From 01d1668436c311127664b7ff96140a88f0b652f8 Mon Sep 17 00:00:00 2001 From: Andrei Baltariu Date: Tue, 28 May 2024 18:34:32 +0300 Subject: [PATCH 001/523] Generated new esdt-safe contract --- enshrine-esdt-safe/Cargo.lock | 2513 +++++++++++++++++ enshrine-esdt-safe/Cargo.toml | 24 + enshrine-esdt-safe/meta/Cargo.toml | 12 + enshrine-esdt-safe/meta/src/main.rs | 3 + enshrine-esdt-safe/multiversx.json | 3 + .../scenarios/enshrine_esdt_safe.scen.json | 39 + enshrine-esdt-safe/src/enshrine_esdt_safe.rs | 14 + .../enshrine_esdt_safe_scenario_go_test.rs | 10 + .../enshrine_esdt_safe_scenario_rs_test.rs | 13 + enshrine-esdt-safe/wasm/Cargo.lock | 188 ++ enshrine-esdt-safe/wasm/Cargo.toml | 34 + enshrine-esdt-safe/wasm/src/lib.rs | 26 + 12 files changed, 2879 insertions(+) create mode 100644 enshrine-esdt-safe/Cargo.lock create mode 100644 enshrine-esdt-safe/Cargo.toml create mode 100644 enshrine-esdt-safe/meta/Cargo.toml create mode 100644 enshrine-esdt-safe/meta/src/main.rs create mode 100644 enshrine-esdt-safe/multiversx.json create mode 100644 enshrine-esdt-safe/scenarios/enshrine_esdt_safe.scen.json create mode 100644 enshrine-esdt-safe/src/enshrine_esdt_safe.rs create mode 100644 enshrine-esdt-safe/tests/enshrine_esdt_safe_scenario_go_test.rs create mode 100644 enshrine-esdt-safe/tests/enshrine_esdt_safe_scenario_rs_test.rs create mode 100644 enshrine-esdt-safe/wasm/Cargo.lock create mode 100644 enshrine-esdt-safe/wasm/Cargo.toml create mode 100644 enshrine-esdt-safe/wasm/src/lib.rs diff --git a/enshrine-esdt-safe/Cargo.lock b/enshrine-esdt-safe/Cargo.lock new file mode 100644 index 00000000..26567031 --- /dev/null +++ b/enshrine-esdt-safe/Cargo.lock @@ -0,0 +1,2513 @@ +# This file is automatically @generated by Cargo. +# It is not intended for manual editing. +version = 3 + +[[package]] +name = "Inflector" +version = "0.11.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fe438c63458706e03479442743baae6c88256498e6431708f6dfc520a26515d3" +dependencies = [ + "lazy_static", + "regex", +] + +[[package]] +name = "addr2line" +version = "0.22.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6e4503c46a5c0c7844e948c9a4d6acd9f50cccb4de1c48eb9e291ea17470c678" +dependencies = [ + "gimli", +] + +[[package]] +name = "adler" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f26201604c87b1e01bd3d98f8d5d9a8fcbb815e8cedb41ffccbeb4bf593a35fe" + +[[package]] +name = "ahash" +version = "0.8.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e89da841a80418a9b391ebaea17f5c112ffaaa96f621d2c285b5174da76b9011" +dependencies = [ + "cfg-if", + "once_cell", + "version_check", + "zerocopy", +] + +[[package]] +name = "aho-corasick" +version = "1.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8e60d3430d3a69478ad0993f19238d2df97c507009a52b3c10addcd7f6bcb916" +dependencies = [ + "memchr", +] + +[[package]] +name = "anstream" +version = "0.6.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "418c75fa768af9c03be99d17643f93f79bbba589895012a80e3452a19ddda15b" +dependencies = [ + "anstyle", + "anstyle-parse", + "anstyle-query", + "anstyle-wincon", + "colorchoice", + "is_terminal_polyfill", + "utf8parse", +] + +[[package]] +name = "anstyle" +version = "1.0.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "038dfcf04a5feb68e9c60b21c9625a54c2c0616e79b72b0fd87075a056ae1d1b" + +[[package]] +name = "anstyle-parse" +version = "0.2.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c03a11a9034d92058ceb6ee011ce58af4a9bf61491aa7e1e59ecd24bd40d22d4" +dependencies = [ + "utf8parse", +] + +[[package]] +name = "anstyle-query" +version = "1.0.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a64c907d4e79225ac72e2a354c9ce84d50ebb4586dee56c82b3ee73004f537f5" +dependencies = [ + "windows-sys 0.52.0", +] + +[[package]] +name = "anstyle-wincon" +version = "3.0.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "61a38449feb7068f52bb06c12759005cf459ee52bb4adc1d5a7c4322d716fb19" +dependencies = [ + "anstyle", + "windows-sys 0.52.0", +] + +[[package]] +name = "anyhow" +version = "1.0.86" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b3d1d046238990b9cf5bcde22a3fb3584ee5cf65fb2765f454ed428c7a0063da" + +[[package]] +name = "arbitrary" +version = "1.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7d5a26814d8dcb93b0e5a0ff3c6d80a8843bafb21b39e8e18a6f05471870e110" +dependencies = [ + "derive_arbitrary", +] + +[[package]] +name = "arrayvec" +version = "0.7.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "96d30a06541fbafbc7f82ed10c06164cfbd2c401138f6addd8404629c4b16711" + +[[package]] +name = "atomic-waker" +version = "1.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1505bd5d3d116872e7271a6d4e16d81d0c8570876c8de68093a09ac269d8aac0" + +[[package]] +name = "autocfg" +version = "1.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0c4b4d0bd25bd0b74681c0ad21497610ce1b7c91b1022cd21c80c6fbdd9476b0" + +[[package]] +name = "backtrace" +version = "0.3.72" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "17c6a35df3749d2e8bb1b7b21a976d82b15548788d2735b9d82f329268f71a11" +dependencies = [ + "addr2line", + "cc", + "cfg-if", + "libc", + "miniz_oxide", + "object", + "rustc-demangle", +] + +[[package]] +name = "base64" +version = "0.22.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "72b3254f16251a8381aa12e40e3c4d2f0199f8c6508fbecb9d91f575e0fbb8c6" + +[[package]] +name = "bech32" +version = "0.9.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d86b93f97252c47b41663388e6d155714a9d0c398b99f1005cbc5f978b29f445" + +[[package]] +name = "bip39" +version = "2.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "93f2635620bf0b9d4576eb7bb9a38a55df78bd1205d26fa994b25911a69f212f" +dependencies = [ + "bitcoin_hashes", + "rand 0.8.5", + "rand_core 0.6.4", + "serde", + "unicode-normalization", +] + +[[package]] +name = "bitcoin_hashes" +version = "0.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "90064b8dee6815a6470d60bad07bbbaee885c0e12d04177138fa3291a01b7bc4" + +[[package]] +name = "bitflags" +version = "1.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" + +[[package]] +name = "bitflags" +version = "2.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cf4b9d6a944f767f8e5e0db018570623c85f3d925ac718db4e06d0187adb21c1" + +[[package]] +name = "block-buffer" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4152116fd6e9dadb291ae18fc1ec3575ed6d84c29642d97890f4b4a3417297e4" +dependencies = [ + "generic-array", +] + +[[package]] +name = "block-buffer" +version = "0.10.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3078c7629b62d3f0439517fa394996acacc5cbc91c5a20d8c658e77abd503a71" +dependencies = [ + "generic-array", +] + +[[package]] +name = "bstr" +version = "1.9.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "05efc5cfd9110c8416e471df0e96702d58690178e206e61b7173706673c93706" +dependencies = [ + "memchr", + "serde", +] + +[[package]] +name = "bumpalo" +version = "3.16.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "79296716171880943b8470b5f8d03aa55eb2e645a4874bdbb28adb49162e012c" + +[[package]] +name = "byteorder" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1fd0f2584146f6f2ef48085050886acf353beff7305ebd1ae69500e27c67f64b" + +[[package]] +name = "bytes" +version = "1.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "514de17de45fdb8dc022b1a7975556c53c86f9f0aa5f534b98977b171857c2c9" + +[[package]] +name = "cc" +version = "1.0.98" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "41c270e7540d725e65ac7f1b212ac8ce349719624d7bcff99f8e2e488e8cf03f" + +[[package]] +name = "cfg-if" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" + +[[package]] +name = "clap" +version = "4.5.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "90bc066a67923782aa8515dbaea16946c5bcc5addbd668bb80af688e53e548a0" +dependencies = [ + "clap_builder", + "clap_derive", +] + +[[package]] +name = "clap_builder" +version = "4.5.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ae129e2e766ae0ec03484e609954119f123cc1fe650337e155d03b022f24f7b4" +dependencies = [ + "anstream", + "anstyle", + "clap_lex", + "strsim", +] + +[[package]] +name = "clap_derive" +version = "4.5.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "528131438037fd55894f62d6e9f068b8f45ac57ffa77517819645d10aed04f64" +dependencies = [ + "heck", + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "clap_lex" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "98cc8fbded0c607b7ba9dd60cd98df59af97e84d24e49c8557331cfc26d301ce" + +[[package]] +name = "colorchoice" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0b6a852b24ab71dffc585bcb46eaf7959d175cb865a7152e35b348d1b2960422" + +[[package]] +name = "colored" +version = "2.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cbf2150cce219b664a8a70df7a1f933836724b503f8a413af9365b4dcc4d90b8" +dependencies = [ + "lazy_static", + "windows-sys 0.48.0", +] + +[[package]] +name = "common-path" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2382f75942f4b3be3690fe4f86365e9c853c1587d6ee58212cebf6e2a9ccd101" + +[[package]] +name = "convert_case" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ec182b0ca2f35d8fc196cf3404988fd8b8c739a4d270ff118a398feb0cbec1ca" +dependencies = [ + "unicode-segmentation", +] + +[[package]] +name = "copy_dir" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "543d1dd138ef086e2ff05e3a48cf9da045da2033d16f8538fd76b86cd49b2ca3" +dependencies = [ + "walkdir", +] + +[[package]] +name = "core-foundation" +version = "0.9.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "91e195e091a93c46f7102ec7818a2aa394e1e1771c3ab4825963fa03e45afb8f" +dependencies = [ + "core-foundation-sys", + "libc", +] + +[[package]] +name = "core-foundation-sys" +version = "0.8.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "06ea2b9bc92be3c2baa9334a323ebca2d6f074ff852cd1d7b11064035cd3868f" + +[[package]] +name = "cpufeatures" +version = "0.2.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "53fe5e26ff1b7aef8bca9c6080520cfb8d9333c7568e1829cef191a9723e5504" +dependencies = [ + "libc", +] + +[[package]] +name = "crc32fast" +version = "1.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a97769d94ddab943e4510d138150169a2758b5ef3eb191a9ee688de3e23ef7b3" +dependencies = [ + "cfg-if", +] + +[[package]] +name = "crossbeam-deque" +version = "0.8.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "613f8cc01fe9cf1a3eb3d7f488fd2fa8388403e97039e2f73692932e291a770d" +dependencies = [ + "crossbeam-epoch", + "crossbeam-utils", +] + +[[package]] +name = "crossbeam-epoch" +version = "0.9.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5b82ac4a3c2ca9c3460964f020e1402edd5753411d7737aa39c3714ad1b5420e" +dependencies = [ + "crossbeam-utils", +] + +[[package]] +name = "crossbeam-utils" +version = "0.8.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "22ec99545bb0ed0ea7bb9b8e1e9122ea386ff8a48c0922e43f36d45ab09e0e80" + +[[package]] +name = "crypto-common" +version = "0.1.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1bfb12502f3fc46cca1bb51ac28df9d618d813cdc3d2f25b9fe775a34af26bb3" +dependencies = [ + "generic-array", + "typenum", +] + +[[package]] +name = "curve25519-dalek" +version = "3.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0b9fdf9972b2bd6af2d913799d9ebc165ea4d2e65878e329d9c6b372c4491b61" +dependencies = [ + "byteorder", + "digest 0.9.0", + "rand_core 0.5.1", + "subtle", + "zeroize", +] + +[[package]] +name = "derive_arbitrary" +version = "1.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "67e77553c4162a157adbf834ebae5b415acbecbeafc7a74b0e886657506a7611" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "digest" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d3dd60d1080a57a05ab032377049e0591415d2b31afd7028356dbf3cc6dcb066" +dependencies = [ + "generic-array", +] + +[[package]] +name = "digest" +version = "0.10.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9ed9a281f7bc9b7576e61468ba615a66a5c8cfdff42420a70aa82701a3b1e292" +dependencies = [ + "block-buffer 0.10.4", + "crypto-common", + "subtle", +] + +[[package]] +name = "displaydoc" +version = "0.2.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "487585f4d0c6655fe74905e2504d8ad6908e4db67f744eb140876906c2f3175d" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "ed25519" +version = "1.5.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "91cff35c70bba8a626e3185d8cd48cc11b5437e1a5bcd15b9b5fa3c64b6dfee7" +dependencies = [ + "signature", +] + +[[package]] +name = "ed25519-dalek" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c762bae6dcaf24c4c84667b8579785430908723d5c889f469d76a41d59cc7a9d" +dependencies = [ + "curve25519-dalek", + "ed25519", + "rand 0.7.3", + "serde", + "sha2 0.9.9", + "zeroize", +] + +[[package]] +name = "either" +version = "1.12.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3dca9240753cf90908d7e4aac30f630662b02aebaa1b58a3cadabdb23385b58b" + +[[package]] +name = "encoding_rs" +version = "0.8.34" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b45de904aa0b010bce2ab45264d0631681847fa7b6f2eaa7dab7619943bc4f59" +dependencies = [ + "cfg-if", +] + +[[package]] +name = "endian-type" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c34f04666d835ff5d62e058c3995147c06f42fe86ff053337632bca83e42702d" + +[[package]] +name = "enshrine-esdt-safe" +version = "0.0.0" +dependencies = [ + "multiversx-sc", + "multiversx-sc-scenario", + "num-bigint", +] + +[[package]] +name = "enshrine-esdt-safe-meta" +version = "0.0.0" +dependencies = [ + "enshrine-esdt-safe", + "multiversx-sc-meta", +] + +[[package]] +name = "equivalent" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5443807d6dff69373d433ab9ef5378ad8df50ca6298caf15de6e52e24aaf54d5" + +[[package]] +name = "errno" +version = "0.3.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "534c5cf6194dfab3db3242765c03bbe257cf92f22b38f6bc0c58d59108a820ba" +dependencies = [ + "libc", + "windows-sys 0.52.0", +] + +[[package]] +name = "fastrand" +version = "2.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9fc0510504f03c51ada170672ac806f1f105a88aa97a5281117e1ddc3368e51a" + +[[package]] +name = "flate2" +version = "1.0.30" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5f54427cfd1c7829e2a139fcefea601bf088ebca651d2bf53ebc600eac295dae" +dependencies = [ + "crc32fast", + "miniz_oxide", +] + +[[package]] +name = "fnv" +version = "1.0.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" + +[[package]] +name = "foreign-types" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f6f339eb8adc052cd2ca78910fda869aefa38d22d5cb648e6485e4d3fc06f3b1" +dependencies = [ + "foreign-types-shared", +] + +[[package]] +name = "foreign-types-shared" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "00b0228411908ca8685dba7fc2cdd70ec9990a6e753e89b6ac91a84c40fbaf4b" + +[[package]] +name = "form_urlencoded" +version = "1.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e13624c2627564efccf4934284bdd98cbaa14e79b0b5a141218e507b3a823456" +dependencies = [ + "percent-encoding", +] + +[[package]] +name = "futures-channel" +version = "0.3.30" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "eac8f7d7865dcb88bd4373ab671c8cf4508703796caa2b1985a9ca867b3fcb78" +dependencies = [ + "futures-core", + "futures-sink", +] + +[[package]] +name = "futures-core" +version = "0.3.30" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dfc6580bb841c5a68e9ef15c77ccc837b40a7504914d52e47b8b0e9bbda25a1d" + +[[package]] +name = "futures-io" +version = "0.3.30" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a44623e20b9681a318efdd71c299b6b222ed6f231972bfe2f224ebad6311f0c1" + +[[package]] +name = "futures-sink" +version = "0.3.30" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9fb8e00e87438d937621c1c6269e53f536c14d3fbd6a042bb24879e57d474fb5" + +[[package]] +name = "futures-task" +version = "0.3.30" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "38d84fa142264698cdce1a9f9172cf383a0c82de1bddcf3092901442c4097004" + +[[package]] +name = "futures-util" +version = "0.3.30" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3d6401deb83407ab3da39eba7e33987a73c3df0c82b4bb5813ee871c19c41d48" +dependencies = [ + "futures-core", + "futures-io", + "futures-sink", + "futures-task", + "memchr", + "pin-project-lite", + "pin-utils", + "slab", +] + +[[package]] +name = "generic-array" +version = "0.14.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "85649ca51fd72272d7821adaf274ad91c288277713d9c18820d8499a7ff69e9a" +dependencies = [ + "typenum", + "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.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c4567c8db10ae91089c99af84c68c38da3ec2f087c3f82960bcdbf3656b6f4d7" +dependencies = [ + "cfg-if", + "libc", + "wasi 0.11.0+wasi-snapshot-preview1", +] + +[[package]] +name = "gimli" +version = "0.29.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "40ecd4077b5ae9fd2e9e169b102c6c330d0605168eb0e8bf79952b256dbefffd" + +[[package]] +name = "globset" +version = "0.4.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "57da3b9b5b85bd66f31093f8c408b90a74431672542466497dcbdfdc02034be1" +dependencies = [ + "aho-corasick", + "bstr", + "log", + "regex-automata", + "regex-syntax", +] + +[[package]] +name = "h2" +version = "0.4.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fa82e28a107a8cc405f0839610bdc9b15f1e25ec7d696aa5cf173edbcb1486ab" +dependencies = [ + "atomic-waker", + "bytes", + "fnv", + "futures-core", + "futures-sink", + "http", + "indexmap", + "slab", + "tokio", + "tokio-util", + "tracing", +] + +[[package]] +name = "hashbrown" +version = "0.14.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e5274423e17b7c9fc20b6e7e208532f9b19825d82dfd615708b70edd83df41f1" +dependencies = [ + "ahash", + "serde", +] + +[[package]] +name = "heck" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2304e00983f87ffb38b55b444b5e3b60a884b5d30c0fca7d82fe33449bbe55ea" + +[[package]] +name = "hermit-abi" +version = "0.3.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d231dfb89cfffdbc30e7fc41579ed6066ad03abda9e567ccafae602b97ec5024" + +[[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 = "hmac" +version = "0.12.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6c49c37c09c17a53d937dfbb742eb3a961d65a994e6bcdcf37e7399d0cc8ab5e" +dependencies = [ + "digest 0.10.7", +] + +[[package]] +name = "http" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "21b9ddb458710bc376481b842f5da65cdf31522de232c1ca8146abce2a358258" +dependencies = [ + "bytes", + "fnv", + "itoa", +] + +[[package]] +name = "http-body" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1cac85db508abc24a2e48553ba12a996e87244a0395ce011e62b37158745d643" +dependencies = [ + "bytes", + "http", +] + +[[package]] +name = "http-body-util" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0475f8b2ac86659c21b64320d5d653f9efe42acd2a4e560073ec61a155a34f1d" +dependencies = [ + "bytes", + "futures-core", + "http", + "http-body", + "pin-project-lite", +] + +[[package]] +name = "httparse" +version = "1.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d897f394bad6a705d5f4104762e116a75639e470d80901eed05a860a95cb1904" + +[[package]] +name = "hyper" +version = "1.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fe575dd17d0862a9a33781c8c4696a55c320909004a67a00fb286ba8b1bc496d" +dependencies = [ + "bytes", + "futures-channel", + "futures-util", + "h2", + "http", + "http-body", + "httparse", + "itoa", + "pin-project-lite", + "smallvec", + "tokio", + "want", +] + +[[package]] +name = "hyper-tls" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "70206fc6890eaca9fde8a0bf71caa2ddfc9fe045ac9e5c70df101a7dbde866e0" +dependencies = [ + "bytes", + "http-body-util", + "hyper", + "hyper-util", + "native-tls", + "tokio", + "tokio-native-tls", + "tower-service", +] + +[[package]] +name = "hyper-util" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7b875924a60b96e5d7b9ae7b066540b1dd1cbd90d1828f54c92e02a283351c56" +dependencies = [ + "bytes", + "futures-channel", + "futures-util", + "http", + "http-body", + "hyper", + "pin-project-lite", + "socket2", + "tokio", + "tower", + "tower-service", + "tracing", +] + +[[package]] +name = "idna" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "634d9b1461af396cad843f47fdba5597a4f9e6ddd4bfb6ff5d85028c25cb12f6" +dependencies = [ + "unicode-bidi", + "unicode-normalization", +] + +[[package]] +name = "ignore" +version = "0.4.22" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b46810df39e66e925525d6e38ce1e7f6e1d208f72dc39757880fcb66e2c58af1" +dependencies = [ + "crossbeam-deque", + "globset", + "log", + "memchr", + "regex-automata", + "same-file", + "walkdir", + "winapi-util", +] + +[[package]] +name = "indexmap" +version = "2.2.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "168fb715dda47215e360912c096649d23d58bf392ac62f73919e831745e40f26" +dependencies = [ + "equivalent", + "hashbrown", + "serde", +] + +[[package]] +name = "ipnet" +version = "2.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8f518f335dce6725a761382244631d86cf0ccb2863413590b31338feb467f9c3" + +[[package]] +name = "is_terminal_polyfill" +version = "1.70.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f8478577c03552c21db0e2724ffb8986a5ce7af88107e6be5d2ee6e158c12800" + +[[package]] +name = "itertools" +version = "0.12.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ba291022dbbd398a455acf126c1e341954079855bc60dfdda641363bd6922569" +dependencies = [ + "either", +] + +[[package]] +name = "itoa" +version = "1.0.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "49f1f14873335454500d59611f1cf4a4b0f786f9ac11f4312a78e4cf2566695b" + +[[package]] +name = "js-sys" +version = "0.3.69" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "29c15563dc2726973df627357ce0c9ddddbea194836909d655df6a75d2cf296d" +dependencies = [ + "wasm-bindgen", +] + +[[package]] +name = "keccak" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ecc2af9a1119c51f12a14607e783cb977bde58bc069ff0c3da1095e635d70654" +dependencies = [ + "cpufeatures", +] + +[[package]] +name = "lazy_static" +version = "1.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" + +[[package]] +name = "libc" +version = "0.2.155" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "97b3888a4aecf77e811145cadf6eef5901f4782c53886191b2f693f24761847c" + +[[package]] +name = "linux-raw-sys" +version = "0.4.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "78b3ae25bc7c8c38cec158d1f2757ee79e9b3740fbc7ccf0e59e4b08d793fa89" + +[[package]] +name = "lock_api" +version = "0.4.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "07af8b9cdd281b7915f413fa73f29ebd5d55d0d3f0155584dade1ff18cea1b17" +dependencies = [ + "autocfg", + "scopeguard", +] + +[[package]] +name = "lockfree-object-pool" +version = "0.1.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9374ef4228402d4b7e403e5838cb880d9ee663314b0a900d5a6aabf0c213552e" + +[[package]] +name = "log" +version = "0.4.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "90ed8c1e510134f979dbc4f070f87d4313098b704861a105fe34231c70a3901c" + +[[package]] +name = "memchr" +version = "2.7.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6c8640c5d730cb13ebd907d8d04b52f55ac9a2eec55b440c8892f40d56c76c1d" + +[[package]] +name = "mime" +version = "0.3.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6877bb514081ee2a7ff5ef9de3281f14a4dd4bceac4c09388074a6b5df8a139a" + +[[package]] +name = "miniz_oxide" +version = "0.7.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "87dfd01fe195c66b572b37921ad8803d010623c0aca821bea2302239d155cdae" +dependencies = [ + "adler", +] + +[[package]] +name = "mio" +version = "0.8.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a4a650543ca06a924e8b371db273b2756685faae30f8487da1b56505a8f78b0c" +dependencies = [ + "libc", + "wasi 0.11.0+wasi-snapshot-preview1", + "windows-sys 0.48.0", +] + +[[package]] +name = "multiversx-chain-scenario-format" +version = "0.22.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7a9190bdd56300e801e7793fc4ee7dc0c76c1149aac019da8c71cc58254966fe" +dependencies = [ + "bech32", + "hex", + "num-bigint", + "num-traits", + "serde", + "serde_json", + "sha3", +] + +[[package]] +name = "multiversx-chain-vm" +version = "0.8.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f69520691466bc184475320c27db21137e68be5e959df25c1a14b09e055d0d58" +dependencies = [ + "bitflags 2.5.0", + "colored", + "ed25519-dalek", + "hex", + "hex-literal", + "itertools", + "multiversx-chain-vm-executor", + "num-bigint", + "num-traits", + "rand 0.8.5", + "rand_seeder", + "sha2 0.10.8", + "sha3", +] + +[[package]] +name = "multiversx-chain-vm-executor" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b59072fa0624b55ae5ae3fa6bfa91515bbeb4ac440214bc4a509e2c8806d6e9f" + +[[package]] +name = "multiversx-sc" +version = "0.50.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1d79d1cea2d23e8f2545749c9b31952305b54c415af88b224b985784d3d6529d" +dependencies = [ + "bitflags 2.5.0", + "hex-literal", + "multiversx-sc-codec", + "multiversx-sc-derive", + "num-traits", + "unwrap-infallible", +] + +[[package]] +name = "multiversx-sc-codec" +version = "0.19.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "35c94397b2fba14e40edfa55905b3f453ed57aa06c9b1960ad6a0ca6bfb7a236" +dependencies = [ + "arrayvec", + "multiversx-sc-codec-derive", + "num-bigint", + "unwrap-infallible", +] + +[[package]] +name = "multiversx-sc-codec-derive" +version = "0.19.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cf72a8042da0bc19da0b8f0d4f61b4c66ae853560fefc69cd8fea87bf1aa8c14" +dependencies = [ + "hex", + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "multiversx-sc-derive" +version = "0.50.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "54e6926e181f6306b69aa805b8d24aa33084497e38ac03e37df457456b6757cc" +dependencies = [ + "hex", + "proc-macro2", + "quote", + "radix_trie", + "syn", +] + +[[package]] +name = "multiversx-sc-meta" +version = "0.50.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "07fe6edb214529678c77e82e25d9495b04773d489c441ef49fc19ad0664504f3" +dependencies = [ + "clap", + "colored", + "common-path", + "convert_case", + "copy_dir", + "hex", + "lazy_static", + "multiversx-sc", + "pathdiff", + "reqwest", + "ruplacer", + "rustc_version", + "semver", + "serde", + "serde_json", + "toml", + "wasmparser", + "wasmprinter", + "zip", +] + +[[package]] +name = "multiversx-sc-scenario" +version = "0.50.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3dd07e4626e551c051f3065c0b2b44047d3281c20cdbcef9375aecb5f9fd5307" +dependencies = [ + "base64", + "bech32", + "clap", + "colored", + "hex", + "itertools", + "log", + "multiversx-chain-scenario-format", + "multiversx-chain-vm", + "multiversx-chain-vm-executor", + "multiversx-sc", + "multiversx-sc-meta", + "multiversx-sdk", + "num-bigint", + "num-traits", + "pathdiff", + "serde", + "serde_json", + "sha2 0.10.8", + "tokio", + "unwrap-infallible", +] + +[[package]] +name = "multiversx-sdk" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5cb2f8dd4a17ce9c9fa1ab3d80152929702968be6536499f32bd7e2278c2e0fb" +dependencies = [ + "anyhow", + "base64", + "bech32", + "bip39", + "hex", + "hmac", + "itertools", + "pbkdf2", + "pem", + "rand 0.8.5", + "reqwest", + "serde", + "serde_json", + "serde_repr", + "sha2 0.10.8", + "sha3", + "tokio", + "zeroize", +] + +[[package]] +name = "native-tls" +version = "0.2.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a8614eb2c83d59d1c8cc974dd3f920198647674a0a035e1af1fa58707e317466" +dependencies = [ + "libc", + "log", + "openssl", + "openssl-probe", + "openssl-sys", + "schannel", + "security-framework", + "security-framework-sys", + "tempfile", +] + +[[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-bigint" +version = "0.4.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c165a9ab64cf766f73521c0dd2cfdff64f488b8f0b3e621face3462d3db536d7" +dependencies = [ + "num-integer", + "num-traits", +] + +[[package]] +name = "num-integer" +version = "0.1.46" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7969661fd2958a5cb096e56c8e1ad0444ac2bbcd0061bd28660485a44879858f" +dependencies = [ + "num-traits", +] + +[[package]] +name = "num-traits" +version = "0.2.19" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "071dfc062690e90b734c0b2273ce72ad0ffa95f0c74596bc250dcfd960262841" +dependencies = [ + "autocfg", +] + +[[package]] +name = "num_cpus" +version = "1.16.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4161fcb6d602d4d2081af7c3a45852d875a03dd337a6bfdd6e06407b61342a43" +dependencies = [ + "hermit-abi", + "libc", +] + +[[package]] +name = "object" +version = "0.35.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b8ec7ab813848ba4522158d5517a6093db1ded27575b070f4177b8d12b41db5e" +dependencies = [ + "memchr", +] + +[[package]] +name = "once_cell" +version = "1.19.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3fdb12b2476b595f9358c5161aa467c2438859caa136dec86c26fdd2efe17b92" + +[[package]] +name = "opaque-debug" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c08d65885ee38876c4f86fa503fb49d7b507c2b62552df7c70b2fce627e06381" + +[[package]] +name = "openssl" +version = "0.10.64" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "95a0481286a310808298130d22dd1fef0fa571e05a8f44ec801801e84b216b1f" +dependencies = [ + "bitflags 2.5.0", + "cfg-if", + "foreign-types", + "libc", + "once_cell", + "openssl-macros", + "openssl-sys", +] + +[[package]] +name = "openssl-macros" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a948666b637a0f465e8564c73e89d4dde00d72d4d473cc972f390fc3dcee7d9c" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "openssl-probe" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ff011a302c396a5197692431fc1948019154afc178baf7d8e37367442a4601cf" + +[[package]] +name = "openssl-sys" +version = "0.9.102" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c597637d56fbc83893a35eb0dd04b2b8e7a50c91e64e9493e398b5df4fb45fa2" +dependencies = [ + "cc", + "libc", + "pkg-config", + "vcpkg", +] + +[[package]] +name = "parking_lot" +version = "0.12.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f1bf18183cf54e8d6059647fc3063646a1801cf30896933ec2311622cc4b9a27" +dependencies = [ + "lock_api", + "parking_lot_core", +] + +[[package]] +name = "parking_lot_core" +version = "0.9.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1e401f977ab385c9e4e3ab30627d6f26d00e2c73eef317493c4ec6d468726cf8" +dependencies = [ + "cfg-if", + "libc", + "redox_syscall", + "smallvec", + "windows-targets 0.52.5", +] + +[[package]] +name = "pathdiff" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8835116a5c179084a830efb3adc117ab007512b535bc1a21c991d3b32a6b44dd" + +[[package]] +name = "pbkdf2" +version = "0.12.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f8ed6a7761f76e3b9f92dfb0a60a6a6477c61024b775147ff0973a02653abaf2" +dependencies = [ + "digest 0.10.7", +] + +[[package]] +name = "pem" +version = "3.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8e459365e590736a54c3fa561947c84837534b8e9af6fc5bf781307e82658fae" +dependencies = [ + "base64", + "serde", +] + +[[package]] +name = "percent-encoding" +version = "2.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e3148f5046208a5d56bcfc03053e3ca6334e51da8dfb19b6cdc8b306fae3283e" + +[[package]] +name = "pin-project" +version = "1.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b6bf43b791c5b9e34c3d182969b4abb522f9343702850a2e57f460d00d09b4b3" +dependencies = [ + "pin-project-internal", +] + +[[package]] +name = "pin-project-internal" +version = "1.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2f38a4412a78282e09a2cf38d195ea5420d15ba0602cb375210efbc877243965" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "pin-project-lite" +version = "0.2.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bda66fc9667c18cb2758a2ac84d1167245054bcf85d5d1aaa6923f45801bdd02" + +[[package]] +name = "pin-utils" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184" + +[[package]] +name = "pkg-config" +version = "0.3.30" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d231b230927b5e4ad203db57bbcbee2802f6bce620b1e4a9024a07d94e2907ec" + +[[package]] +name = "ppv-lite86" +version = "0.2.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5b40af805b3121feab8a3c29f04d8ad262fa8e0561883e7653e024ae4479e6de" + +[[package]] +name = "proc-macro2" +version = "1.0.82" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8ad3d49ab951a01fbaafe34f2ec74122942fe18a3f9814c3268f1bb72042131b" +dependencies = [ + "unicode-ident", +] + +[[package]] +name = "quote" +version = "1.0.36" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0fa76aaf39101c457836aec0ce2316dbdc3ab723cdda1c6bd4e6ad4208acaca7" +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 = "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" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "34af8d1a0e25924bc5b7c43c079c942339d8f0a8b57c39049bef581b46327404" +dependencies = [ + "libc", + "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]] +name = "rand_chacha" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e6c10a63a0fa32252be49d21e7709d4d4baf8d231c2dbce1eaa8141b9b127d88" +dependencies = [ + "ppv-lite86", + "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]] +name = "rand_core" +version = "0.6.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c" +dependencies = [ + "getrandom 0.2.15", +] + +[[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]] +name = "rand_seeder" +version = "0.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cf2890aaef0aa82719a50e808de264f9484b74b442e1a3a0e5ee38243ac40bdb" +dependencies = [ + "rand_core 0.6.4", +] + +[[package]] +name = "redox_syscall" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "469052894dcb553421e483e4209ee581a45100d31b4018de03e5a7ad86374a7e" +dependencies = [ + "bitflags 2.5.0", +] + +[[package]] +name = "regex" +version = "1.10.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c117dbdfde9c8308975b6a18d71f3f385c89461f7b3fb054288ecf2a2058ba4c" +dependencies = [ + "aho-corasick", + "memchr", + "regex-automata", + "regex-syntax", +] + +[[package]] +name = "regex-automata" +version = "0.4.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "86b83b8b9847f9bf95ef68afb0b8e6cdb80f498442f5179a29fad448fcc1eaea" +dependencies = [ + "aho-corasick", + "memchr", + "regex-syntax", +] + +[[package]] +name = "regex-syntax" +version = "0.8.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "adad44e29e4c806119491a7f06f03de4d1af22c3a680dd47f1e6e179439d1f56" + +[[package]] +name = "reqwest" +version = "0.12.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "566cafdd92868e0939d3fb961bd0dc25fcfaaed179291093b3d43e6b3150ea10" +dependencies = [ + "base64", + "bytes", + "encoding_rs", + "futures-channel", + "futures-core", + "futures-util", + "h2", + "http", + "http-body", + "http-body-util", + "hyper", + "hyper-tls", + "hyper-util", + "ipnet", + "js-sys", + "log", + "mime", + "native-tls", + "once_cell", + "percent-encoding", + "pin-project-lite", + "rustls-pemfile", + "serde", + "serde_json", + "serde_urlencoded", + "sync_wrapper", + "system-configuration", + "tokio", + "tokio-native-tls", + "tower-service", + "url", + "wasm-bindgen", + "wasm-bindgen-futures", + "web-sys", + "winreg", +] + +[[package]] +name = "ruplacer" +version = "0.8.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "58a26a1b15ff113d31d139357f7422708312978ed69cd5dd47e36d1b80b7eaf3" +dependencies = [ + "Inflector", + "anyhow", + "clap", + "colored", + "ignore", + "regex", +] + +[[package]] +name = "rustc-demangle" +version = "0.1.24" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "719b953e2095829ee67db738b3bfa9fa368c94900df327b3f07fe6e794d2fe1f" + +[[package]] +name = "rustc_version" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bfa0f585226d2e68097d4f95d113b15b83a82e819ab25717ec0590d9584ef366" +dependencies = [ + "semver", +] + +[[package]] +name = "rustix" +version = "0.38.34" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "70dc5ec042f7a43c4a73241207cecc9873a06d45debb38b329f8541d85c2730f" +dependencies = [ + "bitflags 2.5.0", + "errno", + "libc", + "linux-raw-sys", + "windows-sys 0.52.0", +] + +[[package]] +name = "rustls-pemfile" +version = "2.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "29993a25686778eb88d4189742cd713c9bce943bc54251a33509dc63cbacf73d" +dependencies = [ + "base64", + "rustls-pki-types", +] + +[[package]] +name = "rustls-pki-types" +version = "1.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "976295e77ce332211c0d24d92c0e83e50f5c5f046d11082cea19f3df13a3562d" + +[[package]] +name = "ryu" +version = "1.0.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f3cb5ba0dc43242ce17de99c180e96db90b235b8a9fdc9543c96d2209116bd9f" + +[[package]] +name = "same-file" +version = "1.0.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "93fc1dc3aaa9bfed95e02e6eadabb4baf7e3078b0bd1b4d7b6b0b68378900502" +dependencies = [ + "winapi-util", +] + +[[package]] +name = "schannel" +version = "0.1.23" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fbc91545643bcf3a0bbb6569265615222618bdf33ce4ffbbd13c4bbd4c093534" +dependencies = [ + "windows-sys 0.52.0", +] + +[[package]] +name = "scopeguard" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49" + +[[package]] +name = "security-framework" +version = "2.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c627723fd09706bacdb5cf41499e95098555af3c3c29d014dc3c458ef6be11c0" +dependencies = [ + "bitflags 2.5.0", + "core-foundation", + "core-foundation-sys", + "libc", + "security-framework-sys", +] + +[[package]] +name = "security-framework-sys" +version = "2.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "317936bbbd05227752583946b9e66d7ce3b489f84e11a94a510b4437fef407d7" +dependencies = [ + "core-foundation-sys", + "libc", +] + +[[package]] +name = "semver" +version = "1.0.23" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "61697e0a1c7e512e84a621326239844a24d8207b4669b41bc18b32ea5cbf988b" + +[[package]] +name = "serde" +version = "1.0.203" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7253ab4de971e72fb7be983802300c30b5a7f0c2e56fab8abfc6a214307c0094" +dependencies = [ + "serde_derive", +] + +[[package]] +name = "serde_derive" +version = "1.0.203" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "500cbc0ebeb6f46627f50f3f5811ccf6bf00643be300b4c3eabc0ef55dc5b5ba" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "serde_json" +version = "1.0.117" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "455182ea6142b14f93f4bc5320a2b31c1f266b66a4a5c858b013302a5d8cbfc3" +dependencies = [ + "indexmap", + "itoa", + "ryu", + "serde", +] + +[[package]] +name = "serde_repr" +version = "0.1.19" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6c64451ba24fc7a6a2d60fc75dd9c83c90903b19028d4eff35e88fc1e86564e9" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "serde_spanned" +version = "0.6.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "79e674e01f999af37c49f70a6ede167a8a60b2503e56c5599532a65baa5969a0" +dependencies = [ + "serde", +] + +[[package]] +name = "serde_urlencoded" +version = "0.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d3491c14715ca2294c4d6a88f15e84739788c1d030eed8c110436aafdaa2f3fd" +dependencies = [ + "form_urlencoded", + "itoa", + "ryu", + "serde", +] + +[[package]] +name = "sha2" +version = "0.9.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4d58a1e1bf39749807d89cf2d98ac2dfa0ff1cb3faa38fbb64dd88ac8013d800" +dependencies = [ + "block-buffer 0.9.0", + "cfg-if", + "cpufeatures", + "digest 0.9.0", + "opaque-debug", +] + +[[package]] +name = "sha2" +version = "0.10.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "793db75ad2bcafc3ffa7c68b215fee268f537982cd901d132f89c6343f3a3dc8" +dependencies = [ + "cfg-if", + "cpufeatures", + "digest 0.10.7", +] + +[[package]] +name = "sha3" +version = "0.10.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "75872d278a8f37ef87fa0ddbda7802605cb18344497949862c0d4dcb291eba60" +dependencies = [ + "digest 0.10.7", + "keccak", +] + +[[package]] +name = "signal-hook-registry" +version = "1.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a9e9e0b4211b72e7b8b6e85c807d36c212bdb33ea8587f7569562a84df5465b1" +dependencies = [ + "libc", +] + +[[package]] +name = "signature" +version = "1.6.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "74233d3b3b2f6d4b006dc19dee745e73e2a6bfb6f93607cd3b02bd5b00797d7c" + +[[package]] +name = "simd-adler32" +version = "0.3.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d66dc143e6b11c1eddc06d5c423cfc97062865baf299914ab64caa38182078fe" + +[[package]] +name = "slab" +version = "0.4.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8f92a496fb766b417c996b9c5e57daf2f7ad3b0bebe1ccfca4856390e3d3bb67" +dependencies = [ + "autocfg", +] + +[[package]] +name = "smallvec" +version = "1.13.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3c5e1a9a646d36c3599cd173a41282daf47c44583ad367b8e6837255952e5c67" + +[[package]] +name = "socket2" +version = "0.5.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ce305eb0b4296696835b71df73eb912e0f1ffd2556a501fcede6e0c50349191c" +dependencies = [ + "libc", + "windows-sys 0.52.0", +] + +[[package]] +name = "strsim" +version = "0.11.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7da8b5736845d9f2fcb837ea5d9e2628564b3b043a70948a3f0b778838c5fb4f" + +[[package]] +name = "subtle" +version = "2.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "81cdd64d312baedb58e21336b31bc043b77e01cc99033ce76ef539f78e965ebc" + +[[package]] +name = "syn" +version = "2.0.61" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c993ed8ccba56ae856363b1845da7266a7cb78e1d146c8a32d54b45a8b831fc9" +dependencies = [ + "proc-macro2", + "quote", + "unicode-ident", +] + +[[package]] +name = "sync_wrapper" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2047c6ded9c721764247e62cd3b03c09ffc529b2ba5b10ec482ae507a4a70160" + +[[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.10.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "85b77fafb263dd9d05cbeac119526425676db3784113aa9295c88498cbf8bff1" +dependencies = [ + "cfg-if", + "fastrand", + "rustix", + "windows-sys 0.52.0", +] + +[[package]] +name = "thiserror" +version = "1.0.61" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c546c80d6be4bc6a00c0f01730c08df82eaa7a7a61f11d656526506112cc1709" +dependencies = [ + "thiserror-impl", +] + +[[package]] +name = "thiserror-impl" +version = "1.0.61" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "46c3384250002a6d5af4d114f2845d37b57521033f30d5c3f46c4d70e1197533" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "tinyvec" +version = "1.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "87cc5ceb3875bb20c2890005a4e226a4651264a5c75edb2421b52861a0a0cb50" +dependencies = [ + "tinyvec_macros", +] + +[[package]] +name = "tinyvec_macros" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20" + +[[package]] +name = "tokio" +version = "1.37.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1adbebffeca75fcfd058afa480fb6c0b81e165a0323f9c9d39c9697e37c46787" +dependencies = [ + "backtrace", + "bytes", + "libc", + "mio", + "num_cpus", + "parking_lot", + "pin-project-lite", + "signal-hook-registry", + "socket2", + "tokio-macros", + "windows-sys 0.48.0", +] + +[[package]] +name = "tokio-macros" +version = "2.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5b8a1e28f2deaa14e508979454cb3a223b10b938b45af148bc0986de36f1923b" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "tokio-native-tls" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bbae76ab933c85776efabc971569dd6119c580d8f5d448769dec1764bf796ef2" +dependencies = [ + "native-tls", + "tokio", +] + +[[package]] +name = "tokio-util" +version = "0.7.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9cf6b47b3771c49ac75ad09a6162f53ad4b8088b76ac60e8ec1455b31a189fe1" +dependencies = [ + "bytes", + "futures-core", + "futures-sink", + "pin-project-lite", + "tokio", +] + +[[package]] +name = "toml" +version = "0.8.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a4e43f8cc456c9704c851ae29c67e17ef65d2c30017c17a9765b89c382dc8bba" +dependencies = [ + "indexmap", + "serde", + "serde_spanned", + "toml_datetime", + "toml_edit", +] + +[[package]] +name = "toml_datetime" +version = "0.6.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4badfd56924ae69bcc9039335b2e017639ce3f9b001c393c1b2d1ef846ce2cbf" +dependencies = [ + "serde", +] + +[[package]] +name = "toml_edit" +version = "0.22.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c127785850e8c20836d49732ae6abfa47616e60bf9d9f57c43c250361a9db96c" +dependencies = [ + "indexmap", + "serde", + "serde_spanned", + "toml_datetime", + "winnow", +] + +[[package]] +name = "tower" +version = "0.4.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b8fa9be0de6cf49e536ce1851f987bd21a43b771b09473c3549a6c853db37c1c" +dependencies = [ + "futures-core", + "futures-util", + "pin-project", + "pin-project-lite", + "tokio", + "tower-layer", + "tower-service", +] + +[[package]] +name = "tower-layer" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c20c8dbed6283a09604c3e69b4b7eeb54e298b8a600d4d5ecb5ad39de609f1d0" + +[[package]] +name = "tower-service" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b6bc1c9ce2b5135ac7f93c72918fc37feb872bdc6a5533a8b85eb4b86bfdae52" + +[[package]] +name = "tracing" +version = "0.1.40" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c3523ab5a71916ccf420eebdf5521fcef02141234bbc0b8a49f2fdc4544364ef" +dependencies = [ + "pin-project-lite", + "tracing-core", +] + +[[package]] +name = "tracing-core" +version = "0.1.32" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c06d3da6113f116aaee68e4d601191614c9053067f9ab7f6edbcb161237daa54" +dependencies = [ + "once_cell", +] + +[[package]] +name = "try-lock" +version = "0.2.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e421abadd41a4225275504ea4d6566923418b7f05506fbc9c0fe86ba7396114b" + +[[package]] +name = "typenum" +version = "1.17.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "42ff0bf0c66b8238c6f3b578df37d0b7848e55df8577b3f74f92a69acceeb825" + +[[package]] +name = "unicode-bidi" +version = "0.3.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "08f95100a766bf4f8f28f90d77e0a5461bbdb219042e7679bebe79004fed8d75" + +[[package]] +name = "unicode-ident" +version = "1.0.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3354b9ac3fae1ff6755cb6db53683adb661634f67557942dea4facebec0fee4b" + +[[package]] +name = "unicode-normalization" +version = "0.1.22" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5c5713f0fc4b5db668a2ac63cdb7bb4469d8c9fed047b1d0292cc7b0ce2ba921" +dependencies = [ + "tinyvec", +] + +[[package]] +name = "unicode-segmentation" +version = "1.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d4c87d22b6e3f4a18d4d40ef354e97c90fcb14dd91d7dc0aa9d8a1172ebf7202" + +[[package]] +name = "unwrap-infallible" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "151ac09978d3c2862c4e39b557f4eceee2cc72150bc4cb4f16abf061b6e381fb" + +[[package]] +name = "url" +version = "2.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "31e6302e3bb753d46e83516cae55ae196fc0c309407cf11ab35cc51a4c2a4633" +dependencies = [ + "form_urlencoded", + "idna", + "percent-encoding", +] + +[[package]] +name = "utf8parse" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "711b9620af191e0cdc7468a8d14e709c3dcdb115b36f838e601583af800a370a" + +[[package]] +name = "vcpkg" +version = "0.2.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "accd4ea62f7bb7a82fe23066fb0957d48ef677f6eeb8215f372f52e48bb32426" + +[[package]] +name = "version_check" +version = "0.9.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f" + +[[package]] +name = "walkdir" +version = "2.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "29790946404f91d9c5d06f9874efddea1dc06c5efe94541a7d6863108e3a5e4b" +dependencies = [ + "same-file", + "winapi-util", +] + +[[package]] +name = "want" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bfa7760aed19e106de2c7c0b581b509f2f25d3dacaf737cb82ac61bc6d760b0e" +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" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" + +[[package]] +name = "wasm-bindgen" +version = "0.2.92" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4be2531df63900aeb2bca0daaaddec08491ee64ceecbee5076636a3b026795a8" +dependencies = [ + "cfg-if", + "wasm-bindgen-macro", +] + +[[package]] +name = "wasm-bindgen-backend" +version = "0.2.92" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "614d787b966d3989fa7bb98a654e369c762374fd3213d212cfc0251257e747da" +dependencies = [ + "bumpalo", + "log", + "once_cell", + "proc-macro2", + "quote", + "syn", + "wasm-bindgen-shared", +] + +[[package]] +name = "wasm-bindgen-futures" +version = "0.4.42" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "76bc14366121efc8dbb487ab05bcc9d346b3b5ec0eaa76e46594cabbe51762c0" +dependencies = [ + "cfg-if", + "js-sys", + "wasm-bindgen", + "web-sys", +] + +[[package]] +name = "wasm-bindgen-macro" +version = "0.2.92" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a1f8823de937b71b9460c0c34e25f3da88250760bec0ebac694b49997550d726" +dependencies = [ + "quote", + "wasm-bindgen-macro-support", +] + +[[package]] +name = "wasm-bindgen-macro-support" +version = "0.2.92" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e94f17b526d0a461a191c78ea52bbce64071ed5c04c9ffe424dcb38f74171bb7" +dependencies = [ + "proc-macro2", + "quote", + "syn", + "wasm-bindgen-backend", + "wasm-bindgen-shared", +] + +[[package]] +name = "wasm-bindgen-shared" +version = "0.2.92" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "af190c94f2773fdb3729c55b007a722abb5384da03bc0986df4c289bf5567e96" + +[[package]] +name = "wasmparser" +version = "0.208.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dd921789c9dcc495f589cb37d200155dee65b4a4beeb853323b5e24e0a5f9c58" +dependencies = [ + "ahash", + "bitflags 2.5.0", + "hashbrown", + "indexmap", + "semver", + "serde", +] + +[[package]] +name = "wasmprinter" +version = "0.208.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0700bdace4821e6c694617938500ae9999946df464bb13219c16570f8b6f202f" +dependencies = [ + "anyhow", + "wasmparser", +] + +[[package]] +name = "web-sys" +version = "0.3.69" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "77afa9a11836342370f4817622a2f0f418b134426d91a82dfb48f532d2ec13ef" +dependencies = [ + "js-sys", + "wasm-bindgen", +] + +[[package]] +name = "winapi-util" +version = "0.1.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4d4cc384e1e73b93bafa6fb4f1df8c41695c8a91cf9c4c64358067d15a7b6c6b" +dependencies = [ + "windows-sys 0.52.0", +] + +[[package]] +name = "windows-sys" +version = "0.48.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "677d2418bec65e3338edb076e806bc1ec15693c5d0104683f2efe857f61056a9" +dependencies = [ + "windows-targets 0.48.5", +] + +[[package]] +name = "windows-sys" +version = "0.52.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "282be5f36a8ce781fad8c8ae18fa3f9beff57ec1b52cb3de0789201425d9a33d" +dependencies = [ + "windows-targets 0.52.5", +] + +[[package]] +name = "windows-targets" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9a2fa6e2155d7247be68c096456083145c183cbbbc2764150dda45a87197940c" +dependencies = [ + "windows_aarch64_gnullvm 0.48.5", + "windows_aarch64_msvc 0.48.5", + "windows_i686_gnu 0.48.5", + "windows_i686_msvc 0.48.5", + "windows_x86_64_gnu 0.48.5", + "windows_x86_64_gnullvm 0.48.5", + "windows_x86_64_msvc 0.48.5", +] + +[[package]] +name = "windows-targets" +version = "0.52.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6f0713a46559409d202e70e28227288446bf7841d3211583a4b53e3f6d96e7eb" +dependencies = [ + "windows_aarch64_gnullvm 0.52.5", + "windows_aarch64_msvc 0.52.5", + "windows_i686_gnu 0.52.5", + "windows_i686_gnullvm", + "windows_i686_msvc 0.52.5", + "windows_x86_64_gnu 0.52.5", + "windows_x86_64_gnullvm 0.52.5", + "windows_x86_64_msvc 0.52.5", +] + +[[package]] +name = "windows_aarch64_gnullvm" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2b38e32f0abccf9987a4e3079dfb67dcd799fb61361e53e2882c3cbaf0d905d8" + +[[package]] +name = "windows_aarch64_gnullvm" +version = "0.52.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7088eed71e8b8dda258ecc8bac5fb1153c5cffaf2578fc8ff5d61e23578d3263" + +[[package]] +name = "windows_aarch64_msvc" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dc35310971f3b2dbbf3f0690a219f40e2d9afcf64f9ab7cc1be722937c26b4bc" + +[[package]] +name = "windows_aarch64_msvc" +version = "0.52.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9985fd1504e250c615ca5f281c3f7a6da76213ebd5ccc9561496568a2752afb6" + +[[package]] +name = "windows_i686_gnu" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a75915e7def60c94dcef72200b9a8e58e5091744960da64ec734a6c6e9b3743e" + +[[package]] +name = "windows_i686_gnu" +version = "0.52.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "88ba073cf16d5372720ec942a8ccbf61626074c6d4dd2e745299726ce8b89670" + +[[package]] +name = "windows_i686_gnullvm" +version = "0.52.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "87f4261229030a858f36b459e748ae97545d6f1ec60e5e0d6a3d32e0dc232ee9" + +[[package]] +name = "windows_i686_msvc" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8f55c233f70c4b27f66c523580f78f1004e8b5a8b659e05a4eb49d4166cca406" + +[[package]] +name = "windows_i686_msvc" +version = "0.52.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "db3c2bf3d13d5b658be73463284eaf12830ac9a26a90c717b7f771dfe97487bf" + +[[package]] +name = "windows_x86_64_gnu" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "53d40abd2583d23e4718fddf1ebec84dbff8381c07cae67ff7768bbf19c6718e" + +[[package]] +name = "windows_x86_64_gnu" +version = "0.52.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4e4246f76bdeff09eb48875a0fd3e2af6aada79d409d33011886d3e1581517d9" + +[[package]] +name = "windows_x86_64_gnullvm" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0b7b52767868a23d5bab768e390dc5f5c55825b6d30b86c844ff2dc7414044cc" + +[[package]] +name = "windows_x86_64_gnullvm" +version = "0.52.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "852298e482cd67c356ddd9570386e2862b5673c85bd5f88df9ab6802b334c596" + +[[package]] +name = "windows_x86_64_msvc" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ed94fce61571a4006852b7389a063ab983c02eb1bb37b47f8272ce92d06d9538" + +[[package]] +name = "windows_x86_64_msvc" +version = "0.52.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bec47e5bfd1bff0eeaf6d8b485cc1074891a197ab4225d504cb7a1ab88b02bf0" + +[[package]] +name = "winnow" +version = "0.6.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c3c52e9c97a68071b23e836c9380edae937f17b9c4667bd021973efc689f618d" +dependencies = [ + "memchr", +] + +[[package]] +name = "winreg" +version = "0.52.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a277a57398d4bfa075df44f501a17cfdf8542d224f0d36095a2adc7aee4ef0a5" +dependencies = [ + "cfg-if", + "windows-sys 0.48.0", +] + +[[package]] +name = "zerocopy" +version = "0.7.34" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ae87e3fcd617500e5d106f0380cf7b77f3c6092aae37191433159dda23cfb087" +dependencies = [ + "zerocopy-derive", +] + +[[package]] +name = "zerocopy-derive" +version = "0.7.34" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "15e934569e47891f7d9411f1a451d947a60e000ab3bd24fbb970f000387d1b3b" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "zeroize" +version = "1.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ced3678a2879b30306d323f4542626697a464a97c0a07c9aebf7ebca65cd4dde" +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", +] + +[[package]] +name = "zip" +version = "2.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1dd56a4d5921bc2f99947ac5b3abe5f510b1be7376fdc5e9fce4a23c6a93e87c" +dependencies = [ + "arbitrary", + "crc32fast", + "crossbeam-utils", + "displaydoc", + "flate2", + "indexmap", + "memchr", + "thiserror", + "zopfli", +] + +[[package]] +name = "zopfli" +version = "0.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e5019f391bac5cf252e93bbcc53d039ffd62c7bfb7c150414d61369afe57e946" +dependencies = [ + "bumpalo", + "crc32fast", + "lockfree-object-pool", + "log", + "once_cell", + "simd-adler32", +] diff --git a/enshrine-esdt-safe/Cargo.toml b/enshrine-esdt-safe/Cargo.toml new file mode 100644 index 00000000..0bab0191 --- /dev/null +++ b/enshrine-esdt-safe/Cargo.toml @@ -0,0 +1,24 @@ +[package] +name = "enshrine-esdt-safe" +version = "0.0.0" +authors = ["you"] +edition = "2021" +publish = false + +[lib] +path = "src/enshrine_esdt_safe.rs" + +[dependencies.multiversx-sc] +version = "0.50.3" + +[dev-dependencies] +num-bigint = "0.4" + +[dev-dependencies.multiversx-sc-scenario] +version = "0.50.3" + +[workspace] +members = [ + ".", + "meta", +] diff --git a/enshrine-esdt-safe/meta/Cargo.toml b/enshrine-esdt-safe/meta/Cargo.toml new file mode 100644 index 00000000..8fb28e65 --- /dev/null +++ b/enshrine-esdt-safe/meta/Cargo.toml @@ -0,0 +1,12 @@ +[package] +name = "enshrine-esdt-safe-meta" +version = "0.0.0" +edition = "2021" +publish = false + +[dependencies.enshrine-esdt-safe] +path = ".." + +[dependencies.multiversx-sc-meta] +version = "0.50.3" +default-features = false diff --git a/enshrine-esdt-safe/meta/src/main.rs b/enshrine-esdt-safe/meta/src/main.rs new file mode 100644 index 00000000..7efe7900 --- /dev/null +++ b/enshrine-esdt-safe/meta/src/main.rs @@ -0,0 +1,3 @@ +fn main() { + multiversx_sc_meta::cli_main::(); +} diff --git a/enshrine-esdt-safe/multiversx.json b/enshrine-esdt-safe/multiversx.json new file mode 100644 index 00000000..73655396 --- /dev/null +++ b/enshrine-esdt-safe/multiversx.json @@ -0,0 +1,3 @@ +{ + "language": "rust" +} \ No newline at end of file diff --git a/enshrine-esdt-safe/scenarios/enshrine_esdt_safe.scen.json b/enshrine-esdt-safe/scenarios/enshrine_esdt_safe.scen.json new file mode 100644 index 00000000..96aeb668 --- /dev/null +++ b/enshrine-esdt-safe/scenarios/enshrine_esdt_safe.scen.json @@ -0,0 +1,39 @@ +{ + "name": "empty", + "steps": [ + { + "step": "setState", + "accounts": { + "address:owner": { + "nonce": "1", + "balance": "0" + } + }, + "newAddresses": [ + { + "creatorAddress": "address:owner", + "creatorNonce": "1", + "newAddress": "sc:empty" + } + ] + }, + { + "step": "scDeploy", + "id": "deploy", + "tx": { + "from": "address:owner", + "contractCode": "mxsc:../output/enshrine-esdt-safe.mxsc.json", + "arguments": [], + "gasLimit": "5,000,000", + "gasPrice": "0" + }, + "expect": { + "out": [], + "status": "", + "logs": [], + "gas": "*", + "refund": "*" + } + } + ] +} diff --git a/enshrine-esdt-safe/src/enshrine_esdt_safe.rs b/enshrine-esdt-safe/src/enshrine_esdt_safe.rs new file mode 100644 index 00000000..05d8d57b --- /dev/null +++ b/enshrine-esdt-safe/src/enshrine_esdt_safe.rs @@ -0,0 +1,14 @@ +#![no_std] + +#[allow(unused_imports)] +use multiversx_sc::imports::*; + +/// An empty contract. To be used as a template when starting a new contract from scratch. +#[multiversx_sc::contract] +pub trait EnshrineEsdtSafe { + #[init] + fn init(&self) {} + + #[upgrade] + fn upgrade(&self) {} +} diff --git a/enshrine-esdt-safe/tests/enshrine_esdt_safe_scenario_go_test.rs b/enshrine-esdt-safe/tests/enshrine_esdt_safe_scenario_go_test.rs new file mode 100644 index 00000000..18b3d1e7 --- /dev/null +++ b/enshrine-esdt-safe/tests/enshrine_esdt_safe_scenario_go_test.rs @@ -0,0 +1,10 @@ +use multiversx_sc_scenario::*; + +fn world() -> ScenarioWorld { + ScenarioWorld::vm_go() +} + +#[test] +fn empty_go() { + world().run("scenarios/enshrine_esdt_safe.scen.json"); +} diff --git a/enshrine-esdt-safe/tests/enshrine_esdt_safe_scenario_rs_test.rs b/enshrine-esdt-safe/tests/enshrine_esdt_safe_scenario_rs_test.rs new file mode 100644 index 00000000..6837feb6 --- /dev/null +++ b/enshrine-esdt-safe/tests/enshrine_esdt_safe_scenario_rs_test.rs @@ -0,0 +1,13 @@ +use multiversx_sc_scenario::*; + +fn world() -> ScenarioWorld { + let mut blockchain = ScenarioWorld::new(); + + blockchain.register_contract("mxsc:output/enshrine-esdt-safe.mxsc.json", enshrine_esdt_safe::ContractBuilder); + blockchain +} + +#[test] +fn empty_rs() { + world().run("scenarios/enshrine_esdt_safe.scen.json"); +} diff --git a/enshrine-esdt-safe/wasm/Cargo.lock b/enshrine-esdt-safe/wasm/Cargo.lock new file mode 100644 index 00000000..58d5eb46 --- /dev/null +++ b/enshrine-esdt-safe/wasm/Cargo.lock @@ -0,0 +1,188 @@ +# 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.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cf4b9d6a944f767f8e5e0db018570623c85f3d925ac718db4e06d0187adb21c1" + +[[package]] +name = "endian-type" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c34f04666d835ff5d62e058c3995147c06f42fe86ff053337632bca83e42702d" + +[[package]] +name = "enshrine-esdt-safe" +version = "0.0.0" +dependencies = [ + "multiversx-sc", +] + +[[package]] +name = "enshrine-esdt-safe-wasm" +version = "0.0.0" +dependencies = [ + "enshrine-esdt-safe", + "multiversx-sc-wasm-adapter", +] + +[[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.50.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1d79d1cea2d23e8f2545749c9b31952305b54c415af88b224b985784d3d6529d" +dependencies = [ + "bitflags", + "hex-literal", + "multiversx-sc-codec", + "multiversx-sc-derive", + "num-traits", + "unwrap-infallible", +] + +[[package]] +name = "multiversx-sc-codec" +version = "0.19.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "35c94397b2fba14e40edfa55905b3f453ed57aa06c9b1960ad6a0ca6bfb7a236" +dependencies = [ + "arrayvec", + "multiversx-sc-codec-derive", + "unwrap-infallible", +] + +[[package]] +name = "multiversx-sc-codec-derive" +version = "0.19.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cf72a8042da0bc19da0b8f0d4f61b4c66ae853560fefc69cd8fea87bf1aa8c14" +dependencies = [ + "hex", + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "multiversx-sc-derive" +version = "0.50.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "54e6926e181f6306b69aa805b8d24aa33084497e38ac03e37df457456b6757cc" +dependencies = [ + "hex", + "proc-macro2", + "quote", + "radix_trie", + "syn", +] + +[[package]] +name = "multiversx-sc-wasm-adapter" +version = "0.50.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4350e286afce68bb2448d30572f68dd344b2e98e160404dd7f7d13f185e7acfd" +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.19" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "071dfc062690e90b734c0b2273ce72ad0ffa95f0c74596bc250dcfd960262841" +dependencies = [ + "autocfg", +] + +[[package]] +name = "proc-macro2" +version = "1.0.82" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8ad3d49ab951a01fbaafe34f2ec74122942fe18a3f9814c3268f1bb72042131b" +dependencies = [ + "unicode-ident", +] + +[[package]] +name = "quote" +version = "1.0.36" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0fa76aaf39101c457836aec0ce2316dbdc3ab723cdda1c6bd4e6ad4208acaca7" +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.61" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c993ed8ccba56ae856363b1845da7266a7cb78e1d146c8a32d54b45a8b831fc9" +dependencies = [ + "proc-macro2", + "quote", + "unicode-ident", +] + +[[package]] +name = "unicode-ident" +version = "1.0.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3354b9ac3fae1ff6755cb6db53683adb661634f67557942dea4facebec0fee4b" + +[[package]] +name = "unwrap-infallible" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "151ac09978d3c2862c4e39b557f4eceee2cc72150bc4cb4f16abf061b6e381fb" diff --git a/enshrine-esdt-safe/wasm/Cargo.toml b/enshrine-esdt-safe/wasm/Cargo.toml new file mode 100644 index 00000000..93cdce49 --- /dev/null +++ b/enshrine-esdt-safe/wasm/Cargo.toml @@ -0,0 +1,34 @@ +# Code generated by the multiversx-sc build system. DO NOT EDIT. + +# ########################################## +# ############## AUTO-GENERATED ############# +# ########################################## + +[package] +name = "enshrine-esdt-safe-wasm" +version = "0.0.0" +edition = "2021" +publish = false + +[lib] +crate-type = ["cdylib"] + +[profile.release] +codegen-units = 1 +opt-level = "z" +lto = true +debug = false +panic = "abort" +overflow-checks = false + +[profile.dev] +panic = "abort" + +[dependencies.enshrine-esdt-safe] +path = ".." + +[dependencies.multiversx-sc-wasm-adapter] +version = "0.50.3" + +[workspace] +members = ["."] diff --git a/enshrine-esdt-safe/wasm/src/lib.rs b/enshrine-esdt-safe/wasm/src/lib.rs new file mode 100644 index 00000000..cace3b85 --- /dev/null +++ b/enshrine-esdt-safe/wasm/src/lib.rs @@ -0,0 +1,26 @@ +// Code generated by the multiversx-sc build system. DO NOT EDIT. + +//////////////////////////////////////////////////// +////////////////// AUTO-GENERATED ////////////////// +//////////////////////////////////////////////////// + +// Init: 1 +// Upgrade: 1 +// Endpoints: 0 +// Async Callback (empty): 1 +// Total number of exported functions: 3 + +#![no_std] + +multiversx_sc_wasm_adapter::allocator!(); +multiversx_sc_wasm_adapter::panic_handler!(); + +multiversx_sc_wasm_adapter::endpoints! { + enshrine_esdt_safe + ( + init => init + upgrade => upgrade + ) +} + +multiversx_sc_wasm_adapter::async_callback_empty! {} From a9c319418b31897c8c25bf6802af10739bba8d96 Mon Sep 17 00:00:00 2001 From: Andrei Baltariu Date: Wed, 5 Jun 2024 14:03:49 +0300 Subject: [PATCH 002/523] Copied logic from original esdt contract --- Cargo.lock | 29 ++ Cargo.toml | 2 + enshrine-esdt-safe/Cargo.toml | 46 ++- enshrine-esdt-safe/src/enshrine_esdt_safe.rs | 14 - .../src/from_sovereign/events.rs | 11 + enshrine-esdt-safe/src/from_sovereign/mod.rs | 4 + .../src/from_sovereign/refund.rs | 105 +++++ .../src/from_sovereign/token_mapping.rs | 154 ++++++++ .../src/from_sovereign/transfer_tokens.rs | 327 ++++++++++++++++ enshrine-esdt-safe/src/lib.rs | 95 +++++ .../src/to_sovereign/create_tx.rs | 364 ++++++++++++++++++ enshrine-esdt-safe/src/to_sovereign/events.rs | 26 ++ enshrine-esdt-safe/src/to_sovereign/mod.rs | 4 + enshrine-esdt-safe/src/to_sovereign/refund.rs | 55 +++ .../src/to_sovereign/set_tx_status.rs | 71 ++++ enshrine-esdt-safe/wasm/Cargo.lock | 109 ++++++ enshrine-esdt-safe/wasm/Cargo.toml | 2 +- enshrine-esdt-safe/wasm/src/lib.rs | 49 ++- 18 files changed, 1438 insertions(+), 29 deletions(-) delete mode 100644 enshrine-esdt-safe/src/enshrine_esdt_safe.rs create mode 100644 enshrine-esdt-safe/src/from_sovereign/events.rs create mode 100644 enshrine-esdt-safe/src/from_sovereign/mod.rs create mode 100644 enshrine-esdt-safe/src/from_sovereign/refund.rs create mode 100644 enshrine-esdt-safe/src/from_sovereign/token_mapping.rs create mode 100644 enshrine-esdt-safe/src/from_sovereign/transfer_tokens.rs create mode 100644 enshrine-esdt-safe/src/lib.rs create mode 100644 enshrine-esdt-safe/src/to_sovereign/create_tx.rs create mode 100644 enshrine-esdt-safe/src/to_sovereign/events.rs create mode 100644 enshrine-esdt-safe/src/to_sovereign/mod.rs create mode 100644 enshrine-esdt-safe/src/to_sovereign/refund.rs create mode 100644 enshrine-esdt-safe/src/to_sovereign/set_tx_status.rs diff --git a/Cargo.lock b/Cargo.lock index ac13d76a..64b07df3 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -534,6 +534,35 @@ version = "0.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c34f04666d835ff5d62e058c3995147c06f42fe86ff053337632bca83e42702d" +[[package]] +name = "enshrine-esdt-safe" +version = "0.0.0" +dependencies = [ + "bls-signature", + "fee-market", + "header-verifier", + "hex", + "max-bridged-amount-module", + "multiversx-sc", + "multiversx-sc-modules", + "multiversx-sc-scenario", + "num-bigint", + "num-traits", + "setup-phase", + "token-whitelist", + "transaction", + "tx-batch-module", + "utils", +] + +[[package]] +name = "enshrine-esdt-safe-meta" +version = "0.0.0" +dependencies = [ + "enshrine-esdt-safe", + "multiversx-sc-meta", +] + [[package]] name = "equivalent" version = "1.0.1" diff --git a/Cargo.toml b/Cargo.toml index f2d4c760..e539e782 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -14,4 +14,6 @@ members = [ "router-mock/meta", "header-verifier", "header-verifier/meta", + "enshrine-esdt-safe", + "enshrine-esdt-safe/meta" ] diff --git a/enshrine-esdt-safe/Cargo.toml b/enshrine-esdt-safe/Cargo.toml index 0bab0191..334299fb 100644 --- a/enshrine-esdt-safe/Cargo.toml +++ b/enshrine-esdt-safe/Cargo.toml @@ -6,19 +6,45 @@ edition = "2021" publish = false [lib] -path = "src/enshrine_esdt_safe.rs" +path = "src/lib.rs" + +[dependencies.transaction] +path = "../common/transaction" + +[dependencies.tx-batch-module] +path = "../common/tx-batch-module" + +[dependencies.max-bridged-amount-module] +path = "../common/max-bridged-amount-module" + +[dependencies.bls-signature] +path = "../common/bls-signature" + +[dependencies.setup-phase] +path = "../common/setup-phase" + +[dependencies.token-whitelist] +path = "../common/token-whitelist" + +[dependencies.utils] +path = "../common/utils" + +[dependencies.fee-market] +path = "../fee-market" + +[dependencies.header-verifier] +path = "../header-verifier" [dependencies.multiversx-sc] -version = "0.50.3" +version = "=0.50.3" + +[dependencies.multiversx-sc-modules] +version = "=0.50.3" [dev-dependencies] -num-bigint = "0.4" +num-bigint = "0.4.2" +num-traits = "0.2" +hex = "0.4" [dev-dependencies.multiversx-sc-scenario] -version = "0.50.3" - -[workspace] -members = [ - ".", - "meta", -] +version = "=0.50.3" diff --git a/enshrine-esdt-safe/src/enshrine_esdt_safe.rs b/enshrine-esdt-safe/src/enshrine_esdt_safe.rs deleted file mode 100644 index 05d8d57b..00000000 --- a/enshrine-esdt-safe/src/enshrine_esdt_safe.rs +++ /dev/null @@ -1,14 +0,0 @@ -#![no_std] - -#[allow(unused_imports)] -use multiversx_sc::imports::*; - -/// An empty contract. To be used as a template when starting a new contract from scratch. -#[multiversx_sc::contract] -pub trait EnshrineEsdtSafe { - #[init] - fn init(&self) {} - - #[upgrade] - fn upgrade(&self) {} -} diff --git a/enshrine-esdt-safe/src/from_sovereign/events.rs b/enshrine-esdt-safe/src/from_sovereign/events.rs new file mode 100644 index 00000000..ec07f3a7 --- /dev/null +++ b/enshrine-esdt-safe/src/from_sovereign/events.rs @@ -0,0 +1,11 @@ +multiversx_sc::imports!(); + +#[multiversx_sc::module] +pub trait EventsModule { + #[event("executedBridgeOp")] + fn execute_bridge_operation_event( + &self, + #[indexed] hash_of_hashes: ManagedBuffer, + #[indexed] hash_of_bridge_op: ManagedBuffer, + ); +} diff --git a/enshrine-esdt-safe/src/from_sovereign/mod.rs b/enshrine-esdt-safe/src/from_sovereign/mod.rs new file mode 100644 index 00000000..8564e0ab --- /dev/null +++ b/enshrine-esdt-safe/src/from_sovereign/mod.rs @@ -0,0 +1,4 @@ +pub mod events; +pub mod refund; +pub mod token_mapping; +pub mod transfer_tokens; diff --git a/enshrine-esdt-safe/src/from_sovereign/refund.rs b/enshrine-esdt-safe/src/from_sovereign/refund.rs new file mode 100644 index 00000000..8957dc72 --- /dev/null +++ b/enshrine-esdt-safe/src/from_sovereign/refund.rs @@ -0,0 +1,105 @@ +use transaction::{BatchId, OperationEsdtPayment, PaymentsVec, Transaction, TxNonce}; + +multiversx_sc::imports!(); + +const NFT_AMOUNT: u32 = 1; + +pub struct CheckMustRefundArgs<'a, M: ManagedTypeApi> { + pub token: &'a OperationEsdtPayment, + pub roles: EsdtLocalRoleFlags, + pub dest: &'a ManagedAddress, + pub batch_id: BatchId, + pub tx_nonce: TxNonce, + pub sc_address: &'a ManagedAddress, + pub sc_shard: u32, +} + +#[multiversx_sc::module] +pub trait RefundModule: + super::events::EventsModule + + tx_batch_module::TxBatchModule + + max_bridged_amount_module::MaxBridgedAmountModule +{ + fn check_must_refund(&self, args: CheckMustRefundArgs) -> bool { + let token_balance = self.blockchain().get_esdt_balance( + args.sc_address, + &args.token.token_identifier, + args.token.token_nonce, + ); + + if token_balance < args.token.token_data.amount { + if args.token.token_nonce == 0 { + if !args.roles.has_role(&EsdtLocalRole::Mint) { + return true; + } + } else if !self.has_nft_roles(args.token, args.roles) { + return true; + } + } + + if self.is_above_max_amount(&args.token.token_identifier, &args.token.token_data.amount) { + return true; + } + + if self.is_account_same_shard_frozen(args.sc_shard, args.dest, &args.token.token_identifier) + { + return true; + } + + false + } + + fn has_nft_roles( + &self, + payment: &OperationEsdtPayment, + roles: EsdtLocalRoleFlags, + ) -> bool { + if !roles.has_role(&EsdtLocalRole::NftCreate) { + return false; + } + + if payment.token_data.amount > NFT_AMOUNT && !roles.has_role(&EsdtLocalRole::NftAddQuantity) + { + return false; + } + + true + } + + fn is_account_same_shard_frozen( + &self, + sc_shard: u32, + dest_address: &ManagedAddress, + token_id: &TokenIdentifier, + ) -> bool { + let dest_shard = self.blockchain().get_shard_of_address(dest_address); + if sc_shard != dest_shard { + return false; + } + + let token_data = self + .blockchain() + .get_esdt_token_data(dest_address, token_id, 0); + token_data.frozen + } + + fn convert_to_refund_tx( + &self, + sov_tx: Transaction, + tokens_to_refund: PaymentsVec, + ) -> Transaction { + let tx_nonce = self.get_and_save_next_tx_id(); + + // invert from and to + Transaction { + block_nonce: self.blockchain().get_block_nonce(), + nonce: tx_nonce, + from: sov_tx.to, + to: sov_tx.from, + tokens: tokens_to_refund, + token_data: ManagedVec::new(), + opt_transfer_data: None, + is_refund_tx: true, + } + } +} diff --git a/enshrine-esdt-safe/src/from_sovereign/token_mapping.rs b/enshrine-esdt-safe/src/from_sovereign/token_mapping.rs new file mode 100644 index 00000000..fa825d0e --- /dev/null +++ b/enshrine-esdt-safe/src/from_sovereign/token_mapping.rs @@ -0,0 +1,154 @@ +const DEFAULT_ISSUE_COST: u64 = 50000000000000000; +multiversx_sc::imports!(); +multiversx_sc::derive_imports!(); + +#[derive(TopEncode, TopDecode, NestedEncode, NestedDecode, TypeAbi, ManagedVecItem, Clone)] +pub struct EsdtTokenInfo { + pub token_identifier: TokenIdentifier, + pub token_nonce: u64, +} + +#[multiversx_sc::module] +pub trait TokenMappingModule: + multiversx_sc_modules::default_issue_callbacks::DefaultIssueCallbacksModule +{ + #[payable("EGLD")] + #[endpoint(registerToken)] + fn register_token( + &self, + sov_token_id: TokenIdentifier, + token_type: EsdtTokenType, + token_display_name: ManagedBuffer, + token_ticker: ManagedBuffer, + num_decimals: usize, + ) { + require!( + !self.is_sovereign_chain().get(), + "Invalid method to call in current chain" + ); + + let issue_cost = self.call_value().egld_value().clone_value(); + + require!(issue_cost == DEFAULT_ISSUE_COST, "eGLD value should be 0.5"); + + match token_type { + EsdtTokenType::Invalid => sc_panic!("Invalid type"), + EsdtTokenType::Fungible => self.handle_fungible_token_type( + sov_token_id.clone(), + issue_cost, + token_display_name, + token_ticker, + num_decimals, + ), + _ => self.handle_nonfungible_token_type( + sov_token_id.clone(), + token_type, + issue_cost, + token_display_name, + token_ticker, + num_decimals, + ), + } + + match self.sovereign_to_multiversx_token_id(&sov_token_id).get() { + TokenMapperState::NotSet => sc_panic!("Token ID not set"), + TokenMapperState::Pending => {} + TokenMapperState::Token(mx_token_id) => { + self.multiversx_to_sovereign_token_id(&mx_token_id) + .set(sov_token_id); + } + } + } + + fn handle_fungible_token_type( + &self, + sov_token_id: TokenIdentifier, + issue_cost: BigUint, + token_display_name: ManagedBuffer, + token_ticker: ManagedBuffer, + num_decimals: usize, + ) { + self.multiversx_to_sovereign_token_id(&sov_token_id) + .set(sov_token_id.clone()); + + self.fungible_token(&sov_token_id).issue_and_set_all_roles( + issue_cost, + token_display_name, + token_ticker, + num_decimals, + None, + ); + } + + fn handle_nonfungible_token_type( + &self, + sov_token_id: TokenIdentifier, + token_type: EsdtTokenType, + issue_cost: BigUint, + token_display_name: ManagedBuffer, + token_ticker: ManagedBuffer, + num_decimals: usize, + ) { + self.multiversx_to_sovereign_token_id(&sov_token_id) + .set(sov_token_id.clone()); + + self.non_fungible_token(&sov_token_id) + .issue_and_set_all_roles( + token_type, + issue_cost, + token_display_name, + token_ticker, + num_decimals, + None, + ); + } + + #[only_owner] + #[endpoint(clearRegisteredSovereignToken)] + fn clear_registered_sovereign_token(&self, sov_token_id: TokenIdentifier) { + self.sovereign_to_multiversx_token_id(&sov_token_id).clear(); + } + + #[only_owner] + #[endpoint(clearRegisteredMultiversxToken)] + fn clear_registered_multiversx_token(&self, mvx_token_id: TokenIdentifier) { + self.multiversx_to_sovereign_token_id(&mvx_token_id).clear(); + } + + // WARNING: All mappers must have the exact same storage key! + + #[storage_mapper("sovToMxTokenId")] + fn sovereign_to_multiversx_token_id( + &self, + sov_token_id: &TokenIdentifier, + ) -> SingleValueMapper>; + + #[storage_mapper("mxToSovTokenId")] + fn multiversx_to_sovereign_token_id( + &self, + mx_token_id: &TokenIdentifier, + ) -> SingleValueMapper; + + #[storage_mapper("sovToMxTokenId")] + fn fungible_token(&self, sov_token_id: &TokenIdentifier) -> FungibleTokenMapper; + + #[storage_mapper("sovToMxTokenId")] + fn non_fungible_token(&self, sov_token_id: &TokenIdentifier) -> NonFungibleTokenMapper; + + #[storage_mapper("sovEsdtTokenInfoMapper")] + fn sovereign_esdt_token_info_mapper( + &self, + token_identifier: &TokenIdentifier, + nonce: &u64, + ) -> SingleValueMapper>; + + #[storage_mapper("mxEsdtTokenInfoMapper")] + fn multiversx_esdt_token_info_mapper( + &self, + token_identifier: &TokenIdentifier, + nonce: &u64, + ) -> SingleValueMapper>; + + #[storage_mapper("isSovereignChain")] + fn is_sovereign_chain(&self) -> SingleValueMapper; +} diff --git a/enshrine-esdt-safe/src/from_sovereign/transfer_tokens.rs b/enshrine-esdt-safe/src/from_sovereign/transfer_tokens.rs new file mode 100644 index 00000000..4a4dd8c8 --- /dev/null +++ b/enshrine-esdt-safe/src/from_sovereign/transfer_tokens.rs @@ -0,0 +1,327 @@ +use multiversx_sc::{api::ESDT_MULTI_TRANSFER_FUNC_NAME, storage::StorageKey}; +use transaction::{ + BatchId, GasLimit, Operation, OperationData, OperationEsdtPayment, OperationTuple, +}; + +use crate::to_sovereign; + +use super::token_mapping::EsdtTokenInfo; + +multiversx_sc::imports!(); + +const CALLBACK_GAS: GasLimit = 10_000_000; // Increase if not enough +const TRANSACTION_GAS: GasLimit = 30_000_000; + +#[multiversx_sc::module] +pub trait TransferTokensModule: + bls_signature::BlsSignatureModule + + super::events::EventsModule + + super::refund::RefundModule + + super::token_mapping::TokenMappingModule + + tx_batch_module::TxBatchModule + + max_bridged_amount_module::MaxBridgedAmountModule + + multiversx_sc_modules::pause::PauseModule + + multiversx_sc_modules::default_issue_callbacks::DefaultIssueCallbacksModule + + utils::UtilsModule + + to_sovereign::events::EventsModule +{ + #[endpoint(executeBridgeOps)] + fn execute_operations(&self, hash_of_hashes: ManagedBuffer, operation: Operation) { + require!( + !self.is_sovereign_chain().get(), + "Invalid method to call in current chain" + ); + + require!(self.not_paused(), "Cannot transfer while paused"); + + let (operation_hash, is_registered) = + self.calculate_operation_hash(hash_of_hashes.clone(), operation.clone()); + + if !is_registered { + sc_panic!("Operation is not registered"); + } + + let minted_operation_tokens = self.mint_tokens(&operation.tokens); + let operation_tuple = OperationTuple { + op_hash: operation_hash, + operation, + }; + + self.distribute_payments(hash_of_hashes, operation_tuple, minted_operation_tokens); + } + + fn mint_tokens( + &self, + operation_tokens: &ManagedVec>, + ) -> ManagedVec> { + let mut output_payments = ManagedVec::new(); + + for operation_token in operation_tokens.iter() { + let mx_token_id_state = self + .sovereign_to_multiversx_token_id(&operation_token.token_identifier) + .get(); + + let mx_token_id = match mx_token_id_state { + // token is from sovereign -> continue and mint + TokenMapperState::Token(token_id) => token_id, + // token is from mainchain -> push token + _ => { + // TODO: will use sovereign prefix + output_payments.push(operation_token.clone()); + + continue; + } + }; + + if operation_token.token_nonce == 0 { + self.send() + .esdt_local_mint(&mx_token_id, 0, &operation_token.token_data.amount); + + output_payments.push(OperationEsdtPayment { + token_identifier: mx_token_id, + token_nonce: 0, + token_data: operation_token.token_data, + }); + + continue; + } + + let nft_nonce = self.mint_and_save_token(&mx_token_id, &operation_token); + + output_payments.push(OperationEsdtPayment { + token_identifier: mx_token_id, + token_nonce: nft_nonce, + token_data: operation_token.token_data, + }); + } + + output_payments + } + + fn mint_and_save_token( + self, + mx_token_id: &TokenIdentifier, + operation_token: &OperationEsdtPayment, + ) -> u64 { + // mint NFT + let nft_nonce = self.send().esdt_nft_create( + mx_token_id, + &operation_token.token_data.amount, + &operation_token.token_data.name, + &operation_token.token_data.royalties, + &operation_token.token_data.hash, + &operation_token.token_data.attributes, + &operation_token.token_data.uris, + ); + + // save token id and nonce + self.sovereign_esdt_token_info_mapper( + &operation_token.token_identifier, + &operation_token.token_nonce, + ) + .set(EsdtTokenInfo { + token_identifier: mx_token_id.clone(), + token_nonce: nft_nonce, + }); + + self.multiversx_esdt_token_info_mapper(mx_token_id, &nft_nonce) + .set(EsdtTokenInfo { + token_identifier: operation_token.token_identifier.clone(), + token_nonce: operation_token.token_nonce, + }); + + nft_nonce + } + + fn distribute_payments( + &self, + hash_of_hashes: ManagedBuffer, + operation_tuple: OperationTuple, + tokens_list: ManagedVec>, + ) { + let mapped_tokens = tokens_list.iter().map(|token| token.into()).collect(); + + match &operation_tuple.operation.data.opt_transfer_data { + Some(transfer_data) => { + let mut args = ManagedArgBuffer::new(); + for arg in &transfer_data.args { + args.push_arg(arg); + } + + self.send() + .contract_call::<()>( + operation_tuple.operation.to.clone(), + transfer_data.function.clone(), + ) + .with_raw_arguments(args) + .with_multi_token_transfer(mapped_tokens) + .with_gas_limit(transfer_data.gas_limit) + .async_call_promise() + .with_extra_gas_for_callback(CALLBACK_GAS) + .with_callback( + ::callbacks(self) + .execute(&hash_of_hashes, &operation_tuple), + ) + .register_promise(); + } + None => { + let own_address = self.blockchain().get_sc_address(); + + self.send() + .contract_call::<()>(own_address, ESDT_MULTI_TRANSFER_FUNC_NAME) + .with_raw_arguments( + self.get_contract_call_args(&operation_tuple.operation.to, mapped_tokens), + ) + .with_gas_limit(TRANSACTION_GAS) + .async_call_promise() + .with_callback( + ::callbacks(self) + .execute(&hash_of_hashes, &operation_tuple), + ) + .register_promise(); + } + } + } + + fn get_contract_call_args( + self, + to: &ManagedAddress, + mapped_tokens: ManagedVec>, + ) -> ManagedArgBuffer { + let mut args = ManagedArgBuffer::new(); + args.push_arg(to); + args.push_arg(mapped_tokens.len()); + + for token in &mapped_tokens { + args.push_arg(token.token_identifier); + args.push_arg(token.token_nonce); + args.push_arg(token.amount); + } + + args + } + + #[promises_callback] + fn execute( + &self, + hash_of_hashes: &ManagedBuffer, + operation_tuple: &OperationTuple, + #[call_result] result: ManagedAsyncCallResult, + ) { + match result { + ManagedAsyncCallResult::Ok(_) => { + self.execute_bridge_operation_event( + hash_of_hashes.clone(), + operation_tuple.op_hash.clone(), + ); + } + ManagedAsyncCallResult::Err(_) => { + self.emit_transfer_failed_events(hash_of_hashes, operation_tuple); + } + } + + let _: () = self + .header_verifier_proxy(self.header_verifier_address().get()) + .remove_executed_hash(hash_of_hashes, &operation_tuple.op_hash) + .execute_on_dest_context(); + } + + fn emit_transfer_failed_events( + &self, + hash_of_hashes: &ManagedBuffer, + operation_tuple: &OperationTuple, + ) { + // confirmation event + self.execute_bridge_operation_event( + hash_of_hashes.clone(), + operation_tuple.op_hash.clone(), + ); + + for operation_token in &operation_tuple.operation.tokens { + let mx_token_id_state = self + .sovereign_to_multiversx_token_id(&operation_token.token_identifier) + .get(); + + if let TokenMapperState::Token(mx_token_id) = mx_token_id_state { + let mut mx_token_nonce = 0; + + if operation_token.token_nonce > 0 { + mx_token_nonce = self + .sovereign_esdt_token_info_mapper( + &operation_token.token_identifier, + &operation_token.token_nonce, + ) + .take() + .token_nonce; + + self.multiversx_esdt_token_info_mapper(&mx_token_id, &mx_token_nonce); + } + + self.send().esdt_local_burn( + &mx_token_id, + mx_token_nonce, + &operation_token.token_data.amount, + ); + } + } + + // deposit back mainchain tokens into user account + let sc_address = self.blockchain().get_sc_address(); + let tx_nonce = self.get_and_save_next_tx_id(); + + self.deposit_event( + &operation_tuple.operation.data.op_sender, + &operation_tuple.operation.get_tokens_as_tuple_arr(), + OperationData { + op_nonce: tx_nonce, + op_sender: sc_address.clone(), + opt_transfer_data: None, + }, + ); + } + + // use pending_operations as param + fn calculate_operation_hash( + &self, + hash_of_hashes: ManagedBuffer, + operation: Operation, + ) -> (ManagedBuffer, bool) { + let mut serialized_data = ManagedBuffer::new(); + let mut storage_key = StorageKey::from("pending_hashes"); + storage_key.append_item(&hash_of_hashes); + + let pending_operations_mapper = + UnorderedSetMapper::new_from_address(self.header_verifier_address().get(), storage_key); + + if let core::result::Result::Err(err) = operation.top_encode(&mut serialized_data) { + sc_panic!("Transfer data encode error: {}", err.message_bytes()); + } + + let sha256 = self.crypto().sha256(&serialized_data); + let hash = sha256.as_managed_buffer().clone(); + + if pending_operations_mapper.contains(&hash) { + (hash, true) + } else { + (hash, false) + } + } + + #[proxy] + fn header_verifier_proxy( + &self, + header_verifier_address: ManagedAddress, + ) -> header_verifier::Proxy; + + #[storage_mapper("nextBatchId")] + fn next_batch_id(&self) -> SingleValueMapper; + + #[storage_mapper("pending_hashes")] + fn pending_hashes(&self, hash_of_hashes: &ManagedBuffer) -> UnorderedSetMapper; + + #[storage_mapper("header_verifier_address")] + fn header_verifier_address(&self) -> SingleValueMapper; + + #[storage_mapper("sovereign_bridge_address")] + fn sovereign_bridge_address(&self) -> SingleValueMapper; +} diff --git a/enshrine-esdt-safe/src/lib.rs b/enshrine-esdt-safe/src/lib.rs new file mode 100644 index 00000000..6e516062 --- /dev/null +++ b/enshrine-esdt-safe/src/lib.rs @@ -0,0 +1,95 @@ +#![no_std] + +multiversx_sc::imports!(); +multiversx_sc::derive_imports!(); + +use transaction::GasLimit; +use tx_batch_module::FIRST_BATCH_ID; + +const DEFAULT_MAX_TX_BATCH_SIZE: usize = 10; +const DEFAULT_MAX_TX_BATCH_BLOCK_DURATION: u64 = 100; // ~10 minutes +const DEFAULT_MAX_USER_TX_GAS_LIMIT: GasLimit = 300_000_000; + +pub mod from_sovereign; +pub mod to_sovereign; +// pub mod esdt_safe_proxy; + +#[multiversx_sc::contract] +pub trait EsdtSafe: + to_sovereign::create_tx::CreateTxModule + + to_sovereign::events::EventsModule + + to_sovereign::refund::RefundModule + + to_sovereign::set_tx_status::SetTxStatusModule + + bls_signature::BlsSignatureModule + + from_sovereign::events::EventsModule + + from_sovereign::refund::RefundModule + + from_sovereign::token_mapping::TokenMappingModule + + from_sovereign::transfer_tokens::TransferTokensModule + + tx_batch_module::TxBatchModule + + max_bridged_amount_module::MaxBridgedAmountModule + + setup_phase::SetupPhaseModule + + token_whitelist::TokenWhitelistModule + + utils::UtilsModule + + multiversx_sc_modules::pause::PauseModule + + multiversx_sc_modules::default_issue_callbacks::DefaultIssueCallbacksModule +{ + #[init] + fn init( + &self, + is_sovereign_chain: bool, + min_valid_signers: u32, + initiator_address: ManagedAddress, + signers: MultiValueEncoded, + ) { + self.is_sovereign_chain().set(is_sovereign_chain); + self.max_tx_batch_size().set(DEFAULT_MAX_TX_BATCH_SIZE); + self.max_tx_batch_block_duration() + .set(DEFAULT_MAX_TX_BATCH_BLOCK_DURATION); + self.max_user_tx_gas_limit() + .set(DEFAULT_MAX_USER_TX_GAS_LIMIT); + + // batch ID 0 is considered invalid + self.first_batch_id().set(FIRST_BATCH_ID); + self.last_batch_id().set(FIRST_BATCH_ID); + self.next_batch_id().set(FIRST_BATCH_ID); + + self.set_min_valid_signers(min_valid_signers); + self.add_signers(signers); + + self.initiator_address().set(initiator_address); + + self.set_paused(true); + + // Currently, false is the same as 0, which is the default value. + // If this ever changes, uncomment this line. + // self.setup_phase_complete.set(false); + } + + #[only_owner] + #[endpoint(setFeeMarketAddress)] + fn set_fee_market_address(&self, fee_market_address: ManagedAddress) { + self.require_sc_address(&fee_market_address); + + self.fee_market_address().set(fee_market_address); + } + + #[only_owner] + #[endpoint(setMultisigAddress)] + fn set_header_verifier_address(&self, header_verifier_address: ManagedAddress) { + self.require_sc_address(&header_verifier_address); + + self.header_verifier_address().set(&header_verifier_address); + } + + #[only_owner] + #[endpoint(setSovereignBridgeAddress)] + fn set_sovereign_bridge_address(&self, bridge_address: ManagedAddress) { + self.require_sc_address(&bridge_address); + + self.sovereign_bridge_address().set(bridge_address); + } + + #[upgrade] + fn upgrade(&self) {} + +} diff --git a/enshrine-esdt-safe/src/to_sovereign/create_tx.rs b/enshrine-esdt-safe/src/to_sovereign/create_tx.rs new file mode 100644 index 00000000..7649bb89 --- /dev/null +++ b/enshrine-esdt-safe/src/to_sovereign/create_tx.rs @@ -0,0 +1,364 @@ +use crate::from_sovereign::token_mapping; +use bls_signature::BlsSignature; +use fee_market::subtract_fee::{FinalPayment, ProxyTrait as _}; +use multiversx_sc::{hex_literal::hex, storage::StorageKey}; +use transaction::{GasLimit, OperationData, TransferData}; + +multiversx_sc::imports!(); + +pub const ESDT_SYSTEM_SC_ADDRESS: [u8; 32] = + hex!("000000000000000000010000000000000000000000000000000000000002ffff"); +const MAX_TRANSFERS_PER_TX: usize = 10; + +#[multiversx_sc::module] +pub trait CreateTxModule: + super::events::EventsModule + + tx_batch_module::TxBatchModule + + max_bridged_amount_module::MaxBridgedAmountModule + + token_whitelist::TokenWhitelistModule + + bls_signature::BlsSignatureModule + + setup_phase::SetupPhaseModule + + utils::UtilsModule + + multiversx_sc_modules::pause::PauseModule + + token_mapping::TokenMappingModule + + multiversx_sc_modules::default_issue_callbacks::DefaultIssueCallbacksModule +{ + #[endpoint(setMaxUserTxGasLimit)] + fn set_max_user_tx_gas_limit( + &self, + new_value: GasLimit, + opt_sig: OptionalValue>, + ) { + if !self.is_setup_phase_complete() { + self.require_caller_initiator(); + self.max_user_tx_gas_limit().set(new_value); + + return; + } + + let opt_signature = opt_sig.into_option(); + require!(opt_signature.is_some(), "Must provide signature"); + let signature = unsafe { opt_signature.unwrap_unchecked() }; + let mut signature_data = ManagedBuffer::new(); + let _ = new_value.dep_encode(&mut signature_data); + + self.multi_verify_signature(&signature_data, &signature); + + self.max_user_tx_gas_limit().set(new_value); + } + + #[endpoint(setBurnAndMint)] + fn set_burn_and_mint( + &self, + opt_signature: Option>, + tokens: MultiValueEncoded, + ) { + if !self.is_setup_phase_complete() { + self.require_caller_initiator(); + self.burn_tokens().extend(tokens); + + return; + } + + let all_tokens = self.verify_items_signature(opt_signature, tokens); + self.burn_tokens().extend(&all_tokens); + } + + #[endpoint(removeBurnAndMint)] + fn remove_burn_and_mint( + &self, + opt_signature: Option>, + tokens: MultiValueEncoded, + ) { + if !self.is_setup_phase_complete() { + self.require_caller_initiator(); + self.remove_items(&mut self.burn_tokens(), tokens); + + return; + } + + let all_tokens = self.verify_items_signature(opt_signature, tokens); + self.remove_items(&mut self.burn_tokens(), &all_tokens); + } + + #[endpoint(addBannedEndpointNames)] + fn add_banned_endpoint_names( + &self, + opt_signature: Option>, + names: MultiValueEncoded, + ) { + if !self.is_setup_phase_complete() { + self.require_caller_initiator(); + self.banned_endpoint_names().extend(names); + + return; + } + + let all_names = self.verify_items_signature(opt_signature, names); + self.banned_endpoint_names().extend(&all_names); + } + + #[endpoint(removeBannedEndpointNames)] + fn remove_banned_endpoint_names( + &self, + opt_signature: Option>, + names: MultiValueEncoded, + ) { + if !self.is_setup_phase_complete() { + self.require_caller_initiator(); + self.remove_items(&mut self.banned_endpoint_names(), names); + + return; + } + + let all_names = self.verify_items_signature(opt_signature, names); + self.remove_items(&mut self.banned_endpoint_names(), &all_names); + } + + #[payable("*")] + #[endpoint(depositBack)] + fn deposit_back(&self, to: ManagedAddress) { + require!(self.not_paused(), "Cannot create transaction while paused"); + + let caller = self.blockchain().get_caller(); + require!(caller == ESDT_SYSTEM_SC_ADDRESS.into(), "Caller is invalid"); + + let payments = self.call_value().all_esdt_transfers(); + + require!(!payments.is_empty(), "Nothing to transfer"); + require!(payments.len() <= MAX_TRANSFERS_PER_TX, "Too many tokens"); + + self.send().direct_multi(&to, &payments); + } + + fn check_and_extract_fee( + &self, + ) -> MultiValue2, ManagedVec> { + let mut payments = self.call_value().all_esdt_transfers().clone_value(); + + require!(!payments.is_empty(), "Nothing to transfer"); + require!(payments.len() <= MAX_TRANSFERS_PER_TX, "Too many tokens"); + + let fee_market_address = self.fee_market_address().get(); + let fee_enabled_mapper = SingleValueMapper::new_from_address( + fee_market_address.clone(), + StorageKey::from("feeEnabledFlag"), + ) + .get(); + + let opt_transfer_data = if fee_enabled_mapper { + OptionalValue::Some(self.pop_first_payment(&mut payments)) + } else { + OptionalValue::None + }; + + MultiValue2::from((opt_transfer_data, payments)) + } + + fn process_transfer_data( + &self, + opt_transfer_data: OptionalValue< + MultiValue3>, + >, + ) -> Option> { + match &opt_transfer_data { + OptionalValue::Some(transfer_data) => { + let (gas_limit, function, args) = transfer_data.clone().into_tuple(); + let max_gas_limit = self.max_user_tx_gas_limit().get(); + + require!(gas_limit <= max_gas_limit, "Gas limit too high"); + + require!( + !self.banned_endpoint_names().contains(&function), + "Banned endpoint name" + ); + + Some(TransferData { + gas_limit, + function, + args, + }) + } + OptionalValue::None => None, + } + } + + /// Create an Elrond -> Sovereign transaction. + #[payable("*")] + #[endpoint] + fn deposit( + &self, + to: ManagedAddress, + opt_transfer_data: OptionalValue< + MultiValue3>, + >, + ) { + require!(self.not_paused(), "Cannot create transaction while paused"); + + let (fees_payment, payments) = self.check_and_extract_fee().into_tuple(); + + require!(!payments.is_empty(), "Nothing to transfer"); + require!(payments.len() <= MAX_TRANSFERS_PER_TX, "Too many tokens"); + + let opt_transfer_data = self.process_transfer_data(opt_transfer_data); + let own_sc_address = self.blockchain().get_sc_address(); + let mut total_tokens_for_fees = 0usize; + let mut event_payments: MultiValueEncoded< + MultiValue3, + > = MultiValueEncoded::new(); + let mut refundable_payments: ManagedVec> = + ManagedVec::new(); + + for payment in &payments { + self.require_below_max_amount(&payment.token_identifier, &payment.amount); + self.require_token_not_blacklisted(&payment.token_identifier); + + if !self.token_whitelist().is_empty() + && !self.token_whitelist().contains(&payment.token_identifier) + { + refundable_payments.push(payment.clone()); + + continue; + } else { + total_tokens_for_fees += 1; + } + + let mut current_token_data = self.blockchain().get_esdt_token_data( + &own_sc_address, + &payment.token_identifier, + payment.token_nonce, + ); + + current_token_data.amount = payment.amount.clone(); + + if self.is_sovereign_chain().get() { + self.send().esdt_local_burn( + &payment.token_identifier, + payment.token_nonce, + &payment.amount, + ); + + event_payments.push(MultiValue3(( + payment.token_identifier.clone(), + payment.token_nonce, + current_token_data.clone(), + ))); + } else { + let sov_token_id = self + .multiversx_to_sovereign_token_id(&payment.token_identifier) + .get(); + + if !sov_token_id.is_valid_esdt_identifier() { + event_payments.push(MultiValue3(( + payment.token_identifier, + payment.token_nonce, + current_token_data.clone(), + ))); + + continue; + } + + let sov_token_nonce = self.remove_sovereign_token(payment, &sov_token_id); + + event_payments.push(MultiValue3(( + sov_token_id, + sov_token_nonce, + current_token_data.clone(), + ))); + } + } + + let caller = self.blockchain().get_caller(); + + self.match_fee_payment(total_tokens_for_fees, &fees_payment, &opt_transfer_data); + + // refund refundable_tokens + for payment in &refundable_payments { + self.send().direct_non_zero_esdt_payment(&caller, &payment); + } + + let tx_nonce = self.get_and_save_next_tx_id(); + + self.deposit_event( + &to, + &event_payments, + OperationData { + op_nonce: tx_nonce, + op_sender: caller, + opt_transfer_data, + }, + ); + } + + fn remove_sovereign_token( + &self, + payment: EsdtTokenPayment, + sov_token_id: &TokenIdentifier, + ) -> u64 { + self.send().esdt_local_burn( + &payment.token_identifier, + payment.token_nonce, + &payment.amount, + ); + + let mut sov_token_nonce = 0; + + if payment.token_nonce > 0 { + sov_token_nonce = self + .multiversx_esdt_token_info_mapper(&payment.token_identifier, &payment.token_nonce) + .take() + .token_nonce; + + self.sovereign_esdt_token_info_mapper(sov_token_id, &sov_token_nonce) + .take(); + } + + sov_token_nonce + } + + fn match_fee_payment( + &self, + total_tokens_for_fees: usize, + fees_payment: &OptionalValue>, + opt_transfer_data: &Option::Api>>, + ) { + match fees_payment { + OptionalValue::Some(fee) => { + let mut gas: GasLimit = 0; + + if let Some(transfer_data) = opt_transfer_data { + gas = transfer_data.gas_limit; + } + + let _: FinalPayment = self + .fee_market_proxy(self.fee_market_address().get()) + .subtract_fee( + self.blockchain().get_caller().clone(), + total_tokens_for_fees, + OptionalValue::Some(gas), + ) + .with_esdt_transfer(fee.clone()) + .execute_on_dest_context(); + } + OptionalValue::None => (), + }; + } + + #[proxy] + fn fee_market_proxy(&self, sc_address: ManagedAddress) -> fee_market::Proxy; + + #[storage_mapper("feeMarketAddress")] + fn fee_market_address(&self) -> SingleValueMapper; + + #[storage_mapper("maxUserTxGasLimit")] + fn max_user_tx_gas_limit(&self) -> SingleValueMapper; + + #[storage_mapper("burnTokens")] + fn burn_tokens(&self) -> UnorderedSetMapper; + + #[storage_mapper("bannedEndpointNames")] + fn banned_endpoint_names(&self) -> UnorderedSetMapper; + + #[storage_mapper("feeEnabledFlag")] + fn fee_enabled(&self) -> SingleValueMapper; +} diff --git a/enshrine-esdt-safe/src/to_sovereign/events.rs b/enshrine-esdt-safe/src/to_sovereign/events.rs new file mode 100644 index 00000000..ba1d55a0 --- /dev/null +++ b/enshrine-esdt-safe/src/to_sovereign/events.rs @@ -0,0 +1,26 @@ +use transaction::{ + transaction_status::TransactionStatus, BatchId, OperationData, TxId +}; + +multiversx_sc::imports!(); +multiversx_sc::derive_imports!(); + +#[multiversx_sc::module] +pub trait EventsModule { + #[event("deposit")] + fn deposit_event( + // TODO: Use ManagedVec of EsdtTokenPaymentInfo(EsdtTokenDataPayment, EsdtTokenData) + &self, + #[indexed] dest_address: &ManagedAddress, + #[indexed] tokens: &MultiValueEncoded>, + event_data: OperationData, + ); + + #[event("setStatusEvent")] + fn set_status_event( + &self, + #[indexed] batch_id: BatchId, + #[indexed] tx_id: TxId, + #[indexed] tx_status: TransactionStatus, + ); +} diff --git a/enshrine-esdt-safe/src/to_sovereign/mod.rs b/enshrine-esdt-safe/src/to_sovereign/mod.rs new file mode 100644 index 00000000..72718603 --- /dev/null +++ b/enshrine-esdt-safe/src/to_sovereign/mod.rs @@ -0,0 +1,4 @@ +pub mod create_tx; +pub mod events; +pub mod refund; +pub mod set_tx_status; diff --git a/enshrine-esdt-safe/src/to_sovereign/refund.rs b/enshrine-esdt-safe/src/to_sovereign/refund.rs new file mode 100644 index 00000000..62c37409 --- /dev/null +++ b/enshrine-esdt-safe/src/to_sovereign/refund.rs @@ -0,0 +1,55 @@ +multiversx_sc::imports!(); +multiversx_sc::derive_imports!(); + +#[derive(TopEncode, TopDecode, NestedEncode, NestedDecode, ManagedVecItem)] +pub struct NonceAmountPair { + pub nonce: u64, + pub amount: BigUint, +} + +#[multiversx_sc::module] +pub trait RefundModule: + super::events::EventsModule + + tx_batch_module::TxBatchModule + + max_bridged_amount_module::MaxBridgedAmountModule +{ + /// Claim funds for failed Elrond -> Sovereign transactions. + /// These are not sent automatically to prevent the contract getting stuck. + /// For example, if the receiver is a SC, a frozen account, etc. + #[endpoint(claimRefund)] + fn claim_refund(&self, token_id: TokenIdentifier) -> ManagedVec { + let caller = self.blockchain().get_caller(); + let refund_amounts = self.refund_amount(&caller, &token_id).take(); + require!(!refund_amounts.is_empty(), "Nothing to refund"); + + let mut output_payments = ManagedVec::new(); + for nonce_amount_pair in &refund_amounts { + output_payments.push(EsdtTokenPayment::new( + token_id.clone(), + nonce_amount_pair.nonce, + nonce_amount_pair.amount, + )); + } + + self.send().direct_multi(&caller, &output_payments); + + output_payments + } + + fn mark_refund(&self, to: &ManagedAddress, token: &EsdtTokenPayment) { + self.refund_amount(to, &token.token_identifier) + .update(|refund| { + refund.push(NonceAmountPair { + nonce: token.token_nonce, + amount: token.amount.clone(), + }); + }); + } + + #[storage_mapper("refundAmount")] + fn refund_amount( + &self, + address: &ManagedAddress, + token_id: &TokenIdentifier, + ) -> SingleValueMapper>>; +} diff --git a/enshrine-esdt-safe/src/to_sovereign/set_tx_status.rs b/enshrine-esdt-safe/src/to_sovereign/set_tx_status.rs new file mode 100644 index 00000000..9229866c --- /dev/null +++ b/enshrine-esdt-safe/src/to_sovereign/set_tx_status.rs @@ -0,0 +1,71 @@ +use bls_signature::BlsSignature; +use transaction::{transaction_status::TransactionStatus, BatchId}; + +multiversx_sc::imports!(); + +#[multiversx_sc::module] +pub trait SetTxStatusModule: + bls_signature::BlsSignatureModule + + super::events::EventsModule + + super::refund::RefundModule + + tx_batch_module::TxBatchModule + + max_bridged_amount_module::MaxBridgedAmountModule +{ + /// Sets the statuses for the transactions, after they were executed on the Sovereign side. + /// + /// Only TransactionStatus::Executed (3) and TransactionStatus::Rejected (4) values are allowed. + /// Number of provided statuses must be equal to number of transactions in the batch. + #[endpoint(setTransactionBatchStatus)] + fn set_transaction_batch_status( + &self, + batch_id: BatchId, + signature: BlsSignature, + tx_statuses: MultiValueEncoded, + ) { + let first_batch_id = self.first_batch_id().get(); + require!( + batch_id == first_batch_id, + "Batches must be processed in order" + ); + + let mut tx_batch = self.pending_batches(batch_id); + require!( + tx_batch.len() == tx_statuses.len(), + "Invalid number of statuses provided" + ); + + let mut serialized_data = ManagedBuffer::new(); + let tx_statuses_vec = tx_statuses.to_vec(); + + let _ = batch_id.dep_encode(&mut serialized_data); + for status in &tx_statuses_vec { + let _ = status.dep_encode(&mut serialized_data); + } + + self.multi_verify_signature(&serialized_data, &signature); + + for (tx, tx_status) in tx_batch.iter().zip(tx_statuses_vec.iter()) { + // Since tokens don't exist in the EsdtSafe in the case of a refund transaction + // we have no tokens to burn, nor to refund + if tx.is_refund_tx { + continue; + } + + match tx_status { + TransactionStatus::Executed => {} + TransactionStatus::Rejected => { + for token in &tx.tokens { + self.mark_refund(&tx.from, &token); + } + } + _ => { + sc_panic!("Transaction status may only be set to Executed or Rejected"); + } + } + + self.set_status_event(batch_id, tx.nonce, tx_status); + } + + self.clear_first_batch(&mut tx_batch); + } +} diff --git a/enshrine-esdt-safe/wasm/Cargo.lock b/enshrine-esdt-safe/wasm/Cargo.lock index 58d5eb46..e8238b99 100644 --- a/enshrine-esdt-safe/wasm/Cargo.lock +++ b/enshrine-esdt-safe/wasm/Cargo.lock @@ -20,6 +20,14 @@ version = "2.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "cf4b9d6a944f767f8e5e0db018570623c85f3d925ac718db4e06d0187adb21c1" +[[package]] +name = "bls-signature" +version = "0.0.0" +dependencies = [ + "multiversx-sc", + "transaction", +] + [[package]] name = "endian-type" version = "0.1.2" @@ -30,7 +38,17 @@ checksum = "c34f04666d835ff5d62e058c3995147c06f42fe86ff053337632bca83e42702d" name = "enshrine-esdt-safe" version = "0.0.0" dependencies = [ + "bls-signature", + "fee-market", + "header-verifier", + "max-bridged-amount-module", "multiversx-sc", + "multiversx-sc-modules", + "setup-phase", + "token-whitelist", + "transaction", + "tx-batch-module", + "utils", ] [[package]] @@ -41,6 +59,27 @@ dependencies = [ "multiversx-sc-wasm-adapter", ] +[[package]] +name = "fee-market" +version = "0.0.0" +dependencies = [ + "bls-signature", + "multiversx-sc", + "pair-mock", + "router-mock", + "transaction", + "utils", +] + +[[package]] +name = "header-verifier" +version = "0.0.0" +dependencies = [ + "bls-signature", + "multiversx-sc", + "transaction", +] + [[package]] name = "hex" version = "0.4.3" @@ -53,6 +92,13 @@ version = "0.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6fe2267d4ed49bc07b63801559be28c718ea06c4738b7a03c94df7386d2cde46" +[[package]] +name = "max-bridged-amount-module" +version = "0.0.0" +dependencies = [ + "multiversx-sc", +] + [[package]] name = "multiversx-sc" version = "0.50.3" @@ -103,6 +149,15 @@ dependencies = [ "syn", ] +[[package]] +name = "multiversx-sc-modules" +version = "0.50.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7f9a8c10ddadc7adfc04edbdd1ea80a9ae9a7e11202fc4cfb2e08c8e27f17aa5" +dependencies = [ + "multiversx-sc", +] + [[package]] name = "multiversx-sc-wasm-adapter" version = "0.50.3" @@ -130,6 +185,13 @@ dependencies = [ "autocfg", ] +[[package]] +name = "pair-mock" +version = "0.0.0" +dependencies = [ + "multiversx-sc", +] + [[package]] name = "proc-macro2" version = "1.0.82" @@ -158,6 +220,20 @@ dependencies = [ "nibble_vec", ] +[[package]] +name = "router-mock" +version = "0.0.0" +dependencies = [ + "multiversx-sc", +] + +[[package]] +name = "setup-phase" +version = "0.0.0" +dependencies = [ + "multiversx-sc", +] + [[package]] name = "smallvec" version = "1.13.2" @@ -175,6 +251,31 @@ dependencies = [ "unicode-ident", ] +[[package]] +name = "token-whitelist" +version = "0.0.0" +dependencies = [ + "bls-signature", + "multiversx-sc", + "setup-phase", + "utils", +] + +[[package]] +name = "transaction" +version = "0.0.0" +dependencies = [ + "multiversx-sc", +] + +[[package]] +name = "tx-batch-module" +version = "0.0.0" +dependencies = [ + "multiversx-sc", + "transaction", +] + [[package]] name = "unicode-ident" version = "1.0.12" @@ -186,3 +287,11 @@ name = "unwrap-infallible" version = "0.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "151ac09978d3c2862c4e39b557f4eceee2cc72150bc4cb4f16abf061b6e381fb" + +[[package]] +name = "utils" +version = "0.0.0" +dependencies = [ + "bls-signature", + "multiversx-sc", +] diff --git a/enshrine-esdt-safe/wasm/Cargo.toml b/enshrine-esdt-safe/wasm/Cargo.toml index 93cdce49..3854d80a 100644 --- a/enshrine-esdt-safe/wasm/Cargo.toml +++ b/enshrine-esdt-safe/wasm/Cargo.toml @@ -28,7 +28,7 @@ panic = "abort" path = ".." [dependencies.multiversx-sc-wasm-adapter] -version = "0.50.3" +version = "=0.50.3" [workspace] members = ["."] diff --git a/enshrine-esdt-safe/wasm/src/lib.rs b/enshrine-esdt-safe/wasm/src/lib.rs index cace3b85..7a4f3f37 100644 --- a/enshrine-esdt-safe/wasm/src/lib.rs +++ b/enshrine-esdt-safe/wasm/src/lib.rs @@ -6,9 +6,10 @@ // Init: 1 // Upgrade: 1 -// Endpoints: 0 -// Async Callback (empty): 1 -// Total number of exported functions: 3 +// Endpoints: 39 +// Async Callback: 1 +// Promise callbacks: 1 +// Total number of exported functions: 43 #![no_std] @@ -20,7 +21,47 @@ multiversx_sc_wasm_adapter::endpoints! { ( init => init upgrade => upgrade + setFeeMarketAddress => set_fee_market_address + setMultisigAddress => set_header_verifier_address + setSovereignBridgeAddress => set_sovereign_bridge_address + setMaxUserTxGasLimit => set_max_user_tx_gas_limit + setBurnAndMint => set_burn_and_mint + removeBurnAndMint => remove_burn_and_mint + addBannedEndpointNames => add_banned_endpoint_names + removeBannedEndpointNames => remove_banned_endpoint_names + depositBack => deposit_back + deposit => deposit + claimRefund => claim_refund + setTransactionBatchStatus => set_transaction_batch_status + setMinValidSigners => set_min_valid_signers + addSigners => add_signers + removeSigners => remove_signers + registerToken => register_token + clearRegisteredSovereignToken => clear_registered_sovereign_token + clearRegisteredMultiversxToken => clear_registered_multiversx_token + executeBridgeOps => execute_operations + setMaxTxBatchSize => set_max_tx_batch_size + setMaxTxBatchBlockDuration => set_max_tx_batch_block_duration + getCurrentTxBatch => get_current_tx_batch + getFirstBatchAnyStatus => get_first_batch_any_status + getBatch => get_batch + getBatchStatus => get_batch_status + getFirstBatchId => first_batch_id + getLastBatchId => last_batch_id + setMaxBridgedAmount => set_max_bridged_amount + getMaxBridgedAmount => max_bridged_amount + endSetupPhase => end_setup_phase + addTokensToWhitelist => add_tokens_to_whitelist + removeTokensFromWhitelist => remove_tokens_from_whitelist + addTokensToBlacklist => add_tokens_to_blacklist + removeTokensFromBlacklist => remove_tokens_from_blacklist + getTokenWhitelist => token_whitelist + getTokenBlacklist => token_blacklist + pause => pause_endpoint + unpause => unpause_endpoint + isPaused => paused_status + execute => execute ) } -multiversx_sc_wasm_adapter::async_callback_empty! {} +multiversx_sc_wasm_adapter::async_callback! { enshrine_esdt_safe } From 28e59dceb4b713c411c87695ef880cf6a3106de2 Mon Sep 17 00:00:00 2001 From: Andrei Baltariu Date: Wed, 5 Jun 2024 14:17:49 +0300 Subject: [PATCH 003/523] Added sc meta proxy config file --- enshrine-esdt-safe/sc-config.toml | 19 + .../src/enshrine_esdt_safe_proxy.rs | 624 ++++++++++++++++++ .../wasm-enshrine-esdt-safe-full/Cargo.lock | 297 +++++++++ .../wasm-enshrine-esdt-safe-full/Cargo.toml | 34 + .../wasm-enshrine-esdt-safe-full/src/lib.rs | 67 ++ .../wasm-enshrine-esdt-safe-view/Cargo.lock | 297 +++++++++ .../wasm-enshrine-esdt-safe-view/Cargo.toml | 34 + .../wasm-enshrine-esdt-safe-view/src/lib.rs | 25 + esdt-safe/src/esdt_safe_proxy.rs | 120 ++-- fee-market/src/fee_market_proxy.rs | 44 +- header-verifier/src/header_verifier_proxy.rs | 24 +- 11 files changed, 1521 insertions(+), 64 deletions(-) create mode 100644 enshrine-esdt-safe/sc-config.toml create mode 100644 enshrine-esdt-safe/src/enshrine_esdt_safe_proxy.rs create mode 100644 enshrine-esdt-safe/wasm-enshrine-esdt-safe-full/Cargo.lock create mode 100644 enshrine-esdt-safe/wasm-enshrine-esdt-safe-full/Cargo.toml create mode 100644 enshrine-esdt-safe/wasm-enshrine-esdt-safe-full/src/lib.rs create mode 100644 enshrine-esdt-safe/wasm-enshrine-esdt-safe-view/Cargo.lock create mode 100644 enshrine-esdt-safe/wasm-enshrine-esdt-safe-view/Cargo.toml create mode 100644 enshrine-esdt-safe/wasm-enshrine-esdt-safe-view/src/lib.rs diff --git a/enshrine-esdt-safe/sc-config.toml b/enshrine-esdt-safe/sc-config.toml new file mode 100644 index 00000000..19dc9af0 --- /dev/null +++ b/enshrine-esdt-safe/sc-config.toml @@ -0,0 +1,19 @@ +[settings] +main = "main" + +[contracts.main] +name = "enshrine-esdt-safe" + +[contracts.full] +name = "enshrine-esdt-safe-full" +add-unlabelled = true +add-labels = ["enshrine-esdt-safe-external-view"] + +[contracts.view] +name = "enshrine-esdt-safe-view" +external-view = true +add-unlabelled = false +add-labels = ["enshrine-esdt-safe-external-view"] + +[[proxy]] +path = "src/enshrine_esdt_safe_proxy.rs" diff --git a/enshrine-esdt-safe/src/enshrine_esdt_safe_proxy.rs b/enshrine-esdt-safe/src/enshrine_esdt_safe_proxy.rs new file mode 100644 index 00000000..a5dd5653 --- /dev/null +++ b/enshrine-esdt-safe/src/enshrine_esdt_safe_proxy.rs @@ -0,0 +1,624 @@ +// Code generated by the multiversx-sc proxy generator. DO NOT EDIT. + +//////////////////////////////////////////////////// +////////////////// AUTO-GENERATED ////////////////// +//////////////////////////////////////////////////// + +#![allow(dead_code)] +#![allow(clippy::all)] + +use multiversx_sc::proxy_imports::*; + +pub struct EsdtSafeProxy; + +impl TxProxyTrait for EsdtSafeProxy +where + Env: TxEnv, + From: TxFrom, + To: TxTo, + Gas: TxGas, +{ + type TxProxyMethods = EsdtSafeProxyMethods; + + fn proxy_methods(self, tx: Tx) -> Self::TxProxyMethods { + EsdtSafeProxyMethods { wrapped_tx: tx } + } +} + +pub struct EsdtSafeProxyMethods +where + Env: TxEnv, + From: TxFrom, + To: TxTo, + Gas: TxGas, +{ + wrapped_tx: Tx, +} + +#[rustfmt::skip] +impl EsdtSafeProxyMethods +where + Env: TxEnv, + Env::Api: VMApi, + From: TxFrom, + Gas: TxGas, +{ + pub fn init< + Arg0: ProxyArg, + Arg1: ProxyArg, + Arg2: ProxyArg>, + Arg3: ProxyArg>>, + >( + self, + is_sovereign_chain: Arg0, + min_valid_signers: Arg1, + initiator_address: Arg2, + signers: Arg3, + ) -> TxTypedDeploy { + self.wrapped_tx + .payment(NotPayable) + .raw_deploy() + .argument(&is_sovereign_chain) + .argument(&min_valid_signers) + .argument(&initiator_address) + .argument(&signers) + .original_result() + } +} + +#[rustfmt::skip] +impl EsdtSafeProxyMethods +where + Env: TxEnv, + Env::Api: VMApi, + From: TxFrom, + To: TxTo, + Gas: TxGas, +{ + pub fn upgrade( + self, + ) -> TxTypedUpgrade { + self.wrapped_tx + .payment(NotPayable) + .raw_upgrade() + .original_result() + } +} + +#[rustfmt::skip] +impl EsdtSafeProxyMethods +where + Env: TxEnv, + Env::Api: VMApi, + From: TxFrom, + To: TxTo, + Gas: TxGas, +{ + pub fn set_fee_market_address< + Arg0: ProxyArg>, + >( + self, + fee_market_address: Arg0, + ) -> TxTypedCall { + self.wrapped_tx + .payment(NotPayable) + .raw_call("setFeeMarketAddress") + .argument(&fee_market_address) + .original_result() + } + + pub fn set_header_verifier_address< + Arg0: ProxyArg>, + >( + self, + header_verifier_address: Arg0, + ) -> TxTypedCall { + self.wrapped_tx + .payment(NotPayable) + .raw_call("setMultisigAddress") + .argument(&header_verifier_address) + .original_result() + } + + pub fn set_sovereign_bridge_address< + Arg0: ProxyArg>, + >( + self, + bridge_address: Arg0, + ) -> TxTypedCall { + self.wrapped_tx + .payment(NotPayable) + .raw_call("setSovereignBridgeAddress") + .argument(&bridge_address) + .original_result() + } + + pub fn set_max_user_tx_gas_limit< + Arg0: ProxyArg, + Arg1: ProxyArg>>, + >( + self, + new_value: Arg0, + opt_sig: Arg1, + ) -> TxTypedCall { + self.wrapped_tx + .payment(NotPayable) + .raw_call("setMaxUserTxGasLimit") + .argument(&new_value) + .argument(&opt_sig) + .original_result() + } + + pub fn set_burn_and_mint< + Arg0: ProxyArg>>, + Arg1: ProxyArg>>, + >( + self, + opt_signature: Arg0, + tokens: Arg1, + ) -> TxTypedCall { + self.wrapped_tx + .payment(NotPayable) + .raw_call("setBurnAndMint") + .argument(&opt_signature) + .argument(&tokens) + .original_result() + } + + pub fn remove_burn_and_mint< + Arg0: ProxyArg>>, + Arg1: ProxyArg>>, + >( + self, + opt_signature: Arg0, + tokens: Arg1, + ) -> TxTypedCall { + self.wrapped_tx + .payment(NotPayable) + .raw_call("removeBurnAndMint") + .argument(&opt_signature) + .argument(&tokens) + .original_result() + } + + pub fn add_banned_endpoint_names< + Arg0: ProxyArg>>, + Arg1: ProxyArg>>, + >( + self, + opt_signature: Arg0, + names: Arg1, + ) -> TxTypedCall { + self.wrapped_tx + .payment(NotPayable) + .raw_call("addBannedEndpointNames") + .argument(&opt_signature) + .argument(&names) + .original_result() + } + + pub fn remove_banned_endpoint_names< + Arg0: ProxyArg>>, + Arg1: ProxyArg>>, + >( + self, + opt_signature: Arg0, + names: Arg1, + ) -> TxTypedCall { + self.wrapped_tx + .payment(NotPayable) + .raw_call("removeBannedEndpointNames") + .argument(&opt_signature) + .argument(&names) + .original_result() + } + + pub fn deposit_back< + Arg0: ProxyArg>, + >( + self, + to: Arg0, + ) -> TxTypedCall { + self.wrapped_tx + .raw_call("depositBack") + .argument(&to) + .original_result() + } + + /// Create an Elrond -> Sovereign transaction. + pub fn deposit< + Arg0: ProxyArg>, + Arg1: ProxyArg, ManagedVec>>>>, + >( + self, + to: Arg0, + opt_transfer_data: Arg1, + ) -> TxTypedCall { + self.wrapped_tx + .raw_call("deposit") + .argument(&to) + .argument(&opt_transfer_data) + .original_result() + } + + /// Claim funds for failed Elrond -> Sovereign transactions. + /// These are not sent automatically to prevent the contract getting stuck. + /// For example, if the receiver is a SC, a frozen account, etc. + pub fn claim_refund< + Arg0: ProxyArg>, + >( + self, + token_id: Arg0, + ) -> TxTypedCall>> { + self.wrapped_tx + .payment(NotPayable) + .raw_call("claimRefund") + .argument(&token_id) + .original_result() + } + + /// Sets the statuses for the transactions, after they were executed on the Sovereign side. + /// + /// Only TransactionStatus::Executed (3) and TransactionStatus::Rejected (4) values are allowed. + /// Number of provided statuses must be equal to number of transactions in the batch. + pub fn set_transaction_batch_status< + Arg0: ProxyArg, + Arg1: ProxyArg>, + Arg2: ProxyArg>, + >( + self, + batch_id: Arg0, + signature: Arg1, + tx_statuses: Arg2, + ) -> TxTypedCall { + self.wrapped_tx + .payment(NotPayable) + .raw_call("setTransactionBatchStatus") + .argument(&batch_id) + .argument(&signature) + .argument(&tx_statuses) + .original_result() + } + + pub fn set_min_valid_signers< + Arg0: ProxyArg, + >( + self, + new_value: Arg0, + ) -> TxTypedCall { + self.wrapped_tx + .payment(NotPayable) + .raw_call("setMinValidSigners") + .argument(&new_value) + .original_result() + } + + pub fn add_signers< + Arg0: ProxyArg>>, + >( + self, + signers: Arg0, + ) -> TxTypedCall { + self.wrapped_tx + .payment(NotPayable) + .raw_call("addSigners") + .argument(&signers) + .original_result() + } + + pub fn remove_signers< + Arg0: ProxyArg>>, + >( + self, + signers: Arg0, + ) -> TxTypedCall { + self.wrapped_tx + .payment(NotPayable) + .raw_call("removeSigners") + .argument(&signers) + .original_result() + } + + pub fn register_token< + Arg0: ProxyArg>, + Arg1: ProxyArg, + Arg2: ProxyArg>, + Arg3: ProxyArg>, + Arg4: ProxyArg, + >( + self, + sov_token_id: Arg0, + token_type: Arg1, + token_display_name: Arg2, + token_ticker: Arg3, + num_decimals: Arg4, + ) -> TxTypedCall { + self.wrapped_tx + .raw_call("registerToken") + .argument(&sov_token_id) + .argument(&token_type) + .argument(&token_display_name) + .argument(&token_ticker) + .argument(&num_decimals) + .original_result() + } + + pub fn clear_registered_sovereign_token< + Arg0: ProxyArg>, + >( + self, + sov_token_id: Arg0, + ) -> TxTypedCall { + self.wrapped_tx + .payment(NotPayable) + .raw_call("clearRegisteredSovereignToken") + .argument(&sov_token_id) + .original_result() + } + + pub fn clear_registered_multiversx_token< + Arg0: ProxyArg>, + >( + self, + mvx_token_id: Arg0, + ) -> TxTypedCall { + self.wrapped_tx + .payment(NotPayable) + .raw_call("clearRegisteredMultiversxToken") + .argument(&mvx_token_id) + .original_result() + } + + pub fn execute_operations< + Arg0: ProxyArg>, + Arg1: ProxyArg>, + >( + self, + hash_of_hashes: Arg0, + operation: Arg1, + ) -> TxTypedCall { + self.wrapped_tx + .payment(NotPayable) + .raw_call("executeBridgeOps") + .argument(&hash_of_hashes) + .argument(&operation) + .original_result() + } + + pub fn set_max_tx_batch_size< + Arg0: ProxyArg, + >( + self, + new_max_tx_batch_size: Arg0, + ) -> TxTypedCall { + self.wrapped_tx + .payment(NotPayable) + .raw_call("setMaxTxBatchSize") + .argument(&new_max_tx_batch_size) + .original_result() + } + + pub fn set_max_tx_batch_block_duration< + Arg0: ProxyArg, + >( + self, + new_max_tx_batch_block_duration: Arg0, + ) -> TxTypedCall { + self.wrapped_tx + .payment(NotPayable) + .raw_call("setMaxTxBatchBlockDuration") + .argument(&new_max_tx_batch_block_duration) + .original_result() + } + + pub fn get_current_tx_batch( + self, + ) -> TxTypedCall, ManagedAddress, ManagedVec>, ManagedVec>, Option>>>>>> { + self.wrapped_tx + .payment(NotPayable) + .raw_call("getCurrentTxBatch") + .original_result() + } + + pub fn get_first_batch_any_status( + self, + ) -> TxTypedCall, ManagedAddress, ManagedVec>, ManagedVec>, Option>>>>>> { + self.wrapped_tx + .payment(NotPayable) + .raw_call("getFirstBatchAnyStatus") + .original_result() + } + + pub fn get_batch< + Arg0: ProxyArg, + >( + self, + batch_id: Arg0, + ) -> TxTypedCall, ManagedAddress, ManagedVec>, ManagedVec>, Option>>>>>> { + self.wrapped_tx + .payment(NotPayable) + .raw_call("getBatch") + .argument(&batch_id) + .original_result() + } + + pub fn get_batch_status< + Arg0: ProxyArg, + >( + self, + batch_id: Arg0, + ) -> TxTypedCall> { + self.wrapped_tx + .payment(NotPayable) + .raw_call("getBatchStatus") + .argument(&batch_id) + .original_result() + } + + pub fn first_batch_id( + self, + ) -> TxTypedCall { + self.wrapped_tx + .payment(NotPayable) + .raw_call("getFirstBatchId") + .original_result() + } + + pub fn last_batch_id( + self, + ) -> TxTypedCall { + self.wrapped_tx + .payment(NotPayable) + .raw_call("getLastBatchId") + .original_result() + } + + pub fn set_max_bridged_amount< + Arg0: ProxyArg>, + Arg1: ProxyArg>, + >( + self, + token_id: Arg0, + max_amount: Arg1, + ) -> TxTypedCall { + self.wrapped_tx + .payment(NotPayable) + .raw_call("setMaxBridgedAmount") + .argument(&token_id) + .argument(&max_amount) + .original_result() + } + + pub fn max_bridged_amount< + Arg0: ProxyArg>, + >( + self, + token_id: Arg0, + ) -> TxTypedCall> { + self.wrapped_tx + .payment(NotPayable) + .raw_call("getMaxBridgedAmount") + .argument(&token_id) + .original_result() + } + + pub fn end_setup_phase( + self, + ) -> TxTypedCall { + self.wrapped_tx + .payment(NotPayable) + .raw_call("endSetupPhase") + .original_result() + } + + /// Tokens in the whitelist can be transferred without fees + pub fn add_tokens_to_whitelist< + Arg0: ProxyArg>>, + Arg1: ProxyArg>>, + >( + self, + opt_signature: Arg0, + tokens: Arg1, + ) -> TxTypedCall { + self.wrapped_tx + .payment(NotPayable) + .raw_call("addTokensToWhitelist") + .argument(&opt_signature) + .argument(&tokens) + .original_result() + } + + pub fn remove_tokens_from_whitelist< + Arg0: ProxyArg>>, + Arg1: ProxyArg>>, + >( + self, + opt_signature: Arg0, + tokens: Arg1, + ) -> TxTypedCall { + self.wrapped_tx + .payment(NotPayable) + .raw_call("removeTokensFromWhitelist") + .argument(&opt_signature) + .argument(&tokens) + .original_result() + } + + /// Tokens in blacklist cannot be transferred + pub fn add_tokens_to_blacklist< + Arg0: ProxyArg>>, + Arg1: ProxyArg>>, + >( + self, + opt_signature: Arg0, + tokens: Arg1, + ) -> TxTypedCall { + self.wrapped_tx + .payment(NotPayable) + .raw_call("addTokensToBlacklist") + .argument(&opt_signature) + .argument(&tokens) + .original_result() + } + + pub fn remove_tokens_from_blacklist< + Arg0: ProxyArg>>, + Arg1: ProxyArg>>, + >( + self, + opt_signature: Arg0, + tokens: Arg1, + ) -> TxTypedCall { + self.wrapped_tx + .payment(NotPayable) + .raw_call("removeTokensFromBlacklist") + .argument(&opt_signature) + .argument(&tokens) + .original_result() + } + + pub fn token_whitelist( + self, + ) -> TxTypedCall>> { + self.wrapped_tx + .payment(NotPayable) + .raw_call("getTokenWhitelist") + .original_result() + } + + pub fn token_blacklist( + self, + ) -> TxTypedCall>> { + self.wrapped_tx + .payment(NotPayable) + .raw_call("getTokenBlacklist") + .original_result() + } + + pub fn pause_endpoint( + self, + ) -> TxTypedCall { + self.wrapped_tx + .payment(NotPayable) + .raw_call("pause") + .original_result() + } + + pub fn unpause_endpoint( + self, + ) -> TxTypedCall { + self.wrapped_tx + .payment(NotPayable) + .raw_call("unpause") + .original_result() + } + + pub fn paused_status( + self, + ) -> TxTypedCall { + self.wrapped_tx + .payment(NotPayable) + .raw_call("isPaused") + .original_result() + } +} diff --git a/enshrine-esdt-safe/wasm-enshrine-esdt-safe-full/Cargo.lock b/enshrine-esdt-safe/wasm-enshrine-esdt-safe-full/Cargo.lock new file mode 100644 index 00000000..a1b63347 --- /dev/null +++ b/enshrine-esdt-safe/wasm-enshrine-esdt-safe-full/Cargo.lock @@ -0,0 +1,297 @@ +# 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.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cf4b9d6a944f767f8e5e0db018570623c85f3d925ac718db4e06d0187adb21c1" + +[[package]] +name = "bls-signature" +version = "0.0.0" +dependencies = [ + "multiversx-sc", + "transaction", +] + +[[package]] +name = "endian-type" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c34f04666d835ff5d62e058c3995147c06f42fe86ff053337632bca83e42702d" + +[[package]] +name = "enshrine-esdt-safe" +version = "0.0.0" +dependencies = [ + "bls-signature", + "fee-market", + "header-verifier", + "max-bridged-amount-module", + "multiversx-sc", + "multiversx-sc-modules", + "setup-phase", + "token-whitelist", + "transaction", + "tx-batch-module", + "utils", +] + +[[package]] +name = "enshrine-esdt-safe-full-wasm" +version = "0.0.0" +dependencies = [ + "enshrine-esdt-safe", + "multiversx-sc-wasm-adapter", +] + +[[package]] +name = "fee-market" +version = "0.0.0" +dependencies = [ + "bls-signature", + "multiversx-sc", + "pair-mock", + "router-mock", + "transaction", + "utils", +] + +[[package]] +name = "header-verifier" +version = "0.0.0" +dependencies = [ + "bls-signature", + "multiversx-sc", + "transaction", +] + +[[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 = "max-bridged-amount-module" +version = "0.0.0" +dependencies = [ + "multiversx-sc", +] + +[[package]] +name = "multiversx-sc" +version = "0.50.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1d79d1cea2d23e8f2545749c9b31952305b54c415af88b224b985784d3d6529d" +dependencies = [ + "bitflags", + "hex-literal", + "multiversx-sc-codec", + "multiversx-sc-derive", + "num-traits", + "unwrap-infallible", +] + +[[package]] +name = "multiversx-sc-codec" +version = "0.19.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "35c94397b2fba14e40edfa55905b3f453ed57aa06c9b1960ad6a0ca6bfb7a236" +dependencies = [ + "arrayvec", + "multiversx-sc-codec-derive", + "unwrap-infallible", +] + +[[package]] +name = "multiversx-sc-codec-derive" +version = "0.19.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cf72a8042da0bc19da0b8f0d4f61b4c66ae853560fefc69cd8fea87bf1aa8c14" +dependencies = [ + "hex", + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "multiversx-sc-derive" +version = "0.50.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "54e6926e181f6306b69aa805b8d24aa33084497e38ac03e37df457456b6757cc" +dependencies = [ + "hex", + "proc-macro2", + "quote", + "radix_trie", + "syn", +] + +[[package]] +name = "multiversx-sc-modules" +version = "0.50.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7f9a8c10ddadc7adfc04edbdd1ea80a9ae9a7e11202fc4cfb2e08c8e27f17aa5" +dependencies = [ + "multiversx-sc", +] + +[[package]] +name = "multiversx-sc-wasm-adapter" +version = "0.50.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4350e286afce68bb2448d30572f68dd344b2e98e160404dd7f7d13f185e7acfd" +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.19" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "071dfc062690e90b734c0b2273ce72ad0ffa95f0c74596bc250dcfd960262841" +dependencies = [ + "autocfg", +] + +[[package]] +name = "pair-mock" +version = "0.0.0" +dependencies = [ + "multiversx-sc", +] + +[[package]] +name = "proc-macro2" +version = "1.0.82" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8ad3d49ab951a01fbaafe34f2ec74122942fe18a3f9814c3268f1bb72042131b" +dependencies = [ + "unicode-ident", +] + +[[package]] +name = "quote" +version = "1.0.36" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0fa76aaf39101c457836aec0ce2316dbdc3ab723cdda1c6bd4e6ad4208acaca7" +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 = "router-mock" +version = "0.0.0" +dependencies = [ + "multiversx-sc", +] + +[[package]] +name = "setup-phase" +version = "0.0.0" +dependencies = [ + "multiversx-sc", +] + +[[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.61" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c993ed8ccba56ae856363b1845da7266a7cb78e1d146c8a32d54b45a8b831fc9" +dependencies = [ + "proc-macro2", + "quote", + "unicode-ident", +] + +[[package]] +name = "token-whitelist" +version = "0.0.0" +dependencies = [ + "bls-signature", + "multiversx-sc", + "setup-phase", + "utils", +] + +[[package]] +name = "transaction" +version = "0.0.0" +dependencies = [ + "multiversx-sc", +] + +[[package]] +name = "tx-batch-module" +version = "0.0.0" +dependencies = [ + "multiversx-sc", + "transaction", +] + +[[package]] +name = "unicode-ident" +version = "1.0.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3354b9ac3fae1ff6755cb6db53683adb661634f67557942dea4facebec0fee4b" + +[[package]] +name = "unwrap-infallible" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "151ac09978d3c2862c4e39b557f4eceee2cc72150bc4cb4f16abf061b6e381fb" + +[[package]] +name = "utils" +version = "0.0.0" +dependencies = [ + "bls-signature", + "multiversx-sc", +] diff --git a/enshrine-esdt-safe/wasm-enshrine-esdt-safe-full/Cargo.toml b/enshrine-esdt-safe/wasm-enshrine-esdt-safe-full/Cargo.toml new file mode 100644 index 00000000..ecf11fe9 --- /dev/null +++ b/enshrine-esdt-safe/wasm-enshrine-esdt-safe-full/Cargo.toml @@ -0,0 +1,34 @@ +# Code generated by the multiversx-sc build system. DO NOT EDIT. + +# ########################################## +# ############## AUTO-GENERATED ############# +# ########################################## + +[package] +name = "enshrine-esdt-safe-full-wasm" +version = "0.0.0" +edition = "2021" +publish = false + +[lib] +crate-type = ["cdylib"] + +[profile.release] +codegen-units = 1 +opt-level = "z" +lto = true +debug = false +panic = "abort" +overflow-checks = false + +[profile.dev] +panic = "abort" + +[dependencies.enshrine-esdt-safe] +path = ".." + +[dependencies.multiversx-sc-wasm-adapter] +version = "=0.50.3" + +[workspace] +members = ["."] diff --git a/enshrine-esdt-safe/wasm-enshrine-esdt-safe-full/src/lib.rs b/enshrine-esdt-safe/wasm-enshrine-esdt-safe-full/src/lib.rs new file mode 100644 index 00000000..7a4f3f37 --- /dev/null +++ b/enshrine-esdt-safe/wasm-enshrine-esdt-safe-full/src/lib.rs @@ -0,0 +1,67 @@ +// Code generated by the multiversx-sc build system. DO NOT EDIT. + +//////////////////////////////////////////////////// +////////////////// AUTO-GENERATED ////////////////// +//////////////////////////////////////////////////// + +// Init: 1 +// Upgrade: 1 +// Endpoints: 39 +// Async Callback: 1 +// Promise callbacks: 1 +// Total number of exported functions: 43 + +#![no_std] + +multiversx_sc_wasm_adapter::allocator!(); +multiversx_sc_wasm_adapter::panic_handler!(); + +multiversx_sc_wasm_adapter::endpoints! { + enshrine_esdt_safe + ( + init => init + upgrade => upgrade + setFeeMarketAddress => set_fee_market_address + setMultisigAddress => set_header_verifier_address + setSovereignBridgeAddress => set_sovereign_bridge_address + setMaxUserTxGasLimit => set_max_user_tx_gas_limit + setBurnAndMint => set_burn_and_mint + removeBurnAndMint => remove_burn_and_mint + addBannedEndpointNames => add_banned_endpoint_names + removeBannedEndpointNames => remove_banned_endpoint_names + depositBack => deposit_back + deposit => deposit + claimRefund => claim_refund + setTransactionBatchStatus => set_transaction_batch_status + setMinValidSigners => set_min_valid_signers + addSigners => add_signers + removeSigners => remove_signers + registerToken => register_token + clearRegisteredSovereignToken => clear_registered_sovereign_token + clearRegisteredMultiversxToken => clear_registered_multiversx_token + executeBridgeOps => execute_operations + setMaxTxBatchSize => set_max_tx_batch_size + setMaxTxBatchBlockDuration => set_max_tx_batch_block_duration + getCurrentTxBatch => get_current_tx_batch + getFirstBatchAnyStatus => get_first_batch_any_status + getBatch => get_batch + getBatchStatus => get_batch_status + getFirstBatchId => first_batch_id + getLastBatchId => last_batch_id + setMaxBridgedAmount => set_max_bridged_amount + getMaxBridgedAmount => max_bridged_amount + endSetupPhase => end_setup_phase + addTokensToWhitelist => add_tokens_to_whitelist + removeTokensFromWhitelist => remove_tokens_from_whitelist + addTokensToBlacklist => add_tokens_to_blacklist + removeTokensFromBlacklist => remove_tokens_from_blacklist + getTokenWhitelist => token_whitelist + getTokenBlacklist => token_blacklist + pause => pause_endpoint + unpause => unpause_endpoint + isPaused => paused_status + execute => execute + ) +} + +multiversx_sc_wasm_adapter::async_callback! { enshrine_esdt_safe } diff --git a/enshrine-esdt-safe/wasm-enshrine-esdt-safe-view/Cargo.lock b/enshrine-esdt-safe/wasm-enshrine-esdt-safe-view/Cargo.lock new file mode 100644 index 00000000..61aef708 --- /dev/null +++ b/enshrine-esdt-safe/wasm-enshrine-esdt-safe-view/Cargo.lock @@ -0,0 +1,297 @@ +# 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.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cf4b9d6a944f767f8e5e0db018570623c85f3d925ac718db4e06d0187adb21c1" + +[[package]] +name = "bls-signature" +version = "0.0.0" +dependencies = [ + "multiversx-sc", + "transaction", +] + +[[package]] +name = "endian-type" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c34f04666d835ff5d62e058c3995147c06f42fe86ff053337632bca83e42702d" + +[[package]] +name = "enshrine-esdt-safe" +version = "0.0.0" +dependencies = [ + "bls-signature", + "fee-market", + "header-verifier", + "max-bridged-amount-module", + "multiversx-sc", + "multiversx-sc-modules", + "setup-phase", + "token-whitelist", + "transaction", + "tx-batch-module", + "utils", +] + +[[package]] +name = "enshrine-esdt-safe-view-wasm" +version = "0.0.0" +dependencies = [ + "enshrine-esdt-safe", + "multiversx-sc-wasm-adapter", +] + +[[package]] +name = "fee-market" +version = "0.0.0" +dependencies = [ + "bls-signature", + "multiversx-sc", + "pair-mock", + "router-mock", + "transaction", + "utils", +] + +[[package]] +name = "header-verifier" +version = "0.0.0" +dependencies = [ + "bls-signature", + "multiversx-sc", + "transaction", +] + +[[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 = "max-bridged-amount-module" +version = "0.0.0" +dependencies = [ + "multiversx-sc", +] + +[[package]] +name = "multiversx-sc" +version = "0.50.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1d79d1cea2d23e8f2545749c9b31952305b54c415af88b224b985784d3d6529d" +dependencies = [ + "bitflags", + "hex-literal", + "multiversx-sc-codec", + "multiversx-sc-derive", + "num-traits", + "unwrap-infallible", +] + +[[package]] +name = "multiversx-sc-codec" +version = "0.19.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "35c94397b2fba14e40edfa55905b3f453ed57aa06c9b1960ad6a0ca6bfb7a236" +dependencies = [ + "arrayvec", + "multiversx-sc-codec-derive", + "unwrap-infallible", +] + +[[package]] +name = "multiversx-sc-codec-derive" +version = "0.19.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cf72a8042da0bc19da0b8f0d4f61b4c66ae853560fefc69cd8fea87bf1aa8c14" +dependencies = [ + "hex", + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "multiversx-sc-derive" +version = "0.50.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "54e6926e181f6306b69aa805b8d24aa33084497e38ac03e37df457456b6757cc" +dependencies = [ + "hex", + "proc-macro2", + "quote", + "radix_trie", + "syn", +] + +[[package]] +name = "multiversx-sc-modules" +version = "0.50.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7f9a8c10ddadc7adfc04edbdd1ea80a9ae9a7e11202fc4cfb2e08c8e27f17aa5" +dependencies = [ + "multiversx-sc", +] + +[[package]] +name = "multiversx-sc-wasm-adapter" +version = "0.50.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4350e286afce68bb2448d30572f68dd344b2e98e160404dd7f7d13f185e7acfd" +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.19" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "071dfc062690e90b734c0b2273ce72ad0ffa95f0c74596bc250dcfd960262841" +dependencies = [ + "autocfg", +] + +[[package]] +name = "pair-mock" +version = "0.0.0" +dependencies = [ + "multiversx-sc", +] + +[[package]] +name = "proc-macro2" +version = "1.0.82" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8ad3d49ab951a01fbaafe34f2ec74122942fe18a3f9814c3268f1bb72042131b" +dependencies = [ + "unicode-ident", +] + +[[package]] +name = "quote" +version = "1.0.36" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0fa76aaf39101c457836aec0ce2316dbdc3ab723cdda1c6bd4e6ad4208acaca7" +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 = "router-mock" +version = "0.0.0" +dependencies = [ + "multiversx-sc", +] + +[[package]] +name = "setup-phase" +version = "0.0.0" +dependencies = [ + "multiversx-sc", +] + +[[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.61" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c993ed8ccba56ae856363b1845da7266a7cb78e1d146c8a32d54b45a8b831fc9" +dependencies = [ + "proc-macro2", + "quote", + "unicode-ident", +] + +[[package]] +name = "token-whitelist" +version = "0.0.0" +dependencies = [ + "bls-signature", + "multiversx-sc", + "setup-phase", + "utils", +] + +[[package]] +name = "transaction" +version = "0.0.0" +dependencies = [ + "multiversx-sc", +] + +[[package]] +name = "tx-batch-module" +version = "0.0.0" +dependencies = [ + "multiversx-sc", + "transaction", +] + +[[package]] +name = "unicode-ident" +version = "1.0.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3354b9ac3fae1ff6755cb6db53683adb661634f67557942dea4facebec0fee4b" + +[[package]] +name = "unwrap-infallible" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "151ac09978d3c2862c4e39b557f4eceee2cc72150bc4cb4f16abf061b6e381fb" + +[[package]] +name = "utils" +version = "0.0.0" +dependencies = [ + "bls-signature", + "multiversx-sc", +] diff --git a/enshrine-esdt-safe/wasm-enshrine-esdt-safe-view/Cargo.toml b/enshrine-esdt-safe/wasm-enshrine-esdt-safe-view/Cargo.toml new file mode 100644 index 00000000..d27ae33c --- /dev/null +++ b/enshrine-esdt-safe/wasm-enshrine-esdt-safe-view/Cargo.toml @@ -0,0 +1,34 @@ +# Code generated by the multiversx-sc build system. DO NOT EDIT. + +# ########################################## +# ############## AUTO-GENERATED ############# +# ########################################## + +[package] +name = "enshrine-esdt-safe-view-wasm" +version = "0.0.0" +edition = "2021" +publish = false + +[lib] +crate-type = ["cdylib"] + +[profile.release] +codegen-units = 1 +opt-level = "z" +lto = true +debug = false +panic = "abort" +overflow-checks = false + +[profile.dev] +panic = "abort" + +[dependencies.enshrine-esdt-safe] +path = ".." + +[dependencies.multiversx-sc-wasm-adapter] +version = "=0.50.3" + +[workspace] +members = ["."] diff --git a/enshrine-esdt-safe/wasm-enshrine-esdt-safe-view/src/lib.rs b/enshrine-esdt-safe/wasm-enshrine-esdt-safe-view/src/lib.rs new file mode 100644 index 00000000..24483978 --- /dev/null +++ b/enshrine-esdt-safe/wasm-enshrine-esdt-safe-view/src/lib.rs @@ -0,0 +1,25 @@ +// Code generated by the multiversx-sc build system. DO NOT EDIT. + +//////////////////////////////////////////////////// +////////////////// AUTO-GENERATED ////////////////// +//////////////////////////////////////////////////// + +// Init: 1 +// Endpoints: 0 +// Async Callback (empty): 1 +// Total number of exported functions: 2 + +#![no_std] + +multiversx_sc_wasm_adapter::allocator!(); +multiversx_sc_wasm_adapter::panic_handler!(); + +multiversx_sc_wasm_adapter::external_view_init! {} + +multiversx_sc_wasm_adapter::external_view_endpoints! { + enshrine_esdt_safe + ( + ) +} + +multiversx_sc_wasm_adapter::async_callback_empty! {} diff --git a/esdt-safe/src/esdt_safe_proxy.rs b/esdt-safe/src/esdt_safe_proxy.rs index 87d50f05..a5dd5653 100644 --- a/esdt-safe/src/esdt_safe_proxy.rs +++ b/esdt-safe/src/esdt_safe_proxy.rs @@ -54,8 +54,9 @@ where min_valid_signers: Arg1, initiator_address: Arg2, signers: Arg3, - ) -> TxProxyDeploy { + ) -> TxTypedDeploy { self.wrapped_tx + .payment(NotPayable) .raw_deploy() .argument(&is_sovereign_chain) .argument(&min_valid_signers) @@ -76,8 +77,9 @@ where { pub fn upgrade( self, - ) -> TxProxyUpgrade { + ) -> TxTypedUpgrade { self.wrapped_tx + .payment(NotPayable) .raw_upgrade() .original_result() } @@ -97,8 +99,9 @@ where >( self, fee_market_address: Arg0, - ) -> TxProxyCall { + ) -> TxTypedCall { self.wrapped_tx + .payment(NotPayable) .raw_call("setFeeMarketAddress") .argument(&fee_market_address) .original_result() @@ -109,8 +112,9 @@ where >( self, header_verifier_address: Arg0, - ) -> TxProxyCall { + ) -> TxTypedCall { self.wrapped_tx + .payment(NotPayable) .raw_call("setMultisigAddress") .argument(&header_verifier_address) .original_result() @@ -121,8 +125,9 @@ where >( self, bridge_address: Arg0, - ) -> TxProxyCall { + ) -> TxTypedCall { self.wrapped_tx + .payment(NotPayable) .raw_call("setSovereignBridgeAddress") .argument(&bridge_address) .original_result() @@ -135,8 +140,9 @@ where self, new_value: Arg0, opt_sig: Arg1, - ) -> TxProxyCall { + ) -> TxTypedCall { self.wrapped_tx + .payment(NotPayable) .raw_call("setMaxUserTxGasLimit") .argument(&new_value) .argument(&opt_sig) @@ -150,8 +156,9 @@ where self, opt_signature: Arg0, tokens: Arg1, - ) -> TxProxyCall { + ) -> TxTypedCall { self.wrapped_tx + .payment(NotPayable) .raw_call("setBurnAndMint") .argument(&opt_signature) .argument(&tokens) @@ -165,8 +172,9 @@ where self, opt_signature: Arg0, tokens: Arg1, - ) -> TxProxyCall { + ) -> TxTypedCall { self.wrapped_tx + .payment(NotPayable) .raw_call("removeBurnAndMint") .argument(&opt_signature) .argument(&tokens) @@ -180,8 +188,9 @@ where self, opt_signature: Arg0, names: Arg1, - ) -> TxProxyCall { + ) -> TxTypedCall { self.wrapped_tx + .payment(NotPayable) .raw_call("addBannedEndpointNames") .argument(&opt_signature) .argument(&names) @@ -195,8 +204,9 @@ where self, opt_signature: Arg0, names: Arg1, - ) -> TxProxyCall { + ) -> TxTypedCall { self.wrapped_tx + .payment(NotPayable) .raw_call("removeBannedEndpointNames") .argument(&opt_signature) .argument(&names) @@ -208,7 +218,7 @@ where >( self, to: Arg0, - ) -> TxProxyCall { + ) -> TxTypedCall { self.wrapped_tx .raw_call("depositBack") .argument(&to) @@ -223,7 +233,7 @@ where self, to: Arg0, opt_transfer_data: Arg1, - ) -> TxProxyCall { + ) -> TxTypedCall { self.wrapped_tx .raw_call("deposit") .argument(&to) @@ -239,8 +249,9 @@ where >( self, token_id: Arg0, - ) -> TxProxyCall>> { + ) -> TxTypedCall>> { self.wrapped_tx + .payment(NotPayable) .raw_call("claimRefund") .argument(&token_id) .original_result() @@ -259,8 +270,9 @@ where batch_id: Arg0, signature: Arg1, tx_statuses: Arg2, - ) -> TxProxyCall { + ) -> TxTypedCall { self.wrapped_tx + .payment(NotPayable) .raw_call("setTransactionBatchStatus") .argument(&batch_id) .argument(&signature) @@ -273,8 +285,9 @@ where >( self, new_value: Arg0, - ) -> TxProxyCall { + ) -> TxTypedCall { self.wrapped_tx + .payment(NotPayable) .raw_call("setMinValidSigners") .argument(&new_value) .original_result() @@ -285,8 +298,9 @@ where >( self, signers: Arg0, - ) -> TxProxyCall { + ) -> TxTypedCall { self.wrapped_tx + .payment(NotPayable) .raw_call("addSigners") .argument(&signers) .original_result() @@ -297,8 +311,9 @@ where >( self, signers: Arg0, - ) -> TxProxyCall { + ) -> TxTypedCall { self.wrapped_tx + .payment(NotPayable) .raw_call("removeSigners") .argument(&signers) .original_result() @@ -317,7 +332,7 @@ where token_display_name: Arg2, token_ticker: Arg3, num_decimals: Arg4, - ) -> TxProxyCall { + ) -> TxTypedCall { self.wrapped_tx .raw_call("registerToken") .argument(&sov_token_id) @@ -333,8 +348,9 @@ where >( self, sov_token_id: Arg0, - ) -> TxProxyCall { + ) -> TxTypedCall { self.wrapped_tx + .payment(NotPayable) .raw_call("clearRegisteredSovereignToken") .argument(&sov_token_id) .original_result() @@ -345,8 +361,9 @@ where >( self, mvx_token_id: Arg0, - ) -> TxProxyCall { + ) -> TxTypedCall { self.wrapped_tx + .payment(NotPayable) .raw_call("clearRegisteredMultiversxToken") .argument(&mvx_token_id) .original_result() @@ -359,8 +376,9 @@ where self, hash_of_hashes: Arg0, operation: Arg1, - ) -> TxProxyCall { + ) -> TxTypedCall { self.wrapped_tx + .payment(NotPayable) .raw_call("executeBridgeOps") .argument(&hash_of_hashes) .argument(&operation) @@ -372,8 +390,9 @@ where >( self, new_max_tx_batch_size: Arg0, - ) -> TxProxyCall { + ) -> TxTypedCall { self.wrapped_tx + .payment(NotPayable) .raw_call("setMaxTxBatchSize") .argument(&new_max_tx_batch_size) .original_result() @@ -384,8 +403,9 @@ where >( self, new_max_tx_batch_block_duration: Arg0, - ) -> TxProxyCall { + ) -> TxTypedCall { self.wrapped_tx + .payment(NotPayable) .raw_call("setMaxTxBatchBlockDuration") .argument(&new_max_tx_batch_block_duration) .original_result() @@ -393,16 +413,18 @@ where pub fn get_current_tx_batch( self, - ) -> TxProxyCall, ManagedAddress, ManagedVec>, ManagedVec>, Option>>>>>> { + ) -> TxTypedCall, ManagedAddress, ManagedVec>, ManagedVec>, Option>>>>>> { self.wrapped_tx + .payment(NotPayable) .raw_call("getCurrentTxBatch") .original_result() } pub fn get_first_batch_any_status( self, - ) -> TxProxyCall, ManagedAddress, ManagedVec>, ManagedVec>, Option>>>>>> { + ) -> TxTypedCall, ManagedAddress, ManagedVec>, ManagedVec>, Option>>>>>> { self.wrapped_tx + .payment(NotPayable) .raw_call("getFirstBatchAnyStatus") .original_result() } @@ -412,8 +434,9 @@ where >( self, batch_id: Arg0, - ) -> TxProxyCall, ManagedAddress, ManagedVec>, ManagedVec>, Option>>>>>> { + ) -> TxTypedCall, ManagedAddress, ManagedVec>, ManagedVec>, Option>>>>>> { self.wrapped_tx + .payment(NotPayable) .raw_call("getBatch") .argument(&batch_id) .original_result() @@ -424,8 +447,9 @@ where >( self, batch_id: Arg0, - ) -> TxProxyCall> { + ) -> TxTypedCall> { self.wrapped_tx + .payment(NotPayable) .raw_call("getBatchStatus") .argument(&batch_id) .original_result() @@ -433,16 +457,18 @@ where pub fn first_batch_id( self, - ) -> TxProxyCall { + ) -> TxTypedCall { self.wrapped_tx + .payment(NotPayable) .raw_call("getFirstBatchId") .original_result() } pub fn last_batch_id( self, - ) -> TxProxyCall { + ) -> TxTypedCall { self.wrapped_tx + .payment(NotPayable) .raw_call("getLastBatchId") .original_result() } @@ -454,8 +480,9 @@ where self, token_id: Arg0, max_amount: Arg1, - ) -> TxProxyCall { + ) -> TxTypedCall { self.wrapped_tx + .payment(NotPayable) .raw_call("setMaxBridgedAmount") .argument(&token_id) .argument(&max_amount) @@ -467,8 +494,9 @@ where >( self, token_id: Arg0, - ) -> TxProxyCall> { + ) -> TxTypedCall> { self.wrapped_tx + .payment(NotPayable) .raw_call("getMaxBridgedAmount") .argument(&token_id) .original_result() @@ -476,8 +504,9 @@ where pub fn end_setup_phase( self, - ) -> TxProxyCall { + ) -> TxTypedCall { self.wrapped_tx + .payment(NotPayable) .raw_call("endSetupPhase") .original_result() } @@ -490,8 +519,9 @@ where self, opt_signature: Arg0, tokens: Arg1, - ) -> TxProxyCall { + ) -> TxTypedCall { self.wrapped_tx + .payment(NotPayable) .raw_call("addTokensToWhitelist") .argument(&opt_signature) .argument(&tokens) @@ -505,8 +535,9 @@ where self, opt_signature: Arg0, tokens: Arg1, - ) -> TxProxyCall { + ) -> TxTypedCall { self.wrapped_tx + .payment(NotPayable) .raw_call("removeTokensFromWhitelist") .argument(&opt_signature) .argument(&tokens) @@ -521,8 +552,9 @@ where self, opt_signature: Arg0, tokens: Arg1, - ) -> TxProxyCall { + ) -> TxTypedCall { self.wrapped_tx + .payment(NotPayable) .raw_call("addTokensToBlacklist") .argument(&opt_signature) .argument(&tokens) @@ -536,8 +568,9 @@ where self, opt_signature: Arg0, tokens: Arg1, - ) -> TxProxyCall { + ) -> TxTypedCall { self.wrapped_tx + .payment(NotPayable) .raw_call("removeTokensFromBlacklist") .argument(&opt_signature) .argument(&tokens) @@ -546,40 +579,45 @@ where pub fn token_whitelist( self, - ) -> TxProxyCall>> { + ) -> TxTypedCall>> { self.wrapped_tx + .payment(NotPayable) .raw_call("getTokenWhitelist") .original_result() } pub fn token_blacklist( self, - ) -> TxProxyCall>> { + ) -> TxTypedCall>> { self.wrapped_tx + .payment(NotPayable) .raw_call("getTokenBlacklist") .original_result() } pub fn pause_endpoint( self, - ) -> TxProxyCall { + ) -> TxTypedCall { self.wrapped_tx + .payment(NotPayable) .raw_call("pause") .original_result() } pub fn unpause_endpoint( self, - ) -> TxProxyCall { + ) -> TxTypedCall { self.wrapped_tx + .payment(NotPayable) .raw_call("unpause") .original_result() } pub fn paused_status( self, - ) -> TxProxyCall { + ) -> TxTypedCall { self.wrapped_tx + .payment(NotPayable) .raw_call("isPaused") .original_result() } diff --git a/fee-market/src/fee_market_proxy.rs b/fee-market/src/fee_market_proxy.rs index 35e30bd0..4f4528f4 100644 --- a/fee-market/src/fee_market_proxy.rs +++ b/fee-market/src/fee_market_proxy.rs @@ -54,8 +54,9 @@ where price_aggregator_address: Arg1, usdc_token_id: Arg2, wegld_token_id: Arg3, - ) -> TxProxyDeploy { + ) -> TxTypedDeploy { self.wrapped_tx + .payment(NotPayable) .raw_deploy() .argument(&esdt_safe_address) .argument(&price_aggregator_address) @@ -76,8 +77,9 @@ where { pub fn upgrade( self, - ) -> TxProxyUpgrade { + ) -> TxTypedUpgrade { self.wrapped_tx + .payment(NotPayable) .raw_upgrade() .original_result() } @@ -94,16 +96,18 @@ where { pub fn enable_fee( self, - ) -> TxProxyCall { + ) -> TxTypedCall { self.wrapped_tx + .payment(NotPayable) .raw_call("enableFee") .original_result() } pub fn disable_fee( self, - ) -> TxProxyCall { + ) -> TxTypedCall { self.wrapped_tx + .payment(NotPayable) .raw_call("disableFee") .original_result() } @@ -115,8 +119,9 @@ where self, base_token: Arg0, fee_type: Arg1, - ) -> TxProxyCall { + ) -> TxTypedCall { self.wrapped_tx + .payment(NotPayable) .raw_call("addFee") .argument(&base_token) .argument(&fee_type) @@ -128,8 +133,9 @@ where >( self, base_token: Arg0, - ) -> TxProxyCall { + ) -> TxTypedCall { self.wrapped_tx + .payment(NotPayable) .raw_call("removeFee") .argument(&base_token) .original_result() @@ -140,8 +146,9 @@ where >( self, token_id: Arg0, - ) -> TxProxyCall> { + ) -> TxTypedCall> { self.wrapped_tx + .payment(NotPayable) .raw_call("getTokenFee") .argument(&token_id) .original_result() @@ -152,8 +159,9 @@ where >( self, users: Arg0, - ) -> TxProxyCall { + ) -> TxTypedCall { self.wrapped_tx + .payment(NotPayable) .raw_call("addUsersToWhitelist") .argument(&users) .original_result() @@ -164,8 +172,9 @@ where >( self, users: Arg0, - ) -> TxProxyCall { + ) -> TxTypedCall { self.wrapped_tx + .payment(NotPayable) .raw_call("removeUsersFromWhitelist") .argument(&users) .original_result() @@ -177,8 +186,9 @@ where >( self, address_percentage_pairs: Arg0, - ) -> TxProxyCall { + ) -> TxTypedCall { self.wrapped_tx + .payment(NotPayable) .raw_call("distributeFees") .argument(&address_percentage_pairs) .original_result() @@ -193,7 +203,7 @@ where original_caller: Arg0, total_transfers: Arg1, opt_gas_limit: Arg2, - ) -> TxProxyCall> { + ) -> TxTypedCall> { self.wrapped_tx .raw_call("subtractFee") .argument(&original_caller) @@ -204,8 +214,9 @@ where pub fn users_whitelist( self, - ) -> TxProxyCall>> { + ) -> TxTypedCall>> { self.wrapped_tx + .payment(NotPayable) .raw_call("getUsersWhitelist") .original_result() } @@ -215,8 +226,9 @@ where >( self, new_value: Arg0, - ) -> TxProxyCall { + ) -> TxTypedCall { self.wrapped_tx + .payment(NotPayable) .raw_call("setMinValidSigners") .argument(&new_value) .original_result() @@ -227,8 +239,9 @@ where >( self, signers: Arg0, - ) -> TxProxyCall { + ) -> TxTypedCall { self.wrapped_tx + .payment(NotPayable) .raw_call("addSigners") .argument(&signers) .original_result() @@ -239,8 +252,9 @@ where >( self, signers: Arg0, - ) -> TxProxyCall { + ) -> TxTypedCall { self.wrapped_tx + .payment(NotPayable) .raw_call("removeSigners") .argument(&signers) .original_result() diff --git a/header-verifier/src/header_verifier_proxy.rs b/header-verifier/src/header_verifier_proxy.rs index 7a99b0e2..4f57c709 100644 --- a/header-verifier/src/header_verifier_proxy.rs +++ b/header-verifier/src/header_verifier_proxy.rs @@ -48,8 +48,9 @@ where >( self, bls_pub_keys: Arg0, - ) -> TxProxyDeploy { + ) -> TxTypedDeploy { self.wrapped_tx + .payment(NotPayable) .raw_deploy() .argument(&bls_pub_keys) .original_result() @@ -67,8 +68,9 @@ where { pub fn upgrade( self, - ) -> TxProxyUpgrade { + ) -> TxTypedUpgrade { self.wrapped_tx + .payment(NotPayable) .raw_upgrade() .original_result() } @@ -92,8 +94,9 @@ where signature: Arg0, bridge_operations_hash: Arg1, operations_hashes: Arg2, - ) -> TxProxyCall { + ) -> TxTypedCall { self.wrapped_tx + .payment(NotPayable) .raw_call("registerBridgeOps") .argument(&signature) .argument(&bridge_operations_hash) @@ -106,8 +109,9 @@ where >( self, esdt_safe_address: Arg0, - ) -> TxProxyCall { + ) -> TxTypedCall { self.wrapped_tx + .payment(NotPayable) .raw_call("setEsdtSafeAddress") .argument(&esdt_safe_address) .original_result() @@ -120,8 +124,9 @@ where self, hash_of_hashes: Arg0, operation_hash: Arg1, - ) -> TxProxyCall { + ) -> TxTypedCall { self.wrapped_tx + .payment(NotPayable) .raw_call("removeExecutedHash") .argument(&hash_of_hashes) .argument(&operation_hash) @@ -133,8 +138,9 @@ where >( self, new_value: Arg0, - ) -> TxProxyCall { + ) -> TxTypedCall { self.wrapped_tx + .payment(NotPayable) .raw_call("setMinValidSigners") .argument(&new_value) .original_result() @@ -145,8 +151,9 @@ where >( self, signers: Arg0, - ) -> TxProxyCall { + ) -> TxTypedCall { self.wrapped_tx + .payment(NotPayable) .raw_call("addSigners") .argument(&signers) .original_result() @@ -157,8 +164,9 @@ where >( self, signers: Arg0, - ) -> TxProxyCall { + ) -> TxTypedCall { self.wrapped_tx + .payment(NotPayable) .raw_call("removeSigners") .argument(&signers) .original_result() From 935eb71a542f368b3408f0660880850739cfc88e Mon Sep 17 00:00:00 2001 From: Andrei Baltariu Date: Wed, 5 Jun 2024 14:54:16 +0300 Subject: [PATCH 004/523] Added enshrine logic on create and prefix check --- common/utils/src/lib.rs | 16 +++++++++++ esdt-safe/src/to_sovereign/create_tx.rs | 37 ++++++------------------- 2 files changed, 24 insertions(+), 29 deletions(-) diff --git a/common/utils/src/lib.rs b/common/utils/src/lib.rs index 61ed078e..b168270f 100644 --- a/common/utils/src/lib.rs +++ b/common/utils/src/lib.rs @@ -65,4 +65,20 @@ pub trait UtilsModule: bls_signature::BlsSignatureModule { list } + + fn has_sov_token_prefix(&self, token_id: &TokenIdentifier) -> bool { + let dash = b'-'; + let mut array_buffer = [0u8, 30]; + let slice = token_id.as_managed_buffer().load_to_byte_array(&mut array_buffer); + + // if slice.contains(&dash) { + // let result = slice.split(|dash| slice.contains(&dash)); + // + // for slice in result { + // + // } + // } + + slice.contains(&dash) + } } diff --git a/esdt-safe/src/to_sovereign/create_tx.rs b/esdt-safe/src/to_sovereign/create_tx.rs index 7649bb89..f9fa4301 100644 --- a/esdt-safe/src/to_sovereign/create_tx.rs +++ b/esdt-safe/src/to_sovereign/create_tx.rs @@ -231,41 +231,20 @@ pub trait CreateTxModule: current_token_data.amount = payment.amount.clone(); - if self.is_sovereign_chain().get() { + if self.is_sovereign_chain().get() || self.has_sov_token_prefix(&payment.token_identifier) + { self.send().esdt_local_burn( &payment.token_identifier, payment.token_nonce, &payment.amount, ); - - event_payments.push(MultiValue3(( - payment.token_identifier.clone(), - payment.token_nonce, - current_token_data.clone(), - ))); - } else { - let sov_token_id = self - .multiversx_to_sovereign_token_id(&payment.token_identifier) - .get(); - - if !sov_token_id.is_valid_esdt_identifier() { - event_payments.push(MultiValue3(( - payment.token_identifier, - payment.token_nonce, - current_token_data.clone(), - ))); - - continue; - } - - let sov_token_nonce = self.remove_sovereign_token(payment, &sov_token_id); - - event_payments.push(MultiValue3(( - sov_token_id, - sov_token_nonce, - current_token_data.clone(), - ))); } + + event_payments.push(MultiValue3(( + payment.token_identifier.clone(), + payment.token_nonce, + current_token_data.clone(), + ))); } let caller = self.blockchain().get_caller(); From 29f812e432ce99bf6bf8d0e533d51c0b342660fe Mon Sep 17 00:00:00 2001 From: Andrei Baltariu Date: Thu, 6 Jun 2024 14:04:17 +0300 Subject: [PATCH 005/523] Added enshrine logic + unified syntax --- .../src/from_sovereign/transfer_tokens.rs | 82 ++++++++++++------- esdt-safe/src/to_sovereign/create_tx.rs | 23 +++--- 2 files changed, 63 insertions(+), 42 deletions(-) diff --git a/esdt-safe/src/from_sovereign/transfer_tokens.rs b/esdt-safe/src/from_sovereign/transfer_tokens.rs index 4a4dd8c8..8ccddd1b 100644 --- a/esdt-safe/src/from_sovereign/transfer_tokens.rs +++ b/esdt-safe/src/from_sovereign/transfer_tokens.rs @@ -1,4 +1,5 @@ -use multiversx_sc::{api::ESDT_MULTI_TRANSFER_FUNC_NAME, storage::StorageKey}; +use builtin_func_names::{ESDT_MULTI_TRANSFER_FUNC_NAME, ESDT_NFT_CREATE_FUNC_NAME}; +use multiversx_sc::{codec, storage::StorageKey}; use transaction::{ BatchId, GasLimit, Operation, OperationData, OperationEsdtPayment, OperationTuple, }; @@ -57,47 +58,68 @@ pub trait TransferTokensModule: let mut output_payments = ManagedVec::new(); for operation_token in operation_tokens.iter() { - let mx_token_id_state = self - .sovereign_to_multiversx_token_id(&operation_token.token_identifier) - .get(); - - let mx_token_id = match mx_token_id_state { - // token is from sovereign -> continue and mint - TokenMapperState::Token(token_id) => token_id, - // token is from mainchain -> push token - _ => { - // TODO: will use sovereign prefix - output_payments.push(operation_token.clone()); + if !self.has_sov_token_prefix(&operation_token.token_identifier) { + output_payments.push(operation_token.clone()); + continue; + } - continue; + let nonce = operation_token.token_nonce; + if nonce == 0 { + let _ = self.send().esdt_system_sc_proxy().mint( + &operation_token.token_identifier, + &operation_token.token_data.amount, + ); + } else { + // nonce = self.send().esdt_nft_create( + // &operation_token.token_identifier, + // &operation_token.token_data.amount, + // &operation_token.token_data.name, + // &operation_token.token_data.royalties, + // &operation_token.token_data.hash, + // &operation_token.token_data.attributes, + // &operation_token.token_data.uris, + // ); + + let token_data = operation_token.token_data.clone(); + let mut arg_buffer = ManagedArgBuffer::new(); + + arg_buffer.push_arg(&operation_token.token_identifier); + arg_buffer.push_arg(token_data.amount); + arg_buffer.push_arg(token_data.name); + arg_buffer.push_arg(token_data.royalties); + arg_buffer.push_arg(token_data.hash); + arg_buffer.push_arg(token_data.attributes); + + let uris = token_data.uris.clone(); + + if uris.is_empty() { + // at least one URI is required, so we push an empty one + arg_buffer.push_arg(codec::Empty); + } else { + // The API function has the last argument as variadic, + // so we top-encode each and send as separate argument + for uri in &uris { + arg_buffer.push_arg(uri); + } } - }; + arg_buffer.push_arg(operation_token.token_nonce); - if operation_token.token_nonce == 0 { - self.send() - .esdt_local_mint(&mx_token_id, 0, &operation_token.token_data.amount); - - output_payments.push(OperationEsdtPayment { - token_identifier: mx_token_id, - token_nonce: 0, - token_data: operation_token.token_data, - }); - - continue; + self.send_raw().call_local_esdt_built_in_function( + self.blockchain().get_gas_left(), + &ManagedBuffer::from(ESDT_NFT_CREATE_FUNC_NAME), + &arg_buffer, + ); } - let nft_nonce = self.mint_and_save_token(&mx_token_id, &operation_token); - output_payments.push(OperationEsdtPayment { - token_identifier: mx_token_id, - token_nonce: nft_nonce, + token_identifier: operation_token.token_identifier, + token_nonce: nonce, token_data: operation_token.token_data, }); } output_payments } - fn mint_and_save_token( self, mx_token_id: &TokenIdentifier, diff --git a/esdt-safe/src/to_sovereign/create_tx.rs b/esdt-safe/src/to_sovereign/create_tx.rs index f9fa4301..86549f15 100644 --- a/esdt-safe/src/to_sovereign/create_tx.rs +++ b/esdt-safe/src/to_sovereign/create_tx.rs @@ -231,13 +231,13 @@ pub trait CreateTxModule: current_token_data.amount = payment.amount.clone(); - if self.is_sovereign_chain().get() || self.has_sov_token_prefix(&payment.token_identifier) + if self.is_sovereign_chain().get() + || self.has_sov_token_prefix(&payment.token_identifier) { - self.send().esdt_local_burn( - &payment.token_identifier, - payment.token_nonce, - &payment.amount, - ); + let _ = self + .send() + .esdt_system_sc_proxy() + .burn(&payment.token_identifier, &payment.amount); } event_payments.push(MultiValue3(( @@ -253,7 +253,7 @@ pub trait CreateTxModule: // refund refundable_tokens for payment in &refundable_payments { - self.send().direct_non_zero_esdt_payment(&caller, &payment); + let _ = self.tx().to(&caller).payment(&payment); } let tx_nonce = self.get_and_save_next_tx_id(); @@ -274,11 +274,10 @@ pub trait CreateTxModule: payment: EsdtTokenPayment, sov_token_id: &TokenIdentifier, ) -> u64 { - self.send().esdt_local_burn( - &payment.token_identifier, - payment.token_nonce, - &payment.amount, - ); + let _ = self + .send() + .esdt_system_sc_proxy() + .burn(&payment.token_identifier, &payment.amount); let mut sov_token_nonce = 0; From acb086308faf8fa6ff5223a0d54b766cb3dbe10b Mon Sep 17 00:00:00 2001 From: Andrei Baltariu Date: Thu, 6 Jun 2024 14:18:42 +0300 Subject: [PATCH 006/523] Modified sovereign prefix verification --- common/utils/src/lib.rs | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/common/utils/src/lib.rs b/common/utils/src/lib.rs index b168270f..6ae5727e 100644 --- a/common/utils/src/lib.rs +++ b/common/utils/src/lib.rs @@ -71,14 +71,12 @@ pub trait UtilsModule: bls_signature::BlsSignatureModule { let mut array_buffer = [0u8, 30]; let slice = token_id.as_managed_buffer().load_to_byte_array(&mut array_buffer); - // if slice.contains(&dash) { - // let result = slice.split(|dash| slice.contains(&dash)); - // - // for slice in result { - // - // } - // } - - slice.contains(&dash) + let counter = slice.iter().filter(|&&c| c == dash).count(); + + if counter >= 2 { + return true + } + + false } } From 969b821d3c4018de1d4dfccb1e0ee7cdc3e89457 Mon Sep 17 00:00:00 2001 From: Andrei Baltariu Date: Thu, 6 Jun 2024 14:23:19 +0300 Subject: [PATCH 007/523] Removed unused function --- .../src/from_sovereign/transfer_tokens.rs | 34 ------------------- 1 file changed, 34 deletions(-) diff --git a/esdt-safe/src/from_sovereign/transfer_tokens.rs b/esdt-safe/src/from_sovereign/transfer_tokens.rs index 8ccddd1b..9a3eea2e 100644 --- a/esdt-safe/src/from_sovereign/transfer_tokens.rs +++ b/esdt-safe/src/from_sovereign/transfer_tokens.rs @@ -120,40 +120,6 @@ pub trait TransferTokensModule: output_payments } - fn mint_and_save_token( - self, - mx_token_id: &TokenIdentifier, - operation_token: &OperationEsdtPayment, - ) -> u64 { - // mint NFT - let nft_nonce = self.send().esdt_nft_create( - mx_token_id, - &operation_token.token_data.amount, - &operation_token.token_data.name, - &operation_token.token_data.royalties, - &operation_token.token_data.hash, - &operation_token.token_data.attributes, - &operation_token.token_data.uris, - ); - - // save token id and nonce - self.sovereign_esdt_token_info_mapper( - &operation_token.token_identifier, - &operation_token.token_nonce, - ) - .set(EsdtTokenInfo { - token_identifier: mx_token_id.clone(), - token_nonce: nft_nonce, - }); - - self.multiversx_esdt_token_info_mapper(mx_token_id, &nft_nonce) - .set(EsdtTokenInfo { - token_identifier: operation_token.token_identifier.clone(), - token_nonce: operation_token.token_nonce, - }); - - nft_nonce - } fn distribute_payments( &self, From 63ac4d078352539b59ea0b46015814721782ac9f Mon Sep 17 00:00:00 2001 From: Andrei Baltariu Date: Thu, 6 Jun 2024 15:51:49 +0300 Subject: [PATCH 008/523] Removed unused import --- esdt-safe/src/from_sovereign/transfer_tokens.rs | 2 -- 1 file changed, 2 deletions(-) diff --git a/esdt-safe/src/from_sovereign/transfer_tokens.rs b/esdt-safe/src/from_sovereign/transfer_tokens.rs index 9a3eea2e..a40001cd 100644 --- a/esdt-safe/src/from_sovereign/transfer_tokens.rs +++ b/esdt-safe/src/from_sovereign/transfer_tokens.rs @@ -6,8 +6,6 @@ use transaction::{ use crate::to_sovereign; -use super::token_mapping::EsdtTokenInfo; - multiversx_sc::imports!(); const CALLBACK_GAS: GasLimit = 10_000_000; // Increase if not enough From fbedb4b7ca1abb276fc32fae08cdf6f49e222c3d Mon Sep 17 00:00:00 2001 From: Andrei Baltariu Date: Mon, 10 Jun 2024 14:29:44 +0300 Subject: [PATCH 009/523] Modified mint and prefix logic --- common/utils/src/lib.rs | 2 +- .../src/from_sovereign/transfer_tokens.rs | 30 +++++++++---------- 2 files changed, 16 insertions(+), 16 deletions(-) diff --git a/common/utils/src/lib.rs b/common/utils/src/lib.rs index 6ae5727e..810c1be9 100644 --- a/common/utils/src/lib.rs +++ b/common/utils/src/lib.rs @@ -73,7 +73,7 @@ pub trait UtilsModule: bls_signature::BlsSignatureModule { let counter = slice.iter().filter(|&&c| c == dash).count(); - if counter >= 2 { + if counter == 2 { return true } diff --git a/enshrine-esdt-safe/src/from_sovereign/transfer_tokens.rs b/enshrine-esdt-safe/src/from_sovereign/transfer_tokens.rs index 4a4dd8c8..8f69d815 100644 --- a/enshrine-esdt-safe/src/from_sovereign/transfer_tokens.rs +++ b/enshrine-esdt-safe/src/from_sovereign/transfer_tokens.rs @@ -115,21 +115,21 @@ pub trait TransferTokensModule: ); // save token id and nonce - self.sovereign_esdt_token_info_mapper( - &operation_token.token_identifier, - &operation_token.token_nonce, - ) - .set(EsdtTokenInfo { - token_identifier: mx_token_id.clone(), - token_nonce: nft_nonce, - }); - - self.multiversx_esdt_token_info_mapper(mx_token_id, &nft_nonce) - .set(EsdtTokenInfo { - token_identifier: operation_token.token_identifier.clone(), - token_nonce: operation_token.token_nonce, - }); - + // self.sovereign_esdt_token_info_mapper( + // &operation_token.token_identifier, + // &operation_token.token_nonce, + // ) + // .set(EsdtTokenInfo { + // token_identifier: mx_token_id.clone(), + // token_nonce: nft_nonce, + // }); + // + // self.multiversx_esdt_token_info_mapper(mx_token_id, &nft_nonce) + // .set(EsdtTokenInfo { + // token_identifier: operation_token.token_identifier.clone(), + // token_nonce: operation_token.token_nonce, + // }); + // nft_nonce } From 4c6d33d7dc8de27c9b4dd3c29c097b3b6122ecbc Mon Sep 17 00:00:00 2001 From: Andrei Baltariu Date: Mon, 10 Jun 2024 14:37:42 +0300 Subject: [PATCH 010/523] Modified mint logic --- .../src/from_sovereign/transfer_tokens.rs | 110 +++++++++++------- 1 file changed, 66 insertions(+), 44 deletions(-) diff --git a/enshrine-esdt-safe/src/from_sovereign/transfer_tokens.rs b/enshrine-esdt-safe/src/from_sovereign/transfer_tokens.rs index 8f69d815..fe612d2f 100644 --- a/enshrine-esdt-safe/src/from_sovereign/transfer_tokens.rs +++ b/enshrine-esdt-safe/src/from_sovereign/transfer_tokens.rs @@ -50,47 +50,69 @@ pub trait TransferTokensModule: self.distribute_payments(hash_of_hashes, operation_tuple, minted_operation_tokens); } - fn mint_tokens( +fn mint_tokens( &self, operation_tokens: &ManagedVec>, ) -> ManagedVec> { let mut output_payments = ManagedVec::new(); for operation_token in operation_tokens.iter() { - let mx_token_id_state = self - .sovereign_to_multiversx_token_id(&operation_token.token_identifier) - .get(); - - let mx_token_id = match mx_token_id_state { - // token is from sovereign -> continue and mint - TokenMapperState::Token(token_id) => token_id, - // token is from mainchain -> push token - _ => { - // TODO: will use sovereign prefix - output_payments.push(operation_token.clone()); - - continue; - } - }; + if !self.has_prefix(operation_token.token_identifier.clone()) { + output_payments.push(operation_token.clone()); + continue; + } - if operation_token.token_nonce == 0 { - self.send() - .esdt_local_mint(&mx_token_id, 0, &operation_token.token_data.amount); + let mut nonce = operation_token.token_nonce; + if nonce == 0 { + self.send().esdt_local_mint( + &operation_token.token_identifier, + operation_token.token_nonce, + &operation_token.token_data.amount, + ); + } else { - output_payments.push(OperationEsdtPayment { - token_identifier: mx_token_id, - token_nonce: 0, - token_data: operation_token.token_data, - }); + nonce = self.send().esdt_nft_create( + &operation_token.token_identifier, + &operation_token.token_data.amount, + &operation_token.token_data.name, + &operation_token.token_data.royalties, + &operation_token.token_data.hash, + &operation_token.token_data.attributes, + &operation_token.token_data.uris, + ); - continue; + // let token_data = operation_token.token_data.clone(); + // let mut arg_buffer = ManagedArgBuffer::new(); + // arg_buffer.push_arg(&operation_token.token_identifier); + // arg_buffer.push_arg(token_data.amount); + // arg_buffer.push_arg(token_data.name); + // arg_buffer.push_arg(token_data.royalties); + // arg_buffer.push_arg(token_data.hash); + // arg_buffer.push_arg(token_data.attributes); + // let uris = token_data.uris.clone(); + + // if uris.is_empty() { + // // at least one URI is required, so we push an empty one + // arg_buffer.push_arg(codec::Empty); + // } else { + // // The API function has the last argument as variadic, + // // so we top-encode each and send as separate argument + // for uri in &uris { + // arg_buffer.push_arg(uri); + // } + // } + // arg_buffer.push_arg(operation_token.token_nonce); + + // self.send_raw().call_local_esdt_built_in_function( + // self.blockchain().get_gas_left(), + // &ManagedBuffer::from(ESDT_NFT_CREATE_FUNC_NAME), + // &arg_buffer, + // ); } - let nft_nonce = self.mint_and_save_token(&mx_token_id, &operation_token); - output_payments.push(OperationEsdtPayment { - token_identifier: mx_token_id, - token_nonce: nft_nonce, + token_identifier: operation_token.token_identifier, + token_nonce: nonce, token_data: operation_token.token_data, }); } @@ -115,21 +137,21 @@ pub trait TransferTokensModule: ); // save token id and nonce - // self.sovereign_esdt_token_info_mapper( - // &operation_token.token_identifier, - // &operation_token.token_nonce, - // ) - // .set(EsdtTokenInfo { - // token_identifier: mx_token_id.clone(), - // token_nonce: nft_nonce, - // }); - // - // self.multiversx_esdt_token_info_mapper(mx_token_id, &nft_nonce) - // .set(EsdtTokenInfo { - // token_identifier: operation_token.token_identifier.clone(), - // token_nonce: operation_token.token_nonce, - // }); - // + self.sovereign_esdt_token_info_mapper( + &operation_token.token_identifier, + &operation_token.token_nonce, + ) + .set(EsdtTokenInfo { + token_identifier: mx_token_id.clone(), + token_nonce: nft_nonce, + }); + + self.multiversx_esdt_token_info_mapper(mx_token_id, &nft_nonce) + .set(EsdtTokenInfo { + token_identifier: operation_token.token_identifier.clone(), + token_nonce: operation_token.token_nonce, + }); + nft_nonce } From 1fb87a17454ab975d95f2a6986bc40f4ccbde819 Mon Sep 17 00:00:00 2001 From: Andrei Baltariu Date: Mon, 10 Jun 2024 14:38:24 +0300 Subject: [PATCH 011/523] Fixed prefix check function call --- enshrine-esdt-safe/src/from_sovereign/transfer_tokens.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/enshrine-esdt-safe/src/from_sovereign/transfer_tokens.rs b/enshrine-esdt-safe/src/from_sovereign/transfer_tokens.rs index fe612d2f..cf275a1e 100644 --- a/enshrine-esdt-safe/src/from_sovereign/transfer_tokens.rs +++ b/enshrine-esdt-safe/src/from_sovereign/transfer_tokens.rs @@ -57,7 +57,7 @@ fn mint_tokens( let mut output_payments = ManagedVec::new(); for operation_token in operation_tokens.iter() { - if !self.has_prefix(operation_token.token_identifier.clone()) { + if !self.has_sov_token_prefix(&operation_token.token_identifier) { output_payments.push(operation_token.clone()); continue; } From c2906859cc8bd54dd3c7d1bab41d9b1c0131e6c6 Mon Sep 17 00:00:00 2001 From: Andrei Baltariu Date: Tue, 11 Jun 2024 10:04:31 +0300 Subject: [PATCH 012/523] Applied formatting --- enshrine-esdt-safe/src/from_sovereign/transfer_tokens.rs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/enshrine-esdt-safe/src/from_sovereign/transfer_tokens.rs b/enshrine-esdt-safe/src/from_sovereign/transfer_tokens.rs index cf275a1e..3a1b1cc1 100644 --- a/enshrine-esdt-safe/src/from_sovereign/transfer_tokens.rs +++ b/enshrine-esdt-safe/src/from_sovereign/transfer_tokens.rs @@ -50,7 +50,7 @@ pub trait TransferTokensModule: self.distribute_payments(hash_of_hashes, operation_tuple, minted_operation_tokens); } -fn mint_tokens( + fn mint_tokens( &self, operation_tokens: &ManagedVec>, ) -> ManagedVec> { @@ -70,7 +70,6 @@ fn mint_tokens( &operation_token.token_data.amount, ); } else { - nonce = self.send().esdt_nft_create( &operation_token.token_identifier, &operation_token.token_data.amount, From 28e41fa7f39553b8204c689949f555d077b33a06 Mon Sep 17 00:00:00 2001 From: Andrei Baltariu Date: Wed, 12 Jun 2024 16:34:31 +0300 Subject: [PATCH 013/523] Framework upgrade --- chain-config/wasm/Cargo.toml | 6 ++++++ chain-factory/wasm/Cargo.toml | 6 ++++++ enshrine-esdt-safe/Cargo.toml | 6 +++--- enshrine-esdt-safe/meta/Cargo.toml | 2 +- .../wasm-enshrine-esdt-safe-full/Cargo.lock | 16 ++++++++-------- .../wasm-enshrine-esdt-safe-full/Cargo.toml | 2 +- .../wasm-enshrine-esdt-safe-view/Cargo.lock | 16 ++++++++-------- .../wasm-enshrine-esdt-safe-view/Cargo.toml | 2 +- enshrine-esdt-safe/wasm/Cargo.lock | 16 ++++++++-------- enshrine-esdt-safe/wasm/Cargo.toml | 2 +- esdt-safe/wasm-esdt-safe-full/Cargo.toml | 6 ++++++ esdt-safe/wasm-esdt-safe-view/Cargo.toml | 6 ++++++ esdt-safe/wasm/Cargo.toml | 6 ++++++ fee-market/wasm-fee-marker-full/Cargo.toml | 6 ++++++ fee-market/wasm-multisig-view/Cargo.toml | 6 ++++++ fee-market/wasm/Cargo.toml | 6 ++++++ .../wasm-header-verifier-full/Cargo.toml | 6 ++++++ header-verifier/wasm-multisig-view/Cargo.toml | 6 ++++++ header-verifier/wasm/Cargo.toml | 6 ++++++ pair-mock/wasm/Cargo.toml | 6 ++++++ router-mock/wasm/Cargo.toml | 6 ++++++ 21 files changed, 109 insertions(+), 31 deletions(-) diff --git a/chain-config/wasm/Cargo.toml b/chain-config/wasm/Cargo.toml index 4fa13b08..b1f49c55 100644 --- a/chain-config/wasm/Cargo.toml +++ b/chain-config/wasm/Cargo.toml @@ -1,3 +1,9 @@ +# Code generated by the multiversx-sc build system. DO NOT EDIT. + +# ########################################## +# ############## AUTO-GENERATED ############# +# ########################################## + [package] name = "chain-config-wasm" version = "0.0.0" diff --git a/chain-factory/wasm/Cargo.toml b/chain-factory/wasm/Cargo.toml index aeda890d..1e522fff 100644 --- a/chain-factory/wasm/Cargo.toml +++ b/chain-factory/wasm/Cargo.toml @@ -1,3 +1,9 @@ +# Code generated by the multiversx-sc build system. DO NOT EDIT. + +# ########################################## +# ############## AUTO-GENERATED ############# +# ########################################## + [package] name = "chain-factory-wasm" version = "0.0.0" diff --git a/enshrine-esdt-safe/Cargo.toml b/enshrine-esdt-safe/Cargo.toml index 334299fb..aa3f4b4c 100644 --- a/enshrine-esdt-safe/Cargo.toml +++ b/enshrine-esdt-safe/Cargo.toml @@ -36,10 +36,10 @@ path = "../fee-market" path = "../header-verifier" [dependencies.multiversx-sc] -version = "=0.50.3" +version = "=0.50.4" [dependencies.multiversx-sc-modules] -version = "=0.50.3" +version = "=0.50.4" [dev-dependencies] num-bigint = "0.4.2" @@ -47,4 +47,4 @@ num-traits = "0.2" hex = "0.4" [dev-dependencies.multiversx-sc-scenario] -version = "=0.50.3" +version = "=0.50.4" diff --git a/enshrine-esdt-safe/meta/Cargo.toml b/enshrine-esdt-safe/meta/Cargo.toml index 8fb28e65..cb30e0a4 100644 --- a/enshrine-esdt-safe/meta/Cargo.toml +++ b/enshrine-esdt-safe/meta/Cargo.toml @@ -8,5 +8,5 @@ publish = false path = ".." [dependencies.multiversx-sc-meta] -version = "0.50.3" +version = "0.50.4" default-features = false diff --git a/enshrine-esdt-safe/wasm-enshrine-esdt-safe-full/Cargo.lock b/enshrine-esdt-safe/wasm-enshrine-esdt-safe-full/Cargo.lock index a1b63347..a2694849 100644 --- a/enshrine-esdt-safe/wasm-enshrine-esdt-safe-full/Cargo.lock +++ b/enshrine-esdt-safe/wasm-enshrine-esdt-safe-full/Cargo.lock @@ -101,9 +101,9 @@ dependencies = [ [[package]] name = "multiversx-sc" -version = "0.50.3" +version = "0.50.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1d79d1cea2d23e8f2545749c9b31952305b54c415af88b224b985784d3d6529d" +checksum = "748a370a86e9a3c51e0609c4a6c0c9a5cceaeb742656ee3284c0620504a3d7a5" dependencies = [ "bitflags", "hex-literal", @@ -138,9 +138,9 @@ dependencies = [ [[package]] name = "multiversx-sc-derive" -version = "0.50.3" +version = "0.50.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "54e6926e181f6306b69aa805b8d24aa33084497e38ac03e37df457456b6757cc" +checksum = "b6ca88f27a90b0a1b17d5b645cc859e0480f4321c551525873a59a954bfbcb53" dependencies = [ "hex", "proc-macro2", @@ -151,18 +151,18 @@ dependencies = [ [[package]] name = "multiversx-sc-modules" -version = "0.50.3" +version = "0.50.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7f9a8c10ddadc7adfc04edbdd1ea80a9ae9a7e11202fc4cfb2e08c8e27f17aa5" +checksum = "e97c7153d996ef412f5fc687a6799fc9173cb221adef283c217d160eebebe7d4" dependencies = [ "multiversx-sc", ] [[package]] name = "multiversx-sc-wasm-adapter" -version = "0.50.3" +version = "0.50.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4350e286afce68bb2448d30572f68dd344b2e98e160404dd7f7d13f185e7acfd" +checksum = "37f083d6844a0919a39d87c2552b8e9ea30e365775265d31b419d24f6aa93eee" dependencies = [ "multiversx-sc", ] diff --git a/enshrine-esdt-safe/wasm-enshrine-esdt-safe-full/Cargo.toml b/enshrine-esdt-safe/wasm-enshrine-esdt-safe-full/Cargo.toml index ecf11fe9..70a71f9d 100644 --- a/enshrine-esdt-safe/wasm-enshrine-esdt-safe-full/Cargo.toml +++ b/enshrine-esdt-safe/wasm-enshrine-esdt-safe-full/Cargo.toml @@ -28,7 +28,7 @@ panic = "abort" path = ".." [dependencies.multiversx-sc-wasm-adapter] -version = "=0.50.3" +version = "=0.50.4" [workspace] members = ["."] diff --git a/enshrine-esdt-safe/wasm-enshrine-esdt-safe-view/Cargo.lock b/enshrine-esdt-safe/wasm-enshrine-esdt-safe-view/Cargo.lock index 61aef708..45c68557 100644 --- a/enshrine-esdt-safe/wasm-enshrine-esdt-safe-view/Cargo.lock +++ b/enshrine-esdt-safe/wasm-enshrine-esdt-safe-view/Cargo.lock @@ -101,9 +101,9 @@ dependencies = [ [[package]] name = "multiversx-sc" -version = "0.50.3" +version = "0.50.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1d79d1cea2d23e8f2545749c9b31952305b54c415af88b224b985784d3d6529d" +checksum = "748a370a86e9a3c51e0609c4a6c0c9a5cceaeb742656ee3284c0620504a3d7a5" dependencies = [ "bitflags", "hex-literal", @@ -138,9 +138,9 @@ dependencies = [ [[package]] name = "multiversx-sc-derive" -version = "0.50.3" +version = "0.50.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "54e6926e181f6306b69aa805b8d24aa33084497e38ac03e37df457456b6757cc" +checksum = "b6ca88f27a90b0a1b17d5b645cc859e0480f4321c551525873a59a954bfbcb53" dependencies = [ "hex", "proc-macro2", @@ -151,18 +151,18 @@ dependencies = [ [[package]] name = "multiversx-sc-modules" -version = "0.50.3" +version = "0.50.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7f9a8c10ddadc7adfc04edbdd1ea80a9ae9a7e11202fc4cfb2e08c8e27f17aa5" +checksum = "e97c7153d996ef412f5fc687a6799fc9173cb221adef283c217d160eebebe7d4" dependencies = [ "multiversx-sc", ] [[package]] name = "multiversx-sc-wasm-adapter" -version = "0.50.3" +version = "0.50.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4350e286afce68bb2448d30572f68dd344b2e98e160404dd7f7d13f185e7acfd" +checksum = "37f083d6844a0919a39d87c2552b8e9ea30e365775265d31b419d24f6aa93eee" dependencies = [ "multiversx-sc", ] diff --git a/enshrine-esdt-safe/wasm-enshrine-esdt-safe-view/Cargo.toml b/enshrine-esdt-safe/wasm-enshrine-esdt-safe-view/Cargo.toml index d27ae33c..455d7ed3 100644 --- a/enshrine-esdt-safe/wasm-enshrine-esdt-safe-view/Cargo.toml +++ b/enshrine-esdt-safe/wasm-enshrine-esdt-safe-view/Cargo.toml @@ -28,7 +28,7 @@ panic = "abort" path = ".." [dependencies.multiversx-sc-wasm-adapter] -version = "=0.50.3" +version = "=0.50.4" [workspace] members = ["."] diff --git a/enshrine-esdt-safe/wasm/Cargo.lock b/enshrine-esdt-safe/wasm/Cargo.lock index e8238b99..b2f85c6d 100644 --- a/enshrine-esdt-safe/wasm/Cargo.lock +++ b/enshrine-esdt-safe/wasm/Cargo.lock @@ -101,9 +101,9 @@ dependencies = [ [[package]] name = "multiversx-sc" -version = "0.50.3" +version = "0.50.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1d79d1cea2d23e8f2545749c9b31952305b54c415af88b224b985784d3d6529d" +checksum = "748a370a86e9a3c51e0609c4a6c0c9a5cceaeb742656ee3284c0620504a3d7a5" dependencies = [ "bitflags", "hex-literal", @@ -138,9 +138,9 @@ dependencies = [ [[package]] name = "multiversx-sc-derive" -version = "0.50.3" +version = "0.50.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "54e6926e181f6306b69aa805b8d24aa33084497e38ac03e37df457456b6757cc" +checksum = "b6ca88f27a90b0a1b17d5b645cc859e0480f4321c551525873a59a954bfbcb53" dependencies = [ "hex", "proc-macro2", @@ -151,18 +151,18 @@ dependencies = [ [[package]] name = "multiversx-sc-modules" -version = "0.50.3" +version = "0.50.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7f9a8c10ddadc7adfc04edbdd1ea80a9ae9a7e11202fc4cfb2e08c8e27f17aa5" +checksum = "e97c7153d996ef412f5fc687a6799fc9173cb221adef283c217d160eebebe7d4" dependencies = [ "multiversx-sc", ] [[package]] name = "multiversx-sc-wasm-adapter" -version = "0.50.3" +version = "0.50.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4350e286afce68bb2448d30572f68dd344b2e98e160404dd7f7d13f185e7acfd" +checksum = "37f083d6844a0919a39d87c2552b8e9ea30e365775265d31b419d24f6aa93eee" dependencies = [ "multiversx-sc", ] diff --git a/enshrine-esdt-safe/wasm/Cargo.toml b/enshrine-esdt-safe/wasm/Cargo.toml index 3854d80a..0cf73cf7 100644 --- a/enshrine-esdt-safe/wasm/Cargo.toml +++ b/enshrine-esdt-safe/wasm/Cargo.toml @@ -28,7 +28,7 @@ panic = "abort" path = ".." [dependencies.multiversx-sc-wasm-adapter] -version = "=0.50.3" +version = "=0.50.4" [workspace] members = ["."] diff --git a/esdt-safe/wasm-esdt-safe-full/Cargo.toml b/esdt-safe/wasm-esdt-safe-full/Cargo.toml index 5b2b1a71..5e83939e 100644 --- a/esdt-safe/wasm-esdt-safe-full/Cargo.toml +++ b/esdt-safe/wasm-esdt-safe-full/Cargo.toml @@ -1,3 +1,9 @@ +# Code generated by the multiversx-sc build system. DO NOT EDIT. + +# ########################################## +# ############## AUTO-GENERATED ############# +# ########################################## + [package] name = "esdt-safe-full-wasm" version = "0.0.0" diff --git a/esdt-safe/wasm-esdt-safe-view/Cargo.toml b/esdt-safe/wasm-esdt-safe-view/Cargo.toml index 711fe603..ff3684ed 100644 --- a/esdt-safe/wasm-esdt-safe-view/Cargo.toml +++ b/esdt-safe/wasm-esdt-safe-view/Cargo.toml @@ -1,3 +1,9 @@ +# Code generated by the multiversx-sc build system. DO NOT EDIT. + +# ########################################## +# ############## AUTO-GENERATED ############# +# ########################################## + [package] name = "esdt-safe-view-wasm" version = "0.0.0" diff --git a/esdt-safe/wasm/Cargo.toml b/esdt-safe/wasm/Cargo.toml index 17b77b25..da27e023 100644 --- a/esdt-safe/wasm/Cargo.toml +++ b/esdt-safe/wasm/Cargo.toml @@ -1,3 +1,9 @@ +# Code generated by the multiversx-sc build system. DO NOT EDIT. + +# ########################################## +# ############## AUTO-GENERATED ############# +# ########################################## + [package] name = "esdt-safe-wasm" version = "0.0.0" diff --git a/fee-market/wasm-fee-marker-full/Cargo.toml b/fee-market/wasm-fee-marker-full/Cargo.toml index 06de6d37..aba6b1c8 100644 --- a/fee-market/wasm-fee-marker-full/Cargo.toml +++ b/fee-market/wasm-fee-marker-full/Cargo.toml @@ -1,3 +1,9 @@ +# Code generated by the multiversx-sc build system. DO NOT EDIT. + +# ########################################## +# ############## AUTO-GENERATED ############# +# ########################################## + [package] name = "fee-marker-full-wasm" version = "0.0.0" diff --git a/fee-market/wasm-multisig-view/Cargo.toml b/fee-market/wasm-multisig-view/Cargo.toml index 9671f22e..c7eb1b07 100644 --- a/fee-market/wasm-multisig-view/Cargo.toml +++ b/fee-market/wasm-multisig-view/Cargo.toml @@ -1,3 +1,9 @@ +# Code generated by the multiversx-sc build system. DO NOT EDIT. + +# ########################################## +# ############## AUTO-GENERATED ############# +# ########################################## + [package] name = "multisig-view-wasm" version = "0.0.0" diff --git a/fee-market/wasm/Cargo.toml b/fee-market/wasm/Cargo.toml index c7c11f8e..f15c7298 100644 --- a/fee-market/wasm/Cargo.toml +++ b/fee-market/wasm/Cargo.toml @@ -1,3 +1,9 @@ +# Code generated by the multiversx-sc build system. DO NOT EDIT. + +# ########################################## +# ############## AUTO-GENERATED ############# +# ########################################## + [package] name = "fee-market-wasm" version = "0.0.0" diff --git a/header-verifier/wasm-header-verifier-full/Cargo.toml b/header-verifier/wasm-header-verifier-full/Cargo.toml index 852bb495..e8570e7b 100644 --- a/header-verifier/wasm-header-verifier-full/Cargo.toml +++ b/header-verifier/wasm-header-verifier-full/Cargo.toml @@ -1,3 +1,9 @@ +# Code generated by the multiversx-sc build system. DO NOT EDIT. + +# ########################################## +# ############## AUTO-GENERATED ############# +# ########################################## + [package] name = "header-verifier-full-wasm" version = "0.0.0" diff --git a/header-verifier/wasm-multisig-view/Cargo.toml b/header-verifier/wasm-multisig-view/Cargo.toml index 3895d7de..9be0b619 100644 --- a/header-verifier/wasm-multisig-view/Cargo.toml +++ b/header-verifier/wasm-multisig-view/Cargo.toml @@ -1,3 +1,9 @@ +# Code generated by the multiversx-sc build system. DO NOT EDIT. + +# ########################################## +# ############## AUTO-GENERATED ############# +# ########################################## + [package] name = "multisig-view-wasm" version = "0.0.0" diff --git a/header-verifier/wasm/Cargo.toml b/header-verifier/wasm/Cargo.toml index 5a88285e..dada4a72 100644 --- a/header-verifier/wasm/Cargo.toml +++ b/header-verifier/wasm/Cargo.toml @@ -1,3 +1,9 @@ +# Code generated by the multiversx-sc build system. DO NOT EDIT. + +# ########################################## +# ############## AUTO-GENERATED ############# +# ########################################## + [package] name = "header-verifier-wasm" version = "0.0.0" diff --git a/pair-mock/wasm/Cargo.toml b/pair-mock/wasm/Cargo.toml index 4711ff0e..5d2f3e32 100644 --- a/pair-mock/wasm/Cargo.toml +++ b/pair-mock/wasm/Cargo.toml @@ -1,3 +1,9 @@ +# Code generated by the multiversx-sc build system. DO NOT EDIT. + +# ########################################## +# ############## AUTO-GENERATED ############# +# ########################################## + [package] name = "pair-mock-wasm" version = "0.0.0" diff --git a/router-mock/wasm/Cargo.toml b/router-mock/wasm/Cargo.toml index 34f653de..163994cb 100644 --- a/router-mock/wasm/Cargo.toml +++ b/router-mock/wasm/Cargo.toml @@ -1,3 +1,9 @@ +# Code generated by the multiversx-sc build system. DO NOT EDIT. + +# ########################################## +# ############## AUTO-GENERATED ############# +# ########################################## + [package] name = "router-mock-wasm" version = "0.0.0" From 7de50dead3003067c75bfe758f3237bd3809f23f Mon Sep 17 00:00:00 2001 From: Andrei Baltariu Date: Wed, 12 Jun 2024 17:59:33 +0300 Subject: [PATCH 014/523] Modified header verifier endpoint call --- .../src/from_sovereign/transfer_tokens.rs | 8 +------- esdt-safe/src/from_sovereign/transfer_tokens.rs | 13 +++++-------- 2 files changed, 6 insertions(+), 15 deletions(-) diff --git a/enshrine-esdt-safe/src/from_sovereign/transfer_tokens.rs b/enshrine-esdt-safe/src/from_sovereign/transfer_tokens.rs index f51ebe51..6daf78f2 100644 --- a/enshrine-esdt-safe/src/from_sovereign/transfer_tokens.rs +++ b/enshrine-esdt-safe/src/from_sovereign/transfer_tokens.rs @@ -245,7 +245,7 @@ pub trait TransferTokensModule: let caller = self.blockchain().get_caller(); let header_verifier_address = self.header_verifier_address().get(); - self.tx() + let _ = self.tx() .from(caller) .to(header_verifier_address) .typed(header_verifier_proxy::HeaderverifierProxy) @@ -333,12 +333,6 @@ pub trait TransferTokensModule: } } - #[proxy] - fn header_verifier_proxy( - &self, - header_verifier_address: ManagedAddress, - ) -> header_verifier::Proxy; - #[storage_mapper("nextBatchId")] fn next_batch_id(&self) -> SingleValueMapper; diff --git a/esdt-safe/src/from_sovereign/transfer_tokens.rs b/esdt-safe/src/from_sovereign/transfer_tokens.rs index fbb06fe3..aec15cfc 100644 --- a/esdt-safe/src/from_sovereign/transfer_tokens.rs +++ b/esdt-safe/src/from_sovereign/transfer_tokens.rs @@ -1,4 +1,5 @@ use builtin_func_names::{ESDT_MULTI_TRANSFER_FUNC_NAME, ESDT_NFT_CREATE_FUNC_NAME}; +use header_verifier::header_verifier_proxy; use multiversx_sc::{codec, storage::StorageKey}; use transaction::{ BatchId, GasLimit, Operation, OperationData, OperationEsdtPayment, OperationTuple, @@ -206,9 +207,11 @@ pub trait TransferTokensModule: } } + let caller = self.blockchain().get_caller(); let header_verifier_address = self.header_verifier_address().get(); - let _ = self - .tx() + + let _ = self.tx() + .from(caller) .to(header_verifier_address) .typed(header_verifier_proxy::HeaderverifierProxy) .remove_executed_hash(hash_of_hashes, &operation_tuple.op_hash); @@ -295,12 +298,6 @@ pub trait TransferTokensModule: } } - #[proxy] - fn header_verifier_proxy( - &self, - header_verifier_address: ManagedAddress, - ) -> header_verifier::Proxy; - #[storage_mapper("nextBatchId")] fn next_batch_id(&self) -> SingleValueMapper; From 7d1ba65fa48bb6709a2ab25ba25c11815a5e1c25 Mon Sep 17 00:00:00 2001 From: Andrei Baltariu Date: Wed, 12 Jun 2024 18:36:44 +0300 Subject: [PATCH 015/523] Modified enshrine contract --- .../src/enshrine_esdt_safe_proxy.rs | 16 ++++++++-------- enshrine-esdt-safe/src/lib.rs | 4 ++-- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/enshrine-esdt-safe/src/enshrine_esdt_safe_proxy.rs b/enshrine-esdt-safe/src/enshrine_esdt_safe_proxy.rs index a5dd5653..58964058 100644 --- a/enshrine-esdt-safe/src/enshrine_esdt_safe_proxy.rs +++ b/enshrine-esdt-safe/src/enshrine_esdt_safe_proxy.rs @@ -9,23 +9,23 @@ use multiversx_sc::proxy_imports::*; -pub struct EsdtSafeProxy; +pub struct EnshrineEsdtSafeProxy; -impl TxProxyTrait for EsdtSafeProxy +impl TxProxyTrait for EnshrineEsdtSafeProxy where Env: TxEnv, From: TxFrom, To: TxTo, Gas: TxGas, { - type TxProxyMethods = EsdtSafeProxyMethods; + type TxProxyMethods = EnshrineEsdtSafeProxyMethods; fn proxy_methods(self, tx: Tx) -> Self::TxProxyMethods { - EsdtSafeProxyMethods { wrapped_tx: tx } + EnshrineEsdtSafeProxyMethods { wrapped_tx: tx } } } -pub struct EsdtSafeProxyMethods +pub struct EnshrineEsdtSafeProxyMethods where Env: TxEnv, From: TxFrom, @@ -36,7 +36,7 @@ where } #[rustfmt::skip] -impl EsdtSafeProxyMethods +impl EnshrineEsdtSafeProxyMethods where Env: TxEnv, Env::Api: VMApi, @@ -67,7 +67,7 @@ where } #[rustfmt::skip] -impl EsdtSafeProxyMethods +impl EnshrineEsdtSafeProxyMethods where Env: TxEnv, Env::Api: VMApi, @@ -86,7 +86,7 @@ where } #[rustfmt::skip] -impl EsdtSafeProxyMethods +impl EnshrineEsdtSafeProxyMethods where Env: TxEnv, Env::Api: VMApi, diff --git a/enshrine-esdt-safe/src/lib.rs b/enshrine-esdt-safe/src/lib.rs index 6e516062..2f682f5f 100644 --- a/enshrine-esdt-safe/src/lib.rs +++ b/enshrine-esdt-safe/src/lib.rs @@ -12,10 +12,10 @@ const DEFAULT_MAX_USER_TX_GAS_LIMIT: GasLimit = 300_000_000; pub mod from_sovereign; pub mod to_sovereign; -// pub mod esdt_safe_proxy; +pub mod enshrine_esdt_safe_proxy; #[multiversx_sc::contract] -pub trait EsdtSafe: +pub trait EnshrineEsdtSafe: to_sovereign::create_tx::CreateTxModule + to_sovereign::events::EventsModule + to_sovereign::refund::RefundModule From 2394c54a1531a64e5e0cef18d8aaf0127bff3e40 Mon Sep 17 00:00:00 2001 From: Andrei Baltariu Date: Thu, 13 Jun 2024 11:42:54 +0300 Subject: [PATCH 016/523] Modified transaction call --- esdt-safe/src/from_sovereign/transfer_tokens.rs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/esdt-safe/src/from_sovereign/transfer_tokens.rs b/esdt-safe/src/from_sovereign/transfer_tokens.rs index 24ffdcbf..19df2392 100644 --- a/esdt-safe/src/from_sovereign/transfer_tokens.rs +++ b/esdt-safe/src/from_sovereign/transfer_tokens.rs @@ -222,11 +222,12 @@ pub trait TransferTokensModule: } let header_verifier_address = self.header_verifier_address().get(); - let _ = self - .tx() + + self.tx() .to(header_verifier_address) .typed(header_verifier_proxy::HeaderverifierProxy) - .remove_executed_hash(hash_of_hashes, &operation_tuple.op_hash); + .remove_executed_hash(hash_of_hashes, &operation_tuple.op_hash) + .async_call_and_exit(); } fn emit_transfer_failed_events( From 53c4946d1cbdcf41fe7ea4a7bdb7f0b8e2b40e84 Mon Sep 17 00:00:00 2001 From: Andrei Baltariu Date: Thu, 13 Jun 2024 11:52:11 +0300 Subject: [PATCH 017/523] Modified subtract fee tx --- esdt-safe/src/to_sovereign/create_tx.rs | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/esdt-safe/src/to_sovereign/create_tx.rs b/esdt-safe/src/to_sovereign/create_tx.rs index 57f5f14a..ebc7153e 100644 --- a/esdt-safe/src/to_sovereign/create_tx.rs +++ b/esdt-safe/src/to_sovereign/create_tx.rs @@ -1,8 +1,6 @@ use crate::from_sovereign::token_mapping; use bls_signature::BlsSignature; -use fee_market:: - fee_market_proxy -; +use fee_market::fee_market_proxy; use multiversx_sc::{hex_literal::hex, storage::StorageKey}; use transaction::{GasLimit, OperationData, TransferData}; @@ -313,13 +311,12 @@ pub trait CreateTxModule: let fee_market_address = self.fee_market_address().get(); let caller = self.blockchain().get_caller(); - let _ = self - .tx() + self.tx() .to(fee_market_address) .typed(fee_market_proxy::FeeMarketProxy) .subtract_fee(caller, total_tokens_for_fees, OptionalValue::Some(gas)) .payment(fee) - .returns(ReturnsResult); + .async_call_and_exit(); } OptionalValue::None => (), }; From 54fc60f4bc5e17b692cc6f09b7670137ce25a742 Mon Sep 17 00:00:00 2001 From: Andrei Baltariu Date: Thu, 13 Jun 2024 11:53:52 +0300 Subject: [PATCH 018/523] Modified deposit payments logic --- .../src/to_sovereign/create_tx.rs | 39 +++++-------------- 1 file changed, 9 insertions(+), 30 deletions(-) diff --git a/enshrine-esdt-safe/src/to_sovereign/create_tx.rs b/enshrine-esdt-safe/src/to_sovereign/create_tx.rs index 7649bb89..3478f010 100644 --- a/enshrine-esdt-safe/src/to_sovereign/create_tx.rs +++ b/enshrine-esdt-safe/src/to_sovereign/create_tx.rs @@ -231,43 +231,22 @@ pub trait CreateTxModule: current_token_data.amount = payment.amount.clone(); - if self.is_sovereign_chain().get() { + if self.is_sovereign_chain().get() + || self.has_sov_token_prefix(&payment.token_identifier) + { self.send().esdt_local_burn( &payment.token_identifier, payment.token_nonce, &payment.amount, ); - - event_payments.push(MultiValue3(( - payment.token_identifier.clone(), - payment.token_nonce, - current_token_data.clone(), - ))); - } else { - let sov_token_id = self - .multiversx_to_sovereign_token_id(&payment.token_identifier) - .get(); - - if !sov_token_id.is_valid_esdt_identifier() { - event_payments.push(MultiValue3(( - payment.token_identifier, - payment.token_nonce, - current_token_data.clone(), - ))); - - continue; - } - - let sov_token_nonce = self.remove_sovereign_token(payment, &sov_token_id); - - event_payments.push(MultiValue3(( - sov_token_id, - sov_token_nonce, - current_token_data.clone(), - ))); } - } + event_payments.push(MultiValue3(( + payment.token_identifier.clone(), + payment.token_nonce, + current_token_data.clone(), + ))); + } let caller = self.blockchain().get_caller(); self.match_fee_payment(total_tokens_for_fees, &fees_payment, &opt_transfer_data); From e794f29fcb05724901c088694133df08fbdb2d7b Mon Sep 17 00:00:00 2001 From: Andrei Baltariu Date: Thu, 13 Jun 2024 12:01:21 +0300 Subject: [PATCH 019/523] Modified fee market proxy call --- .../src/to_sovereign/create_tx.rs | 25 +++++++++---------- 1 file changed, 12 insertions(+), 13 deletions(-) diff --git a/enshrine-esdt-safe/src/to_sovereign/create_tx.rs b/enshrine-esdt-safe/src/to_sovereign/create_tx.rs index 3478f010..476462da 100644 --- a/enshrine-esdt-safe/src/to_sovereign/create_tx.rs +++ b/enshrine-esdt-safe/src/to_sovereign/create_tx.rs @@ -1,6 +1,8 @@ use crate::from_sovereign::token_mapping; use bls_signature::BlsSignature; -use fee_market::subtract_fee::{FinalPayment, ProxyTrait as _}; +use fee_market:: + fee_market_proxy +; use multiversx_sc::{hex_literal::hex, storage::StorageKey}; use transaction::{GasLimit, OperationData, TransferData}; @@ -309,23 +311,20 @@ pub trait CreateTxModule: gas = transfer_data.gas_limit; } - let _: FinalPayment = self - .fee_market_proxy(self.fee_market_address().get()) - .subtract_fee( - self.blockchain().get_caller().clone(), - total_tokens_for_fees, - OptionalValue::Some(gas), - ) - .with_esdt_transfer(fee.clone()) - .execute_on_dest_context(); + let fee_market_address = self.fee_market_address().get(); + let caller = self.blockchain().get_caller(); + + self.tx() + .to(fee_market_address) + .typed(fee_market_proxy::FeeMarketProxy) + .subtract_fee(caller, total_tokens_for_fees, OptionalValue::Some(gas)) + .payment(fee.clone()) + .async_call_and_exit(); } OptionalValue::None => (), }; } - #[proxy] - fn fee_market_proxy(&self, sc_address: ManagedAddress) -> fee_market::Proxy; - #[storage_mapper("feeMarketAddress")] fn fee_market_address(&self) -> SingleValueMapper; From ca2712e628e326e3012e7c59aedc0c18c8c4d3ed Mon Sep 17 00:00:00 2001 From: Andrei Baltariu Date: Thu, 13 Jun 2024 12:05:14 +0300 Subject: [PATCH 020/523] Contract call migration to unified syntax --- .../src/from_sovereign/transfer_tokens.rs | 47 +++++++++---------- esdt-safe/src/to_sovereign/create_tx.rs | 3 -- 2 files changed, 22 insertions(+), 28 deletions(-) diff --git a/enshrine-esdt-safe/src/from_sovereign/transfer_tokens.rs b/enshrine-esdt-safe/src/from_sovereign/transfer_tokens.rs index 6daf78f2..43279f5d 100644 --- a/enshrine-esdt-safe/src/from_sovereign/transfer_tokens.rs +++ b/enshrine-esdt-safe/src/from_sovereign/transfer_tokens.rs @@ -161,7 +161,8 @@ pub trait TransferTokensModule: operation_tuple: OperationTuple, tokens_list: ManagedVec>, ) { - let mapped_tokens = tokens_list.iter().map(|token| token.into()).collect(); + let mapped_tokens: ManagedVec> = + tokens_list.iter().map(|token| token.into()).collect(); match &operation_tuple.operation.data.opt_transfer_data { Some(transfer_data) => { @@ -170,33 +171,30 @@ pub trait TransferTokensModule: args.push_arg(arg); } - self.send() - .contract_call::<()>( - operation_tuple.operation.to.clone(), - transfer_data.function.clone(), - ) - .with_raw_arguments(args) - .with_multi_token_transfer(mapped_tokens) - .with_gas_limit(transfer_data.gas_limit) - .async_call_promise() - .with_extra_gas_for_callback(CALLBACK_GAS) - .with_callback( + self.tx() + .to(&operation_tuple.operation.to) + .raw_call(transfer_data.function.clone()) + .arguments_raw(args.clone()) + .multi_esdt(mapped_tokens.clone()) + .gas(transfer_data.gas_limit) + .callback( ::callbacks(self) .execute(&hash_of_hashes, &operation_tuple), ) + .gas_for_callback(CALLBACK_GAS) .register_promise(); } None => { let own_address = self.blockchain().get_sc_address(); - - self.send() - .contract_call::<()>(own_address, ESDT_MULTI_TRANSFER_FUNC_NAME) - .with_raw_arguments( - self.get_contract_call_args(&operation_tuple.operation.to, mapped_tokens), - ) - .with_gas_limit(TRANSACTION_GAS) - .async_call_promise() - .with_callback( + let args = + self.get_contract_call_args(&operation_tuple.operation.to, mapped_tokens); + + self.tx() + .to(own_address) + .raw_call(ESDT_MULTI_TRANSFER_FUNC_NAME) + .arguments_raw(args) + .gas(TRANSACTION_GAS) + .callback( ::callbacks(self) .execute(&hash_of_hashes, &operation_tuple), ) @@ -242,14 +240,13 @@ pub trait TransferTokensModule: } } - let caller = self.blockchain().get_caller(); let header_verifier_address = self.header_verifier_address().get(); - let _ = self.tx() - .from(caller) + self.tx() .to(header_verifier_address) .typed(header_verifier_proxy::HeaderverifierProxy) - .remove_executed_hash(hash_of_hashes, &operation_tuple.op_hash); + .remove_executed_hash(hash_of_hashes, &operation_tuple.op_hash) + .async_call_and_exit(); } fn emit_transfer_failed_events( diff --git a/esdt-safe/src/to_sovereign/create_tx.rs b/esdt-safe/src/to_sovereign/create_tx.rs index ebc7153e..59ddb8c1 100644 --- a/esdt-safe/src/to_sovereign/create_tx.rs +++ b/esdt-safe/src/to_sovereign/create_tx.rs @@ -322,9 +322,6 @@ pub trait CreateTxModule: }; } - #[proxy] - fn fee_market_proxy(&self, sc_address: ManagedAddress) -> fee_market::Proxy; - #[storage_mapper("feeMarketAddress")] fn fee_market_address(&self) -> SingleValueMapper; From 1dc661c249889921c8097f9bdbb22d9b56f09237 Mon Sep 17 00:00:00 2001 From: Andrei Baltariu Date: Thu, 13 Jun 2024 12:12:39 +0300 Subject: [PATCH 021/523] Removed unused variable --- esdt-safe/src/from_sovereign/transfer_tokens.rs | 1 - 1 file changed, 1 deletion(-) diff --git a/esdt-safe/src/from_sovereign/transfer_tokens.rs b/esdt-safe/src/from_sovereign/transfer_tokens.rs index 62842eda..fe47e416 100644 --- a/esdt-safe/src/from_sovereign/transfer_tokens.rs +++ b/esdt-safe/src/from_sovereign/transfer_tokens.rs @@ -207,7 +207,6 @@ pub trait TransferTokensModule: } } - let caller = self.blockchain().get_caller(); let header_verifier_address = self.header_verifier_address().get(); self.tx() From d3cddeae447d97847910d001bcf45fe903608118 Mon Sep 17 00:00:00 2001 From: Andrei Baltariu Date: Thu, 13 Jun 2024 13:56:20 +0300 Subject: [PATCH 022/523] Added sync call --- enshrine-esdt-safe/src/from_sovereign/transfer_tokens.rs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/enshrine-esdt-safe/src/from_sovereign/transfer_tokens.rs b/enshrine-esdt-safe/src/from_sovereign/transfer_tokens.rs index 43279f5d..c3221cb7 100644 --- a/enshrine-esdt-safe/src/from_sovereign/transfer_tokens.rs +++ b/enshrine-esdt-safe/src/from_sovereign/transfer_tokens.rs @@ -3,7 +3,6 @@ use multiversx_sc::{api::ESDT_MULTI_TRANSFER_FUNC_NAME, storage::StorageKey}; use transaction::{ BatchId, GasLimit, Operation, OperationData, OperationEsdtPayment, OperationTuple, }; - use crate::to_sovereign; use super::token_mapping::EsdtTokenInfo; @@ -246,7 +245,7 @@ pub trait TransferTokensModule: .to(header_verifier_address) .typed(header_verifier_proxy::HeaderverifierProxy) .remove_executed_hash(hash_of_hashes, &operation_tuple.op_hash) - .async_call_and_exit(); + .sync_call(); } fn emit_transfer_failed_events( From 5247cda2dbb1bb570842d8d5dc077415be71577e Mon Sep 17 00:00:00 2001 From: Andrei Baltariu Date: Thu, 13 Jun 2024 14:26:36 +0300 Subject: [PATCH 023/523] Added sync call for header verifier proxy --- esdt-safe/src/from_sovereign/transfer_tokens.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/esdt-safe/src/from_sovereign/transfer_tokens.rs b/esdt-safe/src/from_sovereign/transfer_tokens.rs index fe47e416..dba7a975 100644 --- a/esdt-safe/src/from_sovereign/transfer_tokens.rs +++ b/esdt-safe/src/from_sovereign/transfer_tokens.rs @@ -213,7 +213,7 @@ pub trait TransferTokensModule: .to(header_verifier_address) .typed(header_verifier_proxy::HeaderverifierProxy) .remove_executed_hash(hash_of_hashes, &operation_tuple.op_hash) - .async_call_and_exit(); + .sync_call(); } fn emit_transfer_failed_events( From c6c164e1e5521f5510b14ae5f53dfa3c4f2106aa Mon Sep 17 00:00:00 2001 From: Andrei Baltariu Date: Fri, 21 Jun 2024 10:55:53 +0300 Subject: [PATCH 024/523] Removed refund module and unused mappers --- enshrine-esdt-safe/src/from_sovereign/mod.rs | 1 - .../src/from_sovereign/refund.rs | 105 ------------------ .../src/from_sovereign/token_mapping.rs | 2 - .../src/from_sovereign/transfer_tokens.rs | 9 +- 4 files changed, 1 insertion(+), 116 deletions(-) delete mode 100644 enshrine-esdt-safe/src/from_sovereign/refund.rs diff --git a/enshrine-esdt-safe/src/from_sovereign/mod.rs b/enshrine-esdt-safe/src/from_sovereign/mod.rs index 8564e0ab..51dbf34b 100644 --- a/enshrine-esdt-safe/src/from_sovereign/mod.rs +++ b/enshrine-esdt-safe/src/from_sovereign/mod.rs @@ -1,4 +1,3 @@ pub mod events; -pub mod refund; pub mod token_mapping; pub mod transfer_tokens; diff --git a/enshrine-esdt-safe/src/from_sovereign/refund.rs b/enshrine-esdt-safe/src/from_sovereign/refund.rs deleted file mode 100644 index 8957dc72..00000000 --- a/enshrine-esdt-safe/src/from_sovereign/refund.rs +++ /dev/null @@ -1,105 +0,0 @@ -use transaction::{BatchId, OperationEsdtPayment, PaymentsVec, Transaction, TxNonce}; - -multiversx_sc::imports!(); - -const NFT_AMOUNT: u32 = 1; - -pub struct CheckMustRefundArgs<'a, M: ManagedTypeApi> { - pub token: &'a OperationEsdtPayment, - pub roles: EsdtLocalRoleFlags, - pub dest: &'a ManagedAddress, - pub batch_id: BatchId, - pub tx_nonce: TxNonce, - pub sc_address: &'a ManagedAddress, - pub sc_shard: u32, -} - -#[multiversx_sc::module] -pub trait RefundModule: - super::events::EventsModule - + tx_batch_module::TxBatchModule - + max_bridged_amount_module::MaxBridgedAmountModule -{ - fn check_must_refund(&self, args: CheckMustRefundArgs) -> bool { - let token_balance = self.blockchain().get_esdt_balance( - args.sc_address, - &args.token.token_identifier, - args.token.token_nonce, - ); - - if token_balance < args.token.token_data.amount { - if args.token.token_nonce == 0 { - if !args.roles.has_role(&EsdtLocalRole::Mint) { - return true; - } - } else if !self.has_nft_roles(args.token, args.roles) { - return true; - } - } - - if self.is_above_max_amount(&args.token.token_identifier, &args.token.token_data.amount) { - return true; - } - - if self.is_account_same_shard_frozen(args.sc_shard, args.dest, &args.token.token_identifier) - { - return true; - } - - false - } - - fn has_nft_roles( - &self, - payment: &OperationEsdtPayment, - roles: EsdtLocalRoleFlags, - ) -> bool { - if !roles.has_role(&EsdtLocalRole::NftCreate) { - return false; - } - - if payment.token_data.amount > NFT_AMOUNT && !roles.has_role(&EsdtLocalRole::NftAddQuantity) - { - return false; - } - - true - } - - fn is_account_same_shard_frozen( - &self, - sc_shard: u32, - dest_address: &ManagedAddress, - token_id: &TokenIdentifier, - ) -> bool { - let dest_shard = self.blockchain().get_shard_of_address(dest_address); - if sc_shard != dest_shard { - return false; - } - - let token_data = self - .blockchain() - .get_esdt_token_data(dest_address, token_id, 0); - token_data.frozen - } - - fn convert_to_refund_tx( - &self, - sov_tx: Transaction, - tokens_to_refund: PaymentsVec, - ) -> Transaction { - let tx_nonce = self.get_and_save_next_tx_id(); - - // invert from and to - Transaction { - block_nonce: self.blockchain().get_block_nonce(), - nonce: tx_nonce, - from: sov_tx.to, - to: sov_tx.from, - tokens: tokens_to_refund, - token_data: ManagedVec::new(), - opt_transfer_data: None, - is_refund_tx: true, - } - } -} diff --git a/enshrine-esdt-safe/src/from_sovereign/token_mapping.rs b/enshrine-esdt-safe/src/from_sovereign/token_mapping.rs index fa825d0e..f6aad260 100644 --- a/enshrine-esdt-safe/src/from_sovereign/token_mapping.rs +++ b/enshrine-esdt-safe/src/from_sovereign/token_mapping.rs @@ -115,8 +115,6 @@ pub trait TokenMappingModule: self.multiversx_to_sovereign_token_id(&mvx_token_id).clear(); } - // WARNING: All mappers must have the exact same storage key! - #[storage_mapper("sovToMxTokenId")] fn sovereign_to_multiversx_token_id( &self, diff --git a/enshrine-esdt-safe/src/from_sovereign/transfer_tokens.rs b/enshrine-esdt-safe/src/from_sovereign/transfer_tokens.rs index c3221cb7..0d7d7f2c 100644 --- a/enshrine-esdt-safe/src/from_sovereign/transfer_tokens.rs +++ b/enshrine-esdt-safe/src/from_sovereign/transfer_tokens.rs @@ -1,7 +1,7 @@ use header_verifier::header_verifier_proxy; use multiversx_sc::{api::ESDT_MULTI_TRANSFER_FUNC_NAME, storage::StorageKey}; use transaction::{ - BatchId, GasLimit, Operation, OperationData, OperationEsdtPayment, OperationTuple, + GasLimit, Operation, OperationData, OperationEsdtPayment, OperationTuple, }; use crate::to_sovereign; @@ -16,7 +16,6 @@ const TRANSACTION_GAS: GasLimit = 30_000_000; pub trait TransferTokensModule: bls_signature::BlsSignatureModule + super::events::EventsModule - + super::refund::RefundModule + super::token_mapping::TokenMappingModule + tx_batch_module::TxBatchModule + max_bridged_amount_module::MaxBridgedAmountModule @@ -329,15 +328,9 @@ pub trait TransferTokensModule: } } - #[storage_mapper("nextBatchId")] - fn next_batch_id(&self) -> SingleValueMapper; - #[storage_mapper("pending_hashes")] fn pending_hashes(&self, hash_of_hashes: &ManagedBuffer) -> UnorderedSetMapper; #[storage_mapper("header_verifier_address")] fn header_verifier_address(&self) -> SingleValueMapper; - - #[storage_mapper("sovereign_bridge_address")] - fn sovereign_bridge_address(&self) -> SingleValueMapper; } From a1d3cb6d4a0675f1228163bf8324bad8ab75a705 Mon Sep 17 00:00:00 2001 From: Andrei Baltariu Date: Fri, 21 Jun 2024 11:01:51 +0300 Subject: [PATCH 025/523] Regenerated proxy --- enshrine-esdt-safe/src/enshrine_esdt_safe_proxy.rs | 9 --------- 1 file changed, 9 deletions(-) diff --git a/enshrine-esdt-safe/src/enshrine_esdt_safe_proxy.rs b/enshrine-esdt-safe/src/enshrine_esdt_safe_proxy.rs index 58964058..baf24842 100644 --- a/enshrine-esdt-safe/src/enshrine_esdt_safe_proxy.rs +++ b/enshrine-esdt-safe/src/enshrine_esdt_safe_proxy.rs @@ -45,23 +45,14 @@ where { pub fn init< Arg0: ProxyArg, - Arg1: ProxyArg, - Arg2: ProxyArg>, - Arg3: ProxyArg>>, >( self, is_sovereign_chain: Arg0, - min_valid_signers: Arg1, - initiator_address: Arg2, - signers: Arg3, ) -> TxTypedDeploy { self.wrapped_tx .payment(NotPayable) .raw_deploy() .argument(&is_sovereign_chain) - .argument(&min_valid_signers) - .argument(&initiator_address) - .argument(&signers) .original_result() } } From 9b065fad7d7c5e379113553884f3f2ea92f9f7f7 Mon Sep 17 00:00:00 2001 From: Andrei Baltariu Date: Fri, 21 Jun 2024 10:55:53 +0300 Subject: [PATCH 026/523] Removed refund module and unused mappers --- enshrine-esdt-safe/src/from_sovereign/mod.rs | 1 - .../src/from_sovereign/refund.rs | 105 ------------------ .../src/from_sovereign/token_mapping.rs | 2 - .../src/from_sovereign/transfer_tokens.rs | 9 +- 4 files changed, 1 insertion(+), 116 deletions(-) delete mode 100644 enshrine-esdt-safe/src/from_sovereign/refund.rs diff --git a/enshrine-esdt-safe/src/from_sovereign/mod.rs b/enshrine-esdt-safe/src/from_sovereign/mod.rs index 8564e0ab..51dbf34b 100644 --- a/enshrine-esdt-safe/src/from_sovereign/mod.rs +++ b/enshrine-esdt-safe/src/from_sovereign/mod.rs @@ -1,4 +1,3 @@ pub mod events; -pub mod refund; pub mod token_mapping; pub mod transfer_tokens; diff --git a/enshrine-esdt-safe/src/from_sovereign/refund.rs b/enshrine-esdt-safe/src/from_sovereign/refund.rs deleted file mode 100644 index 8957dc72..00000000 --- a/enshrine-esdt-safe/src/from_sovereign/refund.rs +++ /dev/null @@ -1,105 +0,0 @@ -use transaction::{BatchId, OperationEsdtPayment, PaymentsVec, Transaction, TxNonce}; - -multiversx_sc::imports!(); - -const NFT_AMOUNT: u32 = 1; - -pub struct CheckMustRefundArgs<'a, M: ManagedTypeApi> { - pub token: &'a OperationEsdtPayment, - pub roles: EsdtLocalRoleFlags, - pub dest: &'a ManagedAddress, - pub batch_id: BatchId, - pub tx_nonce: TxNonce, - pub sc_address: &'a ManagedAddress, - pub sc_shard: u32, -} - -#[multiversx_sc::module] -pub trait RefundModule: - super::events::EventsModule - + tx_batch_module::TxBatchModule - + max_bridged_amount_module::MaxBridgedAmountModule -{ - fn check_must_refund(&self, args: CheckMustRefundArgs) -> bool { - let token_balance = self.blockchain().get_esdt_balance( - args.sc_address, - &args.token.token_identifier, - args.token.token_nonce, - ); - - if token_balance < args.token.token_data.amount { - if args.token.token_nonce == 0 { - if !args.roles.has_role(&EsdtLocalRole::Mint) { - return true; - } - } else if !self.has_nft_roles(args.token, args.roles) { - return true; - } - } - - if self.is_above_max_amount(&args.token.token_identifier, &args.token.token_data.amount) { - return true; - } - - if self.is_account_same_shard_frozen(args.sc_shard, args.dest, &args.token.token_identifier) - { - return true; - } - - false - } - - fn has_nft_roles( - &self, - payment: &OperationEsdtPayment, - roles: EsdtLocalRoleFlags, - ) -> bool { - if !roles.has_role(&EsdtLocalRole::NftCreate) { - return false; - } - - if payment.token_data.amount > NFT_AMOUNT && !roles.has_role(&EsdtLocalRole::NftAddQuantity) - { - return false; - } - - true - } - - fn is_account_same_shard_frozen( - &self, - sc_shard: u32, - dest_address: &ManagedAddress, - token_id: &TokenIdentifier, - ) -> bool { - let dest_shard = self.blockchain().get_shard_of_address(dest_address); - if sc_shard != dest_shard { - return false; - } - - let token_data = self - .blockchain() - .get_esdt_token_data(dest_address, token_id, 0); - token_data.frozen - } - - fn convert_to_refund_tx( - &self, - sov_tx: Transaction, - tokens_to_refund: PaymentsVec, - ) -> Transaction { - let tx_nonce = self.get_and_save_next_tx_id(); - - // invert from and to - Transaction { - block_nonce: self.blockchain().get_block_nonce(), - nonce: tx_nonce, - from: sov_tx.to, - to: sov_tx.from, - tokens: tokens_to_refund, - token_data: ManagedVec::new(), - opt_transfer_data: None, - is_refund_tx: true, - } - } -} diff --git a/enshrine-esdt-safe/src/from_sovereign/token_mapping.rs b/enshrine-esdt-safe/src/from_sovereign/token_mapping.rs index fa825d0e..f6aad260 100644 --- a/enshrine-esdt-safe/src/from_sovereign/token_mapping.rs +++ b/enshrine-esdt-safe/src/from_sovereign/token_mapping.rs @@ -115,8 +115,6 @@ pub trait TokenMappingModule: self.multiversx_to_sovereign_token_id(&mvx_token_id).clear(); } - // WARNING: All mappers must have the exact same storage key! - #[storage_mapper("sovToMxTokenId")] fn sovereign_to_multiversx_token_id( &self, diff --git a/enshrine-esdt-safe/src/from_sovereign/transfer_tokens.rs b/enshrine-esdt-safe/src/from_sovereign/transfer_tokens.rs index c3221cb7..0d7d7f2c 100644 --- a/enshrine-esdt-safe/src/from_sovereign/transfer_tokens.rs +++ b/enshrine-esdt-safe/src/from_sovereign/transfer_tokens.rs @@ -1,7 +1,7 @@ use header_verifier::header_verifier_proxy; use multiversx_sc::{api::ESDT_MULTI_TRANSFER_FUNC_NAME, storage::StorageKey}; use transaction::{ - BatchId, GasLimit, Operation, OperationData, OperationEsdtPayment, OperationTuple, + GasLimit, Operation, OperationData, OperationEsdtPayment, OperationTuple, }; use crate::to_sovereign; @@ -16,7 +16,6 @@ const TRANSACTION_GAS: GasLimit = 30_000_000; pub trait TransferTokensModule: bls_signature::BlsSignatureModule + super::events::EventsModule - + super::refund::RefundModule + super::token_mapping::TokenMappingModule + tx_batch_module::TxBatchModule + max_bridged_amount_module::MaxBridgedAmountModule @@ -329,15 +328,9 @@ pub trait TransferTokensModule: } } - #[storage_mapper("nextBatchId")] - fn next_batch_id(&self) -> SingleValueMapper; - #[storage_mapper("pending_hashes")] fn pending_hashes(&self, hash_of_hashes: &ManagedBuffer) -> UnorderedSetMapper; #[storage_mapper("header_verifier_address")] fn header_verifier_address(&self) -> SingleValueMapper; - - #[storage_mapper("sovereign_bridge_address")] - fn sovereign_bridge_address(&self) -> SingleValueMapper; } From 126d41526c910b52675c43e428b6734ad928b15c Mon Sep 17 00:00:00 2001 From: Andrei Baltariu Date: Fri, 21 Jun 2024 11:06:19 +0300 Subject: [PATCH 027/523] Regenerated proxy and fixed build error --- enshrine-esdt-safe/src/enshrine_esdt_safe_proxy.rs | 13 ------------- enshrine-esdt-safe/src/lib.rs | 10 ---------- .../wasm-enshrine-esdt-safe-full/src/lib.rs | 5 ++--- enshrine-esdt-safe/wasm/src/lib.rs | 5 ++--- 4 files changed, 4 insertions(+), 29 deletions(-) diff --git a/enshrine-esdt-safe/src/enshrine_esdt_safe_proxy.rs b/enshrine-esdt-safe/src/enshrine_esdt_safe_proxy.rs index baf24842..30d76b2b 100644 --- a/enshrine-esdt-safe/src/enshrine_esdt_safe_proxy.rs +++ b/enshrine-esdt-safe/src/enshrine_esdt_safe_proxy.rs @@ -111,19 +111,6 @@ where .original_result() } - pub fn set_sovereign_bridge_address< - Arg0: ProxyArg>, - >( - self, - bridge_address: Arg0, - ) -> TxTypedCall { - self.wrapped_tx - .payment(NotPayable) - .raw_call("setSovereignBridgeAddress") - .argument(&bridge_address) - .original_result() - } - pub fn set_max_user_tx_gas_limit< Arg0: ProxyArg, Arg1: ProxyArg>>, diff --git a/enshrine-esdt-safe/src/lib.rs b/enshrine-esdt-safe/src/lib.rs index 9dcb1447..37e40b76 100644 --- a/enshrine-esdt-safe/src/lib.rs +++ b/enshrine-esdt-safe/src/lib.rs @@ -15,7 +15,6 @@ pub trait EnshrineEsdtSafe: + to_sovereign::set_tx_status::SetTxStatusModule + bls_signature::BlsSignatureModule + from_sovereign::events::EventsModule - + from_sovereign::refund::RefundModule + from_sovereign::token_mapping::TokenMappingModule + from_sovereign::transfer_tokens::TransferTokensModule + tx_batch_module::TxBatchModule @@ -51,15 +50,6 @@ pub trait EnshrineEsdtSafe: self.header_verifier_address().set(&header_verifier_address); } - #[only_owner] - #[endpoint(setSovereignBridgeAddress)] - fn set_sovereign_bridge_address(&self, bridge_address: ManagedAddress) { - self.require_sc_address(&bridge_address); - - self.sovereign_bridge_address().set(bridge_address); - } - #[upgrade] fn upgrade(&self) {} - } diff --git a/enshrine-esdt-safe/wasm-enshrine-esdt-safe-full/src/lib.rs b/enshrine-esdt-safe/wasm-enshrine-esdt-safe-full/src/lib.rs index 7a4f3f37..46db249b 100644 --- a/enshrine-esdt-safe/wasm-enshrine-esdt-safe-full/src/lib.rs +++ b/enshrine-esdt-safe/wasm-enshrine-esdt-safe-full/src/lib.rs @@ -6,10 +6,10 @@ // Init: 1 // Upgrade: 1 -// Endpoints: 39 +// Endpoints: 38 // Async Callback: 1 // Promise callbacks: 1 -// Total number of exported functions: 43 +// Total number of exported functions: 42 #![no_std] @@ -23,7 +23,6 @@ multiversx_sc_wasm_adapter::endpoints! { upgrade => upgrade setFeeMarketAddress => set_fee_market_address setMultisigAddress => set_header_verifier_address - setSovereignBridgeAddress => set_sovereign_bridge_address setMaxUserTxGasLimit => set_max_user_tx_gas_limit setBurnAndMint => set_burn_and_mint removeBurnAndMint => remove_burn_and_mint diff --git a/enshrine-esdt-safe/wasm/src/lib.rs b/enshrine-esdt-safe/wasm/src/lib.rs index 7a4f3f37..46db249b 100644 --- a/enshrine-esdt-safe/wasm/src/lib.rs +++ b/enshrine-esdt-safe/wasm/src/lib.rs @@ -6,10 +6,10 @@ // Init: 1 // Upgrade: 1 -// Endpoints: 39 +// Endpoints: 38 // Async Callback: 1 // Promise callbacks: 1 -// Total number of exported functions: 43 +// Total number of exported functions: 42 #![no_std] @@ -23,7 +23,6 @@ multiversx_sc_wasm_adapter::endpoints! { upgrade => upgrade setFeeMarketAddress => set_fee_market_address setMultisigAddress => set_header_verifier_address - setSovereignBridgeAddress => set_sovereign_bridge_address setMaxUserTxGasLimit => set_max_user_tx_gas_limit setBurnAndMint => set_burn_and_mint removeBurnAndMint => remove_burn_and_mint From 8329f67853b08ea5d5a46988a45ccca69fc3eecb Mon Sep 17 00:00:00 2001 From: Andrei Baltariu Date: Fri, 21 Jun 2024 11:35:59 +0300 Subject: [PATCH 028/523] Removed unnecessary endpoints + proxy update --- .../src/enshrine_esdt_safe_proxy.rs | 93 -------- .../src/to_sovereign/create_tx.rs | 221 +++++------------- .../wasm-enshrine-esdt-safe-full/src/lib.rs | 10 +- enshrine-esdt-safe/wasm/src/lib.rs | 10 +- 4 files changed, 57 insertions(+), 277 deletions(-) diff --git a/enshrine-esdt-safe/src/enshrine_esdt_safe_proxy.rs b/enshrine-esdt-safe/src/enshrine_esdt_safe_proxy.rs index 30d76b2b..749ae808 100644 --- a/enshrine-esdt-safe/src/enshrine_esdt_safe_proxy.rs +++ b/enshrine-esdt-safe/src/enshrine_esdt_safe_proxy.rs @@ -111,99 +111,6 @@ where .original_result() } - pub fn set_max_user_tx_gas_limit< - Arg0: ProxyArg, - Arg1: ProxyArg>>, - >( - self, - new_value: Arg0, - opt_sig: Arg1, - ) -> TxTypedCall { - self.wrapped_tx - .payment(NotPayable) - .raw_call("setMaxUserTxGasLimit") - .argument(&new_value) - .argument(&opt_sig) - .original_result() - } - - pub fn set_burn_and_mint< - Arg0: ProxyArg>>, - Arg1: ProxyArg>>, - >( - self, - opt_signature: Arg0, - tokens: Arg1, - ) -> TxTypedCall { - self.wrapped_tx - .payment(NotPayable) - .raw_call("setBurnAndMint") - .argument(&opt_signature) - .argument(&tokens) - .original_result() - } - - pub fn remove_burn_and_mint< - Arg0: ProxyArg>>, - Arg1: ProxyArg>>, - >( - self, - opt_signature: Arg0, - tokens: Arg1, - ) -> TxTypedCall { - self.wrapped_tx - .payment(NotPayable) - .raw_call("removeBurnAndMint") - .argument(&opt_signature) - .argument(&tokens) - .original_result() - } - - pub fn add_banned_endpoint_names< - Arg0: ProxyArg>>, - Arg1: ProxyArg>>, - >( - self, - opt_signature: Arg0, - names: Arg1, - ) -> TxTypedCall { - self.wrapped_tx - .payment(NotPayable) - .raw_call("addBannedEndpointNames") - .argument(&opt_signature) - .argument(&names) - .original_result() - } - - pub fn remove_banned_endpoint_names< - Arg0: ProxyArg>>, - Arg1: ProxyArg>>, - >( - self, - opt_signature: Arg0, - names: Arg1, - ) -> TxTypedCall { - self.wrapped_tx - .payment(NotPayable) - .raw_call("removeBannedEndpointNames") - .argument(&opt_signature) - .argument(&names) - .original_result() - } - - pub fn deposit_back< - Arg0: ProxyArg>, - >( - self, - to: Arg0, - ) -> TxTypedCall { - self.wrapped_tx - .raw_call("depositBack") - .argument(&to) - .original_result() - } - - /// Create an Elrond -> Sovereign transaction. pub fn deposit< Arg0: ProxyArg>, Arg1: ProxyArg, ManagedVec>>>>, diff --git a/enshrine-esdt-safe/src/to_sovereign/create_tx.rs b/enshrine-esdt-safe/src/to_sovereign/create_tx.rs index 476462da..f18d5d17 100644 --- a/enshrine-esdt-safe/src/to_sovereign/create_tx.rs +++ b/enshrine-esdt-safe/src/to_sovereign/create_tx.rs @@ -1,8 +1,5 @@ use crate::from_sovereign::token_mapping; -use bls_signature::BlsSignature; -use fee_market:: - fee_market_proxy -; +use fee_market::fee_market_proxy; use multiversx_sc::{hex_literal::hex, storage::StorageKey}; use transaction::{GasLimit, OperationData, TransferData}; @@ -25,167 +22,6 @@ pub trait CreateTxModule: + token_mapping::TokenMappingModule + multiversx_sc_modules::default_issue_callbacks::DefaultIssueCallbacksModule { - #[endpoint(setMaxUserTxGasLimit)] - fn set_max_user_tx_gas_limit( - &self, - new_value: GasLimit, - opt_sig: OptionalValue>, - ) { - if !self.is_setup_phase_complete() { - self.require_caller_initiator(); - self.max_user_tx_gas_limit().set(new_value); - - return; - } - - let opt_signature = opt_sig.into_option(); - require!(opt_signature.is_some(), "Must provide signature"); - let signature = unsafe { opt_signature.unwrap_unchecked() }; - let mut signature_data = ManagedBuffer::new(); - let _ = new_value.dep_encode(&mut signature_data); - - self.multi_verify_signature(&signature_data, &signature); - - self.max_user_tx_gas_limit().set(new_value); - } - - #[endpoint(setBurnAndMint)] - fn set_burn_and_mint( - &self, - opt_signature: Option>, - tokens: MultiValueEncoded, - ) { - if !self.is_setup_phase_complete() { - self.require_caller_initiator(); - self.burn_tokens().extend(tokens); - - return; - } - - let all_tokens = self.verify_items_signature(opt_signature, tokens); - self.burn_tokens().extend(&all_tokens); - } - - #[endpoint(removeBurnAndMint)] - fn remove_burn_and_mint( - &self, - opt_signature: Option>, - tokens: MultiValueEncoded, - ) { - if !self.is_setup_phase_complete() { - self.require_caller_initiator(); - self.remove_items(&mut self.burn_tokens(), tokens); - - return; - } - - let all_tokens = self.verify_items_signature(opt_signature, tokens); - self.remove_items(&mut self.burn_tokens(), &all_tokens); - } - - #[endpoint(addBannedEndpointNames)] - fn add_banned_endpoint_names( - &self, - opt_signature: Option>, - names: MultiValueEncoded, - ) { - if !self.is_setup_phase_complete() { - self.require_caller_initiator(); - self.banned_endpoint_names().extend(names); - - return; - } - - let all_names = self.verify_items_signature(opt_signature, names); - self.banned_endpoint_names().extend(&all_names); - } - - #[endpoint(removeBannedEndpointNames)] - fn remove_banned_endpoint_names( - &self, - opt_signature: Option>, - names: MultiValueEncoded, - ) { - if !self.is_setup_phase_complete() { - self.require_caller_initiator(); - self.remove_items(&mut self.banned_endpoint_names(), names); - - return; - } - - let all_names = self.verify_items_signature(opt_signature, names); - self.remove_items(&mut self.banned_endpoint_names(), &all_names); - } - - #[payable("*")] - #[endpoint(depositBack)] - fn deposit_back(&self, to: ManagedAddress) { - require!(self.not_paused(), "Cannot create transaction while paused"); - - let caller = self.blockchain().get_caller(); - require!(caller == ESDT_SYSTEM_SC_ADDRESS.into(), "Caller is invalid"); - - let payments = self.call_value().all_esdt_transfers(); - - require!(!payments.is_empty(), "Nothing to transfer"); - require!(payments.len() <= MAX_TRANSFERS_PER_TX, "Too many tokens"); - - self.send().direct_multi(&to, &payments); - } - - fn check_and_extract_fee( - &self, - ) -> MultiValue2, ManagedVec> { - let mut payments = self.call_value().all_esdt_transfers().clone_value(); - - require!(!payments.is_empty(), "Nothing to transfer"); - require!(payments.len() <= MAX_TRANSFERS_PER_TX, "Too many tokens"); - - let fee_market_address = self.fee_market_address().get(); - let fee_enabled_mapper = SingleValueMapper::new_from_address( - fee_market_address.clone(), - StorageKey::from("feeEnabledFlag"), - ) - .get(); - - let opt_transfer_data = if fee_enabled_mapper { - OptionalValue::Some(self.pop_first_payment(&mut payments)) - } else { - OptionalValue::None - }; - - MultiValue2::from((opt_transfer_data, payments)) - } - - fn process_transfer_data( - &self, - opt_transfer_data: OptionalValue< - MultiValue3>, - >, - ) -> Option> { - match &opt_transfer_data { - OptionalValue::Some(transfer_data) => { - let (gas_limit, function, args) = transfer_data.clone().into_tuple(); - let max_gas_limit = self.max_user_tx_gas_limit().get(); - - require!(gas_limit <= max_gas_limit, "Gas limit too high"); - - require!( - !self.banned_endpoint_names().contains(&function), - "Banned endpoint name" - ); - - Some(TransferData { - gas_limit, - function, - args, - }) - } - OptionalValue::None => None, - } - } - - /// Create an Elrond -> Sovereign transaction. #[payable("*")] #[endpoint] fn deposit( @@ -271,6 +107,58 @@ pub trait CreateTxModule: ); } + fn check_and_extract_fee( + &self, + ) -> MultiValue2, ManagedVec> { + let mut payments = self.call_value().all_esdt_transfers().clone_value(); + + require!(!payments.is_empty(), "Nothing to transfer"); + require!(payments.len() <= MAX_TRANSFERS_PER_TX, "Too many tokens"); + + let fee_market_address = self.fee_market_address().get(); + let fee_enabled_mapper = SingleValueMapper::new_from_address( + fee_market_address.clone(), + StorageKey::from("feeEnabledFlag"), + ) + .get(); + + let opt_transfer_data = if fee_enabled_mapper { + OptionalValue::Some(self.pop_first_payment(&mut payments)) + } else { + OptionalValue::None + }; + + MultiValue2::from((opt_transfer_data, payments)) + } + + fn process_transfer_data( + &self, + opt_transfer_data: OptionalValue< + MultiValue3>, + >, + ) -> Option> { + match &opt_transfer_data { + OptionalValue::Some(transfer_data) => { + let (gas_limit, function, args) = transfer_data.clone().into_tuple(); + let max_gas_limit = self.max_user_tx_gas_limit().get(); + + require!(gas_limit <= max_gas_limit, "Gas limit too high"); + + require!( + !self.banned_endpoint_names().contains(&function), + "Banned endpoint name" + ); + + Some(TransferData { + gas_limit, + function, + args, + }) + } + OptionalValue::None => None, + } + } + fn remove_sovereign_token( &self, payment: EsdtTokenPayment, @@ -336,7 +224,4 @@ pub trait CreateTxModule: #[storage_mapper("bannedEndpointNames")] fn banned_endpoint_names(&self) -> UnorderedSetMapper; - - #[storage_mapper("feeEnabledFlag")] - fn fee_enabled(&self) -> SingleValueMapper; } diff --git a/enshrine-esdt-safe/wasm-enshrine-esdt-safe-full/src/lib.rs b/enshrine-esdt-safe/wasm-enshrine-esdt-safe-full/src/lib.rs index 46db249b..b88b45fd 100644 --- a/enshrine-esdt-safe/wasm-enshrine-esdt-safe-full/src/lib.rs +++ b/enshrine-esdt-safe/wasm-enshrine-esdt-safe-full/src/lib.rs @@ -6,10 +6,10 @@ // Init: 1 // Upgrade: 1 -// Endpoints: 38 +// Endpoints: 32 // Async Callback: 1 // Promise callbacks: 1 -// Total number of exported functions: 42 +// Total number of exported functions: 36 #![no_std] @@ -23,12 +23,6 @@ multiversx_sc_wasm_adapter::endpoints! { upgrade => upgrade setFeeMarketAddress => set_fee_market_address setMultisigAddress => set_header_verifier_address - setMaxUserTxGasLimit => set_max_user_tx_gas_limit - setBurnAndMint => set_burn_and_mint - removeBurnAndMint => remove_burn_and_mint - addBannedEndpointNames => add_banned_endpoint_names - removeBannedEndpointNames => remove_banned_endpoint_names - depositBack => deposit_back deposit => deposit claimRefund => claim_refund setTransactionBatchStatus => set_transaction_batch_status diff --git a/enshrine-esdt-safe/wasm/src/lib.rs b/enshrine-esdt-safe/wasm/src/lib.rs index 46db249b..b88b45fd 100644 --- a/enshrine-esdt-safe/wasm/src/lib.rs +++ b/enshrine-esdt-safe/wasm/src/lib.rs @@ -6,10 +6,10 @@ // Init: 1 // Upgrade: 1 -// Endpoints: 38 +// Endpoints: 32 // Async Callback: 1 // Promise callbacks: 1 -// Total number of exported functions: 42 +// Total number of exported functions: 36 #![no_std] @@ -23,12 +23,6 @@ multiversx_sc_wasm_adapter::endpoints! { upgrade => upgrade setFeeMarketAddress => set_fee_market_address setMultisigAddress => set_header_verifier_address - setMaxUserTxGasLimit => set_max_user_tx_gas_limit - setBurnAndMint => set_burn_and_mint - removeBurnAndMint => remove_burn_and_mint - addBannedEndpointNames => add_banned_endpoint_names - removeBannedEndpointNames => remove_banned_endpoint_names - depositBack => deposit_back deposit => deposit claimRefund => claim_refund setTransactionBatchStatus => set_transaction_batch_status From 291df6cfb2cbe9be07de6a10523ae03554ed58dd Mon Sep 17 00:00:00 2001 From: Andrei Baltariu Date: Fri, 21 Jun 2024 13:28:54 +0300 Subject: [PATCH 029/523] Enshrine esdt general cleanup --- .../src/enshrine_esdt_safe_proxy.rs | 63 ---------------- .../src/from_sovereign/token_mapping.rs | 49 ------------- enshrine-esdt-safe/src/lib.rs | 2 - enshrine-esdt-safe/src/to_sovereign/events.rs | 13 +--- enshrine-esdt-safe/src/to_sovereign/mod.rs | 2 - enshrine-esdt-safe/src/to_sovereign/refund.rs | 55 -------------- .../src/to_sovereign/set_tx_status.rs | 71 ------------------- .../wasm-enshrine-esdt-safe-full/src/lib.rs | 7 +- enshrine-esdt-safe/wasm/src/lib.rs | 7 +- .../src/from_sovereign/transfer_tokens.rs | 6 +- 10 files changed, 8 insertions(+), 267 deletions(-) delete mode 100644 enshrine-esdt-safe/src/to_sovereign/refund.rs delete mode 100644 enshrine-esdt-safe/src/to_sovereign/set_tx_status.rs diff --git a/enshrine-esdt-safe/src/enshrine_esdt_safe_proxy.rs b/enshrine-esdt-safe/src/enshrine_esdt_safe_proxy.rs index 749ae808..b5c54f2c 100644 --- a/enshrine-esdt-safe/src/enshrine_esdt_safe_proxy.rs +++ b/enshrine-esdt-safe/src/enshrine_esdt_safe_proxy.rs @@ -126,45 +126,6 @@ where .original_result() } - /// Claim funds for failed Elrond -> Sovereign transactions. - /// These are not sent automatically to prevent the contract getting stuck. - /// For example, if the receiver is a SC, a frozen account, etc. - pub fn claim_refund< - Arg0: ProxyArg>, - >( - self, - token_id: Arg0, - ) -> TxTypedCall>> { - self.wrapped_tx - .payment(NotPayable) - .raw_call("claimRefund") - .argument(&token_id) - .original_result() - } - - /// Sets the statuses for the transactions, after they were executed on the Sovereign side. - /// - /// Only TransactionStatus::Executed (3) and TransactionStatus::Rejected (4) values are allowed. - /// Number of provided statuses must be equal to number of transactions in the batch. - pub fn set_transaction_batch_status< - Arg0: ProxyArg, - Arg1: ProxyArg>, - Arg2: ProxyArg>, - >( - self, - batch_id: Arg0, - signature: Arg1, - tx_statuses: Arg2, - ) -> TxTypedCall { - self.wrapped_tx - .payment(NotPayable) - .raw_call("setTransactionBatchStatus") - .argument(&batch_id) - .argument(&signature) - .argument(&tx_statuses) - .original_result() - } - pub fn set_min_valid_signers< Arg0: ProxyArg, >( @@ -204,30 +165,6 @@ where .original_result() } - pub fn register_token< - Arg0: ProxyArg>, - Arg1: ProxyArg, - Arg2: ProxyArg>, - Arg3: ProxyArg>, - Arg4: ProxyArg, - >( - self, - sov_token_id: Arg0, - token_type: Arg1, - token_display_name: Arg2, - token_ticker: Arg3, - num_decimals: Arg4, - ) -> TxTypedCall { - self.wrapped_tx - .raw_call("registerToken") - .argument(&sov_token_id) - .argument(&token_type) - .argument(&token_display_name) - .argument(&token_ticker) - .argument(&num_decimals) - .original_result() - } - pub fn clear_registered_sovereign_token< Arg0: ProxyArg>, >( diff --git a/enshrine-esdt-safe/src/from_sovereign/token_mapping.rs b/enshrine-esdt-safe/src/from_sovereign/token_mapping.rs index f6aad260..320fbd27 100644 --- a/enshrine-esdt-safe/src/from_sovereign/token_mapping.rs +++ b/enshrine-esdt-safe/src/from_sovereign/token_mapping.rs @@ -1,4 +1,3 @@ -const DEFAULT_ISSUE_COST: u64 = 50000000000000000; multiversx_sc::imports!(); multiversx_sc::derive_imports!(); @@ -12,54 +11,6 @@ pub struct EsdtTokenInfo { pub trait TokenMappingModule: multiversx_sc_modules::default_issue_callbacks::DefaultIssueCallbacksModule { - #[payable("EGLD")] - #[endpoint(registerToken)] - fn register_token( - &self, - sov_token_id: TokenIdentifier, - token_type: EsdtTokenType, - token_display_name: ManagedBuffer, - token_ticker: ManagedBuffer, - num_decimals: usize, - ) { - require!( - !self.is_sovereign_chain().get(), - "Invalid method to call in current chain" - ); - - let issue_cost = self.call_value().egld_value().clone_value(); - - require!(issue_cost == DEFAULT_ISSUE_COST, "eGLD value should be 0.5"); - - match token_type { - EsdtTokenType::Invalid => sc_panic!("Invalid type"), - EsdtTokenType::Fungible => self.handle_fungible_token_type( - sov_token_id.clone(), - issue_cost, - token_display_name, - token_ticker, - num_decimals, - ), - _ => self.handle_nonfungible_token_type( - sov_token_id.clone(), - token_type, - issue_cost, - token_display_name, - token_ticker, - num_decimals, - ), - } - - match self.sovereign_to_multiversx_token_id(&sov_token_id).get() { - TokenMapperState::NotSet => sc_panic!("Token ID not set"), - TokenMapperState::Pending => {} - TokenMapperState::Token(mx_token_id) => { - self.multiversx_to_sovereign_token_id(&mx_token_id) - .set(sov_token_id); - } - } - } - fn handle_fungible_token_type( &self, sov_token_id: TokenIdentifier, diff --git a/enshrine-esdt-safe/src/lib.rs b/enshrine-esdt-safe/src/lib.rs index 37e40b76..1bde1e01 100644 --- a/enshrine-esdt-safe/src/lib.rs +++ b/enshrine-esdt-safe/src/lib.rs @@ -11,8 +11,6 @@ pub mod enshrine_esdt_safe_proxy; pub trait EnshrineEsdtSafe: to_sovereign::create_tx::CreateTxModule + to_sovereign::events::EventsModule - + to_sovereign::refund::RefundModule - + to_sovereign::set_tx_status::SetTxStatusModule + bls_signature::BlsSignatureModule + from_sovereign::events::EventsModule + from_sovereign::token_mapping::TokenMappingModule diff --git a/enshrine-esdt-safe/src/to_sovereign/events.rs b/enshrine-esdt-safe/src/to_sovereign/events.rs index ba1d55a0..15439c68 100644 --- a/enshrine-esdt-safe/src/to_sovereign/events.rs +++ b/enshrine-esdt-safe/src/to_sovereign/events.rs @@ -1,6 +1,4 @@ -use transaction::{ - transaction_status::TransactionStatus, BatchId, OperationData, TxId -}; +use transaction::OperationData; multiversx_sc::imports!(); multiversx_sc::derive_imports!(); @@ -9,18 +7,9 @@ multiversx_sc::derive_imports!(); pub trait EventsModule { #[event("deposit")] fn deposit_event( - // TODO: Use ManagedVec of EsdtTokenPaymentInfo(EsdtTokenDataPayment, EsdtTokenData) &self, #[indexed] dest_address: &ManagedAddress, #[indexed] tokens: &MultiValueEncoded>, event_data: OperationData, ); - - #[event("setStatusEvent")] - fn set_status_event( - &self, - #[indexed] batch_id: BatchId, - #[indexed] tx_id: TxId, - #[indexed] tx_status: TransactionStatus, - ); } diff --git a/enshrine-esdt-safe/src/to_sovereign/mod.rs b/enshrine-esdt-safe/src/to_sovereign/mod.rs index 72718603..5c2924da 100644 --- a/enshrine-esdt-safe/src/to_sovereign/mod.rs +++ b/enshrine-esdt-safe/src/to_sovereign/mod.rs @@ -1,4 +1,2 @@ pub mod create_tx; pub mod events; -pub mod refund; -pub mod set_tx_status; diff --git a/enshrine-esdt-safe/src/to_sovereign/refund.rs b/enshrine-esdt-safe/src/to_sovereign/refund.rs deleted file mode 100644 index 62c37409..00000000 --- a/enshrine-esdt-safe/src/to_sovereign/refund.rs +++ /dev/null @@ -1,55 +0,0 @@ -multiversx_sc::imports!(); -multiversx_sc::derive_imports!(); - -#[derive(TopEncode, TopDecode, NestedEncode, NestedDecode, ManagedVecItem)] -pub struct NonceAmountPair { - pub nonce: u64, - pub amount: BigUint, -} - -#[multiversx_sc::module] -pub trait RefundModule: - super::events::EventsModule - + tx_batch_module::TxBatchModule - + max_bridged_amount_module::MaxBridgedAmountModule -{ - /// Claim funds for failed Elrond -> Sovereign transactions. - /// These are not sent automatically to prevent the contract getting stuck. - /// For example, if the receiver is a SC, a frozen account, etc. - #[endpoint(claimRefund)] - fn claim_refund(&self, token_id: TokenIdentifier) -> ManagedVec { - let caller = self.blockchain().get_caller(); - let refund_amounts = self.refund_amount(&caller, &token_id).take(); - require!(!refund_amounts.is_empty(), "Nothing to refund"); - - let mut output_payments = ManagedVec::new(); - for nonce_amount_pair in &refund_amounts { - output_payments.push(EsdtTokenPayment::new( - token_id.clone(), - nonce_amount_pair.nonce, - nonce_amount_pair.amount, - )); - } - - self.send().direct_multi(&caller, &output_payments); - - output_payments - } - - fn mark_refund(&self, to: &ManagedAddress, token: &EsdtTokenPayment) { - self.refund_amount(to, &token.token_identifier) - .update(|refund| { - refund.push(NonceAmountPair { - nonce: token.token_nonce, - amount: token.amount.clone(), - }); - }); - } - - #[storage_mapper("refundAmount")] - fn refund_amount( - &self, - address: &ManagedAddress, - token_id: &TokenIdentifier, - ) -> SingleValueMapper>>; -} diff --git a/enshrine-esdt-safe/src/to_sovereign/set_tx_status.rs b/enshrine-esdt-safe/src/to_sovereign/set_tx_status.rs deleted file mode 100644 index 9229866c..00000000 --- a/enshrine-esdt-safe/src/to_sovereign/set_tx_status.rs +++ /dev/null @@ -1,71 +0,0 @@ -use bls_signature::BlsSignature; -use transaction::{transaction_status::TransactionStatus, BatchId}; - -multiversx_sc::imports!(); - -#[multiversx_sc::module] -pub trait SetTxStatusModule: - bls_signature::BlsSignatureModule - + super::events::EventsModule - + super::refund::RefundModule - + tx_batch_module::TxBatchModule - + max_bridged_amount_module::MaxBridgedAmountModule -{ - /// Sets the statuses for the transactions, after they were executed on the Sovereign side. - /// - /// Only TransactionStatus::Executed (3) and TransactionStatus::Rejected (4) values are allowed. - /// Number of provided statuses must be equal to number of transactions in the batch. - #[endpoint(setTransactionBatchStatus)] - fn set_transaction_batch_status( - &self, - batch_id: BatchId, - signature: BlsSignature, - tx_statuses: MultiValueEncoded, - ) { - let first_batch_id = self.first_batch_id().get(); - require!( - batch_id == first_batch_id, - "Batches must be processed in order" - ); - - let mut tx_batch = self.pending_batches(batch_id); - require!( - tx_batch.len() == tx_statuses.len(), - "Invalid number of statuses provided" - ); - - let mut serialized_data = ManagedBuffer::new(); - let tx_statuses_vec = tx_statuses.to_vec(); - - let _ = batch_id.dep_encode(&mut serialized_data); - for status in &tx_statuses_vec { - let _ = status.dep_encode(&mut serialized_data); - } - - self.multi_verify_signature(&serialized_data, &signature); - - for (tx, tx_status) in tx_batch.iter().zip(tx_statuses_vec.iter()) { - // Since tokens don't exist in the EsdtSafe in the case of a refund transaction - // we have no tokens to burn, nor to refund - if tx.is_refund_tx { - continue; - } - - match tx_status { - TransactionStatus::Executed => {} - TransactionStatus::Rejected => { - for token in &tx.tokens { - self.mark_refund(&tx.from, &token); - } - } - _ => { - sc_panic!("Transaction status may only be set to Executed or Rejected"); - } - } - - self.set_status_event(batch_id, tx.nonce, tx_status); - } - - self.clear_first_batch(&mut tx_batch); - } -} diff --git a/enshrine-esdt-safe/wasm-enshrine-esdt-safe-full/src/lib.rs b/enshrine-esdt-safe/wasm-enshrine-esdt-safe-full/src/lib.rs index b88b45fd..86b3ee87 100644 --- a/enshrine-esdt-safe/wasm-enshrine-esdt-safe-full/src/lib.rs +++ b/enshrine-esdt-safe/wasm-enshrine-esdt-safe-full/src/lib.rs @@ -6,10 +6,10 @@ // Init: 1 // Upgrade: 1 -// Endpoints: 32 +// Endpoints: 29 // Async Callback: 1 // Promise callbacks: 1 -// Total number of exported functions: 36 +// Total number of exported functions: 33 #![no_std] @@ -24,12 +24,9 @@ multiversx_sc_wasm_adapter::endpoints! { setFeeMarketAddress => set_fee_market_address setMultisigAddress => set_header_verifier_address deposit => deposit - claimRefund => claim_refund - setTransactionBatchStatus => set_transaction_batch_status setMinValidSigners => set_min_valid_signers addSigners => add_signers removeSigners => remove_signers - registerToken => register_token clearRegisteredSovereignToken => clear_registered_sovereign_token clearRegisteredMultiversxToken => clear_registered_multiversx_token executeBridgeOps => execute_operations diff --git a/enshrine-esdt-safe/wasm/src/lib.rs b/enshrine-esdt-safe/wasm/src/lib.rs index b88b45fd..86b3ee87 100644 --- a/enshrine-esdt-safe/wasm/src/lib.rs +++ b/enshrine-esdt-safe/wasm/src/lib.rs @@ -6,10 +6,10 @@ // Init: 1 // Upgrade: 1 -// Endpoints: 32 +// Endpoints: 29 // Async Callback: 1 // Promise callbacks: 1 -// Total number of exported functions: 36 +// Total number of exported functions: 33 #![no_std] @@ -24,12 +24,9 @@ multiversx_sc_wasm_adapter::endpoints! { setFeeMarketAddress => set_fee_market_address setMultisigAddress => set_header_verifier_address deposit => deposit - claimRefund => claim_refund - setTransactionBatchStatus => set_transaction_batch_status setMinValidSigners => set_min_valid_signers addSigners => add_signers removeSigners => remove_signers - registerToken => register_token clearRegisteredSovereignToken => clear_registered_sovereign_token clearRegisteredMultiversxToken => clear_registered_multiversx_token executeBridgeOps => execute_operations diff --git a/esdt-safe/src/from_sovereign/transfer_tokens.rs b/esdt-safe/src/from_sovereign/transfer_tokens.rs index 05b45479..afb88298 100644 --- a/esdt-safe/src/from_sovereign/transfer_tokens.rs +++ b/esdt-safe/src/from_sovereign/transfer_tokens.rs @@ -1,8 +1,8 @@ -use builtin_func_names::{ESDT_MULTI_TRANSFER_FUNC_NAME, ESDT_NFT_CREATE_FUNC_NAME}; +use builtin_func_names::ESDT_MULTI_TRANSFER_FUNC_NAME; use header_verifier::header_verifier_proxy; -use multiversx_sc::{codec, storage::StorageKey}; +use multiversx_sc::storage::StorageKey; use transaction::{ - BatchId, GasLimit, Operation, OperationData, OperationEsdtPayment, OperationTuple, + GasLimit, Operation, OperationData, OperationEsdtPayment, OperationTuple, }; use crate::to_sovereign; From 22a7ff972a20dc3dd0d684dd7c9c41f69c400eaa Mon Sep 17 00:00:00 2001 From: Andrei Baltariu Date: Fri, 21 Jun 2024 14:19:32 +0300 Subject: [PATCH 030/523] Modified mint logic --- .../src/from_sovereign/transfer_tokens.rs | 117 ++++++++---------- 1 file changed, 50 insertions(+), 67 deletions(-) diff --git a/esdt-safe/src/from_sovereign/transfer_tokens.rs b/esdt-safe/src/from_sovereign/transfer_tokens.rs index afb88298..6f443a9b 100644 --- a/esdt-safe/src/from_sovereign/transfer_tokens.rs +++ b/esdt-safe/src/from_sovereign/transfer_tokens.rs @@ -1,14 +1,10 @@ -use builtin_func_names::ESDT_MULTI_TRANSFER_FUNC_NAME; +use builtin_func_names::{ESDT_MULTI_TRANSFER_FUNC_NAME, ESDT_NFT_CREATE_FUNC_NAME}; use header_verifier::header_verifier_proxy; -use multiversx_sc::storage::StorageKey; -use transaction::{ - GasLimit, Operation, OperationData, OperationEsdtPayment, OperationTuple, -}; +use multiversx_sc::{codec, storage::StorageKey}; +use transaction::{GasLimit, Operation, OperationData, OperationEsdtPayment, OperationTuple}; use crate::to_sovereign; -use super::token_mapping::EsdtTokenInfo; - multiversx_sc::imports!(); const CALLBACK_GAS: GasLimit = 10_000_000; // Increase if not enough @@ -60,39 +56,61 @@ pub trait TransferTokensModule: let mut output_payments = ManagedVec::new(); for operation_token in operation_tokens.iter() { - let mx_token_id_state = self - .sovereign_to_multiversx_token_id(&operation_token.token_identifier) - .get(); - - let mx_token_id = match mx_token_id_state { - // token is from sovereign -> continue and mint - TokenMapperState::Token(token_id) => token_id, - // token is from mainchain -> push token - _ => { - output_payments.push(operation_token.clone()); + if !self.has_sov_token_prefix(&operation_token.token_identifier) { + output_payments.push(operation_token.clone()); + continue; + } - continue; + let mut nonce = operation_token.token_nonce; + if nonce == 0 { + self.send().esdt_local_mint( + &operation_token.token_identifier, + operation_token.token_nonce, + &operation_token.token_data.amount, + ); + } else { + let token_data = operation_token.token_data.clone(); + let mut arg_buffer = ManagedArgBuffer::new(); + + arg_buffer.push_arg(&operation_token.token_identifier); + arg_buffer.push_arg(token_data.amount); + arg_buffer.push_arg(token_data.name); + arg_buffer.push_arg(token_data.royalties); + arg_buffer.push_arg(token_data.hash); + arg_buffer.push_arg(token_data.attributes); + + let uris = token_data.uris.clone(); + + if uris.is_empty() { + // at least one URI is required, so we push an empty one + arg_buffer.push_arg(codec::Empty); + } else { + // The API function has the last argument as variadic, + // so we top-encode each and send as separate argument + for uri in &uris { + arg_buffer.push_arg(uri); + } } - }; - if operation_token.token_nonce == 0 { - self.send() - .esdt_local_mint(&mx_token_id, 0, &operation_token.token_data.amount); + arg_buffer.push_arg(operation_token.token_nonce); + arg_buffer.push_arg(token_data.creator); - output_payments.push(OperationEsdtPayment { - token_identifier: mx_token_id, - token_nonce: 0, - token_data: operation_token.token_data, - }); + let output = self.send_raw().call_local_esdt_built_in_function( + self.blockchain().get_gas_left(), + &ManagedBuffer::from(ESDT_NFT_CREATE_FUNC_NAME), + &arg_buffer, + ); - continue; + if let Some(first_result_bytes) = output.try_get(0) { + nonce = first_result_bytes.parse_as_u64().unwrap_or_default() + } else { + nonce = 0 + } } - let nft_nonce = self.mint_and_save_token(&mx_token_id, &operation_token); - output_payments.push(OperationEsdtPayment { - token_identifier: mx_token_id, - token_nonce: nft_nonce, + token_identifier: operation_token.token_identifier, + token_nonce: nonce, token_data: operation_token.token_data, }); } @@ -100,41 +118,6 @@ pub trait TransferTokensModule: output_payments } - fn mint_and_save_token( - self, - mx_token_id: &TokenIdentifier, - operation_token: &OperationEsdtPayment, - ) -> u64 { - // mint NFT - let nft_nonce = self.send().esdt_nft_create( - mx_token_id, - &operation_token.token_data.amount, - &operation_token.token_data.name, - &operation_token.token_data.royalties, - &operation_token.token_data.hash, - &operation_token.token_data.attributes, - &operation_token.token_data.uris, - ); - - // save token id and nonce - self.sovereign_esdt_token_info_mapper( - &operation_token.token_identifier, - &operation_token.token_nonce, - ) - .set(EsdtTokenInfo { - token_identifier: mx_token_id.clone(), - token_nonce: nft_nonce, - }); - - self.multiversx_esdt_token_info_mapper(mx_token_id, &nft_nonce) - .set(EsdtTokenInfo { - token_identifier: operation_token.token_identifier.clone(), - token_nonce: operation_token.token_nonce, - }); - - nft_nonce - } - fn distribute_payments( &self, hash_of_hashes: ManagedBuffer, From 4e7059a375924b0eacfe6d56afc639ac8a193487 Mon Sep 17 00:00:00 2001 From: Andrei Baltariu Date: Fri, 21 Jun 2024 15:13:22 +0300 Subject: [PATCH 031/523] Revert "Modified mint logic" This reverts commit 22a7ff972a20dc3dd0d684dd7c9c41f69c400eaa. --- .../src/from_sovereign/transfer_tokens.rs | 117 ++++++++++-------- 1 file changed, 67 insertions(+), 50 deletions(-) diff --git a/esdt-safe/src/from_sovereign/transfer_tokens.rs b/esdt-safe/src/from_sovereign/transfer_tokens.rs index 6f443a9b..afb88298 100644 --- a/esdt-safe/src/from_sovereign/transfer_tokens.rs +++ b/esdt-safe/src/from_sovereign/transfer_tokens.rs @@ -1,10 +1,14 @@ -use builtin_func_names::{ESDT_MULTI_TRANSFER_FUNC_NAME, ESDT_NFT_CREATE_FUNC_NAME}; +use builtin_func_names::ESDT_MULTI_TRANSFER_FUNC_NAME; use header_verifier::header_verifier_proxy; -use multiversx_sc::{codec, storage::StorageKey}; -use transaction::{GasLimit, Operation, OperationData, OperationEsdtPayment, OperationTuple}; +use multiversx_sc::storage::StorageKey; +use transaction::{ + GasLimit, Operation, OperationData, OperationEsdtPayment, OperationTuple, +}; use crate::to_sovereign; +use super::token_mapping::EsdtTokenInfo; + multiversx_sc::imports!(); const CALLBACK_GAS: GasLimit = 10_000_000; // Increase if not enough @@ -56,61 +60,39 @@ pub trait TransferTokensModule: let mut output_payments = ManagedVec::new(); for operation_token in operation_tokens.iter() { - if !self.has_sov_token_prefix(&operation_token.token_identifier) { - output_payments.push(operation_token.clone()); - continue; - } + let mx_token_id_state = self + .sovereign_to_multiversx_token_id(&operation_token.token_identifier) + .get(); - let mut nonce = operation_token.token_nonce; - if nonce == 0 { - self.send().esdt_local_mint( - &operation_token.token_identifier, - operation_token.token_nonce, - &operation_token.token_data.amount, - ); - } else { - let token_data = operation_token.token_data.clone(); - let mut arg_buffer = ManagedArgBuffer::new(); - - arg_buffer.push_arg(&operation_token.token_identifier); - arg_buffer.push_arg(token_data.amount); - arg_buffer.push_arg(token_data.name); - arg_buffer.push_arg(token_data.royalties); - arg_buffer.push_arg(token_data.hash); - arg_buffer.push_arg(token_data.attributes); - - let uris = token_data.uris.clone(); - - if uris.is_empty() { - // at least one URI is required, so we push an empty one - arg_buffer.push_arg(codec::Empty); - } else { - // The API function has the last argument as variadic, - // so we top-encode each and send as separate argument - for uri in &uris { - arg_buffer.push_arg(uri); - } + let mx_token_id = match mx_token_id_state { + // token is from sovereign -> continue and mint + TokenMapperState::Token(token_id) => token_id, + // token is from mainchain -> push token + _ => { + output_payments.push(operation_token.clone()); + + continue; } + }; - arg_buffer.push_arg(operation_token.token_nonce); - arg_buffer.push_arg(token_data.creator); + if operation_token.token_nonce == 0 { + self.send() + .esdt_local_mint(&mx_token_id, 0, &operation_token.token_data.amount); - let output = self.send_raw().call_local_esdt_built_in_function( - self.blockchain().get_gas_left(), - &ManagedBuffer::from(ESDT_NFT_CREATE_FUNC_NAME), - &arg_buffer, - ); + output_payments.push(OperationEsdtPayment { + token_identifier: mx_token_id, + token_nonce: 0, + token_data: operation_token.token_data, + }); - if let Some(first_result_bytes) = output.try_get(0) { - nonce = first_result_bytes.parse_as_u64().unwrap_or_default() - } else { - nonce = 0 - } + continue; } + let nft_nonce = self.mint_and_save_token(&mx_token_id, &operation_token); + output_payments.push(OperationEsdtPayment { - token_identifier: operation_token.token_identifier, - token_nonce: nonce, + token_identifier: mx_token_id, + token_nonce: nft_nonce, token_data: operation_token.token_data, }); } @@ -118,6 +100,41 @@ pub trait TransferTokensModule: output_payments } + fn mint_and_save_token( + self, + mx_token_id: &TokenIdentifier, + operation_token: &OperationEsdtPayment, + ) -> u64 { + // mint NFT + let nft_nonce = self.send().esdt_nft_create( + mx_token_id, + &operation_token.token_data.amount, + &operation_token.token_data.name, + &operation_token.token_data.royalties, + &operation_token.token_data.hash, + &operation_token.token_data.attributes, + &operation_token.token_data.uris, + ); + + // save token id and nonce + self.sovereign_esdt_token_info_mapper( + &operation_token.token_identifier, + &operation_token.token_nonce, + ) + .set(EsdtTokenInfo { + token_identifier: mx_token_id.clone(), + token_nonce: nft_nonce, + }); + + self.multiversx_esdt_token_info_mapper(mx_token_id, &nft_nonce) + .set(EsdtTokenInfo { + token_identifier: operation_token.token_identifier.clone(), + token_nonce: operation_token.token_nonce, + }); + + nft_nonce + } + fn distribute_payments( &self, hash_of_hashes: ManagedBuffer, From 363a47b75886283fb287a0aff2454bc2cebc2228 Mon Sep 17 00:00:00 2001 From: Andrei Baltariu Date: Fri, 21 Jun 2024 15:15:00 +0300 Subject: [PATCH 032/523] Modified enshrine mint logic --- .../src/from_sovereign/transfer_tokens.rs | 79 +++++++++---------- 1 file changed, 39 insertions(+), 40 deletions(-) diff --git a/enshrine-esdt-safe/src/from_sovereign/transfer_tokens.rs b/enshrine-esdt-safe/src/from_sovereign/transfer_tokens.rs index 0d7d7f2c..a3ec88eb 100644 --- a/enshrine-esdt-safe/src/from_sovereign/transfer_tokens.rs +++ b/enshrine-esdt-safe/src/from_sovereign/transfer_tokens.rs @@ -1,9 +1,8 @@ -use header_verifier::header_verifier_proxy; -use multiversx_sc::{api::ESDT_MULTI_TRANSFER_FUNC_NAME, storage::StorageKey}; -use transaction::{ - GasLimit, Operation, OperationData, OperationEsdtPayment, OperationTuple, -}; use crate::to_sovereign; +use builtin_func_names::ESDT_NFT_CREATE_FUNC_NAME; +use header_verifier::header_verifier_proxy; +use multiversx_sc::{api::ESDT_MULTI_TRANSFER_FUNC_NAME, codec, storage::StorageKey}; +use transaction::{GasLimit, Operation, OperationData, OperationEsdtPayment, OperationTuple}; use super::token_mapping::EsdtTokenInfo; @@ -69,43 +68,43 @@ pub trait TransferTokensModule: &operation_token.token_data.amount, ); } else { - nonce = self.send().esdt_nft_create( - &operation_token.token_identifier, - &operation_token.token_data.amount, - &operation_token.token_data.name, - &operation_token.token_data.royalties, - &operation_token.token_data.hash, - &operation_token.token_data.attributes, - &operation_token.token_data.uris, + let token_data = operation_token.token_data.clone(); + let mut arg_buffer = ManagedArgBuffer::new(); + + arg_buffer.push_arg(&operation_token.token_identifier); + arg_buffer.push_arg(token_data.amount); + arg_buffer.push_arg(token_data.name); + arg_buffer.push_arg(token_data.royalties); + arg_buffer.push_arg(token_data.hash); + arg_buffer.push_arg(token_data.attributes); + + let uris = token_data.uris.clone(); + + if uris.is_empty() { + // at least one URI is required, so we push an empty one + arg_buffer.push_arg(codec::Empty); + } else { + // The API function has the last argument as variadic, + // so we top-encode each and send as separate argument + for uri in &uris { + arg_buffer.push_arg(uri); + } + } + + arg_buffer.push_arg(operation_token.token_nonce); + arg_buffer.push_arg(token_data.creator); + + let output = self.send_raw().call_local_esdt_built_in_function( + self.blockchain().get_gas_left(), + &ManagedBuffer::from(ESDT_NFT_CREATE_FUNC_NAME), + &arg_buffer, ); - // let token_data = operation_token.token_data.clone(); - // let mut arg_buffer = ManagedArgBuffer::new(); - // arg_buffer.push_arg(&operation_token.token_identifier); - // arg_buffer.push_arg(token_data.amount); - // arg_buffer.push_arg(token_data.name); - // arg_buffer.push_arg(token_data.royalties); - // arg_buffer.push_arg(token_data.hash); - // arg_buffer.push_arg(token_data.attributes); - // let uris = token_data.uris.clone(); - - // if uris.is_empty() { - // // at least one URI is required, so we push an empty one - // arg_buffer.push_arg(codec::Empty); - // } else { - // // The API function has the last argument as variadic, - // // so we top-encode each and send as separate argument - // for uri in &uris { - // arg_buffer.push_arg(uri); - // } - // } - // arg_buffer.push_arg(operation_token.token_nonce); - - // self.send_raw().call_local_esdt_built_in_function( - // self.blockchain().get_gas_left(), - // &ManagedBuffer::from(ESDT_NFT_CREATE_FUNC_NAME), - // &arg_buffer, - // ); + if let Some(first_result_bytes) = output.try_get(0) { + nonce = first_result_bytes.parse_as_u64().unwrap_or_default() + } else { + nonce = 0 + } } output_payments.push(OperationEsdtPayment { From 480fd62911b537c8fd9f4a3ca146ff14b04e0638 Mon Sep 17 00:00:00 2001 From: Andrei Baltariu Date: Tue, 25 Jun 2024 10:53:31 +0300 Subject: [PATCH 033/523] WIP - modified enshrine logic --- enshrine-esdt-safe/src/from_sovereign/mod.rs | 1 - .../src/from_sovereign/token_mapping.rs | 103 ------------------ .../src/from_sovereign/transfer_tokens.rs | 69 +----------- enshrine-esdt-safe/src/lib.rs | 6 +- .../src/to_sovereign/create_tx.rs | 28 ----- 5 files changed, 9 insertions(+), 198 deletions(-) delete mode 100644 enshrine-esdt-safe/src/from_sovereign/token_mapping.rs diff --git a/enshrine-esdt-safe/src/from_sovereign/mod.rs b/enshrine-esdt-safe/src/from_sovereign/mod.rs index 51dbf34b..d46749bb 100644 --- a/enshrine-esdt-safe/src/from_sovereign/mod.rs +++ b/enshrine-esdt-safe/src/from_sovereign/mod.rs @@ -1,3 +1,2 @@ pub mod events; -pub mod token_mapping; pub mod transfer_tokens; diff --git a/enshrine-esdt-safe/src/from_sovereign/token_mapping.rs b/enshrine-esdt-safe/src/from_sovereign/token_mapping.rs deleted file mode 100644 index 320fbd27..00000000 --- a/enshrine-esdt-safe/src/from_sovereign/token_mapping.rs +++ /dev/null @@ -1,103 +0,0 @@ -multiversx_sc::imports!(); -multiversx_sc::derive_imports!(); - -#[derive(TopEncode, TopDecode, NestedEncode, NestedDecode, TypeAbi, ManagedVecItem, Clone)] -pub struct EsdtTokenInfo { - pub token_identifier: TokenIdentifier, - pub token_nonce: u64, -} - -#[multiversx_sc::module] -pub trait TokenMappingModule: - multiversx_sc_modules::default_issue_callbacks::DefaultIssueCallbacksModule -{ - fn handle_fungible_token_type( - &self, - sov_token_id: TokenIdentifier, - issue_cost: BigUint, - token_display_name: ManagedBuffer, - token_ticker: ManagedBuffer, - num_decimals: usize, - ) { - self.multiversx_to_sovereign_token_id(&sov_token_id) - .set(sov_token_id.clone()); - - self.fungible_token(&sov_token_id).issue_and_set_all_roles( - issue_cost, - token_display_name, - token_ticker, - num_decimals, - None, - ); - } - - fn handle_nonfungible_token_type( - &self, - sov_token_id: TokenIdentifier, - token_type: EsdtTokenType, - issue_cost: BigUint, - token_display_name: ManagedBuffer, - token_ticker: ManagedBuffer, - num_decimals: usize, - ) { - self.multiversx_to_sovereign_token_id(&sov_token_id) - .set(sov_token_id.clone()); - - self.non_fungible_token(&sov_token_id) - .issue_and_set_all_roles( - token_type, - issue_cost, - token_display_name, - token_ticker, - num_decimals, - None, - ); - } - - #[only_owner] - #[endpoint(clearRegisteredSovereignToken)] - fn clear_registered_sovereign_token(&self, sov_token_id: TokenIdentifier) { - self.sovereign_to_multiversx_token_id(&sov_token_id).clear(); - } - - #[only_owner] - #[endpoint(clearRegisteredMultiversxToken)] - fn clear_registered_multiversx_token(&self, mvx_token_id: TokenIdentifier) { - self.multiversx_to_sovereign_token_id(&mvx_token_id).clear(); - } - - #[storage_mapper("sovToMxTokenId")] - fn sovereign_to_multiversx_token_id( - &self, - sov_token_id: &TokenIdentifier, - ) -> SingleValueMapper>; - - #[storage_mapper("mxToSovTokenId")] - fn multiversx_to_sovereign_token_id( - &self, - mx_token_id: &TokenIdentifier, - ) -> SingleValueMapper; - - #[storage_mapper("sovToMxTokenId")] - fn fungible_token(&self, sov_token_id: &TokenIdentifier) -> FungibleTokenMapper; - - #[storage_mapper("sovToMxTokenId")] - fn non_fungible_token(&self, sov_token_id: &TokenIdentifier) -> NonFungibleTokenMapper; - - #[storage_mapper("sovEsdtTokenInfoMapper")] - fn sovereign_esdt_token_info_mapper( - &self, - token_identifier: &TokenIdentifier, - nonce: &u64, - ) -> SingleValueMapper>; - - #[storage_mapper("mxEsdtTokenInfoMapper")] - fn multiversx_esdt_token_info_mapper( - &self, - token_identifier: &TokenIdentifier, - nonce: &u64, - ) -> SingleValueMapper>; - - #[storage_mapper("isSovereignChain")] - fn is_sovereign_chain(&self) -> SingleValueMapper; -} diff --git a/enshrine-esdt-safe/src/from_sovereign/transfer_tokens.rs b/enshrine-esdt-safe/src/from_sovereign/transfer_tokens.rs index a3ec88eb..aae65d55 100644 --- a/enshrine-esdt-safe/src/from_sovereign/transfer_tokens.rs +++ b/enshrine-esdt-safe/src/from_sovereign/transfer_tokens.rs @@ -4,8 +4,6 @@ use header_verifier::header_verifier_proxy; use multiversx_sc::{api::ESDT_MULTI_TRANSFER_FUNC_NAME, codec, storage::StorageKey}; use transaction::{GasLimit, Operation, OperationData, OperationEsdtPayment, OperationTuple}; -use super::token_mapping::EsdtTokenInfo; - multiversx_sc::imports!(); const CALLBACK_GAS: GasLimit = 10_000_000; // Increase if not enough @@ -15,7 +13,6 @@ const TRANSACTION_GAS: GasLimit = 30_000_000; pub trait TransferTokensModule: bls_signature::BlsSignatureModule + super::events::EventsModule - + super::token_mapping::TokenMappingModule + tx_batch_module::TxBatchModule + max_bridged_amount_module::MaxBridgedAmountModule + multiversx_sc_modules::pause::PauseModule @@ -117,41 +114,6 @@ pub trait TransferTokensModule: output_payments } - fn mint_and_save_token( - self, - mx_token_id: &TokenIdentifier, - operation_token: &OperationEsdtPayment, - ) -> u64 { - // mint NFT - let nft_nonce = self.send().esdt_nft_create( - mx_token_id, - &operation_token.token_data.amount, - &operation_token.token_data.name, - &operation_token.token_data.royalties, - &operation_token.token_data.hash, - &operation_token.token_data.attributes, - &operation_token.token_data.uris, - ); - - // save token id and nonce - self.sovereign_esdt_token_info_mapper( - &operation_token.token_identifier, - &operation_token.token_nonce, - ) - .set(EsdtTokenInfo { - token_identifier: mx_token_id.clone(), - token_nonce: nft_nonce, - }); - - self.multiversx_esdt_token_info_mapper(mx_token_id, &nft_nonce) - .set(EsdtTokenInfo { - token_identifier: operation_token.token_identifier.clone(), - token_nonce: operation_token.token_nonce, - }); - - nft_nonce - } - fn distribute_payments( &self, hash_of_hashes: ManagedBuffer, @@ -251,38 +213,17 @@ pub trait TransferTokensModule: hash_of_hashes: &ManagedBuffer, operation_tuple: &OperationTuple, ) { - // confirmation event self.execute_bridge_operation_event( hash_of_hashes.clone(), operation_tuple.op_hash.clone(), ); for operation_token in &operation_tuple.operation.tokens { - let mx_token_id_state = self - .sovereign_to_multiversx_token_id(&operation_token.token_identifier) - .get(); - - if let TokenMapperState::Token(mx_token_id) = mx_token_id_state { - let mut mx_token_nonce = 0; - - if operation_token.token_nonce > 0 { - mx_token_nonce = self - .sovereign_esdt_token_info_mapper( - &operation_token.token_identifier, - &operation_token.token_nonce, - ) - .take() - .token_nonce; - - self.multiversx_esdt_token_info_mapper(&mx_token_id, &mx_token_nonce); - } - - self.send().esdt_local_burn( - &mx_token_id, - mx_token_nonce, - &operation_token.token_data.amount, - ); - } + self.send().esdt_local_burn( + &operation_token.token_identifier, + operation_token.token_nonce, + &operation_token.token_data.amount, + ); } // deposit back mainchain tokens into user account diff --git a/enshrine-esdt-safe/src/lib.rs b/enshrine-esdt-safe/src/lib.rs index 1bde1e01..92cf8657 100644 --- a/enshrine-esdt-safe/src/lib.rs +++ b/enshrine-esdt-safe/src/lib.rs @@ -13,7 +13,6 @@ pub trait EnshrineEsdtSafe: + to_sovereign::events::EventsModule + bls_signature::BlsSignatureModule + from_sovereign::events::EventsModule - + from_sovereign::token_mapping::TokenMappingModule + from_sovereign::transfer_tokens::TransferTokensModule + tx_batch_module::TxBatchModule + max_bridged_amount_module::MaxBridgedAmountModule @@ -41,7 +40,7 @@ pub trait EnshrineEsdtSafe: } #[only_owner] - #[endpoint(setMultisigAddress)] + #[endpoint(setHeaderVerifierAddress)] fn set_header_verifier_address(&self, header_verifier_address: ManagedAddress) { self.require_sc_address(&header_verifier_address); @@ -50,4 +49,7 @@ pub trait EnshrineEsdtSafe: #[upgrade] fn upgrade(&self) {} + + #[storage_mapper("isSovereignChain")] + fn is_sovereign_chain(&self) -> SingleValueMapper; } diff --git a/enshrine-esdt-safe/src/to_sovereign/create_tx.rs b/enshrine-esdt-safe/src/to_sovereign/create_tx.rs index f18d5d17..e16d07f7 100644 --- a/enshrine-esdt-safe/src/to_sovereign/create_tx.rs +++ b/enshrine-esdt-safe/src/to_sovereign/create_tx.rs @@ -1,4 +1,3 @@ -use crate::from_sovereign::token_mapping; use fee_market::fee_market_proxy; use multiversx_sc::{hex_literal::hex, storage::StorageKey}; use transaction::{GasLimit, OperationData, TransferData}; @@ -19,7 +18,6 @@ pub trait CreateTxModule: + setup_phase::SetupPhaseModule + utils::UtilsModule + multiversx_sc_modules::pause::PauseModule - + token_mapping::TokenMappingModule + multiversx_sc_modules::default_issue_callbacks::DefaultIssueCallbacksModule { #[payable("*")] @@ -159,32 +157,6 @@ pub trait CreateTxModule: } } - fn remove_sovereign_token( - &self, - payment: EsdtTokenPayment, - sov_token_id: &TokenIdentifier, - ) -> u64 { - self.send().esdt_local_burn( - &payment.token_identifier, - payment.token_nonce, - &payment.amount, - ); - - let mut sov_token_nonce = 0; - - if payment.token_nonce > 0 { - sov_token_nonce = self - .multiversx_esdt_token_info_mapper(&payment.token_identifier, &payment.token_nonce) - .take() - .token_nonce; - - self.sovereign_esdt_token_info_mapper(sov_token_id, &sov_token_nonce) - .take(); - } - - sov_token_nonce - } - fn match_fee_payment( &self, total_tokens_for_fees: usize, From ea0c95b9bdd6026d0b96213f1f4c217921c73b14 Mon Sep 17 00:00:00 2001 From: Mihai Calin Luca Date: Tue, 25 Jun 2024 11:02:44 +0200 Subject: [PATCH 034/523] common storage module, cleanup and fmt --- common/utils/src/lib.rs | 6 ++++-- enshrine-esdt-safe/src/common/mod.rs | 1 + enshrine-esdt-safe/src/common/storage.rs | 7 +++++++ .../src/from_sovereign/transfer_tokens.rs | 6 +++--- enshrine-esdt-safe/src/lib.rs | 15 +++++---------- enshrine-esdt-safe/src/to_sovereign/create_tx.rs | 4 +++- .../tests/enshrine_esdt_safe_scenario_rs_test.rs | 5 ++++- esdt-safe/src/from_sovereign/transfer_tokens.rs | 4 +--- esdt-safe/src/lib.rs | 8 ++------ esdt-safe/src/to_sovereign/mod.rs | 2 +- fee-market/src/lib.rs | 2 +- fee-market/src/safe_price_query.rs | 3 +-- .../tests/header_verifier_blackbox_test.rs | 2 +- pair-mock/tests/pair_mock_scenario_rs_test.rs | 5 ++++- router-mock/tests/router_mock_scenario_rs_test.rs | 5 ++++- 15 files changed, 42 insertions(+), 33 deletions(-) create mode 100644 enshrine-esdt-safe/src/common/mod.rs create mode 100644 enshrine-esdt-safe/src/common/storage.rs diff --git a/common/utils/src/lib.rs b/common/utils/src/lib.rs index 810c1be9..3886fe55 100644 --- a/common/utils/src/lib.rs +++ b/common/utils/src/lib.rs @@ -69,12 +69,14 @@ pub trait UtilsModule: bls_signature::BlsSignatureModule { fn has_sov_token_prefix(&self, token_id: &TokenIdentifier) -> bool { let dash = b'-'; let mut array_buffer = [0u8, 30]; - let slice = token_id.as_managed_buffer().load_to_byte_array(&mut array_buffer); + let slice = token_id + .as_managed_buffer() + .load_to_byte_array(&mut array_buffer); let counter = slice.iter().filter(|&&c| c == dash).count(); if counter == 2 { - return true + return true; } false diff --git a/enshrine-esdt-safe/src/common/mod.rs b/enshrine-esdt-safe/src/common/mod.rs new file mode 100644 index 00000000..30f61eb6 --- /dev/null +++ b/enshrine-esdt-safe/src/common/mod.rs @@ -0,0 +1 @@ +pub mod storage; diff --git a/enshrine-esdt-safe/src/common/storage.rs b/enshrine-esdt-safe/src/common/storage.rs new file mode 100644 index 00000000..c17ff108 --- /dev/null +++ b/enshrine-esdt-safe/src/common/storage.rs @@ -0,0 +1,7 @@ +use multiversx_sc::imports::*; + +#[multiversx_sc::module] +pub trait CommonStorage { + #[storage_mapper("isSovereignChain")] + fn is_sovereign_chain(&self) -> SingleValueMapper; +} diff --git a/enshrine-esdt-safe/src/from_sovereign/transfer_tokens.rs b/enshrine-esdt-safe/src/from_sovereign/transfer_tokens.rs index aae65d55..3bdd37ec 100644 --- a/enshrine-esdt-safe/src/from_sovereign/transfer_tokens.rs +++ b/enshrine-esdt-safe/src/from_sovereign/transfer_tokens.rs @@ -1,11 +1,10 @@ -use crate::to_sovereign; +use crate::{common, to_sovereign}; use builtin_func_names::ESDT_NFT_CREATE_FUNC_NAME; use header_verifier::header_verifier_proxy; +use multiversx_sc::imports::*; use multiversx_sc::{api::ESDT_MULTI_TRANSFER_FUNC_NAME, codec, storage::StorageKey}; use transaction::{GasLimit, Operation, OperationData, OperationEsdtPayment, OperationTuple}; -multiversx_sc::imports!(); - const CALLBACK_GAS: GasLimit = 10_000_000; // Increase if not enough const TRANSACTION_GAS: GasLimit = 30_000_000; @@ -19,6 +18,7 @@ pub trait TransferTokensModule: + multiversx_sc_modules::default_issue_callbacks::DefaultIssueCallbacksModule + utils::UtilsModule + to_sovereign::events::EventsModule + + common::storage::CommonStorage { #[endpoint(executeBridgeOps)] fn execute_operations(&self, hash_of_hashes: ManagedBuffer, operation: Operation) { diff --git a/enshrine-esdt-safe/src/lib.rs b/enshrine-esdt-safe/src/lib.rs index 92cf8657..260e0159 100644 --- a/enshrine-esdt-safe/src/lib.rs +++ b/enshrine-esdt-safe/src/lib.rs @@ -1,11 +1,11 @@ #![no_std] -multiversx_sc::imports!(); -multiversx_sc::derive_imports!(); +use multiversx_sc::imports::*; +pub mod common; +pub mod enshrine_esdt_safe_proxy; pub mod from_sovereign; pub mod to_sovereign; -pub mod enshrine_esdt_safe_proxy; #[multiversx_sc::contract] pub trait EnshrineEsdtSafe: @@ -21,12 +21,10 @@ pub trait EnshrineEsdtSafe: + utils::UtilsModule + multiversx_sc_modules::pause::PauseModule + multiversx_sc_modules::default_issue_callbacks::DefaultIssueCallbacksModule + + common::storage::CommonStorage { #[init] - fn init( - &self, - is_sovereign_chain: bool, - ) { + fn init(&self, is_sovereign_chain: bool) { self.is_sovereign_chain().set(is_sovereign_chain); self.set_paused(true); } @@ -49,7 +47,4 @@ pub trait EnshrineEsdtSafe: #[upgrade] fn upgrade(&self) {} - - #[storage_mapper("isSovereignChain")] - fn is_sovereign_chain(&self) -> SingleValueMapper; } diff --git a/enshrine-esdt-safe/src/to_sovereign/create_tx.rs b/enshrine-esdt-safe/src/to_sovereign/create_tx.rs index e16d07f7..aafd5cef 100644 --- a/enshrine-esdt-safe/src/to_sovereign/create_tx.rs +++ b/enshrine-esdt-safe/src/to_sovereign/create_tx.rs @@ -1,8 +1,9 @@ +use crate::common; use fee_market::fee_market_proxy; use multiversx_sc::{hex_literal::hex, storage::StorageKey}; use transaction::{GasLimit, OperationData, TransferData}; -multiversx_sc::imports!(); +use multiversx_sc::imports::*; pub const ESDT_SYSTEM_SC_ADDRESS: [u8; 32] = hex!("000000000000000000010000000000000000000000000000000000000002ffff"); @@ -19,6 +20,7 @@ pub trait CreateTxModule: + utils::UtilsModule + multiversx_sc_modules::pause::PauseModule + multiversx_sc_modules::default_issue_callbacks::DefaultIssueCallbacksModule + + common::storage::CommonStorage { #[payable("*")] #[endpoint] diff --git a/enshrine-esdt-safe/tests/enshrine_esdt_safe_scenario_rs_test.rs b/enshrine-esdt-safe/tests/enshrine_esdt_safe_scenario_rs_test.rs index 6837feb6..94ecba89 100644 --- a/enshrine-esdt-safe/tests/enshrine_esdt_safe_scenario_rs_test.rs +++ b/enshrine-esdt-safe/tests/enshrine_esdt_safe_scenario_rs_test.rs @@ -3,7 +3,10 @@ use multiversx_sc_scenario::*; fn world() -> ScenarioWorld { let mut blockchain = ScenarioWorld::new(); - blockchain.register_contract("mxsc:output/enshrine-esdt-safe.mxsc.json", enshrine_esdt_safe::ContractBuilder); + blockchain.register_contract( + "mxsc:output/enshrine-esdt-safe.mxsc.json", + enshrine_esdt_safe::ContractBuilder, + ); blockchain } diff --git a/esdt-safe/src/from_sovereign/transfer_tokens.rs b/esdt-safe/src/from_sovereign/transfer_tokens.rs index afb88298..6b44bc31 100644 --- a/esdt-safe/src/from_sovereign/transfer_tokens.rs +++ b/esdt-safe/src/from_sovereign/transfer_tokens.rs @@ -1,9 +1,7 @@ use builtin_func_names::ESDT_MULTI_TRANSFER_FUNC_NAME; use header_verifier::header_verifier_proxy; use multiversx_sc::storage::StorageKey; -use transaction::{ - GasLimit, Operation, OperationData, OperationEsdtPayment, OperationTuple, -}; +use transaction::{GasLimit, Operation, OperationData, OperationEsdtPayment, OperationTuple}; use crate::to_sovereign; diff --git a/esdt-safe/src/lib.rs b/esdt-safe/src/lib.rs index f0ba9606..0bdb3f83 100644 --- a/esdt-safe/src/lib.rs +++ b/esdt-safe/src/lib.rs @@ -3,9 +3,9 @@ multiversx_sc::imports!(); multiversx_sc::derive_imports!(); +pub mod esdt_safe_proxy; pub mod from_sovereign; pub mod to_sovereign; -pub mod esdt_safe_proxy; #[multiversx_sc::contract] pub trait EsdtSafe: @@ -24,10 +24,7 @@ pub trait EsdtSafe: + multiversx_sc_modules::default_issue_callbacks::DefaultIssueCallbacksModule { #[init] - fn init( - &self, - is_sovereign_chain: bool, - ) { + fn init(&self, is_sovereign_chain: bool) { self.is_sovereign_chain().set(is_sovereign_chain); self.set_paused(true); } @@ -50,5 +47,4 @@ pub trait EsdtSafe: #[upgrade] fn upgrade(&self) {} - } diff --git a/esdt-safe/src/to_sovereign/mod.rs b/esdt-safe/src/to_sovereign/mod.rs index 1d6be669..5c2924da 100644 --- a/esdt-safe/src/to_sovereign/mod.rs +++ b/esdt-safe/src/to_sovereign/mod.rs @@ -1,2 +1,2 @@ pub mod create_tx; -pub mod events; \ No newline at end of file +pub mod events; diff --git a/fee-market/src/lib.rs b/fee-market/src/lib.rs index fe82004b..aac4d36d 100644 --- a/fee-market/src/lib.rs +++ b/fee-market/src/lib.rs @@ -4,11 +4,11 @@ multiversx_sc::imports!(); pub mod enable_fee; pub mod fee_common; +pub mod fee_market_proxy; pub mod fee_type; pub mod price_aggregator; pub mod safe_price_query; pub mod subtract_fee; -pub mod fee_market_proxy; #[multiversx_sc::contract] pub trait FeeMarket: diff --git a/fee-market/src/safe_price_query.rs b/fee-market/src/safe_price_query.rs index 7949c532..755c5a2a 100644 --- a/fee-market/src/safe_price_query.rs +++ b/fee-market/src/safe_price_query.rs @@ -58,8 +58,7 @@ pub trait SafePriceQueryModule: price_aggregator::PriceAggregatorModule { let token_to_wegld_pair = self.call_get_pair(token_id, &wegld_token_id); if !token_to_wegld_pair.is_zero() { - let wegld_to_usdc_pair = - self.call_get_pair(&wegld_token_id, &usdc_token_id); + let wegld_to_usdc_pair = self.call_get_pair(&wegld_token_id, &usdc_token_id); require!( !wegld_to_usdc_pair.is_zero(), "Invalid WEGLD-USDC pair address from router" diff --git a/header-verifier/tests/header_verifier_blackbox_test.rs b/header-verifier/tests/header_verifier_blackbox_test.rs index 18b1dce8..7b255b5c 100644 --- a/header-verifier/tests/header_verifier_blackbox_test.rs +++ b/header-verifier/tests/header_verifier_blackbox_test.rs @@ -60,7 +60,7 @@ impl HeaderVerifierTestState { self.world.sc_deploy( ScDeployStep::new() .from(OWNER_ADDRESS_EXPR) - .code(header_verifier_code), + .code(header_verifier_code), ); self diff --git a/pair-mock/tests/pair_mock_scenario_rs_test.rs b/pair-mock/tests/pair_mock_scenario_rs_test.rs index 92af7b8e..996f6215 100644 --- a/pair-mock/tests/pair_mock_scenario_rs_test.rs +++ b/pair-mock/tests/pair_mock_scenario_rs_test.rs @@ -4,7 +4,10 @@ fn world() -> ScenarioWorld { let mut blockchain = ScenarioWorld::new(); // blockchain.set_current_dir_from_workspace("relative path to your workspace, if applicable"); - blockchain.register_contract("mxsc:output/pair-mock.mxsc.json", pair_mock::ContractBuilder); + blockchain.register_contract( + "mxsc:output/pair-mock.mxsc.json", + pair_mock::ContractBuilder, + ); blockchain } diff --git a/router-mock/tests/router_mock_scenario_rs_test.rs b/router-mock/tests/router_mock_scenario_rs_test.rs index f765bd83..a3a9aa15 100644 --- a/router-mock/tests/router_mock_scenario_rs_test.rs +++ b/router-mock/tests/router_mock_scenario_rs_test.rs @@ -4,7 +4,10 @@ fn world() -> ScenarioWorld { let mut blockchain = ScenarioWorld::new(); // blockchain.set_current_dir_from_workspace("relative path to your workspace, if applicable"); - blockchain.register_contract("mxsc:output/router-mock.mxsc.json", router_mock::ContractBuilder); + blockchain.register_contract( + "mxsc:output/router-mock.mxsc.json", + router_mock::ContractBuilder, + ); blockchain } From 8c441706b1ea6f15d50371e661297e0fff6bfd4f Mon Sep 17 00:00:00 2001 From: Andrei Baltariu Date: Tue, 25 Jun 2024 12:11:48 +0300 Subject: [PATCH 035/523] Regenerated proxy --- .../src/enshrine_esdt_safe_proxy.rs | 28 +------------------ .../wasm-enshrine-esdt-safe-full/src/lib.rs | 8 ++---- enshrine-esdt-safe/wasm/src/lib.rs | 8 ++---- 3 files changed, 7 insertions(+), 37 deletions(-) diff --git a/enshrine-esdt-safe/src/enshrine_esdt_safe_proxy.rs b/enshrine-esdt-safe/src/enshrine_esdt_safe_proxy.rs index b5c54f2c..bab658db 100644 --- a/enshrine-esdt-safe/src/enshrine_esdt_safe_proxy.rs +++ b/enshrine-esdt-safe/src/enshrine_esdt_safe_proxy.rs @@ -106,7 +106,7 @@ where ) -> TxTypedCall { self.wrapped_tx .payment(NotPayable) - .raw_call("setMultisigAddress") + .raw_call("setHeaderVerifierAddress") .argument(&header_verifier_address) .original_result() } @@ -165,32 +165,6 @@ where .original_result() } - pub fn clear_registered_sovereign_token< - Arg0: ProxyArg>, - >( - self, - sov_token_id: Arg0, - ) -> TxTypedCall { - self.wrapped_tx - .payment(NotPayable) - .raw_call("clearRegisteredSovereignToken") - .argument(&sov_token_id) - .original_result() - } - - pub fn clear_registered_multiversx_token< - Arg0: ProxyArg>, - >( - self, - mvx_token_id: Arg0, - ) -> TxTypedCall { - self.wrapped_tx - .payment(NotPayable) - .raw_call("clearRegisteredMultiversxToken") - .argument(&mvx_token_id) - .original_result() - } - pub fn execute_operations< Arg0: ProxyArg>, Arg1: ProxyArg>, diff --git a/enshrine-esdt-safe/wasm-enshrine-esdt-safe-full/src/lib.rs b/enshrine-esdt-safe/wasm-enshrine-esdt-safe-full/src/lib.rs index 86b3ee87..2c4ffaed 100644 --- a/enshrine-esdt-safe/wasm-enshrine-esdt-safe-full/src/lib.rs +++ b/enshrine-esdt-safe/wasm-enshrine-esdt-safe-full/src/lib.rs @@ -6,10 +6,10 @@ // Init: 1 // Upgrade: 1 -// Endpoints: 29 +// Endpoints: 27 // Async Callback: 1 // Promise callbacks: 1 -// Total number of exported functions: 33 +// Total number of exported functions: 31 #![no_std] @@ -22,13 +22,11 @@ multiversx_sc_wasm_adapter::endpoints! { init => init upgrade => upgrade setFeeMarketAddress => set_fee_market_address - setMultisigAddress => set_header_verifier_address + setHeaderVerifierAddress => set_header_verifier_address deposit => deposit setMinValidSigners => set_min_valid_signers addSigners => add_signers removeSigners => remove_signers - clearRegisteredSovereignToken => clear_registered_sovereign_token - clearRegisteredMultiversxToken => clear_registered_multiversx_token executeBridgeOps => execute_operations setMaxTxBatchSize => set_max_tx_batch_size setMaxTxBatchBlockDuration => set_max_tx_batch_block_duration diff --git a/enshrine-esdt-safe/wasm/src/lib.rs b/enshrine-esdt-safe/wasm/src/lib.rs index 86b3ee87..2c4ffaed 100644 --- a/enshrine-esdt-safe/wasm/src/lib.rs +++ b/enshrine-esdt-safe/wasm/src/lib.rs @@ -6,10 +6,10 @@ // Init: 1 // Upgrade: 1 -// Endpoints: 29 +// Endpoints: 27 // Async Callback: 1 // Promise callbacks: 1 -// Total number of exported functions: 33 +// Total number of exported functions: 31 #![no_std] @@ -22,13 +22,11 @@ multiversx_sc_wasm_adapter::endpoints! { init => init upgrade => upgrade setFeeMarketAddress => set_fee_market_address - setMultisigAddress => set_header_verifier_address + setHeaderVerifierAddress => set_header_verifier_address deposit => deposit setMinValidSigners => set_min_valid_signers addSigners => add_signers removeSigners => remove_signers - clearRegisteredSovereignToken => clear_registered_sovereign_token - clearRegisteredMultiversxToken => clear_registered_multiversx_token executeBridgeOps => execute_operations setMaxTxBatchSize => set_max_tx_batch_size setMaxTxBatchBlockDuration => set_max_tx_batch_block_duration From e591d5acda64edab89fc41650b041fc56bbf034c Mon Sep 17 00:00:00 2001 From: Andrei Baltariu Date: Tue, 25 Jun 2024 14:06:06 +0300 Subject: [PATCH 036/523] Framework upgrade --- Cargo.lock | 20 +++++++++---------- chain-config/Cargo.toml | 6 +++--- chain-config/meta/Cargo.toml | 2 +- chain-config/wasm/Cargo.lock | 16 +++++++-------- chain-config/wasm/Cargo.toml | 2 +- chain-factory/Cargo.toml | 4 ++-- chain-factory/meta/Cargo.toml | 2 +- chain-factory/wasm/Cargo.lock | 16 +++++++-------- chain-factory/wasm/Cargo.toml | 2 +- common/bls-signature/Cargo.toml | 4 ++-- common/max-bridged-amount-module/Cargo.toml | 4 ++-- common/setup-phase/Cargo.toml | 4 ++-- common/token-whitelist/Cargo.toml | 4 ++-- common/transaction/Cargo.toml | 2 +- common/tx-batch-module/Cargo.toml | 4 ++-- common/utils/Cargo.toml | 2 +- enshrine-esdt-safe/Cargo.toml | 6 +++--- enshrine-esdt-safe/meta/Cargo.toml | 2 +- .../wasm-enshrine-esdt-safe-full/Cargo.lock | 16 +++++++-------- .../wasm-enshrine-esdt-safe-full/Cargo.toml | 2 +- .../wasm-enshrine-esdt-safe-view/Cargo.lock | 16 +++++++-------- .../wasm-enshrine-esdt-safe-view/Cargo.toml | 2 +- enshrine-esdt-safe/wasm/Cargo.lock | 16 +++++++-------- enshrine-esdt-safe/wasm/Cargo.toml | 2 +- esdt-safe/Cargo.toml | 6 +++--- esdt-safe/meta/Cargo.toml | 2 +- esdt-safe/wasm-esdt-safe-full/Cargo.lock | 16 +++++++-------- esdt-safe/wasm-esdt-safe-full/Cargo.toml | 2 +- esdt-safe/wasm-esdt-safe-view/Cargo.lock | 16 +++++++-------- esdt-safe/wasm-esdt-safe-view/Cargo.toml | 2 +- esdt-safe/wasm/Cargo.lock | 16 +++++++-------- esdt-safe/wasm/Cargo.toml | 2 +- fee-market/Cargo.toml | 4 ++-- fee-market/meta/Cargo.toml | 2 +- fee-market/wasm-fee-marker-full/Cargo.lock | 12 +++++------ fee-market/wasm-fee-marker-full/Cargo.toml | 2 +- fee-market/wasm-multisig-view/Cargo.lock | 12 +++++------ fee-market/wasm-multisig-view/Cargo.toml | 2 +- fee-market/wasm/Cargo.lock | 12 +++++------ fee-market/wasm/Cargo.toml | 2 +- header-verifier/Cargo.toml | 4 ++-- header-verifier/meta/Cargo.toml | 2 +- .../wasm-header-verifier-full/Cargo.lock | 12 +++++------ .../wasm-header-verifier-full/Cargo.toml | 2 +- header-verifier/wasm-multisig-view/Cargo.lock | 12 +++++------ header-verifier/wasm-multisig-view/Cargo.toml | 2 +- header-verifier/wasm/Cargo.lock | 12 +++++------ header-verifier/wasm/Cargo.toml | 2 +- pair-mock/Cargo.toml | 4 ++-- pair-mock/meta/Cargo.toml | 2 +- pair-mock/wasm/Cargo.lock | 12 +++++------ pair-mock/wasm/Cargo.toml | 2 +- router-mock/Cargo.toml | 4 ++-- router-mock/meta/Cargo.toml | 2 +- router-mock/wasm/Cargo.lock | 12 +++++------ router-mock/wasm/Cargo.toml | 2 +- 56 files changed, 177 insertions(+), 177 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 1abca13e..d80204bd 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1154,9 +1154,9 @@ checksum = "b59072fa0624b55ae5ae3fa6bfa91515bbeb4ac440214bc4a509e2c8806d6e9f" [[package]] name = "multiversx-sc" -version = "0.50.4" +version = "0.50.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "748a370a86e9a3c51e0609c4a6c0c9a5cceaeb742656ee3284c0620504a3d7a5" +checksum = "a38a802d6cfa67748145a9e729336f4e6390eba702b5f14360ed01fcff14faa4" dependencies = [ "bitflags 2.5.0", "hex-literal", @@ -1192,9 +1192,9 @@ dependencies = [ [[package]] name = "multiversx-sc-derive" -version = "0.50.4" +version = "0.50.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b6ca88f27a90b0a1b17d5b645cc859e0480f4321c551525873a59a954bfbcb53" +checksum = "7dc53ddcbd71948d2e8d3d6b814da866e2920b24e6c0cbfa643922f781897476" dependencies = [ "hex", "proc-macro2", @@ -1205,9 +1205,9 @@ dependencies = [ [[package]] name = "multiversx-sc-meta" -version = "0.50.4" +version = "0.50.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "93aba82492783759620d72f21059749177e66438d0c021597c567eae8e888307" +checksum = "ca792ba887b76270d5d6c975e349f2e7e037af2db25a78fe855ceb70eed473dd" dependencies = [ "clap", "colored", @@ -1232,18 +1232,18 @@ dependencies = [ [[package]] name = "multiversx-sc-modules" -version = "0.50.4" +version = "0.50.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e97c7153d996ef412f5fc687a6799fc9173cb221adef283c217d160eebebe7d4" +checksum = "ea1ae09db9cac18669b85d50932410df6082e1a575975ba5224e3b7ae33cbe7d" dependencies = [ "multiversx-sc", ] [[package]] name = "multiversx-sc-scenario" -version = "0.50.4" +version = "0.50.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d2992739c2ef6bc8e448434b9c3ab848f2ce17264192a9918734cbb3884d0435" +checksum = "9916e196bbe87d5d46e4c9fd8ea00283660a97be44e6628c2cfbc9df5f8befcb" dependencies = [ "base64", "bech32", diff --git a/chain-config/Cargo.toml b/chain-config/Cargo.toml index 5ba6e04c..44a855a6 100644 --- a/chain-config/Cargo.toml +++ b/chain-config/Cargo.toml @@ -12,10 +12,10 @@ path = "src/lib.rs" num-bigint = "0.4.2" [dev-dependencies.multiversx-sc-scenario] -version = "=0.50.4" +version = "=0.50.5" [dependencies.multiversx-sc] -version = "=0.50.4" +version = "=0.50.5" [dependencies.multiversx-sc-modules] -version = "=0.50.4" +version = "=0.50.5" diff --git a/chain-config/meta/Cargo.toml b/chain-config/meta/Cargo.toml index 84bf9e95..0d750959 100644 --- a/chain-config/meta/Cargo.toml +++ b/chain-config/meta/Cargo.toml @@ -11,4 +11,4 @@ authors = ["you"] path = ".." [dependencies.multiversx-sc-meta] -version = "=0.50.4" +version = "=0.50.5" diff --git a/chain-config/wasm/Cargo.lock b/chain-config/wasm/Cargo.lock index e0adcfe0..ae868650 100644 --- a/chain-config/wasm/Cargo.lock +++ b/chain-config/wasm/Cargo.lock @@ -56,9 +56,9 @@ checksum = "6fe2267d4ed49bc07b63801559be28c718ea06c4738b7a03c94df7386d2cde46" [[package]] name = "multiversx-sc" -version = "0.50.4" +version = "0.50.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "748a370a86e9a3c51e0609c4a6c0c9a5cceaeb742656ee3284c0620504a3d7a5" +checksum = "a38a802d6cfa67748145a9e729336f4e6390eba702b5f14360ed01fcff14faa4" dependencies = [ "bitflags", "hex-literal", @@ -93,9 +93,9 @@ dependencies = [ [[package]] name = "multiversx-sc-derive" -version = "0.50.4" +version = "0.50.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b6ca88f27a90b0a1b17d5b645cc859e0480f4321c551525873a59a954bfbcb53" +checksum = "7dc53ddcbd71948d2e8d3d6b814da866e2920b24e6c0cbfa643922f781897476" dependencies = [ "hex", "proc-macro2", @@ -106,18 +106,18 @@ dependencies = [ [[package]] name = "multiversx-sc-modules" -version = "0.50.4" +version = "0.50.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e97c7153d996ef412f5fc687a6799fc9173cb221adef283c217d160eebebe7d4" +checksum = "ea1ae09db9cac18669b85d50932410df6082e1a575975ba5224e3b7ae33cbe7d" dependencies = [ "multiversx-sc", ] [[package]] name = "multiversx-sc-wasm-adapter" -version = "0.50.4" +version = "0.50.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "37f083d6844a0919a39d87c2552b8e9ea30e365775265d31b419d24f6aa93eee" +checksum = "99a090365b4483b4ea955ba1322f986f6821be88144291f0013c03f59b4de753" dependencies = [ "multiversx-sc", ] diff --git a/chain-config/wasm/Cargo.toml b/chain-config/wasm/Cargo.toml index b1f49c55..9861bcbc 100644 --- a/chain-config/wasm/Cargo.toml +++ b/chain-config/wasm/Cargo.toml @@ -28,7 +28,7 @@ panic = "abort" path = ".." [dependencies.multiversx-sc-wasm-adapter] -version = "=0.50.4" +version = "=0.50.5" [workspace] members = ["."] diff --git a/chain-factory/Cargo.toml b/chain-factory/Cargo.toml index da32373a..1e1ba374 100644 --- a/chain-factory/Cargo.toml +++ b/chain-factory/Cargo.toml @@ -12,10 +12,10 @@ path = "src/lib.rs" num-bigint = "0.4.2" [dev-dependencies.multiversx-sc-scenario] -version = "=0.50.4" +version = "=0.50.5" [dependencies.multiversx-sc] -version = "=0.50.4" +version = "=0.50.5" [dependencies.utils] path = "../common/utils" diff --git a/chain-factory/meta/Cargo.toml b/chain-factory/meta/Cargo.toml index 4b565b44..9fe9efe0 100644 --- a/chain-factory/meta/Cargo.toml +++ b/chain-factory/meta/Cargo.toml @@ -11,4 +11,4 @@ authors = ["you"] path = ".." [dependencies.multiversx-sc-meta] -version = "=0.50.4" +version = "=0.50.5" diff --git a/chain-factory/wasm/Cargo.lock b/chain-factory/wasm/Cargo.lock index b2835ca4..5f1ea236 100644 --- a/chain-factory/wasm/Cargo.lock +++ b/chain-factory/wasm/Cargo.lock @@ -74,9 +74,9 @@ checksum = "6fe2267d4ed49bc07b63801559be28c718ea06c4738b7a03c94df7386d2cde46" [[package]] name = "multiversx-sc" -version = "0.50.4" +version = "0.50.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "748a370a86e9a3c51e0609c4a6c0c9a5cceaeb742656ee3284c0620504a3d7a5" +checksum = "a38a802d6cfa67748145a9e729336f4e6390eba702b5f14360ed01fcff14faa4" dependencies = [ "bitflags", "hex-literal", @@ -111,9 +111,9 @@ dependencies = [ [[package]] name = "multiversx-sc-derive" -version = "0.50.4" +version = "0.50.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b6ca88f27a90b0a1b17d5b645cc859e0480f4321c551525873a59a954bfbcb53" +checksum = "7dc53ddcbd71948d2e8d3d6b814da866e2920b24e6c0cbfa643922f781897476" dependencies = [ "hex", "proc-macro2", @@ -124,18 +124,18 @@ dependencies = [ [[package]] name = "multiversx-sc-modules" -version = "0.50.4" +version = "0.50.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e97c7153d996ef412f5fc687a6799fc9173cb221adef283c217d160eebebe7d4" +checksum = "ea1ae09db9cac18669b85d50932410df6082e1a575975ba5224e3b7ae33cbe7d" dependencies = [ "multiversx-sc", ] [[package]] name = "multiversx-sc-wasm-adapter" -version = "0.50.4" +version = "0.50.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "37f083d6844a0919a39d87c2552b8e9ea30e365775265d31b419d24f6aa93eee" +checksum = "99a090365b4483b4ea955ba1322f986f6821be88144291f0013c03f59b4de753" dependencies = [ "multiversx-sc", ] diff --git a/chain-factory/wasm/Cargo.toml b/chain-factory/wasm/Cargo.toml index 1e522fff..95470464 100644 --- a/chain-factory/wasm/Cargo.toml +++ b/chain-factory/wasm/Cargo.toml @@ -28,7 +28,7 @@ panic = "abort" path = ".." [dependencies.multiversx-sc-wasm-adapter] -version = "=0.50.4" +version = "=0.50.5" [workspace] members = ["."] diff --git a/common/bls-signature/Cargo.toml b/common/bls-signature/Cargo.toml index 6253ae33..4020caf9 100644 --- a/common/bls-signature/Cargo.toml +++ b/common/bls-signature/Cargo.toml @@ -5,10 +5,10 @@ authors = ["dorin-iancu "] edition = "2018" [dependencies.multiversx-sc] -version = "=0.50.4" +version = "=0.50.5" [dependencies.transaction] path = "../transaction" [dev-dependencies.multiversx-sc-scenario] -version = "=0.50.4" +version = "=0.50.5" diff --git a/common/max-bridged-amount-module/Cargo.toml b/common/max-bridged-amount-module/Cargo.toml index ad6c6099..5838ae92 100644 --- a/common/max-bridged-amount-module/Cargo.toml +++ b/common/max-bridged-amount-module/Cargo.toml @@ -5,7 +5,7 @@ authors = ["dorin-iancu "] edition = "2018" [dependencies.multiversx-sc] -version = "=0.50.4" +version = "=0.50.5" [dev-dependencies.multiversx-sc-scenario] -version = "=0.50.4" +version = "=0.50.5" diff --git a/common/setup-phase/Cargo.toml b/common/setup-phase/Cargo.toml index 18094ab2..5e4372b5 100644 --- a/common/setup-phase/Cargo.toml +++ b/common/setup-phase/Cargo.toml @@ -5,7 +5,7 @@ authors = ["dorin-iancu "] edition = "2018" [dependencies.multiversx-sc] -version = "=0.50.4" +version = "=0.50.5" [dev-dependencies.multiversx-sc-scenario] -version = "=0.50.4" +version = "=0.50.5" diff --git a/common/token-whitelist/Cargo.toml b/common/token-whitelist/Cargo.toml index 6e1865f1..c194683d 100644 --- a/common/token-whitelist/Cargo.toml +++ b/common/token-whitelist/Cargo.toml @@ -14,7 +14,7 @@ path = "../setup-phase" path = "../utils" [dependencies.multiversx-sc] -version = "=0.50.4" +version = "=0.50.5" [dev-dependencies.multiversx-sc-scenario] -version = "=0.50.4" +version = "=0.50.5" diff --git a/common/transaction/Cargo.toml b/common/transaction/Cargo.toml index 72d127ab..8f7f51a1 100644 --- a/common/transaction/Cargo.toml +++ b/common/transaction/Cargo.toml @@ -8,4 +8,4 @@ edition = "2018" path = "src/lib.rs" [dependencies.multiversx-sc] -version = "=0.50.4" +version = "=0.50.5" diff --git a/common/tx-batch-module/Cargo.toml b/common/tx-batch-module/Cargo.toml index 12ec58d1..7882455a 100644 --- a/common/tx-batch-module/Cargo.toml +++ b/common/tx-batch-module/Cargo.toml @@ -5,10 +5,10 @@ authors = ["dorin-iancu "] edition = "2018" [dependencies.multiversx-sc] -version = "=0.50.4" +version = "=0.50.5" [dependencies.transaction] path = "../transaction" [dev-dependencies.multiversx-sc-scenario] -version = "=0.50.4" +version = "=0.50.5" diff --git a/common/utils/Cargo.toml b/common/utils/Cargo.toml index cb81f3b7..b29b2ec2 100644 --- a/common/utils/Cargo.toml +++ b/common/utils/Cargo.toml @@ -11,5 +11,5 @@ path = "src/lib.rs" path = "../bls-signature" [dependencies.multiversx-sc] -version = "=0.50.4" +version = "=0.50.5" features = ["esdt-token-payment-legacy-decode"] diff --git a/enshrine-esdt-safe/Cargo.toml b/enshrine-esdt-safe/Cargo.toml index aa3f4b4c..6fed7409 100644 --- a/enshrine-esdt-safe/Cargo.toml +++ b/enshrine-esdt-safe/Cargo.toml @@ -36,10 +36,10 @@ path = "../fee-market" path = "../header-verifier" [dependencies.multiversx-sc] -version = "=0.50.4" +version = "=0.50.5" [dependencies.multiversx-sc-modules] -version = "=0.50.4" +version = "=0.50.5" [dev-dependencies] num-bigint = "0.4.2" @@ -47,4 +47,4 @@ num-traits = "0.2" hex = "0.4" [dev-dependencies.multiversx-sc-scenario] -version = "=0.50.4" +version = "=0.50.5" diff --git a/enshrine-esdt-safe/meta/Cargo.toml b/enshrine-esdt-safe/meta/Cargo.toml index cb30e0a4..e0aed0b1 100644 --- a/enshrine-esdt-safe/meta/Cargo.toml +++ b/enshrine-esdt-safe/meta/Cargo.toml @@ -8,5 +8,5 @@ publish = false path = ".." [dependencies.multiversx-sc-meta] -version = "0.50.4" +version = "0.50.5" default-features = false diff --git a/enshrine-esdt-safe/wasm-enshrine-esdt-safe-full/Cargo.lock b/enshrine-esdt-safe/wasm-enshrine-esdt-safe-full/Cargo.lock index a2694849..b439d2da 100644 --- a/enshrine-esdt-safe/wasm-enshrine-esdt-safe-full/Cargo.lock +++ b/enshrine-esdt-safe/wasm-enshrine-esdt-safe-full/Cargo.lock @@ -101,9 +101,9 @@ dependencies = [ [[package]] name = "multiversx-sc" -version = "0.50.4" +version = "0.50.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "748a370a86e9a3c51e0609c4a6c0c9a5cceaeb742656ee3284c0620504a3d7a5" +checksum = "a38a802d6cfa67748145a9e729336f4e6390eba702b5f14360ed01fcff14faa4" dependencies = [ "bitflags", "hex-literal", @@ -138,9 +138,9 @@ dependencies = [ [[package]] name = "multiversx-sc-derive" -version = "0.50.4" +version = "0.50.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b6ca88f27a90b0a1b17d5b645cc859e0480f4321c551525873a59a954bfbcb53" +checksum = "7dc53ddcbd71948d2e8d3d6b814da866e2920b24e6c0cbfa643922f781897476" dependencies = [ "hex", "proc-macro2", @@ -151,18 +151,18 @@ dependencies = [ [[package]] name = "multiversx-sc-modules" -version = "0.50.4" +version = "0.50.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e97c7153d996ef412f5fc687a6799fc9173cb221adef283c217d160eebebe7d4" +checksum = "ea1ae09db9cac18669b85d50932410df6082e1a575975ba5224e3b7ae33cbe7d" dependencies = [ "multiversx-sc", ] [[package]] name = "multiversx-sc-wasm-adapter" -version = "0.50.4" +version = "0.50.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "37f083d6844a0919a39d87c2552b8e9ea30e365775265d31b419d24f6aa93eee" +checksum = "99a090365b4483b4ea955ba1322f986f6821be88144291f0013c03f59b4de753" dependencies = [ "multiversx-sc", ] diff --git a/enshrine-esdt-safe/wasm-enshrine-esdt-safe-full/Cargo.toml b/enshrine-esdt-safe/wasm-enshrine-esdt-safe-full/Cargo.toml index 70a71f9d..71b08900 100644 --- a/enshrine-esdt-safe/wasm-enshrine-esdt-safe-full/Cargo.toml +++ b/enshrine-esdt-safe/wasm-enshrine-esdt-safe-full/Cargo.toml @@ -28,7 +28,7 @@ panic = "abort" path = ".." [dependencies.multiversx-sc-wasm-adapter] -version = "=0.50.4" +version = "=0.50.5" [workspace] members = ["."] diff --git a/enshrine-esdt-safe/wasm-enshrine-esdt-safe-view/Cargo.lock b/enshrine-esdt-safe/wasm-enshrine-esdt-safe-view/Cargo.lock index 45c68557..bd52fa02 100644 --- a/enshrine-esdt-safe/wasm-enshrine-esdt-safe-view/Cargo.lock +++ b/enshrine-esdt-safe/wasm-enshrine-esdt-safe-view/Cargo.lock @@ -101,9 +101,9 @@ dependencies = [ [[package]] name = "multiversx-sc" -version = "0.50.4" +version = "0.50.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "748a370a86e9a3c51e0609c4a6c0c9a5cceaeb742656ee3284c0620504a3d7a5" +checksum = "a38a802d6cfa67748145a9e729336f4e6390eba702b5f14360ed01fcff14faa4" dependencies = [ "bitflags", "hex-literal", @@ -138,9 +138,9 @@ dependencies = [ [[package]] name = "multiversx-sc-derive" -version = "0.50.4" +version = "0.50.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b6ca88f27a90b0a1b17d5b645cc859e0480f4321c551525873a59a954bfbcb53" +checksum = "7dc53ddcbd71948d2e8d3d6b814da866e2920b24e6c0cbfa643922f781897476" dependencies = [ "hex", "proc-macro2", @@ -151,18 +151,18 @@ dependencies = [ [[package]] name = "multiversx-sc-modules" -version = "0.50.4" +version = "0.50.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e97c7153d996ef412f5fc687a6799fc9173cb221adef283c217d160eebebe7d4" +checksum = "ea1ae09db9cac18669b85d50932410df6082e1a575975ba5224e3b7ae33cbe7d" dependencies = [ "multiversx-sc", ] [[package]] name = "multiversx-sc-wasm-adapter" -version = "0.50.4" +version = "0.50.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "37f083d6844a0919a39d87c2552b8e9ea30e365775265d31b419d24f6aa93eee" +checksum = "99a090365b4483b4ea955ba1322f986f6821be88144291f0013c03f59b4de753" dependencies = [ "multiversx-sc", ] diff --git a/enshrine-esdt-safe/wasm-enshrine-esdt-safe-view/Cargo.toml b/enshrine-esdt-safe/wasm-enshrine-esdt-safe-view/Cargo.toml index 455d7ed3..3119d3b5 100644 --- a/enshrine-esdt-safe/wasm-enshrine-esdt-safe-view/Cargo.toml +++ b/enshrine-esdt-safe/wasm-enshrine-esdt-safe-view/Cargo.toml @@ -28,7 +28,7 @@ panic = "abort" path = ".." [dependencies.multiversx-sc-wasm-adapter] -version = "=0.50.4" +version = "=0.50.5" [workspace] members = ["."] diff --git a/enshrine-esdt-safe/wasm/Cargo.lock b/enshrine-esdt-safe/wasm/Cargo.lock index b2f85c6d..98de4f91 100644 --- a/enshrine-esdt-safe/wasm/Cargo.lock +++ b/enshrine-esdt-safe/wasm/Cargo.lock @@ -101,9 +101,9 @@ dependencies = [ [[package]] name = "multiversx-sc" -version = "0.50.4" +version = "0.50.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "748a370a86e9a3c51e0609c4a6c0c9a5cceaeb742656ee3284c0620504a3d7a5" +checksum = "a38a802d6cfa67748145a9e729336f4e6390eba702b5f14360ed01fcff14faa4" dependencies = [ "bitflags", "hex-literal", @@ -138,9 +138,9 @@ dependencies = [ [[package]] name = "multiversx-sc-derive" -version = "0.50.4" +version = "0.50.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b6ca88f27a90b0a1b17d5b645cc859e0480f4321c551525873a59a954bfbcb53" +checksum = "7dc53ddcbd71948d2e8d3d6b814da866e2920b24e6c0cbfa643922f781897476" dependencies = [ "hex", "proc-macro2", @@ -151,18 +151,18 @@ dependencies = [ [[package]] name = "multiversx-sc-modules" -version = "0.50.4" +version = "0.50.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e97c7153d996ef412f5fc687a6799fc9173cb221adef283c217d160eebebe7d4" +checksum = "ea1ae09db9cac18669b85d50932410df6082e1a575975ba5224e3b7ae33cbe7d" dependencies = [ "multiversx-sc", ] [[package]] name = "multiversx-sc-wasm-adapter" -version = "0.50.4" +version = "0.50.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "37f083d6844a0919a39d87c2552b8e9ea30e365775265d31b419d24f6aa93eee" +checksum = "99a090365b4483b4ea955ba1322f986f6821be88144291f0013c03f59b4de753" dependencies = [ "multiversx-sc", ] diff --git a/enshrine-esdt-safe/wasm/Cargo.toml b/enshrine-esdt-safe/wasm/Cargo.toml index 0cf73cf7..c8376d24 100644 --- a/enshrine-esdt-safe/wasm/Cargo.toml +++ b/enshrine-esdt-safe/wasm/Cargo.toml @@ -28,7 +28,7 @@ panic = "abort" path = ".." [dependencies.multiversx-sc-wasm-adapter] -version = "=0.50.4" +version = "=0.50.5" [workspace] members = ["."] diff --git a/esdt-safe/Cargo.toml b/esdt-safe/Cargo.toml index c58a3b1d..808189ae 100644 --- a/esdt-safe/Cargo.toml +++ b/esdt-safe/Cargo.toml @@ -36,10 +36,10 @@ path = "../fee-market" path = "../header-verifier" [dependencies.multiversx-sc] -version = "=0.50.4" +version = "=0.50.5" [dependencies.multiversx-sc-modules] -version = "=0.50.4" +version = "=0.50.5" [dev-dependencies] num-bigint = "0.4.2" @@ -47,4 +47,4 @@ num-traits = "0.2" hex = "0.4" [dev-dependencies.multiversx-sc-scenario] -version = "=0.50.4" +version = "=0.50.5" diff --git a/esdt-safe/meta/Cargo.toml b/esdt-safe/meta/Cargo.toml index cd3882d2..0ac9378d 100644 --- a/esdt-safe/meta/Cargo.toml +++ b/esdt-safe/meta/Cargo.toml @@ -11,4 +11,4 @@ publish = false path = ".." [dependencies.multiversx-sc-meta] -version = "=0.50.4" +version = "=0.50.5" diff --git a/esdt-safe/wasm-esdt-safe-full/Cargo.lock b/esdt-safe/wasm-esdt-safe-full/Cargo.lock index 7cf03b53..0af191ab 100644 --- a/esdt-safe/wasm-esdt-safe-full/Cargo.lock +++ b/esdt-safe/wasm-esdt-safe-full/Cargo.lock @@ -101,9 +101,9 @@ dependencies = [ [[package]] name = "multiversx-sc" -version = "0.50.4" +version = "0.50.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "748a370a86e9a3c51e0609c4a6c0c9a5cceaeb742656ee3284c0620504a3d7a5" +checksum = "a38a802d6cfa67748145a9e729336f4e6390eba702b5f14360ed01fcff14faa4" dependencies = [ "bitflags", "hex-literal", @@ -138,9 +138,9 @@ dependencies = [ [[package]] name = "multiversx-sc-derive" -version = "0.50.4" +version = "0.50.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b6ca88f27a90b0a1b17d5b645cc859e0480f4321c551525873a59a954bfbcb53" +checksum = "7dc53ddcbd71948d2e8d3d6b814da866e2920b24e6c0cbfa643922f781897476" dependencies = [ "hex", "proc-macro2", @@ -151,18 +151,18 @@ dependencies = [ [[package]] name = "multiversx-sc-modules" -version = "0.50.4" +version = "0.50.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e97c7153d996ef412f5fc687a6799fc9173cb221adef283c217d160eebebe7d4" +checksum = "ea1ae09db9cac18669b85d50932410df6082e1a575975ba5224e3b7ae33cbe7d" dependencies = [ "multiversx-sc", ] [[package]] name = "multiversx-sc-wasm-adapter" -version = "0.50.4" +version = "0.50.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "37f083d6844a0919a39d87c2552b8e9ea30e365775265d31b419d24f6aa93eee" +checksum = "99a090365b4483b4ea955ba1322f986f6821be88144291f0013c03f59b4de753" dependencies = [ "multiversx-sc", ] diff --git a/esdt-safe/wasm-esdt-safe-full/Cargo.toml b/esdt-safe/wasm-esdt-safe-full/Cargo.toml index 5e83939e..fbf7134d 100644 --- a/esdt-safe/wasm-esdt-safe-full/Cargo.toml +++ b/esdt-safe/wasm-esdt-safe-full/Cargo.toml @@ -28,7 +28,7 @@ panic = "abort" path = ".." [dependencies.multiversx-sc-wasm-adapter] -version = "=0.50.4" +version = "=0.50.5" [workspace] members = ["."] diff --git a/esdt-safe/wasm-esdt-safe-view/Cargo.lock b/esdt-safe/wasm-esdt-safe-view/Cargo.lock index 92b55e6a..04a91694 100644 --- a/esdt-safe/wasm-esdt-safe-view/Cargo.lock +++ b/esdt-safe/wasm-esdt-safe-view/Cargo.lock @@ -101,9 +101,9 @@ dependencies = [ [[package]] name = "multiversx-sc" -version = "0.50.4" +version = "0.50.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "748a370a86e9a3c51e0609c4a6c0c9a5cceaeb742656ee3284c0620504a3d7a5" +checksum = "a38a802d6cfa67748145a9e729336f4e6390eba702b5f14360ed01fcff14faa4" dependencies = [ "bitflags", "hex-literal", @@ -138,9 +138,9 @@ dependencies = [ [[package]] name = "multiversx-sc-derive" -version = "0.50.4" +version = "0.50.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b6ca88f27a90b0a1b17d5b645cc859e0480f4321c551525873a59a954bfbcb53" +checksum = "7dc53ddcbd71948d2e8d3d6b814da866e2920b24e6c0cbfa643922f781897476" dependencies = [ "hex", "proc-macro2", @@ -151,18 +151,18 @@ dependencies = [ [[package]] name = "multiversx-sc-modules" -version = "0.50.4" +version = "0.50.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e97c7153d996ef412f5fc687a6799fc9173cb221adef283c217d160eebebe7d4" +checksum = "ea1ae09db9cac18669b85d50932410df6082e1a575975ba5224e3b7ae33cbe7d" dependencies = [ "multiversx-sc", ] [[package]] name = "multiversx-sc-wasm-adapter" -version = "0.50.4" +version = "0.50.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "37f083d6844a0919a39d87c2552b8e9ea30e365775265d31b419d24f6aa93eee" +checksum = "99a090365b4483b4ea955ba1322f986f6821be88144291f0013c03f59b4de753" dependencies = [ "multiversx-sc", ] diff --git a/esdt-safe/wasm-esdt-safe-view/Cargo.toml b/esdt-safe/wasm-esdt-safe-view/Cargo.toml index ff3684ed..ebae0fad 100644 --- a/esdt-safe/wasm-esdt-safe-view/Cargo.toml +++ b/esdt-safe/wasm-esdt-safe-view/Cargo.toml @@ -28,7 +28,7 @@ panic = "abort" path = ".." [dependencies.multiversx-sc-wasm-adapter] -version = "=0.50.4" +version = "=0.50.5" [workspace] members = ["."] diff --git a/esdt-safe/wasm/Cargo.lock b/esdt-safe/wasm/Cargo.lock index 691cbcf6..0ddb82fa 100644 --- a/esdt-safe/wasm/Cargo.lock +++ b/esdt-safe/wasm/Cargo.lock @@ -101,9 +101,9 @@ dependencies = [ [[package]] name = "multiversx-sc" -version = "0.50.4" +version = "0.50.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "748a370a86e9a3c51e0609c4a6c0c9a5cceaeb742656ee3284c0620504a3d7a5" +checksum = "a38a802d6cfa67748145a9e729336f4e6390eba702b5f14360ed01fcff14faa4" dependencies = [ "bitflags", "hex-literal", @@ -138,9 +138,9 @@ dependencies = [ [[package]] name = "multiversx-sc-derive" -version = "0.50.4" +version = "0.50.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b6ca88f27a90b0a1b17d5b645cc859e0480f4321c551525873a59a954bfbcb53" +checksum = "7dc53ddcbd71948d2e8d3d6b814da866e2920b24e6c0cbfa643922f781897476" dependencies = [ "hex", "proc-macro2", @@ -151,18 +151,18 @@ dependencies = [ [[package]] name = "multiversx-sc-modules" -version = "0.50.4" +version = "0.50.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e97c7153d996ef412f5fc687a6799fc9173cb221adef283c217d160eebebe7d4" +checksum = "ea1ae09db9cac18669b85d50932410df6082e1a575975ba5224e3b7ae33cbe7d" dependencies = [ "multiversx-sc", ] [[package]] name = "multiversx-sc-wasm-adapter" -version = "0.50.4" +version = "0.50.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "37f083d6844a0919a39d87c2552b8e9ea30e365775265d31b419d24f6aa93eee" +checksum = "99a090365b4483b4ea955ba1322f986f6821be88144291f0013c03f59b4de753" dependencies = [ "multiversx-sc", ] diff --git a/esdt-safe/wasm/Cargo.toml b/esdt-safe/wasm/Cargo.toml index da27e023..63bcb6c8 100644 --- a/esdt-safe/wasm/Cargo.toml +++ b/esdt-safe/wasm/Cargo.toml @@ -28,7 +28,7 @@ panic = "abort" path = ".." [dependencies.multiversx-sc-wasm-adapter] -version = "=0.50.4" +version = "=0.50.5" [workspace] members = ["."] diff --git a/fee-market/Cargo.toml b/fee-market/Cargo.toml index 5e880006..88680fb9 100644 --- a/fee-market/Cargo.toml +++ b/fee-market/Cargo.toml @@ -24,10 +24,10 @@ path = "../pair-mock" path = "../router-mock" [dependencies.multiversx-sc] -version = "=0.50.4" +version = "=0.50.5" [dev-dependencies] num-bigint = "0.4.2" [dev-dependencies.multiversx-sc-scenario] -version = "=0.50.4" +version = "=0.50.5" diff --git a/fee-market/meta/Cargo.toml b/fee-market/meta/Cargo.toml index 2f36b7c6..a89ca01b 100644 --- a/fee-market/meta/Cargo.toml +++ b/fee-market/meta/Cargo.toml @@ -8,5 +8,5 @@ publish = false path = ".." [dependencies.multiversx-sc-meta] -version = "=0.50.4" +version = "=0.50.5" default-features = false diff --git a/fee-market/wasm-fee-marker-full/Cargo.lock b/fee-market/wasm-fee-marker-full/Cargo.lock index 30846040..43c47c5d 100644 --- a/fee-market/wasm-fee-marker-full/Cargo.lock +++ b/fee-market/wasm-fee-marker-full/Cargo.lock @@ -68,9 +68,9 @@ checksum = "6fe2267d4ed49bc07b63801559be28c718ea06c4738b7a03c94df7386d2cde46" [[package]] name = "multiversx-sc" -version = "0.50.4" +version = "0.50.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "748a370a86e9a3c51e0609c4a6c0c9a5cceaeb742656ee3284c0620504a3d7a5" +checksum = "a38a802d6cfa67748145a9e729336f4e6390eba702b5f14360ed01fcff14faa4" dependencies = [ "bitflags", "hex-literal", @@ -105,9 +105,9 @@ dependencies = [ [[package]] name = "multiversx-sc-derive" -version = "0.50.4" +version = "0.50.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b6ca88f27a90b0a1b17d5b645cc859e0480f4321c551525873a59a954bfbcb53" +checksum = "7dc53ddcbd71948d2e8d3d6b814da866e2920b24e6c0cbfa643922f781897476" dependencies = [ "hex", "proc-macro2", @@ -118,9 +118,9 @@ dependencies = [ [[package]] name = "multiversx-sc-wasm-adapter" -version = "0.50.4" +version = "0.50.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "37f083d6844a0919a39d87c2552b8e9ea30e365775265d31b419d24f6aa93eee" +checksum = "99a090365b4483b4ea955ba1322f986f6821be88144291f0013c03f59b4de753" dependencies = [ "multiversx-sc", ] diff --git a/fee-market/wasm-fee-marker-full/Cargo.toml b/fee-market/wasm-fee-marker-full/Cargo.toml index aba6b1c8..fde6fad8 100644 --- a/fee-market/wasm-fee-marker-full/Cargo.toml +++ b/fee-market/wasm-fee-marker-full/Cargo.toml @@ -28,7 +28,7 @@ panic = "abort" path = ".." [dependencies.multiversx-sc-wasm-adapter] -version = "=0.50.4" +version = "=0.50.5" [workspace] members = ["."] diff --git a/fee-market/wasm-multisig-view/Cargo.lock b/fee-market/wasm-multisig-view/Cargo.lock index aa1cfd4f..c25960a5 100644 --- a/fee-market/wasm-multisig-view/Cargo.lock +++ b/fee-market/wasm-multisig-view/Cargo.lock @@ -68,9 +68,9 @@ dependencies = [ [[package]] name = "multiversx-sc" -version = "0.50.4" +version = "0.50.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "748a370a86e9a3c51e0609c4a6c0c9a5cceaeb742656ee3284c0620504a3d7a5" +checksum = "a38a802d6cfa67748145a9e729336f4e6390eba702b5f14360ed01fcff14faa4" dependencies = [ "bitflags", "hex-literal", @@ -105,9 +105,9 @@ dependencies = [ [[package]] name = "multiversx-sc-derive" -version = "0.50.4" +version = "0.50.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b6ca88f27a90b0a1b17d5b645cc859e0480f4321c551525873a59a954bfbcb53" +checksum = "7dc53ddcbd71948d2e8d3d6b814da866e2920b24e6c0cbfa643922f781897476" dependencies = [ "hex", "proc-macro2", @@ -118,9 +118,9 @@ dependencies = [ [[package]] name = "multiversx-sc-wasm-adapter" -version = "0.50.4" +version = "0.50.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "37f083d6844a0919a39d87c2552b8e9ea30e365775265d31b419d24f6aa93eee" +checksum = "99a090365b4483b4ea955ba1322f986f6821be88144291f0013c03f59b4de753" dependencies = [ "multiversx-sc", ] diff --git a/fee-market/wasm-multisig-view/Cargo.toml b/fee-market/wasm-multisig-view/Cargo.toml index c7eb1b07..eb29e604 100644 --- a/fee-market/wasm-multisig-view/Cargo.toml +++ b/fee-market/wasm-multisig-view/Cargo.toml @@ -28,7 +28,7 @@ panic = "abort" path = ".." [dependencies.multiversx-sc-wasm-adapter] -version = "=0.50.4" +version = "=0.50.5" [workspace] members = ["."] diff --git a/fee-market/wasm/Cargo.lock b/fee-market/wasm/Cargo.lock index 17b02749..80eabef7 100644 --- a/fee-market/wasm/Cargo.lock +++ b/fee-market/wasm/Cargo.lock @@ -68,9 +68,9 @@ checksum = "6fe2267d4ed49bc07b63801559be28c718ea06c4738b7a03c94df7386d2cde46" [[package]] name = "multiversx-sc" -version = "0.50.4" +version = "0.50.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "748a370a86e9a3c51e0609c4a6c0c9a5cceaeb742656ee3284c0620504a3d7a5" +checksum = "a38a802d6cfa67748145a9e729336f4e6390eba702b5f14360ed01fcff14faa4" dependencies = [ "bitflags", "hex-literal", @@ -105,9 +105,9 @@ dependencies = [ [[package]] name = "multiversx-sc-derive" -version = "0.50.4" +version = "0.50.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b6ca88f27a90b0a1b17d5b645cc859e0480f4321c551525873a59a954bfbcb53" +checksum = "7dc53ddcbd71948d2e8d3d6b814da866e2920b24e6c0cbfa643922f781897476" dependencies = [ "hex", "proc-macro2", @@ -118,9 +118,9 @@ dependencies = [ [[package]] name = "multiversx-sc-wasm-adapter" -version = "0.50.4" +version = "0.50.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "37f083d6844a0919a39d87c2552b8e9ea30e365775265d31b419d24f6aa93eee" +checksum = "99a090365b4483b4ea955ba1322f986f6821be88144291f0013c03f59b4de753" dependencies = [ "multiversx-sc", ] diff --git a/fee-market/wasm/Cargo.toml b/fee-market/wasm/Cargo.toml index f15c7298..b918c8f3 100644 --- a/fee-market/wasm/Cargo.toml +++ b/fee-market/wasm/Cargo.toml @@ -28,7 +28,7 @@ panic = "abort" path = ".." [dependencies.multiversx-sc-wasm-adapter] -version = "=0.50.4" +version = "=0.50.5" [workspace] members = ["."] diff --git a/header-verifier/Cargo.toml b/header-verifier/Cargo.toml index 39169eff..6840cd16 100644 --- a/header-verifier/Cargo.toml +++ b/header-verifier/Cargo.toml @@ -9,7 +9,7 @@ publish = false path = "src/lib.rs" [dependencies.multiversx-sc] -version = "0.50.4" +version = "0.50.5" [dependencies.bls-signature] path = "../common/bls-signature" @@ -21,4 +21,4 @@ path = "../common/transaction" num-bigint = "0.4.2" [dev-dependencies.multiversx-sc-scenario] -version = "0.50.4" +version = "0.50.5" diff --git a/header-verifier/meta/Cargo.toml b/header-verifier/meta/Cargo.toml index 51dc880c..3a9d7a5b 100644 --- a/header-verifier/meta/Cargo.toml +++ b/header-verifier/meta/Cargo.toml @@ -8,5 +8,5 @@ publish = false path = ".." [dependencies.multiversx-sc-meta] -version = "0.50.4" +version = "0.50.5" default-features = false diff --git a/header-verifier/wasm-header-verifier-full/Cargo.lock b/header-verifier/wasm-header-verifier-full/Cargo.lock index 9099c9fd..914b6ae0 100644 --- a/header-verifier/wasm-header-verifier-full/Cargo.lock +++ b/header-verifier/wasm-header-verifier-full/Cargo.lock @@ -65,9 +65,9 @@ checksum = "6fe2267d4ed49bc07b63801559be28c718ea06c4738b7a03c94df7386d2cde46" [[package]] name = "multiversx-sc" -version = "0.50.4" +version = "0.50.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "748a370a86e9a3c51e0609c4a6c0c9a5cceaeb742656ee3284c0620504a3d7a5" +checksum = "a38a802d6cfa67748145a9e729336f4e6390eba702b5f14360ed01fcff14faa4" dependencies = [ "bitflags", "hex-literal", @@ -102,9 +102,9 @@ dependencies = [ [[package]] name = "multiversx-sc-derive" -version = "0.50.4" +version = "0.50.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b6ca88f27a90b0a1b17d5b645cc859e0480f4321c551525873a59a954bfbcb53" +checksum = "7dc53ddcbd71948d2e8d3d6b814da866e2920b24e6c0cbfa643922f781897476" dependencies = [ "hex", "proc-macro2", @@ -115,9 +115,9 @@ dependencies = [ [[package]] name = "multiversx-sc-wasm-adapter" -version = "0.50.4" +version = "0.50.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "37f083d6844a0919a39d87c2552b8e9ea30e365775265d31b419d24f6aa93eee" +checksum = "99a090365b4483b4ea955ba1322f986f6821be88144291f0013c03f59b4de753" dependencies = [ "multiversx-sc", ] diff --git a/header-verifier/wasm-header-verifier-full/Cargo.toml b/header-verifier/wasm-header-verifier-full/Cargo.toml index e8570e7b..290968bc 100644 --- a/header-verifier/wasm-header-verifier-full/Cargo.toml +++ b/header-verifier/wasm-header-verifier-full/Cargo.toml @@ -28,7 +28,7 @@ panic = "abort" path = ".." [dependencies.multiversx-sc-wasm-adapter] -version = "0.50.4" +version = "0.50.5" [workspace] members = ["."] diff --git a/header-verifier/wasm-multisig-view/Cargo.lock b/header-verifier/wasm-multisig-view/Cargo.lock index b529f2b9..b5ef0ce7 100644 --- a/header-verifier/wasm-multisig-view/Cargo.lock +++ b/header-verifier/wasm-multisig-view/Cargo.lock @@ -65,9 +65,9 @@ dependencies = [ [[package]] name = "multiversx-sc" -version = "0.50.4" +version = "0.50.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "748a370a86e9a3c51e0609c4a6c0c9a5cceaeb742656ee3284c0620504a3d7a5" +checksum = "a38a802d6cfa67748145a9e729336f4e6390eba702b5f14360ed01fcff14faa4" dependencies = [ "bitflags", "hex-literal", @@ -102,9 +102,9 @@ dependencies = [ [[package]] name = "multiversx-sc-derive" -version = "0.50.4" +version = "0.50.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b6ca88f27a90b0a1b17d5b645cc859e0480f4321c551525873a59a954bfbcb53" +checksum = "7dc53ddcbd71948d2e8d3d6b814da866e2920b24e6c0cbfa643922f781897476" dependencies = [ "hex", "proc-macro2", @@ -115,9 +115,9 @@ dependencies = [ [[package]] name = "multiversx-sc-wasm-adapter" -version = "0.50.4" +version = "0.50.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "37f083d6844a0919a39d87c2552b8e9ea30e365775265d31b419d24f6aa93eee" +checksum = "99a090365b4483b4ea955ba1322f986f6821be88144291f0013c03f59b4de753" dependencies = [ "multiversx-sc", ] diff --git a/header-verifier/wasm-multisig-view/Cargo.toml b/header-verifier/wasm-multisig-view/Cargo.toml index 9be0b619..a5c83d24 100644 --- a/header-verifier/wasm-multisig-view/Cargo.toml +++ b/header-verifier/wasm-multisig-view/Cargo.toml @@ -28,7 +28,7 @@ panic = "abort" path = ".." [dependencies.multiversx-sc-wasm-adapter] -version = "0.50.4" +version = "0.50.5" [workspace] members = ["."] diff --git a/header-verifier/wasm/Cargo.lock b/header-verifier/wasm/Cargo.lock index 398203e1..2c43d602 100644 --- a/header-verifier/wasm/Cargo.lock +++ b/header-verifier/wasm/Cargo.lock @@ -65,9 +65,9 @@ checksum = "6fe2267d4ed49bc07b63801559be28c718ea06c4738b7a03c94df7386d2cde46" [[package]] name = "multiversx-sc" -version = "0.50.4" +version = "0.50.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "748a370a86e9a3c51e0609c4a6c0c9a5cceaeb742656ee3284c0620504a3d7a5" +checksum = "a38a802d6cfa67748145a9e729336f4e6390eba702b5f14360ed01fcff14faa4" dependencies = [ "bitflags", "hex-literal", @@ -102,9 +102,9 @@ dependencies = [ [[package]] name = "multiversx-sc-derive" -version = "0.50.4" +version = "0.50.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b6ca88f27a90b0a1b17d5b645cc859e0480f4321c551525873a59a954bfbcb53" +checksum = "7dc53ddcbd71948d2e8d3d6b814da866e2920b24e6c0cbfa643922f781897476" dependencies = [ "hex", "proc-macro2", @@ -115,9 +115,9 @@ dependencies = [ [[package]] name = "multiversx-sc-wasm-adapter" -version = "0.50.4" +version = "0.50.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "37f083d6844a0919a39d87c2552b8e9ea30e365775265d31b419d24f6aa93eee" +checksum = "99a090365b4483b4ea955ba1322f986f6821be88144291f0013c03f59b4de753" dependencies = [ "multiversx-sc", ] diff --git a/header-verifier/wasm/Cargo.toml b/header-verifier/wasm/Cargo.toml index dada4a72..0d31ae8d 100644 --- a/header-verifier/wasm/Cargo.toml +++ b/header-verifier/wasm/Cargo.toml @@ -28,7 +28,7 @@ panic = "abort" path = ".." [dependencies.multiversx-sc-wasm-adapter] -version = "0.50.4" +version = "0.50.5" [workspace] members = ["."] diff --git a/pair-mock/Cargo.toml b/pair-mock/Cargo.toml index a0034110..d05f4855 100644 --- a/pair-mock/Cargo.toml +++ b/pair-mock/Cargo.toml @@ -9,10 +9,10 @@ publish = false path = "src/pair_mock.rs" [dependencies.multiversx-sc] -version = "0.50.4" +version = "0.50.5" [dev-dependencies] num-bigint = "0.4" [dev-dependencies.multiversx-sc-scenario] -version = "0.50.4" +version = "0.50.5" diff --git a/pair-mock/meta/Cargo.toml b/pair-mock/meta/Cargo.toml index 8fb6137a..c512a41e 100644 --- a/pair-mock/meta/Cargo.toml +++ b/pair-mock/meta/Cargo.toml @@ -8,5 +8,5 @@ publish = false path = ".." [dependencies.multiversx-sc-meta] -version = "0.50.4" +version = "0.50.5" default-features = false diff --git a/pair-mock/wasm/Cargo.lock b/pair-mock/wasm/Cargo.lock index 4805980e..7356f310 100644 --- a/pair-mock/wasm/Cargo.lock +++ b/pair-mock/wasm/Cargo.lock @@ -40,9 +40,9 @@ checksum = "6fe2267d4ed49bc07b63801559be28c718ea06c4738b7a03c94df7386d2cde46" [[package]] name = "multiversx-sc" -version = "0.50.4" +version = "0.50.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "748a370a86e9a3c51e0609c4a6c0c9a5cceaeb742656ee3284c0620504a3d7a5" +checksum = "a38a802d6cfa67748145a9e729336f4e6390eba702b5f14360ed01fcff14faa4" dependencies = [ "bitflags", "hex-literal", @@ -77,9 +77,9 @@ dependencies = [ [[package]] name = "multiversx-sc-derive" -version = "0.50.4" +version = "0.50.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b6ca88f27a90b0a1b17d5b645cc859e0480f4321c551525873a59a954bfbcb53" +checksum = "7dc53ddcbd71948d2e8d3d6b814da866e2920b24e6c0cbfa643922f781897476" dependencies = [ "hex", "proc-macro2", @@ -90,9 +90,9 @@ dependencies = [ [[package]] name = "multiversx-sc-wasm-adapter" -version = "0.50.4" +version = "0.50.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "37f083d6844a0919a39d87c2552b8e9ea30e365775265d31b419d24f6aa93eee" +checksum = "99a090365b4483b4ea955ba1322f986f6821be88144291f0013c03f59b4de753" dependencies = [ "multiversx-sc", ] diff --git a/pair-mock/wasm/Cargo.toml b/pair-mock/wasm/Cargo.toml index 5d2f3e32..199f8fd0 100644 --- a/pair-mock/wasm/Cargo.toml +++ b/pair-mock/wasm/Cargo.toml @@ -28,7 +28,7 @@ panic = "abort" path = ".." [dependencies.multiversx-sc-wasm-adapter] -version = "0.50.4" +version = "0.50.5" [workspace] members = ["."] diff --git a/router-mock/Cargo.toml b/router-mock/Cargo.toml index 3c9ce118..2077f4cf 100644 --- a/router-mock/Cargo.toml +++ b/router-mock/Cargo.toml @@ -9,10 +9,10 @@ publish = false path = "src/router_mock.rs" [dependencies.multiversx-sc] -version = "0.50.4" +version = "0.50.5" [dev-dependencies] num-bigint = "0.4" [dev-dependencies.multiversx-sc-scenario] -version = "0.50.4" +version = "0.50.5" diff --git a/router-mock/meta/Cargo.toml b/router-mock/meta/Cargo.toml index 1b981f83..19d7cd25 100644 --- a/router-mock/meta/Cargo.toml +++ b/router-mock/meta/Cargo.toml @@ -8,5 +8,5 @@ publish = false path = ".." [dependencies.multiversx-sc-meta] -version = "0.50.4" +version = "0.50.5" default-features = false diff --git a/router-mock/wasm/Cargo.lock b/router-mock/wasm/Cargo.lock index 41c925b9..55201fa8 100644 --- a/router-mock/wasm/Cargo.lock +++ b/router-mock/wasm/Cargo.lock @@ -40,9 +40,9 @@ checksum = "6fe2267d4ed49bc07b63801559be28c718ea06c4738b7a03c94df7386d2cde46" [[package]] name = "multiversx-sc" -version = "0.50.4" +version = "0.50.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "748a370a86e9a3c51e0609c4a6c0c9a5cceaeb742656ee3284c0620504a3d7a5" +checksum = "a38a802d6cfa67748145a9e729336f4e6390eba702b5f14360ed01fcff14faa4" dependencies = [ "bitflags", "hex-literal", @@ -77,9 +77,9 @@ dependencies = [ [[package]] name = "multiversx-sc-derive" -version = "0.50.4" +version = "0.50.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b6ca88f27a90b0a1b17d5b645cc859e0480f4321c551525873a59a954bfbcb53" +checksum = "7dc53ddcbd71948d2e8d3d6b814da866e2920b24e6c0cbfa643922f781897476" dependencies = [ "hex", "proc-macro2", @@ -90,9 +90,9 @@ dependencies = [ [[package]] name = "multiversx-sc-wasm-adapter" -version = "0.50.4" +version = "0.50.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "37f083d6844a0919a39d87c2552b8e9ea30e365775265d31b419d24f6aa93eee" +checksum = "99a090365b4483b4ea955ba1322f986f6821be88144291f0013c03f59b4de753" dependencies = [ "multiversx-sc", ] diff --git a/router-mock/wasm/Cargo.toml b/router-mock/wasm/Cargo.toml index 163994cb..e4a44646 100644 --- a/router-mock/wasm/Cargo.toml +++ b/router-mock/wasm/Cargo.toml @@ -28,7 +28,7 @@ panic = "abort" path = ".." [dependencies.multiversx-sc-wasm-adapter] -version = "0.50.4" +version = "0.50.5" [workspace] members = ["."] From 4680f8b28931ef59e3996d78e82f63c895a81c08 Mon Sep 17 00:00:00 2001 From: Andrei Baltariu Date: Tue, 25 Jun 2024 14:32:39 +0300 Subject: [PATCH 037/523] Formatting --- esdt-safe/src/lib.rs | 8 ++------ esdt-safe/src/to_sovereign/events.rs | 4 +--- esdt-safe/tests/bridge_blackbox_tests.rs | 9 +++++++-- fee-market/src/lib.rs | 2 +- fee-market/src/safe_price_query.rs | 3 +-- header-verifier/tests/header_verifier_blackbox_test.rs | 2 +- pair-mock/tests/pair_mock_scenario_rs_test.rs | 5 ++++- router-mock/tests/router_mock_scenario_rs_test.rs | 5 ++++- 8 files changed, 21 insertions(+), 17 deletions(-) diff --git a/esdt-safe/src/lib.rs b/esdt-safe/src/lib.rs index 161f06d6..bea1709a 100644 --- a/esdt-safe/src/lib.rs +++ b/esdt-safe/src/lib.rs @@ -3,9 +3,9 @@ multiversx_sc::imports!(); multiversx_sc::derive_imports!(); +pub mod esdt_safe_proxy; pub mod from_sovereign; pub mod to_sovereign; -pub mod esdt_safe_proxy; #[multiversx_sc::contract] pub trait EsdtSafe: @@ -27,10 +27,7 @@ pub trait EsdtSafe: + multiversx_sc_modules::default_issue_callbacks::DefaultIssueCallbacksModule { #[init] - fn init( - &self, - is_sovereign_chain: bool, - ) { + fn init(&self, is_sovereign_chain: bool) { self.is_sovereign_chain().set(is_sovereign_chain); self.set_paused(true); } @@ -61,5 +58,4 @@ pub trait EsdtSafe: #[upgrade] fn upgrade(&self) {} - } diff --git a/esdt-safe/src/to_sovereign/events.rs b/esdt-safe/src/to_sovereign/events.rs index ba1d55a0..7e5d137d 100644 --- a/esdt-safe/src/to_sovereign/events.rs +++ b/esdt-safe/src/to_sovereign/events.rs @@ -1,6 +1,4 @@ -use transaction::{ - transaction_status::TransactionStatus, BatchId, OperationData, TxId -}; +use transaction::{transaction_status::TransactionStatus, BatchId, OperationData, TxId}; multiversx_sc::imports!(); multiversx_sc::derive_imports!(); diff --git a/esdt-safe/tests/bridge_blackbox_tests.rs b/esdt-safe/tests/bridge_blackbox_tests.rs index e18939e9..43196b6b 100644 --- a/esdt-safe/tests/bridge_blackbox_tests.rs +++ b/esdt-safe/tests/bridge_blackbox_tests.rs @@ -270,7 +270,8 @@ impl BridgeTestState { let to = managed_address!(&Address::from(&RECEIVER_ADDRESS.eval_to_array())); let operation = Operation { to, tokens, data }; let operation_hash = self.get_operation_hash(&operation); - let hash_of_hashes: ManagedBuffer = ManagedBuffer::from(&sha256(&operation_hash.to_vec())); + let hash_of_hashes: ManagedBuffer = + ManagedBuffer::from(&sha256(&operation_hash.to_vec())); self.world .tx() @@ -309,7 +310,11 @@ impl BridgeTestState { .from(BRIDGE_OWNER_ADDRESS) .to(HEADER_VERIFIER_ADDRESS) .typed(header_verifier_proxy::HeaderverifierProxy) - .register_bridge_operations(mock_signature, hash_of_hashes.clone(), operations_hashes.clone()) + .register_bridge_operations( + mock_signature, + hash_of_hashes.clone(), + operations_hashes.clone(), + ) .run(); self.check_header_verifier_address(); diff --git a/fee-market/src/lib.rs b/fee-market/src/lib.rs index fe82004b..aac4d36d 100644 --- a/fee-market/src/lib.rs +++ b/fee-market/src/lib.rs @@ -4,11 +4,11 @@ multiversx_sc::imports!(); pub mod enable_fee; pub mod fee_common; +pub mod fee_market_proxy; pub mod fee_type; pub mod price_aggregator; pub mod safe_price_query; pub mod subtract_fee; -pub mod fee_market_proxy; #[multiversx_sc::contract] pub trait FeeMarket: diff --git a/fee-market/src/safe_price_query.rs b/fee-market/src/safe_price_query.rs index 7949c532..755c5a2a 100644 --- a/fee-market/src/safe_price_query.rs +++ b/fee-market/src/safe_price_query.rs @@ -58,8 +58,7 @@ pub trait SafePriceQueryModule: price_aggregator::PriceAggregatorModule { let token_to_wegld_pair = self.call_get_pair(token_id, &wegld_token_id); if !token_to_wegld_pair.is_zero() { - let wegld_to_usdc_pair = - self.call_get_pair(&wegld_token_id, &usdc_token_id); + let wegld_to_usdc_pair = self.call_get_pair(&wegld_token_id, &usdc_token_id); require!( !wegld_to_usdc_pair.is_zero(), "Invalid WEGLD-USDC pair address from router" diff --git a/header-verifier/tests/header_verifier_blackbox_test.rs b/header-verifier/tests/header_verifier_blackbox_test.rs index 18b1dce8..7b255b5c 100644 --- a/header-verifier/tests/header_verifier_blackbox_test.rs +++ b/header-verifier/tests/header_verifier_blackbox_test.rs @@ -60,7 +60,7 @@ impl HeaderVerifierTestState { self.world.sc_deploy( ScDeployStep::new() .from(OWNER_ADDRESS_EXPR) - .code(header_verifier_code), + .code(header_verifier_code), ); self diff --git a/pair-mock/tests/pair_mock_scenario_rs_test.rs b/pair-mock/tests/pair_mock_scenario_rs_test.rs index 92af7b8e..996f6215 100644 --- a/pair-mock/tests/pair_mock_scenario_rs_test.rs +++ b/pair-mock/tests/pair_mock_scenario_rs_test.rs @@ -4,7 +4,10 @@ fn world() -> ScenarioWorld { let mut blockchain = ScenarioWorld::new(); // blockchain.set_current_dir_from_workspace("relative path to your workspace, if applicable"); - blockchain.register_contract("mxsc:output/pair-mock.mxsc.json", pair_mock::ContractBuilder); + blockchain.register_contract( + "mxsc:output/pair-mock.mxsc.json", + pair_mock::ContractBuilder, + ); blockchain } diff --git a/router-mock/tests/router_mock_scenario_rs_test.rs b/router-mock/tests/router_mock_scenario_rs_test.rs index f765bd83..a3a9aa15 100644 --- a/router-mock/tests/router_mock_scenario_rs_test.rs +++ b/router-mock/tests/router_mock_scenario_rs_test.rs @@ -4,7 +4,10 @@ fn world() -> ScenarioWorld { let mut blockchain = ScenarioWorld::new(); // blockchain.set_current_dir_from_workspace("relative path to your workspace, if applicable"); - blockchain.register_contract("mxsc:output/router-mock.mxsc.json", router_mock::ContractBuilder); + blockchain.register_contract( + "mxsc:output/router-mock.mxsc.json", + router_mock::ContractBuilder, + ); blockchain } From e7319a5ec6cc3a625fd703cec3e0fb30541f8938 Mon Sep 17 00:00:00 2001 From: Andrei Baltariu Date: Tue, 25 Jun 2024 14:41:58 +0300 Subject: [PATCH 038/523] Removed unused imports --- esdt-safe/src/to_sovereign/events.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/esdt-safe/src/to_sovereign/events.rs b/esdt-safe/src/to_sovereign/events.rs index d9d17190..15439c68 100644 --- a/esdt-safe/src/to_sovereign/events.rs +++ b/esdt-safe/src/to_sovereign/events.rs @@ -1,4 +1,4 @@ -use transaction::{transaction_status::TransactionStatus, BatchId, OperationData, TxId}; +use transaction::OperationData; multiversx_sc::imports!(); multiversx_sc::derive_imports!(); From 0805bd0af2d4a0c88239f54b8545cb922c3617ee Mon Sep 17 00:00:00 2001 From: Andrei Baltariu Date: Tue, 25 Jun 2024 14:54:05 +0300 Subject: [PATCH 039/523] Fixed failing tests --- esdt-safe/tests/bridge_blackbox_tests.rs | 29 +----------------------- 1 file changed, 1 insertion(+), 28 deletions(-) diff --git a/esdt-safe/tests/bridge_blackbox_tests.rs b/esdt-safe/tests/bridge_blackbox_tests.rs index 43196b6b..15f64a5e 100644 --- a/esdt-safe/tests/bridge_blackbox_tests.rs +++ b/esdt-safe/tests/bridge_blackbox_tests.rs @@ -17,7 +17,7 @@ use multiversx_sc_scenario::multiversx_chain_vm::crypto_functions::sha256; use multiversx_sc_scenario::{ api::StaticApi, imports::MxscPath, ExpectError, ScenarioTxRun, ScenarioWorld, }; -use multiversx_sc_scenario::{managed_address, ExpectValue}; +use multiversx_sc_scenario::managed_address; use transaction::{ Operation, OperationData, OperationEsdtPayment, StolenFromFrameworkEsdtTokenData, }; @@ -316,33 +316,6 @@ impl BridgeTestState { operations_hashes.clone(), ) .run(); - - self.check_header_verifier_address(); - self.check_pending_hashes_mapper(&hash_of_hashes, &operations_hashes); - } - - fn check_header_verifier_address(&mut self) { - self.world - .query() - .to(BRIDGE_ADDRESS) - .typed(esdt_safe_proxy::EsdtSafeProxy) - .header_verifier_address() - .with_result(ExpectValue(HEADER_VERIFIER_ADDRESS)) - .run() - } - - fn check_pending_hashes_mapper( - &mut self, - hash_of_hashes: &ManagedBuffer, - expected_hash: &MultiValueEncoded>, - ) { - self.world - .query() - .to(HEADER_VERIFIER_ADDRESS) - .typed(header_verifier_proxy::HeaderverifierProxy) - .pending_hashes(hash_of_hashes) - .with_result(ExpectValue(expected_hash)) - .run() } fn setup_payments( From e30b6c1d0dec6a31034eb81ab5d5c7d67132a317 Mon Sep 17 00:00:00 2001 From: Andrei Baltariu Date: Tue, 25 Jun 2024 14:59:42 +0300 Subject: [PATCH 040/523] Formatting --- esdt-safe/tests/bridge_blackbox_tests.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/esdt-safe/tests/bridge_blackbox_tests.rs b/esdt-safe/tests/bridge_blackbox_tests.rs index 15f64a5e..bbe07ff3 100644 --- a/esdt-safe/tests/bridge_blackbox_tests.rs +++ b/esdt-safe/tests/bridge_blackbox_tests.rs @@ -13,11 +13,11 @@ use multiversx_sc::{ TestSCAddress, }, }; +use multiversx_sc_scenario::managed_address; use multiversx_sc_scenario::multiversx_chain_vm::crypto_functions::sha256; use multiversx_sc_scenario::{ api::StaticApi, imports::MxscPath, ExpectError, ScenarioTxRun, ScenarioWorld, }; -use multiversx_sc_scenario::managed_address; use transaction::{ Operation, OperationData, OperationEsdtPayment, StolenFromFrameworkEsdtTokenData, }; From f688a4d9797b1e5aeec378e8cf133b2bc3432080 Mon Sep 17 00:00:00 2001 From: Andrei Baltariu Date: Tue, 25 Jun 2024 15:37:07 +0300 Subject: [PATCH 041/523] Added new test file --- enshrine-esdt-safe/tests/enshrine_esdt_safe_blackbox_test.rs | 0 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 enshrine-esdt-safe/tests/enshrine_esdt_safe_blackbox_test.rs diff --git a/enshrine-esdt-safe/tests/enshrine_esdt_safe_blackbox_test.rs b/enshrine-esdt-safe/tests/enshrine_esdt_safe_blackbox_test.rs new file mode 100644 index 00000000..e69de29b From 2f6723c3017d8ce5e91765948ce48397fc28184f Mon Sep 17 00:00:00 2001 From: Andrei Baltariu Date: Tue, 25 Jun 2024 16:01:10 +0300 Subject: [PATCH 042/523] Deploy test --- .../tests/enshrine_esdt_safe_blackbox_test.rs | 61 +++++++++++++++++++ .../enshrine_esdt_safe_scenario_go_test.rs | 10 --- .../enshrine_esdt_safe_scenario_rs_test.rs | 16 ----- 3 files changed, 61 insertions(+), 26 deletions(-) delete mode 100644 enshrine-esdt-safe/tests/enshrine_esdt_safe_scenario_go_test.rs delete mode 100644 enshrine-esdt-safe/tests/enshrine_esdt_safe_scenario_rs_test.rs diff --git a/enshrine-esdt-safe/tests/enshrine_esdt_safe_blackbox_test.rs b/enshrine-esdt-safe/tests/enshrine_esdt_safe_blackbox_test.rs index e69de29b..5cfd95ac 100644 --- a/enshrine-esdt-safe/tests/enshrine_esdt_safe_blackbox_test.rs +++ b/enshrine-esdt-safe/tests/enshrine_esdt_safe_blackbox_test.rs @@ -0,0 +1,61 @@ +use enshrine_esdt_safe::enshrine_esdt_safe_proxy; +use multiversx_sc::types::{ManagedBuffer, TestAddress, TestSCAddress, TestTokenIdentifier}; +use multiversx_sc_scenario::ScenarioTxRun; +use multiversx_sc_scenario::{imports::MxscPath, ScenarioWorld}; + +const ENSHRINE_ESDT_ADDRESS: TestSCAddress = TestSCAddress::new("enshrine-esdt"); +const ENSHRINE_ESDT_CODE_PATH: MxscPath = MxscPath::new("output/enshrine-esdt-safe.mxsc-json"); +const ENSHRINE_ESDT_OWNER: TestAddress = TestAddress::new("enshrine-esdt-owner"); + +const ENSHRINE_OWNER_BALANCE: u64 = 100_000_000; +const USER_EGLD_BALANCE: u64 = 100_000_000; + +const NFT_TOKEN_ID: TestTokenIdentifier = TestTokenIdentifier::new("NFT-123456"); +const FUNGIBLE_TOKEN_ID: TestTokenIdentifier = TestTokenIdentifier::new("CROWD-123456"); + +fn world() -> ScenarioWorld { + let mut blockchain = ScenarioWorld::new(); + + blockchain.register_contract(ENSHRINE_ESDT_CODE_PATH, enshrine_esdt_safe::ContractBuilder); + + blockchain +} + +struct EnshrineTestState { + world: ScenarioWorld, +} + +impl EnshrineTestState { + fn new() -> Self { + let mut world = world(); + + world + .account(ENSHRINE_ESDT_OWNER) + .esdt_balance(FUNGIBLE_TOKEN_ID, 100_000) + .esdt_nft_balance(NFT_TOKEN_ID, 1, 100_000, ManagedBuffer::new()) + .nonce(1) + .balance(ENSHRINE_OWNER_BALANCE); + + Self { world } + } + + fn deploy_enshrine_esdt_contract(&mut self, is_sovereign_chain: bool) -> &mut Self { + self.world + .tx() + .from(ENSHRINE_ESDT_OWNER) + .typed(enshrine_esdt_safe_proxy::EnshrineEsdtSafeProxy) + .init(is_sovereign_chain) + .code(ENSHRINE_ESDT_CODE_PATH) + .new_address(ENSHRINE_ESDT_ADDRESS) + .run(); + + self + } +} + +#[test] +fn test_deploy() { + let mut state = EnshrineTestState::new(); + + state.deploy_enshrine_esdt_contract(false); +} diff --git a/enshrine-esdt-safe/tests/enshrine_esdt_safe_scenario_go_test.rs b/enshrine-esdt-safe/tests/enshrine_esdt_safe_scenario_go_test.rs deleted file mode 100644 index 18b3d1e7..00000000 --- a/enshrine-esdt-safe/tests/enshrine_esdt_safe_scenario_go_test.rs +++ /dev/null @@ -1,10 +0,0 @@ -use multiversx_sc_scenario::*; - -fn world() -> ScenarioWorld { - ScenarioWorld::vm_go() -} - -#[test] -fn empty_go() { - world().run("scenarios/enshrine_esdt_safe.scen.json"); -} diff --git a/enshrine-esdt-safe/tests/enshrine_esdt_safe_scenario_rs_test.rs b/enshrine-esdt-safe/tests/enshrine_esdt_safe_scenario_rs_test.rs deleted file mode 100644 index 94ecba89..00000000 --- a/enshrine-esdt-safe/tests/enshrine_esdt_safe_scenario_rs_test.rs +++ /dev/null @@ -1,16 +0,0 @@ -use multiversx_sc_scenario::*; - -fn world() -> ScenarioWorld { - let mut blockchain = ScenarioWorld::new(); - - blockchain.register_contract( - "mxsc:output/enshrine-esdt-safe.mxsc.json", - enshrine_esdt_safe::ContractBuilder, - ); - blockchain -} - -#[test] -fn empty_rs() { - world().run("scenarios/enshrine_esdt_safe.scen.json"); -} From 8f2d3612611e9a4eb65d99feb920197cf749225d Mon Sep 17 00:00:00 2001 From: Andrei Baltariu Date: Wed, 26 Jun 2024 12:29:16 +0300 Subject: [PATCH 043/523] Modified setup + execute operation test --- .../tests/enshrine_esdt_safe_blackbox_test.rs | 105 +++++++++++++++++- 1 file changed, 100 insertions(+), 5 deletions(-) diff --git a/enshrine-esdt-safe/tests/enshrine_esdt_safe_blackbox_test.rs b/enshrine-esdt-safe/tests/enshrine_esdt_safe_blackbox_test.rs index 5cfd95ac..36b53da1 100644 --- a/enshrine-esdt-safe/tests/enshrine_esdt_safe_blackbox_test.rs +++ b/enshrine-esdt-safe/tests/enshrine_esdt_safe_blackbox_test.rs @@ -1,15 +1,26 @@ use enshrine_esdt_safe::enshrine_esdt_safe_proxy; -use multiversx_sc::types::{ManagedBuffer, TestAddress, TestSCAddress, TestTokenIdentifier}; -use multiversx_sc_scenario::ScenarioTxRun; +use multiversx_sc::codec::TopEncode; +use multiversx_sc::types::{ + Address, ManagedBuffer, ManagedVec, TestAddress, TestSCAddress, TestTokenIdentifier, +}; +use multiversx_sc_scenario::api::StaticApi; +use multiversx_sc_scenario::multiversx_chain_vm::crypto_functions::sha256; use multiversx_sc_scenario::{imports::MxscPath, ScenarioWorld}; +use multiversx_sc_scenario::{managed_address, ScenarioTxRun}; +use transaction::{ + Operation, OperationData, OperationEsdtPayment, StolenFromFrameworkEsdtTokenData, +}; const ENSHRINE_ESDT_ADDRESS: TestSCAddress = TestSCAddress::new("enshrine-esdt"); const ENSHRINE_ESDT_CODE_PATH: MxscPath = MxscPath::new("output/enshrine-esdt-safe.mxsc-json"); -const ENSHRINE_ESDT_OWNER: TestAddress = TestAddress::new("enshrine-esdt-owner"); +const ENSHRINE_ESDT_OWNER_ADDRESS: TestAddress = TestAddress::new("enshrine-esdt-owner"); const ENSHRINE_OWNER_BALANCE: u64 = 100_000_000; const USER_EGLD_BALANCE: u64 = 100_000_000; +const USER_ADDRESS: TestAddress = TestAddress::new("user"); +const RECEIVER_ADDRESS: TestAddress = TestAddress::new("receiver"); + const NFT_TOKEN_ID: TestTokenIdentifier = TestTokenIdentifier::new("NFT-123456"); const FUNGIBLE_TOKEN_ID: TestTokenIdentifier = TestTokenIdentifier::new("CROWD-123456"); @@ -30,27 +41,102 @@ impl EnshrineTestState { let mut world = world(); world - .account(ENSHRINE_ESDT_OWNER) + .account(ENSHRINE_ESDT_OWNER_ADDRESS) .esdt_balance(FUNGIBLE_TOKEN_ID, 100_000) .esdt_nft_balance(NFT_TOKEN_ID, 1, 100_000, ManagedBuffer::new()) .nonce(1) .balance(ENSHRINE_OWNER_BALANCE); + world + .account(USER_ADDRESS) + .esdt_nft_balance(NFT_TOKEN_ID, 1, 100_000, ManagedBuffer::new()) + .esdt_balance(FUNGIBLE_TOKEN_ID, 100_000) + .balance(USER_EGLD_BALANCE) + .nonce(1); + + world.account(RECEIVER_ADDRESS).nonce(1); + Self { world } } fn deploy_enshrine_esdt_contract(&mut self, is_sovereign_chain: bool) -> &mut Self { self.world .tx() - .from(ENSHRINE_ESDT_OWNER) + .from(ENSHRINE_ESDT_OWNER_ADDRESS) .typed(enshrine_esdt_safe_proxy::EnshrineEsdtSafeProxy) .init(is_sovereign_chain) .code(ENSHRINE_ESDT_CODE_PATH) .new_address(ENSHRINE_ESDT_ADDRESS) .run(); + self.propose_set_unpaused(); + self } + + fn propose_execute_operation(&mut self) { + let (tokens, data) = self.setup_payments(vec![NFT_TOKEN_ID, FUNGIBLE_TOKEN_ID]); + let to = managed_address!(&Address::from(&RECEIVER_ADDRESS.eval_to_array())); + let operation = Operation { to, tokens, data }; + let operation_hash = self.get_operation_hash(&operation); + let hash_of_hashes: ManagedBuffer = + ManagedBuffer::from(&sha256(&operation_hash.to_vec())); + + self.world + .tx() + .from(USER_ADDRESS) + .to(ENSHRINE_ESDT_ADDRESS) + .typed(enshrine_esdt_safe_proxy::EnshrineEsdtSafeProxy) + .execute_operations(hash_of_hashes, operation) + .run(); + } + + fn propose_set_unpaused(&mut self) { + self.world + .tx() + .from(ENSHRINE_ESDT_OWNER_ADDRESS) + .to(ENSHRINE_ESDT_ADDRESS) + .typed(enshrine_esdt_safe_proxy::EnshrineEsdtSafeProxy) + .unpause_endpoint() + .run(); + } + + fn setup_payments( + &mut self, + token_ids: Vec, + ) -> ( + ManagedVec>, + OperationData, + ) { + let mut tokens: ManagedVec> = ManagedVec::new(); + + for token_id in token_ids { + let payment: OperationEsdtPayment = OperationEsdtPayment { + token_identifier: token_id.into(), + token_nonce: 1, + token_data: StolenFromFrameworkEsdtTokenData::default(), + }; + + tokens.push(payment); + } + + let op_sender = managed_address!(&Address::from(&USER_ADDRESS.eval_to_array())); + let data: OperationData = OperationData { + op_nonce: 1, + op_sender, + opt_transfer_data: Option::None, + }; + + (tokens, data) + } + + fn get_operation_hash(&mut self, operation: &Operation) -> ManagedBuffer { + let mut serialized_operation: ManagedBuffer = ManagedBuffer::new(); + let _ = operation.top_encode(&mut serialized_operation); + let sha256 = sha256(&serialized_operation.to_vec()); + + ManagedBuffer::new_from_bytes(&sha256) + } } #[test] @@ -59,3 +145,12 @@ fn test_deploy() { state.deploy_enshrine_esdt_contract(false); } + +#[test] +fn test_sovereign_prefix() { + let mut state = EnshrineTestState::new(); + + state.deploy_enshrine_esdt_contract(false); + + state.propose_execute_operation(); +} From b1dad9e0ef698e582233f70142f41d1193d4cd09 Mon Sep 17 00:00:00 2001 From: Andrei Baltariu Date: Wed, 26 Jun 2024 12:37:13 +0300 Subject: [PATCH 044/523] Added header verifier address method --- .../tests/enshrine_esdt_safe_blackbox_test.rs | 48 +++++++++++++++++-- 1 file changed, 45 insertions(+), 3 deletions(-) diff --git a/enshrine-esdt-safe/tests/enshrine_esdt_safe_blackbox_test.rs b/enshrine-esdt-safe/tests/enshrine_esdt_safe_blackbox_test.rs index 36b53da1..7a954182 100644 --- a/enshrine-esdt-safe/tests/enshrine_esdt_safe_blackbox_test.rs +++ b/enshrine-esdt-safe/tests/enshrine_esdt_safe_blackbox_test.rs @@ -1,7 +1,9 @@ use enshrine_esdt_safe::enshrine_esdt_safe_proxy; +use header_verifier::header_verifier_proxy; use multiversx_sc::codec::TopEncode; use multiversx_sc::types::{ - Address, ManagedBuffer, ManagedVec, TestAddress, TestSCAddress, TestTokenIdentifier, + Address, ManagedBuffer, ManagedVec, MultiValueEncoded, TestAddress, TestSCAddress, + TestTokenIdentifier, }; use multiversx_sc_scenario::api::StaticApi; use multiversx_sc_scenario::multiversx_chain_vm::crypto_functions::sha256; @@ -18,6 +20,10 @@ const ENSHRINE_ESDT_OWNER_ADDRESS: TestAddress = TestAddress::new("enshrine-esdt const ENSHRINE_OWNER_BALANCE: u64 = 100_000_000; const USER_EGLD_BALANCE: u64 = 100_000_000; +const HEADER_VERIFIER_ADDRESS: TestSCAddress = TestSCAddress::new("header_verifier"); +const HEADER_VERIFIER_CODE_PATH: MxscPath = + MxscPath::new("../header-verifier/output/header-verifier.mxsc.json"); + const USER_ADDRESS: TestAddress = TestAddress::new("user"); const RECEIVER_ADDRESS: TestAddress = TestAddress::new("receiver"); @@ -28,6 +34,7 @@ fn world() -> ScenarioWorld { let mut blockchain = ScenarioWorld::new(); blockchain.register_contract(ENSHRINE_ESDT_CODE_PATH, enshrine_esdt_safe::ContractBuilder); + blockchain.register_contract(HEADER_VERIFIER_CODE_PATH, header_verifier::ContractBuilder); blockchain } @@ -74,6 +81,31 @@ impl EnshrineTestState { self } + fn deploy_header_verifier_contract(&mut self) -> &mut Self { + let bls_pub_key: ManagedBuffer = ManagedBuffer::new(); + let mut bls_pub_keys = MultiValueEncoded::new(); + bls_pub_keys.push(bls_pub_key); + + self.world + .tx() + .from(ENSHRINE_ESDT_OWNER_ADDRESS) + .typed(header_verifier_proxy::HeaderverifierProxy) + .init(bls_pub_keys) + .code(HEADER_VERIFIER_CODE_PATH) + .new_address(HEADER_VERIFIER_ADDRESS) + .run(); + + self + } + + fn propose_setup_contracts(&mut self, is_sovereign_chain: bool) -> &mut Self { + self.deploy_enshrine_esdt_contract(is_sovereign_chain); + self.deploy_header_verifier_contract(); + self.propose_set_header_verifier_address(); + + self + } + fn propose_execute_operation(&mut self) { let (tokens, data) = self.setup_payments(vec![NFT_TOKEN_ID, FUNGIBLE_TOKEN_ID]); let to = managed_address!(&Address::from(&RECEIVER_ADDRESS.eval_to_array())); @@ -101,6 +133,16 @@ impl EnshrineTestState { .run(); } + fn propose_set_header_verifier_address(&mut self) { + self.world + .tx() + .from(ENSHRINE_ESDT_OWNER_ADDRESS) + .to(ENSHRINE_ESDT_ADDRESS) + .typed(enshrine_esdt_safe_proxy::EnshrineEsdtSafeProxy) + .set_header_verifier_address(HEADER_VERIFIER_ADDRESS) + .run(); + } + fn setup_payments( &mut self, token_ids: Vec, @@ -143,14 +185,14 @@ impl EnshrineTestState { fn test_deploy() { let mut state = EnshrineTestState::new(); - state.deploy_enshrine_esdt_contract(false); + state.propose_setup_contracts(false); } #[test] fn test_sovereign_prefix() { let mut state = EnshrineTestState::new(); - state.deploy_enshrine_esdt_contract(false); + state.propose_setup_contracts(false); state.propose_execute_operation(); } From 20f951bdbbbda405e19b5b94345146571980f91c Mon Sep 17 00:00:00 2001 From: Andrei Baltariu Date: Wed, 26 Jun 2024 13:44:26 +0300 Subject: [PATCH 045/523] Modified has_prefix function and test --- common/utils/src/lib.rs | 7 ++- .../tests/enshrine_esdt_safe_blackbox_test.rs | 43 +++++++++++++++++-- 2 files changed, 43 insertions(+), 7 deletions(-) diff --git a/common/utils/src/lib.rs b/common/utils/src/lib.rs index 3886fe55..6720dc84 100644 --- a/common/utils/src/lib.rs +++ b/common/utils/src/lib.rs @@ -68,10 +68,9 @@ pub trait UtilsModule: bls_signature::BlsSignatureModule { fn has_sov_token_prefix(&self, token_id: &TokenIdentifier) -> bool { let dash = b'-'; - let mut array_buffer = [0u8, 30]; - let slice = token_id - .as_managed_buffer() - .load_to_byte_array(&mut array_buffer); + let buffer = token_id.as_managed_buffer(); + let mut array_buffer = [0u8, 32]; + let slice = buffer.load_to_byte_array(&mut array_buffer); let counter = slice.iter().filter(|&&c| c == dash).count(); diff --git a/enshrine-esdt-safe/tests/enshrine_esdt_safe_blackbox_test.rs b/enshrine-esdt-safe/tests/enshrine_esdt_safe_blackbox_test.rs index 7a954182..02209602 100644 --- a/enshrine-esdt-safe/tests/enshrine_esdt_safe_blackbox_test.rs +++ b/enshrine-esdt-safe/tests/enshrine_esdt_safe_blackbox_test.rs @@ -1,9 +1,10 @@ +use bls_signature::BlsSignature; use enshrine_esdt_safe::enshrine_esdt_safe_proxy; use header_verifier::header_verifier_proxy; use multiversx_sc::codec::TopEncode; use multiversx_sc::types::{ - Address, ManagedBuffer, ManagedVec, MultiValueEncoded, TestAddress, TestSCAddress, - TestTokenIdentifier, + Address, ManagedBuffer, ManagedByteArray, ManagedVec, MultiValueEncoded, TestAddress, + TestSCAddress, TestTokenIdentifier, }; use multiversx_sc_scenario::api::StaticApi; use multiversx_sc_scenario::multiversx_chain_vm::crypto_functions::sha256; @@ -143,6 +144,42 @@ impl EnshrineTestState { .run(); } + fn propose_register_operation(&mut self) { + let (tokens, data) = self.setup_payments(vec![NFT_TOKEN_ID, FUNGIBLE_TOKEN_ID]); + let to = managed_address!(&Address::from(RECEIVER_ADDRESS.eval_to_array())); + let operation = Operation { to, tokens, data }; + let operation_hash = self.get_operation_hash(&operation); + let mut operations_hashes = MultiValueEncoded::new(); + + operations_hashes.push(operation_hash.clone()); + + let mock_signature = self.mock_bls_signature(&operation_hash); + let hash_of_hashes = ManagedBuffer::new_from_bytes(&sha256(&operation_hash.to_vec())); + + self.world + .tx() + .from(ENSHRINE_ESDT_OWNER_ADDRESS) + .to(HEADER_VERIFIER_ADDRESS) + .typed(header_verifier_proxy::HeaderverifierProxy) + .register_bridge_operations( + mock_signature, + hash_of_hashes.clone(), + operations_hashes.clone(), + ) + .run(); + } + + fn mock_bls_signature( + &mut self, + operation_hash: &ManagedBuffer, + ) -> BlsSignature { + let byte_arr: &mut [u8; 48] = &mut [0; 48]; + operation_hash.load_to_byte_array(byte_arr); + let mock_signature: BlsSignature = ManagedByteArray::new_from_bytes(byte_arr); + + mock_signature + } + fn setup_payments( &mut self, token_ids: Vec, @@ -193,6 +230,6 @@ fn test_sovereign_prefix() { let mut state = EnshrineTestState::new(); state.propose_setup_contracts(false); - + state.propose_register_operation(); state.propose_execute_operation(); } From 4cfda2ba4f57b492e6b790f401483b93739f7b5e Mon Sep 17 00:00:00 2001 From: Andrei Baltariu Date: Wed, 26 Jun 2024 15:15:42 +0300 Subject: [PATCH 046/523] Fixed has_prefix error --- common/utils/src/lib.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/common/utils/src/lib.rs b/common/utils/src/lib.rs index 6720dc84..a23551a7 100644 --- a/common/utils/src/lib.rs +++ b/common/utils/src/lib.rs @@ -69,7 +69,7 @@ pub trait UtilsModule: bls_signature::BlsSignatureModule { fn has_sov_token_prefix(&self, token_id: &TokenIdentifier) -> bool { let dash = b'-'; let buffer = token_id.as_managed_buffer(); - let mut array_buffer = [0u8, 32]; + let mut array_buffer = [0u8; 32]; let slice = buffer.load_to_byte_array(&mut array_buffer); let counter = slice.iter().filter(|&&c| c == dash).count(); From 8b9dfa9e3331fe084e00c1359717389cf7f26f0c Mon Sep 17 00:00:00 2001 From: Andrei Baltariu Date: Wed, 26 Jun 2024 15:43:44 +0300 Subject: [PATCH 047/523] Modified tests setup --- .../tests/enshrine_esdt_safe_blackbox_test.rs | 32 +++++++++++++++---- 1 file changed, 25 insertions(+), 7 deletions(-) diff --git a/enshrine-esdt-safe/tests/enshrine_esdt_safe_blackbox_test.rs b/enshrine-esdt-safe/tests/enshrine_esdt_safe_blackbox_test.rs index 02209602..6b5b11c3 100644 --- a/enshrine-esdt-safe/tests/enshrine_esdt_safe_blackbox_test.rs +++ b/enshrine-esdt-safe/tests/enshrine_esdt_safe_blackbox_test.rs @@ -30,6 +30,7 @@ const RECEIVER_ADDRESS: TestAddress = TestAddress::new("receiver"); const NFT_TOKEN_ID: TestTokenIdentifier = TestTokenIdentifier::new("NFT-123456"); const FUNGIBLE_TOKEN_ID: TestTokenIdentifier = TestTokenIdentifier::new("CROWD-123456"); +const PREFIX_NFT_TOKEN_ID: TestTokenIdentifier = TestTokenIdentifier::new("SOV-NFT-123456"); fn world() -> ScenarioWorld { let mut blockchain = ScenarioWorld::new(); @@ -107,8 +108,12 @@ impl EnshrineTestState { self } - fn propose_execute_operation(&mut self) { - let (tokens, data) = self.setup_payments(vec![NFT_TOKEN_ID, FUNGIBLE_TOKEN_ID]); + fn propose_execute_operation(&mut self, has_prefix: bool) { + let (tokens, data) = if has_prefix { + self.setup_payments(vec![PREFIX_NFT_TOKEN_ID, FUNGIBLE_TOKEN_ID]) + } else { + self.setup_payments(vec![NFT_TOKEN_ID, FUNGIBLE_TOKEN_ID]) + }; let to = managed_address!(&Address::from(&RECEIVER_ADDRESS.eval_to_array())); let operation = Operation { to, tokens, data }; let operation_hash = self.get_operation_hash(&operation); @@ -144,8 +149,12 @@ impl EnshrineTestState { .run(); } - fn propose_register_operation(&mut self) { - let (tokens, data) = self.setup_payments(vec![NFT_TOKEN_ID, FUNGIBLE_TOKEN_ID]); + fn propose_register_operation(&mut self, has_prefix: bool) { + let (tokens, data) = if has_prefix { + self.setup_payments(vec![PREFIX_NFT_TOKEN_ID, FUNGIBLE_TOKEN_ID]) + } else { + self.setup_payments(vec![NFT_TOKEN_ID, FUNGIBLE_TOKEN_ID]) + }; let to = managed_address!(&Address::from(RECEIVER_ADDRESS.eval_to_array())); let operation = Operation { to, tokens, data }; let operation_hash = self.get_operation_hash(&operation); @@ -226,10 +235,19 @@ fn test_deploy() { } #[test] -fn test_sovereign_prefix() { +fn test_sovereign_prefix_no_prefix() { let mut state = EnshrineTestState::new(); state.propose_setup_contracts(false); - state.propose_register_operation(); - state.propose_execute_operation(); + state.propose_register_operation(false); + state.propose_execute_operation(false); } + +// #[test] +// fn test_sovereign_prefix_has_prefix() { +// let mut state = EnshrineTestState::new(); +// +// state.propose_setup_contracts(false); +// state.propose_register_operation(true); +// state.propose_execute_operation(true); +// } From d3c8b59f7cc8f777213081c7dc5475e950679b4b Mon Sep 17 00:00:00 2001 From: Andrei Baltariu Date: Thu, 27 Jun 2024 13:35:44 +0300 Subject: [PATCH 048/523] Fixed failing test --- .../tests/enshrine_esdt_safe_blackbox_test.rs | 52 ++++++++++++------- 1 file changed, 34 insertions(+), 18 deletions(-) diff --git a/enshrine-esdt-safe/tests/enshrine_esdt_safe_blackbox_test.rs b/enshrine-esdt-safe/tests/enshrine_esdt_safe_blackbox_test.rs index 6b5b11c3..e69e72ba 100644 --- a/enshrine-esdt-safe/tests/enshrine_esdt_safe_blackbox_test.rs +++ b/enshrine-esdt-safe/tests/enshrine_esdt_safe_blackbox_test.rs @@ -9,7 +9,7 @@ use multiversx_sc::types::{ use multiversx_sc_scenario::api::StaticApi; use multiversx_sc_scenario::multiversx_chain_vm::crypto_functions::sha256; use multiversx_sc_scenario::{imports::MxscPath, ScenarioWorld}; -use multiversx_sc_scenario::{managed_address, ScenarioTxRun}; +use multiversx_sc_scenario::{managed_address, ExpectError, ScenarioTxRun}; use transaction::{ Operation, OperationData, OperationEsdtPayment, StolenFromFrameworkEsdtTokenData, }; @@ -108,7 +108,7 @@ impl EnshrineTestState { self } - fn propose_execute_operation(&mut self, has_prefix: bool) { + fn propose_execute_operation(&mut self, has_prefix: bool, error_msg: Option<&str>) { let (tokens, data) = if has_prefix { self.setup_payments(vec![PREFIX_NFT_TOKEN_ID, FUNGIBLE_TOKEN_ID]) } else { @@ -120,13 +120,28 @@ impl EnshrineTestState { let hash_of_hashes: ManagedBuffer = ManagedBuffer::from(&sha256(&operation_hash.to_vec())); - self.world - .tx() - .from(USER_ADDRESS) - .to(ENSHRINE_ESDT_ADDRESS) - .typed(enshrine_esdt_safe_proxy::EnshrineEsdtSafeProxy) - .execute_operations(hash_of_hashes, operation) - .run(); + match error_msg { + Some(msg) => { + self.world + .tx() + .from(USER_ADDRESS) + .to(ENSHRINE_ESDT_ADDRESS) + .typed(enshrine_esdt_safe_proxy::EnshrineEsdtSafeProxy) + .execute_operations(hash_of_hashes, operation) + .returns(ExpectError(10, msg)) + .run(); + } + + None => { + self.world + .tx() + .from(USER_ADDRESS) + .to(ENSHRINE_ESDT_ADDRESS) + .typed(enshrine_esdt_safe_proxy::EnshrineEsdtSafeProxy) + .execute_operations(hash_of_hashes, operation) + .run(); + } + } } fn propose_set_unpaused(&mut self) { @@ -240,14 +255,15 @@ fn test_sovereign_prefix_no_prefix() { state.propose_setup_contracts(false); state.propose_register_operation(false); - state.propose_execute_operation(false); + state.propose_execute_operation(false, None); } -// #[test] -// fn test_sovereign_prefix_has_prefix() { -// let mut state = EnshrineTestState::new(); -// -// state.propose_setup_contracts(false); -// state.propose_register_operation(true); -// state.propose_execute_operation(true); -// } +#[test] +fn test_sovereign_prefix_has_prefix() { + let mut state = EnshrineTestState::new(); + let error_message = "action is not allowed"; + + state.propose_setup_contracts(false); + state.propose_register_operation(true); + state.propose_execute_operation(true, Some(error_message)); +} From 4378754083f6aab94986adea3517b60adc792be4 Mon Sep 17 00:00:00 2001 From: Andrei Baltariu Date: Tue, 25 Jun 2024 15:37:07 +0300 Subject: [PATCH 049/523] Added new test file --- enshrine-esdt-safe/tests/enshrine_esdt_safe_blackbox_test.rs | 0 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 enshrine-esdt-safe/tests/enshrine_esdt_safe_blackbox_test.rs diff --git a/enshrine-esdt-safe/tests/enshrine_esdt_safe_blackbox_test.rs b/enshrine-esdt-safe/tests/enshrine_esdt_safe_blackbox_test.rs new file mode 100644 index 00000000..e69de29b From d1f743cbb4d197bb4eec7915f9c64d889a0f445b Mon Sep 17 00:00:00 2001 From: Andrei Baltariu Date: Tue, 25 Jun 2024 16:01:10 +0300 Subject: [PATCH 050/523] Deploy test --- .../tests/enshrine_esdt_safe_blackbox_test.rs | 61 +++++++++++++++++++ .../enshrine_esdt_safe_scenario_go_test.rs | 10 --- .../enshrine_esdt_safe_scenario_rs_test.rs | 16 ----- 3 files changed, 61 insertions(+), 26 deletions(-) delete mode 100644 enshrine-esdt-safe/tests/enshrine_esdt_safe_scenario_go_test.rs delete mode 100644 enshrine-esdt-safe/tests/enshrine_esdt_safe_scenario_rs_test.rs diff --git a/enshrine-esdt-safe/tests/enshrine_esdt_safe_blackbox_test.rs b/enshrine-esdt-safe/tests/enshrine_esdt_safe_blackbox_test.rs index e69de29b..5cfd95ac 100644 --- a/enshrine-esdt-safe/tests/enshrine_esdt_safe_blackbox_test.rs +++ b/enshrine-esdt-safe/tests/enshrine_esdt_safe_blackbox_test.rs @@ -0,0 +1,61 @@ +use enshrine_esdt_safe::enshrine_esdt_safe_proxy; +use multiversx_sc::types::{ManagedBuffer, TestAddress, TestSCAddress, TestTokenIdentifier}; +use multiversx_sc_scenario::ScenarioTxRun; +use multiversx_sc_scenario::{imports::MxscPath, ScenarioWorld}; + +const ENSHRINE_ESDT_ADDRESS: TestSCAddress = TestSCAddress::new("enshrine-esdt"); +const ENSHRINE_ESDT_CODE_PATH: MxscPath = MxscPath::new("output/enshrine-esdt-safe.mxsc-json"); +const ENSHRINE_ESDT_OWNER: TestAddress = TestAddress::new("enshrine-esdt-owner"); + +const ENSHRINE_OWNER_BALANCE: u64 = 100_000_000; +const USER_EGLD_BALANCE: u64 = 100_000_000; + +const NFT_TOKEN_ID: TestTokenIdentifier = TestTokenIdentifier::new("NFT-123456"); +const FUNGIBLE_TOKEN_ID: TestTokenIdentifier = TestTokenIdentifier::new("CROWD-123456"); + +fn world() -> ScenarioWorld { + let mut blockchain = ScenarioWorld::new(); + + blockchain.register_contract(ENSHRINE_ESDT_CODE_PATH, enshrine_esdt_safe::ContractBuilder); + + blockchain +} + +struct EnshrineTestState { + world: ScenarioWorld, +} + +impl EnshrineTestState { + fn new() -> Self { + let mut world = world(); + + world + .account(ENSHRINE_ESDT_OWNER) + .esdt_balance(FUNGIBLE_TOKEN_ID, 100_000) + .esdt_nft_balance(NFT_TOKEN_ID, 1, 100_000, ManagedBuffer::new()) + .nonce(1) + .balance(ENSHRINE_OWNER_BALANCE); + + Self { world } + } + + fn deploy_enshrine_esdt_contract(&mut self, is_sovereign_chain: bool) -> &mut Self { + self.world + .tx() + .from(ENSHRINE_ESDT_OWNER) + .typed(enshrine_esdt_safe_proxy::EnshrineEsdtSafeProxy) + .init(is_sovereign_chain) + .code(ENSHRINE_ESDT_CODE_PATH) + .new_address(ENSHRINE_ESDT_ADDRESS) + .run(); + + self + } +} + +#[test] +fn test_deploy() { + let mut state = EnshrineTestState::new(); + + state.deploy_enshrine_esdt_contract(false); +} diff --git a/enshrine-esdt-safe/tests/enshrine_esdt_safe_scenario_go_test.rs b/enshrine-esdt-safe/tests/enshrine_esdt_safe_scenario_go_test.rs deleted file mode 100644 index 18b3d1e7..00000000 --- a/enshrine-esdt-safe/tests/enshrine_esdt_safe_scenario_go_test.rs +++ /dev/null @@ -1,10 +0,0 @@ -use multiversx_sc_scenario::*; - -fn world() -> ScenarioWorld { - ScenarioWorld::vm_go() -} - -#[test] -fn empty_go() { - world().run("scenarios/enshrine_esdt_safe.scen.json"); -} diff --git a/enshrine-esdt-safe/tests/enshrine_esdt_safe_scenario_rs_test.rs b/enshrine-esdt-safe/tests/enshrine_esdt_safe_scenario_rs_test.rs deleted file mode 100644 index 94ecba89..00000000 --- a/enshrine-esdt-safe/tests/enshrine_esdt_safe_scenario_rs_test.rs +++ /dev/null @@ -1,16 +0,0 @@ -use multiversx_sc_scenario::*; - -fn world() -> ScenarioWorld { - let mut blockchain = ScenarioWorld::new(); - - blockchain.register_contract( - "mxsc:output/enshrine-esdt-safe.mxsc.json", - enshrine_esdt_safe::ContractBuilder, - ); - blockchain -} - -#[test] -fn empty_rs() { - world().run("scenarios/enshrine_esdt_safe.scen.json"); -} From 1710be63f6f4a271dec223726fa0eb458aaceff6 Mon Sep 17 00:00:00 2001 From: Andrei Baltariu Date: Wed, 26 Jun 2024 12:29:16 +0300 Subject: [PATCH 051/523] Modified setup + execute operation test --- .../tests/enshrine_esdt_safe_blackbox_test.rs | 105 +++++++++++++++++- 1 file changed, 100 insertions(+), 5 deletions(-) diff --git a/enshrine-esdt-safe/tests/enshrine_esdt_safe_blackbox_test.rs b/enshrine-esdt-safe/tests/enshrine_esdt_safe_blackbox_test.rs index 5cfd95ac..36b53da1 100644 --- a/enshrine-esdt-safe/tests/enshrine_esdt_safe_blackbox_test.rs +++ b/enshrine-esdt-safe/tests/enshrine_esdt_safe_blackbox_test.rs @@ -1,15 +1,26 @@ use enshrine_esdt_safe::enshrine_esdt_safe_proxy; -use multiversx_sc::types::{ManagedBuffer, TestAddress, TestSCAddress, TestTokenIdentifier}; -use multiversx_sc_scenario::ScenarioTxRun; +use multiversx_sc::codec::TopEncode; +use multiversx_sc::types::{ + Address, ManagedBuffer, ManagedVec, TestAddress, TestSCAddress, TestTokenIdentifier, +}; +use multiversx_sc_scenario::api::StaticApi; +use multiversx_sc_scenario::multiversx_chain_vm::crypto_functions::sha256; use multiversx_sc_scenario::{imports::MxscPath, ScenarioWorld}; +use multiversx_sc_scenario::{managed_address, ScenarioTxRun}; +use transaction::{ + Operation, OperationData, OperationEsdtPayment, StolenFromFrameworkEsdtTokenData, +}; const ENSHRINE_ESDT_ADDRESS: TestSCAddress = TestSCAddress::new("enshrine-esdt"); const ENSHRINE_ESDT_CODE_PATH: MxscPath = MxscPath::new("output/enshrine-esdt-safe.mxsc-json"); -const ENSHRINE_ESDT_OWNER: TestAddress = TestAddress::new("enshrine-esdt-owner"); +const ENSHRINE_ESDT_OWNER_ADDRESS: TestAddress = TestAddress::new("enshrine-esdt-owner"); const ENSHRINE_OWNER_BALANCE: u64 = 100_000_000; const USER_EGLD_BALANCE: u64 = 100_000_000; +const USER_ADDRESS: TestAddress = TestAddress::new("user"); +const RECEIVER_ADDRESS: TestAddress = TestAddress::new("receiver"); + const NFT_TOKEN_ID: TestTokenIdentifier = TestTokenIdentifier::new("NFT-123456"); const FUNGIBLE_TOKEN_ID: TestTokenIdentifier = TestTokenIdentifier::new("CROWD-123456"); @@ -30,27 +41,102 @@ impl EnshrineTestState { let mut world = world(); world - .account(ENSHRINE_ESDT_OWNER) + .account(ENSHRINE_ESDT_OWNER_ADDRESS) .esdt_balance(FUNGIBLE_TOKEN_ID, 100_000) .esdt_nft_balance(NFT_TOKEN_ID, 1, 100_000, ManagedBuffer::new()) .nonce(1) .balance(ENSHRINE_OWNER_BALANCE); + world + .account(USER_ADDRESS) + .esdt_nft_balance(NFT_TOKEN_ID, 1, 100_000, ManagedBuffer::new()) + .esdt_balance(FUNGIBLE_TOKEN_ID, 100_000) + .balance(USER_EGLD_BALANCE) + .nonce(1); + + world.account(RECEIVER_ADDRESS).nonce(1); + Self { world } } fn deploy_enshrine_esdt_contract(&mut self, is_sovereign_chain: bool) -> &mut Self { self.world .tx() - .from(ENSHRINE_ESDT_OWNER) + .from(ENSHRINE_ESDT_OWNER_ADDRESS) .typed(enshrine_esdt_safe_proxy::EnshrineEsdtSafeProxy) .init(is_sovereign_chain) .code(ENSHRINE_ESDT_CODE_PATH) .new_address(ENSHRINE_ESDT_ADDRESS) .run(); + self.propose_set_unpaused(); + self } + + fn propose_execute_operation(&mut self) { + let (tokens, data) = self.setup_payments(vec![NFT_TOKEN_ID, FUNGIBLE_TOKEN_ID]); + let to = managed_address!(&Address::from(&RECEIVER_ADDRESS.eval_to_array())); + let operation = Operation { to, tokens, data }; + let operation_hash = self.get_operation_hash(&operation); + let hash_of_hashes: ManagedBuffer = + ManagedBuffer::from(&sha256(&operation_hash.to_vec())); + + self.world + .tx() + .from(USER_ADDRESS) + .to(ENSHRINE_ESDT_ADDRESS) + .typed(enshrine_esdt_safe_proxy::EnshrineEsdtSafeProxy) + .execute_operations(hash_of_hashes, operation) + .run(); + } + + fn propose_set_unpaused(&mut self) { + self.world + .tx() + .from(ENSHRINE_ESDT_OWNER_ADDRESS) + .to(ENSHRINE_ESDT_ADDRESS) + .typed(enshrine_esdt_safe_proxy::EnshrineEsdtSafeProxy) + .unpause_endpoint() + .run(); + } + + fn setup_payments( + &mut self, + token_ids: Vec, + ) -> ( + ManagedVec>, + OperationData, + ) { + let mut tokens: ManagedVec> = ManagedVec::new(); + + for token_id in token_ids { + let payment: OperationEsdtPayment = OperationEsdtPayment { + token_identifier: token_id.into(), + token_nonce: 1, + token_data: StolenFromFrameworkEsdtTokenData::default(), + }; + + tokens.push(payment); + } + + let op_sender = managed_address!(&Address::from(&USER_ADDRESS.eval_to_array())); + let data: OperationData = OperationData { + op_nonce: 1, + op_sender, + opt_transfer_data: Option::None, + }; + + (tokens, data) + } + + fn get_operation_hash(&mut self, operation: &Operation) -> ManagedBuffer { + let mut serialized_operation: ManagedBuffer = ManagedBuffer::new(); + let _ = operation.top_encode(&mut serialized_operation); + let sha256 = sha256(&serialized_operation.to_vec()); + + ManagedBuffer::new_from_bytes(&sha256) + } } #[test] @@ -59,3 +145,12 @@ fn test_deploy() { state.deploy_enshrine_esdt_contract(false); } + +#[test] +fn test_sovereign_prefix() { + let mut state = EnshrineTestState::new(); + + state.deploy_enshrine_esdt_contract(false); + + state.propose_execute_operation(); +} From 3fd293f16c50f491f7b3e6b64bbdf60ec863c0af Mon Sep 17 00:00:00 2001 From: Andrei Baltariu Date: Wed, 26 Jun 2024 12:37:13 +0300 Subject: [PATCH 052/523] Added header verifier address method --- .../tests/enshrine_esdt_safe_blackbox_test.rs | 48 +++++++++++++++++-- 1 file changed, 45 insertions(+), 3 deletions(-) diff --git a/enshrine-esdt-safe/tests/enshrine_esdt_safe_blackbox_test.rs b/enshrine-esdt-safe/tests/enshrine_esdt_safe_blackbox_test.rs index 36b53da1..7a954182 100644 --- a/enshrine-esdt-safe/tests/enshrine_esdt_safe_blackbox_test.rs +++ b/enshrine-esdt-safe/tests/enshrine_esdt_safe_blackbox_test.rs @@ -1,7 +1,9 @@ use enshrine_esdt_safe::enshrine_esdt_safe_proxy; +use header_verifier::header_verifier_proxy; use multiversx_sc::codec::TopEncode; use multiversx_sc::types::{ - Address, ManagedBuffer, ManagedVec, TestAddress, TestSCAddress, TestTokenIdentifier, + Address, ManagedBuffer, ManagedVec, MultiValueEncoded, TestAddress, TestSCAddress, + TestTokenIdentifier, }; use multiversx_sc_scenario::api::StaticApi; use multiversx_sc_scenario::multiversx_chain_vm::crypto_functions::sha256; @@ -18,6 +20,10 @@ const ENSHRINE_ESDT_OWNER_ADDRESS: TestAddress = TestAddress::new("enshrine-esdt const ENSHRINE_OWNER_BALANCE: u64 = 100_000_000; const USER_EGLD_BALANCE: u64 = 100_000_000; +const HEADER_VERIFIER_ADDRESS: TestSCAddress = TestSCAddress::new("header_verifier"); +const HEADER_VERIFIER_CODE_PATH: MxscPath = + MxscPath::new("../header-verifier/output/header-verifier.mxsc.json"); + const USER_ADDRESS: TestAddress = TestAddress::new("user"); const RECEIVER_ADDRESS: TestAddress = TestAddress::new("receiver"); @@ -28,6 +34,7 @@ fn world() -> ScenarioWorld { let mut blockchain = ScenarioWorld::new(); blockchain.register_contract(ENSHRINE_ESDT_CODE_PATH, enshrine_esdt_safe::ContractBuilder); + blockchain.register_contract(HEADER_VERIFIER_CODE_PATH, header_verifier::ContractBuilder); blockchain } @@ -74,6 +81,31 @@ impl EnshrineTestState { self } + fn deploy_header_verifier_contract(&mut self) -> &mut Self { + let bls_pub_key: ManagedBuffer = ManagedBuffer::new(); + let mut bls_pub_keys = MultiValueEncoded::new(); + bls_pub_keys.push(bls_pub_key); + + self.world + .tx() + .from(ENSHRINE_ESDT_OWNER_ADDRESS) + .typed(header_verifier_proxy::HeaderverifierProxy) + .init(bls_pub_keys) + .code(HEADER_VERIFIER_CODE_PATH) + .new_address(HEADER_VERIFIER_ADDRESS) + .run(); + + self + } + + fn propose_setup_contracts(&mut self, is_sovereign_chain: bool) -> &mut Self { + self.deploy_enshrine_esdt_contract(is_sovereign_chain); + self.deploy_header_verifier_contract(); + self.propose_set_header_verifier_address(); + + self + } + fn propose_execute_operation(&mut self) { let (tokens, data) = self.setup_payments(vec![NFT_TOKEN_ID, FUNGIBLE_TOKEN_ID]); let to = managed_address!(&Address::from(&RECEIVER_ADDRESS.eval_to_array())); @@ -101,6 +133,16 @@ impl EnshrineTestState { .run(); } + fn propose_set_header_verifier_address(&mut self) { + self.world + .tx() + .from(ENSHRINE_ESDT_OWNER_ADDRESS) + .to(ENSHRINE_ESDT_ADDRESS) + .typed(enshrine_esdt_safe_proxy::EnshrineEsdtSafeProxy) + .set_header_verifier_address(HEADER_VERIFIER_ADDRESS) + .run(); + } + fn setup_payments( &mut self, token_ids: Vec, @@ -143,14 +185,14 @@ impl EnshrineTestState { fn test_deploy() { let mut state = EnshrineTestState::new(); - state.deploy_enshrine_esdt_contract(false); + state.propose_setup_contracts(false); } #[test] fn test_sovereign_prefix() { let mut state = EnshrineTestState::new(); - state.deploy_enshrine_esdt_contract(false); + state.propose_setup_contracts(false); state.propose_execute_operation(); } From defe670fe222f33b1a8b74f6f3e6b681e8260977 Mon Sep 17 00:00:00 2001 From: Andrei Baltariu Date: Wed, 26 Jun 2024 13:44:26 +0300 Subject: [PATCH 053/523] Modified has_prefix function and test --- common/utils/src/lib.rs | 7 ++- .../tests/enshrine_esdt_safe_blackbox_test.rs | 43 +++++++++++++++++-- 2 files changed, 43 insertions(+), 7 deletions(-) diff --git a/common/utils/src/lib.rs b/common/utils/src/lib.rs index 3886fe55..6720dc84 100644 --- a/common/utils/src/lib.rs +++ b/common/utils/src/lib.rs @@ -68,10 +68,9 @@ pub trait UtilsModule: bls_signature::BlsSignatureModule { fn has_sov_token_prefix(&self, token_id: &TokenIdentifier) -> bool { let dash = b'-'; - let mut array_buffer = [0u8, 30]; - let slice = token_id - .as_managed_buffer() - .load_to_byte_array(&mut array_buffer); + let buffer = token_id.as_managed_buffer(); + let mut array_buffer = [0u8, 32]; + let slice = buffer.load_to_byte_array(&mut array_buffer); let counter = slice.iter().filter(|&&c| c == dash).count(); diff --git a/enshrine-esdt-safe/tests/enshrine_esdt_safe_blackbox_test.rs b/enshrine-esdt-safe/tests/enshrine_esdt_safe_blackbox_test.rs index 7a954182..02209602 100644 --- a/enshrine-esdt-safe/tests/enshrine_esdt_safe_blackbox_test.rs +++ b/enshrine-esdt-safe/tests/enshrine_esdt_safe_blackbox_test.rs @@ -1,9 +1,10 @@ +use bls_signature::BlsSignature; use enshrine_esdt_safe::enshrine_esdt_safe_proxy; use header_verifier::header_verifier_proxy; use multiversx_sc::codec::TopEncode; use multiversx_sc::types::{ - Address, ManagedBuffer, ManagedVec, MultiValueEncoded, TestAddress, TestSCAddress, - TestTokenIdentifier, + Address, ManagedBuffer, ManagedByteArray, ManagedVec, MultiValueEncoded, TestAddress, + TestSCAddress, TestTokenIdentifier, }; use multiversx_sc_scenario::api::StaticApi; use multiversx_sc_scenario::multiversx_chain_vm::crypto_functions::sha256; @@ -143,6 +144,42 @@ impl EnshrineTestState { .run(); } + fn propose_register_operation(&mut self) { + let (tokens, data) = self.setup_payments(vec![NFT_TOKEN_ID, FUNGIBLE_TOKEN_ID]); + let to = managed_address!(&Address::from(RECEIVER_ADDRESS.eval_to_array())); + let operation = Operation { to, tokens, data }; + let operation_hash = self.get_operation_hash(&operation); + let mut operations_hashes = MultiValueEncoded::new(); + + operations_hashes.push(operation_hash.clone()); + + let mock_signature = self.mock_bls_signature(&operation_hash); + let hash_of_hashes = ManagedBuffer::new_from_bytes(&sha256(&operation_hash.to_vec())); + + self.world + .tx() + .from(ENSHRINE_ESDT_OWNER_ADDRESS) + .to(HEADER_VERIFIER_ADDRESS) + .typed(header_verifier_proxy::HeaderverifierProxy) + .register_bridge_operations( + mock_signature, + hash_of_hashes.clone(), + operations_hashes.clone(), + ) + .run(); + } + + fn mock_bls_signature( + &mut self, + operation_hash: &ManagedBuffer, + ) -> BlsSignature { + let byte_arr: &mut [u8; 48] = &mut [0; 48]; + operation_hash.load_to_byte_array(byte_arr); + let mock_signature: BlsSignature = ManagedByteArray::new_from_bytes(byte_arr); + + mock_signature + } + fn setup_payments( &mut self, token_ids: Vec, @@ -193,6 +230,6 @@ fn test_sovereign_prefix() { let mut state = EnshrineTestState::new(); state.propose_setup_contracts(false); - + state.propose_register_operation(); state.propose_execute_operation(); } From fb815db8e884ad1cd9b936d3cbd71892082a854f Mon Sep 17 00:00:00 2001 From: Andrei Baltariu Date: Wed, 26 Jun 2024 15:15:42 +0300 Subject: [PATCH 054/523] Fixed has_prefix error --- common/utils/src/lib.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/common/utils/src/lib.rs b/common/utils/src/lib.rs index 6720dc84..a23551a7 100644 --- a/common/utils/src/lib.rs +++ b/common/utils/src/lib.rs @@ -69,7 +69,7 @@ pub trait UtilsModule: bls_signature::BlsSignatureModule { fn has_sov_token_prefix(&self, token_id: &TokenIdentifier) -> bool { let dash = b'-'; let buffer = token_id.as_managed_buffer(); - let mut array_buffer = [0u8, 32]; + let mut array_buffer = [0u8; 32]; let slice = buffer.load_to_byte_array(&mut array_buffer); let counter = slice.iter().filter(|&&c| c == dash).count(); From 996827641a80bbf201968110c8ae4aadcdb04328 Mon Sep 17 00:00:00 2001 From: Andrei Baltariu Date: Wed, 26 Jun 2024 15:43:44 +0300 Subject: [PATCH 055/523] Modified tests setup --- .../tests/enshrine_esdt_safe_blackbox_test.rs | 32 +++++++++++++++---- 1 file changed, 25 insertions(+), 7 deletions(-) diff --git a/enshrine-esdt-safe/tests/enshrine_esdt_safe_blackbox_test.rs b/enshrine-esdt-safe/tests/enshrine_esdt_safe_blackbox_test.rs index 02209602..6b5b11c3 100644 --- a/enshrine-esdt-safe/tests/enshrine_esdt_safe_blackbox_test.rs +++ b/enshrine-esdt-safe/tests/enshrine_esdt_safe_blackbox_test.rs @@ -30,6 +30,7 @@ const RECEIVER_ADDRESS: TestAddress = TestAddress::new("receiver"); const NFT_TOKEN_ID: TestTokenIdentifier = TestTokenIdentifier::new("NFT-123456"); const FUNGIBLE_TOKEN_ID: TestTokenIdentifier = TestTokenIdentifier::new("CROWD-123456"); +const PREFIX_NFT_TOKEN_ID: TestTokenIdentifier = TestTokenIdentifier::new("SOV-NFT-123456"); fn world() -> ScenarioWorld { let mut blockchain = ScenarioWorld::new(); @@ -107,8 +108,12 @@ impl EnshrineTestState { self } - fn propose_execute_operation(&mut self) { - let (tokens, data) = self.setup_payments(vec![NFT_TOKEN_ID, FUNGIBLE_TOKEN_ID]); + fn propose_execute_operation(&mut self, has_prefix: bool) { + let (tokens, data) = if has_prefix { + self.setup_payments(vec![PREFIX_NFT_TOKEN_ID, FUNGIBLE_TOKEN_ID]) + } else { + self.setup_payments(vec![NFT_TOKEN_ID, FUNGIBLE_TOKEN_ID]) + }; let to = managed_address!(&Address::from(&RECEIVER_ADDRESS.eval_to_array())); let operation = Operation { to, tokens, data }; let operation_hash = self.get_operation_hash(&operation); @@ -144,8 +149,12 @@ impl EnshrineTestState { .run(); } - fn propose_register_operation(&mut self) { - let (tokens, data) = self.setup_payments(vec![NFT_TOKEN_ID, FUNGIBLE_TOKEN_ID]); + fn propose_register_operation(&mut self, has_prefix: bool) { + let (tokens, data) = if has_prefix { + self.setup_payments(vec![PREFIX_NFT_TOKEN_ID, FUNGIBLE_TOKEN_ID]) + } else { + self.setup_payments(vec![NFT_TOKEN_ID, FUNGIBLE_TOKEN_ID]) + }; let to = managed_address!(&Address::from(RECEIVER_ADDRESS.eval_to_array())); let operation = Operation { to, tokens, data }; let operation_hash = self.get_operation_hash(&operation); @@ -226,10 +235,19 @@ fn test_deploy() { } #[test] -fn test_sovereign_prefix() { +fn test_sovereign_prefix_no_prefix() { let mut state = EnshrineTestState::new(); state.propose_setup_contracts(false); - state.propose_register_operation(); - state.propose_execute_operation(); + state.propose_register_operation(false); + state.propose_execute_operation(false); } + +// #[test] +// fn test_sovereign_prefix_has_prefix() { +// let mut state = EnshrineTestState::new(); +// +// state.propose_setup_contracts(false); +// state.propose_register_operation(true); +// state.propose_execute_operation(true); +// } From ec7ce342ffa34e78231a0f37a4110f82beafd200 Mon Sep 17 00:00:00 2001 From: Andrei Baltariu Date: Thu, 27 Jun 2024 13:35:44 +0300 Subject: [PATCH 056/523] Fixed failing test --- .../tests/enshrine_esdt_safe_blackbox_test.rs | 52 ++++++++++++------- 1 file changed, 34 insertions(+), 18 deletions(-) diff --git a/enshrine-esdt-safe/tests/enshrine_esdt_safe_blackbox_test.rs b/enshrine-esdt-safe/tests/enshrine_esdt_safe_blackbox_test.rs index 6b5b11c3..e69e72ba 100644 --- a/enshrine-esdt-safe/tests/enshrine_esdt_safe_blackbox_test.rs +++ b/enshrine-esdt-safe/tests/enshrine_esdt_safe_blackbox_test.rs @@ -9,7 +9,7 @@ use multiversx_sc::types::{ use multiversx_sc_scenario::api::StaticApi; use multiversx_sc_scenario::multiversx_chain_vm::crypto_functions::sha256; use multiversx_sc_scenario::{imports::MxscPath, ScenarioWorld}; -use multiversx_sc_scenario::{managed_address, ScenarioTxRun}; +use multiversx_sc_scenario::{managed_address, ExpectError, ScenarioTxRun}; use transaction::{ Operation, OperationData, OperationEsdtPayment, StolenFromFrameworkEsdtTokenData, }; @@ -108,7 +108,7 @@ impl EnshrineTestState { self } - fn propose_execute_operation(&mut self, has_prefix: bool) { + fn propose_execute_operation(&mut self, has_prefix: bool, error_msg: Option<&str>) { let (tokens, data) = if has_prefix { self.setup_payments(vec![PREFIX_NFT_TOKEN_ID, FUNGIBLE_TOKEN_ID]) } else { @@ -120,13 +120,28 @@ impl EnshrineTestState { let hash_of_hashes: ManagedBuffer = ManagedBuffer::from(&sha256(&operation_hash.to_vec())); - self.world - .tx() - .from(USER_ADDRESS) - .to(ENSHRINE_ESDT_ADDRESS) - .typed(enshrine_esdt_safe_proxy::EnshrineEsdtSafeProxy) - .execute_operations(hash_of_hashes, operation) - .run(); + match error_msg { + Some(msg) => { + self.world + .tx() + .from(USER_ADDRESS) + .to(ENSHRINE_ESDT_ADDRESS) + .typed(enshrine_esdt_safe_proxy::EnshrineEsdtSafeProxy) + .execute_operations(hash_of_hashes, operation) + .returns(ExpectError(10, msg)) + .run(); + } + + None => { + self.world + .tx() + .from(USER_ADDRESS) + .to(ENSHRINE_ESDT_ADDRESS) + .typed(enshrine_esdt_safe_proxy::EnshrineEsdtSafeProxy) + .execute_operations(hash_of_hashes, operation) + .run(); + } + } } fn propose_set_unpaused(&mut self) { @@ -240,14 +255,15 @@ fn test_sovereign_prefix_no_prefix() { state.propose_setup_contracts(false); state.propose_register_operation(false); - state.propose_execute_operation(false); + state.propose_execute_operation(false, None); } -// #[test] -// fn test_sovereign_prefix_has_prefix() { -// let mut state = EnshrineTestState::new(); -// -// state.propose_setup_contracts(false); -// state.propose_register_operation(true); -// state.propose_execute_operation(true); -// } +#[test] +fn test_sovereign_prefix_has_prefix() { + let mut state = EnshrineTestState::new(); + let error_message = "action is not allowed"; + + state.propose_setup_contracts(false); + state.propose_register_operation(true); + state.propose_execute_operation(true, Some(error_message)); +} From 14e326f93194bd2a8c3a1a9486f45cecf8a3cd31 Mon Sep 17 00:00:00 2001 From: Andrei Baltariu Date: Fri, 28 Jun 2024 12:40:42 +0300 Subject: [PATCH 057/523] Added mapper and inline function --- .../src/from_sovereign/transfer_tokens.rs | 20 ++++++++++++++++++- .../tests/enshrine_esdt_safe_blackbox_test.rs | 2 +- 2 files changed, 20 insertions(+), 2 deletions(-) diff --git a/enshrine-esdt-safe/src/from_sovereign/transfer_tokens.rs b/enshrine-esdt-safe/src/from_sovereign/transfer_tokens.rs index 3bdd37ec..349b65c5 100644 --- a/enshrine-esdt-safe/src/from_sovereign/transfer_tokens.rs +++ b/enshrine-esdt-safe/src/from_sovereign/transfer_tokens.rs @@ -45,18 +45,26 @@ pub trait TransferTokensModule: self.distribute_payments(hash_of_hashes, operation_tuple, minted_operation_tokens); } + //TODO: register_token payable endpoint + fn mint_tokens( &self, operation_tokens: &ManagedVec>, ) -> ManagedVec> { let mut output_payments = ManagedVec::new(); + let mut wegld_amount = 0; for operation_token in operation_tokens.iter() { - if !self.has_sov_token_prefix(&operation_token.token_identifier) { + // TODO: check WEGLD -> continue + let has_sov_token_prefix = self.has_sov_token_prefix(&operation_token.token_identifier); + + if !has_sov_token_prefix { output_payments.push(operation_token.clone()); continue; } + // TODO: check storage + subtract 0.05 WEGLD + let mut nonce = operation_token.token_nonce; if nonce == 0 { self.send().esdt_local_mint( @@ -111,6 +119,8 @@ pub trait TransferTokensModule: }); } + // TODO: send remaining WEGLD to transfer_data.sender + output_payments } @@ -268,9 +278,17 @@ pub trait TransferTokensModule: } } + #[inline] + fn was_token_minted(&self, token_id: &TokenIdentifier) -> bool { + self.paid_issued_tokens().contains(token_id) + } + #[storage_mapper("pending_hashes")] fn pending_hashes(&self, hash_of_hashes: &ManagedBuffer) -> UnorderedSetMapper; #[storage_mapper("header_verifier_address")] fn header_verifier_address(&self) -> SingleValueMapper; + + #[storage_mapper("mintedTokens")] + fn paid_issued_tokens(&self) -> UnorderedSetMapper>; } diff --git a/enshrine-esdt-safe/tests/enshrine_esdt_safe_blackbox_test.rs b/enshrine-esdt-safe/tests/enshrine_esdt_safe_blackbox_test.rs index e69e72ba..4ddf09b5 100644 --- a/enshrine-esdt-safe/tests/enshrine_esdt_safe_blackbox_test.rs +++ b/enshrine-esdt-safe/tests/enshrine_esdt_safe_blackbox_test.rs @@ -30,7 +30,7 @@ const RECEIVER_ADDRESS: TestAddress = TestAddress::new("receiver"); const NFT_TOKEN_ID: TestTokenIdentifier = TestTokenIdentifier::new("NFT-123456"); const FUNGIBLE_TOKEN_ID: TestTokenIdentifier = TestTokenIdentifier::new("CROWD-123456"); -const PREFIX_NFT_TOKEN_ID: TestTokenIdentifier = TestTokenIdentifier::new("SOV-NFT-123456"); +const PREFIX_NFT_TOKEN_ID: TestTokenIdentifier = TestTokenIdentifier::new("sov-NFT-123456"); fn world() -> ScenarioWorld { let mut blockchain = ScenarioWorld::new(); From 36e870e28ef5414a5c8ba4cfde5e5e76e9f00b7a Mon Sep 17 00:00:00 2001 From: Andrei Baltariu Date: Fri, 28 Jun 2024 13:20:59 +0300 Subject: [PATCH 058/523] Modified mint to logic for wegld fee --- .../src/from_sovereign/transfer_tokens.rs | 33 ++++++++++++++++--- 1 file changed, 29 insertions(+), 4 deletions(-) diff --git a/enshrine-esdt-safe/src/from_sovereign/transfer_tokens.rs b/enshrine-esdt-safe/src/from_sovereign/transfer_tokens.rs index 349b65c5..10ca987c 100644 --- a/enshrine-esdt-safe/src/from_sovereign/transfer_tokens.rs +++ b/enshrine-esdt-safe/src/from_sovereign/transfer_tokens.rs @@ -7,6 +7,7 @@ use transaction::{GasLimit, Operation, OperationData, OperationEsdtPayment, Oper const CALLBACK_GAS: GasLimit = 10_000_000; // Increase if not enough const TRANSACTION_GAS: GasLimit = 30_000_000; +const WEGLD_ID: &str = "WEGLD-bd4d79"; #[multiversx_sc::module] pub trait TransferTokensModule: @@ -36,7 +37,8 @@ pub trait TransferTokensModule: sc_panic!("Operation is not registered"); } - let minted_operation_tokens = self.mint_tokens(&operation.tokens); + let minted_operation_tokens = + self.mint_tokens(&operation.data.op_sender, &operation.tokens); let operation_tuple = OperationTuple { op_hash: operation_hash, operation, @@ -46,16 +48,21 @@ pub trait TransferTokensModule: } //TODO: register_token payable endpoint + // require x amount wegld fn mint_tokens( &self, + sender: &ManagedAddress, operation_tokens: &ManagedVec>, ) -> ManagedVec> { let mut output_payments = ManagedVec::new(); - let mut wegld_amount = 0; + let mut wegld_amount = BigUint::from(0u32); for operation_token in operation_tokens.iter() { - // TODO: check WEGLD -> continue + if self.is_wegld_identifier(&operation_token.token_identifier) { + continue; + } + let has_sov_token_prefix = self.has_sov_token_prefix(&operation_token.token_identifier); if !has_sov_token_prefix { @@ -65,6 +72,12 @@ pub trait TransferTokensModule: // TODO: check storage + subtract 0.05 WEGLD + if self.was_token_minted(&operation_token.token_identifier) { + continue; + } + + wegld_amount += &operation_token.token_data.amount; + let mut nonce = operation_token.token_nonce; if nonce == 0 { self.send().esdt_local_mint( @@ -119,7 +132,14 @@ pub trait TransferTokensModule: }); } - // TODO: send remaining WEGLD to transfer_data.sender + let sc_address = self.blockchain().get_sc_address(); + let payment = EsdtTokenPayment::new(WEGLD_ID.into(), 0, wegld_amount); + + self.tx() + .from(sc_address) + .to(sender) + .esdt(payment) + .transfer(); output_payments } @@ -283,6 +303,11 @@ pub trait TransferTokensModule: self.paid_issued_tokens().contains(token_id) } + #[inline] + fn is_wegld_identifier(&self, token_id: &TokenIdentifier) -> bool { + token_id.eq(&TokenIdentifier::from(WEGLD_ID)) + } + #[storage_mapper("pending_hashes")] fn pending_hashes(&self, hash_of_hashes: &ManagedBuffer) -> UnorderedSetMapper; From d0aaea1a2f45161cb748a4b7bebb7dda5abecb36 Mon Sep 17 00:00:00 2001 From: Andrei Baltariu Date: Fri, 28 Jun 2024 13:51:31 +0300 Subject: [PATCH 059/523] Added register_tokens endpoint --- .../src/from_sovereign/transfer_tokens.rs | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/enshrine-esdt-safe/src/from_sovereign/transfer_tokens.rs b/enshrine-esdt-safe/src/from_sovereign/transfer_tokens.rs index 10ca987c..570af898 100644 --- a/enshrine-esdt-safe/src/from_sovereign/transfer_tokens.rs +++ b/enshrine-esdt-safe/src/from_sovereign/transfer_tokens.rs @@ -8,6 +8,7 @@ use transaction::{GasLimit, Operation, OperationData, OperationEsdtPayment, Oper const CALLBACK_GAS: GasLimit = 10_000_000; // Increase if not enough const TRANSACTION_GAS: GasLimit = 30_000_000; const WEGLD_ID: &str = "WEGLD-bd4d79"; +const DEFAULT_ISSUE_COST: u64 = 50000000000000000; #[multiversx_sc::module] pub trait TransferTokensModule: @@ -49,6 +50,20 @@ pub trait TransferTokensModule: //TODO: register_token payable endpoint // require x amount wegld + #[endpoint(registerTokens)] + #[payable("*")] + fn register_tokens(&self, tokens: MultiValueEncoded) { + let call_payment = self.call_value().single_esdt().clone(); + + require!( + call_payment.amount == DEFAULT_ISSUE_COST * tokens.len() as u64, + "WEGLD fee amount is not met" + ); + + for token in tokens { + self.paid_issued_tokens().insert(token); + } + } fn mint_tokens( &self, From 3f5de49eb451dce398669270813c57ab9b019a9f Mon Sep 17 00:00:00 2001 From: Andrei Baltariu Date: Fri, 28 Jun 2024 14:06:55 +0300 Subject: [PATCH 060/523] Modified wegld minting logic --- .../src/from_sovereign/transfer_tokens.rs | 27 ++++++++++--------- 1 file changed, 15 insertions(+), 12 deletions(-) diff --git a/enshrine-esdt-safe/src/from_sovereign/transfer_tokens.rs b/enshrine-esdt-safe/src/from_sovereign/transfer_tokens.rs index 570af898..3e9fa795 100644 --- a/enshrine-esdt-safe/src/from_sovereign/transfer_tokens.rs +++ b/enshrine-esdt-safe/src/from_sovereign/transfer_tokens.rs @@ -74,7 +74,9 @@ pub trait TransferTokensModule: let mut wegld_amount = BigUint::from(0u32); for operation_token in operation_tokens.iter() { - if self.is_wegld_identifier(&operation_token.token_identifier) { + // add amount of transferred WEGLD + if self.is_wegld(&operation_token.token_identifier) { + wegld_amount += &operation_token.token_data.amount; continue; } @@ -85,13 +87,12 @@ pub trait TransferTokensModule: continue; } - // TODO: check storage + subtract 0.05 WEGLD - if self.was_token_minted(&operation_token.token_identifier) { continue; } - wegld_amount += &operation_token.token_data.amount; + // subtract the issue cost + wegld_amount -= BigUint::from(DEFAULT_ISSUE_COST); let mut nonce = operation_token.token_nonce; if nonce == 0 { @@ -147,14 +148,16 @@ pub trait TransferTokensModule: }); } - let sc_address = self.blockchain().get_sc_address(); - let payment = EsdtTokenPayment::new(WEGLD_ID.into(), 0, wegld_amount); + if wegld_amount > 0 { + let sc_address = self.blockchain().get_sc_address(); + let payment = EsdtTokenPayment::new(WEGLD_ID.into(), 0, wegld_amount); - self.tx() - .from(sc_address) - .to(sender) - .esdt(payment) - .transfer(); + self.tx() + .from(sc_address) + .to(sender) + .esdt(payment) + .transfer(); + } output_payments } @@ -319,7 +322,7 @@ pub trait TransferTokensModule: } #[inline] - fn is_wegld_identifier(&self, token_id: &TokenIdentifier) -> bool { + fn is_wegld(&self, token_id: &TokenIdentifier) -> bool { token_id.eq(&TokenIdentifier::from(WEGLD_ID)) } From 752673e0fc2cc871f42f64935262406d724f19a9 Mon Sep 17 00:00:00 2001 From: Andrei Baltariu Date: Fri, 28 Jun 2024 14:29:28 +0300 Subject: [PATCH 061/523] Added wegld require for register tokens endpoint --- enshrine-esdt-safe/src/from_sovereign/transfer_tokens.rs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/enshrine-esdt-safe/src/from_sovereign/transfer_tokens.rs b/enshrine-esdt-safe/src/from_sovereign/transfer_tokens.rs index 3e9fa795..ae8b84dd 100644 --- a/enshrine-esdt-safe/src/from_sovereign/transfer_tokens.rs +++ b/enshrine-esdt-safe/src/from_sovereign/transfer_tokens.rs @@ -55,6 +55,11 @@ pub trait TransferTokensModule: fn register_tokens(&self, tokens: MultiValueEncoded) { let call_payment = self.call_value().single_esdt().clone(); + require!( + call_payment.token_identifier == TokenIdentifier::from(WEGLD_ID), + "WEGLD is the only token accepted as register fee" + ); + require!( call_payment.amount == DEFAULT_ISSUE_COST * tokens.len() as u64, "WEGLD fee amount is not met" From 43e896c2a3fd7151cc6bd89f55a70e4d854f84aa Mon Sep 17 00:00:00 2001 From: Andrei Baltariu Date: Fri, 28 Jun 2024 15:48:43 +0300 Subject: [PATCH 062/523] Added wegld fee functions + reverted mint_tokens --- .../src/from_sovereign/transfer_tokens.rs | 74 +++++++++++-------- 1 file changed, 42 insertions(+), 32 deletions(-) diff --git a/enshrine-esdt-safe/src/from_sovereign/transfer_tokens.rs b/enshrine-esdt-safe/src/from_sovereign/transfer_tokens.rs index ae8b84dd..c9c004d2 100644 --- a/enshrine-esdt-safe/src/from_sovereign/transfer_tokens.rs +++ b/enshrine-esdt-safe/src/from_sovereign/transfer_tokens.rs @@ -38,8 +38,7 @@ pub trait TransferTokensModule: sc_panic!("Operation is not registered"); } - let minted_operation_tokens = - self.mint_tokens(&operation.data.op_sender, &operation.tokens); + let minted_operation_tokens = self.mint_tokens(&operation.tokens); let operation_tuple = OperationTuple { op_hash: operation_hash, operation, @@ -70,35 +69,58 @@ pub trait TransferTokensModule: } } + fn calculate_wegld_fee( + &self, + tokens: ManagedVec>, + ) -> ManagedVec> { + if tokens.len() == 1 { + return tokens; + } + + let wegld_payment = tokens.get(0); + + let mut checked_tokens = tokens.clone(); + let initial_wegld_amount = wegld_payment.token_data.amount; + let mut wegld_amount = initial_wegld_amount.clone(); + + checked_tokens.remove(0); + + for token in checked_tokens.iter() { + if !self.was_token_minted(&token.token_identifier) { + wegld_amount -= token.token_data.amount; + } + } + + if wegld_amount == initial_wegld_amount { + return tokens; + } + + checked_tokens + } + + fn sendback_wegld(&self, sender: &ManagedAddress, wegld_amount: BigUint) { + let sc_address = self.blockchain().get_sc_address(); + let payment = EsdtTokenPayment::new(WEGLD_ID.into(), 0, wegld_amount); + + self.tx() + .from(sc_address) + .to(sender) + .esdt(payment) + .transfer(); + } + fn mint_tokens( &self, - sender: &ManagedAddress, operation_tokens: &ManagedVec>, ) -> ManagedVec> { let mut output_payments = ManagedVec::new(); - let mut wegld_amount = BigUint::from(0u32); for operation_token in operation_tokens.iter() { - // add amount of transferred WEGLD - if self.is_wegld(&operation_token.token_identifier) { - wegld_amount += &operation_token.token_data.amount; - continue; - } - - let has_sov_token_prefix = self.has_sov_token_prefix(&operation_token.token_identifier); - - if !has_sov_token_prefix { + if !self.has_sov_token_prefix(&operation_token.token_identifier) { output_payments.push(operation_token.clone()); continue; } - if self.was_token_minted(&operation_token.token_identifier) { - continue; - } - - // subtract the issue cost - wegld_amount -= BigUint::from(DEFAULT_ISSUE_COST); - let mut nonce = operation_token.token_nonce; if nonce == 0 { self.send().esdt_local_mint( @@ -153,20 +175,8 @@ pub trait TransferTokensModule: }); } - if wegld_amount > 0 { - let sc_address = self.blockchain().get_sc_address(); - let payment = EsdtTokenPayment::new(WEGLD_ID.into(), 0, wegld_amount); - - self.tx() - .from(sc_address) - .to(sender) - .esdt(payment) - .transfer(); - } - output_payments } - fn distribute_payments( &self, hash_of_hashes: ManagedBuffer, From a05a8293ef2c59d57c2e92bd5ffd6ddef92b977a Mon Sep 17 00:00:00 2001 From: Andrei Baltariu Date: Fri, 28 Jun 2024 15:58:45 +0300 Subject: [PATCH 063/523] Modified execute endpoint for wegld fee implementation --- .../src/from_sovereign/transfer_tokens.rs | 28 +++++++++++-------- 1 file changed, 17 insertions(+), 11 deletions(-) diff --git a/enshrine-esdt-safe/src/from_sovereign/transfer_tokens.rs b/enshrine-esdt-safe/src/from_sovereign/transfer_tokens.rs index c9c004d2..7cbf57d4 100644 --- a/enshrine-esdt-safe/src/from_sovereign/transfer_tokens.rs +++ b/enshrine-esdt-safe/src/from_sovereign/transfer_tokens.rs @@ -38,12 +38,16 @@ pub trait TransferTokensModule: sc_panic!("Operation is not registered"); } - let minted_operation_tokens = self.mint_tokens(&operation.tokens); + let (wegld_amount, checked_tokens) = self.calculate_wegld_fee(&operation.tokens); + + let minted_operation_tokens = self.mint_tokens(&checked_tokens); let operation_tuple = OperationTuple { op_hash: operation_hash, - operation, + operation: operation.clone(), }; + self.refund_wegld(&operation.data.op_sender, wegld_amount); + self.distribute_payments(hash_of_hashes, operation_tuple, minted_operation_tokens); } @@ -71,16 +75,18 @@ pub trait TransferTokensModule: fn calculate_wegld_fee( &self, - tokens: ManagedVec>, - ) -> ManagedVec> { + tokens: &ManagedVec>, + ) -> ( + BigUint, + ManagedVec>, + ) { + let wegld_payment = tokens.get(0); if tokens.len() == 1 { - return tokens; + return (wegld_payment.token_data.amount, tokens.clone()); } - let wegld_payment = tokens.get(0); - let mut checked_tokens = tokens.clone(); - let initial_wegld_amount = wegld_payment.token_data.amount; + let initial_wegld_amount = wegld_payment.token_data.amount.clone(); let mut wegld_amount = initial_wegld_amount.clone(); checked_tokens.remove(0); @@ -92,13 +98,13 @@ pub trait TransferTokensModule: } if wegld_amount == initial_wegld_amount { - return tokens; + return (wegld_payment.token_data.amount, tokens.clone()); } - checked_tokens + (wegld_amount, checked_tokens) } - fn sendback_wegld(&self, sender: &ManagedAddress, wegld_amount: BigUint) { + fn refund_wegld(&self, sender: &ManagedAddress, wegld_amount: BigUint) { let sc_address = self.blockchain().get_sc_address(); let payment = EsdtTokenPayment::new(WEGLD_ID.into(), 0, wegld_amount); From 1a77a326395232c1ee3be181e2f0c0716283d8d6 Mon Sep 17 00:00:00 2001 From: Andrei Baltariu Date: Fri, 28 Jun 2024 15:59:57 +0300 Subject: [PATCH 064/523] Regenerated proxy --- enshrine-esdt-safe/src/enshrine_esdt_safe_proxy.rs | 12 ++++++++++++ .../wasm-enshrine-esdt-safe-full/src/lib.rs | 5 +++-- enshrine-esdt-safe/wasm/src/lib.rs | 5 +++-- 3 files changed, 18 insertions(+), 4 deletions(-) diff --git a/enshrine-esdt-safe/src/enshrine_esdt_safe_proxy.rs b/enshrine-esdt-safe/src/enshrine_esdt_safe_proxy.rs index bab658db..dc562369 100644 --- a/enshrine-esdt-safe/src/enshrine_esdt_safe_proxy.rs +++ b/enshrine-esdt-safe/src/enshrine_esdt_safe_proxy.rs @@ -181,6 +181,18 @@ where .original_result() } + pub fn register_tokens< + Arg0: ProxyArg>>, + >( + self, + tokens: Arg0, + ) -> TxTypedCall { + self.wrapped_tx + .raw_call("registerTokens") + .argument(&tokens) + .original_result() + } + pub fn set_max_tx_batch_size< Arg0: ProxyArg, >( diff --git a/enshrine-esdt-safe/wasm-enshrine-esdt-safe-full/src/lib.rs b/enshrine-esdt-safe/wasm-enshrine-esdt-safe-full/src/lib.rs index 2c4ffaed..08014062 100644 --- a/enshrine-esdt-safe/wasm-enshrine-esdt-safe-full/src/lib.rs +++ b/enshrine-esdt-safe/wasm-enshrine-esdt-safe-full/src/lib.rs @@ -6,10 +6,10 @@ // Init: 1 // Upgrade: 1 -// Endpoints: 27 +// Endpoints: 28 // Async Callback: 1 // Promise callbacks: 1 -// Total number of exported functions: 31 +// Total number of exported functions: 32 #![no_std] @@ -28,6 +28,7 @@ multiversx_sc_wasm_adapter::endpoints! { addSigners => add_signers removeSigners => remove_signers executeBridgeOps => execute_operations + registerTokens => register_tokens setMaxTxBatchSize => set_max_tx_batch_size setMaxTxBatchBlockDuration => set_max_tx_batch_block_duration getCurrentTxBatch => get_current_tx_batch diff --git a/enshrine-esdt-safe/wasm/src/lib.rs b/enshrine-esdt-safe/wasm/src/lib.rs index 2c4ffaed..08014062 100644 --- a/enshrine-esdt-safe/wasm/src/lib.rs +++ b/enshrine-esdt-safe/wasm/src/lib.rs @@ -6,10 +6,10 @@ // Init: 1 // Upgrade: 1 -// Endpoints: 27 +// Endpoints: 28 // Async Callback: 1 // Promise callbacks: 1 -// Total number of exported functions: 31 +// Total number of exported functions: 32 #![no_std] @@ -28,6 +28,7 @@ multiversx_sc_wasm_adapter::endpoints! { addSigners => add_signers removeSigners => remove_signers executeBridgeOps => execute_operations + registerTokens => register_tokens setMaxTxBatchSize => set_max_tx_batch_size setMaxTxBatchBlockDuration => set_max_tx_batch_block_duration getCurrentTxBatch => get_current_tx_batch From 139528f9dd972ea9202143f789983e65c38a7a15 Mon Sep 17 00:00:00 2001 From: Andrei Baltariu Date: Mon, 1 Jul 2024 11:40:50 +0300 Subject: [PATCH 065/523] Removed from() in refund_wegld function --- enshrine-esdt-safe/src/from_sovereign/transfer_tokens.rs | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/enshrine-esdt-safe/src/from_sovereign/transfer_tokens.rs b/enshrine-esdt-safe/src/from_sovereign/transfer_tokens.rs index 7cbf57d4..b16348a0 100644 --- a/enshrine-esdt-safe/src/from_sovereign/transfer_tokens.rs +++ b/enshrine-esdt-safe/src/from_sovereign/transfer_tokens.rs @@ -105,14 +105,9 @@ pub trait TransferTokensModule: } fn refund_wegld(&self, sender: &ManagedAddress, wegld_amount: BigUint) { - let sc_address = self.blockchain().get_sc_address(); let payment = EsdtTokenPayment::new(WEGLD_ID.into(), 0, wegld_amount); - self.tx() - .from(sc_address) - .to(sender) - .esdt(payment) - .transfer(); + self.tx().to(sender).esdt(payment).transfer(); } fn mint_tokens( From 4a9db9fa7255537c9427101dcd01eef175b3e9d9 Mon Sep 17 00:00:00 2001 From: Andrei Baltariu Date: Mon, 1 Jul 2024 11:55:38 +0300 Subject: [PATCH 066/523] Added wegld_ticker storage mapper --- enshrine-esdt-safe/src/common/storage.rs | 3 +++ enshrine-esdt-safe/src/lib.rs | 6 ++++++ 2 files changed, 9 insertions(+) diff --git a/enshrine-esdt-safe/src/common/storage.rs b/enshrine-esdt-safe/src/common/storage.rs index c17ff108..b1e60e04 100644 --- a/enshrine-esdt-safe/src/common/storage.rs +++ b/enshrine-esdt-safe/src/common/storage.rs @@ -4,4 +4,7 @@ use multiversx_sc::imports::*; pub trait CommonStorage { #[storage_mapper("isSovereignChain")] fn is_sovereign_chain(&self) -> SingleValueMapper; + + #[storage_mapper("wegldTicker")] + fn wegld_ticker(&self) -> SingleValueMapper; } diff --git a/enshrine-esdt-safe/src/lib.rs b/enshrine-esdt-safe/src/lib.rs index 260e0159..2a8034d7 100644 --- a/enshrine-esdt-safe/src/lib.rs +++ b/enshrine-esdt-safe/src/lib.rs @@ -45,6 +45,12 @@ pub trait EnshrineEsdtSafe: self.header_verifier_address().set(&header_verifier_address); } + #[only_owner] + #[endpoint(setWegldTicker)] + fn set_wegld_ticker(&self, wegld_ticker: ManagedBuffer) { + self.wegld_ticker().set(wegld_ticker); + } + #[upgrade] fn upgrade(&self) {} } From fd7ece4b1957dc6324e019f8ea92b82446a828aa Mon Sep 17 00:00:00 2001 From: Andrei Baltariu Date: Mon, 1 Jul 2024 11:57:51 +0300 Subject: [PATCH 067/523] Modified wegld mapper to save TokenIdentifier --- enshrine-esdt-safe/src/common/storage.rs | 2 +- enshrine-esdt-safe/src/lib.rs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/enshrine-esdt-safe/src/common/storage.rs b/enshrine-esdt-safe/src/common/storage.rs index b1e60e04..30abc29c 100644 --- a/enshrine-esdt-safe/src/common/storage.rs +++ b/enshrine-esdt-safe/src/common/storage.rs @@ -6,5 +6,5 @@ pub trait CommonStorage { fn is_sovereign_chain(&self) -> SingleValueMapper; #[storage_mapper("wegldTicker")] - fn wegld_ticker(&self) -> SingleValueMapper; + fn wegld_ticker(&self) -> SingleValueMapper; } diff --git a/enshrine-esdt-safe/src/lib.rs b/enshrine-esdt-safe/src/lib.rs index 2a8034d7..25300ccd 100644 --- a/enshrine-esdt-safe/src/lib.rs +++ b/enshrine-esdt-safe/src/lib.rs @@ -48,7 +48,7 @@ pub trait EnshrineEsdtSafe: #[only_owner] #[endpoint(setWegldTicker)] fn set_wegld_ticker(&self, wegld_ticker: ManagedBuffer) { - self.wegld_ticker().set(wegld_ticker); + self.wegld_ticker().set(TokenIdentifier::from(wegld_ticker)); } #[upgrade] From 04431bffc95523063ff50a86e0cba0d95e643181 Mon Sep 17 00:00:00 2001 From: Andrei Baltariu Date: Mon, 1 Jul 2024 12:53:36 +0300 Subject: [PATCH 068/523] Renamed wegld mapper --- enshrine-esdt-safe/src/common/storage.rs | 2 +- enshrine-esdt-safe/src/from_sovereign/transfer_tokens.rs | 3 ++- enshrine-esdt-safe/src/lib.rs | 3 ++- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/enshrine-esdt-safe/src/common/storage.rs b/enshrine-esdt-safe/src/common/storage.rs index 30abc29c..0c29794d 100644 --- a/enshrine-esdt-safe/src/common/storage.rs +++ b/enshrine-esdt-safe/src/common/storage.rs @@ -6,5 +6,5 @@ pub trait CommonStorage { fn is_sovereign_chain(&self) -> SingleValueMapper; #[storage_mapper("wegldTicker")] - fn wegld_ticker(&self) -> SingleValueMapper; + fn wegld_identifier(&self) -> SingleValueMapper; } diff --git a/enshrine-esdt-safe/src/from_sovereign/transfer_tokens.rs b/enshrine-esdt-safe/src/from_sovereign/transfer_tokens.rs index b16348a0..6200d5e7 100644 --- a/enshrine-esdt-safe/src/from_sovereign/transfer_tokens.rs +++ b/enshrine-esdt-safe/src/from_sovereign/transfer_tokens.rs @@ -339,7 +339,8 @@ pub trait TransferTokensModule: #[inline] fn is_wegld(&self, token_id: &TokenIdentifier) -> bool { - token_id.eq(&TokenIdentifier::from(WEGLD_ID)) + let wegld_identifier = self.wegld_identifier().get(); + token_id.eq(&wegld_identifier) } #[storage_mapper("pending_hashes")] diff --git a/enshrine-esdt-safe/src/lib.rs b/enshrine-esdt-safe/src/lib.rs index 25300ccd..ceac4fee 100644 --- a/enshrine-esdt-safe/src/lib.rs +++ b/enshrine-esdt-safe/src/lib.rs @@ -48,7 +48,8 @@ pub trait EnshrineEsdtSafe: #[only_owner] #[endpoint(setWegldTicker)] fn set_wegld_ticker(&self, wegld_ticker: ManagedBuffer) { - self.wegld_ticker().set(TokenIdentifier::from(wegld_ticker)); + self.wegld_identifier() + .set(TokenIdentifier::from(wegld_ticker)); } #[upgrade] From a9bdc9f75313ee62995b2a99480134d225cc1986 Mon Sep 17 00:00:00 2001 From: Andrei Baltariu Date: Mon, 1 Jul 2024 12:55:40 +0300 Subject: [PATCH 069/523] Removed any use of wegld identifier constant --- enshrine-esdt-safe/src/from_sovereign/transfer_tokens.rs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/enshrine-esdt-safe/src/from_sovereign/transfer_tokens.rs b/enshrine-esdt-safe/src/from_sovereign/transfer_tokens.rs index 6200d5e7..f6c07195 100644 --- a/enshrine-esdt-safe/src/from_sovereign/transfer_tokens.rs +++ b/enshrine-esdt-safe/src/from_sovereign/transfer_tokens.rs @@ -7,7 +7,6 @@ use transaction::{GasLimit, Operation, OperationData, OperationEsdtPayment, Oper const CALLBACK_GAS: GasLimit = 10_000_000; // Increase if not enough const TRANSACTION_GAS: GasLimit = 30_000_000; -const WEGLD_ID: &str = "WEGLD-bd4d79"; const DEFAULT_ISSUE_COST: u64 = 50000000000000000; #[multiversx_sc::module] @@ -57,9 +56,10 @@ pub trait TransferTokensModule: #[payable("*")] fn register_tokens(&self, tokens: MultiValueEncoded) { let call_payment = self.call_value().single_esdt().clone(); + let wegld_identifier = self.wegld_identifier().get(); require!( - call_payment.token_identifier == TokenIdentifier::from(WEGLD_ID), + call_payment.token_identifier == wegld_identifier, "WEGLD is the only token accepted as register fee" ); @@ -105,7 +105,8 @@ pub trait TransferTokensModule: } fn refund_wegld(&self, sender: &ManagedAddress, wegld_amount: BigUint) { - let payment = EsdtTokenPayment::new(WEGLD_ID.into(), 0, wegld_amount); + let wegld_identifier = self.wegld_identifier().get(); + let payment = EsdtTokenPayment::new(wegld_identifier, 0, wegld_amount); self.tx().to(sender).esdt(payment).transfer(); } From d8124c252b05adcc57f20b8f07fad79d4c0ccaa9 Mon Sep 17 00:00:00 2001 From: Andrei Baltariu Date: Mon, 1 Jul 2024 13:23:40 +0300 Subject: [PATCH 070/523] Regenerated enshrine proxy --- enshrine-esdt-safe/src/enshrine_esdt_safe_proxy.rs | 13 +++++++++++++ .../wasm-enshrine-esdt-safe-full/src/lib.rs | 5 +++-- enshrine-esdt-safe/wasm/src/lib.rs | 5 +++-- 3 files changed, 19 insertions(+), 4 deletions(-) diff --git a/enshrine-esdt-safe/src/enshrine_esdt_safe_proxy.rs b/enshrine-esdt-safe/src/enshrine_esdt_safe_proxy.rs index dc562369..d4ba8092 100644 --- a/enshrine-esdt-safe/src/enshrine_esdt_safe_proxy.rs +++ b/enshrine-esdt-safe/src/enshrine_esdt_safe_proxy.rs @@ -111,6 +111,19 @@ where .original_result() } + pub fn set_wegld_ticker< + Arg0: ProxyArg>, + >( + self, + wegld_ticker: Arg0, + ) -> TxTypedCall { + self.wrapped_tx + .payment(NotPayable) + .raw_call("setWegldTicker") + .argument(&wegld_ticker) + .original_result() + } + pub fn deposit< Arg0: ProxyArg>, Arg1: ProxyArg, ManagedVec>>>>, diff --git a/enshrine-esdt-safe/wasm-enshrine-esdt-safe-full/src/lib.rs b/enshrine-esdt-safe/wasm-enshrine-esdt-safe-full/src/lib.rs index 08014062..ab0809b6 100644 --- a/enshrine-esdt-safe/wasm-enshrine-esdt-safe-full/src/lib.rs +++ b/enshrine-esdt-safe/wasm-enshrine-esdt-safe-full/src/lib.rs @@ -6,10 +6,10 @@ // Init: 1 // Upgrade: 1 -// Endpoints: 28 +// Endpoints: 29 // Async Callback: 1 // Promise callbacks: 1 -// Total number of exported functions: 32 +// Total number of exported functions: 33 #![no_std] @@ -23,6 +23,7 @@ multiversx_sc_wasm_adapter::endpoints! { upgrade => upgrade setFeeMarketAddress => set_fee_market_address setHeaderVerifierAddress => set_header_verifier_address + setWegldTicker => set_wegld_ticker deposit => deposit setMinValidSigners => set_min_valid_signers addSigners => add_signers diff --git a/enshrine-esdt-safe/wasm/src/lib.rs b/enshrine-esdt-safe/wasm/src/lib.rs index 08014062..ab0809b6 100644 --- a/enshrine-esdt-safe/wasm/src/lib.rs +++ b/enshrine-esdt-safe/wasm/src/lib.rs @@ -6,10 +6,10 @@ // Init: 1 // Upgrade: 1 -// Endpoints: 28 +// Endpoints: 29 // Async Callback: 1 // Promise callbacks: 1 -// Total number of exported functions: 32 +// Total number of exported functions: 33 #![no_std] @@ -23,6 +23,7 @@ multiversx_sc_wasm_adapter::endpoints! { upgrade => upgrade setFeeMarketAddress => set_fee_market_address setHeaderVerifierAddress => set_header_verifier_address + setWegldTicker => set_wegld_ticker deposit => deposit setMinValidSigners => set_min_valid_signers addSigners => add_signers From 79add8fae4f10101239ce45d6c586d5eab95bd45 Mon Sep 17 00:00:00 2001 From: Andrei Baltariu Date: Mon, 1 Jul 2024 15:06:28 +0300 Subject: [PATCH 071/523] Renamed wegld method and modified logic --- .../src/from_sovereign/transfer_tokens.rs | 31 ++++++++++++------- 1 file changed, 19 insertions(+), 12 deletions(-) diff --git a/enshrine-esdt-safe/src/from_sovereign/transfer_tokens.rs b/enshrine-esdt-safe/src/from_sovereign/transfer_tokens.rs index f6c07195..854924d5 100644 --- a/enshrine-esdt-safe/src/from_sovereign/transfer_tokens.rs +++ b/enshrine-esdt-safe/src/from_sovereign/transfer_tokens.rs @@ -37,7 +37,8 @@ pub trait TransferTokensModule: sc_panic!("Operation is not registered"); } - let (wegld_amount, checked_tokens) = self.calculate_wegld_fee(&operation.tokens); + let (wegld_amount, checked_tokens) = + self.check_tokens_for_wegld_fee(operation.tokens.clone()); let minted_operation_tokens = self.mint_tokens(&checked_tokens); let operation_tuple = OperationTuple { @@ -73,32 +74,33 @@ pub trait TransferTokensModule: } } - fn calculate_wegld_fee( + fn check_tokens_for_wegld_fee( &self, - tokens: &ManagedVec>, + tokens: ManagedVec>, ) -> ( BigUint, ManagedVec>, ) { let wegld_payment = tokens.get(0); - if tokens.len() == 1 { - return (wegld_payment.token_data.amount, tokens.clone()); + let mut checked_tokens = tokens.clone(); + + if checked_tokens.len() == 1 { + return (wegld_payment.token_data.amount, checked_tokens); } - let mut checked_tokens = tokens.clone(); - let initial_wegld_amount = wegld_payment.token_data.amount.clone(); - let mut wegld_amount = initial_wegld_amount.clone(); + let mut wegld_amount = wegld_payment.token_data.amount.clone(); checked_tokens.remove(0); for token in checked_tokens.iter() { - if !self.was_token_minted(&token.token_identifier) { + if !self.was_token_registered(&token.token_identifier) { wegld_amount -= token.token_data.amount; + self.register_token(token.token_identifier); } } - if wegld_amount == initial_wegld_amount { - return (wegld_payment.token_data.amount, tokens.clone()); + if wegld_amount == wegld_payment.token_data.amount { + return (wegld_amount, tokens); } (wegld_amount, checked_tokens) @@ -334,10 +336,15 @@ pub trait TransferTokensModule: } #[inline] - fn was_token_minted(&self, token_id: &TokenIdentifier) -> bool { + fn was_token_registered(&self, token_id: &TokenIdentifier) -> bool { self.paid_issued_tokens().contains(token_id) } + #[inline] + fn register_token(&self, token_id: TokenIdentifier) { + self.paid_issued_tokens().insert(token_id); + } + #[inline] fn is_wegld(&self, token_id: &TokenIdentifier) -> bool { let wegld_identifier = self.wegld_identifier().get(); From 12d9950d7f33000884b8525958d7d5f5e915d360 Mon Sep 17 00:00:00 2001 From: Andrei Baltariu Date: Tue, 2 Jul 2024 12:28:02 +0300 Subject: [PATCH 072/523] Fixed comments --- enshrine-esdt-safe/src/common/storage.rs | 2 +- .../src/from_sovereign/transfer_tokens.rs | 10 +++++----- enshrine-esdt-safe/src/lib.rs | 7 +++++++ 3 files changed, 13 insertions(+), 6 deletions(-) diff --git a/enshrine-esdt-safe/src/common/storage.rs b/enshrine-esdt-safe/src/common/storage.rs index 0c29794d..3857e6a1 100644 --- a/enshrine-esdt-safe/src/common/storage.rs +++ b/enshrine-esdt-safe/src/common/storage.rs @@ -5,6 +5,6 @@ pub trait CommonStorage { #[storage_mapper("isSovereignChain")] fn is_sovereign_chain(&self) -> SingleValueMapper; - #[storage_mapper("wegldTicker")] + #[storage_mapper("wegldIdentifier")] fn wegld_identifier(&self) -> SingleValueMapper; } diff --git a/enshrine-esdt-safe/src/from_sovereign/transfer_tokens.rs b/enshrine-esdt-safe/src/from_sovereign/transfer_tokens.rs index 854924d5..2cff837a 100644 --- a/enshrine-esdt-safe/src/from_sovereign/transfer_tokens.rs +++ b/enshrine-esdt-safe/src/from_sovereign/transfer_tokens.rs @@ -23,8 +23,10 @@ pub trait TransferTokensModule: { #[endpoint(executeBridgeOps)] fn execute_operations(&self, hash_of_hashes: ManagedBuffer, operation: Operation) { + let is_sovereign_chain = self.is_sovereign_chain().get(); + require!( - !self.is_sovereign_chain().get(), + !is_sovereign_chain, "Invalid method to call in current chain" ); @@ -51,8 +53,6 @@ pub trait TransferTokensModule: self.distribute_payments(hash_of_hashes, operation_tuple, minted_operation_tokens); } - //TODO: register_token payable endpoint - // require x amount wegld #[endpoint(registerTokens)] #[payable("*")] fn register_tokens(&self, tokens: MultiValueEncoded) { @@ -69,8 +69,8 @@ pub trait TransferTokensModule: "WEGLD fee amount is not met" ); - for token in tokens { - self.paid_issued_tokens().insert(token); + for token_id in tokens { + self.register_token(token_id); } } diff --git a/enshrine-esdt-safe/src/lib.rs b/enshrine-esdt-safe/src/lib.rs index ceac4fee..b8bf4b8e 100644 --- a/enshrine-esdt-safe/src/lib.rs +++ b/enshrine-esdt-safe/src/lib.rs @@ -48,6 +48,13 @@ pub trait EnshrineEsdtSafe: #[only_owner] #[endpoint(setWegldTicker)] fn set_wegld_ticker(&self, wegld_ticker: ManagedBuffer) { + let is_sovereign_chain = self.is_sovereign_chain().get(); + + require!( + is_sovereign_chain == true, + "WEGLD Identifier can be set only on Mainchain" + ); + self.wegld_identifier() .set(TokenIdentifier::from(wegld_ticker)); } From 51f855f1bcaa114988d8d8ee0bc0fa9c7602645b Mon Sep 17 00:00:00 2001 From: Andrei Baltariu Date: Tue, 2 Jul 2024 13:58:01 +0300 Subject: [PATCH 073/523] Modified check for wegld fee function --- .../src/from_sovereign/transfer_tokens.rs | 39 +++++++++++++------ 1 file changed, 27 insertions(+), 12 deletions(-) diff --git a/enshrine-esdt-safe/src/from_sovereign/transfer_tokens.rs b/enshrine-esdt-safe/src/from_sovereign/transfer_tokens.rs index 2cff837a..e9dab0df 100644 --- a/enshrine-esdt-safe/src/from_sovereign/transfer_tokens.rs +++ b/enshrine-esdt-safe/src/from_sovereign/transfer_tokens.rs @@ -42,14 +42,14 @@ pub trait TransferTokensModule: let (wegld_amount, checked_tokens) = self.check_tokens_for_wegld_fee(operation.tokens.clone()); + self.refund_wegld(&operation.data.op_sender, wegld_amount); + let minted_operation_tokens = self.mint_tokens(&checked_tokens); let operation_tuple = OperationTuple { op_hash: operation_hash, operation: operation.clone(), }; - self.refund_wegld(&operation.data.op_sender, wegld_amount); - self.distribute_payments(hash_of_hashes, operation_tuple, minted_operation_tokens); } @@ -81,29 +81,44 @@ pub trait TransferTokensModule: BigUint, ManagedVec>, ) { - let wegld_payment = tokens.get(0); - let mut checked_tokens = tokens.clone(); + let biguint_zero = BigUint::from(0u32); + let first_payment = tokens.get(0); + let is_first_payment_wegld = self.is_wegld(&first_payment.token_identifier); + + if !is_first_payment_wegld { + for token in tokens.iter() { + if !self.was_token_registered(&token.token_identifier) + || self.has_sov_token_prefix(&token.token_identifier) + { + return (biguint_zero, ManagedVec::new()); + } + } + } - if checked_tokens.len() == 1 { - return (wegld_payment.token_data.amount, checked_tokens); + if is_first_payment_wegld && tokens.len() == 1 { + return (biguint_zero, tokens); } - let mut wegld_amount = wegld_payment.token_data.amount.clone(); + let mut remaining_tokens = tokens.clone(); + let mut wegld_amount = first_payment.token_data.amount.clone(); + let mut unregistered_tokens_count = 0; - checked_tokens.remove(0); + remaining_tokens.remove(0); - for token in checked_tokens.iter() { + for token in remaining_tokens.iter() { if !self.was_token_registered(&token.token_identifier) { - wegld_amount -= token.token_data.amount; + unregistered_tokens_count += 1; self.register_token(token.token_identifier); } } - if wegld_amount == wegld_payment.token_data.amount { + wegld_amount -= DEFAULT_ISSUE_COST * unregistered_tokens_count; + + if first_payment.token_data.amount >= wegld_amount { return (wegld_amount, tokens); } - (wegld_amount, checked_tokens) + (biguint_zero, tokens) } fn refund_wegld(&self, sender: &ManagedAddress, wegld_amount: BigUint) { From d691d0618e4b08c85f4dd591e962ce4c68b619de Mon Sep 17 00:00:00 2001 From: Andrei Baltariu Date: Tue, 2 Jul 2024 14:01:56 +0300 Subject: [PATCH 074/523] Modified execute_operation logic to throw event --- .../src/from_sovereign/transfer_tokens.rs | 24 ++++++++++++------- 1 file changed, 16 insertions(+), 8 deletions(-) diff --git a/enshrine-esdt-safe/src/from_sovereign/transfer_tokens.rs b/enshrine-esdt-safe/src/from_sovereign/transfer_tokens.rs index e9dab0df..a774e87d 100644 --- a/enshrine-esdt-safe/src/from_sovereign/transfer_tokens.rs +++ b/enshrine-esdt-safe/src/from_sovereign/transfer_tokens.rs @@ -39,18 +39,26 @@ pub trait TransferTokensModule: sc_panic!("Operation is not registered"); } - let (wegld_amount, checked_tokens) = + let (wegld_amount, remaining_tokens) = self.check_tokens_for_wegld_fee(operation.tokens.clone()); - self.refund_wegld(&operation.data.op_sender, wegld_amount); + if remaining_tokens.len() > 0 { + self.refund_wegld(&operation.data.op_sender, wegld_amount); - let minted_operation_tokens = self.mint_tokens(&checked_tokens); - let operation_tuple = OperationTuple { - op_hash: operation_hash, - operation: operation.clone(), - }; + let minted_operation_tokens = self.mint_tokens(&remaining_tokens); + let operation_tuple = OperationTuple { + op_hash: operation_hash.clone(), + operation: operation.clone(), + }; - self.distribute_payments(hash_of_hashes, operation_tuple, minted_operation_tokens); + self.distribute_payments( + hash_of_hashes.clone(), + operation_tuple, + minted_operation_tokens, + ); + } + + self.execute_bridge_operation_event(hash_of_hashes, operation_hash); } #[endpoint(registerTokens)] From b82ac418ab1be16b3236c2025ed55e358124f00a Mon Sep 17 00:00:00 2001 From: Andrei Baltariu Date: Tue, 2 Jul 2024 14:04:16 +0300 Subject: [PATCH 075/523] Function rename --- enshrine-esdt-safe/src/from_sovereign/transfer_tokens.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/enshrine-esdt-safe/src/from_sovereign/transfer_tokens.rs b/enshrine-esdt-safe/src/from_sovereign/transfer_tokens.rs index a774e87d..f4f2f191 100644 --- a/enshrine-esdt-safe/src/from_sovereign/transfer_tokens.rs +++ b/enshrine-esdt-safe/src/from_sovereign/transfer_tokens.rs @@ -40,7 +40,7 @@ pub trait TransferTokensModule: } let (wegld_amount, remaining_tokens) = - self.check_tokens_for_wegld_fee(operation.tokens.clone()); + self.verify_operation_tokens_for_issue_fee(operation.tokens.clone()); if remaining_tokens.len() > 0 { self.refund_wegld(&operation.data.op_sender, wegld_amount); @@ -82,7 +82,7 @@ pub trait TransferTokensModule: } } - fn check_tokens_for_wegld_fee( + fn verify_operation_tokens_for_issue_fee( &self, tokens: ManagedVec>, ) -> ( From 201397b111bd5dc767fc2a95df9e3eea69245daf Mon Sep 17 00:00:00 2001 From: Andrei Baltariu Date: Tue, 2 Jul 2024 14:29:22 +0300 Subject: [PATCH 076/523] Modified inline function --- enshrine-esdt-safe/src/from_sovereign/transfer_tokens.rs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/enshrine-esdt-safe/src/from_sovereign/transfer_tokens.rs b/enshrine-esdt-safe/src/from_sovereign/transfer_tokens.rs index f4f2f191..9b58040a 100644 --- a/enshrine-esdt-safe/src/from_sovereign/transfer_tokens.rs +++ b/enshrine-esdt-safe/src/from_sovereign/transfer_tokens.rs @@ -370,8 +370,7 @@ pub trait TransferTokensModule: #[inline] fn is_wegld(&self, token_id: &TokenIdentifier) -> bool { - let wegld_identifier = self.wegld_identifier().get(); - token_id.eq(&wegld_identifier) + token_id.eq(&self.wegld_identifier().get()) } #[storage_mapper("pending_hashes")] From 6d65426bec7f1a17fda38f29b4242951a405e57e Mon Sep 17 00:00:00 2001 From: Andrei Baltariu Date: Tue, 2 Jul 2024 14:58:23 +0300 Subject: [PATCH 077/523] Added refund logic to verify function --- .../src/from_sovereign/transfer_tokens.rs | 24 +++++++++---------- 1 file changed, 11 insertions(+), 13 deletions(-) diff --git a/enshrine-esdt-safe/src/from_sovereign/transfer_tokens.rs b/enshrine-esdt-safe/src/from_sovereign/transfer_tokens.rs index 9b58040a..357471b2 100644 --- a/enshrine-esdt-safe/src/from_sovereign/transfer_tokens.rs +++ b/enshrine-esdt-safe/src/from_sovereign/transfer_tokens.rs @@ -39,12 +39,12 @@ pub trait TransferTokensModule: sc_panic!("Operation is not registered"); } - let (wegld_amount, remaining_tokens) = - self.verify_operation_tokens_for_issue_fee(operation.tokens.clone()); + let (wegld_amount, remaining_tokens) = self.verify_operation_tokens_for_issue_fee( + &operation.data.op_sender, + operation.tokens.clone(), + ); if remaining_tokens.len() > 0 { - self.refund_wegld(&operation.data.op_sender, wegld_amount); - let minted_operation_tokens = self.mint_tokens(&remaining_tokens); let operation_tuple = OperationTuple { op_hash: operation_hash.clone(), @@ -84,12 +84,9 @@ pub trait TransferTokensModule: fn verify_operation_tokens_for_issue_fee( &self, + sender: &ManagedAddress, tokens: ManagedVec>, - ) -> ( - BigUint, - ManagedVec>, - ) { - let biguint_zero = BigUint::from(0u32); + ) -> ManagedVec> { let first_payment = tokens.get(0); let is_first_payment_wegld = self.is_wegld(&first_payment.token_identifier); @@ -98,13 +95,13 @@ pub trait TransferTokensModule: if !self.was_token_registered(&token.token_identifier) || self.has_sov_token_prefix(&token.token_identifier) { - return (biguint_zero, ManagedVec::new()); + return ManagedVec::new(); } } } if is_first_payment_wegld && tokens.len() == 1 { - return (biguint_zero, tokens); + return tokens; } let mut remaining_tokens = tokens.clone(); @@ -123,10 +120,11 @@ pub trait TransferTokensModule: wegld_amount -= DEFAULT_ISSUE_COST * unregistered_tokens_count; if first_payment.token_data.amount >= wegld_amount { - return (wegld_amount, tokens); + self.refund_wegld(sender, wegld_amount.clone()); + return tokens; } - (biguint_zero, tokens) + tokens } fn refund_wegld(&self, sender: &ManagedAddress, wegld_amount: BigUint) { From 12e326cb223733e7238ac1863e03c9d2f3f1a14a Mon Sep 17 00:00:00 2001 From: Andrei Baltariu Date: Tue, 2 Jul 2024 15:30:11 +0300 Subject: [PATCH 078/523] Modified init and fixed build error --- .../src/from_sovereign/transfer_tokens.rs | 2 +- enshrine-esdt-safe/src/lib.rs | 28 +++++++++---------- 2 files changed, 14 insertions(+), 16 deletions(-) diff --git a/enshrine-esdt-safe/src/from_sovereign/transfer_tokens.rs b/enshrine-esdt-safe/src/from_sovereign/transfer_tokens.rs index 357471b2..2157a0b0 100644 --- a/enshrine-esdt-safe/src/from_sovereign/transfer_tokens.rs +++ b/enshrine-esdt-safe/src/from_sovereign/transfer_tokens.rs @@ -39,7 +39,7 @@ pub trait TransferTokensModule: sc_panic!("Operation is not registered"); } - let (wegld_amount, remaining_tokens) = self.verify_operation_tokens_for_issue_fee( + let remaining_tokens = self.verify_operation_tokens_for_issue_fee( &operation.data.op_sender, operation.tokens.clone(), ); diff --git a/enshrine-esdt-safe/src/lib.rs b/enshrine-esdt-safe/src/lib.rs index b8bf4b8e..8713497e 100644 --- a/enshrine-esdt-safe/src/lib.rs +++ b/enshrine-esdt-safe/src/lib.rs @@ -24,9 +24,21 @@ pub trait EnshrineEsdtSafe: + common::storage::CommonStorage { #[init] - fn init(&self, is_sovereign_chain: bool) { + fn init(&self, is_sovereign_chain: bool, wegld_ticker: OptionalValue) { self.is_sovereign_chain().set(is_sovereign_chain); self.set_paused(true); + + if !is_sovereign_chain { + match wegld_ticker { + OptionalValue::Some(ticker) => { + let identifier = TokenIdentifier::from(ticker); + if identifier.is_valid_esdt_identifier() { + self.wegld_identifier().set(identifier); + } + } + OptionalValue::None => sc_panic!("WEGLD identifier must be set in Mainchain"), + } + } } #[only_owner] @@ -45,20 +57,6 @@ pub trait EnshrineEsdtSafe: self.header_verifier_address().set(&header_verifier_address); } - #[only_owner] - #[endpoint(setWegldTicker)] - fn set_wegld_ticker(&self, wegld_ticker: ManagedBuffer) { - let is_sovereign_chain = self.is_sovereign_chain().get(); - - require!( - is_sovereign_chain == true, - "WEGLD Identifier can be set only on Mainchain" - ); - - self.wegld_identifier() - .set(TokenIdentifier::from(wegld_ticker)); - } - #[upgrade] fn upgrade(&self) {} } From 59c266557d537ea4127b99401f11c1f4c50dfa65 Mon Sep 17 00:00:00 2001 From: Andrei Baltariu Date: Tue, 2 Jul 2024 15:56:24 +0300 Subject: [PATCH 079/523] Modified called event and wegld function --- .../src/from_sovereign/transfer_tokens.rs | 21 ++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/enshrine-esdt-safe/src/from_sovereign/transfer_tokens.rs b/enshrine-esdt-safe/src/from_sovereign/transfer_tokens.rs index 2157a0b0..30a7b1b9 100644 --- a/enshrine-esdt-safe/src/from_sovereign/transfer_tokens.rs +++ b/enshrine-esdt-safe/src/from_sovereign/transfer_tokens.rs @@ -58,7 +58,13 @@ pub trait TransferTokensModule: ); } - self.execute_bridge_operation_event(hash_of_hashes, operation_hash); + self.emit_transfer_failed_events( + &hash_of_hashes, + &OperationTuple { + op_hash: operation_hash, + operation, + }, + ); } #[endpoint(registerTokens)] @@ -93,25 +99,26 @@ pub trait TransferTokensModule: if !is_first_payment_wegld { for token in tokens.iter() { if !self.was_token_registered(&token.token_identifier) - || self.has_sov_token_prefix(&token.token_identifier) + && self.has_sov_token_prefix(&token.token_identifier) { return ManagedVec::new(); } } + + return tokens; } if is_first_payment_wegld && tokens.len() == 1 { return tokens; } - let mut remaining_tokens = tokens.clone(); let mut wegld_amount = first_payment.token_data.amount.clone(); let mut unregistered_tokens_count = 0; - remaining_tokens.remove(0); - - for token in remaining_tokens.iter() { - if !self.was_token_registered(&token.token_identifier) { + for token in tokens.iter().skip(1) { + if !self.was_token_registered(&token.token_identifier) + && self.has_sov_token_prefix(&token.token_identifier) + { unregistered_tokens_count += 1; self.register_token(token.token_identifier); } From 6693b9a12cf1e18ee693d5e44fce741fb10f9923 Mon Sep 17 00:00:00 2001 From: Andrei Baltariu Date: Tue, 2 Jul 2024 15:58:07 +0300 Subject: [PATCH 080/523] Regenerated proxy --- .../src/enshrine_esdt_safe_proxy.rs | 16 +++------------- .../wasm-enshrine-esdt-safe-full/src/lib.rs | 5 ++--- enshrine-esdt-safe/wasm/src/lib.rs | 5 ++--- 3 files changed, 7 insertions(+), 19 deletions(-) diff --git a/enshrine-esdt-safe/src/enshrine_esdt_safe_proxy.rs b/enshrine-esdt-safe/src/enshrine_esdt_safe_proxy.rs index d4ba8092..ee0eca77 100644 --- a/enshrine-esdt-safe/src/enshrine_esdt_safe_proxy.rs +++ b/enshrine-esdt-safe/src/enshrine_esdt_safe_proxy.rs @@ -45,14 +45,17 @@ where { pub fn init< Arg0: ProxyArg, + Arg1: ProxyArg>>, >( self, is_sovereign_chain: Arg0, + wegld_ticker: Arg1, ) -> TxTypedDeploy { self.wrapped_tx .payment(NotPayable) .raw_deploy() .argument(&is_sovereign_chain) + .argument(&wegld_ticker) .original_result() } } @@ -111,19 +114,6 @@ where .original_result() } - pub fn set_wegld_ticker< - Arg0: ProxyArg>, - >( - self, - wegld_ticker: Arg0, - ) -> TxTypedCall { - self.wrapped_tx - .payment(NotPayable) - .raw_call("setWegldTicker") - .argument(&wegld_ticker) - .original_result() - } - pub fn deposit< Arg0: ProxyArg>, Arg1: ProxyArg, ManagedVec>>>>, diff --git a/enshrine-esdt-safe/wasm-enshrine-esdt-safe-full/src/lib.rs b/enshrine-esdt-safe/wasm-enshrine-esdt-safe-full/src/lib.rs index ab0809b6..08014062 100644 --- a/enshrine-esdt-safe/wasm-enshrine-esdt-safe-full/src/lib.rs +++ b/enshrine-esdt-safe/wasm-enshrine-esdt-safe-full/src/lib.rs @@ -6,10 +6,10 @@ // Init: 1 // Upgrade: 1 -// Endpoints: 29 +// Endpoints: 28 // Async Callback: 1 // Promise callbacks: 1 -// Total number of exported functions: 33 +// Total number of exported functions: 32 #![no_std] @@ -23,7 +23,6 @@ multiversx_sc_wasm_adapter::endpoints! { upgrade => upgrade setFeeMarketAddress => set_fee_market_address setHeaderVerifierAddress => set_header_verifier_address - setWegldTicker => set_wegld_ticker deposit => deposit setMinValidSigners => set_min_valid_signers addSigners => add_signers diff --git a/enshrine-esdt-safe/wasm/src/lib.rs b/enshrine-esdt-safe/wasm/src/lib.rs index ab0809b6..08014062 100644 --- a/enshrine-esdt-safe/wasm/src/lib.rs +++ b/enshrine-esdt-safe/wasm/src/lib.rs @@ -6,10 +6,10 @@ // Init: 1 // Upgrade: 1 -// Endpoints: 29 +// Endpoints: 28 // Async Callback: 1 // Promise callbacks: 1 -// Total number of exported functions: 33 +// Total number of exported functions: 32 #![no_std] @@ -23,7 +23,6 @@ multiversx_sc_wasm_adapter::endpoints! { upgrade => upgrade setFeeMarketAddress => set_fee_market_address setHeaderVerifierAddress => set_header_verifier_address - setWegldTicker => set_wegld_ticker deposit => deposit setMinValidSigners => set_min_valid_signers addSigners => add_signers From 33a7aabf9e5bb4fdeea8fc8675d40aa1ea17cbec Mon Sep 17 00:00:00 2001 From: Andrei Baltariu Date: Tue, 2 Jul 2024 15:59:55 +0300 Subject: [PATCH 081/523] Renamed init arg --- enshrine-esdt-safe/src/lib.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/enshrine-esdt-safe/src/lib.rs b/enshrine-esdt-safe/src/lib.rs index 8713497e..90f581e2 100644 --- a/enshrine-esdt-safe/src/lib.rs +++ b/enshrine-esdt-safe/src/lib.rs @@ -24,12 +24,12 @@ pub trait EnshrineEsdtSafe: + common::storage::CommonStorage { #[init] - fn init(&self, is_sovereign_chain: bool, wegld_ticker: OptionalValue) { + fn init(&self, is_sovereign_chain: bool, wegld_identifier: OptionalValue) { self.is_sovereign_chain().set(is_sovereign_chain); self.set_paused(true); if !is_sovereign_chain { - match wegld_ticker { + match wegld_identifier { OptionalValue::Some(ticker) => { let identifier = TokenIdentifier::from(ticker); if identifier.is_valid_esdt_identifier() { From 1f5bff4a1e4c8d3922606cc93aca7a12c975901d Mon Sep 17 00:00:00 2001 From: Andrei Baltariu Date: Tue, 2 Jul 2024 16:01:46 +0300 Subject: [PATCH 082/523] Regenerated proxy --- enshrine-esdt-safe/src/enshrine_esdt_safe_proxy.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/enshrine-esdt-safe/src/enshrine_esdt_safe_proxy.rs b/enshrine-esdt-safe/src/enshrine_esdt_safe_proxy.rs index ee0eca77..6a00ad9d 100644 --- a/enshrine-esdt-safe/src/enshrine_esdt_safe_proxy.rs +++ b/enshrine-esdt-safe/src/enshrine_esdt_safe_proxy.rs @@ -49,13 +49,13 @@ where >( self, is_sovereign_chain: Arg0, - wegld_ticker: Arg1, + wegld_identifier: Arg1, ) -> TxTypedDeploy { self.wrapped_tx .payment(NotPayable) .raw_deploy() .argument(&is_sovereign_chain) - .argument(&wegld_ticker) + .argument(&wegld_identifier) .original_result() } } From 098b0676e544436f822922f1ee93b630b80a4614 Mon Sep 17 00:00:00 2001 From: Andrei Baltariu Date: Wed, 3 Jul 2024 12:04:48 +0300 Subject: [PATCH 083/523] Added burn for sovereign tokens --- .../src/from_sovereign/transfer_tokens.rs | 23 +++++++++++-------- 1 file changed, 14 insertions(+), 9 deletions(-) diff --git a/enshrine-esdt-safe/src/from_sovereign/transfer_tokens.rs b/enshrine-esdt-safe/src/from_sovereign/transfer_tokens.rs index 30a7b1b9..3e2d8d49 100644 --- a/enshrine-esdt-safe/src/from_sovereign/transfer_tokens.rs +++ b/enshrine-esdt-safe/src/from_sovereign/transfer_tokens.rs @@ -127,7 +127,7 @@ pub trait TransferTokensModule: wegld_amount -= DEFAULT_ISSUE_COST * unregistered_tokens_count; if first_payment.token_data.amount >= wegld_amount { - self.refund_wegld(sender, wegld_amount.clone()); + self.refund_wegld(sender, wegld_amount); return tokens; } @@ -290,6 +290,7 @@ pub trait TransferTokensModule: ); } ManagedAsyncCallResult::Err(_) => { + self.burn_sovereign_tokens(&operation_tuple.operation); self.emit_transfer_failed_events(hash_of_hashes, operation_tuple); } } @@ -303,6 +304,18 @@ pub trait TransferTokensModule: .sync_call(); } + fn burn_sovereign_tokens(&self, operation: &Operation) { + for token in operation.tokens.iter() { + if self.has_sov_token_prefix(&token.token_identifier) { + self.send().esdt_local_burn( + &token.token_identifier, + token.token_nonce, + &token.token_data.amount, + ); + } + } + } + fn emit_transfer_failed_events( &self, hash_of_hashes: &ManagedBuffer, @@ -313,14 +326,6 @@ pub trait TransferTokensModule: operation_tuple.op_hash.clone(), ); - for operation_token in &operation_tuple.operation.tokens { - self.send().esdt_local_burn( - &operation_token.token_identifier, - operation_token.token_nonce, - &operation_token.token_data.amount, - ); - } - // deposit back mainchain tokens into user account let sc_address = self.blockchain().get_sc_address(); let tx_nonce = self.get_and_save_next_tx_id(); From 83139b963384a5c89bc725294d81e3fdf2bf8849 Mon Sep 17 00:00:00 2001 From: Andrei Baltariu Date: Wed, 3 Jul 2024 13:57:18 +0300 Subject: [PATCH 084/523] Modified wegld fee function --- .../src/from_sovereign/transfer_tokens.rs | 23 +++++++++++-------- 1 file changed, 14 insertions(+), 9 deletions(-) diff --git a/enshrine-esdt-safe/src/from_sovereign/transfer_tokens.rs b/enshrine-esdt-safe/src/from_sovereign/transfer_tokens.rs index 3e2d8d49..76611fd8 100644 --- a/enshrine-esdt-safe/src/from_sovereign/transfer_tokens.rs +++ b/enshrine-esdt-safe/src/from_sovereign/transfer_tokens.rs @@ -112,26 +112,31 @@ pub trait TransferTokensModule: return tokens; } - let mut wegld_amount = first_payment.token_data.amount.clone(); - let mut unregistered_tokens_count = 0; + let mut unregistered_tokens: ManagedVec = ManagedVec::new(); for token in tokens.iter().skip(1) { if !self.was_token_registered(&token.token_identifier) && self.has_sov_token_prefix(&token.token_identifier) { - unregistered_tokens_count += 1; - self.register_token(token.token_identifier); + unregistered_tokens.push(token.token_identifier); } } - wegld_amount -= DEFAULT_ISSUE_COST * unregistered_tokens_count; - - if first_payment.token_data.amount >= wegld_amount { - self.refund_wegld(sender, wegld_amount); + if unregistered_tokens.is_empty() { return tokens; } - tokens + let wegld_fee_amount = BigUint::from(DEFAULT_ISSUE_COST * unregistered_tokens.len() as u64); + + if first_payment.token_data.amount >= wegld_fee_amount { + let mut registered_tokens = tokens.clone(); + registered_tokens.remove(0); + self.refund_wegld(sender, wegld_fee_amount); + + return registered_tokens; + } + + sc_panic!("Not enough WEGLD to register all tokens"); } fn refund_wegld(&self, sender: &ManagedAddress, wegld_amount: BigUint) { From e1c516b2c9f3a4b2001b471f12087517be1361b4 Mon Sep 17 00:00:00 2001 From: Andrei Baltariu Date: Wed, 3 Jul 2024 14:00:12 +0300 Subject: [PATCH 085/523] Added bool return value to fee function --- .../src/from_sovereign/transfer_tokens.rs | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/enshrine-esdt-safe/src/from_sovereign/transfer_tokens.rs b/enshrine-esdt-safe/src/from_sovereign/transfer_tokens.rs index 76611fd8..fe836a60 100644 --- a/enshrine-esdt-safe/src/from_sovereign/transfer_tokens.rs +++ b/enshrine-esdt-safe/src/from_sovereign/transfer_tokens.rs @@ -39,12 +39,12 @@ pub trait TransferTokensModule: sc_panic!("Operation is not registered"); } - let remaining_tokens = self.verify_operation_tokens_for_issue_fee( + let (is_wegld_fee_paid, remaining_tokens) = self.verify_operation_tokens_for_issue_fee( &operation.data.op_sender, operation.tokens.clone(), ); - if remaining_tokens.len() > 0 { + if is_wegld_fee_paid { let minted_operation_tokens = self.mint_tokens(&remaining_tokens); let operation_tuple = OperationTuple { op_hash: operation_hash.clone(), @@ -92,7 +92,7 @@ pub trait TransferTokensModule: &self, sender: &ManagedAddress, tokens: ManagedVec>, - ) -> ManagedVec> { + ) -> (bool, ManagedVec>) { let first_payment = tokens.get(0); let is_first_payment_wegld = self.is_wegld(&first_payment.token_identifier); @@ -101,15 +101,15 @@ pub trait TransferTokensModule: if !self.was_token_registered(&token.token_identifier) && self.has_sov_token_prefix(&token.token_identifier) { - return ManagedVec::new(); + return (false, ManagedVec::new()); } } - return tokens; + return (true, tokens); } if is_first_payment_wegld && tokens.len() == 1 { - return tokens; + return (true, tokens); } let mut unregistered_tokens: ManagedVec = ManagedVec::new(); @@ -123,7 +123,7 @@ pub trait TransferTokensModule: } if unregistered_tokens.is_empty() { - return tokens; + return (true, tokens); } let wegld_fee_amount = BigUint::from(DEFAULT_ISSUE_COST * unregistered_tokens.len() as u64); @@ -133,7 +133,7 @@ pub trait TransferTokensModule: registered_tokens.remove(0); self.refund_wegld(sender, wegld_fee_amount); - return registered_tokens; + return (true, registered_tokens); } sc_panic!("Not enough WEGLD to register all tokens"); From a1b2738785ce922e4be88d6729e6287f28d3c9c8 Mon Sep 17 00:00:00 2001 From: Andrei Baltariu Date: Wed, 3 Jul 2024 14:29:24 +0300 Subject: [PATCH 086/523] Added register token call --- enshrine-esdt-safe/src/from_sovereign/transfer_tokens.rs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/enshrine-esdt-safe/src/from_sovereign/transfer_tokens.rs b/enshrine-esdt-safe/src/from_sovereign/transfer_tokens.rs index fe836a60..0139d790 100644 --- a/enshrine-esdt-safe/src/from_sovereign/transfer_tokens.rs +++ b/enshrine-esdt-safe/src/from_sovereign/transfer_tokens.rs @@ -93,6 +93,8 @@ pub trait TransferTokensModule: sender: &ManagedAddress, tokens: ManagedVec>, ) -> (bool, ManagedVec>) { + require!(!tokens.is_empty(), "Tokens array should not be empty"); + let first_payment = tokens.get(0); let is_first_payment_wegld = self.is_wegld(&first_payment.token_identifier); @@ -129,6 +131,10 @@ pub trait TransferTokensModule: let wegld_fee_amount = BigUint::from(DEFAULT_ISSUE_COST * unregistered_tokens.len() as u64); if first_payment.token_data.amount >= wegld_fee_amount { + for token_identifier in unregistered_tokens.iter() { + self.register_token(token_identifier.clone_value()); + } + let mut registered_tokens = tokens.clone(); registered_tokens.remove(0); self.refund_wegld(sender, wegld_fee_amount); From 1bff454ab074c4771ca7021e7531e7c77129709f Mon Sep 17 00:00:00 2001 From: Andrei Baltariu Date: Wed, 3 Jul 2024 14:30:37 +0300 Subject: [PATCH 087/523] Removed clone call --- enshrine-esdt-safe/src/from_sovereign/transfer_tokens.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/enshrine-esdt-safe/src/from_sovereign/transfer_tokens.rs b/enshrine-esdt-safe/src/from_sovereign/transfer_tokens.rs index 0139d790..c00cec39 100644 --- a/enshrine-esdt-safe/src/from_sovereign/transfer_tokens.rs +++ b/enshrine-esdt-safe/src/from_sovereign/transfer_tokens.rs @@ -135,7 +135,7 @@ pub trait TransferTokensModule: self.register_token(token_identifier.clone_value()); } - let mut registered_tokens = tokens.clone(); + let mut registered_tokens = tokens; registered_tokens.remove(0); self.refund_wegld(sender, wegld_fee_amount); From 4cfc7c69a1593a86075d9c9428e63bc93fa56cd4 Mon Sep 17 00:00:00 2001 From: Andrei Baltariu Date: Wed, 3 Jul 2024 15:47:28 +0300 Subject: [PATCH 088/523] Modified wegld fee calculation --- enshrine-esdt-safe/src/from_sovereign/transfer_tokens.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/enshrine-esdt-safe/src/from_sovereign/transfer_tokens.rs b/enshrine-esdt-safe/src/from_sovereign/transfer_tokens.rs index c00cec39..82b955e8 100644 --- a/enshrine-esdt-safe/src/from_sovereign/transfer_tokens.rs +++ b/enshrine-esdt-safe/src/from_sovereign/transfer_tokens.rs @@ -137,7 +137,7 @@ pub trait TransferTokensModule: let mut registered_tokens = tokens; registered_tokens.remove(0); - self.refund_wegld(sender, wegld_fee_amount); + self.refund_wegld(sender, first_payment.token_data.amount - wegld_fee_amount); return (true, registered_tokens); } From 87cafe7dca94cb4ddfb8cc8ce2d7ba05e28fc024 Mon Sep 17 00:00:00 2001 From: Andrei Baltariu Date: Wed, 3 Jul 2024 16:00:50 +0300 Subject: [PATCH 089/523] Reverted condition in execute_operations --- .../src/from_sovereign/transfer_tokens.rs | 38 +++++++++---------- 1 file changed, 19 insertions(+), 19 deletions(-) diff --git a/enshrine-esdt-safe/src/from_sovereign/transfer_tokens.rs b/enshrine-esdt-safe/src/from_sovereign/transfer_tokens.rs index 82b955e8..59f05e2a 100644 --- a/enshrine-esdt-safe/src/from_sovereign/transfer_tokens.rs +++ b/enshrine-esdt-safe/src/from_sovereign/transfer_tokens.rs @@ -44,26 +44,28 @@ pub trait TransferTokensModule: operation.tokens.clone(), ); - if is_wegld_fee_paid { - let minted_operation_tokens = self.mint_tokens(&remaining_tokens); - let operation_tuple = OperationTuple { - op_hash: operation_hash.clone(), - operation: operation.clone(), - }; - - self.distribute_payments( - hash_of_hashes.clone(), - operation_tuple, - minted_operation_tokens, + if !is_wegld_fee_paid { + self.emit_transfer_failed_events( + &hash_of_hashes, + &OperationTuple { + op_hash: operation_hash, + operation, + }, ); + + sc_panic!("Not enough WEGLD to register all tokens"); } - self.emit_transfer_failed_events( - &hash_of_hashes, - &OperationTuple { - op_hash: operation_hash, - operation, - }, + let minted_operation_tokens = self.mint_tokens(&remaining_tokens); + let operation_tuple = OperationTuple { + op_hash: operation_hash.clone(), + operation: operation.clone(), + }; + + self.distribute_payments( + hash_of_hashes.clone(), + operation_tuple, + minted_operation_tokens, ); } @@ -141,8 +143,6 @@ pub trait TransferTokensModule: return (true, registered_tokens); } - - sc_panic!("Not enough WEGLD to register all tokens"); } fn refund_wegld(&self, sender: &ManagedAddress, wegld_amount: BigUint) { From 32fb9ac5cb8964cb1dfa664ec524a33ae212aa2a Mon Sep 17 00:00:00 2001 From: Andrei Baltariu Date: Wed, 3 Jul 2024 16:05:09 +0300 Subject: [PATCH 090/523] Added else scenario for wegld fee --- enshrine-esdt-safe/src/from_sovereign/transfer_tokens.rs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/enshrine-esdt-safe/src/from_sovereign/transfer_tokens.rs b/enshrine-esdt-safe/src/from_sovereign/transfer_tokens.rs index 59f05e2a..f6ed389c 100644 --- a/enshrine-esdt-safe/src/from_sovereign/transfer_tokens.rs +++ b/enshrine-esdt-safe/src/from_sovereign/transfer_tokens.rs @@ -143,6 +143,8 @@ pub trait TransferTokensModule: return (true, registered_tokens); } + + (false, tokens) } fn refund_wegld(&self, sender: &ManagedAddress, wegld_amount: BigUint) { From 07d92fcda28e092778aa788be6422c37fcd5c8fd Mon Sep 17 00:00:00 2001 From: Andrei Baltariu Date: Wed, 3 Jul 2024 16:27:36 +0300 Subject: [PATCH 091/523] Added require check + changed return value --- enshrine-esdt-safe/src/from_sovereign/transfer_tokens.rs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/enshrine-esdt-safe/src/from_sovereign/transfer_tokens.rs b/enshrine-esdt-safe/src/from_sovereign/transfer_tokens.rs index f6ed389c..3db3fe91 100644 --- a/enshrine-esdt-safe/src/from_sovereign/transfer_tokens.rs +++ b/enshrine-esdt-safe/src/from_sovereign/transfer_tokens.rs @@ -144,10 +144,12 @@ pub trait TransferTokensModule: return (true, registered_tokens); } - (false, tokens) + (false, ManagedVec::new()) } fn refund_wegld(&self, sender: &ManagedAddress, wegld_amount: BigUint) { + require!(wegld_amount > 0, "No WEGLD fee sent"); + let wegld_identifier = self.wegld_identifier().get(); let payment = EsdtTokenPayment::new(wegld_identifier, 0, wegld_amount); From e426908877a153abc27876e8710acb18befe7c9b Mon Sep 17 00:00:00 2001 From: Andrei Baltariu Date: Thu, 4 Jul 2024 10:44:14 +0300 Subject: [PATCH 092/523] Modified wegld fee and inline function logic --- .../src/from_sovereign/transfer_tokens.rs | 32 ++++++++----------- 1 file changed, 14 insertions(+), 18 deletions(-) diff --git a/enshrine-esdt-safe/src/from_sovereign/transfer_tokens.rs b/enshrine-esdt-safe/src/from_sovereign/transfer_tokens.rs index 3db3fe91..fc3b6839 100644 --- a/enshrine-esdt-safe/src/from_sovereign/transfer_tokens.rs +++ b/enshrine-esdt-safe/src/from_sovereign/transfer_tokens.rs @@ -102,15 +102,13 @@ pub trait TransferTokensModule: if !is_first_payment_wegld { for token in tokens.iter() { - if !self.was_token_registered(&token.token_identifier) - && self.has_sov_token_prefix(&token.token_identifier) - { + if !self.was_token_registered(&token.token_identifier) { return (false, ManagedVec::new()); } } return (true, tokens); - } + }; if is_first_payment_wegld && tokens.len() == 1 { return (true, tokens); @@ -119,9 +117,7 @@ pub trait TransferTokensModule: let mut unregistered_tokens: ManagedVec = ManagedVec::new(); for token in tokens.iter().skip(1) { - if !self.was_token_registered(&token.token_identifier) - && self.has_sov_token_prefix(&token.token_identifier) - { + if !self.was_token_registered(&token.token_identifier) { unregistered_tokens.push(token.token_identifier); } } @@ -131,20 +127,20 @@ pub trait TransferTokensModule: } let wegld_fee_amount = BigUint::from(DEFAULT_ISSUE_COST * unregistered_tokens.len() as u64); + let mut registered_tokens = tokens; + registered_tokens.remove(0); - if first_payment.token_data.amount >= wegld_fee_amount { - for token_identifier in unregistered_tokens.iter() { - self.register_token(token_identifier.clone_value()); - } - - let mut registered_tokens = tokens; - registered_tokens.remove(0); - self.refund_wegld(sender, first_payment.token_data.amount - wegld_fee_amount); + if first_payment.token_data.amount < wegld_fee_amount { + return (false, ManagedVec::new()); + } - return (true, registered_tokens); + for token_identifier in unregistered_tokens.iter() { + self.register_token(token_identifier.clone_value()); } - (false, ManagedVec::new()) + self.refund_wegld(sender, first_payment.token_data.amount - wegld_fee_amount); + + return (true, registered_tokens); } fn refund_wegld(&self, sender: &ManagedAddress, wegld_amount: BigUint) { @@ -385,7 +381,7 @@ pub trait TransferTokensModule: #[inline] fn was_token_registered(&self, token_id: &TokenIdentifier) -> bool { - self.paid_issued_tokens().contains(token_id) + self.has_sov_token_prefix(token_id) && self.paid_issued_tokens().contains(token_id) } #[inline] From 74c97f73f31704cb601e09dd538491a09c729486 Mon Sep 17 00:00:00 2001 From: Andrei Baltariu Date: Thu, 4 Jul 2024 10:45:57 +0300 Subject: [PATCH 093/523] Switched returned types --- .../src/from_sovereign/transfer_tokens.rs | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/enshrine-esdt-safe/src/from_sovereign/transfer_tokens.rs b/enshrine-esdt-safe/src/from_sovereign/transfer_tokens.rs index fc3b6839..4ac3cb64 100644 --- a/enshrine-esdt-safe/src/from_sovereign/transfer_tokens.rs +++ b/enshrine-esdt-safe/src/from_sovereign/transfer_tokens.rs @@ -39,7 +39,7 @@ pub trait TransferTokensModule: sc_panic!("Operation is not registered"); } - let (is_wegld_fee_paid, remaining_tokens) = self.verify_operation_tokens_for_issue_fee( + let (remaining_tokens, is_wegld_fee_paid) = self.verify_operation_tokens_for_issue_fee( &operation.data.op_sender, operation.tokens.clone(), ); @@ -94,7 +94,7 @@ pub trait TransferTokensModule: &self, sender: &ManagedAddress, tokens: ManagedVec>, - ) -> (bool, ManagedVec>) { + ) -> (ManagedVec>, bool) { require!(!tokens.is_empty(), "Tokens array should not be empty"); let first_payment = tokens.get(0); @@ -103,15 +103,15 @@ pub trait TransferTokensModule: if !is_first_payment_wegld { for token in tokens.iter() { if !self.was_token_registered(&token.token_identifier) { - return (false, ManagedVec::new()); + return (ManagedVec::new(), false); } } - return (true, tokens); + return (tokens, false); }; if is_first_payment_wegld && tokens.len() == 1 { - return (true, tokens); + return (tokens, false); } let mut unregistered_tokens: ManagedVec = ManagedVec::new(); @@ -123,7 +123,7 @@ pub trait TransferTokensModule: } if unregistered_tokens.is_empty() { - return (true, tokens); + return (tokens, true); } let wegld_fee_amount = BigUint::from(DEFAULT_ISSUE_COST * unregistered_tokens.len() as u64); @@ -131,7 +131,7 @@ pub trait TransferTokensModule: registered_tokens.remove(0); if first_payment.token_data.amount < wegld_fee_amount { - return (false, ManagedVec::new()); + return (ManagedVec::new(), false); } for token_identifier in unregistered_tokens.iter() { @@ -140,7 +140,7 @@ pub trait TransferTokensModule: self.refund_wegld(sender, first_payment.token_data.amount - wegld_fee_amount); - return (true, registered_tokens); + return (registered_tokens, false); } fn refund_wegld(&self, sender: &ManagedAddress, wegld_amount: BigUint) { From 015c2d4bdfc463196a8821411f02ed966f30c693 Mon Sep 17 00:00:00 2001 From: Andrei Baltariu Date: Thu, 4 Jul 2024 12:31:35 +0300 Subject: [PATCH 094/523] Added default function for OperationEsdtPayment --- common/transaction/src/lib.rs | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/common/transaction/src/lib.rs b/common/transaction/src/lib.rs index 550155a4..2e9a2e03 100644 --- a/common/transaction/src/lib.rs +++ b/common/transaction/src/lib.rs @@ -90,6 +90,16 @@ impl From> for EsdtTokenPayment { } } +impl Default for OperationEsdtPayment { + fn default() -> Self { + OperationEsdtPayment { + token_identifier: TokenIdentifier::from(ManagedBuffer::new()), + token_nonce: 0, + token_data: StolenFromFrameworkEsdtTokenData::default(), + } + } +} + // Temporary until Clone is implemented for EsdtTokenData #[derive( TopDecode, TopEncode, NestedDecode, NestedEncode, TypeAbi, Debug, ManagedVecItem, Clone, From 5352b44c79cf10481ff76e9d72a796b20a2db2df Mon Sep 17 00:00:00 2001 From: Andrei Baltariu Date: Thu, 4 Jul 2024 12:40:15 +0300 Subject: [PATCH 095/523] Added get_wegld_payment function --- .../src/from_sovereign/transfer_tokens.rs | 22 ++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) diff --git a/enshrine-esdt-safe/src/from_sovereign/transfer_tokens.rs b/enshrine-esdt-safe/src/from_sovereign/transfer_tokens.rs index 4ac3cb64..a94a30ef 100644 --- a/enshrine-esdt-safe/src/from_sovereign/transfer_tokens.rs +++ b/enshrine-esdt-safe/src/from_sovereign/transfer_tokens.rs @@ -90,15 +90,27 @@ pub trait TransferTokensModule: } } + fn get_wegld_payment( + &self, + tokens: &ManagedVec>, + ) -> OperationEsdtPayment { + for token in tokens.iter() { + if self.is_wegld(&token.token_identifier) { + return token; + } + } + + OperationEsdtPayment::default() + } + fn verify_operation_tokens_for_issue_fee( &self, sender: &ManagedAddress, tokens: ManagedVec>, ) -> (ManagedVec>, bool) { require!(!tokens.is_empty(), "Tokens array should not be empty"); - - let first_payment = tokens.get(0); - let is_first_payment_wegld = self.is_wegld(&first_payment.token_identifier); + let wegld_payment = self.get_wegld_payment(&tokens); + let is_first_payment_wegld = self.is_wegld(&wegld_payment.token_identifier); if !is_first_payment_wegld { for token in tokens.iter() { @@ -130,7 +142,7 @@ pub trait TransferTokensModule: let mut registered_tokens = tokens; registered_tokens.remove(0); - if first_payment.token_data.amount < wegld_fee_amount { + if wegld_payment.token_data.amount < wegld_fee_amount { return (ManagedVec::new(), false); } @@ -138,7 +150,7 @@ pub trait TransferTokensModule: self.register_token(token_identifier.clone_value()); } - self.refund_wegld(sender, first_payment.token_data.amount - wegld_fee_amount); + self.refund_wegld(sender, wegld_payment.token_data.amount - wegld_fee_amount); return (registered_tokens, false); } From 8ed2d0af74dbed7feb8e2c4c94716bf6db3e1968 Mon Sep 17 00:00:00 2001 From: Andrei Baltariu Date: Thu, 4 Jul 2024 13:43:53 +0300 Subject: [PATCH 096/523] Modified get_wegld_payment to return index --- .../src/from_sovereign/transfer_tokens.rs | 23 +++++++++++-------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/enshrine-esdt-safe/src/from_sovereign/transfer_tokens.rs b/enshrine-esdt-safe/src/from_sovereign/transfer_tokens.rs index a94a30ef..92cb830f 100644 --- a/enshrine-esdt-safe/src/from_sovereign/transfer_tokens.rs +++ b/enshrine-esdt-safe/src/from_sovereign/transfer_tokens.rs @@ -1,3 +1,5 @@ +use core::iter::empty; + use crate::{common, to_sovereign}; use builtin_func_names::ESDT_NFT_CREATE_FUNC_NAME; use header_verifier::header_verifier_proxy; @@ -93,14 +95,14 @@ pub trait TransferTokensModule: fn get_wegld_payment( &self, tokens: &ManagedVec>, - ) -> OperationEsdtPayment { - for token in tokens.iter() { + ) -> (OperationEsdtPayment, usize) { + for (i, token) in tokens.iter().enumerate() { if self.is_wegld(&token.token_identifier) { - return token; + return (token, i); } } - OperationEsdtPayment::default() + (OperationEsdtPayment::default(), 0) } fn verify_operation_tokens_for_issue_fee( @@ -109,10 +111,11 @@ pub trait TransferTokensModule: tokens: ManagedVec>, ) -> (ManagedVec>, bool) { require!(!tokens.is_empty(), "Tokens array should not be empty"); - let wegld_payment = self.get_wegld_payment(&tokens); - let is_first_payment_wegld = self.is_wegld(&wegld_payment.token_identifier); + let (wegld_payment, wegld_position) = self.get_wegld_payment(&tokens); + let is_empty_identifier = + wegld_payment.token_identifier == TokenIdentifier::from(ManagedBuffer::new()); - if !is_first_payment_wegld { + if is_empty_identifier { for token in tokens.iter() { if !self.was_token_registered(&token.token_identifier) { return (ManagedVec::new(), false); @@ -122,13 +125,13 @@ pub trait TransferTokensModule: return (tokens, false); }; - if is_first_payment_wegld && tokens.len() == 1 { + if !is_empty_identifier && tokens.len() == 1 { return (tokens, false); } let mut unregistered_tokens: ManagedVec = ManagedVec::new(); - for token in tokens.iter().skip(1) { + for token in tokens.iter() { if !self.was_token_registered(&token.token_identifier) { unregistered_tokens.push(token.token_identifier); } @@ -140,7 +143,7 @@ pub trait TransferTokensModule: let wegld_fee_amount = BigUint::from(DEFAULT_ISSUE_COST * unregistered_tokens.len() as u64); let mut registered_tokens = tokens; - registered_tokens.remove(0); + registered_tokens.remove(wegld_position); if wegld_payment.token_data.amount < wegld_fee_amount { return (ManagedVec::new(), false); From a26458a0e667ab522b262d3191188f0d9702b526 Mon Sep 17 00:00:00 2001 From: Andrei Baltariu Date: Thu, 4 Jul 2024 13:52:21 +0300 Subject: [PATCH 097/523] Added new endpoint for WEGLD deposit --- .../src/from_sovereign/transfer_tokens.rs | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/enshrine-esdt-safe/src/from_sovereign/transfer_tokens.rs b/enshrine-esdt-safe/src/from_sovereign/transfer_tokens.rs index 92cb830f..68349ea9 100644 --- a/enshrine-esdt-safe/src/from_sovereign/transfer_tokens.rs +++ b/enshrine-esdt-safe/src/from_sovereign/transfer_tokens.rs @@ -1,5 +1,3 @@ -use core::iter::empty; - use crate::{common, to_sovereign}; use builtin_func_names::ESDT_NFT_CREATE_FUNC_NAME; use header_verifier::header_verifier_proxy; @@ -92,6 +90,17 @@ pub trait TransferTokensModule: } } + #[endpoint(depositForNewRegistrations)] + #[payable("*")] + fn deposit_for_new_registrations(&self) { + let call_value = self.call_value().single_esdt(); + + require!( + call_value.amount >= DEFAULT_ISSUE_COST, + "The minimum amount of WEGLD wasn't met" + ); + } + fn get_wegld_payment( &self, tokens: &ManagedVec>, From ae5d9757879a863c6818073fd59bf8a0e9235341 Mon Sep 17 00:00:00 2001 From: Andrei Baltariu Date: Thu, 4 Jul 2024 14:08:41 +0300 Subject: [PATCH 098/523] Modified prefix function and added sov prefix to init --- common/utils/src/lib.rs | 2 +- enshrine-esdt-safe/src/common/storage.rs | 3 +++ .../src/from_sovereign/transfer_tokens.rs | 6 ++--- enshrine-esdt-safe/src/lib.rs | 22 +++++++++++++++---- .../src/to_sovereign/create_tx.rs | 4 +--- 5 files changed, 26 insertions(+), 11 deletions(-) diff --git a/common/utils/src/lib.rs b/common/utils/src/lib.rs index a23551a7..dcbd2c36 100644 --- a/common/utils/src/lib.rs +++ b/common/utils/src/lib.rs @@ -66,7 +66,7 @@ pub trait UtilsModule: bls_signature::BlsSignatureModule { list } - fn has_sov_token_prefix(&self, token_id: &TokenIdentifier) -> bool { + fn has_prefix(&self, token_id: &TokenIdentifier) -> bool { let dash = b'-'; let buffer = token_id.as_managed_buffer(); let mut array_buffer = [0u8; 32]; diff --git a/enshrine-esdt-safe/src/common/storage.rs b/enshrine-esdt-safe/src/common/storage.rs index 3857e6a1..331e4de6 100644 --- a/enshrine-esdt-safe/src/common/storage.rs +++ b/enshrine-esdt-safe/src/common/storage.rs @@ -7,4 +7,7 @@ pub trait CommonStorage { #[storage_mapper("wegldIdentifier")] fn wegld_identifier(&self) -> SingleValueMapper; + + #[storage_mapper("sovereignTokenPrefix")] + fn sovereign_token_prefix(&self) -> SingleValueMapper; } diff --git a/enshrine-esdt-safe/src/from_sovereign/transfer_tokens.rs b/enshrine-esdt-safe/src/from_sovereign/transfer_tokens.rs index 68349ea9..55cd7a1c 100644 --- a/enshrine-esdt-safe/src/from_sovereign/transfer_tokens.rs +++ b/enshrine-esdt-safe/src/from_sovereign/transfer_tokens.rs @@ -183,7 +183,7 @@ pub trait TransferTokensModule: let mut output_payments = ManagedVec::new(); for operation_token in operation_tokens.iter() { - if !self.has_sov_token_prefix(&operation_token.token_identifier) { + if !self.has_prefix(&operation_token.token_identifier) { output_payments.push(operation_token.clone()); continue; } @@ -341,7 +341,7 @@ pub trait TransferTokensModule: fn burn_sovereign_tokens(&self, operation: &Operation) { for token in operation.tokens.iter() { - if self.has_sov_token_prefix(&token.token_identifier) { + if self.has_prefix(&token.token_identifier) { self.send().esdt_local_burn( &token.token_identifier, token.token_nonce, @@ -405,7 +405,7 @@ pub trait TransferTokensModule: #[inline] fn was_token_registered(&self, token_id: &TokenIdentifier) -> bool { - self.has_sov_token_prefix(token_id) && self.paid_issued_tokens().contains(token_id) + self.has_prefix(token_id) && self.paid_issued_tokens().contains(token_id) } #[inline] diff --git a/enshrine-esdt-safe/src/lib.rs b/enshrine-esdt-safe/src/lib.rs index 90f581e2..870a34ee 100644 --- a/enshrine-esdt-safe/src/lib.rs +++ b/enshrine-esdt-safe/src/lib.rs @@ -24,19 +24,33 @@ pub trait EnshrineEsdtSafe: + common::storage::CommonStorage { #[init] - fn init(&self, is_sovereign_chain: bool, wegld_identifier: OptionalValue) { + fn init( + &self, + is_sovereign_chain: bool, + wegld_identifier: OptionalValue, + sov_token_prefix: OptionalValue, + ) { self.is_sovereign_chain().set(is_sovereign_chain); self.set_paused(true); if !is_sovereign_chain { - match wegld_identifier { - OptionalValue::Some(ticker) => { + match (wegld_identifier, sov_token_prefix) { + (OptionalValue::Some(ticker), OptionalValue::Some(prefix)) => { let identifier = TokenIdentifier::from(ticker); if identifier.is_valid_esdt_identifier() { self.wegld_identifier().set(identifier); + self.sovereign_token_prefix().set(prefix); } } - OptionalValue::None => sc_panic!("WEGLD identifier must be set in Mainchain"), + (OptionalValue::Some(_), OptionalValue::None) => { + sc_panic!("Sovereign Token Prefix must be set in Mainchain") + } + (OptionalValue::None, OptionalValue::Some(_)) => { + sc_panic!("WEGLG identifier must be set in Mainchain") + } + _ => sc_panic!( + "Both WEGLD identifier and Sovereign Token Prefix must be set in Mainchain" + ), } } } diff --git a/enshrine-esdt-safe/src/to_sovereign/create_tx.rs b/enshrine-esdt-safe/src/to_sovereign/create_tx.rs index aafd5cef..59d0f9ae 100644 --- a/enshrine-esdt-safe/src/to_sovereign/create_tx.rs +++ b/enshrine-esdt-safe/src/to_sovereign/create_tx.rs @@ -69,9 +69,7 @@ pub trait CreateTxModule: current_token_data.amount = payment.amount.clone(); - if self.is_sovereign_chain().get() - || self.has_sov_token_prefix(&payment.token_identifier) - { + if self.is_sovereign_chain().get() || self.has_prefix(&payment.token_identifier) { self.send().esdt_local_burn( &payment.token_identifier, payment.token_nonce, From 86f397e73163ccc293d6ea5624fd35000c0e3ac9 Mon Sep 17 00:00:00 2001 From: Andrei Baltariu Date: Thu, 4 Jul 2024 14:15:27 +0300 Subject: [PATCH 099/523] Added inline prefix check function --- common/utils/src/lib.rs | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/common/utils/src/lib.rs b/common/utils/src/lib.rs index dcbd2c36..371d2d75 100644 --- a/common/utils/src/lib.rs +++ b/common/utils/src/lib.rs @@ -80,4 +80,11 @@ pub trait UtilsModule: bls_signature::BlsSignatureModule { false } + + #[inline] + fn has_sov_prefix(&self, token_id: &TokenIdentifier, sov_prefix: ManagedBuffer) -> bool { + require!(self.has_prefix(token_id), "Token does not have prefix"); + + *token_id == TokenIdentifier::from(sov_prefix) + } } From b6a8743fd81e6e741d1cf83199f3966c53429035 Mon Sep 17 00:00:00 2001 From: Andrei Baltariu Date: Thu, 4 Jul 2024 14:20:03 +0300 Subject: [PATCH 100/523] Modified inline function and used new has_sov_prefix function --- .../src/from_sovereign/transfer_tokens.rs | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/enshrine-esdt-safe/src/from_sovereign/transfer_tokens.rs b/enshrine-esdt-safe/src/from_sovereign/transfer_tokens.rs index 55cd7a1c..78c99145 100644 --- a/enshrine-esdt-safe/src/from_sovereign/transfer_tokens.rs +++ b/enshrine-esdt-safe/src/from_sovereign/transfer_tokens.rs @@ -183,7 +183,10 @@ pub trait TransferTokensModule: let mut output_payments = ManagedVec::new(); for operation_token in operation_tokens.iter() { - if !self.has_prefix(&operation_token.token_identifier) { + if !self.has_sov_prefix( + &operation_token.token_identifier, + self.get_sovereign_prefix(), + ) { output_payments.push(operation_token.clone()); continue; } @@ -341,7 +344,7 @@ pub trait TransferTokensModule: fn burn_sovereign_tokens(&self, operation: &Operation) { for token in operation.tokens.iter() { - if self.has_prefix(&token.token_identifier) { + if self.has_sov_prefix(&token.token_identifier, self.get_sovereign_prefix()) { self.send().esdt_local_burn( &token.token_identifier, token.token_nonce, @@ -405,7 +408,13 @@ pub trait TransferTokensModule: #[inline] fn was_token_registered(&self, token_id: &TokenIdentifier) -> bool { - self.has_prefix(token_id) && self.paid_issued_tokens().contains(token_id) + self.has_sov_prefix(token_id, self.get_sovereign_prefix()) + && self.paid_issued_tokens().contains(token_id) + } + + #[inline] + fn get_sovereign_prefix(&self) -> ManagedBuffer { + self.sovereign_token_prefix().get() } #[inline] From 3dcf59ca6096c76f0cf8c96247d1a8757026e25f Mon Sep 17 00:00:00 2001 From: Andrei Baltariu Date: Thu, 4 Jul 2024 14:45:40 +0300 Subject: [PATCH 101/523] Switched from OptionalValue to Option --- enshrine-esdt-safe/src/lib.rs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/enshrine-esdt-safe/src/lib.rs b/enshrine-esdt-safe/src/lib.rs index 870a34ee..3411d77e 100644 --- a/enshrine-esdt-safe/src/lib.rs +++ b/enshrine-esdt-safe/src/lib.rs @@ -27,25 +27,25 @@ pub trait EnshrineEsdtSafe: fn init( &self, is_sovereign_chain: bool, - wegld_identifier: OptionalValue, - sov_token_prefix: OptionalValue, + wegld_identifier: Option, + sov_token_prefix: Option, ) { self.is_sovereign_chain().set(is_sovereign_chain); self.set_paused(true); if !is_sovereign_chain { match (wegld_identifier, sov_token_prefix) { - (OptionalValue::Some(ticker), OptionalValue::Some(prefix)) => { + (Some(ticker), Some(prefix)) => { let identifier = TokenIdentifier::from(ticker); if identifier.is_valid_esdt_identifier() { self.wegld_identifier().set(identifier); self.sovereign_token_prefix().set(prefix); } } - (OptionalValue::Some(_), OptionalValue::None) => { + (Some(_), None) => { sc_panic!("Sovereign Token Prefix must be set in Mainchain") } - (OptionalValue::None, OptionalValue::Some(_)) => { + (None, Some(_)) => { sc_panic!("WEGLG identifier must be set in Mainchain") } _ => sc_panic!( From 9eee6b97ac44785a40a95e74b58f76d837baea42 Mon Sep 17 00:00:00 2001 From: Andrei Baltariu Date: Thu, 4 Jul 2024 14:51:02 +0300 Subject: [PATCH 102/523] Modified get_wegld logic to return BigUint and isize index --- .../src/from_sovereign/transfer_tokens.rs | 22 +++++++++---------- 1 file changed, 10 insertions(+), 12 deletions(-) diff --git a/enshrine-esdt-safe/src/from_sovereign/transfer_tokens.rs b/enshrine-esdt-safe/src/from_sovereign/transfer_tokens.rs index 78c99145..54797440 100644 --- a/enshrine-esdt-safe/src/from_sovereign/transfer_tokens.rs +++ b/enshrine-esdt-safe/src/from_sovereign/transfer_tokens.rs @@ -101,17 +101,17 @@ pub trait TransferTokensModule: ); } - fn get_wegld_payment( + fn get_wegld_payment_info( &self, tokens: &ManagedVec>, - ) -> (OperationEsdtPayment, usize) { + ) -> (BigUint, isize) { for (i, token) in tokens.iter().enumerate() { if self.is_wegld(&token.token_identifier) { - return (token, i); + return (token.token_data.amount, i as isize); } } - (OperationEsdtPayment::default(), 0) + (BigUint::from(0u32), -1) } fn verify_operation_tokens_for_issue_fee( @@ -120,11 +120,9 @@ pub trait TransferTokensModule: tokens: ManagedVec>, ) -> (ManagedVec>, bool) { require!(!tokens.is_empty(), "Tokens array should not be empty"); - let (wegld_payment, wegld_position) = self.get_wegld_payment(&tokens); - let is_empty_identifier = - wegld_payment.token_identifier == TokenIdentifier::from(ManagedBuffer::new()); + let (wegld_amount, wegld_position) = self.get_wegld_payment_info(&tokens); - if is_empty_identifier { + if wegld_position == -1 { for token in tokens.iter() { if !self.was_token_registered(&token.token_identifier) { return (ManagedVec::new(), false); @@ -134,7 +132,7 @@ pub trait TransferTokensModule: return (tokens, false); }; - if !is_empty_identifier && tokens.len() == 1 { + if wegld_position >= 0 && tokens.len() == 1 { return (tokens, false); } @@ -152,9 +150,9 @@ pub trait TransferTokensModule: let wegld_fee_amount = BigUint::from(DEFAULT_ISSUE_COST * unregistered_tokens.len() as u64); let mut registered_tokens = tokens; - registered_tokens.remove(wegld_position); + registered_tokens.remove(wegld_position as usize); - if wegld_payment.token_data.amount < wegld_fee_amount { + if wegld_amount < wegld_fee_amount { return (ManagedVec::new(), false); } @@ -162,7 +160,7 @@ pub trait TransferTokensModule: self.register_token(token_identifier.clone_value()); } - self.refund_wegld(sender, wegld_payment.token_data.amount - wegld_fee_amount); + self.refund_wegld(sender, wegld_amount - wegld_fee_amount); return (registered_tokens, false); } From 9b4a6698d3217a60cea05ed30dc4676df58e433e Mon Sep 17 00:00:00 2001 From: Andrei Baltariu Date: Thu, 4 Jul 2024 14:51:46 +0300 Subject: [PATCH 103/523] Regenerated proxy --- enshrine-esdt-safe/src/enshrine_esdt_safe_proxy.rs | 13 ++++++++++++- .../wasm-enshrine-esdt-safe-full/src/lib.rs | 5 +++-- enshrine-esdt-safe/wasm/src/lib.rs | 5 +++-- 3 files changed, 18 insertions(+), 5 deletions(-) diff --git a/enshrine-esdt-safe/src/enshrine_esdt_safe_proxy.rs b/enshrine-esdt-safe/src/enshrine_esdt_safe_proxy.rs index 6a00ad9d..9557acd8 100644 --- a/enshrine-esdt-safe/src/enshrine_esdt_safe_proxy.rs +++ b/enshrine-esdt-safe/src/enshrine_esdt_safe_proxy.rs @@ -45,17 +45,20 @@ where { pub fn init< Arg0: ProxyArg, - Arg1: ProxyArg>>, + Arg1: ProxyArg>>, + Arg2: ProxyArg>>, >( self, is_sovereign_chain: Arg0, wegld_identifier: Arg1, + sov_token_prefix: Arg2, ) -> TxTypedDeploy { self.wrapped_tx .payment(NotPayable) .raw_deploy() .argument(&is_sovereign_chain) .argument(&wegld_identifier) + .argument(&sov_token_prefix) .original_result() } } @@ -196,6 +199,14 @@ where .original_result() } + pub fn deposit_for_new_registrations( + self, + ) -> TxTypedCall { + self.wrapped_tx + .raw_call("depositForNewRegistrations") + .original_result() + } + pub fn set_max_tx_batch_size< Arg0: ProxyArg, >( diff --git a/enshrine-esdt-safe/wasm-enshrine-esdt-safe-full/src/lib.rs b/enshrine-esdt-safe/wasm-enshrine-esdt-safe-full/src/lib.rs index 08014062..65a944a9 100644 --- a/enshrine-esdt-safe/wasm-enshrine-esdt-safe-full/src/lib.rs +++ b/enshrine-esdt-safe/wasm-enshrine-esdt-safe-full/src/lib.rs @@ -6,10 +6,10 @@ // Init: 1 // Upgrade: 1 -// Endpoints: 28 +// Endpoints: 29 // Async Callback: 1 // Promise callbacks: 1 -// Total number of exported functions: 32 +// Total number of exported functions: 33 #![no_std] @@ -29,6 +29,7 @@ multiversx_sc_wasm_adapter::endpoints! { removeSigners => remove_signers executeBridgeOps => execute_operations registerTokens => register_tokens + depositForNewRegistrations => deposit_for_new_registrations setMaxTxBatchSize => set_max_tx_batch_size setMaxTxBatchBlockDuration => set_max_tx_batch_block_duration getCurrentTxBatch => get_current_tx_batch diff --git a/enshrine-esdt-safe/wasm/src/lib.rs b/enshrine-esdt-safe/wasm/src/lib.rs index 08014062..65a944a9 100644 --- a/enshrine-esdt-safe/wasm/src/lib.rs +++ b/enshrine-esdt-safe/wasm/src/lib.rs @@ -6,10 +6,10 @@ // Init: 1 // Upgrade: 1 -// Endpoints: 28 +// Endpoints: 29 // Async Callback: 1 // Promise callbacks: 1 -// Total number of exported functions: 32 +// Total number of exported functions: 33 #![no_std] @@ -29,6 +29,7 @@ multiversx_sc_wasm_adapter::endpoints! { removeSigners => remove_signers executeBridgeOps => execute_operations registerTokens => register_tokens + depositForNewRegistrations => deposit_for_new_registrations setMaxTxBatchSize => set_max_tx_batch_size setMaxTxBatchBlockDuration => set_max_tx_batch_block_duration getCurrentTxBatch => get_current_tx_batch From f49be5122c30f60e0d6cec1405cbfc6b87cab353 Mon Sep 17 00:00:00 2001 From: Andrei Baltariu Date: Thu, 4 Jul 2024 18:33:27 +0300 Subject: [PATCH 104/523] Modified function to check sovereign prefix --- common/utils/src/lib.rs | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/common/utils/src/lib.rs b/common/utils/src/lib.rs index 371d2d75..5432834d 100644 --- a/common/utils/src/lib.rs +++ b/common/utils/src/lib.rs @@ -81,10 +81,22 @@ pub trait UtilsModule: bls_signature::BlsSignatureModule { false } - #[inline] - fn has_sov_prefix(&self, token_id: &TokenIdentifier, sov_prefix: ManagedBuffer) -> bool { + fn has_sov_prefix(&self, token_id: &TokenIdentifier, chain_prefix: ManagedBuffer) -> bool { require!(self.has_prefix(token_id), "Token does not have prefix"); - *token_id == TokenIdentifier::from(sov_prefix) + let dash = b'-'; + let buffer = token_id.as_managed_buffer(); + let mut array_buffer = [0u8; 32]; + let slice = buffer.load_to_byte_array(&mut array_buffer); + + if let Some(index) = slice.iter().position(|&b| b == dash) { + let prefix = ManagedBuffer::from(&slice[..index]); + + if prefix == chain_prefix { + return true; + } + } + + false } } From 0a6a31f1e9a74fc04830010aa32c18381c3e39da Mon Sep 17 00:00:00 2001 From: Andrei Baltariu Date: Thu, 4 Jul 2024 18:34:31 +0300 Subject: [PATCH 105/523] Renamed sovereign token mapper --- enshrine-esdt-safe/src/common/storage.rs | 2 +- enshrine-esdt-safe/src/from_sovereign/transfer_tokens.rs | 2 +- enshrine-esdt-safe/src/lib.rs | 2 +- enshrine-esdt-safe/src/to_sovereign/create_tx.rs | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/enshrine-esdt-safe/src/common/storage.rs b/enshrine-esdt-safe/src/common/storage.rs index 331e4de6..8153b9f2 100644 --- a/enshrine-esdt-safe/src/common/storage.rs +++ b/enshrine-esdt-safe/src/common/storage.rs @@ -9,5 +9,5 @@ pub trait CommonStorage { fn wegld_identifier(&self) -> SingleValueMapper; #[storage_mapper("sovereignTokenPrefix")] - fn sovereign_token_prefix(&self) -> SingleValueMapper; + fn sovereign_tokens_prefix(&self) -> SingleValueMapper; } diff --git a/enshrine-esdt-safe/src/from_sovereign/transfer_tokens.rs b/enshrine-esdt-safe/src/from_sovereign/transfer_tokens.rs index 54797440..00b8ec57 100644 --- a/enshrine-esdt-safe/src/from_sovereign/transfer_tokens.rs +++ b/enshrine-esdt-safe/src/from_sovereign/transfer_tokens.rs @@ -412,7 +412,7 @@ pub trait TransferTokensModule: #[inline] fn get_sovereign_prefix(&self) -> ManagedBuffer { - self.sovereign_token_prefix().get() + self.sovereign_tokens_prefix().get() } #[inline] diff --git a/enshrine-esdt-safe/src/lib.rs b/enshrine-esdt-safe/src/lib.rs index 3411d77e..e45e1d85 100644 --- a/enshrine-esdt-safe/src/lib.rs +++ b/enshrine-esdt-safe/src/lib.rs @@ -39,7 +39,7 @@ pub trait EnshrineEsdtSafe: let identifier = TokenIdentifier::from(ticker); if identifier.is_valid_esdt_identifier() { self.wegld_identifier().set(identifier); - self.sovereign_token_prefix().set(prefix); + self.sovereign_tokens_prefix().set(prefix); } } (Some(_), None) => { diff --git a/enshrine-esdt-safe/src/to_sovereign/create_tx.rs b/enshrine-esdt-safe/src/to_sovereign/create_tx.rs index 59d0f9ae..4f18b76d 100644 --- a/enshrine-esdt-safe/src/to_sovereign/create_tx.rs +++ b/enshrine-esdt-safe/src/to_sovereign/create_tx.rs @@ -69,7 +69,7 @@ pub trait CreateTxModule: current_token_data.amount = payment.amount.clone(); - if self.is_sovereign_chain().get() || self.has_prefix(&payment.token_identifier) { + if self.is_sovereign_chain().get() || self.has_sov_prefix(&payment.token_identifier) { self.send().esdt_local_burn( &payment.token_identifier, payment.token_nonce, From 62aa434104a49ecd63d862061ad3ac6dcc26e656 Mon Sep 17 00:00:00 2001 From: Andrei Baltariu Date: Thu, 4 Jul 2024 18:42:34 +0300 Subject: [PATCH 106/523] Modified wegld fee and mint & burn logic --- .../src/from_sovereign/transfer_tokens.rs | 27 +++++++++---------- 1 file changed, 13 insertions(+), 14 deletions(-) diff --git a/enshrine-esdt-safe/src/from_sovereign/transfer_tokens.rs b/enshrine-esdt-safe/src/from_sovereign/transfer_tokens.rs index 00b8ec57..042a1c2e 100644 --- a/enshrine-esdt-safe/src/from_sovereign/transfer_tokens.rs +++ b/enshrine-esdt-safe/src/from_sovereign/transfer_tokens.rs @@ -129,11 +129,11 @@ pub trait TransferTokensModule: } } - return (tokens, false); + return (tokens, true); }; - if wegld_position >= 0 && tokens.len() == 1 { - return (tokens, false); + if tokens.len() == 1 { + return (tokens, true); } let mut unregistered_tokens: ManagedVec = ManagedVec::new(); @@ -162,7 +162,7 @@ pub trait TransferTokensModule: self.refund_wegld(sender, wegld_amount - wegld_fee_amount); - return (registered_tokens, false); + return (registered_tokens, true); } fn refund_wegld(&self, sender: &ManagedAddress, wegld_amount: BigUint) { @@ -181,10 +181,7 @@ pub trait TransferTokensModule: let mut output_payments = ManagedVec::new(); for operation_token in operation_tokens.iter() { - if !self.has_sov_prefix( - &operation_token.token_identifier, - self.get_sovereign_prefix(), - ) { + if !self.has_prefix(&operation_token.token_identifier) { output_payments.push(operation_token.clone()); continue; } @@ -342,13 +339,15 @@ pub trait TransferTokensModule: fn burn_sovereign_tokens(&self, operation: &Operation) { for token in operation.tokens.iter() { - if self.has_sov_prefix(&token.token_identifier, self.get_sovereign_prefix()) { - self.send().esdt_local_burn( - &token.token_identifier, - token.token_nonce, - &token.token_data.amount, - ); + if self.has_prefix(&token.token_identifier) { + continue; } + + self.send().esdt_local_burn( + &token.token_identifier, + token.token_nonce, + &token.token_data.amount, + ); } } From 7f058e61dee36e2d1d34034f3e3973416bf928f0 Mon Sep 17 00:00:00 2001 From: Andrei Baltariu Date: Thu, 4 Jul 2024 18:51:36 +0300 Subject: [PATCH 107/523] Separated lib.rs match statement --- enshrine-esdt-safe/src/lib.rs | 31 ++++++++++++++++--------------- 1 file changed, 16 insertions(+), 15 deletions(-) diff --git a/enshrine-esdt-safe/src/lib.rs b/enshrine-esdt-safe/src/lib.rs index e45e1d85..2064b71e 100644 --- a/enshrine-esdt-safe/src/lib.rs +++ b/enshrine-esdt-safe/src/lib.rs @@ -34,23 +34,24 @@ pub trait EnshrineEsdtSafe: self.set_paused(true); if !is_sovereign_chain { - match (wegld_identifier, sov_token_prefix) { - (Some(ticker), Some(prefix)) => { + match wegld_identifier { + Some(ticker) => { let identifier = TokenIdentifier::from(ticker); - if identifier.is_valid_esdt_identifier() { - self.wegld_identifier().set(identifier); - self.sovereign_tokens_prefix().set(prefix); - } - } - (Some(_), None) => { - sc_panic!("Sovereign Token Prefix must be set in Mainchain") - } - (None, Some(_)) => { - sc_panic!("WEGLG identifier must be set in Mainchain") + + require!( + identifier.is_valid_esdt_identifier(), + "Sent Identifier is not valid" + ); + + self.wegld_identifier().set(identifier); } - _ => sc_panic!( - "Both WEGLD identifier and Sovereign Token Prefix must be set in Mainchain" - ), + + None => sc_panic!("WEGLG identifier must be set in Mainchain"), + } + + match sov_token_prefix { + Some(prefix) => self.sovereign_tokens_prefix().set(prefix), + None => sc_panic!("Sovereign Token Prefix must be set in Mainchain"), } } } From 906fb920ac952f057ccf7bde87251e44563e8e51 Mon Sep 17 00:00:00 2001 From: Andrei Baltariu Date: Thu, 4 Jul 2024 18:53:45 +0300 Subject: [PATCH 108/523] Reverted create_tx file --- enshrine-esdt-safe/src/to_sovereign/create_tx.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/enshrine-esdt-safe/src/to_sovereign/create_tx.rs b/enshrine-esdt-safe/src/to_sovereign/create_tx.rs index 4f18b76d..59d0f9ae 100644 --- a/enshrine-esdt-safe/src/to_sovereign/create_tx.rs +++ b/enshrine-esdt-safe/src/to_sovereign/create_tx.rs @@ -69,7 +69,7 @@ pub trait CreateTxModule: current_token_data.amount = payment.amount.clone(); - if self.is_sovereign_chain().get() || self.has_sov_prefix(&payment.token_identifier) { + if self.is_sovereign_chain().get() || self.has_prefix(&payment.token_identifier) { self.send().esdt_local_burn( &payment.token_identifier, payment.token_nonce, From aaf36e77335620e3a1e151e6f88c5b09d58709a9 Mon Sep 17 00:00:00 2001 From: Andrei Baltariu Date: Fri, 5 Jul 2024 11:22:57 +0300 Subject: [PATCH 109/523] Modified mapper identifier and removed require --- enshrine-esdt-safe/src/common/storage.rs | 2 +- .../src/from_sovereign/transfer_tokens.rs | 10 ++++++---- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/enshrine-esdt-safe/src/common/storage.rs b/enshrine-esdt-safe/src/common/storage.rs index 8153b9f2..37097f96 100644 --- a/enshrine-esdt-safe/src/common/storage.rs +++ b/enshrine-esdt-safe/src/common/storage.rs @@ -8,6 +8,6 @@ pub trait CommonStorage { #[storage_mapper("wegldIdentifier")] fn wegld_identifier(&self) -> SingleValueMapper; - #[storage_mapper("sovereignTokenPrefix")] + #[storage_mapper("sovereignTokensPrefix")] fn sovereign_tokens_prefix(&self) -> SingleValueMapper; } diff --git a/enshrine-esdt-safe/src/from_sovereign/transfer_tokens.rs b/enshrine-esdt-safe/src/from_sovereign/transfer_tokens.rs index 042a1c2e..f6a32e75 100644 --- a/enshrine-esdt-safe/src/from_sovereign/transfer_tokens.rs +++ b/enshrine-esdt-safe/src/from_sovereign/transfer_tokens.rs @@ -160,14 +160,16 @@ pub trait TransferTokensModule: self.register_token(token_identifier.clone_value()); } - self.refund_wegld(sender, wegld_amount - wegld_fee_amount); + let remaining_wegld = wegld_amount - wegld_fee_amount; + + if remaining_wegld > 0 { + self.refund_wegld(sender, remaining_wegld); + } return (registered_tokens, true); } fn refund_wegld(&self, sender: &ManagedAddress, wegld_amount: BigUint) { - require!(wegld_amount > 0, "No WEGLD fee sent"); - let wegld_identifier = self.wegld_identifier().get(); let payment = EsdtTokenPayment::new(wegld_identifier, 0, wegld_amount); @@ -339,7 +341,7 @@ pub trait TransferTokensModule: fn burn_sovereign_tokens(&self, operation: &Operation) { for token in operation.tokens.iter() { - if self.has_prefix(&token.token_identifier) { + if !self.has_prefix(&token.token_identifier) { continue; } From 28736ebf3fdc5861228d3509e70191a5c84729b5 Mon Sep 17 00:00:00 2001 From: Andrei Baltariu Date: Fri, 5 Jul 2024 13:02:09 +0300 Subject: [PATCH 110/523] Called has_sov_prefix instead of has_prefix --- enshrine-esdt-safe/src/from_sovereign/transfer_tokens.rs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/enshrine-esdt-safe/src/from_sovereign/transfer_tokens.rs b/enshrine-esdt-safe/src/from_sovereign/transfer_tokens.rs index f6a32e75..76e42ab2 100644 --- a/enshrine-esdt-safe/src/from_sovereign/transfer_tokens.rs +++ b/enshrine-esdt-safe/src/from_sovereign/transfer_tokens.rs @@ -183,7 +183,8 @@ pub trait TransferTokensModule: let mut output_payments = ManagedVec::new(); for operation_token in operation_tokens.iter() { - if !self.has_prefix(&operation_token.token_identifier) { + let sov_prefix = self.get_sovereign_prefix(); + if !self.has_sov_prefix(&operation_token.token_identifier, sov_prefix) { output_payments.push(operation_token.clone()); continue; } @@ -341,7 +342,8 @@ pub trait TransferTokensModule: fn burn_sovereign_tokens(&self, operation: &Operation) { for token in operation.tokens.iter() { - if !self.has_prefix(&token.token_identifier) { + let sov_prefix = self.get_sovereign_prefix(); + if !self.has_sov_prefix(&token.token_identifier, sov_prefix) { continue; } From 5d3b2f463e4b33d44e6a7dddbe54e7b1a786d429 Mon Sep 17 00:00:00 2001 From: Andrei Baltariu Date: Fri, 5 Jul 2024 13:16:14 +0300 Subject: [PATCH 111/523] Modified token verification logic Now the verification consists only if the tokens has the current's sovereign prefix and if they are registered. The WEGLD fee has to be paid before execution. --- .../src/from_sovereign/transfer_tokens.rs | 95 ++----------------- 1 file changed, 10 insertions(+), 85 deletions(-) diff --git a/enshrine-esdt-safe/src/from_sovereign/transfer_tokens.rs b/enshrine-esdt-safe/src/from_sovereign/transfer_tokens.rs index 76e42ab2..3247c1a8 100644 --- a/enshrine-esdt-safe/src/from_sovereign/transfer_tokens.rs +++ b/enshrine-esdt-safe/src/from_sovereign/transfer_tokens.rs @@ -39,24 +39,20 @@ pub trait TransferTokensModule: sc_panic!("Operation is not registered"); } - let (remaining_tokens, is_wegld_fee_paid) = self.verify_operation_tokens_for_issue_fee( - &operation.data.op_sender, - operation.tokens.clone(), - ); + let are_tokens_registered = + self.verify_operation_tokens_issue_paid(operation.tokens.clone()); - if !is_wegld_fee_paid { + if !are_tokens_registered { self.emit_transfer_failed_events( &hash_of_hashes, &OperationTuple { - op_hash: operation_hash, - operation, + op_hash: operation_hash.clone(), + operation: operation.clone(), }, ); - - sc_panic!("Not enough WEGLD to register all tokens"); } - let minted_operation_tokens = self.mint_tokens(&remaining_tokens); + let minted_operation_tokens = self.mint_tokens(&operation.tokens); let operation_tuple = OperationTuple { op_hash: operation_hash.clone(), operation: operation.clone(), @@ -90,90 +86,19 @@ pub trait TransferTokensModule: } } - #[endpoint(depositForNewRegistrations)] - #[payable("*")] - fn deposit_for_new_registrations(&self) { - let call_value = self.call_value().single_esdt(); - - require!( - call_value.amount >= DEFAULT_ISSUE_COST, - "The minimum amount of WEGLD wasn't met" - ); - } - - fn get_wegld_payment_info( - &self, - tokens: &ManagedVec>, - ) -> (BigUint, isize) { - for (i, token) in tokens.iter().enumerate() { - if self.is_wegld(&token.token_identifier) { - return (token.token_data.amount, i as isize); - } - } - - (BigUint::from(0u32), -1) - } - - fn verify_operation_tokens_for_issue_fee( + fn verify_operation_tokens_issue_paid( &self, - sender: &ManagedAddress, tokens: ManagedVec>, - ) -> (ManagedVec>, bool) { + ) -> bool { require!(!tokens.is_empty(), "Tokens array should not be empty"); - let (wegld_amount, wegld_position) = self.get_wegld_payment_info(&tokens); - - if wegld_position == -1 { - for token in tokens.iter() { - if !self.was_token_registered(&token.token_identifier) { - return (ManagedVec::new(), false); - } - } - - return (tokens, true); - }; - - if tokens.len() == 1 { - return (tokens, true); - } - - let mut unregistered_tokens: ManagedVec = ManagedVec::new(); for token in tokens.iter() { if !self.was_token_registered(&token.token_identifier) { - unregistered_tokens.push(token.token_identifier); + return false; } } - if unregistered_tokens.is_empty() { - return (tokens, true); - } - - let wegld_fee_amount = BigUint::from(DEFAULT_ISSUE_COST * unregistered_tokens.len() as u64); - let mut registered_tokens = tokens; - registered_tokens.remove(wegld_position as usize); - - if wegld_amount < wegld_fee_amount { - return (ManagedVec::new(), false); - } - - for token_identifier in unregistered_tokens.iter() { - self.register_token(token_identifier.clone_value()); - } - - let remaining_wegld = wegld_amount - wegld_fee_amount; - - if remaining_wegld > 0 { - self.refund_wegld(sender, remaining_wegld); - } - - return (registered_tokens, true); - } - - fn refund_wegld(&self, sender: &ManagedAddress, wegld_amount: BigUint) { - let wegld_identifier = self.wegld_identifier().get(); - let payment = EsdtTokenPayment::new(wegld_identifier, 0, wegld_amount); - - self.tx().to(sender).esdt(payment).transfer(); + true } fn mint_tokens( From ff22b99c99253eb11d7bf6795b65d7e72ec54ebe Mon Sep 17 00:00:00 2001 From: Andrei Baltariu Date: Fri, 5 Jul 2024 13:20:43 +0300 Subject: [PATCH 112/523] Regenerated proxy --- enshrine-esdt-safe/src/enshrine_esdt_safe_proxy.rs | 8 -------- .../wasm-enshrine-esdt-safe-full/src/lib.rs | 5 ++--- enshrine-esdt-safe/wasm/src/lib.rs | 5 ++--- 3 files changed, 4 insertions(+), 14 deletions(-) diff --git a/enshrine-esdt-safe/src/enshrine_esdt_safe_proxy.rs b/enshrine-esdt-safe/src/enshrine_esdt_safe_proxy.rs index 9557acd8..abaec97f 100644 --- a/enshrine-esdt-safe/src/enshrine_esdt_safe_proxy.rs +++ b/enshrine-esdt-safe/src/enshrine_esdt_safe_proxy.rs @@ -199,14 +199,6 @@ where .original_result() } - pub fn deposit_for_new_registrations( - self, - ) -> TxTypedCall { - self.wrapped_tx - .raw_call("depositForNewRegistrations") - .original_result() - } - pub fn set_max_tx_batch_size< Arg0: ProxyArg, >( diff --git a/enshrine-esdt-safe/wasm-enshrine-esdt-safe-full/src/lib.rs b/enshrine-esdt-safe/wasm-enshrine-esdt-safe-full/src/lib.rs index 65a944a9..08014062 100644 --- a/enshrine-esdt-safe/wasm-enshrine-esdt-safe-full/src/lib.rs +++ b/enshrine-esdt-safe/wasm-enshrine-esdt-safe-full/src/lib.rs @@ -6,10 +6,10 @@ // Init: 1 // Upgrade: 1 -// Endpoints: 29 +// Endpoints: 28 // Async Callback: 1 // Promise callbacks: 1 -// Total number of exported functions: 33 +// Total number of exported functions: 32 #![no_std] @@ -29,7 +29,6 @@ multiversx_sc_wasm_adapter::endpoints! { removeSigners => remove_signers executeBridgeOps => execute_operations registerTokens => register_tokens - depositForNewRegistrations => deposit_for_new_registrations setMaxTxBatchSize => set_max_tx_batch_size setMaxTxBatchBlockDuration => set_max_tx_batch_block_duration getCurrentTxBatch => get_current_tx_batch diff --git a/enshrine-esdt-safe/wasm/src/lib.rs b/enshrine-esdt-safe/wasm/src/lib.rs index 65a944a9..08014062 100644 --- a/enshrine-esdt-safe/wasm/src/lib.rs +++ b/enshrine-esdt-safe/wasm/src/lib.rs @@ -6,10 +6,10 @@ // Init: 1 // Upgrade: 1 -// Endpoints: 29 +// Endpoints: 28 // Async Callback: 1 // Promise callbacks: 1 -// Total number of exported functions: 33 +// Total number of exported functions: 32 #![no_std] @@ -29,7 +29,6 @@ multiversx_sc_wasm_adapter::endpoints! { removeSigners => remove_signers executeBridgeOps => execute_operations registerTokens => register_tokens - depositForNewRegistrations => deposit_for_new_registrations setMaxTxBatchSize => set_max_tx_batch_size setMaxTxBatchBlockDuration => set_max_tx_batch_block_duration getCurrentTxBatch => get_current_tx_batch From 13e4765065683d379e8e7013ab2e812a3376accd Mon Sep 17 00:00:00 2001 From: Andrei Baltariu Date: Fri, 5 Jul 2024 15:00:56 +0300 Subject: [PATCH 113/523] Renamed endpoint --- enshrine-esdt-safe/src/enshrine_esdt_safe_proxy.rs | 4 ++-- enshrine-esdt-safe/src/from_sovereign/transfer_tokens.rs | 4 ++-- enshrine-esdt-safe/wasm-enshrine-esdt-safe-full/src/lib.rs | 2 +- enshrine-esdt-safe/wasm/src/lib.rs | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/enshrine-esdt-safe/src/enshrine_esdt_safe_proxy.rs b/enshrine-esdt-safe/src/enshrine_esdt_safe_proxy.rs index abaec97f..54425666 100644 --- a/enshrine-esdt-safe/src/enshrine_esdt_safe_proxy.rs +++ b/enshrine-esdt-safe/src/enshrine_esdt_safe_proxy.rs @@ -187,14 +187,14 @@ where .original_result() } - pub fn register_tokens< + pub fn register_new_token_id< Arg0: ProxyArg>>, >( self, tokens: Arg0, ) -> TxTypedCall { self.wrapped_tx - .raw_call("registerTokens") + .raw_call("registerNewTokenID") .argument(&tokens) .original_result() } diff --git a/enshrine-esdt-safe/src/from_sovereign/transfer_tokens.rs b/enshrine-esdt-safe/src/from_sovereign/transfer_tokens.rs index 3247c1a8..24ee0238 100644 --- a/enshrine-esdt-safe/src/from_sovereign/transfer_tokens.rs +++ b/enshrine-esdt-safe/src/from_sovereign/transfer_tokens.rs @@ -65,9 +65,9 @@ pub trait TransferTokensModule: ); } - #[endpoint(registerTokens)] + #[endpoint(registerNewTokenID)] #[payable("*")] - fn register_tokens(&self, tokens: MultiValueEncoded) { + fn register_new_token_id(&self, tokens: MultiValueEncoded) { let call_payment = self.call_value().single_esdt().clone(); let wegld_identifier = self.wegld_identifier().get(); diff --git a/enshrine-esdt-safe/wasm-enshrine-esdt-safe-full/src/lib.rs b/enshrine-esdt-safe/wasm-enshrine-esdt-safe-full/src/lib.rs index 08014062..d7a87d6b 100644 --- a/enshrine-esdt-safe/wasm-enshrine-esdt-safe-full/src/lib.rs +++ b/enshrine-esdt-safe/wasm-enshrine-esdt-safe-full/src/lib.rs @@ -28,7 +28,7 @@ multiversx_sc_wasm_adapter::endpoints! { addSigners => add_signers removeSigners => remove_signers executeBridgeOps => execute_operations - registerTokens => register_tokens + registerNewTokenID => register_new_token_id setMaxTxBatchSize => set_max_tx_batch_size setMaxTxBatchBlockDuration => set_max_tx_batch_block_duration getCurrentTxBatch => get_current_tx_batch diff --git a/enshrine-esdt-safe/wasm/src/lib.rs b/enshrine-esdt-safe/wasm/src/lib.rs index 08014062..d7a87d6b 100644 --- a/enshrine-esdt-safe/wasm/src/lib.rs +++ b/enshrine-esdt-safe/wasm/src/lib.rs @@ -28,7 +28,7 @@ multiversx_sc_wasm_adapter::endpoints! { addSigners => add_signers removeSigners => remove_signers executeBridgeOps => execute_operations - registerTokens => register_tokens + registerNewTokenID => register_new_token_id setMaxTxBatchSize => set_max_tx_batch_size setMaxTxBatchBlockDuration => set_max_tx_batch_block_duration getCurrentTxBatch => get_current_tx_batch From 13bac6a5ae040486e44440a528d86c94806a70f1 Mon Sep 17 00:00:00 2001 From: Andrei Baltariu Date: Fri, 5 Jul 2024 15:01:35 +0300 Subject: [PATCH 114/523] Removed require statement --- enshrine-esdt-safe/src/from_sovereign/transfer_tokens.rs | 2 -- 1 file changed, 2 deletions(-) diff --git a/enshrine-esdt-safe/src/from_sovereign/transfer_tokens.rs b/enshrine-esdt-safe/src/from_sovereign/transfer_tokens.rs index 24ee0238..21644154 100644 --- a/enshrine-esdt-safe/src/from_sovereign/transfer_tokens.rs +++ b/enshrine-esdt-safe/src/from_sovereign/transfer_tokens.rs @@ -90,8 +90,6 @@ pub trait TransferTokensModule: &self, tokens: ManagedVec>, ) -> bool { - require!(!tokens.is_empty(), "Tokens array should not be empty"); - for token in tokens.iter() { if !self.was_token_registered(&token.token_identifier) { return false; From 5db58c695e72a808dcefc430c4c1fd217564f79d Mon Sep 17 00:00:00 2001 From: Andrei Baltariu Date: Mon, 8 Jul 2024 13:12:14 +0300 Subject: [PATCH 115/523] Added panic in execute operations --- enshrine-esdt-safe/src/from_sovereign/transfer_tokens.rs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/enshrine-esdt-safe/src/from_sovereign/transfer_tokens.rs b/enshrine-esdt-safe/src/from_sovereign/transfer_tokens.rs index 21644154..476e1249 100644 --- a/enshrine-esdt-safe/src/from_sovereign/transfer_tokens.rs +++ b/enshrine-esdt-safe/src/from_sovereign/transfer_tokens.rs @@ -50,6 +50,8 @@ pub trait TransferTokensModule: operation: operation.clone(), }, ); + + sc_panic!("One or more tokens are not registered"); } let minted_operation_tokens = self.mint_tokens(&operation.tokens); From 98e86fdca3ab3db7f5a0d0f4f33029413a3dcbae Mon Sep 17 00:00:00 2001 From: Andrei Baltariu Date: Mon, 8 Jul 2024 15:51:57 +0300 Subject: [PATCH 116/523] Modified init argument --- enshrine-esdt-safe/src/enshrine_esdt_safe_proxy.rs | 2 +- enshrine-esdt-safe/src/lib.rs | 6 ++---- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/enshrine-esdt-safe/src/enshrine_esdt_safe_proxy.rs b/enshrine-esdt-safe/src/enshrine_esdt_safe_proxy.rs index 54425666..e7be6902 100644 --- a/enshrine-esdt-safe/src/enshrine_esdt_safe_proxy.rs +++ b/enshrine-esdt-safe/src/enshrine_esdt_safe_proxy.rs @@ -45,7 +45,7 @@ where { pub fn init< Arg0: ProxyArg, - Arg1: ProxyArg>>, + Arg1: ProxyArg>>, Arg2: ProxyArg>>, >( self, diff --git a/enshrine-esdt-safe/src/lib.rs b/enshrine-esdt-safe/src/lib.rs index 2064b71e..b3472a1c 100644 --- a/enshrine-esdt-safe/src/lib.rs +++ b/enshrine-esdt-safe/src/lib.rs @@ -27,7 +27,7 @@ pub trait EnshrineEsdtSafe: fn init( &self, is_sovereign_chain: bool, - wegld_identifier: Option, + wegld_identifier: Option, sov_token_prefix: Option, ) { self.is_sovereign_chain().set(is_sovereign_chain); @@ -35,9 +35,7 @@ pub trait EnshrineEsdtSafe: if !is_sovereign_chain { match wegld_identifier { - Some(ticker) => { - let identifier = TokenIdentifier::from(ticker); - + Some(identifier) => { require!( identifier.is_valid_esdt_identifier(), "Sent Identifier is not valid" From 1ee29cc7bff30b9ff3bf1617eb5da541b8ce5185 Mon Sep 17 00:00:00 2001 From: Andrei Baltariu Date: Mon, 8 Jul 2024 16:02:49 +0300 Subject: [PATCH 117/523] Framework upgrade to 0.51 --- Cargo.lock | 1541 ++--------------- chain-config/Cargo.toml | 6 +- chain-config/meta/Cargo.toml | 4 +- chain-config/meta/src/main.rs | 2 +- chain-config/wasm/Cargo.toml | 8 +- chain-factory/Cargo.toml | 4 +- chain-factory/meta/Cargo.toml | 4 +- chain-factory/meta/src/main.rs | 2 +- chain-factory/wasm/Cargo.toml | 8 +- common/bls-signature/Cargo.toml | 4 +- common/max-bridged-amount-module/Cargo.toml | 4 +- common/setup-phase/Cargo.toml | 4 +- common/token-whitelist/Cargo.toml | 4 +- common/transaction/Cargo.toml | 2 +- common/tx-batch-module/Cargo.toml | 4 +- common/utils/Cargo.toml | 2 +- enshrine-esdt-safe/Cargo.toml | 6 +- enshrine-esdt-safe/meta/Cargo.toml | 4 +- enshrine-esdt-safe/meta/src/main.rs | 2 +- .../wasm-enshrine-esdt-safe-full/Cargo.toml | 8 +- .../wasm-enshrine-esdt-safe-view/Cargo.toml | 8 +- enshrine-esdt-safe/wasm/Cargo.toml | 8 +- esdt-safe/Cargo.toml | 6 +- esdt-safe/meta/Cargo.toml | 4 +- esdt-safe/meta/src/main.rs | 2 +- esdt-safe/wasm-esdt-safe-full/Cargo.toml | 8 +- esdt-safe/wasm-esdt-safe-view/Cargo.toml | 8 +- esdt-safe/wasm/Cargo.toml | 8 +- fee-market/Cargo.toml | 4 +- fee-market/meta/Cargo.toml | 4 +- fee-market/meta/src/main.rs | 2 +- fee-market/wasm-fee-marker-full/Cargo.toml | 8 +- fee-market/wasm-multisig-view/Cargo.toml | 8 +- fee-market/wasm/Cargo.toml | 8 +- header-verifier/Cargo.toml | 4 +- header-verifier/meta/Cargo.toml | 4 +- header-verifier/meta/src/main.rs | 2 +- .../wasm-header-verifier-full/Cargo.toml | 8 +- header-verifier/wasm-multisig-view/Cargo.toml | 8 +- header-verifier/wasm/Cargo.toml | 8 +- pair-mock/Cargo.toml | 4 +- pair-mock/meta/Cargo.toml | 4 +- pair-mock/meta/src/main.rs | 2 +- pair-mock/wasm/Cargo.toml | 8 +- router-mock/Cargo.toml | 4 +- router-mock/meta/Cargo.toml | 4 +- router-mock/meta/src/main.rs | 2 +- router-mock/wasm/Cargo.toml | 8 +- 48 files changed, 177 insertions(+), 1602 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index d80204bd..35328cfa 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2,31 +2,6 @@ # It is not intended for manual editing. version = 3 -[[package]] -name = "Inflector" -version = "0.11.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fe438c63458706e03479442743baae6c88256498e6431708f6dfc520a26515d3" -dependencies = [ - "lazy_static", - "regex", -] - -[[package]] -name = "addr2line" -version = "0.21.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8a30b2e23b9e17a9f90641c7ab1549cd9b44f296d3ccbf309d2863cfe398a0cb" -dependencies = [ - "gimli", -] - -[[package]] -name = "adler" -version = "1.0.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f26201604c87b1e01bd3d98f8d5d9a8fcbb815e8cedb41ffccbeb4bf593a35fe" - [[package]] name = "ahash" version = "0.8.11" @@ -39,15 +14,6 @@ dependencies = [ "zerocopy", ] -[[package]] -name = "aho-corasick" -version = "1.1.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8e60d3430d3a69478ad0993f19238d2df97c507009a52b3c10addcd7f6bcb916" -dependencies = [ - "memchr", -] - [[package]] name = "anstream" version = "0.6.13" @@ -102,15 +68,6 @@ version = "1.0.82" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f538837af36e6f6a9be0faa67f9a314f8119e4e4b5867c6ab40ed60360142519" -[[package]] -name = "arbitrary" -version = "1.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7d5a26814d8dcb93b0e5a0ff3c6d80a8843bafb21b39e8e18a6f05471870e110" -dependencies = [ - "derive_arbitrary", -] - [[package]] name = "arrayvec" version = "0.7.4" @@ -123,21 +80,6 @@ version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f1fdabc7756949593fe60f30ec81974b613357de856987752631dea1e3394c80" -[[package]] -name = "backtrace" -version = "0.3.71" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "26b05800d2e817c8b3b4b54abd461726265fa9789ae34330622f2db9ee696f9d" -dependencies = [ - "addr2line", - "cc", - "cfg-if", - "libc", - "miniz_oxide", - "object", - "rustc-demangle", -] - [[package]] name = "base64" version = "0.22.0" @@ -150,36 +92,11 @@ version = "0.9.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d86b93f97252c47b41663388e6d155714a9d0c398b99f1005cbc5f978b29f445" -[[package]] -name = "bip39" -version = "2.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "93f2635620bf0b9d4576eb7bb9a38a55df78bd1205d26fa994b25911a69f212f" -dependencies = [ - "bitcoin_hashes", - "rand 0.8.5", - "rand_core 0.6.4", - "serde", - "unicode-normalization", -] - -[[package]] -name = "bitcoin_hashes" -version = "0.11.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "90064b8dee6815a6470d60bad07bbbaee885c0e12d04177138fa3291a01b7bc4" - -[[package]] -name = "bitflags" -version = "1.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" - [[package]] name = "bitflags" -version = "2.5.0" +version = "2.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cf4b9d6a944f767f8e5e0db018570623c85f3d925ac718db4e06d0187adb21c1" +checksum = "b048fb63fd8b5923fc5aa7b340d8e156aec7ec02f0c78fa8a6ddc2613f6f71de" [[package]] name = "block-buffer" @@ -208,40 +125,12 @@ dependencies = [ "transaction", ] -[[package]] -name = "bstr" -version = "1.9.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "05efc5cfd9110c8416e471df0e96702d58690178e206e61b7173706673c93706" -dependencies = [ - "memchr", - "serde", -] - -[[package]] -name = "bumpalo" -version = "3.16.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "79296716171880943b8470b5f8d03aa55eb2e645a4874bdbb28adb49162e012c" - [[package]] name = "byteorder" version = "1.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1fd0f2584146f6f2ef48085050886acf353beff7305ebd1ae69500e27c67f64b" -[[package]] -name = "bytes" -version = "1.6.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "514de17de45fdb8dc022b1a7975556c53c86f9f0aa5f534b98977b171857c2c9" - -[[package]] -name = "cc" -version = "1.0.92" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2678b2e3449475e95b0aa6f9b506a28e61b3dc8996592b983695e8ebb58a8b41" - [[package]] name = "cfg-if" version = "1.0.0" @@ -263,7 +152,7 @@ name = "chain-config-meta" version = "0.0.0" dependencies = [ "chain-config", - "multiversx-sc-meta", + "multiversx-sc-meta-lib", ] [[package]] @@ -283,7 +172,7 @@ name = "chain-factory-meta" version = "0.0.0" dependencies = [ "chain-factory", - "multiversx-sc-meta", + "multiversx-sc-meta-lib", ] [[package]] @@ -342,12 +231,6 @@ dependencies = [ "windows-sys 0.48.0", ] -[[package]] -name = "common-path" -version = "1.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2382f75942f4b3be3690fe4f86365e9c853c1587d6ee58212cebf6e2a9ccd101" - [[package]] name = "convert_case" version = "0.6.0" @@ -357,31 +240,6 @@ dependencies = [ "unicode-segmentation", ] -[[package]] -name = "copy_dir" -version = "0.1.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "543d1dd138ef086e2ff05e3a48cf9da045da2033d16f8538fd76b86cd49b2ca3" -dependencies = [ - "walkdir", -] - -[[package]] -name = "core-foundation" -version = "0.9.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "91e195e091a93c46f7102ec7818a2aa394e1e1771c3ab4825963fa03e45afb8f" -dependencies = [ - "core-foundation-sys", - "libc", -] - -[[package]] -name = "core-foundation-sys" -version = "0.8.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "06ea2b9bc92be3c2baa9334a323ebca2d6f074ff852cd1d7b11064035cd3868f" - [[package]] name = "cpufeatures" version = "0.2.12" @@ -391,40 +249,6 @@ dependencies = [ "libc", ] -[[package]] -name = "crc32fast" -version = "1.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b3855a8a784b474f333699ef2bbca9db2c4a1f6d9088a90a2d25b1eb53111eaa" -dependencies = [ - "cfg-if", -] - -[[package]] -name = "crossbeam-deque" -version = "0.8.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "613f8cc01fe9cf1a3eb3d7f488fd2fa8388403e97039e2f73692932e291a770d" -dependencies = [ - "crossbeam-epoch", - "crossbeam-utils", -] - -[[package]] -name = "crossbeam-epoch" -version = "0.9.18" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5b82ac4a3c2ca9c3460964f020e1402edd5753411d7737aa39c3714ad1b5420e" -dependencies = [ - "crossbeam-utils", -] - -[[package]] -name = "crossbeam-utils" -version = "0.8.19" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "248e3bacc7dc6baa3b21e405ee045c3047101a49145e7e9eca583ab4c2ca5345" - [[package]] name = "crypto-common" version = "0.1.6" @@ -448,17 +272,6 @@ dependencies = [ "zeroize", ] -[[package]] -name = "derive_arbitrary" -version = "1.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "67e77553c4162a157adbf834ebae5b415acbecbeafc7a74b0e886657506a7611" -dependencies = [ - "proc-macro2", - "quote", - "syn", -] - [[package]] name = "digest" version = "0.9.0" @@ -476,18 +289,6 @@ checksum = "9ed9a281f7bc9b7576e61468ba615a66a5c8cfdff42420a70aa82701a3b1e292" dependencies = [ "block-buffer 0.10.4", "crypto-common", - "subtle", -] - -[[package]] -name = "displaydoc" -version = "0.2.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "487585f4d0c6655fe74905e2504d8ad6908e4db67f744eb140876906c2f3175d" -dependencies = [ - "proc-macro2", - "quote", - "syn", ] [[package]] @@ -519,15 +320,6 @@ version = "1.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "11157ac094ffbdde99aa67b23417ebdd801842852b500e395a45a9c0aac03e4a" -[[package]] -name = "encoding_rs" -version = "0.8.34" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b45de904aa0b010bce2ab45264d0631681847fa7b6f2eaa7dab7619943bc4f59" -dependencies = [ - "cfg-if", -] - [[package]] name = "endian-type" version = "0.1.2" @@ -560,7 +352,7 @@ name = "enshrine-esdt-safe-meta" version = "0.0.0" dependencies = [ "enshrine-esdt-safe", - "multiversx-sc-meta", + "multiversx-sc-meta-lib", ] [[package]] @@ -569,16 +361,6 @@ version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5443807d6dff69373d433ab9ef5378ad8df50ca6298caf15de6e52e24aaf54d5" -[[package]] -name = "errno" -version = "0.3.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a258e46cdc063eb8519c00b9fc845fc47bcfca4130e2f08e88665ceda8474245" -dependencies = [ - "libc", - "windows-sys 0.52.0", -] - [[package]] name = "esdt-safe" version = "0.0.0" @@ -605,15 +387,9 @@ name = "esdt-safe-meta" version = "0.0.0" dependencies = [ "esdt-safe", - "multiversx-sc-meta", + "multiversx-sc-meta-lib", ] -[[package]] -name = "fastrand" -version = "2.0.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "658bd65b1cf4c852a3cc96f18a8ce7b5640f6b703f905c7d74532294c2a63984" - [[package]] name = "fee-market" version = "0.0.0" @@ -633,97 +409,7 @@ name = "fee-market-meta" version = "0.0.0" dependencies = [ "fee-market", - "multiversx-sc-meta", -] - -[[package]] -name = "flate2" -version = "1.0.28" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "46303f565772937ffe1d394a4fac6f411c6013172fadde9dcdb1e147a086940e" -dependencies = [ - "crc32fast", - "miniz_oxide", -] - -[[package]] -name = "fnv" -version = "1.0.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" - -[[package]] -name = "foreign-types" -version = "0.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f6f339eb8adc052cd2ca78910fda869aefa38d22d5cb648e6485e4d3fc06f3b1" -dependencies = [ - "foreign-types-shared", -] - -[[package]] -name = "foreign-types-shared" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "00b0228411908ca8685dba7fc2cdd70ec9990a6e753e89b6ac91a84c40fbaf4b" - -[[package]] -name = "form_urlencoded" -version = "1.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e13624c2627564efccf4934284bdd98cbaa14e79b0b5a141218e507b3a823456" -dependencies = [ - "percent-encoding", -] - -[[package]] -name = "futures-channel" -version = "0.3.30" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eac8f7d7865dcb88bd4373ab671c8cf4508703796caa2b1985a9ca867b3fcb78" -dependencies = [ - "futures-core", - "futures-sink", -] - -[[package]] -name = "futures-core" -version = "0.3.30" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dfc6580bb841c5a68e9ef15c77ccc837b40a7504914d52e47b8b0e9bbda25a1d" - -[[package]] -name = "futures-io" -version = "0.3.30" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a44623e20b9681a318efdd71c299b6b222ed6f231972bfe2f224ebad6311f0c1" - -[[package]] -name = "futures-sink" -version = "0.3.30" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9fb8e00e87438d937621c1c6269e53f536c14d3fbd6a042bb24879e57d474fb5" - -[[package]] -name = "futures-task" -version = "0.3.30" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "38d84fa142264698cdce1a9f9172cf383a0c82de1bddcf3092901442c4097004" - -[[package]] -name = "futures-util" -version = "0.3.30" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3d6401deb83407ab3da39eba7e33987a73c3df0c82b4bb5813ee871c19c41d48" -dependencies = [ - "futures-core", - "futures-io", - "futures-sink", - "futures-task", - "memchr", - "pin-project-lite", - "pin-utils", - "slab", + "multiversx-sc-meta-lib", ] [[package]] @@ -758,44 +444,6 @@ dependencies = [ "wasi 0.11.0+wasi-snapshot-preview1", ] -[[package]] -name = "gimli" -version = "0.28.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4271d37baee1b8c7e4b708028c57d816cf9d2434acb33a549475f78c181f6253" - -[[package]] -name = "globset" -version = "0.4.14" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "57da3b9b5b85bd66f31093f8c408b90a74431672542466497dcbdfdc02034be1" -dependencies = [ - "aho-corasick", - "bstr", - "log", - "regex-automata", - "regex-syntax", -] - -[[package]] -name = "h2" -version = "0.4.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "816ec7294445779408f36fe57bc5b7fc1cf59664059096c65f905c1c61f58069" -dependencies = [ - "bytes", - "fnv", - "futures-core", - "futures-sink", - "futures-util", - "http", - "indexmap", - "slab", - "tokio", - "tokio-util", - "tracing", -] - [[package]] name = "hashbrown" version = "0.14.3" @@ -822,7 +470,7 @@ name = "header-verifier-meta" version = "0.0.0" dependencies = [ "header-verifier", - "multiversx-sc-meta", + "multiversx-sc-meta-lib", ] [[package]] @@ -831,12 +479,6 @@ version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2304e00983f87ffb38b55b444b5e3b60a884b5d30c0fca7d82fe33449bbe55ea" -[[package]] -name = "hermit-abi" -version = "0.3.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d231dfb89cfffdbc30e7fc41579ed6066ad03abda9e567ccafae602b97ec5024" - [[package]] name = "hex" version = "0.4.3" @@ -850,288 +492,94 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6fe2267d4ed49bc07b63801559be28c718ea06c4738b7a03c94df7386d2cde46" [[package]] -name = "hmac" -version = "0.12.1" +name = "indexmap" +version = "2.2.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6c49c37c09c17a53d937dfbb742eb3a961d65a994e6bcdcf37e7399d0cc8ab5e" +checksum = "168fb715dda47215e360912c096649d23d58bf392ac62f73919e831745e40f26" dependencies = [ - "digest 0.10.7", + "equivalent", + "hashbrown", + "serde", ] [[package]] -name = "http" -version = "1.1.0" +name = "itertools" +version = "0.13.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "21b9ddb458710bc376481b842f5da65cdf31522de232c1ca8146abce2a358258" +checksum = "413ee7dfc52ee1a4949ceeb7dbc8a33f2d6c088194d9f922fb8318faf1f01186" dependencies = [ - "bytes", - "fnv", - "itoa", + "either", ] [[package]] -name = "http-body" -version = "1.0.0" +name = "itoa" +version = "1.0.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1cac85db508abc24a2e48553ba12a996e87244a0395ce011e62b37158745d643" -dependencies = [ - "bytes", - "http", -] +checksum = "49f1f14873335454500d59611f1cf4a4b0f786f9ac11f4312a78e4cf2566695b" [[package]] -name = "http-body-util" -version = "0.1.1" +name = "keccak" +version = "0.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0475f8b2ac86659c21b64320d5d653f9efe42acd2a4e560073ec61a155a34f1d" +checksum = "ecc2af9a1119c51f12a14607e783cb977bde58bc069ff0c3da1095e635d70654" dependencies = [ - "bytes", - "futures-core", - "http", - "http-body", - "pin-project-lite", + "cpufeatures", ] [[package]] -name = "httparse" -version = "1.8.0" +name = "lazy_static" +version = "1.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d897f394bad6a705d5f4104762e116a75639e470d80901eed05a860a95cb1904" +checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" [[package]] -name = "hyper" -version = "1.3.1" +name = "libc" +version = "0.2.153" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fe575dd17d0862a9a33781c8c4696a55c320909004a67a00fb286ba8b1bc496d" -dependencies = [ - "bytes", - "futures-channel", - "futures-util", - "h2", - "http", - "http-body", - "httparse", - "itoa", - "pin-project-lite", - "smallvec", - "tokio", - "want", -] +checksum = "9c198f91728a82281a64e1f4f9eeb25d82cb32a5de251c6bd1b5154d63a8e7bd" [[package]] -name = "hyper-tls" -version = "0.6.0" +name = "log" +version = "0.4.21" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "70206fc6890eaca9fde8a0bf71caa2ddfc9fe045ac9e5c70df101a7dbde866e0" +checksum = "90ed8c1e510134f979dbc4f070f87d4313098b704861a105fe34231c70a3901c" + +[[package]] +name = "max-bridged-amount-module" +version = "0.0.0" dependencies = [ - "bytes", - "http-body-util", - "hyper", - "hyper-util", - "native-tls", - "tokio", - "tokio-native-tls", - "tower-service", + "multiversx-sc", + "multiversx-sc-scenario", ] [[package]] -name = "hyper-util" -version = "0.1.3" +name = "memchr" +version = "2.7.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ca38ef113da30126bbff9cd1705f9273e15d45498615d138b0c20279ac7a76aa" -dependencies = [ - "bytes", - "futures-channel", - "futures-util", - "http", - "http-body", - "hyper", - "pin-project-lite", - "socket2", - "tokio", - "tower", - "tower-service", - "tracing", -] +checksum = "6c8640c5d730cb13ebd907d8d04b52f55ac9a2eec55b440c8892f40d56c76c1d" [[package]] -name = "idna" -version = "0.5.0" +name = "multiversx-chain-scenario-format" +version = "0.22.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "634d9b1461af396cad843f47fdba5597a4f9e6ddd4bfb6ff5d85028c25cb12f6" +checksum = "921a66f6db5ffff311e355d42a49fd49baf72d7a6a6215b0484dcd9d8dd512a3" dependencies = [ - "unicode-bidi", - "unicode-normalization", -] - -[[package]] -name = "ignore" -version = "0.4.22" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b46810df39e66e925525d6e38ce1e7f6e1d208f72dc39757880fcb66e2c58af1" -dependencies = [ - "crossbeam-deque", - "globset", - "log", - "memchr", - "regex-automata", - "same-file", - "walkdir", - "winapi-util", -] - -[[package]] -name = "indexmap" -version = "2.2.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "168fb715dda47215e360912c096649d23d58bf392ac62f73919e831745e40f26" -dependencies = [ - "equivalent", - "hashbrown", - "serde", -] - -[[package]] -name = "ipnet" -version = "2.9.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8f518f335dce6725a761382244631d86cf0ccb2863413590b31338feb467f9c3" - -[[package]] -name = "itertools" -version = "0.12.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ba291022dbbd398a455acf126c1e341954079855bc60dfdda641363bd6922569" -dependencies = [ - "either", -] - -[[package]] -name = "itoa" -version = "1.0.11" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "49f1f14873335454500d59611f1cf4a4b0f786f9ac11f4312a78e4cf2566695b" - -[[package]] -name = "js-sys" -version = "0.3.69" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "29c15563dc2726973df627357ce0c9ddddbea194836909d655df6a75d2cf296d" -dependencies = [ - "wasm-bindgen", -] - -[[package]] -name = "keccak" -version = "0.1.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ecc2af9a1119c51f12a14607e783cb977bde58bc069ff0c3da1095e635d70654" -dependencies = [ - "cpufeatures", -] - -[[package]] -name = "lazy_static" -version = "1.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" - -[[package]] -name = "libc" -version = "0.2.153" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9c198f91728a82281a64e1f4f9eeb25d82cb32a5de251c6bd1b5154d63a8e7bd" - -[[package]] -name = "linux-raw-sys" -version = "0.4.13" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "01cda141df6706de531b6c46c3a33ecca755538219bd484262fa09410c13539c" - -[[package]] -name = "lock_api" -version = "0.4.11" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3c168f8615b12bc01f9c17e2eb0cc07dcae1940121185446edc3744920e8ef45" -dependencies = [ - "autocfg", - "scopeguard", -] - -[[package]] -name = "lockfree-object-pool" -version = "0.1.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9374ef4228402d4b7e403e5838cb880d9ee663314b0a900d5a6aabf0c213552e" - -[[package]] -name = "log" -version = "0.4.21" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "90ed8c1e510134f979dbc4f070f87d4313098b704861a105fe34231c70a3901c" - -[[package]] -name = "max-bridged-amount-module" -version = "0.0.0" -dependencies = [ - "multiversx-sc", - "multiversx-sc-scenario", -] - -[[package]] -name = "memchr" -version = "2.7.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6c8640c5d730cb13ebd907d8d04b52f55ac9a2eec55b440c8892f40d56c76c1d" - -[[package]] -name = "mime" -version = "0.3.17" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6877bb514081ee2a7ff5ef9de3281f14a4dd4bceac4c09388074a6b5df8a139a" - -[[package]] -name = "miniz_oxide" -version = "0.7.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9d811f3e15f28568be3407c8e7fdb6514c1cda3cb30683f15b6a1a1dc4ea14a7" -dependencies = [ - "adler", -] - -[[package]] -name = "mio" -version = "0.8.11" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a4a650543ca06a924e8b371db273b2756685faae30f8487da1b56505a8f78b0c" -dependencies = [ - "libc", - "wasi 0.11.0+wasi-snapshot-preview1", - "windows-sys 0.48.0", -] - -[[package]] -name = "multiversx-chain-scenario-format" -version = "0.22.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7a9190bdd56300e801e7793fc4ee7dc0c76c1149aac019da8c71cc58254966fe" -dependencies = [ - "bech32", - "hex", - "num-bigint", - "num-traits", - "serde", - "serde_json", - "sha3", + "bech32", + "hex", + "num-bigint", + "num-traits", + "serde", + "serde_json", + "sha3", ] [[package]] name = "multiversx-chain-vm" -version = "0.8.4" +version = "0.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f69520691466bc184475320c27db21137e68be5e959df25c1a14b09e055d0d58" +checksum = "a8d91b6ce610a3ac1272f0813284a3f03a34d55db2f86cddaff357bf651074ee" dependencies = [ - "bitflags 2.5.0", + "bitflags", "colored", "ed25519-dalek", "hex", @@ -1154,11 +602,11 @@ checksum = "b59072fa0624b55ae5ae3fa6bfa91515bbeb4ac440214bc4a509e2c8806d6e9f" [[package]] name = "multiversx-sc" -version = "0.50.5" +version = "0.51.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a38a802d6cfa67748145a9e729336f4e6390eba702b5f14360ed01fcff14faa4" +checksum = "236f7890b2208796df8b5ac73b8572ffaf5e2b1531c7ad549d669328b715b657" dependencies = [ - "bitflags 2.5.0", + "bitflags", "hex-literal", "multiversx-sc-codec", "multiversx-sc-derive", @@ -1168,9 +616,9 @@ dependencies = [ [[package]] name = "multiversx-sc-codec" -version = "0.19.0" +version = "0.20.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "35c94397b2fba14e40edfa55905b3f453ed57aa06c9b1960ad6a0ca6bfb7a236" +checksum = "fcecd449ea708b72f92edaa17158fe4859c1780aed9b52b14de45f26124ccb8b" dependencies = [ "arrayvec", "multiversx-sc-codec-derive", @@ -1180,9 +628,9 @@ dependencies = [ [[package]] name = "multiversx-sc-codec-derive" -version = "0.19.0" +version = "0.20.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cf72a8042da0bc19da0b8f0d4f61b4c66ae853560fefc69cd8fea87bf1aa8c14" +checksum = "68f7fa25402e5e8054d719951289306fd79e481f7c21b2565b5549b6bc359772" dependencies = [ "hex", "proc-macro2", @@ -1192,9 +640,9 @@ dependencies = [ [[package]] name = "multiversx-sc-derive" -version = "0.50.5" +version = "0.51.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7dc53ddcbd71948d2e8d3d6b814da866e2920b24e6c0cbfa643922f781897476" +checksum = "eb683bc78d0e2eb43c16cac790144f53cc2ab27912aeb1484433895742ce698d" dependencies = [ "hex", "proc-macro2", @@ -1204,22 +652,17 @@ dependencies = [ ] [[package]] -name = "multiversx-sc-meta" -version = "0.50.5" +name = "multiversx-sc-meta-lib" +version = "0.51.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ca792ba887b76270d5d6c975e349f2e7e037af2db25a78fe855ceb70eed473dd" +checksum = "eb12232450627cb0e9f3ba9493b0bd7445a40066f0e311e19e84de812bbffd56" dependencies = [ "clap", "colored", - "common-path", "convert_case", - "copy_dir", "hex", "lazy_static", "multiversx-sc", - "pathdiff", - "reqwest", - "ruplacer", "rustc_version", "semver", "serde", @@ -1227,27 +670,25 @@ dependencies = [ "toml", "wasmparser", "wasmprinter", - "zip", ] [[package]] name = "multiversx-sc-modules" -version = "0.50.5" +version = "0.51.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ea1ae09db9cac18669b85d50932410df6082e1a575975ba5224e3b7ae33cbe7d" +checksum = "16af268784dff8a34cb696605413c325253da793d85f81b00dcb0e66f82963c9" dependencies = [ "multiversx-sc", ] [[package]] name = "multiversx-sc-scenario" -version = "0.50.5" +version = "0.51.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9916e196bbe87d5d46e4c9fd8ea00283660a97be44e6628c2cfbc9df5f8befcb" +checksum = "6b7a5e1289d021c89c44688d77110d78edf83ea52b2eff40481a8119ad2f0411" dependencies = [ "base64", "bech32", - "clap", "colored", "hex", "itertools", @@ -1256,62 +697,16 @@ dependencies = [ "multiversx-chain-vm", "multiversx-chain-vm-executor", "multiversx-sc", - "multiversx-sc-meta", - "multiversx-sdk", + "multiversx-sc-meta-lib", "num-bigint", "num-traits", "pathdiff", "serde", "serde_json", "sha2 0.10.8", - "tokio", "unwrap-infallible", ] -[[package]] -name = "multiversx-sdk" -version = "0.4.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5cb2f8dd4a17ce9c9fa1ab3d80152929702968be6536499f32bd7e2278c2e0fb" -dependencies = [ - "anyhow", - "base64", - "bech32", - "bip39", - "hex", - "hmac", - "itertools", - "pbkdf2", - "pem", - "rand 0.8.5", - "reqwest", - "serde", - "serde_json", - "serde_repr", - "sha2 0.10.8", - "sha3", - "tokio", - "zeroize", -] - -[[package]] -name = "native-tls" -version = "0.2.11" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "07226173c32f2926027b63cce4bcd8076c3552846cbe7925f3aaffeac0a3b92e" -dependencies = [ - "lazy_static", - "libc", - "log", - "openssl", - "openssl-probe", - "openssl-sys", - "schannel", - "security-framework", - "security-framework-sys", - "tempfile", -] - [[package]] name = "nibble_vec" version = "0.1.0" @@ -1349,25 +744,6 @@ dependencies = [ "autocfg", ] -[[package]] -name = "num_cpus" -version = "1.16.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4161fcb6d602d4d2081af7c3a45852d875a03dd337a6bfdd6e06407b61342a43" -dependencies = [ - "hermit-abi", - "libc", -] - -[[package]] -name = "object" -version = "0.32.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a6a622008b6e321afc04970976f62ee297fdbaa6f95318ca343e3eebb9648441" -dependencies = [ - "memchr", -] - [[package]] name = "once_cell" version = "1.19.0" @@ -1380,50 +756,6 @@ version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c08d65885ee38876c4f86fa503fb49d7b507c2b62552df7c70b2fce627e06381" -[[package]] -name = "openssl" -version = "0.10.64" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "95a0481286a310808298130d22dd1fef0fa571e05a8f44ec801801e84b216b1f" -dependencies = [ - "bitflags 2.5.0", - "cfg-if", - "foreign-types", - "libc", - "once_cell", - "openssl-macros", - "openssl-sys", -] - -[[package]] -name = "openssl-macros" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a948666b637a0f465e8564c73e89d4dde00d72d4d473cc972f390fc3dcee7d9c" -dependencies = [ - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "openssl-probe" -version = "0.1.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ff011a302c396a5197692431fc1948019154afc178baf7d8e37367442a4601cf" - -[[package]] -name = "openssl-sys" -version = "0.9.102" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c597637d56fbc83893a35eb0dd04b2b8e7a50c91e64e9493e398b5df4fb45fa2" -dependencies = [ - "cc", - "libc", - "pkg-config", - "vcpkg", -] - [[package]] name = "pair-mock" version = "0.0.0" @@ -1437,102 +769,16 @@ dependencies = [ name = "pair-mock-meta" version = "0.0.0" dependencies = [ - "multiversx-sc-meta", + "multiversx-sc-meta-lib", "pair-mock", ] -[[package]] -name = "parking_lot" -version = "0.12.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3742b2c103b9f06bc9fff0a37ff4912935851bee6d36f3c02bcc755bcfec228f" -dependencies = [ - "lock_api", - "parking_lot_core", -] - -[[package]] -name = "parking_lot_core" -version = "0.9.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4c42a9226546d68acdd9c0a280d17ce19bfe27a46bf68784e4066115788d008e" -dependencies = [ - "cfg-if", - "libc", - "redox_syscall", - "smallvec", - "windows-targets 0.48.5", -] - [[package]] name = "pathdiff" version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8835116a5c179084a830efb3adc117ab007512b535bc1a21c991d3b32a6b44dd" -[[package]] -name = "pbkdf2" -version = "0.12.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f8ed6a7761f76e3b9f92dfb0a60a6a6477c61024b775147ff0973a02653abaf2" -dependencies = [ - "digest 0.10.7", -] - -[[package]] -name = "pem" -version = "3.0.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8e459365e590736a54c3fa561947c84837534b8e9af6fc5bf781307e82658fae" -dependencies = [ - "base64", - "serde", -] - -[[package]] -name = "percent-encoding" -version = "2.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e3148f5046208a5d56bcfc03053e3ca6334e51da8dfb19b6cdc8b306fae3283e" - -[[package]] -name = "pin-project" -version = "1.1.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b6bf43b791c5b9e34c3d182969b4abb522f9343702850a2e57f460d00d09b4b3" -dependencies = [ - "pin-project-internal", -] - -[[package]] -name = "pin-project-internal" -version = "1.1.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2f38a4412a78282e09a2cf38d195ea5420d15ba0602cb375210efbc877243965" -dependencies = [ - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "pin-project-lite" -version = "0.2.14" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bda66fc9667c18cb2758a2ac84d1167245054bcf85d5d1aaa6923f45801bdd02" - -[[package]] -name = "pin-utils" -version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184" - -[[package]] -name = "pkg-config" -version = "0.3.30" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d231b230927b5e4ad203db57bbcbee2802f6bce620b1e4a9024a07d94e2907ec" - [[package]] name = "ppv-lite86" version = "0.2.17" @@ -1541,9 +787,9 @@ checksum = "5b40af805b3121feab8a3c29f04d8ad262fa8e0561883e7653e024ae4479e6de" [[package]] name = "proc-macro2" -version = "1.0.82" +version = "1.0.86" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8ad3d49ab951a01fbaafe34f2ec74122942fe18a3f9814c3268f1bb72042131b" +checksum = "5e719e8df665df0d1c8fbfd238015744736151d4445ec0836b8e628aae103b77" dependencies = [ "unicode-ident", ] @@ -1648,213 +894,36 @@ dependencies = [ ] [[package]] -name = "redox_syscall" -version = "0.4.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4722d768eff46b75989dd134e5c353f0d6296e5aaa3132e776cbdb56be7731aa" -dependencies = [ - "bitflags 1.3.2", -] - -[[package]] -name = "regex" -version = "1.10.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c117dbdfde9c8308975b6a18d71f3f385c89461f7b3fb054288ecf2a2058ba4c" -dependencies = [ - "aho-corasick", - "memchr", - "regex-automata", - "regex-syntax", -] - -[[package]] -name = "regex-automata" -version = "0.4.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "86b83b8b9847f9bf95ef68afb0b8e6cdb80f498442f5179a29fad448fcc1eaea" -dependencies = [ - "aho-corasick", - "memchr", - "regex-syntax", -] - -[[package]] -name = "regex-syntax" -version = "0.8.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "adad44e29e4c806119491a7f06f03de4d1af22c3a680dd47f1e6e179439d1f56" - -[[package]] -name = "reqwest" -version = "0.12.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "566cafdd92868e0939d3fb961bd0dc25fcfaaed179291093b3d43e6b3150ea10" -dependencies = [ - "base64", - "bytes", - "encoding_rs", - "futures-channel", - "futures-core", - "futures-util", - "h2", - "http", - "http-body", - "http-body-util", - "hyper", - "hyper-tls", - "hyper-util", - "ipnet", - "js-sys", - "log", - "mime", - "native-tls", - "once_cell", - "percent-encoding", - "pin-project-lite", - "rustls-pemfile", - "serde", - "serde_json", - "serde_urlencoded", - "sync_wrapper", - "system-configuration", - "tokio", - "tokio-native-tls", - "tower-service", - "url", - "wasm-bindgen", - "wasm-bindgen-futures", - "web-sys", - "winreg", -] - -[[package]] -name = "router-mock" -version = "0.0.0" -dependencies = [ - "multiversx-sc", - "multiversx-sc-scenario", - "num-bigint", -] - -[[package]] -name = "router-mock-meta" -version = "0.0.0" -dependencies = [ - "multiversx-sc-meta", - "router-mock", -] - -[[package]] -name = "ruplacer" -version = "0.8.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "58a26a1b15ff113d31d139357f7422708312978ed69cd5dd47e36d1b80b7eaf3" -dependencies = [ - "Inflector", - "anyhow", - "clap", - "colored", - "ignore", - "regex", -] - -[[package]] -name = "rustc-demangle" -version = "0.1.23" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d626bb9dae77e28219937af045c257c28bfd3f69333c512553507f5f9798cb76" - -[[package]] -name = "rustc_version" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bfa0f585226d2e68097d4f95d113b15b83a82e819ab25717ec0590d9584ef366" -dependencies = [ - "semver", -] - -[[package]] -name = "rustix" -version = "0.38.32" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "65e04861e65f21776e67888bfbea442b3642beaa0138fdb1dd7a84a52dffdb89" -dependencies = [ - "bitflags 2.5.0", - "errno", - "libc", - "linux-raw-sys", - "windows-sys 0.52.0", -] - -[[package]] -name = "rustls-pemfile" -version = "2.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "29993a25686778eb88d4189742cd713c9bce943bc54251a33509dc63cbacf73d" -dependencies = [ - "base64", - "rustls-pki-types", -] - -[[package]] -name = "rustls-pki-types" -version = "1.7.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "976295e77ce332211c0d24d92c0e83e50f5c5f046d11082cea19f3df13a3562d" - -[[package]] -name = "ryu" -version = "1.0.17" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e86697c916019a8588c99b5fac3cead74ec0b4b819707a682fd4d23fa0ce1ba1" - -[[package]] -name = "same-file" -version = "1.0.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "93fc1dc3aaa9bfed95e02e6eadabb4baf7e3078b0bd1b4d7b6b0b68378900502" -dependencies = [ - "winapi-util", -] - -[[package]] -name = "schannel" -version = "0.1.23" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fbc91545643bcf3a0bbb6569265615222618bdf33ce4ffbbd13c4bbd4c093534" +name = "router-mock" +version = "0.0.0" dependencies = [ - "windows-sys 0.52.0", + "multiversx-sc", + "multiversx-sc-scenario", + "num-bigint", ] [[package]] -name = "scopeguard" -version = "1.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49" +name = "router-mock-meta" +version = "0.0.0" +dependencies = [ + "multiversx-sc-meta-lib", + "router-mock", +] [[package]] -name = "security-framework" -version = "2.10.0" +name = "rustc_version" +version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "770452e37cad93e0a50d5abc3990d2bc351c36d0328f86cefec2f2fb206eaef6" +checksum = "bfa0f585226d2e68097d4f95d113b15b83a82e819ab25717ec0590d9584ef366" dependencies = [ - "bitflags 1.3.2", - "core-foundation", - "core-foundation-sys", - "libc", - "security-framework-sys", + "semver", ] [[package]] -name = "security-framework-sys" -version = "2.10.0" +name = "ryu" +version = "1.0.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "41f3cc463c0ef97e11c3461a9d3787412d30e8e7eb907c79180c4a57bf7c04ef" -dependencies = [ - "core-foundation-sys", - "libc", -] +checksum = "e86697c916019a8588c99b5fac3cead74ec0b4b819707a682fd4d23fa0ce1ba1" [[package]] name = "semver" @@ -1888,23 +957,11 @@ version = "1.0.115" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "12dc5c46daa8e9fdf4f5e71b6cf9a53f2487da0e86e55808e2d35539666497dd" dependencies = [ - "indexmap", "itoa", "ryu", "serde", ] -[[package]] -name = "serde_repr" -version = "0.1.19" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6c64451ba24fc7a6a2d60fc75dd9c83c90903b19028d4eff35e88fc1e86564e9" -dependencies = [ - "proc-macro2", - "quote", - "syn", -] - [[package]] name = "serde_spanned" version = "0.6.5" @@ -1914,18 +971,6 @@ dependencies = [ "serde", ] -[[package]] -name = "serde_urlencoded" -version = "0.7.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d3491c14715ca2294c4d6a88f15e84739788c1d030eed8c110436aafdaa2f3fd" -dependencies = [ - "form_urlencoded", - "itoa", - "ryu", - "serde", -] - [[package]] name = "setup-phase" version = "0.0.0" @@ -1968,52 +1013,18 @@ dependencies = [ "keccak", ] -[[package]] -name = "signal-hook-registry" -version = "1.4.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d8229b473baa5980ac72ef434c4415e70c4b5e71b423043adb4ba059f89c99a1" -dependencies = [ - "libc", -] - [[package]] name = "signature" version = "1.6.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "74233d3b3b2f6d4b006dc19dee745e73e2a6bfb6f93607cd3b02bd5b00797d7c" -[[package]] -name = "simd-adler32" -version = "0.3.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d66dc143e6b11c1eddc06d5c423cfc97062865baf299914ab64caa38182078fe" - -[[package]] -name = "slab" -version = "0.4.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8f92a496fb766b417c996b9c5e57daf2f7ad3b0bebe1ccfca4856390e3d3bb67" -dependencies = [ - "autocfg", -] - [[package]] name = "smallvec" version = "1.13.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3c5e1a9a646d36c3599cd173a41282daf47c44583ad367b8e6837255952e5c67" -[[package]] -name = "socket2" -version = "0.5.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "05ffd9c0a93b7543e062e759284fcf5f5e3b098501104bfbdde4d404db792871" -dependencies = [ - "libc", - "windows-sys 0.52.0", -] - [[package]] name = "strsim" version = "0.11.1" @@ -2028,9 +1039,9 @@ checksum = "81cdd64d312baedb58e21336b31bc043b77e01cc99033ce76ef539f78e965ebc" [[package]] name = "syn" -version = "2.0.61" +version = "2.0.68" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c993ed8ccba56ae856363b1845da7266a7cb78e1d146c8a32d54b45a8b831fc9" +checksum = "901fa70d88b9d6c98022e23b4136f9f3e54e4662c3bc1bd1d84a42a9a0f0c1e9" dependencies = [ "proc-macro2", "quote", @@ -2038,79 +1049,14 @@ dependencies = [ ] [[package]] -name = "sync_wrapper" -version = "0.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2047c6ded9c721764247e62cd3b03c09ffc529b2ba5b10ec482ae507a4a70160" - -[[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.10.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "85b77fafb263dd9d05cbeac119526425676db3784113aa9295c88498cbf8bff1" -dependencies = [ - "cfg-if", - "fastrand", - "rustix", - "windows-sys 0.52.0", -] - -[[package]] -name = "thiserror" -version = "1.0.60" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "579e9083ca58dd9dcf91a9923bb9054071b9ebbd800b342194c9feb0ee89fc18" -dependencies = [ - "thiserror-impl", -] - -[[package]] -name = "thiserror-impl" -version = "1.0.60" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e2470041c06ec3ac1ab38d0356a6119054dedaea53e12fbefc0de730a1c08524" -dependencies = [ - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "tinyvec" -version = "1.6.0" +name = "termcolor" +version = "1.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "87cc5ceb3875bb20c2890005a4e226a4651264a5c75edb2421b52861a0a0cb50" +checksum = "06794f8f6c5c898b3275aebefa6b8a1cb24cd2c6c79397ab15774837a0bc5755" dependencies = [ - "tinyvec_macros", + "winapi-util", ] -[[package]] -name = "tinyvec_macros" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20" - [[package]] name = "token-whitelist" version = "0.0.0" @@ -2122,60 +1068,6 @@ dependencies = [ "utils", ] -[[package]] -name = "tokio" -version = "1.37.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1adbebffeca75fcfd058afa480fb6c0b81e165a0323f9c9d39c9697e37c46787" -dependencies = [ - "backtrace", - "bytes", - "libc", - "mio", - "num_cpus", - "parking_lot", - "pin-project-lite", - "signal-hook-registry", - "socket2", - "tokio-macros", - "windows-sys 0.48.0", -] - -[[package]] -name = "tokio-macros" -version = "2.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5b8a1e28f2deaa14e508979454cb3a223b10b938b45af148bc0986de36f1923b" -dependencies = [ - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "tokio-native-tls" -version = "0.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bbae76ab933c85776efabc971569dd6119c580d8f5d448769dec1764bf796ef2" -dependencies = [ - "native-tls", - "tokio", -] - -[[package]] -name = "tokio-util" -version = "0.7.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5419f34732d9eb6ee4c3578b7989078579b7f039cbbb9ca2c4da015749371e15" -dependencies = [ - "bytes", - "futures-core", - "futures-sink", - "pin-project-lite", - "tokio", - "tracing", -] - [[package]] name = "toml" version = "0.8.12" @@ -2211,54 +1103,6 @@ dependencies = [ "winnow", ] -[[package]] -name = "tower" -version = "0.4.13" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b8fa9be0de6cf49e536ce1851f987bd21a43b771b09473c3549a6c853db37c1c" -dependencies = [ - "futures-core", - "futures-util", - "pin-project", - "pin-project-lite", - "tokio", - "tower-layer", - "tower-service", - "tracing", -] - -[[package]] -name = "tower-layer" -version = "0.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c20c8dbed6283a09604c3e69b4b7eeb54e298b8a600d4d5ecb5ad39de609f1d0" - -[[package]] -name = "tower-service" -version = "0.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b6bc1c9ce2b5135ac7f93c72918fc37feb872bdc6a5533a8b85eb4b86bfdae52" - -[[package]] -name = "tracing" -version = "0.1.40" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c3523ab5a71916ccf420eebdf5521fcef02141234bbc0b8a49f2fdc4544364ef" -dependencies = [ - "log", - "pin-project-lite", - "tracing-core", -] - -[[package]] -name = "tracing-core" -version = "0.1.32" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c06d3da6113f116aaee68e4d601191614c9053067f9ab7f6edbcb161237daa54" -dependencies = [ - "once_cell", -] - [[package]] name = "transaction" version = "0.0.0" @@ -2266,12 +1110,6 @@ dependencies = [ "multiversx-sc", ] -[[package]] -name = "try-lock" -version = "0.2.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e421abadd41a4225275504ea4d6566923418b7f05506fbc9c0fe86ba7396114b" - [[package]] name = "tx-batch-module" version = "0.0.0" @@ -2287,27 +1125,12 @@ version = "1.17.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "42ff0bf0c66b8238c6f3b578df37d0b7848e55df8577b3f74f92a69acceeb825" -[[package]] -name = "unicode-bidi" -version = "0.3.15" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "08f95100a766bf4f8f28f90d77e0a5461bbdb219042e7679bebe79004fed8d75" - [[package]] name = "unicode-ident" version = "1.0.12" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3354b9ac3fae1ff6755cb6db53683adb661634f67557942dea4facebec0fee4b" -[[package]] -name = "unicode-normalization" -version = "0.1.22" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5c5713f0fc4b5db668a2ac63cdb7bb4469d8c9fed047b1d0292cc7b0ce2ba921" -dependencies = [ - "tinyvec", -] - [[package]] name = "unicode-segmentation" version = "1.11.0" @@ -2320,17 +1143,6 @@ version = "0.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "151ac09978d3c2862c4e39b557f4eceee2cc72150bc4cb4f16abf061b6e381fb" -[[package]] -name = "url" -version = "2.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "31e6302e3bb753d46e83516cae55ae196fc0c309407cf11ab35cc51a4c2a4633" -dependencies = [ - "form_urlencoded", - "idna", - "percent-encoding", -] - [[package]] name = "utf8parse" version = "0.2.1" @@ -2345,37 +1157,12 @@ dependencies = [ "multiversx-sc", ] -[[package]] -name = "vcpkg" -version = "0.2.15" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "accd4ea62f7bb7a82fe23066fb0957d48ef677f6eeb8215f372f52e48bb32426" - [[package]] name = "version_check" version = "0.9.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f" -[[package]] -name = "walkdir" -version = "2.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "29790946404f91d9c5d06f9874efddea1dc06c5efe94541a7d6863108e3a5e4b" -dependencies = [ - "same-file", - "winapi-util", -] - -[[package]] -name = "want" -version = "0.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bfa7760aed19e106de2c7c0b581b509f2f25d3dacaf737cb82ac61bc6d760b0e" -dependencies = [ - "try-lock", -] - [[package]] name = "wasi" version = "0.9.0+wasi-snapshot-preview1" @@ -2388,80 +1175,14 @@ version = "0.11.0+wasi-snapshot-preview1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" -[[package]] -name = "wasm-bindgen" -version = "0.2.92" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4be2531df63900aeb2bca0daaaddec08491ee64ceecbee5076636a3b026795a8" -dependencies = [ - "cfg-if", - "wasm-bindgen-macro", -] - -[[package]] -name = "wasm-bindgen-backend" -version = "0.2.92" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "614d787b966d3989fa7bb98a654e369c762374fd3213d212cfc0251257e747da" -dependencies = [ - "bumpalo", - "log", - "once_cell", - "proc-macro2", - "quote", - "syn", - "wasm-bindgen-shared", -] - -[[package]] -name = "wasm-bindgen-futures" -version = "0.4.42" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "76bc14366121efc8dbb487ab05bcc9d346b3b5ec0eaa76e46594cabbe51762c0" -dependencies = [ - "cfg-if", - "js-sys", - "wasm-bindgen", - "web-sys", -] - -[[package]] -name = "wasm-bindgen-macro" -version = "0.2.92" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a1f8823de937b71b9460c0c34e25f3da88250760bec0ebac694b49997550d726" -dependencies = [ - "quote", - "wasm-bindgen-macro-support", -] - -[[package]] -name = "wasm-bindgen-macro-support" -version = "0.2.92" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e94f17b526d0a461a191c78ea52bbce64071ed5c04c9ffe424dcb38f74171bb7" -dependencies = [ - "proc-macro2", - "quote", - "syn", - "wasm-bindgen-backend", - "wasm-bindgen-shared", -] - -[[package]] -name = "wasm-bindgen-shared" -version = "0.2.92" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "af190c94f2773fdb3729c55b007a722abb5384da03bc0986df4c289bf5567e96" - [[package]] name = "wasmparser" -version = "0.208.1" +version = "0.212.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dd921789c9dcc495f589cb37d200155dee65b4a4beeb853323b5e24e0a5f9c58" +checksum = "8d28bc49ba1e5c5b61ffa7a2eace10820443c4b7d1c0b144109261d14570fdf8" dependencies = [ "ahash", - "bitflags 2.5.0", + "bitflags", "hashbrown", "indexmap", "semver", @@ -2470,24 +1191,15 @@ dependencies = [ [[package]] name = "wasmprinter" -version = "0.208.1" +version = "0.212.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0700bdace4821e6c694617938500ae9999946df464bb13219c16570f8b6f202f" +checksum = "dfac65326cc561112af88c3028f6dfdb140acff67ede33a8e86be2dc6b8956f7" dependencies = [ "anyhow", + "termcolor", "wasmparser", ] -[[package]] -name = "web-sys" -version = "0.3.69" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "77afa9a11836342370f4817622a2f0f418b134426d91a82dfb48f532d2ec13ef" -dependencies = [ - "js-sys", - "wasm-bindgen", -] - [[package]] name = "winapi" version = "0.3.9" @@ -2660,16 +1372,6 @@ dependencies = [ "memchr", ] -[[package]] -name = "winreg" -version = "0.52.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a277a57398d4bfa075df44f501a17cfdf8542d224f0d36095a2adc7aee4ef0a5" -dependencies = [ - "cfg-if", - "windows-sys 0.48.0", -] - [[package]] name = "zerocopy" version = "0.7.34" @@ -2709,34 +1411,3 @@ dependencies = [ "quote", "syn", ] - -[[package]] -name = "zip" -version = "2.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e2568cd0f20e86cd9a7349fe05178f7bd22f22724678448ae5a9bac266df2689" -dependencies = [ - "arbitrary", - "crc32fast", - "crossbeam-utils", - "displaydoc", - "flate2", - "indexmap", - "memchr", - "thiserror", - "zopfli", -] - -[[package]] -name = "zopfli" -version = "0.8.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e5019f391bac5cf252e93bbcc53d039ffd62c7bfb7c150414d61369afe57e946" -dependencies = [ - "bumpalo", - "crc32fast", - "lockfree-object-pool", - "log", - "once_cell", - "simd-adler32", -] diff --git a/chain-config/Cargo.toml b/chain-config/Cargo.toml index 44a855a6..82b182fe 100644 --- a/chain-config/Cargo.toml +++ b/chain-config/Cargo.toml @@ -12,10 +12,10 @@ path = "src/lib.rs" num-bigint = "0.4.2" [dev-dependencies.multiversx-sc-scenario] -version = "=0.50.5" +version = "=0.51.1" [dependencies.multiversx-sc] -version = "=0.50.5" +version = "=0.51.1" [dependencies.multiversx-sc-modules] -version = "=0.50.5" +version = "=0.51.1" diff --git a/chain-config/meta/Cargo.toml b/chain-config/meta/Cargo.toml index 0d750959..33929c62 100644 --- a/chain-config/meta/Cargo.toml +++ b/chain-config/meta/Cargo.toml @@ -10,5 +10,5 @@ authors = ["you"] [dependencies.chain-config] path = ".." -[dependencies.multiversx-sc-meta] -version = "=0.50.5" +[dependencies.multiversx-sc-meta-lib] +version = "=0.51.1" diff --git a/chain-config/meta/src/main.rs b/chain-config/meta/src/main.rs index 5aeb10d5..1f07fa8b 100644 --- a/chain-config/meta/src/main.rs +++ b/chain-config/meta/src/main.rs @@ -1,3 +1,3 @@ fn main() { - multiversx_sc_meta::cli_main::(); + multiversx_sc_meta_lib::cli_main::(); } diff --git a/chain-config/wasm/Cargo.toml b/chain-config/wasm/Cargo.toml index 9861bcbc..851dfcbf 100644 --- a/chain-config/wasm/Cargo.toml +++ b/chain-config/wasm/Cargo.toml @@ -1,9 +1,3 @@ -# Code generated by the multiversx-sc build system. DO NOT EDIT. - -# ########################################## -# ############## AUTO-GENERATED ############# -# ########################################## - [package] name = "chain-config-wasm" version = "0.0.0" @@ -28,7 +22,7 @@ panic = "abort" path = ".." [dependencies.multiversx-sc-wasm-adapter] -version = "=0.50.5" +version = "=0.51.1" [workspace] members = ["."] diff --git a/chain-factory/Cargo.toml b/chain-factory/Cargo.toml index 1e1ba374..d7af8a33 100644 --- a/chain-factory/Cargo.toml +++ b/chain-factory/Cargo.toml @@ -12,10 +12,10 @@ path = "src/lib.rs" num-bigint = "0.4.2" [dev-dependencies.multiversx-sc-scenario] -version = "=0.50.5" +version = "=0.51.1" [dependencies.multiversx-sc] -version = "=0.50.5" +version = "=0.51.1" [dependencies.utils] path = "../common/utils" diff --git a/chain-factory/meta/Cargo.toml b/chain-factory/meta/Cargo.toml index 9fe9efe0..d6b9bf02 100644 --- a/chain-factory/meta/Cargo.toml +++ b/chain-factory/meta/Cargo.toml @@ -10,5 +10,5 @@ authors = ["you"] [dependencies.chain-factory] path = ".." -[dependencies.multiversx-sc-meta] -version = "=0.50.5" +[dependencies.multiversx-sc-meta-lib] +version = "=0.51.1" diff --git a/chain-factory/meta/src/main.rs b/chain-factory/meta/src/main.rs index 732e0b9f..0a6cc89a 100644 --- a/chain-factory/meta/src/main.rs +++ b/chain-factory/meta/src/main.rs @@ -1,3 +1,3 @@ fn main() { - multiversx_sc_meta::cli_main::(); + multiversx_sc_meta_lib::cli_main::(); } diff --git a/chain-factory/wasm/Cargo.toml b/chain-factory/wasm/Cargo.toml index 95470464..2314a8be 100644 --- a/chain-factory/wasm/Cargo.toml +++ b/chain-factory/wasm/Cargo.toml @@ -1,9 +1,3 @@ -# Code generated by the multiversx-sc build system. DO NOT EDIT. - -# ########################################## -# ############## AUTO-GENERATED ############# -# ########################################## - [package] name = "chain-factory-wasm" version = "0.0.0" @@ -28,7 +22,7 @@ panic = "abort" path = ".." [dependencies.multiversx-sc-wasm-adapter] -version = "=0.50.5" +version = "=0.51.1" [workspace] members = ["."] diff --git a/common/bls-signature/Cargo.toml b/common/bls-signature/Cargo.toml index 4020caf9..063f8c6c 100644 --- a/common/bls-signature/Cargo.toml +++ b/common/bls-signature/Cargo.toml @@ -5,10 +5,10 @@ authors = ["dorin-iancu "] edition = "2018" [dependencies.multiversx-sc] -version = "=0.50.5" +version = "=0.51.1" [dependencies.transaction] path = "../transaction" [dev-dependencies.multiversx-sc-scenario] -version = "=0.50.5" +version = "=0.51.1" diff --git a/common/max-bridged-amount-module/Cargo.toml b/common/max-bridged-amount-module/Cargo.toml index 5838ae92..c0b0234a 100644 --- a/common/max-bridged-amount-module/Cargo.toml +++ b/common/max-bridged-amount-module/Cargo.toml @@ -5,7 +5,7 @@ authors = ["dorin-iancu "] edition = "2018" [dependencies.multiversx-sc] -version = "=0.50.5" +version = "=0.51.1" [dev-dependencies.multiversx-sc-scenario] -version = "=0.50.5" +version = "=0.51.1" diff --git a/common/setup-phase/Cargo.toml b/common/setup-phase/Cargo.toml index 5e4372b5..7904852b 100644 --- a/common/setup-phase/Cargo.toml +++ b/common/setup-phase/Cargo.toml @@ -5,7 +5,7 @@ authors = ["dorin-iancu "] edition = "2018" [dependencies.multiversx-sc] -version = "=0.50.5" +version = "=0.51.1" [dev-dependencies.multiversx-sc-scenario] -version = "=0.50.5" +version = "=0.51.1" diff --git a/common/token-whitelist/Cargo.toml b/common/token-whitelist/Cargo.toml index c194683d..f775623d 100644 --- a/common/token-whitelist/Cargo.toml +++ b/common/token-whitelist/Cargo.toml @@ -14,7 +14,7 @@ path = "../setup-phase" path = "../utils" [dependencies.multiversx-sc] -version = "=0.50.5" +version = "=0.51.1" [dev-dependencies.multiversx-sc-scenario] -version = "=0.50.5" +version = "=0.51.1" diff --git a/common/transaction/Cargo.toml b/common/transaction/Cargo.toml index 8f7f51a1..529b5578 100644 --- a/common/transaction/Cargo.toml +++ b/common/transaction/Cargo.toml @@ -8,4 +8,4 @@ edition = "2018" path = "src/lib.rs" [dependencies.multiversx-sc] -version = "=0.50.5" +version = "=0.51.1" diff --git a/common/tx-batch-module/Cargo.toml b/common/tx-batch-module/Cargo.toml index 7882455a..df0582e0 100644 --- a/common/tx-batch-module/Cargo.toml +++ b/common/tx-batch-module/Cargo.toml @@ -5,10 +5,10 @@ authors = ["dorin-iancu "] edition = "2018" [dependencies.multiversx-sc] -version = "=0.50.5" +version = "=0.51.1" [dependencies.transaction] path = "../transaction" [dev-dependencies.multiversx-sc-scenario] -version = "=0.50.5" +version = "=0.51.1" diff --git a/common/utils/Cargo.toml b/common/utils/Cargo.toml index b29b2ec2..2175cda3 100644 --- a/common/utils/Cargo.toml +++ b/common/utils/Cargo.toml @@ -11,5 +11,5 @@ path = "src/lib.rs" path = "../bls-signature" [dependencies.multiversx-sc] -version = "=0.50.5" +version = "=0.51.1" features = ["esdt-token-payment-legacy-decode"] diff --git a/enshrine-esdt-safe/Cargo.toml b/enshrine-esdt-safe/Cargo.toml index 6fed7409..9a970b70 100644 --- a/enshrine-esdt-safe/Cargo.toml +++ b/enshrine-esdt-safe/Cargo.toml @@ -36,10 +36,10 @@ path = "../fee-market" path = "../header-verifier" [dependencies.multiversx-sc] -version = "=0.50.5" +version = "=0.51.1" [dependencies.multiversx-sc-modules] -version = "=0.50.5" +version = "=0.51.1" [dev-dependencies] num-bigint = "0.4.2" @@ -47,4 +47,4 @@ num-traits = "0.2" hex = "0.4" [dev-dependencies.multiversx-sc-scenario] -version = "=0.50.5" +version = "=0.51.1" diff --git a/enshrine-esdt-safe/meta/Cargo.toml b/enshrine-esdt-safe/meta/Cargo.toml index e0aed0b1..3667dafc 100644 --- a/enshrine-esdt-safe/meta/Cargo.toml +++ b/enshrine-esdt-safe/meta/Cargo.toml @@ -7,6 +7,6 @@ publish = false [dependencies.enshrine-esdt-safe] path = ".." -[dependencies.multiversx-sc-meta] -version = "0.50.5" +[dependencies.multiversx-sc-meta-lib] +version = "0.51.1" default-features = false diff --git a/enshrine-esdt-safe/meta/src/main.rs b/enshrine-esdt-safe/meta/src/main.rs index 7efe7900..5d9864f5 100644 --- a/enshrine-esdt-safe/meta/src/main.rs +++ b/enshrine-esdt-safe/meta/src/main.rs @@ -1,3 +1,3 @@ fn main() { - multiversx_sc_meta::cli_main::(); + multiversx_sc_meta_lib::cli_main::(); } diff --git a/enshrine-esdt-safe/wasm-enshrine-esdt-safe-full/Cargo.toml b/enshrine-esdt-safe/wasm-enshrine-esdt-safe-full/Cargo.toml index 71b08900..f155e3c9 100644 --- a/enshrine-esdt-safe/wasm-enshrine-esdt-safe-full/Cargo.toml +++ b/enshrine-esdt-safe/wasm-enshrine-esdt-safe-full/Cargo.toml @@ -1,9 +1,3 @@ -# Code generated by the multiversx-sc build system. DO NOT EDIT. - -# ########################################## -# ############## AUTO-GENERATED ############# -# ########################################## - [package] name = "enshrine-esdt-safe-full-wasm" version = "0.0.0" @@ -28,7 +22,7 @@ panic = "abort" path = ".." [dependencies.multiversx-sc-wasm-adapter] -version = "=0.50.5" +version = "=0.51.1" [workspace] members = ["."] diff --git a/enshrine-esdt-safe/wasm-enshrine-esdt-safe-view/Cargo.toml b/enshrine-esdt-safe/wasm-enshrine-esdt-safe-view/Cargo.toml index 3119d3b5..cc8d6ddf 100644 --- a/enshrine-esdt-safe/wasm-enshrine-esdt-safe-view/Cargo.toml +++ b/enshrine-esdt-safe/wasm-enshrine-esdt-safe-view/Cargo.toml @@ -1,9 +1,3 @@ -# Code generated by the multiversx-sc build system. DO NOT EDIT. - -# ########################################## -# ############## AUTO-GENERATED ############# -# ########################################## - [package] name = "enshrine-esdt-safe-view-wasm" version = "0.0.0" @@ -28,7 +22,7 @@ panic = "abort" path = ".." [dependencies.multiversx-sc-wasm-adapter] -version = "=0.50.5" +version = "=0.51.1" [workspace] members = ["."] diff --git a/enshrine-esdt-safe/wasm/Cargo.toml b/enshrine-esdt-safe/wasm/Cargo.toml index c8376d24..5306da1a 100644 --- a/enshrine-esdt-safe/wasm/Cargo.toml +++ b/enshrine-esdt-safe/wasm/Cargo.toml @@ -1,9 +1,3 @@ -# Code generated by the multiversx-sc build system. DO NOT EDIT. - -# ########################################## -# ############## AUTO-GENERATED ############# -# ########################################## - [package] name = "enshrine-esdt-safe-wasm" version = "0.0.0" @@ -28,7 +22,7 @@ panic = "abort" path = ".." [dependencies.multiversx-sc-wasm-adapter] -version = "=0.50.5" +version = "=0.51.1" [workspace] members = ["."] diff --git a/esdt-safe/Cargo.toml b/esdt-safe/Cargo.toml index 808189ae..2aa892ef 100644 --- a/esdt-safe/Cargo.toml +++ b/esdt-safe/Cargo.toml @@ -36,10 +36,10 @@ path = "../fee-market" path = "../header-verifier" [dependencies.multiversx-sc] -version = "=0.50.5" +version = "=0.51.1" [dependencies.multiversx-sc-modules] -version = "=0.50.5" +version = "=0.51.1" [dev-dependencies] num-bigint = "0.4.2" @@ -47,4 +47,4 @@ num-traits = "0.2" hex = "0.4" [dev-dependencies.multiversx-sc-scenario] -version = "=0.50.5" +version = "=0.51.1" diff --git a/esdt-safe/meta/Cargo.toml b/esdt-safe/meta/Cargo.toml index 0ac9378d..934d5f37 100644 --- a/esdt-safe/meta/Cargo.toml +++ b/esdt-safe/meta/Cargo.toml @@ -10,5 +10,5 @@ publish = false [dependencies.esdt-safe] path = ".." -[dependencies.multiversx-sc-meta] -version = "=0.50.5" +[dependencies.multiversx-sc-meta-lib] +version = "=0.51.1" diff --git a/esdt-safe/meta/src/main.rs b/esdt-safe/meta/src/main.rs index 232dc09e..811f0759 100644 --- a/esdt-safe/meta/src/main.rs +++ b/esdt-safe/meta/src/main.rs @@ -1,3 +1,3 @@ fn main() { - multiversx_sc_meta::cli_main::(); + multiversx_sc_meta_lib::cli_main::(); } diff --git a/esdt-safe/wasm-esdt-safe-full/Cargo.toml b/esdt-safe/wasm-esdt-safe-full/Cargo.toml index fbf7134d..dfb338ba 100644 --- a/esdt-safe/wasm-esdt-safe-full/Cargo.toml +++ b/esdt-safe/wasm-esdt-safe-full/Cargo.toml @@ -1,9 +1,3 @@ -# Code generated by the multiversx-sc build system. DO NOT EDIT. - -# ########################################## -# ############## AUTO-GENERATED ############# -# ########################################## - [package] name = "esdt-safe-full-wasm" version = "0.0.0" @@ -28,7 +22,7 @@ panic = "abort" path = ".." [dependencies.multiversx-sc-wasm-adapter] -version = "=0.50.5" +version = "=0.51.1" [workspace] members = ["."] diff --git a/esdt-safe/wasm-esdt-safe-view/Cargo.toml b/esdt-safe/wasm-esdt-safe-view/Cargo.toml index ebae0fad..dfe5e07b 100644 --- a/esdt-safe/wasm-esdt-safe-view/Cargo.toml +++ b/esdt-safe/wasm-esdt-safe-view/Cargo.toml @@ -1,9 +1,3 @@ -# Code generated by the multiversx-sc build system. DO NOT EDIT. - -# ########################################## -# ############## AUTO-GENERATED ############# -# ########################################## - [package] name = "esdt-safe-view-wasm" version = "0.0.0" @@ -28,7 +22,7 @@ panic = "abort" path = ".." [dependencies.multiversx-sc-wasm-adapter] -version = "=0.50.5" +version = "=0.51.1" [workspace] members = ["."] diff --git a/esdt-safe/wasm/Cargo.toml b/esdt-safe/wasm/Cargo.toml index 63bcb6c8..fd905bf1 100644 --- a/esdt-safe/wasm/Cargo.toml +++ b/esdt-safe/wasm/Cargo.toml @@ -1,9 +1,3 @@ -# Code generated by the multiversx-sc build system. DO NOT EDIT. - -# ########################################## -# ############## AUTO-GENERATED ############# -# ########################################## - [package] name = "esdt-safe-wasm" version = "0.0.0" @@ -28,7 +22,7 @@ panic = "abort" path = ".." [dependencies.multiversx-sc-wasm-adapter] -version = "=0.50.5" +version = "=0.51.1" [workspace] members = ["."] diff --git a/fee-market/Cargo.toml b/fee-market/Cargo.toml index 88680fb9..2a971578 100644 --- a/fee-market/Cargo.toml +++ b/fee-market/Cargo.toml @@ -24,10 +24,10 @@ path = "../pair-mock" path = "../router-mock" [dependencies.multiversx-sc] -version = "=0.50.5" +version = "=0.51.1" [dev-dependencies] num-bigint = "0.4.2" [dev-dependencies.multiversx-sc-scenario] -version = "=0.50.5" +version = "=0.51.1" diff --git a/fee-market/meta/Cargo.toml b/fee-market/meta/Cargo.toml index a89ca01b..8625fe32 100644 --- a/fee-market/meta/Cargo.toml +++ b/fee-market/meta/Cargo.toml @@ -7,6 +7,6 @@ publish = false [dependencies.fee-market] path = ".." -[dependencies.multiversx-sc-meta] -version = "=0.50.5" +[dependencies.multiversx-sc-meta-lib] +version = "=0.51.1" default-features = false diff --git a/fee-market/meta/src/main.rs b/fee-market/meta/src/main.rs index 6e8526a1..18d797bb 100644 --- a/fee-market/meta/src/main.rs +++ b/fee-market/meta/src/main.rs @@ -1,3 +1,3 @@ fn main() { - multiversx_sc_meta::cli_main::(); + multiversx_sc_meta_lib::cli_main::(); } diff --git a/fee-market/wasm-fee-marker-full/Cargo.toml b/fee-market/wasm-fee-marker-full/Cargo.toml index fde6fad8..7858e0d7 100644 --- a/fee-market/wasm-fee-marker-full/Cargo.toml +++ b/fee-market/wasm-fee-marker-full/Cargo.toml @@ -1,9 +1,3 @@ -# Code generated by the multiversx-sc build system. DO NOT EDIT. - -# ########################################## -# ############## AUTO-GENERATED ############# -# ########################################## - [package] name = "fee-marker-full-wasm" version = "0.0.0" @@ -28,7 +22,7 @@ panic = "abort" path = ".." [dependencies.multiversx-sc-wasm-adapter] -version = "=0.50.5" +version = "=0.51.1" [workspace] members = ["."] diff --git a/fee-market/wasm-multisig-view/Cargo.toml b/fee-market/wasm-multisig-view/Cargo.toml index eb29e604..fff8aaac 100644 --- a/fee-market/wasm-multisig-view/Cargo.toml +++ b/fee-market/wasm-multisig-view/Cargo.toml @@ -1,9 +1,3 @@ -# Code generated by the multiversx-sc build system. DO NOT EDIT. - -# ########################################## -# ############## AUTO-GENERATED ############# -# ########################################## - [package] name = "multisig-view-wasm" version = "0.0.0" @@ -28,7 +22,7 @@ panic = "abort" path = ".." [dependencies.multiversx-sc-wasm-adapter] -version = "=0.50.5" +version = "=0.51.1" [workspace] members = ["."] diff --git a/fee-market/wasm/Cargo.toml b/fee-market/wasm/Cargo.toml index b918c8f3..3ce9604b 100644 --- a/fee-market/wasm/Cargo.toml +++ b/fee-market/wasm/Cargo.toml @@ -1,9 +1,3 @@ -# Code generated by the multiversx-sc build system. DO NOT EDIT. - -# ########################################## -# ############## AUTO-GENERATED ############# -# ########################################## - [package] name = "fee-market-wasm" version = "0.0.0" @@ -28,7 +22,7 @@ panic = "abort" path = ".." [dependencies.multiversx-sc-wasm-adapter] -version = "=0.50.5" +version = "=0.51.1" [workspace] members = ["."] diff --git a/header-verifier/Cargo.toml b/header-verifier/Cargo.toml index 6840cd16..ce5901a5 100644 --- a/header-verifier/Cargo.toml +++ b/header-verifier/Cargo.toml @@ -9,7 +9,7 @@ publish = false path = "src/lib.rs" [dependencies.multiversx-sc] -version = "0.50.5" +version = "0.51.1" [dependencies.bls-signature] path = "../common/bls-signature" @@ -21,4 +21,4 @@ path = "../common/transaction" num-bigint = "0.4.2" [dev-dependencies.multiversx-sc-scenario] -version = "0.50.5" +version = "0.51.1" diff --git a/header-verifier/meta/Cargo.toml b/header-verifier/meta/Cargo.toml index 3a9d7a5b..2758e4c9 100644 --- a/header-verifier/meta/Cargo.toml +++ b/header-verifier/meta/Cargo.toml @@ -7,6 +7,6 @@ publish = false [dependencies.header-verifier] path = ".." -[dependencies.multiversx-sc-meta] -version = "0.50.5" +[dependencies.multiversx-sc-meta-lib] +version = "0.51.1" default-features = false diff --git a/header-verifier/meta/src/main.rs b/header-verifier/meta/src/main.rs index 38b49041..36d2818d 100644 --- a/header-verifier/meta/src/main.rs +++ b/header-verifier/meta/src/main.rs @@ -1,3 +1,3 @@ fn main() { - multiversx_sc_meta::cli_main::(); + multiversx_sc_meta_lib::cli_main::(); } diff --git a/header-verifier/wasm-header-verifier-full/Cargo.toml b/header-verifier/wasm-header-verifier-full/Cargo.toml index 290968bc..e12804c3 100644 --- a/header-verifier/wasm-header-verifier-full/Cargo.toml +++ b/header-verifier/wasm-header-verifier-full/Cargo.toml @@ -1,9 +1,3 @@ -# Code generated by the multiversx-sc build system. DO NOT EDIT. - -# ########################################## -# ############## AUTO-GENERATED ############# -# ########################################## - [package] name = "header-verifier-full-wasm" version = "0.0.0" @@ -28,7 +22,7 @@ panic = "abort" path = ".." [dependencies.multiversx-sc-wasm-adapter] -version = "0.50.5" +version = "0.51.1" [workspace] members = ["."] diff --git a/header-verifier/wasm-multisig-view/Cargo.toml b/header-verifier/wasm-multisig-view/Cargo.toml index a5c83d24..5753d4c6 100644 --- a/header-verifier/wasm-multisig-view/Cargo.toml +++ b/header-verifier/wasm-multisig-view/Cargo.toml @@ -1,9 +1,3 @@ -# Code generated by the multiversx-sc build system. DO NOT EDIT. - -# ########################################## -# ############## AUTO-GENERATED ############# -# ########################################## - [package] name = "multisig-view-wasm" version = "0.0.0" @@ -28,7 +22,7 @@ panic = "abort" path = ".." [dependencies.multiversx-sc-wasm-adapter] -version = "0.50.5" +version = "0.51.1" [workspace] members = ["."] diff --git a/header-verifier/wasm/Cargo.toml b/header-verifier/wasm/Cargo.toml index 0d31ae8d..e7591c58 100644 --- a/header-verifier/wasm/Cargo.toml +++ b/header-verifier/wasm/Cargo.toml @@ -1,9 +1,3 @@ -# Code generated by the multiversx-sc build system. DO NOT EDIT. - -# ########################################## -# ############## AUTO-GENERATED ############# -# ########################################## - [package] name = "header-verifier-wasm" version = "0.0.0" @@ -28,7 +22,7 @@ panic = "abort" path = ".." [dependencies.multiversx-sc-wasm-adapter] -version = "0.50.5" +version = "0.51.1" [workspace] members = ["."] diff --git a/pair-mock/Cargo.toml b/pair-mock/Cargo.toml index d05f4855..e0ea6ae1 100644 --- a/pair-mock/Cargo.toml +++ b/pair-mock/Cargo.toml @@ -9,10 +9,10 @@ publish = false path = "src/pair_mock.rs" [dependencies.multiversx-sc] -version = "0.50.5" +version = "0.51.1" [dev-dependencies] num-bigint = "0.4" [dev-dependencies.multiversx-sc-scenario] -version = "0.50.5" +version = "0.51.1" diff --git a/pair-mock/meta/Cargo.toml b/pair-mock/meta/Cargo.toml index c512a41e..4aedd584 100644 --- a/pair-mock/meta/Cargo.toml +++ b/pair-mock/meta/Cargo.toml @@ -7,6 +7,6 @@ publish = false [dependencies.pair-mock] path = ".." -[dependencies.multiversx-sc-meta] -version = "0.50.5" +[dependencies.multiversx-sc-meta-lib] +version = "0.51.1" default-features = false diff --git a/pair-mock/meta/src/main.rs b/pair-mock/meta/src/main.rs index e4776f4f..17e5421a 100644 --- a/pair-mock/meta/src/main.rs +++ b/pair-mock/meta/src/main.rs @@ -1,3 +1,3 @@ fn main() { - multiversx_sc_meta::cli_main::(); + multiversx_sc_meta_lib::cli_main::(); } diff --git a/pair-mock/wasm/Cargo.toml b/pair-mock/wasm/Cargo.toml index 199f8fd0..b33fc78c 100644 --- a/pair-mock/wasm/Cargo.toml +++ b/pair-mock/wasm/Cargo.toml @@ -1,9 +1,3 @@ -# Code generated by the multiversx-sc build system. DO NOT EDIT. - -# ########################################## -# ############## AUTO-GENERATED ############# -# ########################################## - [package] name = "pair-mock-wasm" version = "0.0.0" @@ -28,7 +22,7 @@ panic = "abort" path = ".." [dependencies.multiversx-sc-wasm-adapter] -version = "0.50.5" +version = "0.51.1" [workspace] members = ["."] diff --git a/router-mock/Cargo.toml b/router-mock/Cargo.toml index 2077f4cf..d8738601 100644 --- a/router-mock/Cargo.toml +++ b/router-mock/Cargo.toml @@ -9,10 +9,10 @@ publish = false path = "src/router_mock.rs" [dependencies.multiversx-sc] -version = "0.50.5" +version = "0.51.1" [dev-dependencies] num-bigint = "0.4" [dev-dependencies.multiversx-sc-scenario] -version = "0.50.5" +version = "0.51.1" diff --git a/router-mock/meta/Cargo.toml b/router-mock/meta/Cargo.toml index 19d7cd25..76847b8d 100644 --- a/router-mock/meta/Cargo.toml +++ b/router-mock/meta/Cargo.toml @@ -7,6 +7,6 @@ publish = false [dependencies.router-mock] path = ".." -[dependencies.multiversx-sc-meta] -version = "0.50.5" +[dependencies.multiversx-sc-meta-lib] +version = "0.51.1" default-features = false diff --git a/router-mock/meta/src/main.rs b/router-mock/meta/src/main.rs index 0d3974eb..c0eaaddb 100644 --- a/router-mock/meta/src/main.rs +++ b/router-mock/meta/src/main.rs @@ -1,3 +1,3 @@ fn main() { - multiversx_sc_meta::cli_main::(); + multiversx_sc_meta_lib::cli_main::(); } diff --git a/router-mock/wasm/Cargo.toml b/router-mock/wasm/Cargo.toml index e4a44646..32659180 100644 --- a/router-mock/wasm/Cargo.toml +++ b/router-mock/wasm/Cargo.toml @@ -1,9 +1,3 @@ -# Code generated by the multiversx-sc build system. DO NOT EDIT. - -# ########################################## -# ############## AUTO-GENERATED ############# -# ########################################## - [package] name = "router-mock-wasm" version = "0.0.0" @@ -28,7 +22,7 @@ panic = "abort" path = ".." [dependencies.multiversx-sc-wasm-adapter] -version = "0.50.5" +version = "0.51.1" [workspace] members = ["."] From 6b3e73be98f8c47d5d175d9c54426b467019d6bd Mon Sep 17 00:00:00 2001 From: Andrei Baltariu Date: Mon, 8 Jul 2024 16:08:16 +0300 Subject: [PATCH 118/523] Added Cargo lock files --- chain-config/wasm/Cargo.lock | 36 +++++++++---------- chain-config/wasm/Cargo.toml | 6 ++++ chain-factory/wasm/Cargo.lock | 36 +++++++++---------- chain-factory/wasm/Cargo.toml | 6 ++++ .../wasm-enshrine-esdt-safe-full/Cargo.lock | 36 +++++++++---------- .../wasm-enshrine-esdt-safe-full/Cargo.toml | 6 ++++ .../wasm-enshrine-esdt-safe-view/Cargo.lock | 36 +++++++++---------- .../wasm-enshrine-esdt-safe-view/Cargo.toml | 6 ++++ enshrine-esdt-safe/wasm/Cargo.lock | 36 +++++++++---------- enshrine-esdt-safe/wasm/Cargo.toml | 6 ++++ esdt-safe/wasm-esdt-safe-full/Cargo.lock | 36 +++++++++---------- esdt-safe/wasm-esdt-safe-full/Cargo.toml | 6 ++++ esdt-safe/wasm-esdt-safe-view/Cargo.lock | 36 +++++++++---------- esdt-safe/wasm-esdt-safe-view/Cargo.toml | 6 ++++ esdt-safe/wasm/Cargo.lock | 36 +++++++++---------- esdt-safe/wasm/Cargo.toml | 6 ++++ fee-market/wasm-fee-marker-full/Cargo.lock | 32 ++++++++--------- fee-market/wasm-fee-marker-full/Cargo.toml | 6 ++++ fee-market/wasm-multisig-view/Cargo.lock | 32 ++++++++--------- fee-market/wasm-multisig-view/Cargo.toml | 6 ++++ fee-market/wasm/Cargo.lock | 32 ++++++++--------- fee-market/wasm/Cargo.toml | 6 ++++ .../wasm-header-verifier-full/Cargo.lock | 32 ++++++++--------- .../wasm-header-verifier-full/Cargo.toml | 6 ++++ header-verifier/wasm-multisig-view/Cargo.lock | 32 ++++++++--------- header-verifier/wasm-multisig-view/Cargo.toml | 6 ++++ header-verifier/wasm/Cargo.lock | 32 ++++++++--------- header-verifier/wasm/Cargo.toml | 6 ++++ pair-mock/wasm/Cargo.lock | 32 ++++++++--------- pair-mock/wasm/Cargo.toml | 6 ++++ router-mock/wasm/Cargo.lock | 32 ++++++++--------- router-mock/wasm/Cargo.toml | 6 ++++ 32 files changed, 368 insertions(+), 272 deletions(-) diff --git a/chain-config/wasm/Cargo.lock b/chain-config/wasm/Cargo.lock index ae868650..3d943e47 100644 --- a/chain-config/wasm/Cargo.lock +++ b/chain-config/wasm/Cargo.lock @@ -16,9 +16,9 @@ checksum = "0c4b4d0bd25bd0b74681c0ad21497610ce1b7c91b1022cd21c80c6fbdd9476b0" [[package]] name = "bitflags" -version = "2.5.0" +version = "2.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cf4b9d6a944f767f8e5e0db018570623c85f3d925ac718db4e06d0187adb21c1" +checksum = "b048fb63fd8b5923fc5aa7b340d8e156aec7ec02f0c78fa8a6ddc2613f6f71de" [[package]] name = "chain-config" @@ -56,9 +56,9 @@ checksum = "6fe2267d4ed49bc07b63801559be28c718ea06c4738b7a03c94df7386d2cde46" [[package]] name = "multiversx-sc" -version = "0.50.5" +version = "0.51.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a38a802d6cfa67748145a9e729336f4e6390eba702b5f14360ed01fcff14faa4" +checksum = "236f7890b2208796df8b5ac73b8572ffaf5e2b1531c7ad549d669328b715b657" dependencies = [ "bitflags", "hex-literal", @@ -70,9 +70,9 @@ dependencies = [ [[package]] name = "multiversx-sc-codec" -version = "0.19.0" +version = "0.20.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "35c94397b2fba14e40edfa55905b3f453ed57aa06c9b1960ad6a0ca6bfb7a236" +checksum = "fcecd449ea708b72f92edaa17158fe4859c1780aed9b52b14de45f26124ccb8b" dependencies = [ "arrayvec", "multiversx-sc-codec-derive", @@ -81,9 +81,9 @@ dependencies = [ [[package]] name = "multiversx-sc-codec-derive" -version = "0.19.0" +version = "0.20.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cf72a8042da0bc19da0b8f0d4f61b4c66ae853560fefc69cd8fea87bf1aa8c14" +checksum = "68f7fa25402e5e8054d719951289306fd79e481f7c21b2565b5549b6bc359772" dependencies = [ "hex", "proc-macro2", @@ -93,9 +93,9 @@ dependencies = [ [[package]] name = "multiversx-sc-derive" -version = "0.50.5" +version = "0.51.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7dc53ddcbd71948d2e8d3d6b814da866e2920b24e6c0cbfa643922f781897476" +checksum = "eb683bc78d0e2eb43c16cac790144f53cc2ab27912aeb1484433895742ce698d" dependencies = [ "hex", "proc-macro2", @@ -106,18 +106,18 @@ dependencies = [ [[package]] name = "multiversx-sc-modules" -version = "0.50.5" +version = "0.51.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ea1ae09db9cac18669b85d50932410df6082e1a575975ba5224e3b7ae33cbe7d" +checksum = "16af268784dff8a34cb696605413c325253da793d85f81b00dcb0e66f82963c9" dependencies = [ "multiversx-sc", ] [[package]] name = "multiversx-sc-wasm-adapter" -version = "0.50.5" +version = "0.51.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "99a090365b4483b4ea955ba1322f986f6821be88144291f0013c03f59b4de753" +checksum = "b2f0d6be22f911ce45427491a9bec94612a1678eab2769dd08c9c9731d13da53" dependencies = [ "multiversx-sc", ] @@ -142,9 +142,9 @@ dependencies = [ [[package]] name = "proc-macro2" -version = "1.0.82" +version = "1.0.86" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8ad3d49ab951a01fbaafe34f2ec74122942fe18a3f9814c3268f1bb72042131b" +checksum = "5e719e8df665df0d1c8fbfd238015744736151d4445ec0836b8e628aae103b77" dependencies = [ "unicode-ident", ] @@ -176,9 +176,9 @@ checksum = "3c5e1a9a646d36c3599cd173a41282daf47c44583ad367b8e6837255952e5c67" [[package]] name = "syn" -version = "2.0.61" +version = "2.0.68" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c993ed8ccba56ae856363b1845da7266a7cb78e1d146c8a32d54b45a8b831fc9" +checksum = "901fa70d88b9d6c98022e23b4136f9f3e54e4662c3bc1bd1d84a42a9a0f0c1e9" dependencies = [ "proc-macro2", "quote", diff --git a/chain-config/wasm/Cargo.toml b/chain-config/wasm/Cargo.toml index 851dfcbf..218930e9 100644 --- a/chain-config/wasm/Cargo.toml +++ b/chain-config/wasm/Cargo.toml @@ -1,3 +1,9 @@ +# Code generated by the multiversx-sc build system. DO NOT EDIT. + +# ########################################## +# ############## AUTO-GENERATED ############# +# ########################################## + [package] name = "chain-config-wasm" version = "0.0.0" diff --git a/chain-factory/wasm/Cargo.lock b/chain-factory/wasm/Cargo.lock index 5f1ea236..30ac35b8 100644 --- a/chain-factory/wasm/Cargo.lock +++ b/chain-factory/wasm/Cargo.lock @@ -16,9 +16,9 @@ checksum = "0c4b4d0bd25bd0b74681c0ad21497610ce1b7c91b1022cd21c80c6fbdd9476b0" [[package]] name = "bitflags" -version = "2.5.0" +version = "2.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cf4b9d6a944f767f8e5e0db018570623c85f3d925ac718db4e06d0187adb21c1" +checksum = "b048fb63fd8b5923fc5aa7b340d8e156aec7ec02f0c78fa8a6ddc2613f6f71de" [[package]] name = "bls-signature" @@ -74,9 +74,9 @@ checksum = "6fe2267d4ed49bc07b63801559be28c718ea06c4738b7a03c94df7386d2cde46" [[package]] name = "multiversx-sc" -version = "0.50.5" +version = "0.51.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a38a802d6cfa67748145a9e729336f4e6390eba702b5f14360ed01fcff14faa4" +checksum = "236f7890b2208796df8b5ac73b8572ffaf5e2b1531c7ad549d669328b715b657" dependencies = [ "bitflags", "hex-literal", @@ -88,9 +88,9 @@ dependencies = [ [[package]] name = "multiversx-sc-codec" -version = "0.19.0" +version = "0.20.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "35c94397b2fba14e40edfa55905b3f453ed57aa06c9b1960ad6a0ca6bfb7a236" +checksum = "fcecd449ea708b72f92edaa17158fe4859c1780aed9b52b14de45f26124ccb8b" dependencies = [ "arrayvec", "multiversx-sc-codec-derive", @@ -99,9 +99,9 @@ dependencies = [ [[package]] name = "multiversx-sc-codec-derive" -version = "0.19.0" +version = "0.20.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cf72a8042da0bc19da0b8f0d4f61b4c66ae853560fefc69cd8fea87bf1aa8c14" +checksum = "68f7fa25402e5e8054d719951289306fd79e481f7c21b2565b5549b6bc359772" dependencies = [ "hex", "proc-macro2", @@ -111,9 +111,9 @@ dependencies = [ [[package]] name = "multiversx-sc-derive" -version = "0.50.5" +version = "0.51.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7dc53ddcbd71948d2e8d3d6b814da866e2920b24e6c0cbfa643922f781897476" +checksum = "eb683bc78d0e2eb43c16cac790144f53cc2ab27912aeb1484433895742ce698d" dependencies = [ "hex", "proc-macro2", @@ -124,18 +124,18 @@ dependencies = [ [[package]] name = "multiversx-sc-modules" -version = "0.50.5" +version = "0.51.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ea1ae09db9cac18669b85d50932410df6082e1a575975ba5224e3b7ae33cbe7d" +checksum = "16af268784dff8a34cb696605413c325253da793d85f81b00dcb0e66f82963c9" dependencies = [ "multiversx-sc", ] [[package]] name = "multiversx-sc-wasm-adapter" -version = "0.50.5" +version = "0.51.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "99a090365b4483b4ea955ba1322f986f6821be88144291f0013c03f59b4de753" +checksum = "b2f0d6be22f911ce45427491a9bec94612a1678eab2769dd08c9c9731d13da53" dependencies = [ "multiversx-sc", ] @@ -160,9 +160,9 @@ dependencies = [ [[package]] name = "proc-macro2" -version = "1.0.82" +version = "1.0.86" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8ad3d49ab951a01fbaafe34f2ec74122942fe18a3f9814c3268f1bb72042131b" +checksum = "5e719e8df665df0d1c8fbfd238015744736151d4445ec0836b8e628aae103b77" dependencies = [ "unicode-ident", ] @@ -194,9 +194,9 @@ checksum = "3c5e1a9a646d36c3599cd173a41282daf47c44583ad367b8e6837255952e5c67" [[package]] name = "syn" -version = "2.0.61" +version = "2.0.68" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c993ed8ccba56ae856363b1845da7266a7cb78e1d146c8a32d54b45a8b831fc9" +checksum = "901fa70d88b9d6c98022e23b4136f9f3e54e4662c3bc1bd1d84a42a9a0f0c1e9" dependencies = [ "proc-macro2", "quote", diff --git a/chain-factory/wasm/Cargo.toml b/chain-factory/wasm/Cargo.toml index 2314a8be..f5aeac10 100644 --- a/chain-factory/wasm/Cargo.toml +++ b/chain-factory/wasm/Cargo.toml @@ -1,3 +1,9 @@ +# Code generated by the multiversx-sc build system. DO NOT EDIT. + +# ########################################## +# ############## AUTO-GENERATED ############# +# ########################################## + [package] name = "chain-factory-wasm" version = "0.0.0" diff --git a/enshrine-esdt-safe/wasm-enshrine-esdt-safe-full/Cargo.lock b/enshrine-esdt-safe/wasm-enshrine-esdt-safe-full/Cargo.lock index b439d2da..9677d66b 100644 --- a/enshrine-esdt-safe/wasm-enshrine-esdt-safe-full/Cargo.lock +++ b/enshrine-esdt-safe/wasm-enshrine-esdt-safe-full/Cargo.lock @@ -16,9 +16,9 @@ checksum = "0c4b4d0bd25bd0b74681c0ad21497610ce1b7c91b1022cd21c80c6fbdd9476b0" [[package]] name = "bitflags" -version = "2.5.0" +version = "2.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cf4b9d6a944f767f8e5e0db018570623c85f3d925ac718db4e06d0187adb21c1" +checksum = "b048fb63fd8b5923fc5aa7b340d8e156aec7ec02f0c78fa8a6ddc2613f6f71de" [[package]] name = "bls-signature" @@ -101,9 +101,9 @@ dependencies = [ [[package]] name = "multiversx-sc" -version = "0.50.5" +version = "0.51.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a38a802d6cfa67748145a9e729336f4e6390eba702b5f14360ed01fcff14faa4" +checksum = "236f7890b2208796df8b5ac73b8572ffaf5e2b1531c7ad549d669328b715b657" dependencies = [ "bitflags", "hex-literal", @@ -115,9 +115,9 @@ dependencies = [ [[package]] name = "multiversx-sc-codec" -version = "0.19.0" +version = "0.20.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "35c94397b2fba14e40edfa55905b3f453ed57aa06c9b1960ad6a0ca6bfb7a236" +checksum = "fcecd449ea708b72f92edaa17158fe4859c1780aed9b52b14de45f26124ccb8b" dependencies = [ "arrayvec", "multiversx-sc-codec-derive", @@ -126,9 +126,9 @@ dependencies = [ [[package]] name = "multiversx-sc-codec-derive" -version = "0.19.0" +version = "0.20.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cf72a8042da0bc19da0b8f0d4f61b4c66ae853560fefc69cd8fea87bf1aa8c14" +checksum = "68f7fa25402e5e8054d719951289306fd79e481f7c21b2565b5549b6bc359772" dependencies = [ "hex", "proc-macro2", @@ -138,9 +138,9 @@ dependencies = [ [[package]] name = "multiversx-sc-derive" -version = "0.50.5" +version = "0.51.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7dc53ddcbd71948d2e8d3d6b814da866e2920b24e6c0cbfa643922f781897476" +checksum = "eb683bc78d0e2eb43c16cac790144f53cc2ab27912aeb1484433895742ce698d" dependencies = [ "hex", "proc-macro2", @@ -151,18 +151,18 @@ dependencies = [ [[package]] name = "multiversx-sc-modules" -version = "0.50.5" +version = "0.51.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ea1ae09db9cac18669b85d50932410df6082e1a575975ba5224e3b7ae33cbe7d" +checksum = "16af268784dff8a34cb696605413c325253da793d85f81b00dcb0e66f82963c9" dependencies = [ "multiversx-sc", ] [[package]] name = "multiversx-sc-wasm-adapter" -version = "0.50.5" +version = "0.51.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "99a090365b4483b4ea955ba1322f986f6821be88144291f0013c03f59b4de753" +checksum = "b2f0d6be22f911ce45427491a9bec94612a1678eab2769dd08c9c9731d13da53" dependencies = [ "multiversx-sc", ] @@ -194,9 +194,9 @@ dependencies = [ [[package]] name = "proc-macro2" -version = "1.0.82" +version = "1.0.86" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8ad3d49ab951a01fbaafe34f2ec74122942fe18a3f9814c3268f1bb72042131b" +checksum = "5e719e8df665df0d1c8fbfd238015744736151d4445ec0836b8e628aae103b77" dependencies = [ "unicode-ident", ] @@ -242,9 +242,9 @@ checksum = "3c5e1a9a646d36c3599cd173a41282daf47c44583ad367b8e6837255952e5c67" [[package]] name = "syn" -version = "2.0.61" +version = "2.0.68" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c993ed8ccba56ae856363b1845da7266a7cb78e1d146c8a32d54b45a8b831fc9" +checksum = "901fa70d88b9d6c98022e23b4136f9f3e54e4662c3bc1bd1d84a42a9a0f0c1e9" dependencies = [ "proc-macro2", "quote", diff --git a/enshrine-esdt-safe/wasm-enshrine-esdt-safe-full/Cargo.toml b/enshrine-esdt-safe/wasm-enshrine-esdt-safe-full/Cargo.toml index f155e3c9..71f28b83 100644 --- a/enshrine-esdt-safe/wasm-enshrine-esdt-safe-full/Cargo.toml +++ b/enshrine-esdt-safe/wasm-enshrine-esdt-safe-full/Cargo.toml @@ -1,3 +1,9 @@ +# Code generated by the multiversx-sc build system. DO NOT EDIT. + +# ########################################## +# ############## AUTO-GENERATED ############# +# ########################################## + [package] name = "enshrine-esdt-safe-full-wasm" version = "0.0.0" diff --git a/enshrine-esdt-safe/wasm-enshrine-esdt-safe-view/Cargo.lock b/enshrine-esdt-safe/wasm-enshrine-esdt-safe-view/Cargo.lock index bd52fa02..1cecede7 100644 --- a/enshrine-esdt-safe/wasm-enshrine-esdt-safe-view/Cargo.lock +++ b/enshrine-esdt-safe/wasm-enshrine-esdt-safe-view/Cargo.lock @@ -16,9 +16,9 @@ checksum = "0c4b4d0bd25bd0b74681c0ad21497610ce1b7c91b1022cd21c80c6fbdd9476b0" [[package]] name = "bitflags" -version = "2.5.0" +version = "2.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cf4b9d6a944f767f8e5e0db018570623c85f3d925ac718db4e06d0187adb21c1" +checksum = "b048fb63fd8b5923fc5aa7b340d8e156aec7ec02f0c78fa8a6ddc2613f6f71de" [[package]] name = "bls-signature" @@ -101,9 +101,9 @@ dependencies = [ [[package]] name = "multiversx-sc" -version = "0.50.5" +version = "0.51.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a38a802d6cfa67748145a9e729336f4e6390eba702b5f14360ed01fcff14faa4" +checksum = "236f7890b2208796df8b5ac73b8572ffaf5e2b1531c7ad549d669328b715b657" dependencies = [ "bitflags", "hex-literal", @@ -115,9 +115,9 @@ dependencies = [ [[package]] name = "multiversx-sc-codec" -version = "0.19.0" +version = "0.20.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "35c94397b2fba14e40edfa55905b3f453ed57aa06c9b1960ad6a0ca6bfb7a236" +checksum = "fcecd449ea708b72f92edaa17158fe4859c1780aed9b52b14de45f26124ccb8b" dependencies = [ "arrayvec", "multiversx-sc-codec-derive", @@ -126,9 +126,9 @@ dependencies = [ [[package]] name = "multiversx-sc-codec-derive" -version = "0.19.0" +version = "0.20.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cf72a8042da0bc19da0b8f0d4f61b4c66ae853560fefc69cd8fea87bf1aa8c14" +checksum = "68f7fa25402e5e8054d719951289306fd79e481f7c21b2565b5549b6bc359772" dependencies = [ "hex", "proc-macro2", @@ -138,9 +138,9 @@ dependencies = [ [[package]] name = "multiversx-sc-derive" -version = "0.50.5" +version = "0.51.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7dc53ddcbd71948d2e8d3d6b814da866e2920b24e6c0cbfa643922f781897476" +checksum = "eb683bc78d0e2eb43c16cac790144f53cc2ab27912aeb1484433895742ce698d" dependencies = [ "hex", "proc-macro2", @@ -151,18 +151,18 @@ dependencies = [ [[package]] name = "multiversx-sc-modules" -version = "0.50.5" +version = "0.51.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ea1ae09db9cac18669b85d50932410df6082e1a575975ba5224e3b7ae33cbe7d" +checksum = "16af268784dff8a34cb696605413c325253da793d85f81b00dcb0e66f82963c9" dependencies = [ "multiversx-sc", ] [[package]] name = "multiversx-sc-wasm-adapter" -version = "0.50.5" +version = "0.51.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "99a090365b4483b4ea955ba1322f986f6821be88144291f0013c03f59b4de753" +checksum = "b2f0d6be22f911ce45427491a9bec94612a1678eab2769dd08c9c9731d13da53" dependencies = [ "multiversx-sc", ] @@ -194,9 +194,9 @@ dependencies = [ [[package]] name = "proc-macro2" -version = "1.0.82" +version = "1.0.86" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8ad3d49ab951a01fbaafe34f2ec74122942fe18a3f9814c3268f1bb72042131b" +checksum = "5e719e8df665df0d1c8fbfd238015744736151d4445ec0836b8e628aae103b77" dependencies = [ "unicode-ident", ] @@ -242,9 +242,9 @@ checksum = "3c5e1a9a646d36c3599cd173a41282daf47c44583ad367b8e6837255952e5c67" [[package]] name = "syn" -version = "2.0.61" +version = "2.0.68" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c993ed8ccba56ae856363b1845da7266a7cb78e1d146c8a32d54b45a8b831fc9" +checksum = "901fa70d88b9d6c98022e23b4136f9f3e54e4662c3bc1bd1d84a42a9a0f0c1e9" dependencies = [ "proc-macro2", "quote", diff --git a/enshrine-esdt-safe/wasm-enshrine-esdt-safe-view/Cargo.toml b/enshrine-esdt-safe/wasm-enshrine-esdt-safe-view/Cargo.toml index cc8d6ddf..09dbe893 100644 --- a/enshrine-esdt-safe/wasm-enshrine-esdt-safe-view/Cargo.toml +++ b/enshrine-esdt-safe/wasm-enshrine-esdt-safe-view/Cargo.toml @@ -1,3 +1,9 @@ +# Code generated by the multiversx-sc build system. DO NOT EDIT. + +# ########################################## +# ############## AUTO-GENERATED ############# +# ########################################## + [package] name = "enshrine-esdt-safe-view-wasm" version = "0.0.0" diff --git a/enshrine-esdt-safe/wasm/Cargo.lock b/enshrine-esdt-safe/wasm/Cargo.lock index 98de4f91..060a012b 100644 --- a/enshrine-esdt-safe/wasm/Cargo.lock +++ b/enshrine-esdt-safe/wasm/Cargo.lock @@ -16,9 +16,9 @@ checksum = "0c4b4d0bd25bd0b74681c0ad21497610ce1b7c91b1022cd21c80c6fbdd9476b0" [[package]] name = "bitflags" -version = "2.5.0" +version = "2.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cf4b9d6a944f767f8e5e0db018570623c85f3d925ac718db4e06d0187adb21c1" +checksum = "b048fb63fd8b5923fc5aa7b340d8e156aec7ec02f0c78fa8a6ddc2613f6f71de" [[package]] name = "bls-signature" @@ -101,9 +101,9 @@ dependencies = [ [[package]] name = "multiversx-sc" -version = "0.50.5" +version = "0.51.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a38a802d6cfa67748145a9e729336f4e6390eba702b5f14360ed01fcff14faa4" +checksum = "236f7890b2208796df8b5ac73b8572ffaf5e2b1531c7ad549d669328b715b657" dependencies = [ "bitflags", "hex-literal", @@ -115,9 +115,9 @@ dependencies = [ [[package]] name = "multiversx-sc-codec" -version = "0.19.0" +version = "0.20.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "35c94397b2fba14e40edfa55905b3f453ed57aa06c9b1960ad6a0ca6bfb7a236" +checksum = "fcecd449ea708b72f92edaa17158fe4859c1780aed9b52b14de45f26124ccb8b" dependencies = [ "arrayvec", "multiversx-sc-codec-derive", @@ -126,9 +126,9 @@ dependencies = [ [[package]] name = "multiversx-sc-codec-derive" -version = "0.19.0" +version = "0.20.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cf72a8042da0bc19da0b8f0d4f61b4c66ae853560fefc69cd8fea87bf1aa8c14" +checksum = "68f7fa25402e5e8054d719951289306fd79e481f7c21b2565b5549b6bc359772" dependencies = [ "hex", "proc-macro2", @@ -138,9 +138,9 @@ dependencies = [ [[package]] name = "multiversx-sc-derive" -version = "0.50.5" +version = "0.51.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7dc53ddcbd71948d2e8d3d6b814da866e2920b24e6c0cbfa643922f781897476" +checksum = "eb683bc78d0e2eb43c16cac790144f53cc2ab27912aeb1484433895742ce698d" dependencies = [ "hex", "proc-macro2", @@ -151,18 +151,18 @@ dependencies = [ [[package]] name = "multiversx-sc-modules" -version = "0.50.5" +version = "0.51.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ea1ae09db9cac18669b85d50932410df6082e1a575975ba5224e3b7ae33cbe7d" +checksum = "16af268784dff8a34cb696605413c325253da793d85f81b00dcb0e66f82963c9" dependencies = [ "multiversx-sc", ] [[package]] name = "multiversx-sc-wasm-adapter" -version = "0.50.5" +version = "0.51.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "99a090365b4483b4ea955ba1322f986f6821be88144291f0013c03f59b4de753" +checksum = "b2f0d6be22f911ce45427491a9bec94612a1678eab2769dd08c9c9731d13da53" dependencies = [ "multiversx-sc", ] @@ -194,9 +194,9 @@ dependencies = [ [[package]] name = "proc-macro2" -version = "1.0.82" +version = "1.0.86" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8ad3d49ab951a01fbaafe34f2ec74122942fe18a3f9814c3268f1bb72042131b" +checksum = "5e719e8df665df0d1c8fbfd238015744736151d4445ec0836b8e628aae103b77" dependencies = [ "unicode-ident", ] @@ -242,9 +242,9 @@ checksum = "3c5e1a9a646d36c3599cd173a41282daf47c44583ad367b8e6837255952e5c67" [[package]] name = "syn" -version = "2.0.61" +version = "2.0.68" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c993ed8ccba56ae856363b1845da7266a7cb78e1d146c8a32d54b45a8b831fc9" +checksum = "901fa70d88b9d6c98022e23b4136f9f3e54e4662c3bc1bd1d84a42a9a0f0c1e9" dependencies = [ "proc-macro2", "quote", diff --git a/enshrine-esdt-safe/wasm/Cargo.toml b/enshrine-esdt-safe/wasm/Cargo.toml index 5306da1a..e8c6bf60 100644 --- a/enshrine-esdt-safe/wasm/Cargo.toml +++ b/enshrine-esdt-safe/wasm/Cargo.toml @@ -1,3 +1,9 @@ +# Code generated by the multiversx-sc build system. DO NOT EDIT. + +# ########################################## +# ############## AUTO-GENERATED ############# +# ########################################## + [package] name = "enshrine-esdt-safe-wasm" version = "0.0.0" diff --git a/esdt-safe/wasm-esdt-safe-full/Cargo.lock b/esdt-safe/wasm-esdt-safe-full/Cargo.lock index 0af191ab..07451e04 100644 --- a/esdt-safe/wasm-esdt-safe-full/Cargo.lock +++ b/esdt-safe/wasm-esdt-safe-full/Cargo.lock @@ -16,9 +16,9 @@ checksum = "0c4b4d0bd25bd0b74681c0ad21497610ce1b7c91b1022cd21c80c6fbdd9476b0" [[package]] name = "bitflags" -version = "2.5.0" +version = "2.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cf4b9d6a944f767f8e5e0db018570623c85f3d925ac718db4e06d0187adb21c1" +checksum = "b048fb63fd8b5923fc5aa7b340d8e156aec7ec02f0c78fa8a6ddc2613f6f71de" [[package]] name = "bls-signature" @@ -101,9 +101,9 @@ dependencies = [ [[package]] name = "multiversx-sc" -version = "0.50.5" +version = "0.51.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a38a802d6cfa67748145a9e729336f4e6390eba702b5f14360ed01fcff14faa4" +checksum = "236f7890b2208796df8b5ac73b8572ffaf5e2b1531c7ad549d669328b715b657" dependencies = [ "bitflags", "hex-literal", @@ -115,9 +115,9 @@ dependencies = [ [[package]] name = "multiversx-sc-codec" -version = "0.19.0" +version = "0.20.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "35c94397b2fba14e40edfa55905b3f453ed57aa06c9b1960ad6a0ca6bfb7a236" +checksum = "fcecd449ea708b72f92edaa17158fe4859c1780aed9b52b14de45f26124ccb8b" dependencies = [ "arrayvec", "multiversx-sc-codec-derive", @@ -126,9 +126,9 @@ dependencies = [ [[package]] name = "multiversx-sc-codec-derive" -version = "0.19.0" +version = "0.20.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cf72a8042da0bc19da0b8f0d4f61b4c66ae853560fefc69cd8fea87bf1aa8c14" +checksum = "68f7fa25402e5e8054d719951289306fd79e481f7c21b2565b5549b6bc359772" dependencies = [ "hex", "proc-macro2", @@ -138,9 +138,9 @@ dependencies = [ [[package]] name = "multiversx-sc-derive" -version = "0.50.5" +version = "0.51.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7dc53ddcbd71948d2e8d3d6b814da866e2920b24e6c0cbfa643922f781897476" +checksum = "eb683bc78d0e2eb43c16cac790144f53cc2ab27912aeb1484433895742ce698d" dependencies = [ "hex", "proc-macro2", @@ -151,18 +151,18 @@ dependencies = [ [[package]] name = "multiversx-sc-modules" -version = "0.50.5" +version = "0.51.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ea1ae09db9cac18669b85d50932410df6082e1a575975ba5224e3b7ae33cbe7d" +checksum = "16af268784dff8a34cb696605413c325253da793d85f81b00dcb0e66f82963c9" dependencies = [ "multiversx-sc", ] [[package]] name = "multiversx-sc-wasm-adapter" -version = "0.50.5" +version = "0.51.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "99a090365b4483b4ea955ba1322f986f6821be88144291f0013c03f59b4de753" +checksum = "b2f0d6be22f911ce45427491a9bec94612a1678eab2769dd08c9c9731d13da53" dependencies = [ "multiversx-sc", ] @@ -194,9 +194,9 @@ dependencies = [ [[package]] name = "proc-macro2" -version = "1.0.82" +version = "1.0.86" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8ad3d49ab951a01fbaafe34f2ec74122942fe18a3f9814c3268f1bb72042131b" +checksum = "5e719e8df665df0d1c8fbfd238015744736151d4445ec0836b8e628aae103b77" dependencies = [ "unicode-ident", ] @@ -242,9 +242,9 @@ checksum = "3c5e1a9a646d36c3599cd173a41282daf47c44583ad367b8e6837255952e5c67" [[package]] name = "syn" -version = "2.0.61" +version = "2.0.68" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c993ed8ccba56ae856363b1845da7266a7cb78e1d146c8a32d54b45a8b831fc9" +checksum = "901fa70d88b9d6c98022e23b4136f9f3e54e4662c3bc1bd1d84a42a9a0f0c1e9" dependencies = [ "proc-macro2", "quote", diff --git a/esdt-safe/wasm-esdt-safe-full/Cargo.toml b/esdt-safe/wasm-esdt-safe-full/Cargo.toml index dfb338ba..66c52792 100644 --- a/esdt-safe/wasm-esdt-safe-full/Cargo.toml +++ b/esdt-safe/wasm-esdt-safe-full/Cargo.toml @@ -1,3 +1,9 @@ +# Code generated by the multiversx-sc build system. DO NOT EDIT. + +# ########################################## +# ############## AUTO-GENERATED ############# +# ########################################## + [package] name = "esdt-safe-full-wasm" version = "0.0.0" diff --git a/esdt-safe/wasm-esdt-safe-view/Cargo.lock b/esdt-safe/wasm-esdt-safe-view/Cargo.lock index 04a91694..7dd7b721 100644 --- a/esdt-safe/wasm-esdt-safe-view/Cargo.lock +++ b/esdt-safe/wasm-esdt-safe-view/Cargo.lock @@ -16,9 +16,9 @@ checksum = "0c4b4d0bd25bd0b74681c0ad21497610ce1b7c91b1022cd21c80c6fbdd9476b0" [[package]] name = "bitflags" -version = "2.5.0" +version = "2.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cf4b9d6a944f767f8e5e0db018570623c85f3d925ac718db4e06d0187adb21c1" +checksum = "b048fb63fd8b5923fc5aa7b340d8e156aec7ec02f0c78fa8a6ddc2613f6f71de" [[package]] name = "bls-signature" @@ -101,9 +101,9 @@ dependencies = [ [[package]] name = "multiversx-sc" -version = "0.50.5" +version = "0.51.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a38a802d6cfa67748145a9e729336f4e6390eba702b5f14360ed01fcff14faa4" +checksum = "236f7890b2208796df8b5ac73b8572ffaf5e2b1531c7ad549d669328b715b657" dependencies = [ "bitflags", "hex-literal", @@ -115,9 +115,9 @@ dependencies = [ [[package]] name = "multiversx-sc-codec" -version = "0.19.0" +version = "0.20.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "35c94397b2fba14e40edfa55905b3f453ed57aa06c9b1960ad6a0ca6bfb7a236" +checksum = "fcecd449ea708b72f92edaa17158fe4859c1780aed9b52b14de45f26124ccb8b" dependencies = [ "arrayvec", "multiversx-sc-codec-derive", @@ -126,9 +126,9 @@ dependencies = [ [[package]] name = "multiversx-sc-codec-derive" -version = "0.19.0" +version = "0.20.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cf72a8042da0bc19da0b8f0d4f61b4c66ae853560fefc69cd8fea87bf1aa8c14" +checksum = "68f7fa25402e5e8054d719951289306fd79e481f7c21b2565b5549b6bc359772" dependencies = [ "hex", "proc-macro2", @@ -138,9 +138,9 @@ dependencies = [ [[package]] name = "multiversx-sc-derive" -version = "0.50.5" +version = "0.51.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7dc53ddcbd71948d2e8d3d6b814da866e2920b24e6c0cbfa643922f781897476" +checksum = "eb683bc78d0e2eb43c16cac790144f53cc2ab27912aeb1484433895742ce698d" dependencies = [ "hex", "proc-macro2", @@ -151,18 +151,18 @@ dependencies = [ [[package]] name = "multiversx-sc-modules" -version = "0.50.5" +version = "0.51.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ea1ae09db9cac18669b85d50932410df6082e1a575975ba5224e3b7ae33cbe7d" +checksum = "16af268784dff8a34cb696605413c325253da793d85f81b00dcb0e66f82963c9" dependencies = [ "multiversx-sc", ] [[package]] name = "multiversx-sc-wasm-adapter" -version = "0.50.5" +version = "0.51.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "99a090365b4483b4ea955ba1322f986f6821be88144291f0013c03f59b4de753" +checksum = "b2f0d6be22f911ce45427491a9bec94612a1678eab2769dd08c9c9731d13da53" dependencies = [ "multiversx-sc", ] @@ -194,9 +194,9 @@ dependencies = [ [[package]] name = "proc-macro2" -version = "1.0.82" +version = "1.0.86" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8ad3d49ab951a01fbaafe34f2ec74122942fe18a3f9814c3268f1bb72042131b" +checksum = "5e719e8df665df0d1c8fbfd238015744736151d4445ec0836b8e628aae103b77" dependencies = [ "unicode-ident", ] @@ -242,9 +242,9 @@ checksum = "3c5e1a9a646d36c3599cd173a41282daf47c44583ad367b8e6837255952e5c67" [[package]] name = "syn" -version = "2.0.61" +version = "2.0.68" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c993ed8ccba56ae856363b1845da7266a7cb78e1d146c8a32d54b45a8b831fc9" +checksum = "901fa70d88b9d6c98022e23b4136f9f3e54e4662c3bc1bd1d84a42a9a0f0c1e9" dependencies = [ "proc-macro2", "quote", diff --git a/esdt-safe/wasm-esdt-safe-view/Cargo.toml b/esdt-safe/wasm-esdt-safe-view/Cargo.toml index dfe5e07b..9a8bf4bc 100644 --- a/esdt-safe/wasm-esdt-safe-view/Cargo.toml +++ b/esdt-safe/wasm-esdt-safe-view/Cargo.toml @@ -1,3 +1,9 @@ +# Code generated by the multiversx-sc build system. DO NOT EDIT. + +# ########################################## +# ############## AUTO-GENERATED ############# +# ########################################## + [package] name = "esdt-safe-view-wasm" version = "0.0.0" diff --git a/esdt-safe/wasm/Cargo.lock b/esdt-safe/wasm/Cargo.lock index 0ddb82fa..b9e789ac 100644 --- a/esdt-safe/wasm/Cargo.lock +++ b/esdt-safe/wasm/Cargo.lock @@ -16,9 +16,9 @@ checksum = "0c4b4d0bd25bd0b74681c0ad21497610ce1b7c91b1022cd21c80c6fbdd9476b0" [[package]] name = "bitflags" -version = "2.5.0" +version = "2.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cf4b9d6a944f767f8e5e0db018570623c85f3d925ac718db4e06d0187adb21c1" +checksum = "b048fb63fd8b5923fc5aa7b340d8e156aec7ec02f0c78fa8a6ddc2613f6f71de" [[package]] name = "bls-signature" @@ -101,9 +101,9 @@ dependencies = [ [[package]] name = "multiversx-sc" -version = "0.50.5" +version = "0.51.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a38a802d6cfa67748145a9e729336f4e6390eba702b5f14360ed01fcff14faa4" +checksum = "236f7890b2208796df8b5ac73b8572ffaf5e2b1531c7ad549d669328b715b657" dependencies = [ "bitflags", "hex-literal", @@ -115,9 +115,9 @@ dependencies = [ [[package]] name = "multiversx-sc-codec" -version = "0.19.0" +version = "0.20.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "35c94397b2fba14e40edfa55905b3f453ed57aa06c9b1960ad6a0ca6bfb7a236" +checksum = "fcecd449ea708b72f92edaa17158fe4859c1780aed9b52b14de45f26124ccb8b" dependencies = [ "arrayvec", "multiversx-sc-codec-derive", @@ -126,9 +126,9 @@ dependencies = [ [[package]] name = "multiversx-sc-codec-derive" -version = "0.19.0" +version = "0.20.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cf72a8042da0bc19da0b8f0d4f61b4c66ae853560fefc69cd8fea87bf1aa8c14" +checksum = "68f7fa25402e5e8054d719951289306fd79e481f7c21b2565b5549b6bc359772" dependencies = [ "hex", "proc-macro2", @@ -138,9 +138,9 @@ dependencies = [ [[package]] name = "multiversx-sc-derive" -version = "0.50.5" +version = "0.51.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7dc53ddcbd71948d2e8d3d6b814da866e2920b24e6c0cbfa643922f781897476" +checksum = "eb683bc78d0e2eb43c16cac790144f53cc2ab27912aeb1484433895742ce698d" dependencies = [ "hex", "proc-macro2", @@ -151,18 +151,18 @@ dependencies = [ [[package]] name = "multiversx-sc-modules" -version = "0.50.5" +version = "0.51.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ea1ae09db9cac18669b85d50932410df6082e1a575975ba5224e3b7ae33cbe7d" +checksum = "16af268784dff8a34cb696605413c325253da793d85f81b00dcb0e66f82963c9" dependencies = [ "multiversx-sc", ] [[package]] name = "multiversx-sc-wasm-adapter" -version = "0.50.5" +version = "0.51.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "99a090365b4483b4ea955ba1322f986f6821be88144291f0013c03f59b4de753" +checksum = "b2f0d6be22f911ce45427491a9bec94612a1678eab2769dd08c9c9731d13da53" dependencies = [ "multiversx-sc", ] @@ -194,9 +194,9 @@ dependencies = [ [[package]] name = "proc-macro2" -version = "1.0.82" +version = "1.0.86" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8ad3d49ab951a01fbaafe34f2ec74122942fe18a3f9814c3268f1bb72042131b" +checksum = "5e719e8df665df0d1c8fbfd238015744736151d4445ec0836b8e628aae103b77" dependencies = [ "unicode-ident", ] @@ -242,9 +242,9 @@ checksum = "3c5e1a9a646d36c3599cd173a41282daf47c44583ad367b8e6837255952e5c67" [[package]] name = "syn" -version = "2.0.61" +version = "2.0.68" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c993ed8ccba56ae856363b1845da7266a7cb78e1d146c8a32d54b45a8b831fc9" +checksum = "901fa70d88b9d6c98022e23b4136f9f3e54e4662c3bc1bd1d84a42a9a0f0c1e9" dependencies = [ "proc-macro2", "quote", diff --git a/esdt-safe/wasm/Cargo.toml b/esdt-safe/wasm/Cargo.toml index fd905bf1..85d6a0ab 100644 --- a/esdt-safe/wasm/Cargo.toml +++ b/esdt-safe/wasm/Cargo.toml @@ -1,3 +1,9 @@ +# Code generated by the multiversx-sc build system. DO NOT EDIT. + +# ########################################## +# ############## AUTO-GENERATED ############# +# ########################################## + [package] name = "esdt-safe-wasm" version = "0.0.0" diff --git a/fee-market/wasm-fee-marker-full/Cargo.lock b/fee-market/wasm-fee-marker-full/Cargo.lock index 43c47c5d..d86c3bdd 100644 --- a/fee-market/wasm-fee-marker-full/Cargo.lock +++ b/fee-market/wasm-fee-marker-full/Cargo.lock @@ -16,9 +16,9 @@ checksum = "0c4b4d0bd25bd0b74681c0ad21497610ce1b7c91b1022cd21c80c6fbdd9476b0" [[package]] name = "bitflags" -version = "2.5.0" +version = "2.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cf4b9d6a944f767f8e5e0db018570623c85f3d925ac718db4e06d0187adb21c1" +checksum = "b048fb63fd8b5923fc5aa7b340d8e156aec7ec02f0c78fa8a6ddc2613f6f71de" [[package]] name = "bls-signature" @@ -68,9 +68,9 @@ checksum = "6fe2267d4ed49bc07b63801559be28c718ea06c4738b7a03c94df7386d2cde46" [[package]] name = "multiversx-sc" -version = "0.50.5" +version = "0.51.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a38a802d6cfa67748145a9e729336f4e6390eba702b5f14360ed01fcff14faa4" +checksum = "236f7890b2208796df8b5ac73b8572ffaf5e2b1531c7ad549d669328b715b657" dependencies = [ "bitflags", "hex-literal", @@ -82,9 +82,9 @@ dependencies = [ [[package]] name = "multiversx-sc-codec" -version = "0.19.0" +version = "0.20.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "35c94397b2fba14e40edfa55905b3f453ed57aa06c9b1960ad6a0ca6bfb7a236" +checksum = "fcecd449ea708b72f92edaa17158fe4859c1780aed9b52b14de45f26124ccb8b" dependencies = [ "arrayvec", "multiversx-sc-codec-derive", @@ -93,9 +93,9 @@ dependencies = [ [[package]] name = "multiversx-sc-codec-derive" -version = "0.19.0" +version = "0.20.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cf72a8042da0bc19da0b8f0d4f61b4c66ae853560fefc69cd8fea87bf1aa8c14" +checksum = "68f7fa25402e5e8054d719951289306fd79e481f7c21b2565b5549b6bc359772" dependencies = [ "hex", "proc-macro2", @@ -105,9 +105,9 @@ dependencies = [ [[package]] name = "multiversx-sc-derive" -version = "0.50.5" +version = "0.51.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7dc53ddcbd71948d2e8d3d6b814da866e2920b24e6c0cbfa643922f781897476" +checksum = "eb683bc78d0e2eb43c16cac790144f53cc2ab27912aeb1484433895742ce698d" dependencies = [ "hex", "proc-macro2", @@ -118,9 +118,9 @@ dependencies = [ [[package]] name = "multiversx-sc-wasm-adapter" -version = "0.50.5" +version = "0.51.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "99a090365b4483b4ea955ba1322f986f6821be88144291f0013c03f59b4de753" +checksum = "b2f0d6be22f911ce45427491a9bec94612a1678eab2769dd08c9c9731d13da53" dependencies = [ "multiversx-sc", ] @@ -152,9 +152,9 @@ dependencies = [ [[package]] name = "proc-macro2" -version = "1.0.82" +version = "1.0.86" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8ad3d49ab951a01fbaafe34f2ec74122942fe18a3f9814c3268f1bb72042131b" +checksum = "5e719e8df665df0d1c8fbfd238015744736151d4445ec0836b8e628aae103b77" dependencies = [ "unicode-ident", ] @@ -193,9 +193,9 @@ checksum = "3c5e1a9a646d36c3599cd173a41282daf47c44583ad367b8e6837255952e5c67" [[package]] name = "syn" -version = "2.0.61" +version = "2.0.68" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c993ed8ccba56ae856363b1845da7266a7cb78e1d146c8a32d54b45a8b831fc9" +checksum = "901fa70d88b9d6c98022e23b4136f9f3e54e4662c3bc1bd1d84a42a9a0f0c1e9" dependencies = [ "proc-macro2", "quote", diff --git a/fee-market/wasm-fee-marker-full/Cargo.toml b/fee-market/wasm-fee-marker-full/Cargo.toml index 7858e0d7..e5dd8492 100644 --- a/fee-market/wasm-fee-marker-full/Cargo.toml +++ b/fee-market/wasm-fee-marker-full/Cargo.toml @@ -1,3 +1,9 @@ +# Code generated by the multiversx-sc build system. DO NOT EDIT. + +# ########################################## +# ############## AUTO-GENERATED ############# +# ########################################## + [package] name = "fee-marker-full-wasm" version = "0.0.0" diff --git a/fee-market/wasm-multisig-view/Cargo.lock b/fee-market/wasm-multisig-view/Cargo.lock index c25960a5..0daf4b2f 100644 --- a/fee-market/wasm-multisig-view/Cargo.lock +++ b/fee-market/wasm-multisig-view/Cargo.lock @@ -16,9 +16,9 @@ checksum = "0c4b4d0bd25bd0b74681c0ad21497610ce1b7c91b1022cd21c80c6fbdd9476b0" [[package]] name = "bitflags" -version = "2.5.0" +version = "2.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cf4b9d6a944f767f8e5e0db018570623c85f3d925ac718db4e06d0187adb21c1" +checksum = "b048fb63fd8b5923fc5aa7b340d8e156aec7ec02f0c78fa8a6ddc2613f6f71de" [[package]] name = "bls-signature" @@ -68,9 +68,9 @@ dependencies = [ [[package]] name = "multiversx-sc" -version = "0.50.5" +version = "0.51.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a38a802d6cfa67748145a9e729336f4e6390eba702b5f14360ed01fcff14faa4" +checksum = "236f7890b2208796df8b5ac73b8572ffaf5e2b1531c7ad549d669328b715b657" dependencies = [ "bitflags", "hex-literal", @@ -82,9 +82,9 @@ dependencies = [ [[package]] name = "multiversx-sc-codec" -version = "0.19.0" +version = "0.20.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "35c94397b2fba14e40edfa55905b3f453ed57aa06c9b1960ad6a0ca6bfb7a236" +checksum = "fcecd449ea708b72f92edaa17158fe4859c1780aed9b52b14de45f26124ccb8b" dependencies = [ "arrayvec", "multiversx-sc-codec-derive", @@ -93,9 +93,9 @@ dependencies = [ [[package]] name = "multiversx-sc-codec-derive" -version = "0.19.0" +version = "0.20.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cf72a8042da0bc19da0b8f0d4f61b4c66ae853560fefc69cd8fea87bf1aa8c14" +checksum = "68f7fa25402e5e8054d719951289306fd79e481f7c21b2565b5549b6bc359772" dependencies = [ "hex", "proc-macro2", @@ -105,9 +105,9 @@ dependencies = [ [[package]] name = "multiversx-sc-derive" -version = "0.50.5" +version = "0.51.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7dc53ddcbd71948d2e8d3d6b814da866e2920b24e6c0cbfa643922f781897476" +checksum = "eb683bc78d0e2eb43c16cac790144f53cc2ab27912aeb1484433895742ce698d" dependencies = [ "hex", "proc-macro2", @@ -118,9 +118,9 @@ dependencies = [ [[package]] name = "multiversx-sc-wasm-adapter" -version = "0.50.5" +version = "0.51.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "99a090365b4483b4ea955ba1322f986f6821be88144291f0013c03f59b4de753" +checksum = "b2f0d6be22f911ce45427491a9bec94612a1678eab2769dd08c9c9731d13da53" dependencies = [ "multiversx-sc", ] @@ -152,9 +152,9 @@ dependencies = [ [[package]] name = "proc-macro2" -version = "1.0.82" +version = "1.0.86" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8ad3d49ab951a01fbaafe34f2ec74122942fe18a3f9814c3268f1bb72042131b" +checksum = "5e719e8df665df0d1c8fbfd238015744736151d4445ec0836b8e628aae103b77" dependencies = [ "unicode-ident", ] @@ -193,9 +193,9 @@ checksum = "3c5e1a9a646d36c3599cd173a41282daf47c44583ad367b8e6837255952e5c67" [[package]] name = "syn" -version = "2.0.61" +version = "2.0.68" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c993ed8ccba56ae856363b1845da7266a7cb78e1d146c8a32d54b45a8b831fc9" +checksum = "901fa70d88b9d6c98022e23b4136f9f3e54e4662c3bc1bd1d84a42a9a0f0c1e9" dependencies = [ "proc-macro2", "quote", diff --git a/fee-market/wasm-multisig-view/Cargo.toml b/fee-market/wasm-multisig-view/Cargo.toml index fff8aaac..5b53275a 100644 --- a/fee-market/wasm-multisig-view/Cargo.toml +++ b/fee-market/wasm-multisig-view/Cargo.toml @@ -1,3 +1,9 @@ +# Code generated by the multiversx-sc build system. DO NOT EDIT. + +# ########################################## +# ############## AUTO-GENERATED ############# +# ########################################## + [package] name = "multisig-view-wasm" version = "0.0.0" diff --git a/fee-market/wasm/Cargo.lock b/fee-market/wasm/Cargo.lock index 80eabef7..473bedd6 100644 --- a/fee-market/wasm/Cargo.lock +++ b/fee-market/wasm/Cargo.lock @@ -16,9 +16,9 @@ checksum = "0c4b4d0bd25bd0b74681c0ad21497610ce1b7c91b1022cd21c80c6fbdd9476b0" [[package]] name = "bitflags" -version = "2.5.0" +version = "2.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cf4b9d6a944f767f8e5e0db018570623c85f3d925ac718db4e06d0187adb21c1" +checksum = "b048fb63fd8b5923fc5aa7b340d8e156aec7ec02f0c78fa8a6ddc2613f6f71de" [[package]] name = "bls-signature" @@ -68,9 +68,9 @@ checksum = "6fe2267d4ed49bc07b63801559be28c718ea06c4738b7a03c94df7386d2cde46" [[package]] name = "multiversx-sc" -version = "0.50.5" +version = "0.51.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a38a802d6cfa67748145a9e729336f4e6390eba702b5f14360ed01fcff14faa4" +checksum = "236f7890b2208796df8b5ac73b8572ffaf5e2b1531c7ad549d669328b715b657" dependencies = [ "bitflags", "hex-literal", @@ -82,9 +82,9 @@ dependencies = [ [[package]] name = "multiversx-sc-codec" -version = "0.19.0" +version = "0.20.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "35c94397b2fba14e40edfa55905b3f453ed57aa06c9b1960ad6a0ca6bfb7a236" +checksum = "fcecd449ea708b72f92edaa17158fe4859c1780aed9b52b14de45f26124ccb8b" dependencies = [ "arrayvec", "multiversx-sc-codec-derive", @@ -93,9 +93,9 @@ dependencies = [ [[package]] name = "multiversx-sc-codec-derive" -version = "0.19.0" +version = "0.20.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cf72a8042da0bc19da0b8f0d4f61b4c66ae853560fefc69cd8fea87bf1aa8c14" +checksum = "68f7fa25402e5e8054d719951289306fd79e481f7c21b2565b5549b6bc359772" dependencies = [ "hex", "proc-macro2", @@ -105,9 +105,9 @@ dependencies = [ [[package]] name = "multiversx-sc-derive" -version = "0.50.5" +version = "0.51.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7dc53ddcbd71948d2e8d3d6b814da866e2920b24e6c0cbfa643922f781897476" +checksum = "eb683bc78d0e2eb43c16cac790144f53cc2ab27912aeb1484433895742ce698d" dependencies = [ "hex", "proc-macro2", @@ -118,9 +118,9 @@ dependencies = [ [[package]] name = "multiversx-sc-wasm-adapter" -version = "0.50.5" +version = "0.51.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "99a090365b4483b4ea955ba1322f986f6821be88144291f0013c03f59b4de753" +checksum = "b2f0d6be22f911ce45427491a9bec94612a1678eab2769dd08c9c9731d13da53" dependencies = [ "multiversx-sc", ] @@ -152,9 +152,9 @@ dependencies = [ [[package]] name = "proc-macro2" -version = "1.0.82" +version = "1.0.86" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8ad3d49ab951a01fbaafe34f2ec74122942fe18a3f9814c3268f1bb72042131b" +checksum = "5e719e8df665df0d1c8fbfd238015744736151d4445ec0836b8e628aae103b77" dependencies = [ "unicode-ident", ] @@ -193,9 +193,9 @@ checksum = "3c5e1a9a646d36c3599cd173a41282daf47c44583ad367b8e6837255952e5c67" [[package]] name = "syn" -version = "2.0.61" +version = "2.0.68" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c993ed8ccba56ae856363b1845da7266a7cb78e1d146c8a32d54b45a8b831fc9" +checksum = "901fa70d88b9d6c98022e23b4136f9f3e54e4662c3bc1bd1d84a42a9a0f0c1e9" dependencies = [ "proc-macro2", "quote", diff --git a/fee-market/wasm/Cargo.toml b/fee-market/wasm/Cargo.toml index 3ce9604b..ef37bca1 100644 --- a/fee-market/wasm/Cargo.toml +++ b/fee-market/wasm/Cargo.toml @@ -1,3 +1,9 @@ +# Code generated by the multiversx-sc build system. DO NOT EDIT. + +# ########################################## +# ############## AUTO-GENERATED ############# +# ########################################## + [package] name = "fee-market-wasm" version = "0.0.0" diff --git a/header-verifier/wasm-header-verifier-full/Cargo.lock b/header-verifier/wasm-header-verifier-full/Cargo.lock index 914b6ae0..06de2fdf 100644 --- a/header-verifier/wasm-header-verifier-full/Cargo.lock +++ b/header-verifier/wasm-header-verifier-full/Cargo.lock @@ -16,9 +16,9 @@ checksum = "0c4b4d0bd25bd0b74681c0ad21497610ce1b7c91b1022cd21c80c6fbdd9476b0" [[package]] name = "bitflags" -version = "2.5.0" +version = "2.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cf4b9d6a944f767f8e5e0db018570623c85f3d925ac718db4e06d0187adb21c1" +checksum = "b048fb63fd8b5923fc5aa7b340d8e156aec7ec02f0c78fa8a6ddc2613f6f71de" [[package]] name = "bls-signature" @@ -65,9 +65,9 @@ checksum = "6fe2267d4ed49bc07b63801559be28c718ea06c4738b7a03c94df7386d2cde46" [[package]] name = "multiversx-sc" -version = "0.50.5" +version = "0.51.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a38a802d6cfa67748145a9e729336f4e6390eba702b5f14360ed01fcff14faa4" +checksum = "236f7890b2208796df8b5ac73b8572ffaf5e2b1531c7ad549d669328b715b657" dependencies = [ "bitflags", "hex-literal", @@ -79,9 +79,9 @@ dependencies = [ [[package]] name = "multiversx-sc-codec" -version = "0.19.0" +version = "0.20.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "35c94397b2fba14e40edfa55905b3f453ed57aa06c9b1960ad6a0ca6bfb7a236" +checksum = "fcecd449ea708b72f92edaa17158fe4859c1780aed9b52b14de45f26124ccb8b" dependencies = [ "arrayvec", "multiversx-sc-codec-derive", @@ -90,9 +90,9 @@ dependencies = [ [[package]] name = "multiversx-sc-codec-derive" -version = "0.19.0" +version = "0.20.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cf72a8042da0bc19da0b8f0d4f61b4c66ae853560fefc69cd8fea87bf1aa8c14" +checksum = "68f7fa25402e5e8054d719951289306fd79e481f7c21b2565b5549b6bc359772" dependencies = [ "hex", "proc-macro2", @@ -102,9 +102,9 @@ dependencies = [ [[package]] name = "multiversx-sc-derive" -version = "0.50.5" +version = "0.51.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7dc53ddcbd71948d2e8d3d6b814da866e2920b24e6c0cbfa643922f781897476" +checksum = "eb683bc78d0e2eb43c16cac790144f53cc2ab27912aeb1484433895742ce698d" dependencies = [ "hex", "proc-macro2", @@ -115,9 +115,9 @@ dependencies = [ [[package]] name = "multiversx-sc-wasm-adapter" -version = "0.50.5" +version = "0.51.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "99a090365b4483b4ea955ba1322f986f6821be88144291f0013c03f59b4de753" +checksum = "b2f0d6be22f911ce45427491a9bec94612a1678eab2769dd08c9c9731d13da53" dependencies = [ "multiversx-sc", ] @@ -142,9 +142,9 @@ dependencies = [ [[package]] name = "proc-macro2" -version = "1.0.82" +version = "1.0.86" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8ad3d49ab951a01fbaafe34f2ec74122942fe18a3f9814c3268f1bb72042131b" +checksum = "5e719e8df665df0d1c8fbfd238015744736151d4445ec0836b8e628aae103b77" dependencies = [ "unicode-ident", ] @@ -176,9 +176,9 @@ checksum = "3c5e1a9a646d36c3599cd173a41282daf47c44583ad367b8e6837255952e5c67" [[package]] name = "syn" -version = "2.0.61" +version = "2.0.68" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c993ed8ccba56ae856363b1845da7266a7cb78e1d146c8a32d54b45a8b831fc9" +checksum = "901fa70d88b9d6c98022e23b4136f9f3e54e4662c3bc1bd1d84a42a9a0f0c1e9" dependencies = [ "proc-macro2", "quote", diff --git a/header-verifier/wasm-header-verifier-full/Cargo.toml b/header-verifier/wasm-header-verifier-full/Cargo.toml index e12804c3..58458b66 100644 --- a/header-verifier/wasm-header-verifier-full/Cargo.toml +++ b/header-verifier/wasm-header-verifier-full/Cargo.toml @@ -1,3 +1,9 @@ +# Code generated by the multiversx-sc build system. DO NOT EDIT. + +# ########################################## +# ############## AUTO-GENERATED ############# +# ########################################## + [package] name = "header-verifier-full-wasm" version = "0.0.0" diff --git a/header-verifier/wasm-multisig-view/Cargo.lock b/header-verifier/wasm-multisig-view/Cargo.lock index b5ef0ce7..71231a21 100644 --- a/header-verifier/wasm-multisig-view/Cargo.lock +++ b/header-verifier/wasm-multisig-view/Cargo.lock @@ -16,9 +16,9 @@ checksum = "0c4b4d0bd25bd0b74681c0ad21497610ce1b7c91b1022cd21c80c6fbdd9476b0" [[package]] name = "bitflags" -version = "2.5.0" +version = "2.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cf4b9d6a944f767f8e5e0db018570623c85f3d925ac718db4e06d0187adb21c1" +checksum = "b048fb63fd8b5923fc5aa7b340d8e156aec7ec02f0c78fa8a6ddc2613f6f71de" [[package]] name = "bls-signature" @@ -65,9 +65,9 @@ dependencies = [ [[package]] name = "multiversx-sc" -version = "0.50.5" +version = "0.51.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a38a802d6cfa67748145a9e729336f4e6390eba702b5f14360ed01fcff14faa4" +checksum = "236f7890b2208796df8b5ac73b8572ffaf5e2b1531c7ad549d669328b715b657" dependencies = [ "bitflags", "hex-literal", @@ -79,9 +79,9 @@ dependencies = [ [[package]] name = "multiversx-sc-codec" -version = "0.19.0" +version = "0.20.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "35c94397b2fba14e40edfa55905b3f453ed57aa06c9b1960ad6a0ca6bfb7a236" +checksum = "fcecd449ea708b72f92edaa17158fe4859c1780aed9b52b14de45f26124ccb8b" dependencies = [ "arrayvec", "multiversx-sc-codec-derive", @@ -90,9 +90,9 @@ dependencies = [ [[package]] name = "multiversx-sc-codec-derive" -version = "0.19.0" +version = "0.20.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cf72a8042da0bc19da0b8f0d4f61b4c66ae853560fefc69cd8fea87bf1aa8c14" +checksum = "68f7fa25402e5e8054d719951289306fd79e481f7c21b2565b5549b6bc359772" dependencies = [ "hex", "proc-macro2", @@ -102,9 +102,9 @@ dependencies = [ [[package]] name = "multiversx-sc-derive" -version = "0.50.5" +version = "0.51.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7dc53ddcbd71948d2e8d3d6b814da866e2920b24e6c0cbfa643922f781897476" +checksum = "eb683bc78d0e2eb43c16cac790144f53cc2ab27912aeb1484433895742ce698d" dependencies = [ "hex", "proc-macro2", @@ -115,9 +115,9 @@ dependencies = [ [[package]] name = "multiversx-sc-wasm-adapter" -version = "0.50.5" +version = "0.51.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "99a090365b4483b4ea955ba1322f986f6821be88144291f0013c03f59b4de753" +checksum = "b2f0d6be22f911ce45427491a9bec94612a1678eab2769dd08c9c9731d13da53" dependencies = [ "multiversx-sc", ] @@ -142,9 +142,9 @@ dependencies = [ [[package]] name = "proc-macro2" -version = "1.0.82" +version = "1.0.86" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8ad3d49ab951a01fbaafe34f2ec74122942fe18a3f9814c3268f1bb72042131b" +checksum = "5e719e8df665df0d1c8fbfd238015744736151d4445ec0836b8e628aae103b77" dependencies = [ "unicode-ident", ] @@ -176,9 +176,9 @@ checksum = "3c5e1a9a646d36c3599cd173a41282daf47c44583ad367b8e6837255952e5c67" [[package]] name = "syn" -version = "2.0.61" +version = "2.0.68" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c993ed8ccba56ae856363b1845da7266a7cb78e1d146c8a32d54b45a8b831fc9" +checksum = "901fa70d88b9d6c98022e23b4136f9f3e54e4662c3bc1bd1d84a42a9a0f0c1e9" dependencies = [ "proc-macro2", "quote", diff --git a/header-verifier/wasm-multisig-view/Cargo.toml b/header-verifier/wasm-multisig-view/Cargo.toml index 5753d4c6..ae13b76d 100644 --- a/header-verifier/wasm-multisig-view/Cargo.toml +++ b/header-verifier/wasm-multisig-view/Cargo.toml @@ -1,3 +1,9 @@ +# Code generated by the multiversx-sc build system. DO NOT EDIT. + +# ########################################## +# ############## AUTO-GENERATED ############# +# ########################################## + [package] name = "multisig-view-wasm" version = "0.0.0" diff --git a/header-verifier/wasm/Cargo.lock b/header-verifier/wasm/Cargo.lock index 2c43d602..3f7bdd6b 100644 --- a/header-verifier/wasm/Cargo.lock +++ b/header-verifier/wasm/Cargo.lock @@ -16,9 +16,9 @@ checksum = "0c4b4d0bd25bd0b74681c0ad21497610ce1b7c91b1022cd21c80c6fbdd9476b0" [[package]] name = "bitflags" -version = "2.5.0" +version = "2.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cf4b9d6a944f767f8e5e0db018570623c85f3d925ac718db4e06d0187adb21c1" +checksum = "b048fb63fd8b5923fc5aa7b340d8e156aec7ec02f0c78fa8a6ddc2613f6f71de" [[package]] name = "bls-signature" @@ -65,9 +65,9 @@ checksum = "6fe2267d4ed49bc07b63801559be28c718ea06c4738b7a03c94df7386d2cde46" [[package]] name = "multiversx-sc" -version = "0.50.5" +version = "0.51.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a38a802d6cfa67748145a9e729336f4e6390eba702b5f14360ed01fcff14faa4" +checksum = "236f7890b2208796df8b5ac73b8572ffaf5e2b1531c7ad549d669328b715b657" dependencies = [ "bitflags", "hex-literal", @@ -79,9 +79,9 @@ dependencies = [ [[package]] name = "multiversx-sc-codec" -version = "0.19.0" +version = "0.20.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "35c94397b2fba14e40edfa55905b3f453ed57aa06c9b1960ad6a0ca6bfb7a236" +checksum = "fcecd449ea708b72f92edaa17158fe4859c1780aed9b52b14de45f26124ccb8b" dependencies = [ "arrayvec", "multiversx-sc-codec-derive", @@ -90,9 +90,9 @@ dependencies = [ [[package]] name = "multiversx-sc-codec-derive" -version = "0.19.0" +version = "0.20.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cf72a8042da0bc19da0b8f0d4f61b4c66ae853560fefc69cd8fea87bf1aa8c14" +checksum = "68f7fa25402e5e8054d719951289306fd79e481f7c21b2565b5549b6bc359772" dependencies = [ "hex", "proc-macro2", @@ -102,9 +102,9 @@ dependencies = [ [[package]] name = "multiversx-sc-derive" -version = "0.50.5" +version = "0.51.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7dc53ddcbd71948d2e8d3d6b814da866e2920b24e6c0cbfa643922f781897476" +checksum = "eb683bc78d0e2eb43c16cac790144f53cc2ab27912aeb1484433895742ce698d" dependencies = [ "hex", "proc-macro2", @@ -115,9 +115,9 @@ dependencies = [ [[package]] name = "multiversx-sc-wasm-adapter" -version = "0.50.5" +version = "0.51.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "99a090365b4483b4ea955ba1322f986f6821be88144291f0013c03f59b4de753" +checksum = "b2f0d6be22f911ce45427491a9bec94612a1678eab2769dd08c9c9731d13da53" dependencies = [ "multiversx-sc", ] @@ -142,9 +142,9 @@ dependencies = [ [[package]] name = "proc-macro2" -version = "1.0.82" +version = "1.0.86" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8ad3d49ab951a01fbaafe34f2ec74122942fe18a3f9814c3268f1bb72042131b" +checksum = "5e719e8df665df0d1c8fbfd238015744736151d4445ec0836b8e628aae103b77" dependencies = [ "unicode-ident", ] @@ -176,9 +176,9 @@ checksum = "3c5e1a9a646d36c3599cd173a41282daf47c44583ad367b8e6837255952e5c67" [[package]] name = "syn" -version = "2.0.61" +version = "2.0.68" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c993ed8ccba56ae856363b1845da7266a7cb78e1d146c8a32d54b45a8b831fc9" +checksum = "901fa70d88b9d6c98022e23b4136f9f3e54e4662c3bc1bd1d84a42a9a0f0c1e9" dependencies = [ "proc-macro2", "quote", diff --git a/header-verifier/wasm/Cargo.toml b/header-verifier/wasm/Cargo.toml index e7591c58..769535b3 100644 --- a/header-verifier/wasm/Cargo.toml +++ b/header-verifier/wasm/Cargo.toml @@ -1,3 +1,9 @@ +# Code generated by the multiversx-sc build system. DO NOT EDIT. + +# ########################################## +# ############## AUTO-GENERATED ############# +# ########################################## + [package] name = "header-verifier-wasm" version = "0.0.0" diff --git a/pair-mock/wasm/Cargo.lock b/pair-mock/wasm/Cargo.lock index 7356f310..c30e0685 100644 --- a/pair-mock/wasm/Cargo.lock +++ b/pair-mock/wasm/Cargo.lock @@ -16,9 +16,9 @@ checksum = "0c4b4d0bd25bd0b74681c0ad21497610ce1b7c91b1022cd21c80c6fbdd9476b0" [[package]] name = "bitflags" -version = "2.5.0" +version = "2.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cf4b9d6a944f767f8e5e0db018570623c85f3d925ac718db4e06d0187adb21c1" +checksum = "b048fb63fd8b5923fc5aa7b340d8e156aec7ec02f0c78fa8a6ddc2613f6f71de" [[package]] name = "endian-type" @@ -40,9 +40,9 @@ checksum = "6fe2267d4ed49bc07b63801559be28c718ea06c4738b7a03c94df7386d2cde46" [[package]] name = "multiversx-sc" -version = "0.50.5" +version = "0.51.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a38a802d6cfa67748145a9e729336f4e6390eba702b5f14360ed01fcff14faa4" +checksum = "236f7890b2208796df8b5ac73b8572ffaf5e2b1531c7ad549d669328b715b657" dependencies = [ "bitflags", "hex-literal", @@ -54,9 +54,9 @@ dependencies = [ [[package]] name = "multiversx-sc-codec" -version = "0.19.0" +version = "0.20.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "35c94397b2fba14e40edfa55905b3f453ed57aa06c9b1960ad6a0ca6bfb7a236" +checksum = "fcecd449ea708b72f92edaa17158fe4859c1780aed9b52b14de45f26124ccb8b" dependencies = [ "arrayvec", "multiversx-sc-codec-derive", @@ -65,9 +65,9 @@ dependencies = [ [[package]] name = "multiversx-sc-codec-derive" -version = "0.19.0" +version = "0.20.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cf72a8042da0bc19da0b8f0d4f61b4c66ae853560fefc69cd8fea87bf1aa8c14" +checksum = "68f7fa25402e5e8054d719951289306fd79e481f7c21b2565b5549b6bc359772" dependencies = [ "hex", "proc-macro2", @@ -77,9 +77,9 @@ dependencies = [ [[package]] name = "multiversx-sc-derive" -version = "0.50.5" +version = "0.51.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7dc53ddcbd71948d2e8d3d6b814da866e2920b24e6c0cbfa643922f781897476" +checksum = "eb683bc78d0e2eb43c16cac790144f53cc2ab27912aeb1484433895742ce698d" dependencies = [ "hex", "proc-macro2", @@ -90,9 +90,9 @@ dependencies = [ [[package]] name = "multiversx-sc-wasm-adapter" -version = "0.50.5" +version = "0.51.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "99a090365b4483b4ea955ba1322f986f6821be88144291f0013c03f59b4de753" +checksum = "b2f0d6be22f911ce45427491a9bec94612a1678eab2769dd08c9c9731d13da53" dependencies = [ "multiversx-sc", ] @@ -132,9 +132,9 @@ dependencies = [ [[package]] name = "proc-macro2" -version = "1.0.82" +version = "1.0.86" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8ad3d49ab951a01fbaafe34f2ec74122942fe18a3f9814c3268f1bb72042131b" +checksum = "5e719e8df665df0d1c8fbfd238015744736151d4445ec0836b8e628aae103b77" dependencies = [ "unicode-ident", ] @@ -166,9 +166,9 @@ checksum = "3c5e1a9a646d36c3599cd173a41282daf47c44583ad367b8e6837255952e5c67" [[package]] name = "syn" -version = "2.0.61" +version = "2.0.68" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c993ed8ccba56ae856363b1845da7266a7cb78e1d146c8a32d54b45a8b831fc9" +checksum = "901fa70d88b9d6c98022e23b4136f9f3e54e4662c3bc1bd1d84a42a9a0f0c1e9" dependencies = [ "proc-macro2", "quote", diff --git a/pair-mock/wasm/Cargo.toml b/pair-mock/wasm/Cargo.toml index b33fc78c..7311470b 100644 --- a/pair-mock/wasm/Cargo.toml +++ b/pair-mock/wasm/Cargo.toml @@ -1,3 +1,9 @@ +# Code generated by the multiversx-sc build system. DO NOT EDIT. + +# ########################################## +# ############## AUTO-GENERATED ############# +# ########################################## + [package] name = "pair-mock-wasm" version = "0.0.0" diff --git a/router-mock/wasm/Cargo.lock b/router-mock/wasm/Cargo.lock index 55201fa8..b3023fdc 100644 --- a/router-mock/wasm/Cargo.lock +++ b/router-mock/wasm/Cargo.lock @@ -16,9 +16,9 @@ checksum = "0c4b4d0bd25bd0b74681c0ad21497610ce1b7c91b1022cd21c80c6fbdd9476b0" [[package]] name = "bitflags" -version = "2.5.0" +version = "2.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cf4b9d6a944f767f8e5e0db018570623c85f3d925ac718db4e06d0187adb21c1" +checksum = "b048fb63fd8b5923fc5aa7b340d8e156aec7ec02f0c78fa8a6ddc2613f6f71de" [[package]] name = "endian-type" @@ -40,9 +40,9 @@ checksum = "6fe2267d4ed49bc07b63801559be28c718ea06c4738b7a03c94df7386d2cde46" [[package]] name = "multiversx-sc" -version = "0.50.5" +version = "0.51.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a38a802d6cfa67748145a9e729336f4e6390eba702b5f14360ed01fcff14faa4" +checksum = "236f7890b2208796df8b5ac73b8572ffaf5e2b1531c7ad549d669328b715b657" dependencies = [ "bitflags", "hex-literal", @@ -54,9 +54,9 @@ dependencies = [ [[package]] name = "multiversx-sc-codec" -version = "0.19.0" +version = "0.20.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "35c94397b2fba14e40edfa55905b3f453ed57aa06c9b1960ad6a0ca6bfb7a236" +checksum = "fcecd449ea708b72f92edaa17158fe4859c1780aed9b52b14de45f26124ccb8b" dependencies = [ "arrayvec", "multiversx-sc-codec-derive", @@ -65,9 +65,9 @@ dependencies = [ [[package]] name = "multiversx-sc-codec-derive" -version = "0.19.0" +version = "0.20.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cf72a8042da0bc19da0b8f0d4f61b4c66ae853560fefc69cd8fea87bf1aa8c14" +checksum = "68f7fa25402e5e8054d719951289306fd79e481f7c21b2565b5549b6bc359772" dependencies = [ "hex", "proc-macro2", @@ -77,9 +77,9 @@ dependencies = [ [[package]] name = "multiversx-sc-derive" -version = "0.50.5" +version = "0.51.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7dc53ddcbd71948d2e8d3d6b814da866e2920b24e6c0cbfa643922f781897476" +checksum = "eb683bc78d0e2eb43c16cac790144f53cc2ab27912aeb1484433895742ce698d" dependencies = [ "hex", "proc-macro2", @@ -90,9 +90,9 @@ dependencies = [ [[package]] name = "multiversx-sc-wasm-adapter" -version = "0.50.5" +version = "0.51.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "99a090365b4483b4ea955ba1322f986f6821be88144291f0013c03f59b4de753" +checksum = "b2f0d6be22f911ce45427491a9bec94612a1678eab2769dd08c9c9731d13da53" dependencies = [ "multiversx-sc", ] @@ -117,9 +117,9 @@ dependencies = [ [[package]] name = "proc-macro2" -version = "1.0.82" +version = "1.0.86" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8ad3d49ab951a01fbaafe34f2ec74122942fe18a3f9814c3268f1bb72042131b" +checksum = "5e719e8df665df0d1c8fbfd238015744736151d4445ec0836b8e628aae103b77" dependencies = [ "unicode-ident", ] @@ -166,9 +166,9 @@ checksum = "3c5e1a9a646d36c3599cd173a41282daf47c44583ad367b8e6837255952e5c67" [[package]] name = "syn" -version = "2.0.61" +version = "2.0.68" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c993ed8ccba56ae856363b1845da7266a7cb78e1d146c8a32d54b45a8b831fc9" +checksum = "901fa70d88b9d6c98022e23b4136f9f3e54e4662c3bc1bd1d84a42a9a0f0c1e9" dependencies = [ "proc-macro2", "quote", diff --git a/router-mock/wasm/Cargo.toml b/router-mock/wasm/Cargo.toml index 32659180..32eee391 100644 --- a/router-mock/wasm/Cargo.toml +++ b/router-mock/wasm/Cargo.toml @@ -1,3 +1,9 @@ +# Code generated by the multiversx-sc build system. DO NOT EDIT. + +# ########################################## +# ############## AUTO-GENERATED ############# +# ########################################## + [package] name = "router-mock-wasm" version = "0.0.0" From a4041282fc97898c4027bf6d379c93f972c4b729 Mon Sep 17 00:00:00 2001 From: Andrei Baltariu Date: Mon, 8 Jul 2024 17:29:18 +0300 Subject: [PATCH 119/523] Fixed deploy test --- .../tests/enshrine_esdt_safe_blackbox_test.rs | 20 +++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/enshrine-esdt-safe/tests/enshrine_esdt_safe_blackbox_test.rs b/enshrine-esdt-safe/tests/enshrine_esdt_safe_blackbox_test.rs index 4ddf09b5..3bed32ed 100644 --- a/enshrine-esdt-safe/tests/enshrine_esdt_safe_blackbox_test.rs +++ b/enshrine-esdt-safe/tests/enshrine_esdt_safe_blackbox_test.rs @@ -4,7 +4,7 @@ use header_verifier::header_verifier_proxy; use multiversx_sc::codec::TopEncode; use multiversx_sc::types::{ Address, ManagedBuffer, ManagedByteArray, ManagedVec, MultiValueEncoded, TestAddress, - TestSCAddress, TestTokenIdentifier, + TestSCAddress, TestTokenIdentifier, TokenIdentifier, }; use multiversx_sc_scenario::api::StaticApi; use multiversx_sc_scenario::multiversx_chain_vm::crypto_functions::sha256; @@ -32,6 +32,9 @@ const NFT_TOKEN_ID: TestTokenIdentifier = TestTokenIdentifier::new("NFT-123456") const FUNGIBLE_TOKEN_ID: TestTokenIdentifier = TestTokenIdentifier::new("CROWD-123456"); const PREFIX_NFT_TOKEN_ID: TestTokenIdentifier = TestTokenIdentifier::new("sov-NFT-123456"); +const WEGLD_IDENTIFIER: TestTokenIdentifier = TestTokenIdentifier::new("WEGLD-123456"); +const SOVEREIGN_TOKEN_PREFIX: &str = "sov-"; + fn world() -> ScenarioWorld { let mut blockchain = ScenarioWorld::new(); @@ -68,12 +71,17 @@ impl EnshrineTestState { Self { world } } - fn deploy_enshrine_esdt_contract(&mut self, is_sovereign_chain: bool) -> &mut Self { + fn deploy_enshrine_esdt_contract( + &mut self, + is_sovereign_chain: bool, + wegld_identifier: Option>, + sovereign_token_prefix: Option>, + ) -> &mut Self { self.world .tx() .from(ENSHRINE_ESDT_OWNER_ADDRESS) .typed(enshrine_esdt_safe_proxy::EnshrineEsdtSafeProxy) - .init(is_sovereign_chain) + .init(is_sovereign_chain, wegld_identifier, sovereign_token_prefix) .code(ENSHRINE_ESDT_CODE_PATH) .new_address(ENSHRINE_ESDT_ADDRESS) .run(); @@ -101,7 +109,11 @@ impl EnshrineTestState { } fn propose_setup_contracts(&mut self, is_sovereign_chain: bool) -> &mut Self { - self.deploy_enshrine_esdt_contract(is_sovereign_chain); + self.deploy_enshrine_esdt_contract( + is_sovereign_chain, + Some(WEGLD_IDENTIFIER.into()), + Some(SOVEREIGN_TOKEN_PREFIX.into()), + ); self.deploy_header_verifier_contract(); self.propose_set_header_verifier_address(); From db647b9145089fed5da4f976a1be5924b748b66f Mon Sep 17 00:00:00 2001 From: Andrei Baltariu Date: Tue, 9 Jul 2024 10:27:02 +0300 Subject: [PATCH 120/523] Removed sc_panic and added return --- enshrine-esdt-safe/src/from_sovereign/transfer_tokens.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/enshrine-esdt-safe/src/from_sovereign/transfer_tokens.rs b/enshrine-esdt-safe/src/from_sovereign/transfer_tokens.rs index 476e1249..c31144b7 100644 --- a/enshrine-esdt-safe/src/from_sovereign/transfer_tokens.rs +++ b/enshrine-esdt-safe/src/from_sovereign/transfer_tokens.rs @@ -51,7 +51,7 @@ pub trait TransferTokensModule: }, ); - sc_panic!("One or more tokens are not registered"); + return; } let minted_operation_tokens = self.mint_tokens(&operation.tokens); From a8ddcc8c02c96295915000b689d349359a561300 Mon Sep 17 00:00:00 2001 From: Andrei Baltariu Date: Tue, 9 Jul 2024 15:16:58 +0300 Subject: [PATCH 121/523] Modified tokens wegld registration and removed function --- .../src/from_sovereign/transfer_tokens.rs | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/enshrine-esdt-safe/src/from_sovereign/transfer_tokens.rs b/enshrine-esdt-safe/src/from_sovereign/transfer_tokens.rs index c31144b7..30bf4715 100644 --- a/enshrine-esdt-safe/src/from_sovereign/transfer_tokens.rs +++ b/enshrine-esdt-safe/src/from_sovereign/transfer_tokens.rs @@ -92,8 +92,14 @@ pub trait TransferTokensModule: &self, tokens: ManagedVec>, ) -> bool { + let sovereign_prefix = self.get_sovereign_prefix(); + for token in tokens.iter() { - if !self.was_token_registered(&token.token_identifier) { + if !self.has_sov_prefix(&token.token_identifier, sovereign_prefix) { + continue; + } + + if !self.paid_issued_tokens().contains(&token.token_identifier) { return false; } } @@ -332,12 +338,6 @@ pub trait TransferTokensModule: } } - #[inline] - fn was_token_registered(&self, token_id: &TokenIdentifier) -> bool { - self.has_sov_prefix(token_id, self.get_sovereign_prefix()) - && self.paid_issued_tokens().contains(token_id) - } - #[inline] fn get_sovereign_prefix(&self) -> ManagedBuffer { self.sovereign_tokens_prefix().get() From 5882849a4df453d4b4f7714d1d9adfebf35ae818 Mon Sep 17 00:00:00 2001 From: Andrei Baltariu Date: Tue, 9 Jul 2024 15:21:26 +0300 Subject: [PATCH 122/523] Modified get_sovereign_prefix call --- enshrine-esdt-safe/src/from_sovereign/transfer_tokens.rs | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/enshrine-esdt-safe/src/from_sovereign/transfer_tokens.rs b/enshrine-esdt-safe/src/from_sovereign/transfer_tokens.rs index 30bf4715..df28fad1 100644 --- a/enshrine-esdt-safe/src/from_sovereign/transfer_tokens.rs +++ b/enshrine-esdt-safe/src/from_sovereign/transfer_tokens.rs @@ -92,10 +92,8 @@ pub trait TransferTokensModule: &self, tokens: ManagedVec>, ) -> bool { - let sovereign_prefix = self.get_sovereign_prefix(); - for token in tokens.iter() { - if !self.has_sov_prefix(&token.token_identifier, sovereign_prefix) { + if !self.has_sov_prefix(&token.token_identifier, self.get_sovereign_prefix()) { continue; } From d614640bc413e9541776b255bc49d6cd90d82ceb Mon Sep 17 00:00:00 2001 From: Andrei Baltariu Date: Mon, 8 Jul 2024 17:29:18 +0300 Subject: [PATCH 123/523] Fixed deploy test --- .../tests/enshrine_esdt_safe_blackbox_test.rs | 20 +++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/enshrine-esdt-safe/tests/enshrine_esdt_safe_blackbox_test.rs b/enshrine-esdt-safe/tests/enshrine_esdt_safe_blackbox_test.rs index 4ddf09b5..3bed32ed 100644 --- a/enshrine-esdt-safe/tests/enshrine_esdt_safe_blackbox_test.rs +++ b/enshrine-esdt-safe/tests/enshrine_esdt_safe_blackbox_test.rs @@ -4,7 +4,7 @@ use header_verifier::header_verifier_proxy; use multiversx_sc::codec::TopEncode; use multiversx_sc::types::{ Address, ManagedBuffer, ManagedByteArray, ManagedVec, MultiValueEncoded, TestAddress, - TestSCAddress, TestTokenIdentifier, + TestSCAddress, TestTokenIdentifier, TokenIdentifier, }; use multiversx_sc_scenario::api::StaticApi; use multiversx_sc_scenario::multiversx_chain_vm::crypto_functions::sha256; @@ -32,6 +32,9 @@ const NFT_TOKEN_ID: TestTokenIdentifier = TestTokenIdentifier::new("NFT-123456") const FUNGIBLE_TOKEN_ID: TestTokenIdentifier = TestTokenIdentifier::new("CROWD-123456"); const PREFIX_NFT_TOKEN_ID: TestTokenIdentifier = TestTokenIdentifier::new("sov-NFT-123456"); +const WEGLD_IDENTIFIER: TestTokenIdentifier = TestTokenIdentifier::new("WEGLD-123456"); +const SOVEREIGN_TOKEN_PREFIX: &str = "sov-"; + fn world() -> ScenarioWorld { let mut blockchain = ScenarioWorld::new(); @@ -68,12 +71,17 @@ impl EnshrineTestState { Self { world } } - fn deploy_enshrine_esdt_contract(&mut self, is_sovereign_chain: bool) -> &mut Self { + fn deploy_enshrine_esdt_contract( + &mut self, + is_sovereign_chain: bool, + wegld_identifier: Option>, + sovereign_token_prefix: Option>, + ) -> &mut Self { self.world .tx() .from(ENSHRINE_ESDT_OWNER_ADDRESS) .typed(enshrine_esdt_safe_proxy::EnshrineEsdtSafeProxy) - .init(is_sovereign_chain) + .init(is_sovereign_chain, wegld_identifier, sovereign_token_prefix) .code(ENSHRINE_ESDT_CODE_PATH) .new_address(ENSHRINE_ESDT_ADDRESS) .run(); @@ -101,7 +109,11 @@ impl EnshrineTestState { } fn propose_setup_contracts(&mut self, is_sovereign_chain: bool) -> &mut Self { - self.deploy_enshrine_esdt_contract(is_sovereign_chain); + self.deploy_enshrine_esdt_contract( + is_sovereign_chain, + Some(WEGLD_IDENTIFIER.into()), + Some(SOVEREIGN_TOKEN_PREFIX.into()), + ); self.deploy_header_verifier_contract(); self.propose_set_header_verifier_address(); From 26d9a55b470a721e04a7413c639770e98ad16b34 Mon Sep 17 00:00:00 2001 From: Andrei Baltariu Date: Wed, 10 Jul 2024 09:24:56 +0300 Subject: [PATCH 124/523] Modified init call --- enshrine-esdt-safe/tests/enshrine_esdt_safe_blackbox_test.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/enshrine-esdt-safe/tests/enshrine_esdt_safe_blackbox_test.rs b/enshrine-esdt-safe/tests/enshrine_esdt_safe_blackbox_test.rs index 3bed32ed..ad34b025 100644 --- a/enshrine-esdt-safe/tests/enshrine_esdt_safe_blackbox_test.rs +++ b/enshrine-esdt-safe/tests/enshrine_esdt_safe_blackbox_test.rs @@ -111,7 +111,7 @@ impl EnshrineTestState { fn propose_setup_contracts(&mut self, is_sovereign_chain: bool) -> &mut Self { self.deploy_enshrine_esdt_contract( is_sovereign_chain, - Some(WEGLD_IDENTIFIER.into()), + Some(TokenIdentifier::from(WEGLD_IDENTIFIER)), Some(SOVEREIGN_TOKEN_PREFIX.into()), ); self.deploy_header_verifier_contract(); From 6aef775cb4173c2917b80fa264a0354bb4b51000 Mon Sep 17 00:00:00 2001 From: Andrei Baltariu Date: Wed, 10 Jul 2024 09:27:15 +0300 Subject: [PATCH 125/523] Removed require and added if --- common/utils/src/lib.rs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/common/utils/src/lib.rs b/common/utils/src/lib.rs index 5432834d..e8a318f9 100644 --- a/common/utils/src/lib.rs +++ b/common/utils/src/lib.rs @@ -82,7 +82,9 @@ pub trait UtilsModule: bls_signature::BlsSignatureModule { } fn has_sov_prefix(&self, token_id: &TokenIdentifier, chain_prefix: ManagedBuffer) -> bool { - require!(self.has_prefix(token_id), "Token does not have prefix"); + if !self.has_prefix(token_id) { + return false; + } let dash = b'-'; let buffer = token_id.as_managed_buffer(); From 7ca2f498e07823add740d19e334d63a238f4fa6e Mon Sep 17 00:00:00 2001 From: Andrei Baltariu Date: Wed, 10 Jul 2024 13:46:30 +0300 Subject: [PATCH 126/523] Modified tests to not fail --- enshrine-esdt-safe/tests/enshrine_esdt_safe_blackbox_test.rs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/enshrine-esdt-safe/tests/enshrine_esdt_safe_blackbox_test.rs b/enshrine-esdt-safe/tests/enshrine_esdt_safe_blackbox_test.rs index ad34b025..726a88fd 100644 --- a/enshrine-esdt-safe/tests/enshrine_esdt_safe_blackbox_test.rs +++ b/enshrine-esdt-safe/tests/enshrine_esdt_safe_blackbox_test.rs @@ -273,9 +273,8 @@ fn test_sovereign_prefix_no_prefix() { #[test] fn test_sovereign_prefix_has_prefix() { let mut state = EnshrineTestState::new(); - let error_message = "action is not allowed"; state.propose_setup_contracts(false); state.propose_register_operation(true); - state.propose_execute_operation(true, Some(error_message)); + state.propose_execute_operation(true, None); } From 1a115a7b534fd80d4d6d64a3ebf11dcc5a575e42 Mon Sep 17 00:00:00 2001 From: Andrei Baltariu Date: Wed, 10 Jul 2024 19:44:51 +0300 Subject: [PATCH 127/523] Added propose function for registering tokens --- .../tests/enshrine_esdt_safe_blackbox_test.rs | 25 +++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/enshrine-esdt-safe/tests/enshrine_esdt_safe_blackbox_test.rs b/enshrine-esdt-safe/tests/enshrine_esdt_safe_blackbox_test.rs index 726a88fd..c7197af0 100644 --- a/enshrine-esdt-safe/tests/enshrine_esdt_safe_blackbox_test.rs +++ b/enshrine-esdt-safe/tests/enshrine_esdt_safe_blackbox_test.rs @@ -205,6 +205,24 @@ impl EnshrineTestState { .run(); } + fn propose_register_tokens(&mut self, token_ids: Vec) { + let mut managed_token_ids: MultiValueEncoded> = + MultiValueEncoded::new(); + for token_id in token_ids { + managed_token_ids.push(TokenIdentifier::from(token_id)) + } + + self.world + .tx() + .from(ENSHRINE_ESDT_OWNER_ADDRESS) + .to(ENSHRINE_ESDT_ADDRESS) + .typed(enshrine_esdt_safe_proxy::EnshrineEsdtSafeProxy) + .register_new_token_id(managed_token_ids) + .run(); + } + + fn check_registered_tokens(&mut self) {} + fn mock_bls_signature( &mut self, operation_hash: &ManagedBuffer, @@ -278,3 +296,10 @@ fn test_sovereign_prefix_has_prefix() { state.propose_register_operation(true); state.propose_execute_operation(true, None); } + +#[test] +fn test_register_tokens() { + let mut state = EnshrineTestState::new(); + + state.propose_setup_contracts(false); +} From f660493b807fa47cf4ad4ff19cc5ef0dc1497f5a Mon Sep 17 00:00:00 2001 From: Andrei Baltariu Date: Thu, 11 Jul 2024 10:46:30 +0300 Subject: [PATCH 128/523] Added constants for prefix checks --- common/utils/src/lib.rs | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/common/utils/src/lib.rs b/common/utils/src/lib.rs index e8a318f9..4f53c016 100644 --- a/common/utils/src/lib.rs +++ b/common/utils/src/lib.rs @@ -7,6 +7,8 @@ multiversx_sc::imports!(); pub type PaymentsVec = ManagedVec>; static ERR_EMPTY_PAYMENTS: &[u8] = b"No payments"; +const DASH: u8 = b'-'; +const MAX_TOKEN_ID_LEN: usize = 32; #[multiversx_sc::module] pub trait UtilsModule: bls_signature::BlsSignatureModule { @@ -67,12 +69,11 @@ pub trait UtilsModule: bls_signature::BlsSignatureModule { } fn has_prefix(&self, token_id: &TokenIdentifier) -> bool { - let dash = b'-'; let buffer = token_id.as_managed_buffer(); - let mut array_buffer = [0u8; 32]; + let mut array_buffer = [0u8; MAX_TOKEN_ID_LEN]; let slice = buffer.load_to_byte_array(&mut array_buffer); - let counter = slice.iter().filter(|&&c| c == dash).count(); + let counter = slice.iter().filter(|&&c| c == DASH).count(); if counter == 2 { return true; @@ -86,12 +87,11 @@ pub trait UtilsModule: bls_signature::BlsSignatureModule { return false; } - let dash = b'-'; let buffer = token_id.as_managed_buffer(); - let mut array_buffer = [0u8; 32]; + let mut array_buffer = [0u8; MAX_TOKEN_ID_LEN]; let slice = buffer.load_to_byte_array(&mut array_buffer); - if let Some(index) = slice.iter().position(|&b| b == dash) { + if let Some(index) = slice.iter().position(|&b| b == DASH) { let prefix = ManagedBuffer::from(&slice[..index]); if prefix == chain_prefix { From 9ad4b0e2a7a3f0a96c6424c7ad7809ce6bbf3797 Mon Sep 17 00:00:00 2001 From: Andrei Baltariu Date: Thu, 11 Jul 2024 20:22:06 +0300 Subject: [PATCH 129/523] Modified init endpoint if condition --- enshrine-esdt-safe/src/lib.rs | 30 ++++++++++++++++-------------- 1 file changed, 16 insertions(+), 14 deletions(-) diff --git a/enshrine-esdt-safe/src/lib.rs b/enshrine-esdt-safe/src/lib.rs index b3472a1c..7f7558f9 100644 --- a/enshrine-esdt-safe/src/lib.rs +++ b/enshrine-esdt-safe/src/lib.rs @@ -33,24 +33,26 @@ pub trait EnshrineEsdtSafe: self.is_sovereign_chain().set(is_sovereign_chain); self.set_paused(true); - if !is_sovereign_chain { - match wegld_identifier { - Some(identifier) => { - require!( - identifier.is_valid_esdt_identifier(), - "Sent Identifier is not valid" - ); + if is_sovereign_chain { + return; + } - self.wegld_identifier().set(identifier); - } + match wegld_identifier { + Some(identifier) => { + require!( + identifier.is_valid_esdt_identifier(), + "Sent Identifier is not valid" + ); - None => sc_panic!("WEGLG identifier must be set in Mainchain"), + self.wegld_identifier().set(identifier); } - match sov_token_prefix { - Some(prefix) => self.sovereign_tokens_prefix().set(prefix), - None => sc_panic!("Sovereign Token Prefix must be set in Mainchain"), - } + None => sc_panic!("WEGLG identifier must be set in Mainchain"), + } + + match sov_token_prefix { + Some(prefix) => self.sovereign_tokens_prefix().set(prefix), + None => sc_panic!("Sovereign Token Prefix must be set in Mainchain"), } } From 67856273829bbe60bc32eb76b6ec081a2aba16ce Mon Sep 17 00:00:00 2001 From: Andrei Baltariu Date: Fri, 12 Jul 2024 10:26:17 +0300 Subject: [PATCH 130/523] Renamed optional parameters in init --- enshrine-esdt-safe/src/lib.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/enshrine-esdt-safe/src/lib.rs b/enshrine-esdt-safe/src/lib.rs index 7f7558f9..4b0820e9 100644 --- a/enshrine-esdt-safe/src/lib.rs +++ b/enshrine-esdt-safe/src/lib.rs @@ -27,8 +27,8 @@ pub trait EnshrineEsdtSafe: fn init( &self, is_sovereign_chain: bool, - wegld_identifier: Option, - sov_token_prefix: Option, + opt_wegld_identifier: Option, + opt_sov_token_prefix: Option, ) { self.is_sovereign_chain().set(is_sovereign_chain); self.set_paused(true); @@ -37,7 +37,7 @@ pub trait EnshrineEsdtSafe: return; } - match wegld_identifier { + match opt_wegld_identifier { Some(identifier) => { require!( identifier.is_valid_esdt_identifier(), @@ -50,7 +50,7 @@ pub trait EnshrineEsdtSafe: None => sc_panic!("WEGLG identifier must be set in Mainchain"), } - match sov_token_prefix { + match opt_sov_token_prefix { Some(prefix) => self.sovereign_tokens_prefix().set(prefix), None => sc_panic!("Sovereign Token Prefix must be set in Mainchain"), } From 4b92c046050660cf7013eb1fef6c3cebebe463f6 Mon Sep 17 00:00:00 2001 From: Andrei Baltariu Date: Fri, 12 Jul 2024 10:28:30 +0300 Subject: [PATCH 131/523] Regenerated proxy --- enshrine-esdt-safe/src/enshrine_esdt_safe_proxy.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/enshrine-esdt-safe/src/enshrine_esdt_safe_proxy.rs b/enshrine-esdt-safe/src/enshrine_esdt_safe_proxy.rs index e7be6902..54b2b2ff 100644 --- a/enshrine-esdt-safe/src/enshrine_esdt_safe_proxy.rs +++ b/enshrine-esdt-safe/src/enshrine_esdt_safe_proxy.rs @@ -50,15 +50,15 @@ where >( self, is_sovereign_chain: Arg0, - wegld_identifier: Arg1, - sov_token_prefix: Arg2, + opt_wegld_identifier: Arg1, + opt_sov_token_prefix: Arg2, ) -> TxTypedDeploy { self.wrapped_tx .payment(NotPayable) .raw_deploy() .argument(&is_sovereign_chain) - .argument(&wegld_identifier) - .argument(&sov_token_prefix) + .argument(&opt_wegld_identifier) + .argument(&opt_sov_token_prefix) .original_result() } } From 9224c63f3469f92941dbae7de0e040efed3a0d53 Mon Sep 17 00:00:00 2001 From: Andrei Baltariu Date: Fri, 12 Jul 2024 12:48:26 +0300 Subject: [PATCH 132/523] Added failing test for tokens registration --- .../tests/enshrine_esdt_safe_blackbox_test.rs | 42 ++++++++++++++----- 1 file changed, 31 insertions(+), 11 deletions(-) diff --git a/enshrine-esdt-safe/tests/enshrine_esdt_safe_blackbox_test.rs b/enshrine-esdt-safe/tests/enshrine_esdt_safe_blackbox_test.rs index c7197af0..e6c25d84 100644 --- a/enshrine-esdt-safe/tests/enshrine_esdt_safe_blackbox_test.rs +++ b/enshrine-esdt-safe/tests/enshrine_esdt_safe_blackbox_test.rs @@ -205,24 +205,39 @@ impl EnshrineTestState { .run(); } - fn propose_register_tokens(&mut self, token_ids: Vec) { + fn propose_register_tokens( + &mut self, + token_ids: Vec, + opt_err_message: Option<&str>, + ) { let mut managed_token_ids: MultiValueEncoded> = MultiValueEncoded::new(); + for token_id in token_ids { managed_token_ids.push(TokenIdentifier::from(token_id)) } - self.world - .tx() - .from(ENSHRINE_ESDT_OWNER_ADDRESS) - .to(ENSHRINE_ESDT_ADDRESS) - .typed(enshrine_esdt_safe_proxy::EnshrineEsdtSafeProxy) - .register_new_token_id(managed_token_ids) - .run(); + match opt_err_message { + Some(err_msg) => self + .world + .tx() + .from(ENSHRINE_ESDT_OWNER_ADDRESS) + .to(ENSHRINE_ESDT_ADDRESS) + .typed(enshrine_esdt_safe_proxy::EnshrineEsdtSafeProxy) + .register_new_token_id(managed_token_ids) + .returns(ExpectError(4, err_msg)) + .run(), + None => self + .world + .tx() + .from(ENSHRINE_ESDT_OWNER_ADDRESS) + .to(ENSHRINE_ESDT_ADDRESS) + .typed(enshrine_esdt_safe_proxy::EnshrineEsdtSafeProxy) + .register_new_token_id(managed_token_ids) + .run(), + } } - fn check_registered_tokens(&mut self) {} - fn mock_bls_signature( &mut self, operation_hash: &ManagedBuffer, @@ -298,8 +313,13 @@ fn test_sovereign_prefix_has_prefix() { } #[test] -fn test_register_tokens() { +fn test_register_tokens_multiple_esdt() { let mut state = EnshrineTestState::new(); + let error_message = "incorrect number of ESDT transfers"; state.propose_setup_contracts(false); + state.propose_register_tokens( + Vec::from([PREFIX_NFT_TOKEN_ID, FUNGIBLE_TOKEN_ID]), + Some(error_message), + ); } From ff1d520b7c8a3e9fdefa26f6c63820bc3ec5baea Mon Sep 17 00:00:00 2001 From: Andrei Baltariu Date: Fri, 12 Jul 2024 13:32:56 +0300 Subject: [PATCH 133/523] Added wegld payment and balance --- .../tests/enshrine_esdt_safe_blackbox_test.rs | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/enshrine-esdt-safe/tests/enshrine_esdt_safe_blackbox_test.rs b/enshrine-esdt-safe/tests/enshrine_esdt_safe_blackbox_test.rs index e6c25d84..b018e740 100644 --- a/enshrine-esdt-safe/tests/enshrine_esdt_safe_blackbox_test.rs +++ b/enshrine-esdt-safe/tests/enshrine_esdt_safe_blackbox_test.rs @@ -3,8 +3,8 @@ use enshrine_esdt_safe::enshrine_esdt_safe_proxy; use header_verifier::header_verifier_proxy; use multiversx_sc::codec::TopEncode; use multiversx_sc::types::{ - Address, ManagedBuffer, ManagedByteArray, ManagedVec, MultiValueEncoded, TestAddress, - TestSCAddress, TestTokenIdentifier, TokenIdentifier, + Address, BigUint, EsdtTokenPayment, ManagedBuffer, ManagedByteArray, ManagedVec, + MultiValueEncoded, TestAddress, TestSCAddress, TestTokenIdentifier, TokenIdentifier, }; use multiversx_sc_scenario::api::StaticApi; use multiversx_sc_scenario::multiversx_chain_vm::crypto_functions::sha256; @@ -20,6 +20,7 @@ const ENSHRINE_ESDT_OWNER_ADDRESS: TestAddress = TestAddress::new("enshrine-esdt const ENSHRINE_OWNER_BALANCE: u64 = 100_000_000; const USER_EGLD_BALANCE: u64 = 100_000_000; +const DEFAULT_ISSUE_COST: u64 = 50000000000000000; const HEADER_VERIFIER_ADDRESS: TestSCAddress = TestSCAddress::new("header_verifier"); const HEADER_VERIFIER_CODE_PATH: MxscPath = @@ -55,6 +56,7 @@ impl EnshrineTestState { world .account(ENSHRINE_ESDT_OWNER_ADDRESS) .esdt_balance(FUNGIBLE_TOKEN_ID, 100_000) + .esdt_balance(WEGLD_IDENTIFIER, 100_000) .esdt_nft_balance(NFT_TOKEN_ID, 1, 100_000, ManagedBuffer::new()) .nonce(1) .balance(ENSHRINE_OWNER_BALANCE); @@ -217,6 +219,9 @@ impl EnshrineTestState { managed_token_ids.push(TokenIdentifier::from(token_id)) } + let wegld_amount = BigUint::from(DEFAULT_ISSUE_COST * managed_token_ids.len() as u64); + let wegld_payment = EsdtTokenPayment::new(WEGLD_IDENTIFIER.into(), 0, wegld_amount); + match opt_err_message { Some(err_msg) => self .world @@ -226,6 +231,7 @@ impl EnshrineTestState { .typed(enshrine_esdt_safe_proxy::EnshrineEsdtSafeProxy) .register_new_token_id(managed_token_ids) .returns(ExpectError(4, err_msg)) + .esdt(wegld_payment) .run(), None => self .world @@ -234,6 +240,7 @@ impl EnshrineTestState { .to(ENSHRINE_ESDT_ADDRESS) .typed(enshrine_esdt_safe_proxy::EnshrineEsdtSafeProxy) .register_new_token_id(managed_token_ids) + .esdt(wegld_payment) .run(), } } @@ -323,3 +330,11 @@ fn test_register_tokens_multiple_esdt() { Some(error_message), ); } + +#[test] +fn test_register_tokens_with_egld() { + let mut state = EnshrineTestState::new(); + + state.propose_setup_contracts(false); + state.propose_register_tokens(Vec::from([PREFIX_NFT_TOKEN_ID, FUNGIBLE_TOKEN_ID]), None); +} From ceffe3bbf7f07ffd3af8a725d839db2c46778954 Mon Sep 17 00:00:00 2001 From: Andrei Baltariu Date: Fri, 12 Jul 2024 13:36:51 +0300 Subject: [PATCH 134/523] Fixed WEGLD balance setup --- .../tests/enshrine_esdt_safe_blackbox_test.rs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/enshrine-esdt-safe/tests/enshrine_esdt_safe_blackbox_test.rs b/enshrine-esdt-safe/tests/enshrine_esdt_safe_blackbox_test.rs index b018e740..d78c3f9c 100644 --- a/enshrine-esdt-safe/tests/enshrine_esdt_safe_blackbox_test.rs +++ b/enshrine-esdt-safe/tests/enshrine_esdt_safe_blackbox_test.rs @@ -20,7 +20,7 @@ const ENSHRINE_ESDT_OWNER_ADDRESS: TestAddress = TestAddress::new("enshrine-esdt const ENSHRINE_OWNER_BALANCE: u64 = 100_000_000; const USER_EGLD_BALANCE: u64 = 100_000_000; -const DEFAULT_ISSUE_COST: u64 = 50000000000000000; +const DEFAULT_ISSUE_COST: u64 = 50_000_000_000_000_000; const HEADER_VERIFIER_ADDRESS: TestSCAddress = TestSCAddress::new("header_verifier"); const HEADER_VERIFIER_CODE_PATH: MxscPath = @@ -56,7 +56,10 @@ impl EnshrineTestState { world .account(ENSHRINE_ESDT_OWNER_ADDRESS) .esdt_balance(FUNGIBLE_TOKEN_ID, 100_000) - .esdt_balance(WEGLD_IDENTIFIER, 100_000) + .esdt_balance( + WEGLD_IDENTIFIER, + BigUint::from(100_000_000_000_000_000 as u128), + ) .esdt_nft_balance(NFT_TOKEN_ID, 1, 100_000, ManagedBuffer::new()) .nonce(1) .balance(ENSHRINE_OWNER_BALANCE); From 4e1ab255772ebf1731cdc7a976d84a8c395ef18d Mon Sep 17 00:00:00 2001 From: Andrei Baltariu Date: Fri, 12 Jul 2024 13:43:16 +0300 Subject: [PATCH 135/523] Fixed insufficient funds test --- .../tests/enshrine_esdt_safe_blackbox_test.rs | 36 ++++++++++++++++--- 1 file changed, 32 insertions(+), 4 deletions(-) diff --git a/enshrine-esdt-safe/tests/enshrine_esdt_safe_blackbox_test.rs b/enshrine-esdt-safe/tests/enshrine_esdt_safe_blackbox_test.rs index d78c3f9c..df438f7e 100644 --- a/enshrine-esdt-safe/tests/enshrine_esdt_safe_blackbox_test.rs +++ b/enshrine-esdt-safe/tests/enshrine_esdt_safe_blackbox_test.rs @@ -210,6 +210,33 @@ impl EnshrineTestState { .run(); } + fn propose_register_tokens_insufficient_funds( + &mut self, + token_ids: Vec, + err_message: &str, + err_code: u64, + ) { + let mut managed_token_ids: MultiValueEncoded> = + MultiValueEncoded::new(); + + for token_id in token_ids { + managed_token_ids.push(TokenIdentifier::from(token_id)) + } + + let wegld_amount = BigUint::from(DEFAULT_ISSUE_COST * managed_token_ids.len() as u64); + let wegld_payment = EsdtTokenPayment::new(WEGLD_IDENTIFIER.into(), 0, wegld_amount); + + self.world + .tx() + .from(USER_ADDRESS) + .to(ENSHRINE_ESDT_ADDRESS) + .typed(enshrine_esdt_safe_proxy::EnshrineEsdtSafeProxy) + .register_new_token_id(managed_token_ids) + .returns(ExpectError(err_code, err_message)) + .esdt(wegld_payment) + .run(); + } + fn propose_register_tokens( &mut self, token_ids: Vec, @@ -323,14 +350,15 @@ fn test_sovereign_prefix_has_prefix() { } #[test] -fn test_register_tokens_multiple_esdt() { +fn test_register_tokens_insufficient_funds() { let mut state = EnshrineTestState::new(); - let error_message = "incorrect number of ESDT transfers"; + let error_message = "insufficient funds"; state.propose_setup_contracts(false); - state.propose_register_tokens( + state.propose_register_tokens_insufficient_funds( Vec::from([PREFIX_NFT_TOKEN_ID, FUNGIBLE_TOKEN_ID]), - Some(error_message), + error_message, + 10, ); } From 3915ac1fa500f9c7036afea3f0950d6f41f10e90 Mon Sep 17 00:00:00 2001 From: Andrei Baltariu Date: Fri, 12 Jul 2024 14:00:11 +0300 Subject: [PATCH 136/523] Renamed test --- enshrine-esdt-safe/tests/enshrine_esdt_safe_blackbox_test.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/enshrine-esdt-safe/tests/enshrine_esdt_safe_blackbox_test.rs b/enshrine-esdt-safe/tests/enshrine_esdt_safe_blackbox_test.rs index df438f7e..4300c63c 100644 --- a/enshrine-esdt-safe/tests/enshrine_esdt_safe_blackbox_test.rs +++ b/enshrine-esdt-safe/tests/enshrine_esdt_safe_blackbox_test.rs @@ -363,7 +363,7 @@ fn test_register_tokens_insufficient_funds() { } #[test] -fn test_register_tokens_with_egld() { +fn test_register_tokens() { let mut state = EnshrineTestState::new(); state.propose_setup_contracts(false); From e37c008080331471a17e6f84b6e228246fb26c94 Mon Sep 17 00:00:00 2001 From: Andrei Baltariu Date: Fri, 12 Jul 2024 14:04:58 +0300 Subject: [PATCH 137/523] Use camel case for storage mappers alias --- enshrine-esdt-safe/src/from_sovereign/transfer_tokens.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/enshrine-esdt-safe/src/from_sovereign/transfer_tokens.rs b/enshrine-esdt-safe/src/from_sovereign/transfer_tokens.rs index df28fad1..5277592e 100644 --- a/enshrine-esdt-safe/src/from_sovereign/transfer_tokens.rs +++ b/enshrine-esdt-safe/src/from_sovereign/transfer_tokens.rs @@ -351,10 +351,10 @@ pub trait TransferTokensModule: token_id.eq(&self.wegld_identifier().get()) } - #[storage_mapper("pending_hashes")] + #[storage_mapper("pendingHashes")] fn pending_hashes(&self, hash_of_hashes: &ManagedBuffer) -> UnorderedSetMapper; - #[storage_mapper("header_verifier_address")] + #[storage_mapper("headerVerifierAddress")] fn header_verifier_address(&self) -> SingleValueMapper; #[storage_mapper("mintedTokens")] From 894229239233f746e7c94afd358712391f0f23f0 Mon Sep 17 00:00:00 2001 From: Andrei Baltariu Date: Fri, 12 Jul 2024 14:37:40 +0300 Subject: [PATCH 138/523] Modified storage mapper alias Signed-off-by: Andrei Baltariu --- enshrine-esdt-safe/src/from_sovereign/transfer_tokens.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/enshrine-esdt-safe/src/from_sovereign/transfer_tokens.rs b/enshrine-esdt-safe/src/from_sovereign/transfer_tokens.rs index 5277592e..d8534726 100644 --- a/enshrine-esdt-safe/src/from_sovereign/transfer_tokens.rs +++ b/enshrine-esdt-safe/src/from_sovereign/transfer_tokens.rs @@ -357,6 +357,6 @@ pub trait TransferTokensModule: #[storage_mapper("headerVerifierAddress")] fn header_verifier_address(&self) -> SingleValueMapper; - #[storage_mapper("mintedTokens")] + #[storage_mapper("paidIssuedTokens")] fn paid_issued_tokens(&self) -> UnorderedSetMapper>; } From 2225211f4dcaa6ddec62fc615b0fff2ad8e56b7a Mon Sep 17 00:00:00 2001 From: Andrei Baltariu Date: Fri, 12 Jul 2024 20:37:50 +0300 Subject: [PATCH 139/523] Added camel case for storage mappers alias Signed-off-by: Andrei Baltariu --- header-verifier/src/lib.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/header-verifier/src/lib.rs b/header-verifier/src/lib.rs index 3791c78d..a881f3b1 100644 --- a/header-verifier/src/lib.rs +++ b/header-verifier/src/lib.rs @@ -103,13 +103,13 @@ pub trait Headerverifier: bls_signature::BlsSignatureModule { pub_keys_count > minimum_signatures } - #[storage_mapper("bls_pub_keys")] + #[storage_mapper("blsPubKeys")] fn bls_pub_keys(&self) -> SetMapper; - #[storage_mapper("pending_hashes")] + #[storage_mapper("pendingHashes")] fn pending_hashes(&self, hash_of_hashes: &ManagedBuffer) -> UnorderedSetMapper; - #[storage_mapper("hash_of_hashes_history")] + #[storage_mapper("hashOfHashesHistory")] fn hash_of_hashes_history(&self) -> UnorderedSetMapper; #[storage_mapper("esdtSafeAddress")] From 1018d99f2e4fce058bf050cd7cfcb56973d9230a Mon Sep 17 00:00:00 2001 From: Andrei Baltariu Date: Mon, 15 Jul 2024 12:32:10 +0300 Subject: [PATCH 140/523] Generated Token-Handler contract Signed-off-by: Andrei Baltariu --- token-handler/Cargo.toml | 24 ++++++++++++ token-handler/meta/Cargo.toml | 12 ++++++ token-handler/meta/src/main.rs | 3 ++ token-handler/multiversx.json | 3 ++ .../scenarios/token_handler.scen.json | 39 +++++++++++++++++++ token-handler/src/token_handler.rs | 14 +++++++ .../tests/token_handler_scenario_go_test.rs | 10 +++++ .../tests/token_handler_scenario_rs_test.rs | 13 +++++++ 8 files changed, 118 insertions(+) create mode 100644 token-handler/Cargo.toml create mode 100644 token-handler/meta/Cargo.toml create mode 100644 token-handler/meta/src/main.rs create mode 100644 token-handler/multiversx.json create mode 100644 token-handler/scenarios/token_handler.scen.json create mode 100644 token-handler/src/token_handler.rs create mode 100644 token-handler/tests/token_handler_scenario_go_test.rs create mode 100644 token-handler/tests/token_handler_scenario_rs_test.rs diff --git a/token-handler/Cargo.toml b/token-handler/Cargo.toml new file mode 100644 index 00000000..eea60eee --- /dev/null +++ b/token-handler/Cargo.toml @@ -0,0 +1,24 @@ +[package] +name = "token-handler" +version = "0.0.0" +authors = ["you"] +edition = "2021" +publish = false + +[lib] +path = "src/token_handler.rs" + +[dependencies.multiversx-sc] +version = "0.51.1" + +[dev-dependencies] +num-bigint = "0.4" + +[dev-dependencies.multiversx-sc-scenario] +version = "0.51.1" + +[workspace] +members = [ + ".", + "meta", +] diff --git a/token-handler/meta/Cargo.toml b/token-handler/meta/Cargo.toml new file mode 100644 index 00000000..4a40c246 --- /dev/null +++ b/token-handler/meta/Cargo.toml @@ -0,0 +1,12 @@ +[package] +name = "token-handler-meta" +version = "0.0.0" +edition = "2021" +publish = false + +[dependencies.token-handler] +path = ".." + +[dependencies.multiversx-sc-meta-lib] +version = "0.51.1" +default-features = false diff --git a/token-handler/meta/src/main.rs b/token-handler/meta/src/main.rs new file mode 100644 index 00000000..38215cdb --- /dev/null +++ b/token-handler/meta/src/main.rs @@ -0,0 +1,3 @@ +fn main() { + multiversx_sc_meta_lib::cli_main::(); +} diff --git a/token-handler/multiversx.json b/token-handler/multiversx.json new file mode 100644 index 00000000..73655396 --- /dev/null +++ b/token-handler/multiversx.json @@ -0,0 +1,3 @@ +{ + "language": "rust" +} \ No newline at end of file diff --git a/token-handler/scenarios/token_handler.scen.json b/token-handler/scenarios/token_handler.scen.json new file mode 100644 index 00000000..e16380b6 --- /dev/null +++ b/token-handler/scenarios/token_handler.scen.json @@ -0,0 +1,39 @@ +{ + "name": "empty", + "steps": [ + { + "step": "setState", + "accounts": { + "address:owner": { + "nonce": "1", + "balance": "0" + } + }, + "newAddresses": [ + { + "creatorAddress": "address:owner", + "creatorNonce": "1", + "newAddress": "sc:empty" + } + ] + }, + { + "step": "scDeploy", + "id": "deploy", + "tx": { + "from": "address:owner", + "contractCode": "mxsc:../output/token-handler.mxsc.json", + "arguments": [], + "gasLimit": "5,000,000", + "gasPrice": "0" + }, + "expect": { + "out": [], + "status": "", + "logs": [], + "gas": "*", + "refund": "*" + } + } + ] +} diff --git a/token-handler/src/token_handler.rs b/token-handler/src/token_handler.rs new file mode 100644 index 00000000..489e0c60 --- /dev/null +++ b/token-handler/src/token_handler.rs @@ -0,0 +1,14 @@ +#![no_std] + +#[allow(unused_imports)] +use multiversx_sc::imports::*; + +/// An empty contract. To be used as a template when starting a new contract from scratch. +#[multiversx_sc::contract] +pub trait TokenHandler { + #[init] + fn init(&self) {} + + #[upgrade] + fn upgrade(&self) {} +} diff --git a/token-handler/tests/token_handler_scenario_go_test.rs b/token-handler/tests/token_handler_scenario_go_test.rs new file mode 100644 index 00000000..057832d6 --- /dev/null +++ b/token-handler/tests/token_handler_scenario_go_test.rs @@ -0,0 +1,10 @@ +use multiversx_sc_scenario::*; + +fn world() -> ScenarioWorld { + ScenarioWorld::vm_go() +} + +#[test] +fn empty_go() { + world().run("scenarios/token_handler.scen.json"); +} diff --git a/token-handler/tests/token_handler_scenario_rs_test.rs b/token-handler/tests/token_handler_scenario_rs_test.rs new file mode 100644 index 00000000..ca953346 --- /dev/null +++ b/token-handler/tests/token_handler_scenario_rs_test.rs @@ -0,0 +1,13 @@ +use multiversx_sc_scenario::*; + +fn world() -> ScenarioWorld { + let mut blockchain = ScenarioWorld::new(); + + blockchain.register_contract("mxsc:output/token-handler.mxsc.json", token_handler::ContractBuilder); + blockchain +} + +#[test] +fn empty_rs() { + world().run("scenarios/token_handler.scen.json"); +} From 22c3af31952b5f66483c83b438f36d45d31d9dff Mon Sep 17 00:00:00 2001 From: Andrei Baltariu Date: Mon, 15 Jul 2024 12:51:24 +0300 Subject: [PATCH 141/523] Added modules for mint and burn Signed-off-by: Andrei Baltariu --- token-handler/Cargo.lock | 1182 +++++++++++++++++ token-handler/Cargo.toml | 2 +- token-handler/src/burn_tokens.rs | 5 + .../src/{token_handler.rs => lib.rs} | 4 +- token-handler/src/mint_tokens.rs | 5 + 5 files changed, 1196 insertions(+), 2 deletions(-) create mode 100644 token-handler/Cargo.lock create mode 100644 token-handler/src/burn_tokens.rs rename token-handler/src/{token_handler.rs => lib.rs} (68%) create mode 100644 token-handler/src/mint_tokens.rs diff --git a/token-handler/Cargo.lock b/token-handler/Cargo.lock new file mode 100644 index 00000000..91b43380 --- /dev/null +++ b/token-handler/Cargo.lock @@ -0,0 +1,1182 @@ +# This file is automatically @generated by Cargo. +# It is not intended for manual editing. +version = 3 + +[[package]] +name = "ahash" +version = "0.8.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e89da841a80418a9b391ebaea17f5c112ffaaa96f621d2c285b5174da76b9011" +dependencies = [ + "cfg-if", + "once_cell", + "version_check", + "zerocopy", +] + +[[package]] +name = "anstream" +version = "0.6.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "418c75fa768af9c03be99d17643f93f79bbba589895012a80e3452a19ddda15b" +dependencies = [ + "anstyle", + "anstyle-parse", + "anstyle-query", + "anstyle-wincon", + "colorchoice", + "is_terminal_polyfill", + "utf8parse", +] + +[[package]] +name = "anstyle" +version = "1.0.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "038dfcf04a5feb68e9c60b21c9625a54c2c0616e79b72b0fd87075a056ae1d1b" + +[[package]] +name = "anstyle-parse" +version = "0.2.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c03a11a9034d92058ceb6ee011ce58af4a9bf61491aa7e1e59ecd24bd40d22d4" +dependencies = [ + "utf8parse", +] + +[[package]] +name = "anstyle-query" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ad186efb764318d35165f1758e7dcef3b10628e26d41a44bc5550652e6804391" +dependencies = [ + "windows-sys 0.52.0", +] + +[[package]] +name = "anstyle-wincon" +version = "3.0.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "61a38449feb7068f52bb06c12759005cf459ee52bb4adc1d5a7c4322d716fb19" +dependencies = [ + "anstyle", + "windows-sys 0.52.0", +] + +[[package]] +name = "anyhow" +version = "1.0.86" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b3d1d046238990b9cf5bcde22a3fb3584ee5cf65fb2765f454ed428c7a0063da" + +[[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 = "base64" +version = "0.22.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "72b3254f16251a8381aa12e40e3c4d2f0199f8c6508fbecb9d91f575e0fbb8c6" + +[[package]] +name = "bech32" +version = "0.9.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d86b93f97252c47b41663388e6d155714a9d0c398b99f1005cbc5f978b29f445" + +[[package]] +name = "bitflags" +version = "2.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b048fb63fd8b5923fc5aa7b340d8e156aec7ec02f0c78fa8a6ddc2613f6f71de" + +[[package]] +name = "block-buffer" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4152116fd6e9dadb291ae18fc1ec3575ed6d84c29642d97890f4b4a3417297e4" +dependencies = [ + "generic-array", +] + +[[package]] +name = "block-buffer" +version = "0.10.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3078c7629b62d3f0439517fa394996acacc5cbc91c5a20d8c658e77abd503a71" +dependencies = [ + "generic-array", +] + +[[package]] +name = "byteorder" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1fd0f2584146f6f2ef48085050886acf353beff7305ebd1ae69500e27c67f64b" + +[[package]] +name = "cfg-if" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" + +[[package]] +name = "clap" +version = "4.5.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "64acc1846d54c1fe936a78dc189c34e28d3f5afc348403f28ecf53660b9b8462" +dependencies = [ + "clap_builder", + "clap_derive", +] + +[[package]] +name = "clap_builder" +version = "4.5.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6fb8393d67ba2e7bfaf28a23458e4e2b543cc73a99595511eb207fdb8aede942" +dependencies = [ + "anstream", + "anstyle", + "clap_lex", + "strsim", +] + +[[package]] +name = "clap_derive" +version = "4.5.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2bac35c6dafb060fd4d275d9a4ffae97917c13a6327903a8be2153cd964f7085" +dependencies = [ + "heck", + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "clap_lex" +version = "0.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4b82cf0babdbd58558212896d1a4272303a57bdb245c2bf1147185fb45640e70" + +[[package]] +name = "colorchoice" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0b6a852b24ab71dffc585bcb46eaf7959d175cb865a7152e35b348d1b2960422" + +[[package]] +name = "colored" +version = "2.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cbf2150cce219b664a8a70df7a1f933836724b503f8a413af9365b4dcc4d90b8" +dependencies = [ + "lazy_static", + "windows-sys 0.48.0", +] + +[[package]] +name = "convert_case" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ec182b0ca2f35d8fc196cf3404988fd8b8c739a4d270ff118a398feb0cbec1ca" +dependencies = [ + "unicode-segmentation", +] + +[[package]] +name = "cpufeatures" +version = "0.2.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "53fe5e26ff1b7aef8bca9c6080520cfb8d9333c7568e1829cef191a9723e5504" +dependencies = [ + "libc", +] + +[[package]] +name = "crypto-common" +version = "0.1.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1bfb12502f3fc46cca1bb51ac28df9d618d813cdc3d2f25b9fe775a34af26bb3" +dependencies = [ + "generic-array", + "typenum", +] + +[[package]] +name = "curve25519-dalek" +version = "3.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "90f9d052967f590a76e62eb387bd0bbb1b000182c3cefe5364db6b7211651bc0" +dependencies = [ + "byteorder", + "digest 0.9.0", + "rand_core 0.5.1", + "subtle", + "zeroize", +] + +[[package]] +name = "digest" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d3dd60d1080a57a05ab032377049e0591415d2b31afd7028356dbf3cc6dcb066" +dependencies = [ + "generic-array", +] + +[[package]] +name = "digest" +version = "0.10.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9ed9a281f7bc9b7576e61468ba615a66a5c8cfdff42420a70aa82701a3b1e292" +dependencies = [ + "block-buffer 0.10.4", + "crypto-common", +] + +[[package]] +name = "ed25519" +version = "1.5.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "91cff35c70bba8a626e3185d8cd48cc11b5437e1a5bcd15b9b5fa3c64b6dfee7" +dependencies = [ + "signature", +] + +[[package]] +name = "ed25519-dalek" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c762bae6dcaf24c4c84667b8579785430908723d5c889f469d76a41d59cc7a9d" +dependencies = [ + "curve25519-dalek", + "ed25519", + "rand 0.7.3", + "serde", + "sha2 0.9.9", + "zeroize", +] + +[[package]] +name = "either" +version = "1.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "60b1af1c220855b6ceac025d3f6ecdd2b7c4894bfe9cd9bda4fbb4bc7c0d4cf0" + +[[package]] +name = "endian-type" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c34f04666d835ff5d62e058c3995147c06f42fe86ff053337632bca83e42702d" + +[[package]] +name = "equivalent" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5443807d6dff69373d433ab9ef5378ad8df50ca6298caf15de6e52e24aaf54d5" + +[[package]] +name = "generic-array" +version = "0.14.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "85649ca51fd72272d7821adaf274ad91c288277713d9c18820d8499a7ff69e9a" +dependencies = [ + "typenum", + "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.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c4567c8db10ae91089c99af84c68c38da3ec2f087c3f82960bcdbf3656b6f4d7" +dependencies = [ + "cfg-if", + "libc", + "wasi 0.11.0+wasi-snapshot-preview1", +] + +[[package]] +name = "hashbrown" +version = "0.14.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e5274423e17b7c9fc20b6e7e208532f9b19825d82dfd615708b70edd83df41f1" +dependencies = [ + "ahash", + "serde", +] + +[[package]] +name = "heck" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2304e00983f87ffb38b55b444b5e3b60a884b5d30c0fca7d82fe33449bbe55ea" + +[[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 = "indexmap" +version = "2.2.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "168fb715dda47215e360912c096649d23d58bf392ac62f73919e831745e40f26" +dependencies = [ + "equivalent", + "hashbrown", + "serde", +] + +[[package]] +name = "is_terminal_polyfill" +version = "1.70.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f8478577c03552c21db0e2724ffb8986a5ce7af88107e6be5d2ee6e158c12800" + +[[package]] +name = "itertools" +version = "0.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "413ee7dfc52ee1a4949ceeb7dbc8a33f2d6c088194d9f922fb8318faf1f01186" +dependencies = [ + "either", +] + +[[package]] +name = "itoa" +version = "1.0.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "49f1f14873335454500d59611f1cf4a4b0f786f9ac11f4312a78e4cf2566695b" + +[[package]] +name = "keccak" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ecc2af9a1119c51f12a14607e783cb977bde58bc069ff0c3da1095e635d70654" +dependencies = [ + "cpufeatures", +] + +[[package]] +name = "lazy_static" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bbd2bcb4c963f2ddae06a2efc7e9f3591312473c50c6685e1f298068316e66fe" + +[[package]] +name = "libc" +version = "0.2.155" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "97b3888a4aecf77e811145cadf6eef5901f4782c53886191b2f693f24761847c" + +[[package]] +name = "log" +version = "0.4.22" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a7a70ba024b9dc04c27ea2f0c0548feb474ec5c54bba33a7f72f873a39d07b24" + +[[package]] +name = "memchr" +version = "2.7.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "78ca9ab1a0babb1e7d5695e3530886289c18cf2f87ec19a575a0abdce112e3a3" + +[[package]] +name = "multiversx-chain-scenario-format" +version = "0.22.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "921a66f6db5ffff311e355d42a49fd49baf72d7a6a6215b0484dcd9d8dd512a3" +dependencies = [ + "bech32", + "hex", + "num-bigint", + "num-traits", + "serde", + "serde_json", + "sha3", +] + +[[package]] +name = "multiversx-chain-vm" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a8d91b6ce610a3ac1272f0813284a3f03a34d55db2f86cddaff357bf651074ee" +dependencies = [ + "bitflags", + "colored", + "ed25519-dalek", + "hex", + "hex-literal", + "itertools", + "multiversx-chain-vm-executor", + "num-bigint", + "num-traits", + "rand 0.8.5", + "rand_seeder", + "sha2 0.10.8", + "sha3", +] + +[[package]] +name = "multiversx-chain-vm-executor" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b59072fa0624b55ae5ae3fa6bfa91515bbeb4ac440214bc4a509e2c8806d6e9f" + +[[package]] +name = "multiversx-sc" +version = "0.51.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "236f7890b2208796df8b5ac73b8572ffaf5e2b1531c7ad549d669328b715b657" +dependencies = [ + "bitflags", + "hex-literal", + "multiversx-sc-codec", + "multiversx-sc-derive", + "num-traits", + "unwrap-infallible", +] + +[[package]] +name = "multiversx-sc-codec" +version = "0.20.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fcecd449ea708b72f92edaa17158fe4859c1780aed9b52b14de45f26124ccb8b" +dependencies = [ + "arrayvec", + "multiversx-sc-codec-derive", + "num-bigint", + "unwrap-infallible", +] + +[[package]] +name = "multiversx-sc-codec-derive" +version = "0.20.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "68f7fa25402e5e8054d719951289306fd79e481f7c21b2565b5549b6bc359772" +dependencies = [ + "hex", + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "multiversx-sc-derive" +version = "0.51.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "eb683bc78d0e2eb43c16cac790144f53cc2ab27912aeb1484433895742ce698d" +dependencies = [ + "hex", + "proc-macro2", + "quote", + "radix_trie", + "syn", +] + +[[package]] +name = "multiversx-sc-meta-lib" +version = "0.51.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "eb12232450627cb0e9f3ba9493b0bd7445a40066f0e311e19e84de812bbffd56" +dependencies = [ + "clap", + "colored", + "convert_case", + "hex", + "lazy_static", + "multiversx-sc", + "rustc_version", + "semver", + "serde", + "serde_json", + "toml", + "wasmparser", + "wasmprinter", +] + +[[package]] +name = "multiversx-sc-scenario" +version = "0.51.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6b7a5e1289d021c89c44688d77110d78edf83ea52b2eff40481a8119ad2f0411" +dependencies = [ + "base64", + "bech32", + "colored", + "hex", + "itertools", + "log", + "multiversx-chain-scenario-format", + "multiversx-chain-vm", + "multiversx-chain-vm-executor", + "multiversx-sc", + "multiversx-sc-meta-lib", + "num-bigint", + "num-traits", + "pathdiff", + "serde", + "serde_json", + "sha2 0.10.8", + "unwrap-infallible", +] + +[[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-bigint" +version = "0.4.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a5e44f723f1133c9deac646763579fdb3ac745e418f2a7af9cd0c431da1f20b9" +dependencies = [ + "num-integer", + "num-traits", +] + +[[package]] +name = "num-integer" +version = "0.1.46" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7969661fd2958a5cb096e56c8e1ad0444ac2bbcd0061bd28660485a44879858f" +dependencies = [ + "num-traits", +] + +[[package]] +name = "num-traits" +version = "0.2.19" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "071dfc062690e90b734c0b2273ce72ad0ffa95f0c74596bc250dcfd960262841" +dependencies = [ + "autocfg", +] + +[[package]] +name = "once_cell" +version = "1.19.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3fdb12b2476b595f9358c5161aa467c2438859caa136dec86c26fdd2efe17b92" + +[[package]] +name = "opaque-debug" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c08d65885ee38876c4f86fa503fb49d7b507c2b62552df7c70b2fce627e06381" + +[[package]] +name = "pathdiff" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8835116a5c179084a830efb3adc117ab007512b535bc1a21c991d3b32a6b44dd" + +[[package]] +name = "ppv-lite86" +version = "0.2.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5b40af805b3121feab8a3c29f04d8ad262fa8e0561883e7653e024ae4479e6de" + +[[package]] +name = "proc-macro2" +version = "1.0.86" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5e719e8df665df0d1c8fbfd238015744736151d4445ec0836b8e628aae103b77" +dependencies = [ + "unicode-ident", +] + +[[package]] +name = "quote" +version = "1.0.36" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0fa76aaf39101c457836aec0ce2316dbdc3ab723cdda1c6bd4e6ad4208acaca7" +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 = "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" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "34af8d1a0e25924bc5b7c43c079c942339d8f0a8b57c39049bef581b46327404" +dependencies = [ + "libc", + "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]] +name = "rand_chacha" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e6c10a63a0fa32252be49d21e7709d4d4baf8d231c2dbce1eaa8141b9b127d88" +dependencies = [ + "ppv-lite86", + "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]] +name = "rand_core" +version = "0.6.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c" +dependencies = [ + "getrandom 0.2.15", +] + +[[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]] +name = "rand_seeder" +version = "0.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cf2890aaef0aa82719a50e808de264f9484b74b442e1a3a0e5ee38243ac40bdb" +dependencies = [ + "rand_core 0.6.4", +] + +[[package]] +name = "rustc_version" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bfa0f585226d2e68097d4f95d113b15b83a82e819ab25717ec0590d9584ef366" +dependencies = [ + "semver", +] + +[[package]] +name = "ryu" +version = "1.0.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f3cb5ba0dc43242ce17de99c180e96db90b235b8a9fdc9543c96d2209116bd9f" + +[[package]] +name = "semver" +version = "1.0.23" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "61697e0a1c7e512e84a621326239844a24d8207b4669b41bc18b32ea5cbf988b" + +[[package]] +name = "serde" +version = "1.0.204" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bc76f558e0cbb2a839d37354c575f1dc3fdc6546b5be373ba43d95f231bf7c12" +dependencies = [ + "serde_derive", +] + +[[package]] +name = "serde_derive" +version = "1.0.204" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e0cd7e117be63d3c3678776753929474f3b04a43a080c744d6b0ae2a8c28e222" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "serde_json" +version = "1.0.120" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4e0d21c9a8cae1235ad58a00c11cb40d4b1e5c784f1ef2c537876ed6ffd8b7c5" +dependencies = [ + "itoa", + "ryu", + "serde", +] + +[[package]] +name = "serde_spanned" +version = "0.6.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "79e674e01f999af37c49f70a6ede167a8a60b2503e56c5599532a65baa5969a0" +dependencies = [ + "serde", +] + +[[package]] +name = "sha2" +version = "0.9.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4d58a1e1bf39749807d89cf2d98ac2dfa0ff1cb3faa38fbb64dd88ac8013d800" +dependencies = [ + "block-buffer 0.9.0", + "cfg-if", + "cpufeatures", + "digest 0.9.0", + "opaque-debug", +] + +[[package]] +name = "sha2" +version = "0.10.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "793db75ad2bcafc3ffa7c68b215fee268f537982cd901d132f89c6343f3a3dc8" +dependencies = [ + "cfg-if", + "cpufeatures", + "digest 0.10.7", +] + +[[package]] +name = "sha3" +version = "0.10.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "75872d278a8f37ef87fa0ddbda7802605cb18344497949862c0d4dcb291eba60" +dependencies = [ + "digest 0.10.7", + "keccak", +] + +[[package]] +name = "signature" +version = "1.6.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "74233d3b3b2f6d4b006dc19dee745e73e2a6bfb6f93607cd3b02bd5b00797d7c" + +[[package]] +name = "smallvec" +version = "1.13.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3c5e1a9a646d36c3599cd173a41282daf47c44583ad367b8e6837255952e5c67" + +[[package]] +name = "strsim" +version = "0.11.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7da8b5736845d9f2fcb837ea5d9e2628564b3b043a70948a3f0b778838c5fb4f" + +[[package]] +name = "subtle" +version = "2.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "13c2bddecc57b384dee18652358fb23172facb8a2c51ccc10d74c157bdea3292" + +[[package]] +name = "syn" +version = "2.0.68" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "901fa70d88b9d6c98022e23b4136f9f3e54e4662c3bc1bd1d84a42a9a0f0c1e9" +dependencies = [ + "proc-macro2", + "quote", + "unicode-ident", +] + +[[package]] +name = "termcolor" +version = "1.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "06794f8f6c5c898b3275aebefa6b8a1cb24cd2c6c79397ab15774837a0bc5755" +dependencies = [ + "winapi-util", +] + +[[package]] +name = "token-handler" +version = "0.0.0" +dependencies = [ + "multiversx-sc", + "multiversx-sc-scenario", + "num-bigint", +] + +[[package]] +name = "token-handler-meta" +version = "0.0.0" +dependencies = [ + "multiversx-sc-meta-lib", + "token-handler", +] + +[[package]] +name = "toml" +version = "0.8.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6f49eb2ab21d2f26bd6db7bf383edc527a7ebaee412d17af4d40fdccd442f335" +dependencies = [ + "indexmap", + "serde", + "serde_spanned", + "toml_datetime", + "toml_edit", +] + +[[package]] +name = "toml_datetime" +version = "0.6.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4badfd56924ae69bcc9039335b2e017639ce3f9b001c393c1b2d1ef846ce2cbf" +dependencies = [ + "serde", +] + +[[package]] +name = "toml_edit" +version = "0.22.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d59a3a72298453f564e2b111fa896f8d07fabb36f51f06d7e875fc5e0b5a3ef1" +dependencies = [ + "indexmap", + "serde", + "serde_spanned", + "toml_datetime", + "winnow", +] + +[[package]] +name = "typenum" +version = "1.17.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "42ff0bf0c66b8238c6f3b578df37d0b7848e55df8577b3f74f92a69acceeb825" + +[[package]] +name = "unicode-ident" +version = "1.0.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3354b9ac3fae1ff6755cb6db53683adb661634f67557942dea4facebec0fee4b" + +[[package]] +name = "unicode-segmentation" +version = "1.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d4c87d22b6e3f4a18d4d40ef354e97c90fcb14dd91d7dc0aa9d8a1172ebf7202" + +[[package]] +name = "unwrap-infallible" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "151ac09978d3c2862c4e39b557f4eceee2cc72150bc4cb4f16abf061b6e381fb" + +[[package]] +name = "utf8parse" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "06abde3611657adf66d383f00b093d7faecc7fa57071cce2578660c9f1010821" + +[[package]] +name = "version_check" +version = "0.9.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f" + +[[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" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" + +[[package]] +name = "wasmparser" +version = "0.212.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8d28bc49ba1e5c5b61ffa7a2eace10820443c4b7d1c0b144109261d14570fdf8" +dependencies = [ + "ahash", + "bitflags", + "hashbrown", + "indexmap", + "semver", + "serde", +] + +[[package]] +name = "wasmprinter" +version = "0.212.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dfac65326cc561112af88c3028f6dfdb140acff67ede33a8e86be2dc6b8956f7" +dependencies = [ + "anyhow", + "termcolor", + "wasmparser", +] + +[[package]] +name = "winapi-util" +version = "0.1.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4d4cc384e1e73b93bafa6fb4f1df8c41695c8a91cf9c4c64358067d15a7b6c6b" +dependencies = [ + "windows-sys 0.52.0", +] + +[[package]] +name = "windows-sys" +version = "0.48.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "677d2418bec65e3338edb076e806bc1ec15693c5d0104683f2efe857f61056a9" +dependencies = [ + "windows-targets 0.48.5", +] + +[[package]] +name = "windows-sys" +version = "0.52.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "282be5f36a8ce781fad8c8ae18fa3f9beff57ec1b52cb3de0789201425d9a33d" +dependencies = [ + "windows-targets 0.52.6", +] + +[[package]] +name = "windows-targets" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9a2fa6e2155d7247be68c096456083145c183cbbbc2764150dda45a87197940c" +dependencies = [ + "windows_aarch64_gnullvm 0.48.5", + "windows_aarch64_msvc 0.48.5", + "windows_i686_gnu 0.48.5", + "windows_i686_msvc 0.48.5", + "windows_x86_64_gnu 0.48.5", + "windows_x86_64_gnullvm 0.48.5", + "windows_x86_64_msvc 0.48.5", +] + +[[package]] +name = "windows-targets" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9b724f72796e036ab90c1021d4780d4d3d648aca59e491e6b98e725b84e99973" +dependencies = [ + "windows_aarch64_gnullvm 0.52.6", + "windows_aarch64_msvc 0.52.6", + "windows_i686_gnu 0.52.6", + "windows_i686_gnullvm", + "windows_i686_msvc 0.52.6", + "windows_x86_64_gnu 0.52.6", + "windows_x86_64_gnullvm 0.52.6", + "windows_x86_64_msvc 0.52.6", +] + +[[package]] +name = "windows_aarch64_gnullvm" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2b38e32f0abccf9987a4e3079dfb67dcd799fb61361e53e2882c3cbaf0d905d8" + +[[package]] +name = "windows_aarch64_gnullvm" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "32a4622180e7a0ec044bb555404c800bc9fd9ec262ec147edd5989ccd0c02cd3" + +[[package]] +name = "windows_aarch64_msvc" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dc35310971f3b2dbbf3f0690a219f40e2d9afcf64f9ab7cc1be722937c26b4bc" + +[[package]] +name = "windows_aarch64_msvc" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "09ec2a7bb152e2252b53fa7803150007879548bc709c039df7627cabbd05d469" + +[[package]] +name = "windows_i686_gnu" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a75915e7def60c94dcef72200b9a8e58e5091744960da64ec734a6c6e9b3743e" + +[[package]] +name = "windows_i686_gnu" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8e9b5ad5ab802e97eb8e295ac6720e509ee4c243f69d781394014ebfe8bbfa0b" + +[[package]] +name = "windows_i686_gnullvm" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0eee52d38c090b3caa76c563b86c3a4bd71ef1a819287c19d586d7334ae8ed66" + +[[package]] +name = "windows_i686_msvc" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8f55c233f70c4b27f66c523580f78f1004e8b5a8b659e05a4eb49d4166cca406" + +[[package]] +name = "windows_i686_msvc" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "240948bc05c5e7c6dabba28bf89d89ffce3e303022809e73deaefe4f6ec56c66" + +[[package]] +name = "windows_x86_64_gnu" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "53d40abd2583d23e4718fddf1ebec84dbff8381c07cae67ff7768bbf19c6718e" + +[[package]] +name = "windows_x86_64_gnu" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "147a5c80aabfbf0c7d901cb5895d1de30ef2907eb21fbbab29ca94c5b08b1a78" + +[[package]] +name = "windows_x86_64_gnullvm" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0b7b52767868a23d5bab768e390dc5f5c55825b6d30b86c844ff2dc7414044cc" + +[[package]] +name = "windows_x86_64_gnullvm" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "24d5b23dc417412679681396f2b49f3de8c1473deb516bd34410872eff51ed0d" + +[[package]] +name = "windows_x86_64_msvc" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ed94fce61571a4006852b7389a063ab983c02eb1bb37b47f8272ce92d06d9538" + +[[package]] +name = "windows_x86_64_msvc" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec" + +[[package]] +name = "winnow" +version = "0.6.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "59b5e5f6c299a3c7890b876a2a587f3115162487e704907d9b6cd29473052ba1" +dependencies = [ + "memchr", +] + +[[package]] +name = "zerocopy" +version = "0.7.35" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1b9b4fd18abc82b8136838da5d50bae7bdea537c574d8dc1a34ed098d6c166f0" +dependencies = [ + "zerocopy-derive", +] + +[[package]] +name = "zerocopy-derive" +version = "0.7.35" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fa4f8080344d4671fb4e831a13ad1e68092748387dfc4f55e356242fae12ce3e" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "zeroize" +version = "1.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4756f7db3f7b5574938c3eb1c117038b8e07f95ee6718c0efad4ac21508f1efd" +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", +] diff --git a/token-handler/Cargo.toml b/token-handler/Cargo.toml index eea60eee..6e9d4076 100644 --- a/token-handler/Cargo.toml +++ b/token-handler/Cargo.toml @@ -6,7 +6,7 @@ edition = "2021" publish = false [lib] -path = "src/token_handler.rs" +path = "src/lib.rs" [dependencies.multiversx-sc] version = "0.51.1" diff --git a/token-handler/src/burn_tokens.rs b/token-handler/src/burn_tokens.rs new file mode 100644 index 00000000..671cc4ff --- /dev/null +++ b/token-handler/src/burn_tokens.rs @@ -0,0 +1,5 @@ +#[multiversx_sc::module] +pub trait BurnTokens { + #[endpoint(burnTokens)] + fn burn_tokens(&self) {} +} diff --git a/token-handler/src/token_handler.rs b/token-handler/src/lib.rs similarity index 68% rename from token-handler/src/token_handler.rs rename to token-handler/src/lib.rs index 489e0c60..adceb183 100644 --- a/token-handler/src/token_handler.rs +++ b/token-handler/src/lib.rs @@ -3,7 +3,9 @@ #[allow(unused_imports)] use multiversx_sc::imports::*; -/// An empty contract. To be used as a template when starting a new contract from scratch. +pub mod burn_tokens; +pub mod mint_tokens; + #[multiversx_sc::contract] pub trait TokenHandler { #[init] diff --git a/token-handler/src/mint_tokens.rs b/token-handler/src/mint_tokens.rs new file mode 100644 index 00000000..193c2c63 --- /dev/null +++ b/token-handler/src/mint_tokens.rs @@ -0,0 +1,5 @@ +#[multiversx_sc::module] +pub trait MintTokens { + #[endpoint(mintTokens)] + fn mint_tokens(&self) {} +} From 9ef85625b1a51da6898239ada8629e40f1f73776 Mon Sep 17 00:00:00 2001 From: Andrei Baltariu Date: Mon, 15 Jul 2024 13:01:44 +0300 Subject: [PATCH 142/523] Added Operation file and first endpoint for mint Signed-off-by: Andrei Baltariu --- token-handler/src/lib.rs | 1 + token-handler/src/mint_tokens.rs | 6 +- token-handler/src/operation.rs | 140 +++++++++++++++++++++++++++++++ 3 files changed, 146 insertions(+), 1 deletion(-) create mode 100644 token-handler/src/operation.rs diff --git a/token-handler/src/lib.rs b/token-handler/src/lib.rs index adceb183..6d61386e 100644 --- a/token-handler/src/lib.rs +++ b/token-handler/src/lib.rs @@ -5,6 +5,7 @@ use multiversx_sc::imports::*; pub mod burn_tokens; pub mod mint_tokens; +pub mod operation; #[multiversx_sc::contract] pub trait TokenHandler { diff --git a/token-handler/src/mint_tokens.rs b/token-handler/src/mint_tokens.rs index 193c2c63..90acdb57 100644 --- a/token-handler/src/mint_tokens.rs +++ b/token-handler/src/mint_tokens.rs @@ -1,5 +1,9 @@ +use multiversx_sc::types::MultiValueEncoded; + +use crate::operation::OperationEsdtPayment; + #[multiversx_sc::module] pub trait MintTokens { #[endpoint(mintTokens)] - fn mint_tokens(&self) {} + fn mint_tokens(&self, operation_tokens: MultiValueEncoded>) {} } diff --git a/token-handler/src/operation.rs b/token-handler/src/operation.rs new file mode 100644 index 00000000..195809d9 --- /dev/null +++ b/token-handler/src/operation.rs @@ -0,0 +1,140 @@ +multiversx_sc::imports!(); +multiversx_sc::derive_imports!(); + +pub type TxId = u64; +pub type GasLimit = u64; + +#[derive(TopEncode, TopDecode, NestedEncode, NestedDecode, TypeAbi, ManagedVecItem, Clone)] +pub struct Operation { + pub to: ManagedAddress, + pub tokens: ManagedVec>, + pub data: OperationData, +} + +impl Operation { + pub fn get_tokens_as_tuple_arr( + &self, + ) -> MultiValueEncoded, u64, EsdtTokenData>> { + let mut tuple_arr = MultiValueEncoded::new(); + + for token in &self.tokens { + tuple_arr.push(MultiValue3::from(( + token.token_identifier, + token.token_nonce, + token.token_data.into(), + ))); + } + + tuple_arr + } +} + +#[derive(TopEncode, TopDecode, NestedEncode, NestedDecode, TypeAbi, ManagedVecItem, Clone)] +pub struct OperationData { + pub op_nonce: TxId, + pub op_sender: ManagedAddress, + pub opt_transfer_data: Option>, +} + +#[derive(TopEncode, TopDecode, NestedEncode, NestedDecode, TypeAbi, ManagedVecItem, Clone)] +pub struct OperationTuple { + pub op_hash: ManagedBuffer, + pub operation: Operation, +} + +#[derive(TopEncode, TopDecode, NestedEncode, NestedDecode, TypeAbi, ManagedVecItem, Clone)] +pub struct OperationEsdtPayment { + pub token_identifier: TokenIdentifier, + pub token_nonce: u64, + pub token_data: StolenFromFrameworkEsdtTokenData, +} + +impl From> for EsdtTokenPayment { + fn from(payment: OperationEsdtPayment) -> Self { + EsdtTokenPayment { + token_identifier: payment.token_identifier, + token_nonce: payment.token_nonce, + amount: payment.token_data.amount, + } + } +} + +impl Default for OperationEsdtPayment { + fn default() -> Self { + OperationEsdtPayment { + token_identifier: TokenIdentifier::from(ManagedBuffer::new()), + token_nonce: 0, + token_data: StolenFromFrameworkEsdtTokenData::default(), + } + } +} + +#[derive(TopEncode, TopDecode, NestedEncode, NestedDecode, TypeAbi, ManagedVecItem, Clone)] +pub struct TransferData { + pub gas_limit: GasLimit, + pub function: ManagedBuffer, + pub args: ManagedVec>, +} + +#[derive( + TopDecode, TopEncode, NestedDecode, NestedEncode, TypeAbi, Debug, ManagedVecItem, Clone, +)] +pub struct StolenFromFrameworkEsdtTokenData { + pub token_type: EsdtTokenType, + pub amount: BigUint, + pub frozen: bool, + pub hash: ManagedBuffer, + pub name: ManagedBuffer, + pub attributes: ManagedBuffer, + pub creator: ManagedAddress, + pub royalties: BigUint, + pub uris: ManagedVec>, +} + +impl Default for StolenFromFrameworkEsdtTokenData { + fn default() -> Self { + StolenFromFrameworkEsdtTokenData { + token_type: EsdtTokenType::Fungible, + amount: BigUint::zero(), + frozen: false, + hash: ManagedBuffer::new(), + name: ManagedBuffer::new(), + attributes: ManagedBuffer::new(), + creator: ManagedAddress::zero(), + royalties: BigUint::zero(), + uris: ManagedVec::new(), + } + } +} + +impl From> for StolenFromFrameworkEsdtTokenData { + fn from(value: EsdtTokenData) -> Self { + StolenFromFrameworkEsdtTokenData { + token_type: value.token_type, + amount: value.amount, + frozen: value.frozen, + hash: value.hash, + name: value.name, + attributes: value.attributes, + creator: value.creator, + royalties: value.royalties, + uris: value.uris, + } + } +} + +impl From> for EsdtTokenData { + fn from(token_data: StolenFromFrameworkEsdtTokenData) -> Self { + EsdtTokenData { + token_type: token_data.token_type, + amount: token_data.amount, + frozen: token_data.frozen, + hash: token_data.hash, + name: token_data.name, + attributes: token_data.attributes, + creator: token_data.creator, + royalties: token_data.royalties, + uris: token_data.uris, + } + } +} From f2d56af37938022cedfe9e48b6dcbf3689da61c6 Mon Sep 17 00:00:00 2001 From: Andrei Baltariu Date: Mon, 15 Jul 2024 14:56:24 +0300 Subject: [PATCH 143/523] Modified tests setup for registering tokens Signed-off-by: Andrei Baltariu --- .../tests/enshrine_esdt_safe_blackbox_test.rs | 69 ++++++++----------- 1 file changed, 27 insertions(+), 42 deletions(-) diff --git a/enshrine-esdt-safe/tests/enshrine_esdt_safe_blackbox_test.rs b/enshrine-esdt-safe/tests/enshrine_esdt_safe_blackbox_test.rs index 4300c63c..2b13e406 100644 --- a/enshrine-esdt-safe/tests/enshrine_esdt_safe_blackbox_test.rs +++ b/enshrine-esdt-safe/tests/enshrine_esdt_safe_blackbox_test.rs @@ -34,7 +34,13 @@ const FUNGIBLE_TOKEN_ID: TestTokenIdentifier = TestTokenIdentifier::new("CROWD-1 const PREFIX_NFT_TOKEN_ID: TestTokenIdentifier = TestTokenIdentifier::new("sov-NFT-123456"); const WEGLD_IDENTIFIER: TestTokenIdentifier = TestTokenIdentifier::new("WEGLD-123456"); -const SOVEREIGN_TOKEN_PREFIX: &str = "sov-"; +const WEGLD_BALANCE: u128 = 100_000_000_000_000_000; +const SOVEREIGN_TOKEN_PREFIX: &str = "sov"; + +pub struct ErrorStatus<'a> { + code: u64, + error_message: &'a str, +} fn world() -> ScenarioWorld { let mut blockchain = ScenarioWorld::new(); @@ -56,10 +62,7 @@ impl EnshrineTestState { world .account(ENSHRINE_ESDT_OWNER_ADDRESS) .esdt_balance(FUNGIBLE_TOKEN_ID, 100_000) - .esdt_balance( - WEGLD_IDENTIFIER, - BigUint::from(100_000_000_000_000_000 as u128), - ) + .esdt_balance(WEGLD_IDENTIFIER, BigUint::from(WEGLD_BALANCE)) .esdt_nft_balance(NFT_TOKEN_ID, 1, 100_000, ManagedBuffer::new()) .nonce(1) .balance(ENSHRINE_OWNER_BALANCE); @@ -210,37 +213,11 @@ impl EnshrineTestState { .run(); } - fn propose_register_tokens_insufficient_funds( - &mut self, - token_ids: Vec, - err_message: &str, - err_code: u64, - ) { - let mut managed_token_ids: MultiValueEncoded> = - MultiValueEncoded::new(); - - for token_id in token_ids { - managed_token_ids.push(TokenIdentifier::from(token_id)) - } - - let wegld_amount = BigUint::from(DEFAULT_ISSUE_COST * managed_token_ids.len() as u64); - let wegld_payment = EsdtTokenPayment::new(WEGLD_IDENTIFIER.into(), 0, wegld_amount); - - self.world - .tx() - .from(USER_ADDRESS) - .to(ENSHRINE_ESDT_ADDRESS) - .typed(enshrine_esdt_safe_proxy::EnshrineEsdtSafeProxy) - .register_new_token_id(managed_token_ids) - .returns(ExpectError(err_code, err_message)) - .esdt(wegld_payment) - .run(); - } - fn propose_register_tokens( &mut self, + sender: &TestAddress, token_ids: Vec, - opt_err_message: Option<&str>, + error_status: Option, ) { let mut managed_token_ids: MultiValueEncoded> = MultiValueEncoded::new(); @@ -252,21 +229,21 @@ impl EnshrineTestState { let wegld_amount = BigUint::from(DEFAULT_ISSUE_COST * managed_token_ids.len() as u64); let wegld_payment = EsdtTokenPayment::new(WEGLD_IDENTIFIER.into(), 0, wegld_amount); - match opt_err_message { - Some(err_msg) => self + match error_status { + Some(status) => self .world .tx() - .from(ENSHRINE_ESDT_OWNER_ADDRESS) + .from(sender.clone()) .to(ENSHRINE_ESDT_ADDRESS) .typed(enshrine_esdt_safe_proxy::EnshrineEsdtSafeProxy) .register_new_token_id(managed_token_ids) - .returns(ExpectError(4, err_msg)) + .returns(ExpectError(status.code, status.error_message)) .esdt(wegld_payment) .run(), None => self .world .tx() - .from(ENSHRINE_ESDT_OWNER_ADDRESS) + .from(sender.clone()) .to(ENSHRINE_ESDT_ADDRESS) .typed(enshrine_esdt_safe_proxy::EnshrineEsdtSafeProxy) .register_new_token_id(managed_token_ids) @@ -352,13 +329,17 @@ fn test_sovereign_prefix_has_prefix() { #[test] fn test_register_tokens_insufficient_funds() { let mut state = EnshrineTestState::new(); + let code = 10u64; let error_message = "insufficient funds"; state.propose_setup_contracts(false); - state.propose_register_tokens_insufficient_funds( + state.propose_register_tokens( + &USER_ADDRESS, Vec::from([PREFIX_NFT_TOKEN_ID, FUNGIBLE_TOKEN_ID]), - error_message, - 10, + Some(ErrorStatus { + code, + error_message, + }), ); } @@ -367,5 +348,9 @@ fn test_register_tokens() { let mut state = EnshrineTestState::new(); state.propose_setup_contracts(false); - state.propose_register_tokens(Vec::from([PREFIX_NFT_TOKEN_ID, FUNGIBLE_TOKEN_ID]), None); + state.propose_register_tokens( + &ENSHRINE_ESDT_OWNER_ADDRESS, + Vec::from([PREFIX_NFT_TOKEN_ID, FUNGIBLE_TOKEN_ID]), + None, + ); } From 49c631d188ebc56a59526a406180cee6912c307e Mon Sep 17 00:00:00 2001 From: Andrei Baltariu Date: Mon, 15 Jul 2024 15:37:27 +0300 Subject: [PATCH 144/523] Added balance check for registering tokens test Signed-off-by: Andrei Baltariu --- .../tests/enshrine_esdt_safe_blackbox_test.rs | 21 ++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/enshrine-esdt-safe/tests/enshrine_esdt_safe_blackbox_test.rs b/enshrine-esdt-safe/tests/enshrine_esdt_safe_blackbox_test.rs index 2b13e406..61231331 100644 --- a/enshrine-esdt-safe/tests/enshrine_esdt_safe_blackbox_test.rs +++ b/enshrine-esdt-safe/tests/enshrine_esdt_safe_blackbox_test.rs @@ -299,6 +299,16 @@ impl EnshrineTestState { ManagedBuffer::new_from_bytes(&sha256) } + + fn propose_check_wegld_balance( + &mut self, + account: TestAddress, + wegld_amount: BigUint, + ) { + self.world + .check_account(account) + .esdt_balance(WEGLD_IDENTIFIER, wegld_amount); + } } #[test] @@ -346,11 +356,12 @@ fn test_register_tokens_insufficient_funds() { #[test] fn test_register_tokens() { let mut state = EnshrineTestState::new(); + let token_vec = Vec::from([PREFIX_NFT_TOKEN_ID, FUNGIBLE_TOKEN_ID]); state.propose_setup_contracts(false); - state.propose_register_tokens( - &ENSHRINE_ESDT_OWNER_ADDRESS, - Vec::from([PREFIX_NFT_TOKEN_ID, FUNGIBLE_TOKEN_ID]), - None, - ); + state.propose_register_tokens(&ENSHRINE_ESDT_OWNER_ADDRESS, token_vec, None); + state + .world + .check_account(ENSHRINE_ESDT_OWNER_ADDRESS) + .esdt_balance(WEGLD_IDENTIFIER, BigUint::zero()); } From f21c380ddddd03b102d5158a522f4bf8a2b2de84 Mon Sep 17 00:00:00 2001 From: Andrei Baltariu Date: Mon, 15 Jul 2024 15:42:04 +0300 Subject: [PATCH 145/523] Added ErrorStatus for test and moved functions Signed-off-by: Andrei Baltariu --- .../tests/enshrine_esdt_safe_blackbox_test.rs | 58 ++++++++----------- 1 file changed, 24 insertions(+), 34 deletions(-) diff --git a/enshrine-esdt-safe/tests/enshrine_esdt_safe_blackbox_test.rs b/enshrine-esdt-safe/tests/enshrine_esdt_safe_blackbox_test.rs index 61231331..0eaf4a13 100644 --- a/enshrine-esdt-safe/tests/enshrine_esdt_safe_blackbox_test.rs +++ b/enshrine-esdt-safe/tests/enshrine_esdt_safe_blackbox_test.rs @@ -79,6 +79,26 @@ impl EnshrineTestState { Self { world } } + fn propose_set_unpaused(&mut self) { + self.world + .tx() + .from(ENSHRINE_ESDT_OWNER_ADDRESS) + .to(ENSHRINE_ESDT_ADDRESS) + .typed(enshrine_esdt_safe_proxy::EnshrineEsdtSafeProxy) + .unpause_endpoint() + .run(); + } + + fn propose_set_header_verifier_address(&mut self) { + self.world + .tx() + .from(ENSHRINE_ESDT_OWNER_ADDRESS) + .to(ENSHRINE_ESDT_ADDRESS) + .typed(enshrine_esdt_safe_proxy::EnshrineEsdtSafeProxy) + .set_header_verifier_address(HEADER_VERIFIER_ADDRESS) + .run(); + } + fn deploy_enshrine_esdt_contract( &mut self, is_sovereign_chain: bool, @@ -128,7 +148,7 @@ impl EnshrineTestState { self } - fn propose_execute_operation(&mut self, has_prefix: bool, error_msg: Option<&str>) { + fn propose_execute_operation(&mut self, has_prefix: bool, error_status: Option) { let (tokens, data) = if has_prefix { self.setup_payments(vec![PREFIX_NFT_TOKEN_ID, FUNGIBLE_TOKEN_ID]) } else { @@ -140,15 +160,15 @@ impl EnshrineTestState { let hash_of_hashes: ManagedBuffer = ManagedBuffer::from(&sha256(&operation_hash.to_vec())); - match error_msg { - Some(msg) => { + match error_status { + Some(status) => { self.world .tx() .from(USER_ADDRESS) .to(ENSHRINE_ESDT_ADDRESS) .typed(enshrine_esdt_safe_proxy::EnshrineEsdtSafeProxy) .execute_operations(hash_of_hashes, operation) - .returns(ExpectError(10, msg)) + .returns(ExpectError(status.code, status.error_message)) .run(); } @@ -164,26 +184,6 @@ impl EnshrineTestState { } } - fn propose_set_unpaused(&mut self) { - self.world - .tx() - .from(ENSHRINE_ESDT_OWNER_ADDRESS) - .to(ENSHRINE_ESDT_ADDRESS) - .typed(enshrine_esdt_safe_proxy::EnshrineEsdtSafeProxy) - .unpause_endpoint() - .run(); - } - - fn propose_set_header_verifier_address(&mut self) { - self.world - .tx() - .from(ENSHRINE_ESDT_OWNER_ADDRESS) - .to(ENSHRINE_ESDT_ADDRESS) - .typed(enshrine_esdt_safe_proxy::EnshrineEsdtSafeProxy) - .set_header_verifier_address(HEADER_VERIFIER_ADDRESS) - .run(); - } - fn propose_register_operation(&mut self, has_prefix: bool) { let (tokens, data) = if has_prefix { self.setup_payments(vec![PREFIX_NFT_TOKEN_ID, FUNGIBLE_TOKEN_ID]) @@ -299,16 +299,6 @@ impl EnshrineTestState { ManagedBuffer::new_from_bytes(&sha256) } - - fn propose_check_wegld_balance( - &mut self, - account: TestAddress, - wegld_amount: BigUint, - ) { - self.world - .check_account(account) - .esdt_balance(WEGLD_IDENTIFIER, wegld_amount); - } } #[test] From 392fba422dcc82cd9d90dbe372b811654fc1a7ec Mon Sep 17 00:00:00 2001 From: Andrei Baltariu Date: Mon, 15 Jul 2024 22:15:25 +0300 Subject: [PATCH 146/523] Added wrong fee token test Signed-off-by: Andrei Baltariu --- .../tests/enshrine_esdt_safe_blackbox_test.rs | 35 ++++++++++++++++--- 1 file changed, 30 insertions(+), 5 deletions(-) diff --git a/enshrine-esdt-safe/tests/enshrine_esdt_safe_blackbox_test.rs b/enshrine-esdt-safe/tests/enshrine_esdt_safe_blackbox_test.rs index 0eaf4a13..7f9bc28a 100644 --- a/enshrine-esdt-safe/tests/enshrine_esdt_safe_blackbox_test.rs +++ b/enshrine-esdt-safe/tests/enshrine_esdt_safe_blackbox_test.rs @@ -61,7 +61,7 @@ impl EnshrineTestState { world .account(ENSHRINE_ESDT_OWNER_ADDRESS) - .esdt_balance(FUNGIBLE_TOKEN_ID, 100_000) + .esdt_balance(FUNGIBLE_TOKEN_ID, BigUint::from(WEGLD_BALANCE)) .esdt_balance(WEGLD_IDENTIFIER, BigUint::from(WEGLD_BALANCE)) .esdt_nft_balance(NFT_TOKEN_ID, 1, 100_000, ManagedBuffer::new()) .nonce(1) @@ -216,18 +216,19 @@ impl EnshrineTestState { fn propose_register_tokens( &mut self, sender: &TestAddress, - token_ids: Vec, + token_fee: &TestTokenIdentifier, + tokens_to_register: Vec, error_status: Option, ) { let mut managed_token_ids: MultiValueEncoded> = MultiValueEncoded::new(); - for token_id in token_ids { + for token_id in tokens_to_register { managed_token_ids.push(TokenIdentifier::from(token_id)) } let wegld_amount = BigUint::from(DEFAULT_ISSUE_COST * managed_token_ids.len() as u64); - let wegld_payment = EsdtTokenPayment::new(WEGLD_IDENTIFIER.into(), 0, wegld_amount); + let wegld_payment = EsdtTokenPayment::new(token_fee.clone().into(), 0, wegld_amount); match error_status { Some(status) => self @@ -335,6 +336,25 @@ fn test_register_tokens_insufficient_funds() { state.propose_setup_contracts(false); state.propose_register_tokens( &USER_ADDRESS, + &WEGLD_IDENTIFIER, + Vec::from([PREFIX_NFT_TOKEN_ID, FUNGIBLE_TOKEN_ID]), + Some(ErrorStatus { + code, + error_message, + }), + ); +} + +#[test] +fn test_register_tokens_wrong_token_as_fee() { + let mut state = EnshrineTestState::new(); + let code = 4u64; + let error_message = "WEGLD is the only token accepted as register fee"; + + state.propose_setup_contracts(false); + state.propose_register_tokens( + &ENSHRINE_ESDT_OWNER_ADDRESS, + &FUNGIBLE_TOKEN_ID, Vec::from([PREFIX_NFT_TOKEN_ID, FUNGIBLE_TOKEN_ID]), Some(ErrorStatus { code, @@ -349,7 +369,12 @@ fn test_register_tokens() { let token_vec = Vec::from([PREFIX_NFT_TOKEN_ID, FUNGIBLE_TOKEN_ID]); state.propose_setup_contracts(false); - state.propose_register_tokens(&ENSHRINE_ESDT_OWNER_ADDRESS, token_vec, None); + state.propose_register_tokens( + &ENSHRINE_ESDT_OWNER_ADDRESS, + &WEGLD_IDENTIFIER, + token_vec, + None, + ); state .world .check_account(ENSHRINE_ESDT_OWNER_ADDRESS) From 3202a2960ca65579228635ed7ec75ce1b475a042 Mon Sep 17 00:00:00 2001 From: Andrei Baltariu Date: Tue, 16 Jul 2024 10:31:32 +0300 Subject: [PATCH 147/523] Cleanup test setups to be more easier to call Signed-off-by: Andrei Baltariu --- .../tests/enshrine_esdt_safe_blackbox_test.rs | 92 ++++++++++++++----- 1 file changed, 69 insertions(+), 23 deletions(-) diff --git a/enshrine-esdt-safe/tests/enshrine_esdt_safe_blackbox_test.rs b/enshrine-esdt-safe/tests/enshrine_esdt_safe_blackbox_test.rs index 7f9bc28a..23f69161 100644 --- a/enshrine-esdt-safe/tests/enshrine_esdt_safe_blackbox_test.rs +++ b/enshrine-esdt-safe/tests/enshrine_esdt_safe_blackbox_test.rs @@ -27,10 +27,12 @@ const HEADER_VERIFIER_CODE_PATH: MxscPath = MxscPath::new("../header-verifier/output/header-verifier.mxsc.json"); const USER_ADDRESS: TestAddress = TestAddress::new("user"); +const INSUFFICIENT_WEGLD_ADDRESS: TestAddress = TestAddress::new("insufficient_wegld"); const RECEIVER_ADDRESS: TestAddress = TestAddress::new("receiver"); const NFT_TOKEN_ID: TestTokenIdentifier = TestTokenIdentifier::new("NFT-123456"); -const FUNGIBLE_TOKEN_ID: TestTokenIdentifier = TestTokenIdentifier::new("CROWD-123456"); +const CROWD_TOKEN_ID: TestTokenIdentifier = TestTokenIdentifier::new("CROWD-123456"); +const FUNGIBLE_TOKEN_ID: TestTokenIdentifier = TestTokenIdentifier::new("FUNG-123456"); const PREFIX_NFT_TOKEN_ID: TestTokenIdentifier = TestTokenIdentifier::new("sov-NFT-123456"); const WEGLD_IDENTIFIER: TestTokenIdentifier = TestTokenIdentifier::new("WEGLD-123456"); @@ -61,16 +63,27 @@ impl EnshrineTestState { world .account(ENSHRINE_ESDT_OWNER_ADDRESS) - .esdt_balance(FUNGIBLE_TOKEN_ID, BigUint::from(WEGLD_BALANCE)) + .esdt_balance(CROWD_TOKEN_ID, BigUint::from(WEGLD_BALANCE)) .esdt_balance(WEGLD_IDENTIFIER, BigUint::from(WEGLD_BALANCE)) + .esdt_balance(FUNGIBLE_TOKEN_ID, BigUint::from(WEGLD_BALANCE)) .esdt_nft_balance(NFT_TOKEN_ID, 1, 100_000, ManagedBuffer::new()) + .esdt_nft_balance(PREFIX_NFT_TOKEN_ID, 1, 100_000, ManagedBuffer::new()) .nonce(1) .balance(ENSHRINE_OWNER_BALANCE); world .account(USER_ADDRESS) .esdt_nft_balance(NFT_TOKEN_ID, 1, 100_000, ManagedBuffer::new()) - .esdt_balance(FUNGIBLE_TOKEN_ID, 100_000) + .esdt_balance(CROWD_TOKEN_ID, 100_000) + .balance(USER_EGLD_BALANCE) + .nonce(1); + + world + .account(INSUFFICIENT_WEGLD_ADDRESS) + .esdt_nft_balance(NFT_TOKEN_ID, 1, 100_000, ManagedBuffer::new()) + .esdt_balance(WEGLD_IDENTIFIER, BigUint::from(WEGLD_BALANCE + 100_000)) + .esdt_balance(FUNGIBLE_TOKEN_ID, BigUint::from(WEGLD_BALANCE)) + .esdt_balance(CROWD_TOKEN_ID, BigUint::from(WEGLD_BALANCE)) .balance(USER_EGLD_BALANCE) .nonce(1); @@ -148,11 +161,16 @@ impl EnshrineTestState { self } - fn propose_execute_operation(&mut self, has_prefix: bool, error_status: Option) { + fn propose_execute_operation( + &mut self, + has_prefix: bool, + error_status: Option, + tokens: &Vec, + ) { let (tokens, data) = if has_prefix { - self.setup_payments(vec![PREFIX_NFT_TOKEN_ID, FUNGIBLE_TOKEN_ID]) + self.setup_payments(tokens) } else { - self.setup_payments(vec![NFT_TOKEN_ID, FUNGIBLE_TOKEN_ID]) + self.setup_payments(tokens) }; let to = managed_address!(&Address::from(&RECEIVER_ADDRESS.eval_to_array())); let operation = Operation { to, tokens, data }; @@ -184,11 +202,11 @@ impl EnshrineTestState { } } - fn propose_register_operation(&mut self, has_prefix: bool) { + fn propose_register_operation(&mut self, has_prefix: bool, tokens: &Vec) { let (tokens, data) = if has_prefix { - self.setup_payments(vec![PREFIX_NFT_TOKEN_ID, FUNGIBLE_TOKEN_ID]) + self.setup_payments(tokens) } else { - self.setup_payments(vec![NFT_TOKEN_ID, FUNGIBLE_TOKEN_ID]) + self.setup_payments(tokens) }; let to = managed_address!(&Address::from(RECEIVER_ADDRESS.eval_to_array())); let operation = Operation { to, tokens, data }; @@ -227,8 +245,8 @@ impl EnshrineTestState { managed_token_ids.push(TokenIdentifier::from(token_id)) } - let wegld_amount = BigUint::from(DEFAULT_ISSUE_COST * managed_token_ids.len() as u64); - let wegld_payment = EsdtTokenPayment::new(token_fee.clone().into(), 0, wegld_amount); + let payment_amount = BigUint::from(DEFAULT_ISSUE_COST * managed_token_ids.len() as u64); + let payment = EsdtTokenPayment::new(token_fee.clone().into(), 0, payment_amount); match error_status { Some(status) => self @@ -239,7 +257,7 @@ impl EnshrineTestState { .typed(enshrine_esdt_safe_proxy::EnshrineEsdtSafeProxy) .register_new_token_id(managed_token_ids) .returns(ExpectError(status.code, status.error_message)) - .esdt(wegld_payment) + .esdt(payment) .run(), None => self .world @@ -248,7 +266,7 @@ impl EnshrineTestState { .to(ENSHRINE_ESDT_ADDRESS) .typed(enshrine_esdt_safe_proxy::EnshrineEsdtSafeProxy) .register_new_token_id(managed_token_ids) - .esdt(wegld_payment) + .esdt(payment) .run(), } } @@ -266,7 +284,7 @@ impl EnshrineTestState { fn setup_payments( &mut self, - token_ids: Vec, + token_ids: &Vec, ) -> ( ManagedVec>, OperationData, @@ -275,7 +293,7 @@ impl EnshrineTestState { for token_id in token_ids { let payment: OperationEsdtPayment = OperationEsdtPayment { - token_identifier: token_id.into(), + token_identifier: token_id.clone().into(), token_nonce: 1, token_data: StolenFromFrameworkEsdtTokenData::default(), }; @@ -312,24 +330,27 @@ fn test_deploy() { #[test] fn test_sovereign_prefix_no_prefix() { let mut state = EnshrineTestState::new(); + let token_vec = Vec::from([NFT_TOKEN_ID, CROWD_TOKEN_ID]); state.propose_setup_contracts(false); - state.propose_register_operation(false); - state.propose_execute_operation(false, None); + state.propose_register_operation(false, &token_vec); + state.propose_execute_operation(false, None, &token_vec); } #[test] fn test_sovereign_prefix_has_prefix() { let mut state = EnshrineTestState::new(); + let token_vec = Vec::from([PREFIX_NFT_TOKEN_ID, CROWD_TOKEN_ID]); state.propose_setup_contracts(false); - state.propose_register_operation(true); - state.propose_execute_operation(true, None); + state.propose_register_operation(true, &token_vec); + state.propose_execute_operation(true, None, &token_vec); } #[test] fn test_register_tokens_insufficient_funds() { let mut state = EnshrineTestState::new(); + let token_vec = Vec::from([PREFIX_NFT_TOKEN_ID, CROWD_TOKEN_ID]); let code = 10u64; let error_message = "insufficient funds"; @@ -337,7 +358,7 @@ fn test_register_tokens_insufficient_funds() { state.propose_register_tokens( &USER_ADDRESS, &WEGLD_IDENTIFIER, - Vec::from([PREFIX_NFT_TOKEN_ID, FUNGIBLE_TOKEN_ID]), + token_vec, Some(ErrorStatus { code, error_message, @@ -348,14 +369,15 @@ fn test_register_tokens_insufficient_funds() { #[test] fn test_register_tokens_wrong_token_as_fee() { let mut state = EnshrineTestState::new(); + let token_vec = Vec::from([PREFIX_NFT_TOKEN_ID, CROWD_TOKEN_ID]); let code = 4u64; let error_message = "WEGLD is the only token accepted as register fee"; state.propose_setup_contracts(false); state.propose_register_tokens( &ENSHRINE_ESDT_OWNER_ADDRESS, - &FUNGIBLE_TOKEN_ID, - Vec::from([PREFIX_NFT_TOKEN_ID, FUNGIBLE_TOKEN_ID]), + &CROWD_TOKEN_ID, + token_vec, Some(ErrorStatus { code, error_message, @@ -366,7 +388,7 @@ fn test_register_tokens_wrong_token_as_fee() { #[test] fn test_register_tokens() { let mut state = EnshrineTestState::new(); - let token_vec = Vec::from([PREFIX_NFT_TOKEN_ID, FUNGIBLE_TOKEN_ID]); + let token_vec = Vec::from([PREFIX_NFT_TOKEN_ID, CROWD_TOKEN_ID]); state.propose_setup_contracts(false); state.propose_register_tokens( @@ -380,3 +402,27 @@ fn test_register_tokens() { .check_account(ENSHRINE_ESDT_OWNER_ADDRESS) .esdt_balance(WEGLD_IDENTIFIER, BigUint::zero()); } +// +// #[test] +// fn test_register_tokens_insufficient_wegld() { +// let mut state = EnshrineTestState::new(); +// let token_vec = Vec::from([ +// NFT_TOKEN_ID, +// PREFIX_NFT_TOKEN_ID, +// FUNGIBLE_TOKEN_ID, +// CROWD_TOKEN_ID, +// ]); +// let code = 10u64; +// let error_message = "WEGLD fee amount is not met"; +// +// state.propose_setup_contracts(false); +// state.propose_register_tokens( +// &ENSHRINE_ESDT_OWNER_ADDRESS, +// &WEGLD_IDENTIFIER, +// token_vec, +// Some(ErrorStatus { +// code, +// error_message, +// }), +// ); +// } From 07a233f39739e54ab6395db81a0e0fd4f0ec3a64 Mon Sep 17 00:00:00 2001 From: Andrei Baltariu Date: Tue, 16 Jul 2024 14:28:14 +0300 Subject: [PATCH 148/523] Added mint logic Signed-off-by: Andrei Baltariu --- token-handler/Cargo.lock | 26 ++++++++++++++++++++++++++ token-handler/Cargo.toml | 9 +++++++++ token-handler/src/events.rs | 0 token-handler/src/lib.rs | 2 +- token-handler/src/mint_tokens.rs | 22 +++++++++++++++++----- 5 files changed, 53 insertions(+), 6 deletions(-) create mode 100644 token-handler/src/events.rs diff --git a/token-handler/Cargo.lock b/token-handler/Cargo.lock index 91b43380..899fb58d 100644 --- a/token-handler/Cargo.lock +++ b/token-handler/Cargo.lock @@ -117,6 +117,14 @@ dependencies = [ "generic-array", ] +[[package]] +name = "bls-signature" +version = "0.0.0" +dependencies = [ + "multiversx-sc", + "transaction", +] + [[package]] name = "byteorder" version = "1.5.0" @@ -863,9 +871,12 @@ dependencies = [ name = "token-handler" version = "0.0.0" dependencies = [ + "bls-signature", "multiversx-sc", "multiversx-sc-scenario", "num-bigint", + "transaction", + "utils", ] [[package]] @@ -911,6 +922,13 @@ dependencies = [ "winnow", ] +[[package]] +name = "transaction" +version = "0.0.0" +dependencies = [ + "multiversx-sc", +] + [[package]] name = "typenum" version = "1.17.0" @@ -941,6 +959,14 @@ version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "06abde3611657adf66d383f00b093d7faecc7fa57071cce2578660c9f1010821" +[[package]] +name = "utils" +version = "0.0.0" +dependencies = [ + "bls-signature", + "multiversx-sc", +] + [[package]] name = "version_check" version = "0.9.4" diff --git a/token-handler/Cargo.toml b/token-handler/Cargo.toml index 6e9d4076..a625d0f9 100644 --- a/token-handler/Cargo.toml +++ b/token-handler/Cargo.toml @@ -8,6 +8,15 @@ publish = false [lib] path = "src/lib.rs" +[dependencies.utils] +path = "../common/utils" + +[dependencies.transaction] +path = "../common/transaction" + +[dependencies.bls-signature] +path = "../common/bls-signature/" + [dependencies.multiversx-sc] version = "0.51.1" diff --git a/token-handler/src/events.rs b/token-handler/src/events.rs new file mode 100644 index 00000000..e69de29b diff --git a/token-handler/src/lib.rs b/token-handler/src/lib.rs index 6d61386e..1de2947b 100644 --- a/token-handler/src/lib.rs +++ b/token-handler/src/lib.rs @@ -4,8 +4,8 @@ use multiversx_sc::imports::*; pub mod burn_tokens; +pub mod events; pub mod mint_tokens; -pub mod operation; #[multiversx_sc::contract] pub trait TokenHandler { diff --git a/token-handler/src/mint_tokens.rs b/token-handler/src/mint_tokens.rs index 90acdb57..90829fd0 100644 --- a/token-handler/src/mint_tokens.rs +++ b/token-handler/src/mint_tokens.rs @@ -1,9 +1,21 @@ -use multiversx_sc::types::MultiValueEncoded; - -use crate::operation::OperationEsdtPayment; +use multiversx_sc::err_msg; +use multiversx_sc::{ + imports::SingleValueMapper, + types::{ManagedVec, MultiValueEncoded}, +}; +use transaction::OperationEsdtPayment; #[multiversx_sc::module] -pub trait MintTokens { +pub trait MintTokens: utils::UtilsModule + bls_signature::BlsSignatureModule { #[endpoint(mintTokens)] - fn mint_tokens(&self, operation_tokens: MultiValueEncoded>) {} + fn mint_tokens(&self, operation_tokens: MultiValueEncoded>) { + let output_payments = ManagedVec::new(); + + for operation_token in operation_tokens { + if self.has_sov_prefix(&operation_token.token_identifier, self.sov_prefix().get()) {} + } + } + + #[storage_mapper] + fn sov_prefix(&self) -> SingleValueMapper; } From 67f6f9e5741a4f2e706a0e8a99cd80449321f554 Mon Sep 17 00:00:00 2001 From: Andrei Baltariu Date: Tue, 16 Jul 2024 14:45:12 +0300 Subject: [PATCH 149/523] Modified argument to take esdt payment instead of token id Signed-off-by: Andrei Baltariu --- .../tests/enshrine_esdt_safe_blackbox_test.rs | 26 +++++++++---------- 1 file changed, 12 insertions(+), 14 deletions(-) diff --git a/enshrine-esdt-safe/tests/enshrine_esdt_safe_blackbox_test.rs b/enshrine-esdt-safe/tests/enshrine_esdt_safe_blackbox_test.rs index 23f69161..86370f6a 100644 --- a/enshrine-esdt-safe/tests/enshrine_esdt_safe_blackbox_test.rs +++ b/enshrine-esdt-safe/tests/enshrine_esdt_safe_blackbox_test.rs @@ -234,7 +234,7 @@ impl EnshrineTestState { fn propose_register_tokens( &mut self, sender: &TestAddress, - token_fee: &TestTokenIdentifier, + fee_payment: EsdtTokenPayment, tokens_to_register: Vec, error_status: Option, ) { @@ -245,9 +245,6 @@ impl EnshrineTestState { managed_token_ids.push(TokenIdentifier::from(token_id)) } - let payment_amount = BigUint::from(DEFAULT_ISSUE_COST * managed_token_ids.len() as u64); - let payment = EsdtTokenPayment::new(token_fee.clone().into(), 0, payment_amount); - match error_status { Some(status) => self .world @@ -257,7 +254,7 @@ impl EnshrineTestState { .typed(enshrine_esdt_safe_proxy::EnshrineEsdtSafeProxy) .register_new_token_id(managed_token_ids) .returns(ExpectError(status.code, status.error_message)) - .esdt(payment) + .esdt(fee_payment) .run(), None => self .world @@ -266,7 +263,7 @@ impl EnshrineTestState { .to(ENSHRINE_ESDT_ADDRESS) .typed(enshrine_esdt_safe_proxy::EnshrineEsdtSafeProxy) .register_new_token_id(managed_token_ids) - .esdt(payment) + .esdt(fee_payment) .run(), } } @@ -353,11 +350,13 @@ fn test_register_tokens_insufficient_funds() { let token_vec = Vec::from([PREFIX_NFT_TOKEN_ID, CROWD_TOKEN_ID]); let code = 10u64; let error_message = "insufficient funds"; + let payment_amount = BigUint::from(DEFAULT_ISSUE_COST * token_vec.len() as u64); + let payment = EsdtTokenPayment::new(WEGLD_IDENTIFIER.into(), 0, payment_amount); state.propose_setup_contracts(false); state.propose_register_tokens( &USER_ADDRESS, - &WEGLD_IDENTIFIER, + payment, token_vec, Some(ErrorStatus { code, @@ -372,11 +371,13 @@ fn test_register_tokens_wrong_token_as_fee() { let token_vec = Vec::from([PREFIX_NFT_TOKEN_ID, CROWD_TOKEN_ID]); let code = 4u64; let error_message = "WEGLD is the only token accepted as register fee"; + let payment_amount = BigUint::from(DEFAULT_ISSUE_COST * token_vec.len() as u64); + let payment = EsdtTokenPayment::new(CROWD_TOKEN_ID.into(), 0, payment_amount); state.propose_setup_contracts(false); state.propose_register_tokens( &ENSHRINE_ESDT_OWNER_ADDRESS, - &CROWD_TOKEN_ID, + payment, token_vec, Some(ErrorStatus { code, @@ -389,14 +390,11 @@ fn test_register_tokens_wrong_token_as_fee() { fn test_register_tokens() { let mut state = EnshrineTestState::new(); let token_vec = Vec::from([PREFIX_NFT_TOKEN_ID, CROWD_TOKEN_ID]); + let payment_amount = BigUint::from(DEFAULT_ISSUE_COST * token_vec.len() as u64); + let payment = EsdtTokenPayment::new(WEGLD_IDENTIFIER.into(), 0, payment_amount); state.propose_setup_contracts(false); - state.propose_register_tokens( - &ENSHRINE_ESDT_OWNER_ADDRESS, - &WEGLD_IDENTIFIER, - token_vec, - None, - ); + state.propose_register_tokens(&ENSHRINE_ESDT_OWNER_ADDRESS, payment, token_vec, None); state .world .check_account(ENSHRINE_ESDT_OWNER_ADDRESS) From 9c5d4e98b8ae1c52584183f5c8a0fb0005055c19 Mon Sep 17 00:00:00 2001 From: Andrei Baltariu Date: Tue, 16 Jul 2024 14:46:17 +0300 Subject: [PATCH 150/523] Decommented and fixed test Signed-off-by: Andrei Baltariu --- .../tests/enshrine_esdt_safe_blackbox_test.rs | 50 ++++++++++--------- 1 file changed, 26 insertions(+), 24 deletions(-) diff --git a/enshrine-esdt-safe/tests/enshrine_esdt_safe_blackbox_test.rs b/enshrine-esdt-safe/tests/enshrine_esdt_safe_blackbox_test.rs index 86370f6a..1d370730 100644 --- a/enshrine-esdt-safe/tests/enshrine_esdt_safe_blackbox_test.rs +++ b/enshrine-esdt-safe/tests/enshrine_esdt_safe_blackbox_test.rs @@ -400,27 +400,29 @@ fn test_register_tokens() { .check_account(ENSHRINE_ESDT_OWNER_ADDRESS) .esdt_balance(WEGLD_IDENTIFIER, BigUint::zero()); } -// -// #[test] -// fn test_register_tokens_insufficient_wegld() { -// let mut state = EnshrineTestState::new(); -// let token_vec = Vec::from([ -// NFT_TOKEN_ID, -// PREFIX_NFT_TOKEN_ID, -// FUNGIBLE_TOKEN_ID, -// CROWD_TOKEN_ID, -// ]); -// let code = 10u64; -// let error_message = "WEGLD fee amount is not met"; -// -// state.propose_setup_contracts(false); -// state.propose_register_tokens( -// &ENSHRINE_ESDT_OWNER_ADDRESS, -// &WEGLD_IDENTIFIER, -// token_vec, -// Some(ErrorStatus { -// code, -// error_message, -// }), -// ); -// } + +#[test] +fn test_register_tokens_insufficient_wegld() { + let mut state = EnshrineTestState::new(); + let token_vec = Vec::from([ + NFT_TOKEN_ID, + PREFIX_NFT_TOKEN_ID, + FUNGIBLE_TOKEN_ID, + CROWD_TOKEN_ID, + ]); + let code = 4u64; + let error_message = "WEGLD fee amount is not met"; + let payment_amount = BigUint::from(DEFAULT_ISSUE_COST + token_vec.len() as u64); + let payment = EsdtTokenPayment::new(WEGLD_IDENTIFIER.into(), 0, payment_amount); + + state.propose_setup_contracts(false); + state.propose_register_tokens( + &ENSHRINE_ESDT_OWNER_ADDRESS, + payment, + token_vec, + Some(ErrorStatus { + code, + error_message, + }), + ); +} From 9e588d8fbcb16693a6c989aa0734fda1e1d61b4f Mon Sep 17 00:00:00 2001 From: Andrei Baltariu Date: Tue, 16 Jul 2024 15:56:39 +0300 Subject: [PATCH 151/523] Added mint endpoint logic, proxy script, and token_handler address in enshrine init Signed-off-by: Andrei Baltariu --- enshrine-esdt-safe/src/common/storage.rs | 3 + .../src/enshrine_esdt_safe_proxy.rs | 11 +- .../src/from_sovereign/transfer_tokens.rs | 3 +- enshrine-esdt-safe/src/lib.rs | 2 + token-handler/sc-config.toml | 19 ++ token-handler/src/mint_tokens.rs | 73 +++++- token-handler/src/token_handler_proxy.rs | 73 ++++++ .../wasm-token-handler-full/Cargo.toml | 34 +++ .../wasm-token-handler-full/src/lib.rs | 26 +++ .../wasm-token-handler-view/Cargo.toml | 34 +++ .../wasm-token-handler-view/src/lib.rs | 25 ++ token-handler/wasm/Cargo.lock | 214 ++++++++++++++++++ token-handler/wasm/Cargo.toml | 34 +++ token-handler/wasm/src/lib.rs | 26 +++ 14 files changed, 568 insertions(+), 9 deletions(-) create mode 100644 token-handler/sc-config.toml create mode 100644 token-handler/src/token_handler_proxy.rs create mode 100644 token-handler/wasm-token-handler-full/Cargo.toml create mode 100644 token-handler/wasm-token-handler-full/src/lib.rs create mode 100644 token-handler/wasm-token-handler-view/Cargo.toml create mode 100644 token-handler/wasm-token-handler-view/src/lib.rs create mode 100644 token-handler/wasm/Cargo.lock create mode 100644 token-handler/wasm/Cargo.toml create mode 100644 token-handler/wasm/src/lib.rs diff --git a/enshrine-esdt-safe/src/common/storage.rs b/enshrine-esdt-safe/src/common/storage.rs index 37097f96..3390f71b 100644 --- a/enshrine-esdt-safe/src/common/storage.rs +++ b/enshrine-esdt-safe/src/common/storage.rs @@ -10,4 +10,7 @@ pub trait CommonStorage { #[storage_mapper("sovereignTokensPrefix")] fn sovereign_tokens_prefix(&self) -> SingleValueMapper; + + #[storage_mapper("tokenHandlerAddress")] + fn token_handler_address(&self) -> SingleValueMapper; } diff --git a/enshrine-esdt-safe/src/enshrine_esdt_safe_proxy.rs b/enshrine-esdt-safe/src/enshrine_esdt_safe_proxy.rs index 54b2b2ff..d97c6e94 100644 --- a/enshrine-esdt-safe/src/enshrine_esdt_safe_proxy.rs +++ b/enshrine-esdt-safe/src/enshrine_esdt_safe_proxy.rs @@ -45,18 +45,21 @@ where { pub fn init< Arg0: ProxyArg, - Arg1: ProxyArg>>, - Arg2: ProxyArg>>, + Arg1: ProxyArg>, + Arg2: ProxyArg>>, + Arg3: ProxyArg>>, >( self, is_sovereign_chain: Arg0, - opt_wegld_identifier: Arg1, - opt_sov_token_prefix: Arg2, + token_handler_address: Arg1, + opt_wegld_identifier: Arg2, + opt_sov_token_prefix: Arg3, ) -> TxTypedDeploy { self.wrapped_tx .payment(NotPayable) .raw_deploy() .argument(&is_sovereign_chain) + .argument(&token_handler_address) .argument(&opt_wegld_identifier) .argument(&opt_sov_token_prefix) .original_result() diff --git a/enshrine-esdt-safe/src/from_sovereign/transfer_tokens.rs b/enshrine-esdt-safe/src/from_sovereign/transfer_tokens.rs index df28fad1..b0a18b57 100644 --- a/enshrine-esdt-safe/src/from_sovereign/transfer_tokens.rs +++ b/enshrine-esdt-safe/src/from_sovereign/transfer_tokens.rs @@ -53,7 +53,8 @@ pub trait TransferTokensModule: return; } - + // let token_handler_address = self.token_handler_address().get(); + // self.tx().to(token_handler_address); let minted_operation_tokens = self.mint_tokens(&operation.tokens); let operation_tuple = OperationTuple { op_hash: operation_hash.clone(), diff --git a/enshrine-esdt-safe/src/lib.rs b/enshrine-esdt-safe/src/lib.rs index 4b0820e9..0a15f423 100644 --- a/enshrine-esdt-safe/src/lib.rs +++ b/enshrine-esdt-safe/src/lib.rs @@ -27,11 +27,13 @@ pub trait EnshrineEsdtSafe: fn init( &self, is_sovereign_chain: bool, + token_handler_address: ManagedAddress, opt_wegld_identifier: Option, opt_sov_token_prefix: Option, ) { self.is_sovereign_chain().set(is_sovereign_chain); self.set_paused(true); + self.token_handler_address().set(token_handler_address); if is_sovereign_chain { return; diff --git a/token-handler/sc-config.toml b/token-handler/sc-config.toml new file mode 100644 index 00000000..565b6b17 --- /dev/null +++ b/token-handler/sc-config.toml @@ -0,0 +1,19 @@ +[settings] +main = "main" + +[contracts.main] +name = "token-handler" + +[contracts.full] +name = "token-handler-full" +add-unlabelled = true +add-labels = ["token-handler-external-view"] + +[contracts.view] +name = "token-handler-view" +external-view = true +add-unlabelled = false +add-labels = ["token-handler-external-view"] + +[[proxy]] +path = "src/token_handler_proxy.rs" diff --git a/token-handler/src/mint_tokens.rs b/token-handler/src/mint_tokens.rs index 90829fd0..37f5eaae 100644 --- a/token-handler/src/mint_tokens.rs +++ b/token-handler/src/mint_tokens.rs @@ -1,4 +1,6 @@ -use multiversx_sc::err_msg; +use multiversx_sc::api::ESDT_NFT_CREATE_FUNC_NAME; +use multiversx_sc::types::ManagedArgBuffer; +use multiversx_sc::{codec, err_msg}; use multiversx_sc::{ imports::SingleValueMapper, types::{ManagedVec, MultiValueEncoded}, @@ -8,12 +10,75 @@ use transaction::OperationEsdtPayment; #[multiversx_sc::module] pub trait MintTokens: utils::UtilsModule + bls_signature::BlsSignatureModule { #[endpoint(mintTokens)] - fn mint_tokens(&self, operation_tokens: MultiValueEncoded>) { - let output_payments = ManagedVec::new(); + fn mint_tokens( + &self, + operation_tokens: MultiValueEncoded>, + ) -> MultiValueEncoded> { + let mut output_payments: ManagedVec> = + ManagedVec::new(); for operation_token in operation_tokens { - if self.has_sov_prefix(&operation_token.token_identifier, self.sov_prefix().get()) {} + let sov_prefix = self.sov_prefix().get(); + if !self.has_sov_prefix(&operation_token.token_identifier, sov_prefix) { + output_payments.push(operation_token.clone()); + continue; + } + + let mut nonce = operation_token.token_nonce; + if nonce == 0 { + self.send().esdt_local_mint( + &operation_token.token_identifier, + operation_token.token_nonce, + &operation_token.token_data.amount, + ); + } else { + let token_data = operation_token.token_data.clone(); + let mut arg_buffer = ManagedArgBuffer::new(); + + arg_buffer.push_arg(&operation_token.token_identifier); + arg_buffer.push_arg(token_data.amount); + arg_buffer.push_arg(token_data.name); + arg_buffer.push_arg(token_data.royalties); + arg_buffer.push_arg(token_data.hash); + arg_buffer.push_arg(token_data.attributes); + + let uris = token_data.uris.clone(); + + if uris.is_empty() { + // at least one URI is required, so we push an empty one + arg_buffer.push_arg(codec::Empty); + } else { + // The API function has the last argument as variadic, + // so we top-encode each and send as separate argument + for uri in &uris { + arg_buffer.push_arg(uri); + } + } + + arg_buffer.push_arg(operation_token.token_nonce); + arg_buffer.push_arg(token_data.creator); + + let output = self.send_raw().call_local_esdt_built_in_function( + self.blockchain().get_gas_left(), + &ManagedBuffer::from(ESDT_NFT_CREATE_FUNC_NAME), + &arg_buffer, + ); + + if let Some(first_result_bytes) = output.try_get(0) { + nonce = first_result_bytes.parse_as_u64().unwrap_or_default() + } else { + nonce = 0 + } + } + + output_payments.push(OperationEsdtPayment { + token_identifier: operation_token.token_identifier, + token_nonce: nonce, + token_data: operation_token.token_data, + }); } + + output_payments.into() } #[storage_mapper] diff --git a/token-handler/src/token_handler_proxy.rs b/token-handler/src/token_handler_proxy.rs new file mode 100644 index 00000000..a4dc7ae0 --- /dev/null +++ b/token-handler/src/token_handler_proxy.rs @@ -0,0 +1,73 @@ +// Code generated by the multiversx-sc proxy generator. DO NOT EDIT. + +//////////////////////////////////////////////////// +////////////////// AUTO-GENERATED ////////////////// +//////////////////////////////////////////////////// + +#![allow(dead_code)] +#![allow(clippy::all)] + +use multiversx_sc::proxy_imports::*; + +pub struct TokenHandlerProxy; + +impl TxProxyTrait for TokenHandlerProxy +where + Env: TxEnv, + From: TxFrom, + To: TxTo, + Gas: TxGas, +{ + type TxProxyMethods = TokenHandlerProxyMethods; + + fn proxy_methods(self, tx: Tx) -> Self::TxProxyMethods { + TokenHandlerProxyMethods { wrapped_tx: tx } + } +} + +pub struct TokenHandlerProxyMethods +where + Env: TxEnv, + From: TxFrom, + To: TxTo, + Gas: TxGas, +{ + wrapped_tx: Tx, +} + +#[rustfmt::skip] +impl TokenHandlerProxyMethods +where + Env: TxEnv, + Env::Api: VMApi, + From: TxFrom, + Gas: TxGas, +{ + pub fn init( + self, + ) -> TxTypedDeploy { + self.wrapped_tx + .payment(NotPayable) + .raw_deploy() + .original_result() + } +} + +#[rustfmt::skip] +impl TokenHandlerProxyMethods +where + Env: TxEnv, + Env::Api: VMApi, + From: TxFrom, + To: TxTo, + Gas: TxGas, +{ + pub fn upgrade( + self, + ) -> TxTypedUpgrade { + self.wrapped_tx + .payment(NotPayable) + .raw_upgrade() + .original_result() + } +} diff --git a/token-handler/wasm-token-handler-full/Cargo.toml b/token-handler/wasm-token-handler-full/Cargo.toml new file mode 100644 index 00000000..1f5fceb0 --- /dev/null +++ b/token-handler/wasm-token-handler-full/Cargo.toml @@ -0,0 +1,34 @@ +# Code generated by the multiversx-sc build system. DO NOT EDIT. + +# ########################################## +# ############## AUTO-GENERATED ############# +# ########################################## + +[package] +name = "token-handler-full-wasm" +version = "0.0.0" +edition = "2021" +publish = false + +[lib] +crate-type = ["cdylib"] + +[profile.release] +codegen-units = 1 +opt-level = "z" +lto = true +debug = false +panic = "abort" +overflow-checks = false + +[profile.dev] +panic = "abort" + +[dependencies.token-handler] +path = ".." + +[dependencies.multiversx-sc-wasm-adapter] +version = "0.51.1" + +[workspace] +members = ["."] diff --git a/token-handler/wasm-token-handler-full/src/lib.rs b/token-handler/wasm-token-handler-full/src/lib.rs new file mode 100644 index 00000000..411f8caa --- /dev/null +++ b/token-handler/wasm-token-handler-full/src/lib.rs @@ -0,0 +1,26 @@ +// Code generated by the multiversx-sc build system. DO NOT EDIT. + +//////////////////////////////////////////////////// +////////////////// AUTO-GENERATED ////////////////// +//////////////////////////////////////////////////// + +// Init: 1 +// Upgrade: 1 +// Endpoints: 0 +// Async Callback (empty): 1 +// Total number of exported functions: 3 + +#![no_std] + +multiversx_sc_wasm_adapter::allocator!(); +multiversx_sc_wasm_adapter::panic_handler!(); + +multiversx_sc_wasm_adapter::endpoints! { + token_handler + ( + init => init + upgrade => upgrade + ) +} + +multiversx_sc_wasm_adapter::async_callback_empty! {} diff --git a/token-handler/wasm-token-handler-view/Cargo.toml b/token-handler/wasm-token-handler-view/Cargo.toml new file mode 100644 index 00000000..127091ef --- /dev/null +++ b/token-handler/wasm-token-handler-view/Cargo.toml @@ -0,0 +1,34 @@ +# Code generated by the multiversx-sc build system. DO NOT EDIT. + +# ########################################## +# ############## AUTO-GENERATED ############# +# ########################################## + +[package] +name = "token-handler-view-wasm" +version = "0.0.0" +edition = "2021" +publish = false + +[lib] +crate-type = ["cdylib"] + +[profile.release] +codegen-units = 1 +opt-level = "z" +lto = true +debug = false +panic = "abort" +overflow-checks = false + +[profile.dev] +panic = "abort" + +[dependencies.token-handler] +path = ".." + +[dependencies.multiversx-sc-wasm-adapter] +version = "0.51.1" + +[workspace] +members = ["."] diff --git a/token-handler/wasm-token-handler-view/src/lib.rs b/token-handler/wasm-token-handler-view/src/lib.rs new file mode 100644 index 00000000..fdc820a9 --- /dev/null +++ b/token-handler/wasm-token-handler-view/src/lib.rs @@ -0,0 +1,25 @@ +// Code generated by the multiversx-sc build system. DO NOT EDIT. + +//////////////////////////////////////////////////// +////////////////// AUTO-GENERATED ////////////////// +//////////////////////////////////////////////////// + +// Init: 1 +// Endpoints: 0 +// Async Callback (empty): 1 +// Total number of exported functions: 2 + +#![no_std] + +multiversx_sc_wasm_adapter::allocator!(); +multiversx_sc_wasm_adapter::panic_handler!(); + +multiversx_sc_wasm_adapter::external_view_init! {} + +multiversx_sc_wasm_adapter::external_view_endpoints! { + token_handler + ( + ) +} + +multiversx_sc_wasm_adapter::async_callback_empty! {} diff --git a/token-handler/wasm/Cargo.lock b/token-handler/wasm/Cargo.lock new file mode 100644 index 00000000..bbca5a3b --- /dev/null +++ b/token-handler/wasm/Cargo.lock @@ -0,0 +1,214 @@ +# 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.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b048fb63fd8b5923fc5aa7b340d8e156aec7ec02f0c78fa8a6ddc2613f6f71de" + +[[package]] +name = "bls-signature" +version = "0.0.0" +dependencies = [ + "multiversx-sc", + "transaction", +] + +[[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.51.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "236f7890b2208796df8b5ac73b8572ffaf5e2b1531c7ad549d669328b715b657" +dependencies = [ + "bitflags", + "hex-literal", + "multiversx-sc-codec", + "multiversx-sc-derive", + "num-traits", + "unwrap-infallible", +] + +[[package]] +name = "multiversx-sc-codec" +version = "0.20.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fcecd449ea708b72f92edaa17158fe4859c1780aed9b52b14de45f26124ccb8b" +dependencies = [ + "arrayvec", + "multiversx-sc-codec-derive", + "unwrap-infallible", +] + +[[package]] +name = "multiversx-sc-codec-derive" +version = "0.20.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "68f7fa25402e5e8054d719951289306fd79e481f7c21b2565b5549b6bc359772" +dependencies = [ + "hex", + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "multiversx-sc-derive" +version = "0.51.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "eb683bc78d0e2eb43c16cac790144f53cc2ab27912aeb1484433895742ce698d" +dependencies = [ + "hex", + "proc-macro2", + "quote", + "radix_trie", + "syn", +] + +[[package]] +name = "multiversx-sc-wasm-adapter" +version = "0.51.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b2f0d6be22f911ce45427491a9bec94612a1678eab2769dd08c9c9731d13da53" +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.19" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "071dfc062690e90b734c0b2273ce72ad0ffa95f0c74596bc250dcfd960262841" +dependencies = [ + "autocfg", +] + +[[package]] +name = "proc-macro2" +version = "1.0.86" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5e719e8df665df0d1c8fbfd238015744736151d4445ec0836b8e628aae103b77" +dependencies = [ + "unicode-ident", +] + +[[package]] +name = "quote" +version = "1.0.36" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0fa76aaf39101c457836aec0ce2316dbdc3ab723cdda1c6bd4e6ad4208acaca7" +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.68" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "901fa70d88b9d6c98022e23b4136f9f3e54e4662c3bc1bd1d84a42a9a0f0c1e9" +dependencies = [ + "proc-macro2", + "quote", + "unicode-ident", +] + +[[package]] +name = "token-handler" +version = "0.0.0" +dependencies = [ + "bls-signature", + "multiversx-sc", + "transaction", + "utils", +] + +[[package]] +name = "token-handler-wasm" +version = "0.0.0" +dependencies = [ + "multiversx-sc-wasm-adapter", + "token-handler", +] + +[[package]] +name = "transaction" +version = "0.0.0" +dependencies = [ + "multiversx-sc", +] + +[[package]] +name = "unicode-ident" +version = "1.0.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3354b9ac3fae1ff6755cb6db53683adb661634f67557942dea4facebec0fee4b" + +[[package]] +name = "unwrap-infallible" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "151ac09978d3c2862c4e39b557f4eceee2cc72150bc4cb4f16abf061b6e381fb" + +[[package]] +name = "utils" +version = "0.0.0" +dependencies = [ + "bls-signature", + "multiversx-sc", +] diff --git a/token-handler/wasm/Cargo.toml b/token-handler/wasm/Cargo.toml new file mode 100644 index 00000000..2b7be507 --- /dev/null +++ b/token-handler/wasm/Cargo.toml @@ -0,0 +1,34 @@ +# Code generated by the multiversx-sc build system. DO NOT EDIT. + +# ########################################## +# ############## AUTO-GENERATED ############# +# ########################################## + +[package] +name = "token-handler-wasm" +version = "0.0.0" +edition = "2021" +publish = false + +[lib] +crate-type = ["cdylib"] + +[profile.release] +codegen-units = 1 +opt-level = "z" +lto = true +debug = false +panic = "abort" +overflow-checks = false + +[profile.dev] +panic = "abort" + +[dependencies.token-handler] +path = ".." + +[dependencies.multiversx-sc-wasm-adapter] +version = "0.51.1" + +[workspace] +members = ["."] diff --git a/token-handler/wasm/src/lib.rs b/token-handler/wasm/src/lib.rs new file mode 100644 index 00000000..411f8caa --- /dev/null +++ b/token-handler/wasm/src/lib.rs @@ -0,0 +1,26 @@ +// Code generated by the multiversx-sc build system. DO NOT EDIT. + +//////////////////////////////////////////////////// +////////////////// AUTO-GENERATED ////////////////// +//////////////////////////////////////////////////// + +// Init: 1 +// Upgrade: 1 +// Endpoints: 0 +// Async Callback (empty): 1 +// Total number of exported functions: 3 + +#![no_std] + +multiversx_sc_wasm_adapter::allocator!(); +multiversx_sc_wasm_adapter::panic_handler!(); + +multiversx_sc_wasm_adapter::endpoints! { + token_handler + ( + init => init + upgrade => upgrade + ) +} + +multiversx_sc_wasm_adapter::async_callback_empty! {} From 895b9f9d781ac85c9ae6a0663013961c074e6543 Mon Sep 17 00:00:00 2001 From: Andrei Baltariu Date: Wed, 17 Jul 2024 11:48:47 +0300 Subject: [PATCH 152/523] Removed any BLS signature module usage Signed-off-by: Andrei Baltariu --- common/token-whitelist/src/lib.rs | 29 ++++++++------------- common/utils/src/lib.rs | 42 +++++++++++++++---------------- 2 files changed, 31 insertions(+), 40 deletions(-) diff --git a/common/token-whitelist/src/lib.rs b/common/token-whitelist/src/lib.rs index 75af79a9..56524102 100644 --- a/common/token-whitelist/src/lib.rs +++ b/common/token-whitelist/src/lib.rs @@ -1,7 +1,5 @@ #![no_std] -use bls_signature::BlsSignature; - multiversx_sc::imports!(); #[multiversx_sc::module] @@ -12,7 +10,7 @@ pub trait TokenWhitelistModule: #[endpoint(addTokensToWhitelist)] fn add_tokens_to_whitelist( &self, - opt_signature: Option>, + // opt_signature: Option>, tokens: MultiValueEncoded, ) { if !self.is_setup_phase_complete() { @@ -22,14 +20,14 @@ pub trait TokenWhitelistModule: return; } - let token_list = self.verify_items_signature(opt_signature, tokens); - self.token_whitelist().extend(&token_list); + // let token_list = self.verify_items_signature(opt_signature, tokens); + self.token_whitelist().extend(tokens); } #[endpoint(removeTokensFromWhitelist)] fn remove_tokens_from_whitelist( &self, - opt_signature: Option>, + // opt_signature: Option>, tokens: MultiValueEncoded, ) { if !self.is_setup_phase_complete() { @@ -39,8 +37,8 @@ pub trait TokenWhitelistModule: return; } - let token_list = self.verify_items_signature(opt_signature, tokens); - self.remove_items(&mut self.token_whitelist(), &token_list); + // let token_list = self.verify_items_signature(opt_signature, tokens); + self.remove_items(&mut self.token_whitelist(), tokens); } fn require_token_not_blacklisted(&self, token_id: &TokenIdentifier) { @@ -54,7 +52,7 @@ pub trait TokenWhitelistModule: #[endpoint(addTokensToBlacklist)] fn add_tokens_to_blacklist( &self, - opt_signature: Option>, + // opt_signature: Option>, tokens: MultiValueEncoded, ) { if !self.is_setup_phase_complete() { @@ -64,16 +62,12 @@ pub trait TokenWhitelistModule: return; } - let token_list = self.verify_items_signature(opt_signature, tokens); - self.token_blacklist().extend(&token_list); + // let token_list = self.verify_items_signature(opt_signature, tokens); + self.token_blacklist().extend(tokens); } #[endpoint(removeTokensFromBlacklist)] - fn remove_tokens_from_blacklist( - &self, - opt_signature: Option>, - tokens: MultiValueEncoded, - ) { + fn remove_tokens_from_blacklist(&self, tokens: MultiValueEncoded) { if !self.is_setup_phase_complete() { self.require_caller_initiator(); self.remove_items(&mut self.token_blacklist(), tokens); @@ -81,8 +75,7 @@ pub trait TokenWhitelistModule: return; } - let token_list = self.verify_items_signature(opt_signature, tokens); - self.remove_items(&mut self.token_blacklist(), &token_list); + self.remove_items(&mut self.token_blacklist(), tokens); } #[view(getTokenWhitelist)] diff --git a/common/utils/src/lib.rs b/common/utils/src/lib.rs index 4f53c016..8350cf84 100644 --- a/common/utils/src/lib.rs +++ b/common/utils/src/lib.rs @@ -1,7 +1,5 @@ #![no_std] -use bls_signature::BlsSignature; - multiversx_sc::imports!(); pub type PaymentsVec = ManagedVec>; @@ -11,7 +9,7 @@ const DASH: u8 = b'-'; const MAX_TOKEN_ID_LEN: usize = 32; #[multiversx_sc::module] -pub trait UtilsModule: bls_signature::BlsSignatureModule { +pub trait UtilsModule { fn require_sc_address(&self, address: &ManagedAddress) { require!( !address.is_zero() && self.blockchain().is_smart_contract(address), @@ -49,25 +47,25 @@ pub trait UtilsModule: bls_signature::BlsSignatureModule { first_payment } - fn verify_items_signature( - &self, - opt_signature: Option>, - items: MultiValueEncoded, - ) -> ManagedVec { - require!(opt_signature.is_some(), "Must provide signature"); - - let list = items.to_vec(); - let signature = unsafe { opt_signature.unwrap_unchecked() }; - let mut signature_data = ManagedBuffer::new(); - for token in &list { - let _ = token.dep_encode(&mut signature_data); - } - - self.multi_verify_signature(&signature_data, &signature); - - list - } - + // fn verify_items_signature( + // &self, + // opt_signature: Option>, + // items: MultiValueEncoded, + // ) -> ManagedVec { + // require!(opt_signature.is_some(), "Must provide signature"); + // + // let list = items.to_vec(); + // let signature = unsafe { opt_signature.unwrap_unchecked() }; + // let mut signature_data = ManagedBuffer::new(); + // for token in &list { + // let _ = token.dep_encode(&mut signature_data); + // } + // + // self.multi_verify_signature(&signature_data, &signature); + // + // list + // } + // fn has_prefix(&self, token_id: &TokenIdentifier) -> bool { let buffer = token_id.as_managed_buffer(); let mut array_buffer = [0u8; MAX_TOKEN_ID_LEN]; From a0fce4e7b2a2786e0496ed3e2e8f2cd264351476 Mon Sep 17 00:00:00 2001 From: Andrei Baltariu Date: Wed, 17 Jul 2024 12:07:08 +0300 Subject: [PATCH 153/523] Added common storage module and deleted operation file Signed-off-by: Andrei Baltariu --- token-handler/src/common/mod.rs | 1 + token-handler/src/common/storage.rs | 4 + token-handler/src/lib.rs | 1 + token-handler/src/operation.rs | 140 ---------------------------- 4 files changed, 6 insertions(+), 140 deletions(-) create mode 100644 token-handler/src/common/mod.rs create mode 100644 token-handler/src/common/storage.rs delete mode 100644 token-handler/src/operation.rs diff --git a/token-handler/src/common/mod.rs b/token-handler/src/common/mod.rs new file mode 100644 index 00000000..30f61eb6 --- /dev/null +++ b/token-handler/src/common/mod.rs @@ -0,0 +1 @@ +pub mod storage; diff --git a/token-handler/src/common/storage.rs b/token-handler/src/common/storage.rs new file mode 100644 index 00000000..3ee0f4ad --- /dev/null +++ b/token-handler/src/common/storage.rs @@ -0,0 +1,4 @@ +use multiversx_sc::{imports::SingleValueMapper, types::ManagedBuffer}; + +#[storage_mapper] +fn sov_prefix(&self) -> SingleValueMapper; diff --git a/token-handler/src/lib.rs b/token-handler/src/lib.rs index 1de2947b..faaeebe1 100644 --- a/token-handler/src/lib.rs +++ b/token-handler/src/lib.rs @@ -6,6 +6,7 @@ use multiversx_sc::imports::*; pub mod burn_tokens; pub mod events; pub mod mint_tokens; +pub mod token_handler_proxy; #[multiversx_sc::contract] pub trait TokenHandler { diff --git a/token-handler/src/operation.rs b/token-handler/src/operation.rs deleted file mode 100644 index 195809d9..00000000 --- a/token-handler/src/operation.rs +++ /dev/null @@ -1,140 +0,0 @@ -multiversx_sc::imports!(); -multiversx_sc::derive_imports!(); - -pub type TxId = u64; -pub type GasLimit = u64; - -#[derive(TopEncode, TopDecode, NestedEncode, NestedDecode, TypeAbi, ManagedVecItem, Clone)] -pub struct Operation { - pub to: ManagedAddress, - pub tokens: ManagedVec>, - pub data: OperationData, -} - -impl Operation { - pub fn get_tokens_as_tuple_arr( - &self, - ) -> MultiValueEncoded, u64, EsdtTokenData>> { - let mut tuple_arr = MultiValueEncoded::new(); - - for token in &self.tokens { - tuple_arr.push(MultiValue3::from(( - token.token_identifier, - token.token_nonce, - token.token_data.into(), - ))); - } - - tuple_arr - } -} - -#[derive(TopEncode, TopDecode, NestedEncode, NestedDecode, TypeAbi, ManagedVecItem, Clone)] -pub struct OperationData { - pub op_nonce: TxId, - pub op_sender: ManagedAddress, - pub opt_transfer_data: Option>, -} - -#[derive(TopEncode, TopDecode, NestedEncode, NestedDecode, TypeAbi, ManagedVecItem, Clone)] -pub struct OperationTuple { - pub op_hash: ManagedBuffer, - pub operation: Operation, -} - -#[derive(TopEncode, TopDecode, NestedEncode, NestedDecode, TypeAbi, ManagedVecItem, Clone)] -pub struct OperationEsdtPayment { - pub token_identifier: TokenIdentifier, - pub token_nonce: u64, - pub token_data: StolenFromFrameworkEsdtTokenData, -} - -impl From> for EsdtTokenPayment { - fn from(payment: OperationEsdtPayment) -> Self { - EsdtTokenPayment { - token_identifier: payment.token_identifier, - token_nonce: payment.token_nonce, - amount: payment.token_data.amount, - } - } -} - -impl Default for OperationEsdtPayment { - fn default() -> Self { - OperationEsdtPayment { - token_identifier: TokenIdentifier::from(ManagedBuffer::new()), - token_nonce: 0, - token_data: StolenFromFrameworkEsdtTokenData::default(), - } - } -} - -#[derive(TopEncode, TopDecode, NestedEncode, NestedDecode, TypeAbi, ManagedVecItem, Clone)] -pub struct TransferData { - pub gas_limit: GasLimit, - pub function: ManagedBuffer, - pub args: ManagedVec>, -} - -#[derive( - TopDecode, TopEncode, NestedDecode, NestedEncode, TypeAbi, Debug, ManagedVecItem, Clone, -)] -pub struct StolenFromFrameworkEsdtTokenData { - pub token_type: EsdtTokenType, - pub amount: BigUint, - pub frozen: bool, - pub hash: ManagedBuffer, - pub name: ManagedBuffer, - pub attributes: ManagedBuffer, - pub creator: ManagedAddress, - pub royalties: BigUint, - pub uris: ManagedVec>, -} - -impl Default for StolenFromFrameworkEsdtTokenData { - fn default() -> Self { - StolenFromFrameworkEsdtTokenData { - token_type: EsdtTokenType::Fungible, - amount: BigUint::zero(), - frozen: false, - hash: ManagedBuffer::new(), - name: ManagedBuffer::new(), - attributes: ManagedBuffer::new(), - creator: ManagedAddress::zero(), - royalties: BigUint::zero(), - uris: ManagedVec::new(), - } - } -} - -impl From> for StolenFromFrameworkEsdtTokenData { - fn from(value: EsdtTokenData) -> Self { - StolenFromFrameworkEsdtTokenData { - token_type: value.token_type, - amount: value.amount, - frozen: value.frozen, - hash: value.hash, - name: value.name, - attributes: value.attributes, - creator: value.creator, - royalties: value.royalties, - uris: value.uris, - } - } -} - -impl From> for EsdtTokenData { - fn from(token_data: StolenFromFrameworkEsdtTokenData) -> Self { - EsdtTokenData { - token_type: token_data.token_type, - amount: token_data.amount, - frozen: token_data.frozen, - hash: token_data.hash, - name: token_data.name, - attributes: token_data.attributes, - creator: token_data.creator, - royalties: token_data.royalties, - uris: token_data.uris, - } - } -} From ad43025818720bbf7f6233ce4224a7a428e0aaf7 Mon Sep 17 00:00:00 2001 From: Andrei Baltariu Date: Wed, 17 Jul 2024 12:14:28 +0300 Subject: [PATCH 154/523] Modified common storage module and burn endpoint Signed-off-by: Andrei Baltariu --- token-handler/sc-config.toml | 3 +++ token-handler/src/burn_tokens.rs | 21 +++++++++++++++++++-- token-handler/src/common/storage.rs | 9 ++++++--- token-handler/src/lib.rs | 1 + token-handler/src/mint_tokens.rs | 5 +---- 5 files changed, 30 insertions(+), 9 deletions(-) diff --git a/token-handler/sc-config.toml b/token-handler/sc-config.toml index 565b6b17..ba261c17 100644 --- a/token-handler/sc-config.toml +++ b/token-handler/sc-config.toml @@ -17,3 +17,6 @@ add-labels = ["token-handler-external-view"] [[proxy]] path = "src/token_handler_proxy.rs" + +[[proxy]] +path = "../enshrine-esdt-safe/src/token_handler_proxy.rs" diff --git a/token-handler/src/burn_tokens.rs b/token-handler/src/burn_tokens.rs index 671cc4ff..f556b3aa 100644 --- a/token-handler/src/burn_tokens.rs +++ b/token-handler/src/burn_tokens.rs @@ -1,5 +1,22 @@ +use crate::{common, err_msg}; +use transaction::Operation; + #[multiversx_sc::module] -pub trait BurnTokens { +pub trait BurnTokens: utils::UtilsModule + common::storage::CommonStorage { #[endpoint(burnTokens)] - fn burn_tokens(&self) {} + fn burn_tokens(&self, operation: Operation) { + let sov_prefix = self.sov_prefix().get(); + + for token in operation.tokens.iter() { + if self.has_sov_prefix(&token.token_identifier, sov_prefix.clone()) { + continue; + } + + self.send().esdt_local_burn( + &token.token_identifier, + token.token_nonce, + &token.token_data.amount, + ); + } + } } diff --git a/token-handler/src/common/storage.rs b/token-handler/src/common/storage.rs index 3ee0f4ad..ce708adb 100644 --- a/token-handler/src/common/storage.rs +++ b/token-handler/src/common/storage.rs @@ -1,4 +1,7 @@ -use multiversx_sc::{imports::SingleValueMapper, types::ManagedBuffer}; +use multiversx_sc::imports::SingleValueMapper; -#[storage_mapper] -fn sov_prefix(&self) -> SingleValueMapper; +#[multiversx_sc::module] +pub trait CommonStorage { + #[storage_mapper] + fn sov_prefix(&self) -> SingleValueMapper; +} diff --git a/token-handler/src/lib.rs b/token-handler/src/lib.rs index faaeebe1..ce0f6ea4 100644 --- a/token-handler/src/lib.rs +++ b/token-handler/src/lib.rs @@ -4,6 +4,7 @@ use multiversx_sc::imports::*; pub mod burn_tokens; +pub mod common; pub mod events; pub mod mint_tokens; pub mod token_handler_proxy; diff --git a/token-handler/src/mint_tokens.rs b/token-handler/src/mint_tokens.rs index 37f5eaae..e12d38bd 100644 --- a/token-handler/src/mint_tokens.rs +++ b/token-handler/src/mint_tokens.rs @@ -8,7 +8,7 @@ use multiversx_sc::{ use transaction::OperationEsdtPayment; #[multiversx_sc::module] -pub trait MintTokens: utils::UtilsModule + bls_signature::BlsSignatureModule { +pub trait MintTokens: utils::UtilsModule { #[endpoint(mintTokens)] fn mint_tokens( &self, @@ -80,7 +80,4 @@ pub trait MintTokens: utils::UtilsModule + bls_signature::BlsSignatureModule { output_payments.into() } - - #[storage_mapper] - fn sov_prefix(&self) -> SingleValueMapper; } From 8a82d80694f9d2a77373838916fde119f2bc76c4 Mon Sep 17 00:00:00 2001 From: Andrei Baltariu Date: Wed, 17 Jul 2024 12:14:59 +0300 Subject: [PATCH 155/523] Regenrated proxy Signed-off-by: Andrei Baltariu --- esdt-safe/src/esdt_safe_proxy.rs | 28 ++++++++-------------------- 1 file changed, 8 insertions(+), 20 deletions(-) diff --git a/esdt-safe/src/esdt_safe_proxy.rs b/esdt-safe/src/esdt_safe_proxy.rs index 4e58fc40..0d69917a 100644 --- a/esdt-safe/src/esdt_safe_proxy.rs +++ b/esdt-safe/src/esdt_safe_proxy.rs @@ -333,66 +333,54 @@ where /// Tokens in the whitelist can be transferred without fees pub fn add_tokens_to_whitelist< - Arg0: ProxyArg>>, - Arg1: ProxyArg>>, + Arg0: ProxyArg>>, >( self, - opt_signature: Arg0, - tokens: Arg1, + tokens: Arg0, ) -> TxTypedCall { self.wrapped_tx .payment(NotPayable) .raw_call("addTokensToWhitelist") - .argument(&opt_signature) .argument(&tokens) .original_result() } pub fn remove_tokens_from_whitelist< - Arg0: ProxyArg>>, - Arg1: ProxyArg>>, + Arg0: ProxyArg>>, >( self, - opt_signature: Arg0, - tokens: Arg1, + tokens: Arg0, ) -> TxTypedCall { self.wrapped_tx .payment(NotPayable) .raw_call("removeTokensFromWhitelist") - .argument(&opt_signature) .argument(&tokens) .original_result() } /// Tokens in blacklist cannot be transferred pub fn add_tokens_to_blacklist< - Arg0: ProxyArg>>, - Arg1: ProxyArg>>, + Arg0: ProxyArg>>, >( self, - opt_signature: Arg0, - tokens: Arg1, + tokens: Arg0, ) -> TxTypedCall { self.wrapped_tx .payment(NotPayable) .raw_call("addTokensToBlacklist") - .argument(&opt_signature) .argument(&tokens) .original_result() } pub fn remove_tokens_from_blacklist< - Arg0: ProxyArg>>, - Arg1: ProxyArg>>, + Arg0: ProxyArg>>, >( self, - opt_signature: Arg0, - tokens: Arg1, + tokens: Arg0, ) -> TxTypedCall { self.wrapped_tx .payment(NotPayable) .raw_call("removeTokensFromBlacklist") - .argument(&opt_signature) .argument(&tokens) .original_result() } From 01b0fab3a4ee73badee68118de355e050b14a49f Mon Sep 17 00:00:00 2001 From: Andrei Baltariu Date: Wed, 17 Jul 2024 12:15:31 +0300 Subject: [PATCH 156/523] Modified enshrine lib file and added token handler proxy Signed-off-by: Andrei Baltariu --- .../src/enshrine_esdt_safe_proxy.rs | 28 ++----- .../src/from_sovereign/transfer_tokens.rs | 8 +- enshrine-esdt-safe/src/lib.rs | 1 + enshrine-esdt-safe/src/token_handler_proxy.rs | 73 +++++++++++++++++++ 4 files changed, 88 insertions(+), 22 deletions(-) create mode 100644 enshrine-esdt-safe/src/token_handler_proxy.rs diff --git a/enshrine-esdt-safe/src/enshrine_esdt_safe_proxy.rs b/enshrine-esdt-safe/src/enshrine_esdt_safe_proxy.rs index d97c6e94..cb57fb68 100644 --- a/enshrine-esdt-safe/src/enshrine_esdt_safe_proxy.rs +++ b/enshrine-esdt-safe/src/enshrine_esdt_safe_proxy.rs @@ -330,66 +330,54 @@ where /// Tokens in the whitelist can be transferred without fees pub fn add_tokens_to_whitelist< - Arg0: ProxyArg>>, - Arg1: ProxyArg>>, + Arg0: ProxyArg>>, >( self, - opt_signature: Arg0, - tokens: Arg1, + tokens: Arg0, ) -> TxTypedCall { self.wrapped_tx .payment(NotPayable) .raw_call("addTokensToWhitelist") - .argument(&opt_signature) .argument(&tokens) .original_result() } pub fn remove_tokens_from_whitelist< - Arg0: ProxyArg>>, - Arg1: ProxyArg>>, + Arg0: ProxyArg>>, >( self, - opt_signature: Arg0, - tokens: Arg1, + tokens: Arg0, ) -> TxTypedCall { self.wrapped_tx .payment(NotPayable) .raw_call("removeTokensFromWhitelist") - .argument(&opt_signature) .argument(&tokens) .original_result() } /// Tokens in blacklist cannot be transferred pub fn add_tokens_to_blacklist< - Arg0: ProxyArg>>, - Arg1: ProxyArg>>, + Arg0: ProxyArg>>, >( self, - opt_signature: Arg0, - tokens: Arg1, + tokens: Arg0, ) -> TxTypedCall { self.wrapped_tx .payment(NotPayable) .raw_call("addTokensToBlacklist") - .argument(&opt_signature) .argument(&tokens) .original_result() } pub fn remove_tokens_from_blacklist< - Arg0: ProxyArg>>, - Arg1: ProxyArg>>, + Arg0: ProxyArg>>, >( self, - opt_signature: Arg0, - tokens: Arg1, + tokens: Arg0, ) -> TxTypedCall { self.wrapped_tx .payment(NotPayable) .raw_call("removeTokensFromBlacklist") - .argument(&opt_signature) .argument(&tokens) .original_result() } diff --git a/enshrine-esdt-safe/src/from_sovereign/transfer_tokens.rs b/enshrine-esdt-safe/src/from_sovereign/transfer_tokens.rs index b0a18b57..b413ff0b 100644 --- a/enshrine-esdt-safe/src/from_sovereign/transfer_tokens.rs +++ b/enshrine-esdt-safe/src/from_sovereign/transfer_tokens.rs @@ -1,4 +1,4 @@ -use crate::{common, to_sovereign}; +use crate::{common, to_sovereign, token_handler_proxy}; use builtin_func_names::ESDT_NFT_CREATE_FUNC_NAME; use header_verifier::header_verifier_proxy; use multiversx_sc::imports::*; @@ -53,8 +53,12 @@ pub trait TransferTokensModule: return; } + // let token_handler_address = self.token_handler_address().get(); - // self.tx().to(token_handler_address); + // self.tx() + // .to(token_handler_address) + // .typed(token_handler_proxy::TokenHandlerProxy) + // .mint_tokens(); let minted_operation_tokens = self.mint_tokens(&operation.tokens); let operation_tuple = OperationTuple { op_hash: operation_hash.clone(), diff --git a/enshrine-esdt-safe/src/lib.rs b/enshrine-esdt-safe/src/lib.rs index 0a15f423..ac47139f 100644 --- a/enshrine-esdt-safe/src/lib.rs +++ b/enshrine-esdt-safe/src/lib.rs @@ -6,6 +6,7 @@ pub mod common; pub mod enshrine_esdt_safe_proxy; pub mod from_sovereign; pub mod to_sovereign; +pub mod token_handler_proxy; #[multiversx_sc::contract] pub trait EnshrineEsdtSafe: diff --git a/enshrine-esdt-safe/src/token_handler_proxy.rs b/enshrine-esdt-safe/src/token_handler_proxy.rs new file mode 100644 index 00000000..a4dc7ae0 --- /dev/null +++ b/enshrine-esdt-safe/src/token_handler_proxy.rs @@ -0,0 +1,73 @@ +// Code generated by the multiversx-sc proxy generator. DO NOT EDIT. + +//////////////////////////////////////////////////// +////////////////// AUTO-GENERATED ////////////////// +//////////////////////////////////////////////////// + +#![allow(dead_code)] +#![allow(clippy::all)] + +use multiversx_sc::proxy_imports::*; + +pub struct TokenHandlerProxy; + +impl TxProxyTrait for TokenHandlerProxy +where + Env: TxEnv, + From: TxFrom, + To: TxTo, + Gas: TxGas, +{ + type TxProxyMethods = TokenHandlerProxyMethods; + + fn proxy_methods(self, tx: Tx) -> Self::TxProxyMethods { + TokenHandlerProxyMethods { wrapped_tx: tx } + } +} + +pub struct TokenHandlerProxyMethods +where + Env: TxEnv, + From: TxFrom, + To: TxTo, + Gas: TxGas, +{ + wrapped_tx: Tx, +} + +#[rustfmt::skip] +impl TokenHandlerProxyMethods +where + Env: TxEnv, + Env::Api: VMApi, + From: TxFrom, + Gas: TxGas, +{ + pub fn init( + self, + ) -> TxTypedDeploy { + self.wrapped_tx + .payment(NotPayable) + .raw_deploy() + .original_result() + } +} + +#[rustfmt::skip] +impl TokenHandlerProxyMethods +where + Env: TxEnv, + Env::Api: VMApi, + From: TxFrom, + To: TxTo, + Gas: TxGas, +{ + pub fn upgrade( + self, + ) -> TxTypedUpgrade { + self.wrapped_tx + .payment(NotPayable) + .raw_upgrade() + .original_result() + } +} From fc5a635bc2527f9839d1228dd39d22145025b46b Mon Sep 17 00:00:00 2001 From: Andrei Baltariu Date: Wed, 17 Jul 2024 12:19:14 +0300 Subject: [PATCH 157/523] Modified prefix function to use reference Signed-off-by: Andrei Baltariu --- common/utils/src/lib.rs | 4 ++-- .../src/from_sovereign/transfer_tokens.rs | 12 +++++++----- 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/common/utils/src/lib.rs b/common/utils/src/lib.rs index 4f53c016..c91138b6 100644 --- a/common/utils/src/lib.rs +++ b/common/utils/src/lib.rs @@ -82,7 +82,7 @@ pub trait UtilsModule: bls_signature::BlsSignatureModule { false } - fn has_sov_prefix(&self, token_id: &TokenIdentifier, chain_prefix: ManagedBuffer) -> bool { + fn has_sov_prefix(&self, token_id: &TokenIdentifier, chain_prefix: &ManagedBuffer) -> bool { if !self.has_prefix(token_id) { return false; } @@ -94,7 +94,7 @@ pub trait UtilsModule: bls_signature::BlsSignatureModule { if let Some(index) = slice.iter().position(|&b| b == DASH) { let prefix = ManagedBuffer::from(&slice[..index]); - if prefix == chain_prefix { + if prefix == chain_prefix.clone() { return true; } } diff --git a/enshrine-esdt-safe/src/from_sovereign/transfer_tokens.rs b/enshrine-esdt-safe/src/from_sovereign/transfer_tokens.rs index d8534726..c9ef1c90 100644 --- a/enshrine-esdt-safe/src/from_sovereign/transfer_tokens.rs +++ b/enshrine-esdt-safe/src/from_sovereign/transfer_tokens.rs @@ -92,8 +92,10 @@ pub trait TransferTokensModule: &self, tokens: ManagedVec>, ) -> bool { + let sov_prefix = self.get_sovereign_prefix(); + for token in tokens.iter() { - if !self.has_sov_prefix(&token.token_identifier, self.get_sovereign_prefix()) { + if !self.has_sov_prefix(&token.token_identifier, &sov_prefix) { continue; } @@ -110,10 +112,10 @@ pub trait TransferTokensModule: operation_tokens: &ManagedVec>, ) -> ManagedVec> { let mut output_payments = ManagedVec::new(); + let sov_prefix = self.get_sovereign_prefix(); for operation_token in operation_tokens.iter() { - let sov_prefix = self.get_sovereign_prefix(); - if !self.has_sov_prefix(&operation_token.token_identifier, sov_prefix) { + if !self.has_sov_prefix(&operation_token.token_identifier, &sov_prefix) { output_payments.push(operation_token.clone()); continue; } @@ -270,9 +272,9 @@ pub trait TransferTokensModule: } fn burn_sovereign_tokens(&self, operation: &Operation) { + let sov_prefix = self.get_sovereign_prefix(); for token in operation.tokens.iter() { - let sov_prefix = self.get_sovereign_prefix(); - if !self.has_sov_prefix(&token.token_identifier, sov_prefix) { + if !self.has_sov_prefix(&token.token_identifier, &sov_prefix) { continue; } From a430ea422bf50dcc2bf9dbd0e29b3dc367328c7c Mon Sep 17 00:00:00 2001 From: Andrei Baltariu Date: Wed, 17 Jul 2024 13:53:10 +0300 Subject: [PATCH 158/523] Added common storage module as import Signed-off-by: Andrei Baltariu --- token-handler/src/mint_tokens.rs | 9 +- .../wasm-token-handler-full/Cargo.lock | 214 ++++++++++++++++++ .../wasm-token-handler-view/Cargo.lock | 214 ++++++++++++++++++ 3 files changed, 432 insertions(+), 5 deletions(-) create mode 100644 token-handler/wasm-token-handler-full/Cargo.lock create mode 100644 token-handler/wasm-token-handler-view/Cargo.lock diff --git a/token-handler/src/mint_tokens.rs b/token-handler/src/mint_tokens.rs index e12d38bd..3d7b6e3a 100644 --- a/token-handler/src/mint_tokens.rs +++ b/token-handler/src/mint_tokens.rs @@ -1,14 +1,13 @@ use multiversx_sc::api::ESDT_NFT_CREATE_FUNC_NAME; use multiversx_sc::types::ManagedArgBuffer; +use multiversx_sc::types::{ManagedVec, MultiValueEncoded}; use multiversx_sc::{codec, err_msg}; -use multiversx_sc::{ - imports::SingleValueMapper, - types::{ManagedVec, MultiValueEncoded}, -}; use transaction::OperationEsdtPayment; +use crate::common; + #[multiversx_sc::module] -pub trait MintTokens: utils::UtilsModule { +pub trait MintTokens: utils::UtilsModule + common::storage::CommonStorage { #[endpoint(mintTokens)] fn mint_tokens( &self, diff --git a/token-handler/wasm-token-handler-full/Cargo.lock b/token-handler/wasm-token-handler-full/Cargo.lock new file mode 100644 index 00000000..8fe79e0b --- /dev/null +++ b/token-handler/wasm-token-handler-full/Cargo.lock @@ -0,0 +1,214 @@ +# 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.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b048fb63fd8b5923fc5aa7b340d8e156aec7ec02f0c78fa8a6ddc2613f6f71de" + +[[package]] +name = "bls-signature" +version = "0.0.0" +dependencies = [ + "multiversx-sc", + "transaction", +] + +[[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.51.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "236f7890b2208796df8b5ac73b8572ffaf5e2b1531c7ad549d669328b715b657" +dependencies = [ + "bitflags", + "hex-literal", + "multiversx-sc-codec", + "multiversx-sc-derive", + "num-traits", + "unwrap-infallible", +] + +[[package]] +name = "multiversx-sc-codec" +version = "0.20.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fcecd449ea708b72f92edaa17158fe4859c1780aed9b52b14de45f26124ccb8b" +dependencies = [ + "arrayvec", + "multiversx-sc-codec-derive", + "unwrap-infallible", +] + +[[package]] +name = "multiversx-sc-codec-derive" +version = "0.20.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "68f7fa25402e5e8054d719951289306fd79e481f7c21b2565b5549b6bc359772" +dependencies = [ + "hex", + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "multiversx-sc-derive" +version = "0.51.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "eb683bc78d0e2eb43c16cac790144f53cc2ab27912aeb1484433895742ce698d" +dependencies = [ + "hex", + "proc-macro2", + "quote", + "radix_trie", + "syn", +] + +[[package]] +name = "multiversx-sc-wasm-adapter" +version = "0.51.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b2f0d6be22f911ce45427491a9bec94612a1678eab2769dd08c9c9731d13da53" +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.19" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "071dfc062690e90b734c0b2273ce72ad0ffa95f0c74596bc250dcfd960262841" +dependencies = [ + "autocfg", +] + +[[package]] +name = "proc-macro2" +version = "1.0.86" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5e719e8df665df0d1c8fbfd238015744736151d4445ec0836b8e628aae103b77" +dependencies = [ + "unicode-ident", +] + +[[package]] +name = "quote" +version = "1.0.36" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0fa76aaf39101c457836aec0ce2316dbdc3ab723cdda1c6bd4e6ad4208acaca7" +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.68" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "901fa70d88b9d6c98022e23b4136f9f3e54e4662c3bc1bd1d84a42a9a0f0c1e9" +dependencies = [ + "proc-macro2", + "quote", + "unicode-ident", +] + +[[package]] +name = "token-handler" +version = "0.0.0" +dependencies = [ + "bls-signature", + "multiversx-sc", + "transaction", + "utils", +] + +[[package]] +name = "token-handler-full-wasm" +version = "0.0.0" +dependencies = [ + "multiversx-sc-wasm-adapter", + "token-handler", +] + +[[package]] +name = "transaction" +version = "0.0.0" +dependencies = [ + "multiversx-sc", +] + +[[package]] +name = "unicode-ident" +version = "1.0.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3354b9ac3fae1ff6755cb6db53683adb661634f67557942dea4facebec0fee4b" + +[[package]] +name = "unwrap-infallible" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "151ac09978d3c2862c4e39b557f4eceee2cc72150bc4cb4f16abf061b6e381fb" + +[[package]] +name = "utils" +version = "0.0.0" +dependencies = [ + "bls-signature", + "multiversx-sc", +] diff --git a/token-handler/wasm-token-handler-view/Cargo.lock b/token-handler/wasm-token-handler-view/Cargo.lock new file mode 100644 index 00000000..c74b749f --- /dev/null +++ b/token-handler/wasm-token-handler-view/Cargo.lock @@ -0,0 +1,214 @@ +# 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.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b048fb63fd8b5923fc5aa7b340d8e156aec7ec02f0c78fa8a6ddc2613f6f71de" + +[[package]] +name = "bls-signature" +version = "0.0.0" +dependencies = [ + "multiversx-sc", + "transaction", +] + +[[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.51.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "236f7890b2208796df8b5ac73b8572ffaf5e2b1531c7ad549d669328b715b657" +dependencies = [ + "bitflags", + "hex-literal", + "multiversx-sc-codec", + "multiversx-sc-derive", + "num-traits", + "unwrap-infallible", +] + +[[package]] +name = "multiversx-sc-codec" +version = "0.20.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fcecd449ea708b72f92edaa17158fe4859c1780aed9b52b14de45f26124ccb8b" +dependencies = [ + "arrayvec", + "multiversx-sc-codec-derive", + "unwrap-infallible", +] + +[[package]] +name = "multiversx-sc-codec-derive" +version = "0.20.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "68f7fa25402e5e8054d719951289306fd79e481f7c21b2565b5549b6bc359772" +dependencies = [ + "hex", + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "multiversx-sc-derive" +version = "0.51.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "eb683bc78d0e2eb43c16cac790144f53cc2ab27912aeb1484433895742ce698d" +dependencies = [ + "hex", + "proc-macro2", + "quote", + "radix_trie", + "syn", +] + +[[package]] +name = "multiversx-sc-wasm-adapter" +version = "0.51.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b2f0d6be22f911ce45427491a9bec94612a1678eab2769dd08c9c9731d13da53" +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.19" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "071dfc062690e90b734c0b2273ce72ad0ffa95f0c74596bc250dcfd960262841" +dependencies = [ + "autocfg", +] + +[[package]] +name = "proc-macro2" +version = "1.0.86" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5e719e8df665df0d1c8fbfd238015744736151d4445ec0836b8e628aae103b77" +dependencies = [ + "unicode-ident", +] + +[[package]] +name = "quote" +version = "1.0.36" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0fa76aaf39101c457836aec0ce2316dbdc3ab723cdda1c6bd4e6ad4208acaca7" +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.68" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "901fa70d88b9d6c98022e23b4136f9f3e54e4662c3bc1bd1d84a42a9a0f0c1e9" +dependencies = [ + "proc-macro2", + "quote", + "unicode-ident", +] + +[[package]] +name = "token-handler" +version = "0.0.0" +dependencies = [ + "bls-signature", + "multiversx-sc", + "transaction", + "utils", +] + +[[package]] +name = "token-handler-view-wasm" +version = "0.0.0" +dependencies = [ + "multiversx-sc-wasm-adapter", + "token-handler", +] + +[[package]] +name = "transaction" +version = "0.0.0" +dependencies = [ + "multiversx-sc", +] + +[[package]] +name = "unicode-ident" +version = "1.0.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3354b9ac3fae1ff6755cb6db53683adb661634f67557942dea4facebec0fee4b" + +[[package]] +name = "unwrap-infallible" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "151ac09978d3c2862c4e39b557f4eceee2cc72150bc4cb4f16abf061b6e381fb" + +[[package]] +name = "utils" +version = "0.0.0" +dependencies = [ + "bls-signature", + "multiversx-sc", +] From b0443fa1cc701472068beaa1e517b280f1fab228 Mon Sep 17 00:00:00 2001 From: Andrei Baltariu Date: Wed, 17 Jul 2024 14:01:33 +0300 Subject: [PATCH 159/523] Fixed build errors Signed-off-by: Andrei Baltariu --- token-handler/src/burn_tokens.rs | 2 +- token-handler/src/mint_tokens.rs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/token-handler/src/burn_tokens.rs b/token-handler/src/burn_tokens.rs index f556b3aa..1dc2e29c 100644 --- a/token-handler/src/burn_tokens.rs +++ b/token-handler/src/burn_tokens.rs @@ -8,7 +8,7 @@ pub trait BurnTokens: utils::UtilsModule + common::storage::CommonStorage { let sov_prefix = self.sov_prefix().get(); for token in operation.tokens.iter() { - if self.has_sov_prefix(&token.token_identifier, sov_prefix.clone()) { + if self.has_sov_prefix(&token.token_identifier, &sov_prefix) { continue; } diff --git a/token-handler/src/mint_tokens.rs b/token-handler/src/mint_tokens.rs index 3d7b6e3a..7357a78e 100644 --- a/token-handler/src/mint_tokens.rs +++ b/token-handler/src/mint_tokens.rs @@ -18,7 +18,7 @@ pub trait MintTokens: utils::UtilsModule + common::storage::CommonStorage { for operation_token in operation_tokens { let sov_prefix = self.sov_prefix().get(); - if !self.has_sov_prefix(&operation_token.token_identifier, sov_prefix) { + if !self.has_sov_prefix(&operation_token.token_identifier, &sov_prefix) { output_payments.push(operation_token.clone()); continue; } From ee4924d8555f2c9c298bed87cb094adcf1fc02c3 Mon Sep 17 00:00:00 2001 From: Andrei Baltariu Date: Wed, 17 Jul 2024 14:32:46 +0300 Subject: [PATCH 160/523] Modified lib file Signed-off-by: Andrei Baltariu --- token-handler/src/lib.rs | 11 ++++- token-handler/src/token_handler_proxy.rs | 42 ++++++++++++++++++- .../wasm-token-handler-full/src/lib.rs | 6 ++- token-handler/wasm/src/lib.rs | 6 ++- 4 files changed, 58 insertions(+), 7 deletions(-) diff --git a/token-handler/src/lib.rs b/token-handler/src/lib.rs index ce0f6ea4..1b225737 100644 --- a/token-handler/src/lib.rs +++ b/token-handler/src/lib.rs @@ -10,9 +10,16 @@ pub mod mint_tokens; pub mod token_handler_proxy; #[multiversx_sc::contract] -pub trait TokenHandler { +pub trait TokenHandler: + mint_tokens::MintTokens + + burn_tokens::BurnTokens + + utils::UtilsModule + + common::storage::CommonStorage +{ #[init] - fn init(&self) {} + fn init(&self, chain_prefix: ManagedBuffer) { + self.sov_prefix().set(chain_prefix); + } #[upgrade] fn upgrade(&self) {} diff --git a/token-handler/src/token_handler_proxy.rs b/token-handler/src/token_handler_proxy.rs index a4dc7ae0..418c363e 100644 --- a/token-handler/src/token_handler_proxy.rs +++ b/token-handler/src/token_handler_proxy.rs @@ -43,12 +43,16 @@ where From: TxFrom, Gas: TxGas, { - pub fn init( + pub fn init< + Arg0: ProxyArg>, + >( self, + chain_prefix: Arg0, ) -> TxTypedDeploy { self.wrapped_tx .payment(NotPayable) .raw_deploy() + .argument(&chain_prefix) .original_result() } } @@ -71,3 +75,39 @@ where .original_result() } } + +#[rustfmt::skip] +impl TokenHandlerProxyMethods +where + Env: TxEnv, + Env::Api: VMApi, + From: TxFrom, + To: TxTo, + Gas: TxGas, +{ + pub fn mint_tokens< + Arg0: ProxyArg>>, + >( + self, + operation_tokens: Arg0, + ) -> TxTypedCall>> { + self.wrapped_tx + .payment(NotPayable) + .raw_call("mintTokens") + .argument(&operation_tokens) + .original_result() + } + + pub fn burn_tokens< + Arg0: ProxyArg>, + >( + self, + operation: Arg0, + ) -> TxTypedCall { + self.wrapped_tx + .payment(NotPayable) + .raw_call("burnTokens") + .argument(&operation) + .original_result() + } +} diff --git a/token-handler/wasm-token-handler-full/src/lib.rs b/token-handler/wasm-token-handler-full/src/lib.rs index 411f8caa..79bf8a84 100644 --- a/token-handler/wasm-token-handler-full/src/lib.rs +++ b/token-handler/wasm-token-handler-full/src/lib.rs @@ -6,9 +6,9 @@ // Init: 1 // Upgrade: 1 -// Endpoints: 0 +// Endpoints: 2 // Async Callback (empty): 1 -// Total number of exported functions: 3 +// Total number of exported functions: 5 #![no_std] @@ -20,6 +20,8 @@ multiversx_sc_wasm_adapter::endpoints! { ( init => init upgrade => upgrade + mintTokens => mint_tokens + burnTokens => burn_tokens ) } diff --git a/token-handler/wasm/src/lib.rs b/token-handler/wasm/src/lib.rs index 411f8caa..79bf8a84 100644 --- a/token-handler/wasm/src/lib.rs +++ b/token-handler/wasm/src/lib.rs @@ -6,9 +6,9 @@ // Init: 1 // Upgrade: 1 -// Endpoints: 0 +// Endpoints: 2 // Async Callback (empty): 1 -// Total number of exported functions: 3 +// Total number of exported functions: 5 #![no_std] @@ -20,6 +20,8 @@ multiversx_sc_wasm_adapter::endpoints! { ( init => init upgrade => upgrade + mintTokens => mint_tokens + burnTokens => burn_tokens ) } From 63b16969a72950aefea4578a0097caa3f537fa02 Mon Sep 17 00:00:00 2001 From: Andrei Baltariu Date: Wed, 17 Jul 2024 14:32:52 +0300 Subject: [PATCH 161/523] Regenerated proxy Signed-off-by: Andrei Baltariu --- enshrine-esdt-safe/src/token_handler_proxy.rs | 42 ++++++++++++++++++- 1 file changed, 41 insertions(+), 1 deletion(-) diff --git a/enshrine-esdt-safe/src/token_handler_proxy.rs b/enshrine-esdt-safe/src/token_handler_proxy.rs index a4dc7ae0..418c363e 100644 --- a/enshrine-esdt-safe/src/token_handler_proxy.rs +++ b/enshrine-esdt-safe/src/token_handler_proxy.rs @@ -43,12 +43,16 @@ where From: TxFrom, Gas: TxGas, { - pub fn init( + pub fn init< + Arg0: ProxyArg>, + >( self, + chain_prefix: Arg0, ) -> TxTypedDeploy { self.wrapped_tx .payment(NotPayable) .raw_deploy() + .argument(&chain_prefix) .original_result() } } @@ -71,3 +75,39 @@ where .original_result() } } + +#[rustfmt::skip] +impl TokenHandlerProxyMethods +where + Env: TxEnv, + Env::Api: VMApi, + From: TxFrom, + To: TxTo, + Gas: TxGas, +{ + pub fn mint_tokens< + Arg0: ProxyArg>>, + >( + self, + operation_tokens: Arg0, + ) -> TxTypedCall>> { + self.wrapped_tx + .payment(NotPayable) + .raw_call("mintTokens") + .argument(&operation_tokens) + .original_result() + } + + pub fn burn_tokens< + Arg0: ProxyArg>, + >( + self, + operation: Arg0, + ) -> TxTypedCall { + self.wrapped_tx + .payment(NotPayable) + .raw_call("burnTokens") + .argument(&operation) + .original_result() + } +} From 4b344d636f65b5a78149a57dcbbfd0fae365b476 Mon Sep 17 00:00:00 2001 From: Andrei Baltariu Date: Wed, 17 Jul 2024 15:29:19 +0300 Subject: [PATCH 162/523] WIP Added call to token handler Signed-off-by: Andrei Baltariu --- .../src/from_sovereign/transfer_tokens.rs | 50 +++++++++++++++---- 1 file changed, 40 insertions(+), 10 deletions(-) diff --git a/enshrine-esdt-safe/src/from_sovereign/transfer_tokens.rs b/enshrine-esdt-safe/src/from_sovereign/transfer_tokens.rs index f0f7a3ce..ef2d892e 100644 --- a/enshrine-esdt-safe/src/from_sovereign/transfer_tokens.rs +++ b/enshrine-esdt-safe/src/from_sovereign/transfer_tokens.rs @@ -54,16 +54,21 @@ pub trait TransferTokensModule: return; } - // let token_handler_address = self.token_handler_address().get(); - // self.tx() - // .to(token_handler_address) - // .typed(token_handler_proxy::TokenHandlerProxy) - // .mint_tokens(); - let minted_operation_tokens = self.mint_tokens(&operation.tokens); - let operation_tuple = OperationTuple { - op_hash: operation_hash.clone(), - operation: operation.clone(), - }; + let token_handler_address = self.token_handler_address().get(); + self.tx() + .to(token_handler_address) + .typed(token_handler_proxy::TokenHandlerProxy) + .mint_tokens(MultiValueEncoded::from(operation.tokens.clone())) + .callback( + ::callbacks(self).return_minted_tokens( + operation_hash, + hash_of_hashes, + operation, + ), + ) + .async_call_and_exit(); + + // let minted_operation_tokens = self.mint_tokens(&operation.tokens); self.distribute_payments( hash_of_hashes.clone(), @@ -72,6 +77,31 @@ pub trait TransferTokensModule: ); } + #[promises_callback] + fn return_minted_tokens( + &self, + operation_hash: ManagedBuffer, + hash_of_hashes: ManagedBuffer, + operation: Operation, + #[call_result] result: ManagedAsyncCallResult, + ) -> MultiValueEncoded> { + match result { + ManagedAsyncCallResult::Ok(tokens) => { + let operation_tuple = OperationTuple { + op_hash: operation_hash.clone(), + operation: operation.clone(), + }; + + self.distribute_payments( + hash_of_hashes.clone(), + operation_tuple, + minted_operation_tokens, + ); + } + } + MultiValueEncoded::new() + } + #[endpoint(registerNewTokenID)] #[payable("*")] fn register_new_token_id(&self, tokens: MultiValueEncoded) { From d2e1093312e680421f85b80ed679eb3ee6ce1c6a Mon Sep 17 00:00:00 2001 From: Andrei Baltariu Date: Wed, 17 Jul 2024 16:32:46 +0300 Subject: [PATCH 163/523] Added storage for operation tokens Signed-off-by: Andrei Baltariu --- token-handler/src/common/storage.rs | 6 +++++- token-handler/src/mint_tokens.rs | 9 +++------ 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/token-handler/src/common/storage.rs b/token-handler/src/common/storage.rs index ce708adb..52918df1 100644 --- a/token-handler/src/common/storage.rs +++ b/token-handler/src/common/storage.rs @@ -1,7 +1,11 @@ -use multiversx_sc::imports::SingleValueMapper; +use multiversx_sc::imports::{SingleValueMapper, VecMapper}; +use transaction::OperationEsdtPayment; #[multiversx_sc::module] pub trait CommonStorage { #[storage_mapper] fn sov_prefix(&self) -> SingleValueMapper; + + #[storage_mapper("mintedTokens")] + fn minted_tokens(&self) -> VecMapper>; } diff --git a/token-handler/src/mint_tokens.rs b/token-handler/src/mint_tokens.rs index 7357a78e..afc7bb4d 100644 --- a/token-handler/src/mint_tokens.rs +++ b/token-handler/src/mint_tokens.rs @@ -9,10 +9,7 @@ use crate::common; #[multiversx_sc::module] pub trait MintTokens: utils::UtilsModule + common::storage::CommonStorage { #[endpoint(mintTokens)] - fn mint_tokens( - &self, - operation_tokens: MultiValueEncoded>, - ) -> MultiValueEncoded> { + fn mint_tokens(&self, operation_tokens: MultiValueEncoded>) { let mut output_payments: ManagedVec> = ManagedVec::new(); @@ -70,13 +67,13 @@ pub trait MintTokens: utils::UtilsModule + common::storage::CommonStorage { } } + self.minted_tokens().push(&operation_token); + output_payments.push(OperationEsdtPayment { token_identifier: operation_token.token_identifier, token_nonce: nonce, token_data: operation_token.token_data, }); } - - output_payments.into() } } From 426b674926bc19a281224454eb5ac832678a69fa Mon Sep 17 00:00:00 2001 From: Andrei Baltariu Date: Wed, 17 Jul 2024 16:59:53 +0300 Subject: [PATCH 164/523] Added minted_tokens mapper to enshrine Signed-off-by: Andrei Baltariu --- enshrine-esdt-safe/src/common/storage.rs | 4 ++++ token-handler/src/common/storage.rs | 6 +----- token-handler/src/mint_tokens.rs | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/enshrine-esdt-safe/src/common/storage.rs b/enshrine-esdt-safe/src/common/storage.rs index 3390f71b..7c56d22b 100644 --- a/enshrine-esdt-safe/src/common/storage.rs +++ b/enshrine-esdt-safe/src/common/storage.rs @@ -1,4 +1,5 @@ use multiversx_sc::imports::*; +use transaction::OperationEsdtPayment; #[multiversx_sc::module] pub trait CommonStorage { @@ -13,4 +14,7 @@ pub trait CommonStorage { #[storage_mapper("tokenHandlerAddress")] fn token_handler_address(&self) -> SingleValueMapper; + + #[storage_mapper("mintedTokens")] + fn minted_tokens(&self) -> VecMapper>; } diff --git a/token-handler/src/common/storage.rs b/token-handler/src/common/storage.rs index 52918df1..ce708adb 100644 --- a/token-handler/src/common/storage.rs +++ b/token-handler/src/common/storage.rs @@ -1,11 +1,7 @@ -use multiversx_sc::imports::{SingleValueMapper, VecMapper}; -use transaction::OperationEsdtPayment; +use multiversx_sc::imports::SingleValueMapper; #[multiversx_sc::module] pub trait CommonStorage { #[storage_mapper] fn sov_prefix(&self) -> SingleValueMapper; - - #[storage_mapper("mintedTokens")] - fn minted_tokens(&self) -> VecMapper>; } diff --git a/token-handler/src/mint_tokens.rs b/token-handler/src/mint_tokens.rs index afc7bb4d..349ad140 100644 --- a/token-handler/src/mint_tokens.rs +++ b/token-handler/src/mint_tokens.rs @@ -1,7 +1,7 @@ use multiversx_sc::api::ESDT_NFT_CREATE_FUNC_NAME; use multiversx_sc::types::ManagedArgBuffer; use multiversx_sc::types::{ManagedVec, MultiValueEncoded}; -use multiversx_sc::{codec, err_msg}; +use multiversx_sc::{codec, err_msg, require}; use transaction::OperationEsdtPayment; use crate::common; From 14b833ccf29c9385fee16a52ff50f584ddc8b78d Mon Sep 17 00:00:00 2001 From: Andrei Baltariu Date: Thu, 18 Jul 2024 11:26:37 +0300 Subject: [PATCH 165/523] Modified enshrine to fit new token handler logic Signed-off-by: Andrei Baltariu --- .../src/from_sovereign/transfer_tokens.rs | 44 ++++++++----------- enshrine-esdt-safe/src/token_handler_proxy.rs | 2 +- .../wasm-enshrine-esdt-safe-full/src/lib.rs | 5 ++- enshrine-esdt-safe/wasm/src/lib.rs | 5 ++- token-handler/src/mint_tokens.rs | 2 +- token-handler/src/token_handler_proxy.rs | 2 +- 6 files changed, 27 insertions(+), 33 deletions(-) diff --git a/enshrine-esdt-safe/src/from_sovereign/transfer_tokens.rs b/enshrine-esdt-safe/src/from_sovereign/transfer_tokens.rs index ef2d892e..5090bb3f 100644 --- a/enshrine-esdt-safe/src/from_sovereign/transfer_tokens.rs +++ b/enshrine-esdt-safe/src/from_sovereign/transfer_tokens.rs @@ -55,51 +55,43 @@ pub trait TransferTokensModule: } let token_handler_address = self.token_handler_address().get(); + let operation_tuple = OperationTuple { + op_hash: operation_hash, + operation: operation.clone(), + }; + self.tx() .to(token_handler_address) .typed(token_handler_proxy::TokenHandlerProxy) .mint_tokens(MultiValueEncoded::from(operation.tokens.clone())) .callback( - ::callbacks(self).return_minted_tokens( - operation_hash, - hash_of_hashes, - operation, - ), + ::callbacks(self) + .save_minted_tokens(&operation_tuple, hash_of_hashes), ) .async_call_and_exit(); - - // let minted_operation_tokens = self.mint_tokens(&operation.tokens); - - self.distribute_payments( - hash_of_hashes.clone(), - operation_tuple, - minted_operation_tokens, - ); } #[promises_callback] - fn return_minted_tokens( + fn save_minted_tokens( &self, - operation_hash: ManagedBuffer, + operation_tuple: &OperationTuple, hash_of_hashes: ManagedBuffer, - operation: Operation, - #[call_result] result: ManagedAsyncCallResult, - ) -> MultiValueEncoded> { + #[call_result] result: ManagedAsyncCallResult< + MultiValueEncoded>, + >, + ) { match result { ManagedAsyncCallResult::Ok(tokens) => { - let operation_tuple = OperationTuple { - op_hash: operation_hash.clone(), - operation: operation.clone(), - }; - self.distribute_payments( hash_of_hashes.clone(), - operation_tuple, - minted_operation_tokens, + operation_tuple.clone(), + tokens.to_vec(), ); } + ManagedAsyncCallResult::Err(_) => { + sc_panic!("Error at minting tokens"); + } } - MultiValueEncoded::new() } #[endpoint(registerNewTokenID)] diff --git a/enshrine-esdt-safe/src/token_handler_proxy.rs b/enshrine-esdt-safe/src/token_handler_proxy.rs index 418c363e..83c00023 100644 --- a/enshrine-esdt-safe/src/token_handler_proxy.rs +++ b/enshrine-esdt-safe/src/token_handler_proxy.rs @@ -90,7 +90,7 @@ where >( self, operation_tokens: Arg0, - ) -> TxTypedCall>> { + ) -> TxTypedCall { self.wrapped_tx .payment(NotPayable) .raw_call("mintTokens") diff --git a/enshrine-esdt-safe/wasm-enshrine-esdt-safe-full/src/lib.rs b/enshrine-esdt-safe/wasm-enshrine-esdt-safe-full/src/lib.rs index d7a87d6b..3d62b31d 100644 --- a/enshrine-esdt-safe/wasm-enshrine-esdt-safe-full/src/lib.rs +++ b/enshrine-esdt-safe/wasm-enshrine-esdt-safe-full/src/lib.rs @@ -8,8 +8,8 @@ // Upgrade: 1 // Endpoints: 28 // Async Callback: 1 -// Promise callbacks: 1 -// Total number of exported functions: 32 +// Promise callbacks: 2 +// Total number of exported functions: 33 #![no_std] @@ -49,6 +49,7 @@ multiversx_sc_wasm_adapter::endpoints! { pause => pause_endpoint unpause => unpause_endpoint isPaused => paused_status + save_minted_tokens => save_minted_tokens execute => execute ) } diff --git a/enshrine-esdt-safe/wasm/src/lib.rs b/enshrine-esdt-safe/wasm/src/lib.rs index d7a87d6b..3d62b31d 100644 --- a/enshrine-esdt-safe/wasm/src/lib.rs +++ b/enshrine-esdt-safe/wasm/src/lib.rs @@ -8,8 +8,8 @@ // Upgrade: 1 // Endpoints: 28 // Async Callback: 1 -// Promise callbacks: 1 -// Total number of exported functions: 32 +// Promise callbacks: 2 +// Total number of exported functions: 33 #![no_std] @@ -49,6 +49,7 @@ multiversx_sc_wasm_adapter::endpoints! { pause => pause_endpoint unpause => unpause_endpoint isPaused => paused_status + save_minted_tokens => save_minted_tokens execute => execute ) } diff --git a/token-handler/src/mint_tokens.rs b/token-handler/src/mint_tokens.rs index 349ad140..ac12409b 100644 --- a/token-handler/src/mint_tokens.rs +++ b/token-handler/src/mint_tokens.rs @@ -67,7 +67,7 @@ pub trait MintTokens: utils::UtilsModule + common::storage::CommonStorage { } } - self.minted_tokens().push(&operation_token); + // self.minted_tokens().push(&operation_token); output_payments.push(OperationEsdtPayment { token_identifier: operation_token.token_identifier, diff --git a/token-handler/src/token_handler_proxy.rs b/token-handler/src/token_handler_proxy.rs index 418c363e..83c00023 100644 --- a/token-handler/src/token_handler_proxy.rs +++ b/token-handler/src/token_handler_proxy.rs @@ -90,7 +90,7 @@ where >( self, operation_tokens: Arg0, - ) -> TxTypedCall>> { + ) -> TxTypedCall { self.wrapped_tx .payment(NotPayable) .raw_call("mintTokens") From 484e8869ac5dfa893a2810e8711745603be68f48 Mon Sep 17 00:00:00 2001 From: Andrei Baltariu Date: Thu, 18 Jul 2024 11:29:55 +0300 Subject: [PATCH 166/523] Removed unnecessary argument and if condition Signed-off-by: Andrei Baltariu --- .../tests/enshrine_esdt_safe_blackbox_test.rs | 23 ++++++------------- 1 file changed, 7 insertions(+), 16 deletions(-) diff --git a/enshrine-esdt-safe/tests/enshrine_esdt_safe_blackbox_test.rs b/enshrine-esdt-safe/tests/enshrine_esdt_safe_blackbox_test.rs index 1d370730..1c785f3d 100644 --- a/enshrine-esdt-safe/tests/enshrine_esdt_safe_blackbox_test.rs +++ b/enshrine-esdt-safe/tests/enshrine_esdt_safe_blackbox_test.rs @@ -163,15 +163,10 @@ impl EnshrineTestState { fn propose_execute_operation( &mut self, - has_prefix: bool, error_status: Option, tokens: &Vec, ) { - let (tokens, data) = if has_prefix { - self.setup_payments(tokens) - } else { - self.setup_payments(tokens) - }; + let (tokens, data) = self.setup_payments(tokens); let to = managed_address!(&Address::from(&RECEIVER_ADDRESS.eval_to_array())); let operation = Operation { to, tokens, data }; let operation_hash = self.get_operation_hash(&operation); @@ -202,12 +197,8 @@ impl EnshrineTestState { } } - fn propose_register_operation(&mut self, has_prefix: bool, tokens: &Vec) { - let (tokens, data) = if has_prefix { - self.setup_payments(tokens) - } else { - self.setup_payments(tokens) - }; + fn propose_register_operation(&mut self, tokens: &Vec) { + let (tokens, data) = self.setup_payments(tokens); let to = managed_address!(&Address::from(RECEIVER_ADDRESS.eval_to_array())); let operation = Operation { to, tokens, data }; let operation_hash = self.get_operation_hash(&operation); @@ -330,8 +321,8 @@ fn test_sovereign_prefix_no_prefix() { let token_vec = Vec::from([NFT_TOKEN_ID, CROWD_TOKEN_ID]); state.propose_setup_contracts(false); - state.propose_register_operation(false, &token_vec); - state.propose_execute_operation(false, None, &token_vec); + state.propose_register_operation(&token_vec); + state.propose_execute_operation(None, &token_vec); } #[test] @@ -340,8 +331,8 @@ fn test_sovereign_prefix_has_prefix() { let token_vec = Vec::from([PREFIX_NFT_TOKEN_ID, CROWD_TOKEN_ID]); state.propose_setup_contracts(false); - state.propose_register_operation(true, &token_vec); - state.propose_execute_operation(true, None, &token_vec); + state.propose_register_operation(&token_vec); + state.propose_execute_operation(None, &token_vec); } #[test] From ca479d93d2bb999c0ad4af9557e66c775dc2602f Mon Sep 17 00:00:00 2001 From: Andrei Baltariu Date: Thu, 18 Jul 2024 12:39:02 +0300 Subject: [PATCH 167/523] Added package depedency and setup for token handler Signed-off-by: Andrei Baltariu --- Cargo.lock | 13 +++++++++ enshrine-esdt-safe/Cargo.toml | 3 +++ .../tests/enshrine_esdt_safe_blackbox_test.rs | 27 ++++++++++++++++++- token-handler/Cargo.toml | 6 ----- 4 files changed, 42 insertions(+), 7 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 35328cfa..1c65bb67 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -341,6 +341,7 @@ dependencies = [ "num-bigint", "num-traits", "setup-phase", + "token-handler", "token-whitelist", "transaction", "tx-batch-module", @@ -1057,6 +1058,18 @@ dependencies = [ "winapi-util", ] +[[package]] +name = "token-handler" +version = "0.0.0" +dependencies = [ + "bls-signature", + "multiversx-sc", + "multiversx-sc-scenario", + "num-bigint", + "transaction", + "utils", +] + [[package]] name = "token-whitelist" version = "0.0.0" diff --git a/enshrine-esdt-safe/Cargo.toml b/enshrine-esdt-safe/Cargo.toml index 9a970b70..9f06d578 100644 --- a/enshrine-esdt-safe/Cargo.toml +++ b/enshrine-esdt-safe/Cargo.toml @@ -35,6 +35,9 @@ path = "../fee-market" [dependencies.header-verifier] path = "../header-verifier" +[dependencies.token-handler] +path = "../token-handler" + [dependencies.multiversx-sc] version = "=0.51.1" diff --git a/enshrine-esdt-safe/tests/enshrine_esdt_safe_blackbox_test.rs b/enshrine-esdt-safe/tests/enshrine_esdt_safe_blackbox_test.rs index 1c785f3d..203041d9 100644 --- a/enshrine-esdt-safe/tests/enshrine_esdt_safe_blackbox_test.rs +++ b/enshrine-esdt-safe/tests/enshrine_esdt_safe_blackbox_test.rs @@ -10,6 +10,7 @@ use multiversx_sc_scenario::api::StaticApi; use multiversx_sc_scenario::multiversx_chain_vm::crypto_functions::sha256; use multiversx_sc_scenario::{imports::MxscPath, ScenarioWorld}; use multiversx_sc_scenario::{managed_address, ExpectError, ScenarioTxRun}; +use token_handler::token_handler_proxy; use transaction::{ Operation, OperationData, OperationEsdtPayment, StolenFromFrameworkEsdtTokenData, }; @@ -26,6 +27,10 @@ const HEADER_VERIFIER_ADDRESS: TestSCAddress = TestSCAddress::new("header_verifi const HEADER_VERIFIER_CODE_PATH: MxscPath = MxscPath::new("../header-verifier/output/header-verifier.mxsc.json"); +const TOKEN_HANDLER_ADDRESS: TestSCAddress = TestSCAddress::new("token_handler"); +const TOKEN_HANDLER_CODE_PATH: MxscPath = + MxscPath::new("../token-handler/output/token-handler.mxsc.json"); + const USER_ADDRESS: TestAddress = TestAddress::new("user"); const INSUFFICIENT_WEGLD_ADDRESS: TestAddress = TestAddress::new("insufficient_wegld"); const RECEIVER_ADDRESS: TestAddress = TestAddress::new("receiver"); @@ -49,6 +54,7 @@ fn world() -> ScenarioWorld { blockchain.register_contract(ENSHRINE_ESDT_CODE_PATH, enshrine_esdt_safe::ContractBuilder); blockchain.register_contract(HEADER_VERIFIER_CODE_PATH, header_verifier::ContractBuilder); + blockchain.register_contract(TOKEN_HANDLER_CODE_PATH, token_handler::ContractBuilder); blockchain } @@ -122,7 +128,12 @@ impl EnshrineTestState { .tx() .from(ENSHRINE_ESDT_OWNER_ADDRESS) .typed(enshrine_esdt_safe_proxy::EnshrineEsdtSafeProxy) - .init(is_sovereign_chain, wegld_identifier, sovereign_token_prefix) + .init( + is_sovereign_chain, + TOKEN_HANDLER_ADDRESS, + wegld_identifier, + sovereign_token_prefix, + ) .code(ENSHRINE_ESDT_CODE_PATH) .new_address(ENSHRINE_ESDT_ADDRESS) .run(); @@ -149,6 +160,19 @@ impl EnshrineTestState { self } + fn deploy_token_handler_contract(&mut self) -> &mut Self { + self.world + .tx() + .from(ENSHRINE_ESDT_OWNER_ADDRESS) + .typed(token_handler_proxy::TokenHandlerProxy) + .init(SOVEREIGN_TOKEN_PREFIX) + .code(TOKEN_HANDLER_CODE_PATH) + .new_address(TOKEN_HANDLER_ADDRESS) + .run(); + + self + } + fn propose_setup_contracts(&mut self, is_sovereign_chain: bool) -> &mut Self { self.deploy_enshrine_esdt_contract( is_sovereign_chain, @@ -156,6 +180,7 @@ impl EnshrineTestState { Some(SOVEREIGN_TOKEN_PREFIX.into()), ); self.deploy_header_verifier_contract(); + self.deploy_token_handler_contract(); self.propose_set_header_verifier_address(); self diff --git a/token-handler/Cargo.toml b/token-handler/Cargo.toml index a625d0f9..981a20ce 100644 --- a/token-handler/Cargo.toml +++ b/token-handler/Cargo.toml @@ -25,9 +25,3 @@ num-bigint = "0.4" [dev-dependencies.multiversx-sc-scenario] version = "0.51.1" - -[workspace] -members = [ - ".", - "meta", -] From 859850b519f6a95afdb306841a137d5ea9ed699c Mon Sep 17 00:00:00 2001 From: Andrei Baltariu Date: Thu, 18 Jul 2024 14:51:13 +0300 Subject: [PATCH 168/523] WIP minting logic in executeBridgeOps Signed-off-by: Andrei Baltariu --- .../src/from_sovereign/transfer_tokens.rs | 27 ++++++++++--------- token-handler/src/mint_tokens.rs | 2 +- 2 files changed, 16 insertions(+), 13 deletions(-) diff --git a/enshrine-esdt-safe/src/from_sovereign/transfer_tokens.rs b/enshrine-esdt-safe/src/from_sovereign/transfer_tokens.rs index 5090bb3f..5eea5ef2 100644 --- a/enshrine-esdt-safe/src/from_sovereign/transfer_tokens.rs +++ b/enshrine-esdt-safe/src/from_sovereign/transfer_tokens.rs @@ -54,39 +54,42 @@ pub trait TransferTokensModule: return; } - let token_handler_address = self.token_handler_address().get(); let operation_tuple = OperationTuple { op_hash: operation_hash, operation: operation.clone(), }; + // self.distribute_payments( + // hash_of_hashes.clone(), + // operation_tuple.clone(), + // tokens.to_vec(), + // ); + } + + #[endpoint] + fn call_token_handler_mint_endpoint(&self, operation: Operation) { + let token_handler_address = self.token_handler_address().get(); + self.tx() .to(token_handler_address) .typed(token_handler_proxy::TokenHandlerProxy) .mint_tokens(MultiValueEncoded::from(operation.tokens.clone())) - .callback( - ::callbacks(self) - .save_minted_tokens(&operation_tuple, hash_of_hashes), - ) + .callback(::callbacks(self).save_minted_tokens()) .async_call_and_exit(); } #[promises_callback] fn save_minted_tokens( &self, - operation_tuple: &OperationTuple, - hash_of_hashes: ManagedBuffer, #[call_result] result: ManagedAsyncCallResult< MultiValueEncoded>, >, ) { match result { ManagedAsyncCallResult::Ok(tokens) => { - self.distribute_payments( - hash_of_hashes.clone(), - operation_tuple.clone(), - tokens.to_vec(), - ); + for token in tokens { + self.minted_tokens().push(&token); + } } ManagedAsyncCallResult::Err(_) => { sc_panic!("Error at minting tokens"); diff --git a/token-handler/src/mint_tokens.rs b/token-handler/src/mint_tokens.rs index ac12409b..e31dedf5 100644 --- a/token-handler/src/mint_tokens.rs +++ b/token-handler/src/mint_tokens.rs @@ -1,7 +1,7 @@ use multiversx_sc::api::ESDT_NFT_CREATE_FUNC_NAME; use multiversx_sc::types::ManagedArgBuffer; use multiversx_sc::types::{ManagedVec, MultiValueEncoded}; -use multiversx_sc::{codec, err_msg, require}; +use multiversx_sc::{codec, err_msg}; use transaction::OperationEsdtPayment; use crate::common; From 50972f6c1cb7f38be06e58cbbea600f6e1c28b95 Mon Sep 17 00:00:00 2001 From: Andrei Baltariu Date: Thu, 18 Jul 2024 16:43:04 +0300 Subject: [PATCH 169/523] Added distribute payments logic Signed-off-by: Andrei Baltariu --- .../src/from_sovereign/transfer_tokens.rs | 1 + token-handler/src/mint_tokens.rs | 104 +++++++++++++++++- 2 files changed, 102 insertions(+), 3 deletions(-) diff --git a/enshrine-esdt-safe/src/from_sovereign/transfer_tokens.rs b/enshrine-esdt-safe/src/from_sovereign/transfer_tokens.rs index 5eea5ef2..05fe9217 100644 --- a/enshrine-esdt-safe/src/from_sovereign/transfer_tokens.rs +++ b/enshrine-esdt-safe/src/from_sovereign/transfer_tokens.rs @@ -206,6 +206,7 @@ pub trait TransferTokensModule: output_payments } + fn distribute_payments( &self, hash_of_hashes: ManagedBuffer, diff --git a/token-handler/src/mint_tokens.rs b/token-handler/src/mint_tokens.rs index e31dedf5..cf7604a9 100644 --- a/token-handler/src/mint_tokens.rs +++ b/token-handler/src/mint_tokens.rs @@ -1,8 +1,12 @@ -use multiversx_sc::api::ESDT_NFT_CREATE_FUNC_NAME; -use multiversx_sc::types::ManagedArgBuffer; +use multiversx_sc::api::{ESDT_MULTI_TRANSFER_FUNC_NAME, ESDT_NFT_CREATE_FUNC_NAME}; +use multiversx_sc::imports::IgnoreValue; +use multiversx_sc::types::{EsdtTokenPayment, ManagedArgBuffer, ManagedAsyncCallResult}; use multiversx_sc::types::{ManagedVec, MultiValueEncoded}; use multiversx_sc::{codec, err_msg}; -use transaction::OperationEsdtPayment; +use transaction::{GasLimit, OperationEsdtPayment, OperationTuple}; + +const CALLBACK_GAS: GasLimit = 10_000_000; // Increase if not enough +const TRANSACTION_GAS: GasLimit = 30_000_000; use crate::common; @@ -76,4 +80,98 @@ pub trait MintTokens: utils::UtilsModule + common::storage::CommonStorage { }); } } + fn distribute_payments( + &self, + hash_of_hashes: ManagedBuffer, + operation_tuple: OperationTuple, + tokens_list: ManagedVec>, + ) { + let mapped_tokens: ManagedVec> = + tokens_list.iter().map(|token| token.into()).collect(); + + match &operation_tuple.operation.data.opt_transfer_data { + Some(transfer_data) => { + let mut args = ManagedArgBuffer::new(); + for arg in &transfer_data.args { + args.push_arg(arg); + } + + self.tx() + .to(&operation_tuple.operation.to) + .raw_call(transfer_data.function.clone()) + .arguments_raw(args.clone()) + .multi_esdt(mapped_tokens.clone()) + .gas(transfer_data.gas_limit) + .callback( + ::callbacks(self) + .execute(&hash_of_hashes, &operation_tuple), + ) + .gas_for_callback(CALLBACK_GAS) + .register_promise(); + } + None => { + let own_address = self.blockchain().get_sc_address(); + let args = + self.get_contract_call_args(&operation_tuple.operation.to, mapped_tokens); + + self.tx() + .to(own_address) + .raw_call(ESDT_MULTI_TRANSFER_FUNC_NAME) + .arguments_raw(args) + .gas(TRANSACTION_GAS) + .callback( + ::callbacks(self) + .execute(&hash_of_hashes, &operation_tuple), + ) + .register_promise(); + } + } + } + + #[promises_callback] + fn execute( + &self, + hash_of_hashes: &ManagedBuffer, + operation_tuple: &OperationTuple, + #[call_result] result: ManagedAsyncCallResult, + ) { + match result { + ManagedAsyncCallResult::Ok(_) => { + // self.execute_bridge_operation_event( + // hash_of_hashes.clone(), + // operation_tuple.op_hash.clone(), + // ); + } + ManagedAsyncCallResult::Err(_) => { + // self.burn_sovereign_tokens(&operation_tuple.operation); + // self.emit_transfer_failed_events(hash_of_hashes, operation_tuple); + } + } + + // let header_verifier_address = self.header_verifier_address().get(); + // + // self.tx() + // .to(header_verifier_address) + // .typed(header_verifier_proxy::HeaderverifierProxy) + // .remove_executed_hash(hash_of_hashes, &operation_tuple.op_hash) + // .sync_call(); + } + + fn get_contract_call_args( + self, + to: &ManagedAddress, + mapped_tokens: ManagedVec>, + ) -> ManagedArgBuffer { + let mut args = ManagedArgBuffer::new(); + args.push_arg(to); + args.push_arg(mapped_tokens.len()); + + for token in &mapped_tokens { + args.push_arg(token.token_identifier); + args.push_arg(token.token_nonce); + args.push_arg(token.amount); + } + + args + } } From 40d0da923c063ffba0367e9dea798d19c8ca2aab Mon Sep 17 00:00:00 2001 From: Andrei Baltariu Date: Fri, 19 Jul 2024 09:46:05 +0300 Subject: [PATCH 170/523] Added storage and setup in init for header verifier address Signed-off-by: Andrei Baltariu --- token-handler/src/common/storage.rs | 3 +++ token-handler/src/lib.rs | 9 ++++++++- token-handler/src/mint_tokens.rs | 3 +-- 3 files changed, 12 insertions(+), 3 deletions(-) diff --git a/token-handler/src/common/storage.rs b/token-handler/src/common/storage.rs index ce708adb..46ab6d16 100644 --- a/token-handler/src/common/storage.rs +++ b/token-handler/src/common/storage.rs @@ -4,4 +4,7 @@ use multiversx_sc::imports::SingleValueMapper; pub trait CommonStorage { #[storage_mapper] fn sov_prefix(&self) -> SingleValueMapper; + + #[storage_mapper] + fn header_verifier_address(&self) -> SingleValueMapper; } diff --git a/token-handler/src/lib.rs b/token-handler/src/lib.rs index 1b225737..c399a982 100644 --- a/token-handler/src/lib.rs +++ b/token-handler/src/lib.rs @@ -17,7 +17,14 @@ pub trait TokenHandler: + common::storage::CommonStorage { #[init] - fn init(&self, chain_prefix: ManagedBuffer) { + fn init(&self, header_verifier_address: ManagedAddress, chain_prefix: ManagedBuffer) { + require!( + self.blockchain() + .is_smart_contract(&header_verifier_address), + "Header Verifier address is not a SC contract address" + ); + + self.header_verifier_address().set(header_verifier_address); self.sov_prefix().set(chain_prefix); } diff --git a/token-handler/src/mint_tokens.rs b/token-handler/src/mint_tokens.rs index cf7604a9..6b47778a 100644 --- a/token-handler/src/mint_tokens.rs +++ b/token-handler/src/mint_tokens.rs @@ -71,8 +71,6 @@ pub trait MintTokens: utils::UtilsModule + common::storage::CommonStorage { } } - // self.minted_tokens().push(&operation_token); - output_payments.push(OperationEsdtPayment { token_identifier: operation_token.token_identifier, token_nonce: nonce, @@ -80,6 +78,7 @@ pub trait MintTokens: utils::UtilsModule + common::storage::CommonStorage { }); } } + fn distribute_payments( &self, hash_of_hashes: ManagedBuffer, From 20bb52c8033302a10f3fd61c52177b57df7e8cf9 Mon Sep 17 00:00:00 2001 From: Andrei Baltariu Date: Fri, 19 Jul 2024 09:48:26 +0300 Subject: [PATCH 171/523] Added header-verifier dependency and sync call Signed-off-by: Andrei Baltariu --- Cargo.lock | 1 + token-handler/Cargo.toml | 3 +++ token-handler/src/mint_tokens.rs | 15 ++++++++------- 3 files changed, 12 insertions(+), 7 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 1c65bb67..ec2bb88a 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1063,6 +1063,7 @@ name = "token-handler" version = "0.0.0" dependencies = [ "bls-signature", + "header-verifier", "multiversx-sc", "multiversx-sc-scenario", "num-bigint", diff --git a/token-handler/Cargo.toml b/token-handler/Cargo.toml index 981a20ce..18a2666c 100644 --- a/token-handler/Cargo.toml +++ b/token-handler/Cargo.toml @@ -17,6 +17,9 @@ path = "../common/transaction" [dependencies.bls-signature] path = "../common/bls-signature/" +[dependencies.header-verifier] +path = "../header-verifier/" + [dependencies.multiversx-sc] version = "0.51.1" diff --git a/token-handler/src/mint_tokens.rs b/token-handler/src/mint_tokens.rs index 6b47778a..cd6d05d8 100644 --- a/token-handler/src/mint_tokens.rs +++ b/token-handler/src/mint_tokens.rs @@ -1,3 +1,4 @@ +use header_verifier::header_verifier_proxy; use multiversx_sc::api::{ESDT_MULTI_TRANSFER_FUNC_NAME, ESDT_NFT_CREATE_FUNC_NAME}; use multiversx_sc::imports::IgnoreValue; use multiversx_sc::types::{EsdtTokenPayment, ManagedArgBuffer, ManagedAsyncCallResult}; @@ -147,13 +148,13 @@ pub trait MintTokens: utils::UtilsModule + common::storage::CommonStorage { } } - // let header_verifier_address = self.header_verifier_address().get(); - // - // self.tx() - // .to(header_verifier_address) - // .typed(header_verifier_proxy::HeaderverifierProxy) - // .remove_executed_hash(hash_of_hashes, &operation_tuple.op_hash) - // .sync_call(); + let header_verifier_address = self.header_verifier_address().get(); + + self.tx() + .to(header_verifier_address) + .typed(header_verifier_proxy::HeaderverifierProxy) + .remove_executed_hash(hash_of_hashes, &operation_tuple.op_hash) + .sync_call(); } fn get_contract_call_args( From f9abf8a01a96ca62cf144d31e00f1825c005ec0d Mon Sep 17 00:00:00 2001 From: Andrei Baltariu Date: Fri, 19 Jul 2024 10:37:17 +0300 Subject: [PATCH 172/523] Added tx-batch module dependency and created events module Signed-off-by: Andrei Baltariu --- token-handler/Cargo.toml | 3 +++ token-handler/src/common/events.rs | 21 +++++++++++++++ token-handler/src/common/mod.rs | 1 + token-handler/src/events.rs | 0 token-handler/src/lib.rs | 3 ++- token-handler/src/mint_tokens.rs | 42 +++++++++++++++++++++++++----- 6 files changed, 63 insertions(+), 7 deletions(-) create mode 100644 token-handler/src/common/events.rs delete mode 100644 token-handler/src/events.rs diff --git a/token-handler/Cargo.toml b/token-handler/Cargo.toml index 18a2666c..d88a13ac 100644 --- a/token-handler/Cargo.toml +++ b/token-handler/Cargo.toml @@ -20,6 +20,9 @@ path = "../common/bls-signature/" [dependencies.header-verifier] path = "../header-verifier/" +[dependencies.tx-batch-module] +path = "../common/tx-batch-module" + [dependencies.multiversx-sc] version = "0.51.1" diff --git a/token-handler/src/common/events.rs b/token-handler/src/common/events.rs new file mode 100644 index 00000000..dfce962d --- /dev/null +++ b/token-handler/src/common/events.rs @@ -0,0 +1,21 @@ +use transaction::OperationData; + +multiversx_sc::imports!(); + +#[multiversx_sc::module] +pub trait EventsModule { + #[event("executedBridgeOp")] + fn execute_bridge_operation_event( + &self, + #[indexed] hash_of_hashes: ManagedBuffer, + #[indexed] hash_of_bridge_op: ManagedBuffer, + ); + + #[event("deposit")] + fn deposit_event( + &self, + #[indexed] dest_address: &ManagedAddress, + #[indexed] tokens: &MultiValueEncoded>, + event_data: OperationData, + ); +} diff --git a/token-handler/src/common/mod.rs b/token-handler/src/common/mod.rs index 30f61eb6..663b8166 100644 --- a/token-handler/src/common/mod.rs +++ b/token-handler/src/common/mod.rs @@ -1 +1,2 @@ +pub mod events; pub mod storage; diff --git a/token-handler/src/events.rs b/token-handler/src/events.rs deleted file mode 100644 index e69de29b..00000000 diff --git a/token-handler/src/lib.rs b/token-handler/src/lib.rs index c399a982..993654dd 100644 --- a/token-handler/src/lib.rs +++ b/token-handler/src/lib.rs @@ -5,7 +5,6 @@ use multiversx_sc::imports::*; pub mod burn_tokens; pub mod common; -pub mod events; pub mod mint_tokens; pub mod token_handler_proxy; @@ -15,6 +14,8 @@ pub trait TokenHandler: + burn_tokens::BurnTokens + utils::UtilsModule + common::storage::CommonStorage + + tx_batch_module::TxBatchModule + + common::events::EventsModule { #[init] fn init(&self, header_verifier_address: ManagedAddress, chain_prefix: ManagedBuffer) { diff --git a/token-handler/src/mint_tokens.rs b/token-handler/src/mint_tokens.rs index cd6d05d8..1401448d 100644 --- a/token-handler/src/mint_tokens.rs +++ b/token-handler/src/mint_tokens.rs @@ -4,7 +4,7 @@ use multiversx_sc::imports::IgnoreValue; use multiversx_sc::types::{EsdtTokenPayment, ManagedArgBuffer, ManagedAsyncCallResult}; use multiversx_sc::types::{ManagedVec, MultiValueEncoded}; use multiversx_sc::{codec, err_msg}; -use transaction::{GasLimit, OperationEsdtPayment, OperationTuple}; +use transaction::{GasLimit, OperationData, OperationEsdtPayment, OperationTuple}; const CALLBACK_GAS: GasLimit = 10_000_000; // Increase if not enough const TRANSACTION_GAS: GasLimit = 30_000_000; @@ -12,7 +12,12 @@ const TRANSACTION_GAS: GasLimit = 30_000_000; use crate::common; #[multiversx_sc::module] -pub trait MintTokens: utils::UtilsModule + common::storage::CommonStorage { +pub trait MintTokens: + utils::UtilsModule + + common::storage::CommonStorage + + common::events::EventsModule + + tx_batch_module::TxBatchModule +{ #[endpoint(mintTokens)] fn mint_tokens(&self, operation_tokens: MultiValueEncoded>) { let mut output_payments: ManagedVec> = @@ -137,10 +142,10 @@ pub trait MintTokens: utils::UtilsModule + common::storage::CommonStorage { ) { match result { ManagedAsyncCallResult::Ok(_) => { - // self.execute_bridge_operation_event( - // hash_of_hashes.clone(), - // operation_tuple.op_hash.clone(), - // ); + self.execute_bridge_operation_event( + hash_of_hashes.clone(), + operation_tuple.op_hash.clone(), + ); } ManagedAsyncCallResult::Err(_) => { // self.burn_sovereign_tokens(&operation_tuple.operation); @@ -174,4 +179,29 @@ pub trait MintTokens: utils::UtilsModule + common::storage::CommonStorage { args } + + fn emit_transfer_failed_events( + &self, + hash_of_hashes: &ManagedBuffer, + operation_tuple: &OperationTuple, + ) { + self.execute_bridge_operation_event( + hash_of_hashes.clone(), + operation_tuple.op_hash.clone(), + ); + + // deposit back mainchain tokens into user account + let sc_address = self.blockchain().get_sc_address(); + let tx_nonce = self.get_and_save_next_tx_id(); + + self.deposit_event( + &operation_tuple.operation.data.op_sender, + &operation_tuple.operation.get_tokens_as_tuple_arr(), + OperationData { + op_nonce: tx_nonce, + op_sender: sc_address.clone(), + opt_transfer_data: None, + }, + ); + } } From 3512f75fddaca563c40b3d82cadb31107359d7f4 Mon Sep 17 00:00:00 2001 From: Andrei Baltariu Date: Fri, 19 Jul 2024 10:37:43 +0300 Subject: [PATCH 173/523] Cargo lock update Signed-off-by: Andrei Baltariu --- Cargo.lock | 1 + 1 file changed, 1 insertion(+) diff --git a/Cargo.lock b/Cargo.lock index ec2bb88a..341b3c4f 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1068,6 +1068,7 @@ dependencies = [ "multiversx-sc-scenario", "num-bigint", "transaction", + "tx-batch-module", "utils", ] From 5723fca2ae4eb8cdb0018af02740eff65caf92cd Mon Sep 17 00:00:00 2001 From: Andrei Baltariu Date: Fri, 19 Jul 2024 11:30:24 +0300 Subject: [PATCH 174/523] Modified burn tokens endpoint to be wrapper for burn function Signed-off-by: Andrei Baltariu --- token-handler/src/burn_tokens.rs | 12 +++++++++++- token-handler/src/mint_tokens.rs | 7 ++++--- 2 files changed, 15 insertions(+), 4 deletions(-) diff --git a/token-handler/src/burn_tokens.rs b/token-handler/src/burn_tokens.rs index 1dc2e29c..7c16e894 100644 --- a/token-handler/src/burn_tokens.rs +++ b/token-handler/src/burn_tokens.rs @@ -1,10 +1,20 @@ use crate::{common, err_msg}; +use multiversx_sc::require; use transaction::Operation; #[multiversx_sc::module] pub trait BurnTokens: utils::UtilsModule + common::storage::CommonStorage { #[endpoint(burnTokens)] - fn burn_tokens(&self, operation: Operation) { + fn burn_tokens_endpoint(&self, operation: Operation) { + require!( + operation.tokens.len() > 0, + "Operation tokens array is empty" + ); + + self.burn_tokens(&operation); + } + + fn burn_tokens(&self, operation: &Operation) { let sov_prefix = self.sov_prefix().get(); for token in operation.tokens.iter() { diff --git a/token-handler/src/mint_tokens.rs b/token-handler/src/mint_tokens.rs index 1401448d..e6c8679c 100644 --- a/token-handler/src/mint_tokens.rs +++ b/token-handler/src/mint_tokens.rs @@ -9,13 +9,14 @@ use transaction::{GasLimit, OperationData, OperationEsdtPayment, OperationTuple} const CALLBACK_GAS: GasLimit = 10_000_000; // Increase if not enough const TRANSACTION_GAS: GasLimit = 30_000_000; -use crate::common; +use crate::{burn_tokens, common}; #[multiversx_sc::module] pub trait MintTokens: utils::UtilsModule + common::storage::CommonStorage + common::events::EventsModule + + burn_tokens::BurnTokens + tx_batch_module::TxBatchModule { #[endpoint(mintTokens)] @@ -148,8 +149,8 @@ pub trait MintTokens: ); } ManagedAsyncCallResult::Err(_) => { - // self.burn_sovereign_tokens(&operation_tuple.operation); - // self.emit_transfer_failed_events(hash_of_hashes, operation_tuple); + self.burn_tokens(&operation_tuple.operation); + self.emit_transfer_failed_events(hash_of_hashes, operation_tuple); } } From 8e4b7cf0da7f17e828f0348a9712099b1d3e158a Mon Sep 17 00:00:00 2001 From: Andrei Baltariu Date: Fri, 19 Jul 2024 11:40:39 +0300 Subject: [PATCH 175/523] Renamed mint token trait Signed-off-by: Andrei Baltariu --- token-handler/src/lib.rs | 2 +- token-handler/src/mint_tokens.rs | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/token-handler/src/lib.rs b/token-handler/src/lib.rs index 993654dd..5459ac96 100644 --- a/token-handler/src/lib.rs +++ b/token-handler/src/lib.rs @@ -10,7 +10,7 @@ pub mod token_handler_proxy; #[multiversx_sc::contract] pub trait TokenHandler: - mint_tokens::MintTokens + mint_tokens::MintTokensModule + burn_tokens::BurnTokens + utils::UtilsModule + common::storage::CommonStorage diff --git a/token-handler/src/mint_tokens.rs b/token-handler/src/mint_tokens.rs index e6c8679c..2893cb94 100644 --- a/token-handler/src/mint_tokens.rs +++ b/token-handler/src/mint_tokens.rs @@ -12,7 +12,7 @@ const TRANSACTION_GAS: GasLimit = 30_000_000; use crate::{burn_tokens, common}; #[multiversx_sc::module] -pub trait MintTokens: +pub trait MintTokensModule: utils::UtilsModule + common::storage::CommonStorage + common::events::EventsModule @@ -109,7 +109,7 @@ pub trait MintTokens: .multi_esdt(mapped_tokens.clone()) .gas(transfer_data.gas_limit) .callback( - ::callbacks(self) + ::callbacks(self) .execute(&hash_of_hashes, &operation_tuple), ) .gas_for_callback(CALLBACK_GAS) @@ -126,7 +126,7 @@ pub trait MintTokens: .arguments_raw(args) .gas(TRANSACTION_GAS) .callback( - ::callbacks(self) + ::callbacks(self) .execute(&hash_of_hashes, &operation_tuple), ) .register_promise(); From e07b4872550d33e9e0659e9a7ff0fb4a4fc92506 Mon Sep 17 00:00:00 2001 From: Andrei Baltariu Date: Fri, 19 Jul 2024 11:42:38 +0300 Subject: [PATCH 176/523] Renamed burn tokens trait and build all dependencies Signed-off-by: Andrei Baltariu --- .../wasm-enshrine-esdt-safe-full/Cargo.lock | 13 +++++++++++++ .../wasm-enshrine-esdt-safe-full/src/lib.rs | 5 +++-- .../wasm-enshrine-esdt-safe-view/Cargo.lock | 13 +++++++++++++ enshrine-esdt-safe/wasm/Cargo.lock | 13 +++++++++++++ enshrine-esdt-safe/wasm/src/lib.rs | 5 +++-- token-handler/src/burn_tokens.rs | 2 +- token-handler/src/lib.rs | 2 +- token-handler/src/mint_tokens.rs | 2 +- .../wasm-token-handler-full/Cargo.lock | 19 +++++++++++++++++++ .../wasm-token-handler-full/src/lib.rs | 16 +++++++++++++--- .../wasm-token-handler-view/Cargo.lock | 19 +++++++++++++++++++ token-handler/wasm/Cargo.lock | 19 +++++++++++++++++++ token-handler/wasm/src/lib.rs | 16 +++++++++++++--- 13 files changed, 131 insertions(+), 13 deletions(-) diff --git a/enshrine-esdt-safe/wasm-enshrine-esdt-safe-full/Cargo.lock b/enshrine-esdt-safe/wasm-enshrine-esdt-safe-full/Cargo.lock index 9677d66b..f72ab75a 100644 --- a/enshrine-esdt-safe/wasm-enshrine-esdt-safe-full/Cargo.lock +++ b/enshrine-esdt-safe/wasm-enshrine-esdt-safe-full/Cargo.lock @@ -45,6 +45,7 @@ dependencies = [ "multiversx-sc", "multiversx-sc-modules", "setup-phase", + "token-handler", "token-whitelist", "transaction", "tx-batch-module", @@ -251,6 +252,18 @@ dependencies = [ "unicode-ident", ] +[[package]] +name = "token-handler" +version = "0.0.0" +dependencies = [ + "bls-signature", + "header-verifier", + "multiversx-sc", + "transaction", + "tx-batch-module", + "utils", +] + [[package]] name = "token-whitelist" version = "0.0.0" diff --git a/enshrine-esdt-safe/wasm-enshrine-esdt-safe-full/src/lib.rs b/enshrine-esdt-safe/wasm-enshrine-esdt-safe-full/src/lib.rs index 3d62b31d..6d2ed615 100644 --- a/enshrine-esdt-safe/wasm-enshrine-esdt-safe-full/src/lib.rs +++ b/enshrine-esdt-safe/wasm-enshrine-esdt-safe-full/src/lib.rs @@ -6,10 +6,10 @@ // Init: 1 // Upgrade: 1 -// Endpoints: 28 +// Endpoints: 29 // Async Callback: 1 // Promise callbacks: 2 -// Total number of exported functions: 33 +// Total number of exported functions: 34 #![no_std] @@ -28,6 +28,7 @@ multiversx_sc_wasm_adapter::endpoints! { addSigners => add_signers removeSigners => remove_signers executeBridgeOps => execute_operations + call_token_handler_mint_endpoint => call_token_handler_mint_endpoint registerNewTokenID => register_new_token_id setMaxTxBatchSize => set_max_tx_batch_size setMaxTxBatchBlockDuration => set_max_tx_batch_block_duration diff --git a/enshrine-esdt-safe/wasm-enshrine-esdt-safe-view/Cargo.lock b/enshrine-esdt-safe/wasm-enshrine-esdt-safe-view/Cargo.lock index 1cecede7..bed269f4 100644 --- a/enshrine-esdt-safe/wasm-enshrine-esdt-safe-view/Cargo.lock +++ b/enshrine-esdt-safe/wasm-enshrine-esdt-safe-view/Cargo.lock @@ -45,6 +45,7 @@ dependencies = [ "multiversx-sc", "multiversx-sc-modules", "setup-phase", + "token-handler", "token-whitelist", "transaction", "tx-batch-module", @@ -251,6 +252,18 @@ dependencies = [ "unicode-ident", ] +[[package]] +name = "token-handler" +version = "0.0.0" +dependencies = [ + "bls-signature", + "header-verifier", + "multiversx-sc", + "transaction", + "tx-batch-module", + "utils", +] + [[package]] name = "token-whitelist" version = "0.0.0" diff --git a/enshrine-esdt-safe/wasm/Cargo.lock b/enshrine-esdt-safe/wasm/Cargo.lock index 060a012b..a2dd6406 100644 --- a/enshrine-esdt-safe/wasm/Cargo.lock +++ b/enshrine-esdt-safe/wasm/Cargo.lock @@ -45,6 +45,7 @@ dependencies = [ "multiversx-sc", "multiversx-sc-modules", "setup-phase", + "token-handler", "token-whitelist", "transaction", "tx-batch-module", @@ -251,6 +252,18 @@ dependencies = [ "unicode-ident", ] +[[package]] +name = "token-handler" +version = "0.0.0" +dependencies = [ + "bls-signature", + "header-verifier", + "multiversx-sc", + "transaction", + "tx-batch-module", + "utils", +] + [[package]] name = "token-whitelist" version = "0.0.0" diff --git a/enshrine-esdt-safe/wasm/src/lib.rs b/enshrine-esdt-safe/wasm/src/lib.rs index 3d62b31d..6d2ed615 100644 --- a/enshrine-esdt-safe/wasm/src/lib.rs +++ b/enshrine-esdt-safe/wasm/src/lib.rs @@ -6,10 +6,10 @@ // Init: 1 // Upgrade: 1 -// Endpoints: 28 +// Endpoints: 29 // Async Callback: 1 // Promise callbacks: 2 -// Total number of exported functions: 33 +// Total number of exported functions: 34 #![no_std] @@ -28,6 +28,7 @@ multiversx_sc_wasm_adapter::endpoints! { addSigners => add_signers removeSigners => remove_signers executeBridgeOps => execute_operations + call_token_handler_mint_endpoint => call_token_handler_mint_endpoint registerNewTokenID => register_new_token_id setMaxTxBatchSize => set_max_tx_batch_size setMaxTxBatchBlockDuration => set_max_tx_batch_block_duration diff --git a/token-handler/src/burn_tokens.rs b/token-handler/src/burn_tokens.rs index 7c16e894..833c0e42 100644 --- a/token-handler/src/burn_tokens.rs +++ b/token-handler/src/burn_tokens.rs @@ -3,7 +3,7 @@ use multiversx_sc::require; use transaction::Operation; #[multiversx_sc::module] -pub trait BurnTokens: utils::UtilsModule + common::storage::CommonStorage { +pub trait BurnTokensModule: utils::UtilsModule + common::storage::CommonStorage { #[endpoint(burnTokens)] fn burn_tokens_endpoint(&self, operation: Operation) { require!( diff --git a/token-handler/src/lib.rs b/token-handler/src/lib.rs index 5459ac96..d16a485c 100644 --- a/token-handler/src/lib.rs +++ b/token-handler/src/lib.rs @@ -11,7 +11,7 @@ pub mod token_handler_proxy; #[multiversx_sc::contract] pub trait TokenHandler: mint_tokens::MintTokensModule - + burn_tokens::BurnTokens + + burn_tokens::BurnTokensModule + utils::UtilsModule + common::storage::CommonStorage + tx_batch_module::TxBatchModule diff --git a/token-handler/src/mint_tokens.rs b/token-handler/src/mint_tokens.rs index 2893cb94..bdfdc34f 100644 --- a/token-handler/src/mint_tokens.rs +++ b/token-handler/src/mint_tokens.rs @@ -16,7 +16,7 @@ pub trait MintTokensModule: utils::UtilsModule + common::storage::CommonStorage + common::events::EventsModule - + burn_tokens::BurnTokens + + burn_tokens::BurnTokensModule + tx_batch_module::TxBatchModule { #[endpoint(mintTokens)] diff --git a/token-handler/wasm-token-handler-full/Cargo.lock b/token-handler/wasm-token-handler-full/Cargo.lock index 8fe79e0b..2041a676 100644 --- a/token-handler/wasm-token-handler-full/Cargo.lock +++ b/token-handler/wasm-token-handler-full/Cargo.lock @@ -34,6 +34,15 @@ version = "0.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c34f04666d835ff5d62e058c3995147c06f42fe86ff053337632bca83e42702d" +[[package]] +name = "header-verifier" +version = "0.0.0" +dependencies = [ + "bls-signature", + "multiversx-sc", + "transaction", +] + [[package]] name = "hex" version = "0.4.3" @@ -173,8 +182,10 @@ name = "token-handler" version = "0.0.0" dependencies = [ "bls-signature", + "header-verifier", "multiversx-sc", "transaction", + "tx-batch-module", "utils", ] @@ -193,6 +204,14 @@ dependencies = [ "multiversx-sc", ] +[[package]] +name = "tx-batch-module" +version = "0.0.0" +dependencies = [ + "multiversx-sc", + "transaction", +] + [[package]] name = "unicode-ident" version = "1.0.12" diff --git a/token-handler/wasm-token-handler-full/src/lib.rs b/token-handler/wasm-token-handler-full/src/lib.rs index 79bf8a84..fda7d7f9 100644 --- a/token-handler/wasm-token-handler-full/src/lib.rs +++ b/token-handler/wasm-token-handler-full/src/lib.rs @@ -6,9 +6,10 @@ // Init: 1 // Upgrade: 1 -// Endpoints: 2 +// Endpoints: 10 // Async Callback (empty): 1 -// Total number of exported functions: 5 +// Promise callbacks: 1 +// Total number of exported functions: 14 #![no_std] @@ -21,7 +22,16 @@ multiversx_sc_wasm_adapter::endpoints! { init => init upgrade => upgrade mintTokens => mint_tokens - burnTokens => burn_tokens + burnTokens => burn_tokens_endpoint + setMaxTxBatchSize => set_max_tx_batch_size + setMaxTxBatchBlockDuration => set_max_tx_batch_block_duration + getCurrentTxBatch => get_current_tx_batch + getFirstBatchAnyStatus => get_first_batch_any_status + getBatch => get_batch + getBatchStatus => get_batch_status + getFirstBatchId => first_batch_id + getLastBatchId => last_batch_id + execute => execute ) } diff --git a/token-handler/wasm-token-handler-view/Cargo.lock b/token-handler/wasm-token-handler-view/Cargo.lock index c74b749f..ae19e65e 100644 --- a/token-handler/wasm-token-handler-view/Cargo.lock +++ b/token-handler/wasm-token-handler-view/Cargo.lock @@ -34,6 +34,15 @@ version = "0.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c34f04666d835ff5d62e058c3995147c06f42fe86ff053337632bca83e42702d" +[[package]] +name = "header-verifier" +version = "0.0.0" +dependencies = [ + "bls-signature", + "multiversx-sc", + "transaction", +] + [[package]] name = "hex" version = "0.4.3" @@ -173,8 +182,10 @@ name = "token-handler" version = "0.0.0" dependencies = [ "bls-signature", + "header-verifier", "multiversx-sc", "transaction", + "tx-batch-module", "utils", ] @@ -193,6 +204,14 @@ dependencies = [ "multiversx-sc", ] +[[package]] +name = "tx-batch-module" +version = "0.0.0" +dependencies = [ + "multiversx-sc", + "transaction", +] + [[package]] name = "unicode-ident" version = "1.0.12" diff --git a/token-handler/wasm/Cargo.lock b/token-handler/wasm/Cargo.lock index bbca5a3b..238456a2 100644 --- a/token-handler/wasm/Cargo.lock +++ b/token-handler/wasm/Cargo.lock @@ -34,6 +34,15 @@ version = "0.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c34f04666d835ff5d62e058c3995147c06f42fe86ff053337632bca83e42702d" +[[package]] +name = "header-verifier" +version = "0.0.0" +dependencies = [ + "bls-signature", + "multiversx-sc", + "transaction", +] + [[package]] name = "hex" version = "0.4.3" @@ -173,8 +182,10 @@ name = "token-handler" version = "0.0.0" dependencies = [ "bls-signature", + "header-verifier", "multiversx-sc", "transaction", + "tx-batch-module", "utils", ] @@ -193,6 +204,14 @@ dependencies = [ "multiversx-sc", ] +[[package]] +name = "tx-batch-module" +version = "0.0.0" +dependencies = [ + "multiversx-sc", + "transaction", +] + [[package]] name = "unicode-ident" version = "1.0.12" diff --git a/token-handler/wasm/src/lib.rs b/token-handler/wasm/src/lib.rs index 79bf8a84..fda7d7f9 100644 --- a/token-handler/wasm/src/lib.rs +++ b/token-handler/wasm/src/lib.rs @@ -6,9 +6,10 @@ // Init: 1 // Upgrade: 1 -// Endpoints: 2 +// Endpoints: 10 // Async Callback (empty): 1 -// Total number of exported functions: 5 +// Promise callbacks: 1 +// Total number of exported functions: 14 #![no_std] @@ -21,7 +22,16 @@ multiversx_sc_wasm_adapter::endpoints! { init => init upgrade => upgrade mintTokens => mint_tokens - burnTokens => burn_tokens + burnTokens => burn_tokens_endpoint + setMaxTxBatchSize => set_max_tx_batch_size + setMaxTxBatchBlockDuration => set_max_tx_batch_block_duration + getCurrentTxBatch => get_current_tx_batch + getFirstBatchAnyStatus => get_first_batch_any_status + getBatch => get_batch + getBatchStatus => get_batch_status + getFirstBatchId => first_batch_id + getLastBatchId => last_batch_id + execute => execute ) } From f4a99d8bd6ae45969471c1639d50a99e8eab052a Mon Sep 17 00:00:00 2001 From: Andrei Baltariu Date: Fri, 19 Jul 2024 12:16:24 +0300 Subject: [PATCH 177/523] Added unified syntax calls for mint and burn Signed-off-by: Andrei Baltariu --- Cargo.lock | 8 +++++++ Cargo.toml | 4 +++- .../src/from_sovereign/transfer_tokens.rs | 11 --------- token-handler/src/burn_tokens.rs | 23 ++++++++++++++----- token-handler/src/mint_tokens.rs | 18 ++++++++++----- 5 files changed, 40 insertions(+), 24 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 341b3c4f..2ea3d877 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1072,6 +1072,14 @@ dependencies = [ "utils", ] +[[package]] +name = "token-handler-meta" +version = "0.0.0" +dependencies = [ + "multiversx-sc-meta-lib", + "token-handler", +] + [[package]] name = "token-whitelist" version = "0.0.0" diff --git a/Cargo.toml b/Cargo.toml index e539e782..2ddad9dd 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -15,5 +15,7 @@ members = [ "header-verifier", "header-verifier/meta", "enshrine-esdt-safe", - "enshrine-esdt-safe/meta" + "enshrine-esdt-safe/meta", + "token-handler", + "token-handler/meta", ] diff --git a/enshrine-esdt-safe/src/from_sovereign/transfer_tokens.rs b/enshrine-esdt-safe/src/from_sovereign/transfer_tokens.rs index 05fe9217..f0e5c1b0 100644 --- a/enshrine-esdt-safe/src/from_sovereign/transfer_tokens.rs +++ b/enshrine-esdt-safe/src/from_sovereign/transfer_tokens.rs @@ -53,17 +53,6 @@ pub trait TransferTokensModule: return; } - - let operation_tuple = OperationTuple { - op_hash: operation_hash, - operation: operation.clone(), - }; - - // self.distribute_payments( - // hash_of_hashes.clone(), - // operation_tuple.clone(), - // tokens.to_vec(), - // ); } #[endpoint] diff --git a/token-handler/src/burn_tokens.rs b/token-handler/src/burn_tokens.rs index 833c0e42..026b62af 100644 --- a/token-handler/src/burn_tokens.rs +++ b/token-handler/src/burn_tokens.rs @@ -1,7 +1,14 @@ use crate::{common, err_msg}; -use multiversx_sc::require; +use multiversx_sc::{ + hex_literal::hex, + require, + types::{system_proxy, ToSelf}, +}; use transaction::Operation; +pub const ESDT_SYSTEM_SC_ADDRESS: [u8; 32] = + hex!("000000000000000000010000000000000000000000000000000000000002ffff"); + #[multiversx_sc::module] pub trait BurnTokensModule: utils::UtilsModule + common::storage::CommonStorage { #[endpoint(burnTokens)] @@ -22,11 +29,15 @@ pub trait BurnTokensModule: utils::UtilsModule + common::storage::CommonStorage continue; } - self.send().esdt_local_burn( - &token.token_identifier, - token.token_nonce, - &token.token_data.amount, - ); + self.tx() + .to(ToSelf) + .typed(system_proxy::UserBuiltinProxy) + .esdt_local_burn( + &token.token_identifier, + token.token_nonce, + &token.token_data.amount, + ) + .sync_call(); } } } diff --git a/token-handler/src/mint_tokens.rs b/token-handler/src/mint_tokens.rs index bdfdc34f..5fa091b1 100644 --- a/token-handler/src/mint_tokens.rs +++ b/token-handler/src/mint_tokens.rs @@ -1,7 +1,9 @@ use header_verifier::header_verifier_proxy; use multiversx_sc::api::{ESDT_MULTI_TRANSFER_FUNC_NAME, ESDT_NFT_CREATE_FUNC_NAME}; use multiversx_sc::imports::IgnoreValue; -use multiversx_sc::types::{EsdtTokenPayment, ManagedArgBuffer, ManagedAsyncCallResult}; +use multiversx_sc::types::{ + system_proxy, EsdtTokenPayment, ManagedArgBuffer, ManagedAsyncCallResult, ToSelf, +}; use multiversx_sc::types::{ManagedVec, MultiValueEncoded}; use multiversx_sc::{codec, err_msg}; use transaction::{GasLimit, OperationData, OperationEsdtPayment, OperationTuple}; @@ -33,11 +35,15 @@ pub trait MintTokensModule: let mut nonce = operation_token.token_nonce; if nonce == 0 { - self.send().esdt_local_mint( - &operation_token.token_identifier, - operation_token.token_nonce, - &operation_token.token_data.amount, - ); + self.tx() + .to(ToSelf) + .typed(system_proxy::UserBuiltinProxy) + .esdt_local_mint( + &operation_token.token_identifier, + operation_token.token_nonce, + &operation_token.token_data.amount, + ) + .sync_call(); } else { let token_data = operation_token.token_data.clone(); let mut arg_buffer = ManagedArgBuffer::new(); From 42a79bd46c1cd1e6cbd1454bfae271706289a85d Mon Sep 17 00:00:00 2001 From: Andrei Baltariu Date: Fri, 19 Jul 2024 16:49:59 +0300 Subject: [PATCH 178/523] Added vec to multivalue mapping Signed-off-by: Andrei Baltariu --- .../src/from_sovereign/transfer_tokens.rs | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/enshrine-esdt-safe/src/from_sovereign/transfer_tokens.rs b/enshrine-esdt-safe/src/from_sovereign/transfer_tokens.rs index f0e5c1b0..88129ae6 100644 --- a/enshrine-esdt-safe/src/from_sovereign/transfer_tokens.rs +++ b/enshrine-esdt-safe/src/from_sovereign/transfer_tokens.rs @@ -53,6 +53,19 @@ pub trait TransferTokensModule: return; } + + let mut managed_tokens = MultiValueEncoded::new(); + + for token in operation.tokens.iter() { + managed_tokens.push(token); + } + + let token_handler_address = self.token_handler_address().get(); + self.tx() + .to(token_handler_address) + .typed(token_handler_proxy::TokenHandlerProxy) + .mint_tokens(managed_tokens) + .async_call_and_exit(); } #[endpoint] From 380a2f06d00dc213abe53b4abf0acc7880a6265c Mon Sep 17 00:00:00 2001 From: Andrei Baltariu Date: Thu, 25 Jul 2024 14:07:31 +0300 Subject: [PATCH 179/523] Modified endpoint params and added TODO Signed-off-by: Andrei Baltariu --- common/transaction/src/lib.rs | 1 + .../src/from_sovereign/transfer_tokens.rs | 25 +++- enshrine-esdt-safe/src/token_handler_proxy.rs | 107 +++++++++++++++++- .../wasm-enshrine-esdt-safe-full/src/lib.rs | 5 +- enshrine-esdt-safe/wasm/src/lib.rs | 5 +- token-handler/src/mint_tokens.rs | 21 +++- token-handler/src/token_handler_proxy.rs | 107 +++++++++++++++++- 7 files changed, 246 insertions(+), 25 deletions(-) diff --git a/common/transaction/src/lib.rs b/common/transaction/src/lib.rs index 2e9a2e03..f6830a9c 100644 --- a/common/transaction/src/lib.rs +++ b/common/transaction/src/lib.rs @@ -73,6 +73,7 @@ pub struct OperationTuple { pub operation: Operation, } +// TODO: Implement IntoMultiValue #[derive(TopEncode, TopDecode, NestedEncode, NestedDecode, TypeAbi, ManagedVecItem, Clone)] pub struct OperationEsdtPayment { pub token_identifier: TokenIdentifier, diff --git a/enshrine-esdt-safe/src/from_sovereign/transfer_tokens.rs b/enshrine-esdt-safe/src/from_sovereign/transfer_tokens.rs index 88129ae6..ff639c34 100644 --- a/enshrine-esdt-safe/src/from_sovereign/transfer_tokens.rs +++ b/enshrine-esdt-safe/src/from_sovereign/transfer_tokens.rs @@ -61,21 +61,38 @@ pub trait TransferTokensModule: } let token_handler_address = self.token_handler_address().get(); + self.tx() .to(token_handler_address) .typed(token_handler_proxy::TokenHandlerProxy) - .mint_tokens(managed_tokens) - .async_call_and_exit(); + .mint_tokens( + hash_of_hashes, + OperationTuple { + op_hash: operation_hash, + operation, + }, + managed_tokens, + ) + .sync_call(); } #[endpoint] - fn call_token_handler_mint_endpoint(&self, operation: Operation) { + fn call_token_handler_mint_endpoint( + &self, + hash_of_hashes: ManagedBuffer, + operation_tuple: OperationTuple, + ) { let token_handler_address = self.token_handler_address().get(); + let mut multi_value_tokens = MultiValueEncoded::new(); + + for token in operation_tuple.operation.tokens.iter().clone() { + multi_value_tokens.push(token); + } self.tx() .to(token_handler_address) .typed(token_handler_proxy::TokenHandlerProxy) - .mint_tokens(MultiValueEncoded::from(operation.tokens.clone())) + .mint_tokens(hash_of_hashes, operation_tuple, multi_value_tokens) .callback(::callbacks(self).save_minted_tokens()) .async_call_and_exit(); } diff --git a/enshrine-esdt-safe/src/token_handler_proxy.rs b/enshrine-esdt-safe/src/token_handler_proxy.rs index 83c00023..1849ef54 100644 --- a/enshrine-esdt-safe/src/token_handler_proxy.rs +++ b/enshrine-esdt-safe/src/token_handler_proxy.rs @@ -44,14 +44,17 @@ where Gas: TxGas, { pub fn init< - Arg0: ProxyArg>, + Arg0: ProxyArg>, + Arg1: ProxyArg>, >( self, - chain_prefix: Arg0, + header_verifier_address: Arg0, + chain_prefix: Arg1, ) -> TxTypedDeploy { self.wrapped_tx .payment(NotPayable) .raw_deploy() + .argument(&header_verifier_address) .argument(&chain_prefix) .original_result() } @@ -86,19 +89,25 @@ where Gas: TxGas, { pub fn mint_tokens< - Arg0: ProxyArg>>, + Arg0: ProxyArg>, + Arg1: ProxyArg>, + Arg2: ProxyArg>>, >( self, - operation_tokens: Arg0, + hash_of_hashes: Arg0, + operation_tuple: Arg1, + operation_tokens: Arg2, ) -> TxTypedCall { self.wrapped_tx .payment(NotPayable) .raw_call("mintTokens") + .argument(&hash_of_hashes) + .argument(&operation_tuple) .argument(&operation_tokens) .original_result() } - pub fn burn_tokens< + pub fn burn_tokens_endpoint< Arg0: ProxyArg>, >( self, @@ -110,4 +119,92 @@ where .argument(&operation) .original_result() } + + pub fn set_max_tx_batch_size< + Arg0: ProxyArg, + >( + self, + new_max_tx_batch_size: Arg0, + ) -> TxTypedCall { + self.wrapped_tx + .payment(NotPayable) + .raw_call("setMaxTxBatchSize") + .argument(&new_max_tx_batch_size) + .original_result() + } + + pub fn set_max_tx_batch_block_duration< + Arg0: ProxyArg, + >( + self, + new_max_tx_batch_block_duration: Arg0, + ) -> TxTypedCall { + self.wrapped_tx + .payment(NotPayable) + .raw_call("setMaxTxBatchBlockDuration") + .argument(&new_max_tx_batch_block_duration) + .original_result() + } + + pub fn get_current_tx_batch( + self, + ) -> TxTypedCall, ManagedAddress, ManagedVec>, ManagedVec>, Option>>>>>> { + self.wrapped_tx + .payment(NotPayable) + .raw_call("getCurrentTxBatch") + .original_result() + } + + pub fn get_first_batch_any_status( + self, + ) -> TxTypedCall, ManagedAddress, ManagedVec>, ManagedVec>, Option>>>>>> { + self.wrapped_tx + .payment(NotPayable) + .raw_call("getFirstBatchAnyStatus") + .original_result() + } + + pub fn get_batch< + Arg0: ProxyArg, + >( + self, + batch_id: Arg0, + ) -> TxTypedCall, ManagedAddress, ManagedVec>, ManagedVec>, Option>>>>>> { + self.wrapped_tx + .payment(NotPayable) + .raw_call("getBatch") + .argument(&batch_id) + .original_result() + } + + pub fn get_batch_status< + Arg0: ProxyArg, + >( + self, + batch_id: Arg0, + ) -> TxTypedCall> { + self.wrapped_tx + .payment(NotPayable) + .raw_call("getBatchStatus") + .argument(&batch_id) + .original_result() + } + + pub fn first_batch_id( + self, + ) -> TxTypedCall { + self.wrapped_tx + .payment(NotPayable) + .raw_call("getFirstBatchId") + .original_result() + } + + pub fn last_batch_id( + self, + ) -> TxTypedCall { + self.wrapped_tx + .payment(NotPayable) + .raw_call("getLastBatchId") + .original_result() + } } diff --git a/enshrine-esdt-safe/wasm-enshrine-esdt-safe-full/src/lib.rs b/enshrine-esdt-safe/wasm-enshrine-esdt-safe-full/src/lib.rs index 6d2ed615..3d62b31d 100644 --- a/enshrine-esdt-safe/wasm-enshrine-esdt-safe-full/src/lib.rs +++ b/enshrine-esdt-safe/wasm-enshrine-esdt-safe-full/src/lib.rs @@ -6,10 +6,10 @@ // Init: 1 // Upgrade: 1 -// Endpoints: 29 +// Endpoints: 28 // Async Callback: 1 // Promise callbacks: 2 -// Total number of exported functions: 34 +// Total number of exported functions: 33 #![no_std] @@ -28,7 +28,6 @@ multiversx_sc_wasm_adapter::endpoints! { addSigners => add_signers removeSigners => remove_signers executeBridgeOps => execute_operations - call_token_handler_mint_endpoint => call_token_handler_mint_endpoint registerNewTokenID => register_new_token_id setMaxTxBatchSize => set_max_tx_batch_size setMaxTxBatchBlockDuration => set_max_tx_batch_block_duration diff --git a/enshrine-esdt-safe/wasm/src/lib.rs b/enshrine-esdt-safe/wasm/src/lib.rs index 6d2ed615..3d62b31d 100644 --- a/enshrine-esdt-safe/wasm/src/lib.rs +++ b/enshrine-esdt-safe/wasm/src/lib.rs @@ -6,10 +6,10 @@ // Init: 1 // Upgrade: 1 -// Endpoints: 29 +// Endpoints: 28 // Async Callback: 1 // Promise callbacks: 2 -// Total number of exported functions: 34 +// Total number of exported functions: 33 #![no_std] @@ -28,7 +28,6 @@ multiversx_sc_wasm_adapter::endpoints! { addSigners => add_signers removeSigners => remove_signers executeBridgeOps => execute_operations - call_token_handler_mint_endpoint => call_token_handler_mint_endpoint registerNewTokenID => register_new_token_id setMaxTxBatchSize => set_max_tx_batch_size setMaxTxBatchBlockDuration => set_max_tx_batch_block_duration diff --git a/token-handler/src/mint_tokens.rs b/token-handler/src/mint_tokens.rs index 5fa091b1..cb48371f 100644 --- a/token-handler/src/mint_tokens.rs +++ b/token-handler/src/mint_tokens.rs @@ -6,7 +6,7 @@ use multiversx_sc::types::{ }; use multiversx_sc::types::{ManagedVec, MultiValueEncoded}; use multiversx_sc::{codec, err_msg}; -use transaction::{GasLimit, OperationData, OperationEsdtPayment, OperationTuple}; +use transaction::{GasLimit, Operation, OperationData, OperationEsdtPayment, OperationTuple}; const CALLBACK_GAS: GasLimit = 10_000_000; // Increase if not enough const TRANSACTION_GAS: GasLimit = 30_000_000; @@ -22,12 +22,18 @@ pub trait MintTokensModule: + tx_batch_module::TxBatchModule { #[endpoint(mintTokens)] - fn mint_tokens(&self, operation_tokens: MultiValueEncoded>) { + fn mint_tokens( + &self, + hash_of_hashes: ManagedBuffer, + operation_tuple: OperationTuple, + operation_tokens: MultiValueEncoded>, + ) { let mut output_payments: ManagedVec> = ManagedVec::new(); for operation_token in operation_tokens { let sov_prefix = self.sov_prefix().get(); + if !self.has_sov_prefix(&operation_token.token_identifier, &sov_prefix) { output_payments.push(operation_token.clone()); continue; @@ -90,16 +96,21 @@ pub trait MintTokensModule: token_data: operation_token.token_data, }); } + + self.distribute_payments(hash_of_hashes, operation_tuple); } fn distribute_payments( &self, hash_of_hashes: ManagedBuffer, operation_tuple: OperationTuple, - tokens_list: ManagedVec>, ) { - let mapped_tokens: ManagedVec> = - tokens_list.iter().map(|token| token.into()).collect(); + let mapped_tokens: ManagedVec> = operation_tuple + .operation + .tokens + .iter() + .map(|token| token.into()) + .collect(); match &operation_tuple.operation.data.opt_transfer_data { Some(transfer_data) => { diff --git a/token-handler/src/token_handler_proxy.rs b/token-handler/src/token_handler_proxy.rs index 83c00023..1849ef54 100644 --- a/token-handler/src/token_handler_proxy.rs +++ b/token-handler/src/token_handler_proxy.rs @@ -44,14 +44,17 @@ where Gas: TxGas, { pub fn init< - Arg0: ProxyArg>, + Arg0: ProxyArg>, + Arg1: ProxyArg>, >( self, - chain_prefix: Arg0, + header_verifier_address: Arg0, + chain_prefix: Arg1, ) -> TxTypedDeploy { self.wrapped_tx .payment(NotPayable) .raw_deploy() + .argument(&header_verifier_address) .argument(&chain_prefix) .original_result() } @@ -86,19 +89,25 @@ where Gas: TxGas, { pub fn mint_tokens< - Arg0: ProxyArg>>, + Arg0: ProxyArg>, + Arg1: ProxyArg>, + Arg2: ProxyArg>>, >( self, - operation_tokens: Arg0, + hash_of_hashes: Arg0, + operation_tuple: Arg1, + operation_tokens: Arg2, ) -> TxTypedCall { self.wrapped_tx .payment(NotPayable) .raw_call("mintTokens") + .argument(&hash_of_hashes) + .argument(&operation_tuple) .argument(&operation_tokens) .original_result() } - pub fn burn_tokens< + pub fn burn_tokens_endpoint< Arg0: ProxyArg>, >( self, @@ -110,4 +119,92 @@ where .argument(&operation) .original_result() } + + pub fn set_max_tx_batch_size< + Arg0: ProxyArg, + >( + self, + new_max_tx_batch_size: Arg0, + ) -> TxTypedCall { + self.wrapped_tx + .payment(NotPayable) + .raw_call("setMaxTxBatchSize") + .argument(&new_max_tx_batch_size) + .original_result() + } + + pub fn set_max_tx_batch_block_duration< + Arg0: ProxyArg, + >( + self, + new_max_tx_batch_block_duration: Arg0, + ) -> TxTypedCall { + self.wrapped_tx + .payment(NotPayable) + .raw_call("setMaxTxBatchBlockDuration") + .argument(&new_max_tx_batch_block_duration) + .original_result() + } + + pub fn get_current_tx_batch( + self, + ) -> TxTypedCall, ManagedAddress, ManagedVec>, ManagedVec>, Option>>>>>> { + self.wrapped_tx + .payment(NotPayable) + .raw_call("getCurrentTxBatch") + .original_result() + } + + pub fn get_first_batch_any_status( + self, + ) -> TxTypedCall, ManagedAddress, ManagedVec>, ManagedVec>, Option>>>>>> { + self.wrapped_tx + .payment(NotPayable) + .raw_call("getFirstBatchAnyStatus") + .original_result() + } + + pub fn get_batch< + Arg0: ProxyArg, + >( + self, + batch_id: Arg0, + ) -> TxTypedCall, ManagedAddress, ManagedVec>, ManagedVec>, Option>>>>>> { + self.wrapped_tx + .payment(NotPayable) + .raw_call("getBatch") + .argument(&batch_id) + .original_result() + } + + pub fn get_batch_status< + Arg0: ProxyArg, + >( + self, + batch_id: Arg0, + ) -> TxTypedCall> { + self.wrapped_tx + .payment(NotPayable) + .raw_call("getBatchStatus") + .argument(&batch_id) + .original_result() + } + + pub fn first_batch_id( + self, + ) -> TxTypedCall { + self.wrapped_tx + .payment(NotPayable) + .raw_call("getFirstBatchId") + .original_result() + } + + pub fn last_batch_id( + self, + ) -> TxTypedCall { + self.wrapped_tx + .payment(NotPayable) + .raw_call("getLastBatchId") + .original_result() + } } From e6f3b3f6265963632a4bd4e7c2a405cd817204a2 Mon Sep 17 00:00:00 2001 From: Andrei Baltariu Date: Thu, 25 Jul 2024 15:27:41 +0300 Subject: [PATCH 180/523] Added token vec mapping Signed-off-by: Andrei Baltariu --- common/transaction/src/lib.rs | 13 ++++++++++++- .../src/from_sovereign/transfer_tokens.rs | 11 +++++------ token-handler/src/mint_tokens.rs | 2 +- 3 files changed, 18 insertions(+), 8 deletions(-) diff --git a/common/transaction/src/lib.rs b/common/transaction/src/lib.rs index f6830a9c..35cf3dd7 100644 --- a/common/transaction/src/lib.rs +++ b/common/transaction/src/lib.rs @@ -1,5 +1,7 @@ #![no_std] +use codec::arrayvec::IntoIter; + multiversx_sc::imports!(); multiversx_sc::derive_imports!(); @@ -51,6 +53,16 @@ impl Operation { tuple_arr } + + pub fn map_tokens_vec_to_multi_value(&self) -> MultiValueEncoded> { + let mut multi_value_tokens = MultiValueEncoded::new(); + + for token in &self.tokens { + multi_value_tokens.push(token); + } + + multi_value_tokens + } } #[derive(TopEncode, TopDecode, NestedEncode, NestedDecode, TypeAbi, ManagedVecItem, Clone)] @@ -73,7 +85,6 @@ pub struct OperationTuple { pub operation: Operation, } -// TODO: Implement IntoMultiValue #[derive(TopEncode, TopDecode, NestedEncode, NestedDecode, TypeAbi, ManagedVecItem, Clone)] pub struct OperationEsdtPayment { pub token_identifier: TokenIdentifier, diff --git a/enshrine-esdt-safe/src/from_sovereign/transfer_tokens.rs b/enshrine-esdt-safe/src/from_sovereign/transfer_tokens.rs index ff639c34..133375a2 100644 --- a/enshrine-esdt-safe/src/from_sovereign/transfer_tokens.rs +++ b/enshrine-esdt-safe/src/from_sovereign/transfer_tokens.rs @@ -83,16 +83,15 @@ pub trait TransferTokensModule: operation_tuple: OperationTuple, ) { let token_handler_address = self.token_handler_address().get(); - let mut multi_value_tokens = MultiValueEncoded::new(); - - for token in operation_tuple.operation.tokens.iter().clone() { - multi_value_tokens.push(token); - } self.tx() .to(token_handler_address) .typed(token_handler_proxy::TokenHandlerProxy) - .mint_tokens(hash_of_hashes, operation_tuple, multi_value_tokens) + .mint_tokens( + hash_of_hashes, + operation_tuple.clone(), + operation_tuple.operation.map_tokens_vec_to_multi_value(), + ) .callback(::callbacks(self).save_minted_tokens()) .async_call_and_exit(); } diff --git a/token-handler/src/mint_tokens.rs b/token-handler/src/mint_tokens.rs index cb48371f..8e5610ec 100644 --- a/token-handler/src/mint_tokens.rs +++ b/token-handler/src/mint_tokens.rs @@ -6,7 +6,7 @@ use multiversx_sc::types::{ }; use multiversx_sc::types::{ManagedVec, MultiValueEncoded}; use multiversx_sc::{codec, err_msg}; -use transaction::{GasLimit, Operation, OperationData, OperationEsdtPayment, OperationTuple}; +use transaction::{GasLimit, OperationData, OperationEsdtPayment, OperationTuple}; const CALLBACK_GAS: GasLimit = 10_000_000; // Increase if not enough const TRANSACTION_GAS: GasLimit = 30_000_000; From d61b4d90ad97154d8011c85cf26f159f12862c7e Mon Sep 17 00:00:00 2001 From: Andrei Baltariu Date: Thu, 25 Jul 2024 15:32:07 +0300 Subject: [PATCH 181/523] Removed unused import Signed-off-by: Andrei Baltariu --- common/transaction/src/lib.rs | 2 -- 1 file changed, 2 deletions(-) diff --git a/common/transaction/src/lib.rs b/common/transaction/src/lib.rs index 35cf3dd7..c2fe0138 100644 --- a/common/transaction/src/lib.rs +++ b/common/transaction/src/lib.rs @@ -1,7 +1,5 @@ #![no_std] -use codec::arrayvec::IntoIter; - multiversx_sc::imports!(); multiversx_sc::derive_imports!(); From 5f5267669dbee7f62ab670abc73b62c2c969970e Mon Sep 17 00:00:00 2001 From: Andrei Baltariu Date: Thu, 25 Jul 2024 15:34:15 +0300 Subject: [PATCH 182/523] Regenerated proxy Signed-off-by: Andrei Baltariu --- .../src/enshrine_esdt_safe_proxy.rs | 16 ++++++++++++++++ .../wasm-enshrine-esdt-safe-full/src/lib.rs | 5 +++-- enshrine-esdt-safe/wasm/src/lib.rs | 5 +++-- 3 files changed, 22 insertions(+), 4 deletions(-) diff --git a/enshrine-esdt-safe/src/enshrine_esdt_safe_proxy.rs b/enshrine-esdt-safe/src/enshrine_esdt_safe_proxy.rs index cb57fb68..e2acf342 100644 --- a/enshrine-esdt-safe/src/enshrine_esdt_safe_proxy.rs +++ b/enshrine-esdt-safe/src/enshrine_esdt_safe_proxy.rs @@ -190,6 +190,22 @@ where .original_result() } + pub fn call_token_handler_mint_endpoint< + Arg0: ProxyArg>, + Arg1: ProxyArg>, + >( + self, + hash_of_hashes: Arg0, + operation_tuple: Arg1, + ) -> TxTypedCall { + self.wrapped_tx + .payment(NotPayable) + .raw_call("call_token_handler_mint_endpoint") + .argument(&hash_of_hashes) + .argument(&operation_tuple) + .original_result() + } + pub fn register_new_token_id< Arg0: ProxyArg>>, >( diff --git a/enshrine-esdt-safe/wasm-enshrine-esdt-safe-full/src/lib.rs b/enshrine-esdt-safe/wasm-enshrine-esdt-safe-full/src/lib.rs index 3d62b31d..6d2ed615 100644 --- a/enshrine-esdt-safe/wasm-enshrine-esdt-safe-full/src/lib.rs +++ b/enshrine-esdt-safe/wasm-enshrine-esdt-safe-full/src/lib.rs @@ -6,10 +6,10 @@ // Init: 1 // Upgrade: 1 -// Endpoints: 28 +// Endpoints: 29 // Async Callback: 1 // Promise callbacks: 2 -// Total number of exported functions: 33 +// Total number of exported functions: 34 #![no_std] @@ -28,6 +28,7 @@ multiversx_sc_wasm_adapter::endpoints! { addSigners => add_signers removeSigners => remove_signers executeBridgeOps => execute_operations + call_token_handler_mint_endpoint => call_token_handler_mint_endpoint registerNewTokenID => register_new_token_id setMaxTxBatchSize => set_max_tx_batch_size setMaxTxBatchBlockDuration => set_max_tx_batch_block_duration diff --git a/enshrine-esdt-safe/wasm/src/lib.rs b/enshrine-esdt-safe/wasm/src/lib.rs index 3d62b31d..6d2ed615 100644 --- a/enshrine-esdt-safe/wasm/src/lib.rs +++ b/enshrine-esdt-safe/wasm/src/lib.rs @@ -6,10 +6,10 @@ // Init: 1 // Upgrade: 1 -// Endpoints: 28 +// Endpoints: 29 // Async Callback: 1 // Promise callbacks: 2 -// Total number of exported functions: 33 +// Total number of exported functions: 34 #![no_std] @@ -28,6 +28,7 @@ multiversx_sc_wasm_adapter::endpoints! { addSigners => add_signers removeSigners => remove_signers executeBridgeOps => execute_operations + call_token_handler_mint_endpoint => call_token_handler_mint_endpoint registerNewTokenID => register_new_token_id setMaxTxBatchSize => set_max_tx_batch_size setMaxTxBatchBlockDuration => set_max_tx_batch_block_duration From ee47dcc4fd1ad1771e1cd620f4e7b5dcafb3877e Mon Sep 17 00:00:00 2001 From: Andrei Baltariu Date: Thu, 25 Jul 2024 15:59:16 +0300 Subject: [PATCH 183/523] Reverted and used into instead Signed-off-by: Andrei Baltariu --- common/transaction/src/lib.rs | 10 - .../src/from_sovereign/transfer_tokens.rs | 196 +----------------- 2 files changed, 5 insertions(+), 201 deletions(-) diff --git a/common/transaction/src/lib.rs b/common/transaction/src/lib.rs index c2fe0138..2e9a2e03 100644 --- a/common/transaction/src/lib.rs +++ b/common/transaction/src/lib.rs @@ -51,16 +51,6 @@ impl Operation { tuple_arr } - - pub fn map_tokens_vec_to_multi_value(&self) -> MultiValueEncoded> { - let mut multi_value_tokens = MultiValueEncoded::new(); - - for token in &self.tokens { - multi_value_tokens.push(token); - } - - multi_value_tokens - } } #[derive(TopEncode, TopDecode, NestedEncode, NestedDecode, TypeAbi, ManagedVecItem, Clone)] diff --git a/enshrine-esdt-safe/src/from_sovereign/transfer_tokens.rs b/enshrine-esdt-safe/src/from_sovereign/transfer_tokens.rs index 133375a2..71fa0504 100644 --- a/enshrine-esdt-safe/src/from_sovereign/transfer_tokens.rs +++ b/enshrine-esdt-safe/src/from_sovereign/transfer_tokens.rs @@ -1,12 +1,8 @@ use crate::{common, to_sovereign, token_handler_proxy}; -use builtin_func_names::ESDT_NFT_CREATE_FUNC_NAME; -use header_verifier::header_verifier_proxy; use multiversx_sc::imports::*; -use multiversx_sc::{api::ESDT_MULTI_TRANSFER_FUNC_NAME, codec, storage::StorageKey}; -use transaction::{GasLimit, Operation, OperationData, OperationEsdtPayment, OperationTuple}; +use multiversx_sc::storage::StorageKey; +use transaction::{Operation, OperationData, OperationEsdtPayment, OperationTuple}; -const CALLBACK_GAS: GasLimit = 10_000_000; // Increase if not enough -const TRANSACTION_GAS: GasLimit = 30_000_000; const DEFAULT_ISSUE_COST: u64 = 50000000000000000; #[multiversx_sc::module] @@ -83,15 +79,13 @@ pub trait TransferTokensModule: operation_tuple: OperationTuple, ) { let token_handler_address = self.token_handler_address().get(); + let multi_value_tokens: MultiValueEncoded> = + operation_tuple.operation.tokens.clone().into(); self.tx() .to(token_handler_address) .typed(token_handler_proxy::TokenHandlerProxy) - .mint_tokens( - hash_of_hashes, - operation_tuple.clone(), - operation_tuple.operation.map_tokens_vec_to_multi_value(), - ) + .mint_tokens(hash_of_hashes, operation_tuple, multi_value_tokens) .callback(::callbacks(self).save_minted_tokens()) .async_call_and_exit(); } @@ -155,186 +149,6 @@ pub trait TransferTokensModule: true } - fn mint_tokens( - &self, - operation_tokens: &ManagedVec>, - ) -> ManagedVec> { - let mut output_payments = ManagedVec::new(); - let sov_prefix = self.get_sovereign_prefix(); - - for operation_token in operation_tokens.iter() { - if !self.has_sov_prefix(&operation_token.token_identifier, &sov_prefix) { - output_payments.push(operation_token.clone()); - continue; - } - - let mut nonce = operation_token.token_nonce; - if nonce == 0 { - self.send().esdt_local_mint( - &operation_token.token_identifier, - operation_token.token_nonce, - &operation_token.token_data.amount, - ); - } else { - let token_data = operation_token.token_data.clone(); - let mut arg_buffer = ManagedArgBuffer::new(); - - arg_buffer.push_arg(&operation_token.token_identifier); - arg_buffer.push_arg(token_data.amount); - arg_buffer.push_arg(token_data.name); - arg_buffer.push_arg(token_data.royalties); - arg_buffer.push_arg(token_data.hash); - arg_buffer.push_arg(token_data.attributes); - - let uris = token_data.uris.clone(); - - if uris.is_empty() { - // at least one URI is required, so we push an empty one - arg_buffer.push_arg(codec::Empty); - } else { - // The API function has the last argument as variadic, - // so we top-encode each and send as separate argument - for uri in &uris { - arg_buffer.push_arg(uri); - } - } - - arg_buffer.push_arg(operation_token.token_nonce); - arg_buffer.push_arg(token_data.creator); - - let output = self.send_raw().call_local_esdt_built_in_function( - self.blockchain().get_gas_left(), - &ManagedBuffer::from(ESDT_NFT_CREATE_FUNC_NAME), - &arg_buffer, - ); - - if let Some(first_result_bytes) = output.try_get(0) { - nonce = first_result_bytes.parse_as_u64().unwrap_or_default() - } else { - nonce = 0 - } - } - - output_payments.push(OperationEsdtPayment { - token_identifier: operation_token.token_identifier, - token_nonce: nonce, - token_data: operation_token.token_data, - }); - } - - output_payments - } - - fn distribute_payments( - &self, - hash_of_hashes: ManagedBuffer, - operation_tuple: OperationTuple, - tokens_list: ManagedVec>, - ) { - let mapped_tokens: ManagedVec> = - tokens_list.iter().map(|token| token.into()).collect(); - - match &operation_tuple.operation.data.opt_transfer_data { - Some(transfer_data) => { - let mut args = ManagedArgBuffer::new(); - for arg in &transfer_data.args { - args.push_arg(arg); - } - - self.tx() - .to(&operation_tuple.operation.to) - .raw_call(transfer_data.function.clone()) - .arguments_raw(args.clone()) - .multi_esdt(mapped_tokens.clone()) - .gas(transfer_data.gas_limit) - .callback( - ::callbacks(self) - .execute(&hash_of_hashes, &operation_tuple), - ) - .gas_for_callback(CALLBACK_GAS) - .register_promise(); - } - None => { - let own_address = self.blockchain().get_sc_address(); - let args = - self.get_contract_call_args(&operation_tuple.operation.to, mapped_tokens); - - self.tx() - .to(own_address) - .raw_call(ESDT_MULTI_TRANSFER_FUNC_NAME) - .arguments_raw(args) - .gas(TRANSACTION_GAS) - .callback( - ::callbacks(self) - .execute(&hash_of_hashes, &operation_tuple), - ) - .register_promise(); - } - } - } - - fn get_contract_call_args( - self, - to: &ManagedAddress, - mapped_tokens: ManagedVec>, - ) -> ManagedArgBuffer { - let mut args = ManagedArgBuffer::new(); - args.push_arg(to); - args.push_arg(mapped_tokens.len()); - - for token in &mapped_tokens { - args.push_arg(token.token_identifier); - args.push_arg(token.token_nonce); - args.push_arg(token.amount); - } - - args - } - - #[promises_callback] - fn execute( - &self, - hash_of_hashes: &ManagedBuffer, - operation_tuple: &OperationTuple, - #[call_result] result: ManagedAsyncCallResult, - ) { - match result { - ManagedAsyncCallResult::Ok(_) => { - self.execute_bridge_operation_event( - hash_of_hashes.clone(), - operation_tuple.op_hash.clone(), - ); - } - ManagedAsyncCallResult::Err(_) => { - self.burn_sovereign_tokens(&operation_tuple.operation); - self.emit_transfer_failed_events(hash_of_hashes, operation_tuple); - } - } - - let header_verifier_address = self.header_verifier_address().get(); - - self.tx() - .to(header_verifier_address) - .typed(header_verifier_proxy::HeaderverifierProxy) - .remove_executed_hash(hash_of_hashes, &operation_tuple.op_hash) - .sync_call(); - } - - fn burn_sovereign_tokens(&self, operation: &Operation) { - let sov_prefix = self.get_sovereign_prefix(); - for token in operation.tokens.iter() { - if !self.has_sov_prefix(&token.token_identifier, &sov_prefix) { - continue; - } - - self.send().esdt_local_burn( - &token.token_identifier, - token.token_nonce, - &token.token_data.amount, - ); - } - } - fn emit_transfer_failed_events( &self, hash_of_hashes: &ManagedBuffer, From b8ec553ad923fe926b3635deb635d8774daf1711 Mon Sep 17 00:00:00 2001 From: Andrei Baltariu Date: Thu, 25 Jul 2024 18:28:59 +0300 Subject: [PATCH 184/523] Cleanup + added into() for tokens array Signed-off-by: Andrei Baltariu --- .../src/from_sovereign/transfer_tokens.rs | 23 ++++--------------- enshrine-esdt-safe/src/token_handler_proxy.rs | 3 --- token-handler/src/mint_tokens.rs | 6 ++--- token-handler/src/token_handler_proxy.rs | 3 --- 4 files changed, 7 insertions(+), 28 deletions(-) diff --git a/enshrine-esdt-safe/src/from_sovereign/transfer_tokens.rs b/enshrine-esdt-safe/src/from_sovereign/transfer_tokens.rs index 71fa0504..d1aff64d 100644 --- a/enshrine-esdt-safe/src/from_sovereign/transfer_tokens.rs +++ b/enshrine-esdt-safe/src/from_sovereign/transfer_tokens.rs @@ -28,7 +28,7 @@ pub trait TransferTokensModule: require!(self.not_paused(), "Cannot transfer while paused"); - let (operation_hash, is_registered) = + let (op_hash, is_registered) = self.calculate_operation_hash(hash_of_hashes.clone(), operation.clone()); if !is_registered { @@ -42,7 +42,7 @@ pub trait TransferTokensModule: self.emit_transfer_failed_events( &hash_of_hashes, &OperationTuple { - op_hash: operation_hash.clone(), + op_hash: op_hash.clone(), operation: operation.clone(), }, ); @@ -50,25 +50,12 @@ pub trait TransferTokensModule: return; } - let mut managed_tokens = MultiValueEncoded::new(); - - for token in operation.tokens.iter() { - managed_tokens.push(token); - } - let token_handler_address = self.token_handler_address().get(); self.tx() .to(token_handler_address) .typed(token_handler_proxy::TokenHandlerProxy) - .mint_tokens( - hash_of_hashes, - OperationTuple { - op_hash: operation_hash, - operation, - }, - managed_tokens, - ) + .mint_tokens(hash_of_hashes, OperationTuple { op_hash, operation }) .sync_call(); } @@ -79,13 +66,11 @@ pub trait TransferTokensModule: operation_tuple: OperationTuple, ) { let token_handler_address = self.token_handler_address().get(); - let multi_value_tokens: MultiValueEncoded> = - operation_tuple.operation.tokens.clone().into(); self.tx() .to(token_handler_address) .typed(token_handler_proxy::TokenHandlerProxy) - .mint_tokens(hash_of_hashes, operation_tuple, multi_value_tokens) + .mint_tokens(hash_of_hashes, operation_tuple) .callback(::callbacks(self).save_minted_tokens()) .async_call_and_exit(); } diff --git a/enshrine-esdt-safe/src/token_handler_proxy.rs b/enshrine-esdt-safe/src/token_handler_proxy.rs index 1849ef54..994ef106 100644 --- a/enshrine-esdt-safe/src/token_handler_proxy.rs +++ b/enshrine-esdt-safe/src/token_handler_proxy.rs @@ -91,19 +91,16 @@ where pub fn mint_tokens< Arg0: ProxyArg>, Arg1: ProxyArg>, - Arg2: ProxyArg>>, >( self, hash_of_hashes: Arg0, operation_tuple: Arg1, - operation_tokens: Arg2, ) -> TxTypedCall { self.wrapped_tx .payment(NotPayable) .raw_call("mintTokens") .argument(&hash_of_hashes) .argument(&operation_tuple) - .argument(&operation_tokens) .original_result() } diff --git a/token-handler/src/mint_tokens.rs b/token-handler/src/mint_tokens.rs index 8e5610ec..9d1adfb4 100644 --- a/token-handler/src/mint_tokens.rs +++ b/token-handler/src/mint_tokens.rs @@ -1,10 +1,10 @@ use header_verifier::header_verifier_proxy; use multiversx_sc::api::{ESDT_MULTI_TRANSFER_FUNC_NAME, ESDT_NFT_CREATE_FUNC_NAME}; use multiversx_sc::imports::IgnoreValue; +use multiversx_sc::types::ManagedVec; use multiversx_sc::types::{ system_proxy, EsdtTokenPayment, ManagedArgBuffer, ManagedAsyncCallResult, ToSelf, }; -use multiversx_sc::types::{ManagedVec, MultiValueEncoded}; use multiversx_sc::{codec, err_msg}; use transaction::{GasLimit, OperationData, OperationEsdtPayment, OperationTuple}; @@ -26,12 +26,11 @@ pub trait MintTokensModule: &self, hash_of_hashes: ManagedBuffer, operation_tuple: OperationTuple, - operation_tokens: MultiValueEncoded>, ) { let mut output_payments: ManagedVec> = ManagedVec::new(); - for operation_token in operation_tokens { + for operation_token in operation_tuple.operation.tokens.iter() { let sov_prefix = self.sov_prefix().get(); if !self.has_sov_prefix(&operation_token.token_identifier, &sov_prefix) { @@ -40,6 +39,7 @@ pub trait MintTokensModule: } let mut nonce = operation_token.token_nonce; + if nonce == 0 { self.tx() .to(ToSelf) diff --git a/token-handler/src/token_handler_proxy.rs b/token-handler/src/token_handler_proxy.rs index 1849ef54..994ef106 100644 --- a/token-handler/src/token_handler_proxy.rs +++ b/token-handler/src/token_handler_proxy.rs @@ -91,19 +91,16 @@ where pub fn mint_tokens< Arg0: ProxyArg>, Arg1: ProxyArg>, - Arg2: ProxyArg>>, >( self, hash_of_hashes: Arg0, operation_tuple: Arg1, - operation_tokens: Arg2, ) -> TxTypedCall { self.wrapped_tx .payment(NotPayable) .raw_call("mintTokens") .argument(&hash_of_hashes) .argument(&operation_tuple) - .argument(&operation_tokens) .original_result() } From 976eeda4d3f6607338a543d8be7eecec162565e1 Mon Sep 17 00:00:00 2001 From: Andrei Baltariu Date: Fri, 26 Jul 2024 00:36:07 +0300 Subject: [PATCH 185/523] Added new() function for operation structs Signed-off-by: Andrei Baltariu --- common/transaction/src/lib.rs | 42 +++++++++++++++++++ .../src/from_sovereign/transfer_tokens.rs | 13 ++---- token-handler/src/mint_tokens.rs | 16 +++---- 3 files changed, 51 insertions(+), 20 deletions(-) diff --git a/common/transaction/src/lib.rs b/common/transaction/src/lib.rs index 2e9a2e03..93d88c41 100644 --- a/common/transaction/src/lib.rs +++ b/common/transaction/src/lib.rs @@ -36,6 +36,14 @@ pub struct Operation { } impl Operation { + pub fn new( + to: ManagedAddress, + tokens: ManagedVec>, + data: OperationData, + ) -> Self { + Operation { to, tokens, data } + } + pub fn get_tokens_as_tuple_arr( &self, ) -> MultiValueEncoded, u64, EsdtTokenData>> { @@ -67,12 +75,32 @@ pub struct OperationData { pub opt_transfer_data: Option>, } +impl OperationData { + pub fn new( + op_nonce: TxId, + op_sender: ManagedAddress, + opt_transfer_data: Option>, + ) -> Self { + OperationData { + op_nonce, + op_sender, + opt_transfer_data, + } + } +} + #[derive(TopEncode, TopDecode, NestedEncode, NestedDecode, TypeAbi, ManagedVecItem, Clone)] pub struct OperationTuple { pub op_hash: ManagedBuffer, pub operation: Operation, } +impl OperationTuple { + pub fn new(op_hash: ManagedBuffer, operation: Operation) -> Self { + OperationTuple { op_hash, operation } + } +} + #[derive(TopEncode, TopDecode, NestedEncode, NestedDecode, TypeAbi, ManagedVecItem, Clone)] pub struct OperationEsdtPayment { pub token_identifier: TokenIdentifier, @@ -80,6 +108,20 @@ pub struct OperationEsdtPayment { pub token_data: StolenFromFrameworkEsdtTokenData, } +impl OperationEsdtPayment { + pub fn new( + token_identifier: TokenIdentifier, + token_nonce: u64, + token_data: StolenFromFrameworkEsdtTokenData, + ) -> Self { + OperationEsdtPayment { + token_identifier, + token_nonce, + token_data, + } + } +} + impl From> for EsdtTokenPayment { fn from(payment: OperationEsdtPayment) -> Self { EsdtTokenPayment { diff --git a/enshrine-esdt-safe/src/from_sovereign/transfer_tokens.rs b/enshrine-esdt-safe/src/from_sovereign/transfer_tokens.rs index d1aff64d..c7139ec5 100644 --- a/enshrine-esdt-safe/src/from_sovereign/transfer_tokens.rs +++ b/enshrine-esdt-safe/src/from_sovereign/transfer_tokens.rs @@ -41,10 +41,7 @@ pub trait TransferTokensModule: if !are_tokens_registered { self.emit_transfer_failed_events( &hash_of_hashes, - &OperationTuple { - op_hash: op_hash.clone(), - operation: operation.clone(), - }, + &OperationTuple::new(op_hash, operation), ); return; @@ -55,7 +52,7 @@ pub trait TransferTokensModule: self.tx() .to(token_handler_address) .typed(token_handler_proxy::TokenHandlerProxy) - .mint_tokens(hash_of_hashes, OperationTuple { op_hash, operation }) + .mint_tokens(hash_of_hashes, OperationTuple::new(op_hash, operation)) .sync_call(); } @@ -151,11 +148,7 @@ pub trait TransferTokensModule: self.deposit_event( &operation_tuple.operation.data.op_sender, &operation_tuple.operation.get_tokens_as_tuple_arr(), - OperationData { - op_nonce: tx_nonce, - op_sender: sc_address.clone(), - opt_transfer_data: None, - }, + OperationData::new(tx_nonce, sc_address.clone(), None), ); } diff --git a/token-handler/src/mint_tokens.rs b/token-handler/src/mint_tokens.rs index 9d1adfb4..825e86c1 100644 --- a/token-handler/src/mint_tokens.rs +++ b/token-handler/src/mint_tokens.rs @@ -90,11 +90,11 @@ pub trait MintTokensModule: } } - output_payments.push(OperationEsdtPayment { - token_identifier: operation_token.token_identifier, - token_nonce: nonce, - token_data: operation_token.token_data, - }); + output_payments.push(OperationEsdtPayment::new( + operation_token.token_identifier, + nonce, + operation_token.token_data, + )); } self.distribute_payments(hash_of_hashes, operation_tuple); @@ -215,11 +215,7 @@ pub trait MintTokensModule: self.deposit_event( &operation_tuple.operation.data.op_sender, &operation_tuple.operation.get_tokens_as_tuple_arr(), - OperationData { - op_nonce: tx_nonce, - op_sender: sc_address.clone(), - opt_transfer_data: None, - }, + OperationData::new(tx_nonce, sc_address.clone(), None), ); } } From 37b088d9f34a51ae5694308db289e2a6a6d9d26f Mon Sep 17 00:00:00 2001 From: Andrei Baltariu Date: Fri, 26 Jul 2024 01:02:05 +0300 Subject: [PATCH 186/523] Modified Cargo lock to include token-handler SC Signed-off-by: Andrei Baltariu --- Cargo.lock | 8 ++++++++ Cargo.toml | 4 +++- enshrine-esdt-safe/src/enshrine_esdt_safe_proxy.rs | 13 +++++++++++++ .../wasm-enshrine-esdt-safe-full/Cargo.lock | 11 +++++++++++ .../wasm-enshrine-esdt-safe-full/src/lib.rs | 5 +++-- .../wasm-enshrine-esdt-safe-view/Cargo.lock | 11 +++++++++++ enshrine-esdt-safe/wasm/Cargo.lock | 11 +++++++++++ enshrine-esdt-safe/wasm/src/lib.rs | 5 +++-- 8 files changed, 63 insertions(+), 5 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 1c65bb67..6869b700 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1070,6 +1070,14 @@ dependencies = [ "utils", ] +[[package]] +name = "token-handler-meta" +version = "0.0.0" +dependencies = [ + "multiversx-sc-meta-lib", + "token-handler", +] + [[package]] name = "token-whitelist" version = "0.0.0" diff --git a/Cargo.toml b/Cargo.toml index e539e782..e29fcca9 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -15,5 +15,7 @@ members = [ "header-verifier", "header-verifier/meta", "enshrine-esdt-safe", - "enshrine-esdt-safe/meta" + "enshrine-esdt-safe/meta", + "token-handler", + "token-handler/meta" ] diff --git a/enshrine-esdt-safe/src/enshrine_esdt_safe_proxy.rs b/enshrine-esdt-safe/src/enshrine_esdt_safe_proxy.rs index cb57fb68..df587e03 100644 --- a/enshrine-esdt-safe/src/enshrine_esdt_safe_proxy.rs +++ b/enshrine-esdt-safe/src/enshrine_esdt_safe_proxy.rs @@ -190,6 +190,19 @@ where .original_result() } + pub fn call_token_handler_mint_endpoint< + Arg0: ProxyArg>, + >( + self, + operation: Arg0, + ) -> TxTypedCall { + self.wrapped_tx + .payment(NotPayable) + .raw_call("call_token_handler_mint_endpoint") + .argument(&operation) + .original_result() + } + pub fn register_new_token_id< Arg0: ProxyArg>>, >( diff --git a/enshrine-esdt-safe/wasm-enshrine-esdt-safe-full/Cargo.lock b/enshrine-esdt-safe/wasm-enshrine-esdt-safe-full/Cargo.lock index 9677d66b..9bc6cb25 100644 --- a/enshrine-esdt-safe/wasm-enshrine-esdt-safe-full/Cargo.lock +++ b/enshrine-esdt-safe/wasm-enshrine-esdt-safe-full/Cargo.lock @@ -45,6 +45,7 @@ dependencies = [ "multiversx-sc", "multiversx-sc-modules", "setup-phase", + "token-handler", "token-whitelist", "transaction", "tx-batch-module", @@ -251,6 +252,16 @@ dependencies = [ "unicode-ident", ] +[[package]] +name = "token-handler" +version = "0.0.0" +dependencies = [ + "bls-signature", + "multiversx-sc", + "transaction", + "utils", +] + [[package]] name = "token-whitelist" version = "0.0.0" diff --git a/enshrine-esdt-safe/wasm-enshrine-esdt-safe-full/src/lib.rs b/enshrine-esdt-safe/wasm-enshrine-esdt-safe-full/src/lib.rs index 3d62b31d..6d2ed615 100644 --- a/enshrine-esdt-safe/wasm-enshrine-esdt-safe-full/src/lib.rs +++ b/enshrine-esdt-safe/wasm-enshrine-esdt-safe-full/src/lib.rs @@ -6,10 +6,10 @@ // Init: 1 // Upgrade: 1 -// Endpoints: 28 +// Endpoints: 29 // Async Callback: 1 // Promise callbacks: 2 -// Total number of exported functions: 33 +// Total number of exported functions: 34 #![no_std] @@ -28,6 +28,7 @@ multiversx_sc_wasm_adapter::endpoints! { addSigners => add_signers removeSigners => remove_signers executeBridgeOps => execute_operations + call_token_handler_mint_endpoint => call_token_handler_mint_endpoint registerNewTokenID => register_new_token_id setMaxTxBatchSize => set_max_tx_batch_size setMaxTxBatchBlockDuration => set_max_tx_batch_block_duration diff --git a/enshrine-esdt-safe/wasm-enshrine-esdt-safe-view/Cargo.lock b/enshrine-esdt-safe/wasm-enshrine-esdt-safe-view/Cargo.lock index 1cecede7..d8b81871 100644 --- a/enshrine-esdt-safe/wasm-enshrine-esdt-safe-view/Cargo.lock +++ b/enshrine-esdt-safe/wasm-enshrine-esdt-safe-view/Cargo.lock @@ -45,6 +45,7 @@ dependencies = [ "multiversx-sc", "multiversx-sc-modules", "setup-phase", + "token-handler", "token-whitelist", "transaction", "tx-batch-module", @@ -251,6 +252,16 @@ dependencies = [ "unicode-ident", ] +[[package]] +name = "token-handler" +version = "0.0.0" +dependencies = [ + "bls-signature", + "multiversx-sc", + "transaction", + "utils", +] + [[package]] name = "token-whitelist" version = "0.0.0" diff --git a/enshrine-esdt-safe/wasm/Cargo.lock b/enshrine-esdt-safe/wasm/Cargo.lock index 060a012b..d6fcccb7 100644 --- a/enshrine-esdt-safe/wasm/Cargo.lock +++ b/enshrine-esdt-safe/wasm/Cargo.lock @@ -45,6 +45,7 @@ dependencies = [ "multiversx-sc", "multiversx-sc-modules", "setup-phase", + "token-handler", "token-whitelist", "transaction", "tx-batch-module", @@ -251,6 +252,16 @@ dependencies = [ "unicode-ident", ] +[[package]] +name = "token-handler" +version = "0.0.0" +dependencies = [ + "bls-signature", + "multiversx-sc", + "transaction", + "utils", +] + [[package]] name = "token-whitelist" version = "0.0.0" diff --git a/enshrine-esdt-safe/wasm/src/lib.rs b/enshrine-esdt-safe/wasm/src/lib.rs index 3d62b31d..6d2ed615 100644 --- a/enshrine-esdt-safe/wasm/src/lib.rs +++ b/enshrine-esdt-safe/wasm/src/lib.rs @@ -6,10 +6,10 @@ // Init: 1 // Upgrade: 1 -// Endpoints: 28 +// Endpoints: 29 // Async Callback: 1 // Promise callbacks: 2 -// Total number of exported functions: 33 +// Total number of exported functions: 34 #![no_std] @@ -28,6 +28,7 @@ multiversx_sc_wasm_adapter::endpoints! { addSigners => add_signers removeSigners => remove_signers executeBridgeOps => execute_operations + call_token_handler_mint_endpoint => call_token_handler_mint_endpoint registerNewTokenID => register_new_token_id setMaxTxBatchSize => set_max_tx_batch_size setMaxTxBatchBlockDuration => set_max_tx_batch_block_duration From bd1e018a7388d0e1782b6fa01586bebcdd767c8f Mon Sep 17 00:00:00 2001 From: Andrei Baltariu Date: Fri, 26 Jul 2024 01:06:55 +0300 Subject: [PATCH 187/523] Clippy fixes Signed-off-by: Andrei Baltariu --- .../src/from_sovereign/transfer_tokens.rs | 11 ----------- 1 file changed, 11 deletions(-) diff --git a/enshrine-esdt-safe/src/from_sovereign/transfer_tokens.rs b/enshrine-esdt-safe/src/from_sovereign/transfer_tokens.rs index 5eea5ef2..048bd03c 100644 --- a/enshrine-esdt-safe/src/from_sovereign/transfer_tokens.rs +++ b/enshrine-esdt-safe/src/from_sovereign/transfer_tokens.rs @@ -53,17 +53,6 @@ pub trait TransferTokensModule: return; } - - let operation_tuple = OperationTuple { - op_hash: operation_hash, - operation: operation.clone(), - }; - - // self.distribute_payments( - // hash_of_hashes.clone(), - // operation_tuple.clone(), - // tokens.to_vec(), - // ); } #[endpoint] From c2bfe522c37f39df2a88e60867ce7ca04185d310 Mon Sep 17 00:00:00 2001 From: Andrei Baltariu Date: Fri, 26 Jul 2024 09:47:13 +0300 Subject: [PATCH 188/523] Added references where is possible Signed-off-by: Andrei Baltariu --- .../wasm-enshrine-esdt-safe-full/src/lib.rs | 5 ++--- enshrine-esdt-safe/wasm/src/lib.rs | 5 ++--- token-handler/src/mint_tokens.rs | 12 ++++++------ 3 files changed, 10 insertions(+), 12 deletions(-) diff --git a/enshrine-esdt-safe/wasm-enshrine-esdt-safe-full/src/lib.rs b/enshrine-esdt-safe/wasm-enshrine-esdt-safe-full/src/lib.rs index 6d2ed615..ece84b89 100644 --- a/enshrine-esdt-safe/wasm-enshrine-esdt-safe-full/src/lib.rs +++ b/enshrine-esdt-safe/wasm-enshrine-esdt-safe-full/src/lib.rs @@ -8,8 +8,8 @@ // Upgrade: 1 // Endpoints: 29 // Async Callback: 1 -// Promise callbacks: 2 -// Total number of exported functions: 34 +// Promise callbacks: 1 +// Total number of exported functions: 33 #![no_std] @@ -51,7 +51,6 @@ multiversx_sc_wasm_adapter::endpoints! { unpause => unpause_endpoint isPaused => paused_status save_minted_tokens => save_minted_tokens - execute => execute ) } diff --git a/enshrine-esdt-safe/wasm/src/lib.rs b/enshrine-esdt-safe/wasm/src/lib.rs index 6d2ed615..ece84b89 100644 --- a/enshrine-esdt-safe/wasm/src/lib.rs +++ b/enshrine-esdt-safe/wasm/src/lib.rs @@ -8,8 +8,8 @@ // Upgrade: 1 // Endpoints: 29 // Async Callback: 1 -// Promise callbacks: 2 -// Total number of exported functions: 34 +// Promise callbacks: 1 +// Total number of exported functions: 33 #![no_std] @@ -51,7 +51,6 @@ multiversx_sc_wasm_adapter::endpoints! { unpause => unpause_endpoint isPaused => paused_status save_minted_tokens => save_minted_tokens - execute => execute ) } diff --git a/token-handler/src/mint_tokens.rs b/token-handler/src/mint_tokens.rs index 9d1adfb4..f59dcab6 100644 --- a/token-handler/src/mint_tokens.rs +++ b/token-handler/src/mint_tokens.rs @@ -97,13 +97,13 @@ pub trait MintTokensModule: }); } - self.distribute_payments(hash_of_hashes, operation_tuple); + self.distribute_payments(&hash_of_hashes, &operation_tuple); } fn distribute_payments( &self, - hash_of_hashes: ManagedBuffer, - operation_tuple: OperationTuple, + hash_of_hashes: &ManagedBuffer, + operation_tuple: &OperationTuple, ) { let mapped_tokens: ManagedVec> = operation_tuple .operation @@ -135,7 +135,7 @@ pub trait MintTokensModule: None => { let own_address = self.blockchain().get_sc_address(); let args = - self.get_contract_call_args(&operation_tuple.operation.to, mapped_tokens); + self.get_contract_call_args(&operation_tuple.operation.to, &mapped_tokens); self.tx() .to(own_address) @@ -183,13 +183,13 @@ pub trait MintTokensModule: fn get_contract_call_args( self, to: &ManagedAddress, - mapped_tokens: ManagedVec>, + mapped_tokens: &ManagedVec>, ) -> ManagedArgBuffer { let mut args = ManagedArgBuffer::new(); args.push_arg(to); args.push_arg(mapped_tokens.len()); - for token in &mapped_tokens { + for token in mapped_tokens { args.push_arg(token.token_identifier); args.push_arg(token.token_nonce); args.push_arg(token.amount); From 38dc22c812c2c4005efa906803c4ad41d616ab92 Mon Sep 17 00:00:00 2001 From: Andrei Baltariu Date: Fri, 26 Jul 2024 10:05:16 +0300 Subject: [PATCH 189/523] Added function for preparing nft create args Signed-off-by: Andrei Baltariu --- token-handler/src/mint_tokens.rs | 71 ++++++++++++++++++++------------ 1 file changed, 44 insertions(+), 27 deletions(-) diff --git a/token-handler/src/mint_tokens.rs b/token-handler/src/mint_tokens.rs index f59dcab6..f970aed6 100644 --- a/token-handler/src/mint_tokens.rs +++ b/token-handler/src/mint_tokens.rs @@ -1,12 +1,14 @@ use header_verifier::header_verifier_proxy; use multiversx_sc::api::{ESDT_MULTI_TRANSFER_FUNC_NAME, ESDT_NFT_CREATE_FUNC_NAME}; use multiversx_sc::imports::IgnoreValue; -use multiversx_sc::types::ManagedVec; use multiversx_sc::types::{ system_proxy, EsdtTokenPayment, ManagedArgBuffer, ManagedAsyncCallResult, ToSelf, }; +use multiversx_sc::types::{ManagedVec, TokenIdentifier}; use multiversx_sc::{codec, err_msg}; -use transaction::{GasLimit, OperationData, OperationEsdtPayment, OperationTuple}; +use transaction::{ + GasLimit, OperationData, OperationEsdtPayment, OperationTuple, StolenFromFrameworkEsdtTokenData, +}; const CALLBACK_GAS: GasLimit = 10_000_000; // Increase if not enough const TRANSACTION_GAS: GasLimit = 30_000_000; @@ -51,31 +53,11 @@ pub trait MintTokensModule: ) .sync_call(); } else { - let token_data = operation_token.token_data.clone(); - let mut arg_buffer = ManagedArgBuffer::new(); - - arg_buffer.push_arg(&operation_token.token_identifier); - arg_buffer.push_arg(token_data.amount); - arg_buffer.push_arg(token_data.name); - arg_buffer.push_arg(token_data.royalties); - arg_buffer.push_arg(token_data.hash); - arg_buffer.push_arg(token_data.attributes); - - let uris = token_data.uris.clone(); - - if uris.is_empty() { - // at least one URI is required, so we push an empty one - arg_buffer.push_arg(codec::Empty); - } else { - // The API function has the last argument as variadic, - // so we top-encode each and send as separate argument - for uri in &uris { - arg_buffer.push_arg(uri); - } - } - - arg_buffer.push_arg(operation_token.token_nonce); - arg_buffer.push_arg(token_data.creator); + let arg_buffer = self.prepare_nft_create_args( + &operation_token.token_identifier, + &operation_token.token_nonce, + &operation_token.token_data, + ); let output = self.send_raw().call_local_esdt_built_in_function( self.blockchain().get_gas_left(), @@ -100,6 +82,41 @@ pub trait MintTokensModule: self.distribute_payments(&hash_of_hashes, &operation_tuple); } + fn prepare_nft_create_args( + &self, + token_identifier: &TokenIdentifier, + token_nonce: &u64, + token_data: &StolenFromFrameworkEsdtTokenData, + ) -> ManagedArgBuffer { + let mut arg_buffer = ManagedArgBuffer::new(); + let cloned_token_data = token_data.clone(); + + arg_buffer.push_arg(&token_identifier); + arg_buffer.push_arg(cloned_token_data.amount); + arg_buffer.push_arg(cloned_token_data.name); + arg_buffer.push_arg(cloned_token_data.royalties); + arg_buffer.push_arg(cloned_token_data.hash); + arg_buffer.push_arg(cloned_token_data.attributes); + + let uris = token_data.uris.clone(); + + if uris.is_empty() { + // at least one URI is required, so we push an empty one + arg_buffer.push_arg(codec::Empty); + } else { + // The API function has the last argument as variadic, + // so we top-encode each and send as separate argument + for uri in &uris { + arg_buffer.push_arg(uri); + } + } + + arg_buffer.push_arg(token_nonce); + arg_buffer.push_arg(cloned_token_data.creator); + + arg_buffer + } + fn distribute_payments( &self, hash_of_hashes: &ManagedBuffer, From 74c6e8e19d1b5ba1489fd22b62a4f7bfdf321b51 Mon Sep 17 00:00:00 2001 From: Andrei Baltariu Date: Fri, 26 Jul 2024 10:08:30 +0300 Subject: [PATCH 190/523] Renamed nft create args function Signed-off-by: Andrei Baltariu --- token-handler/src/mint_tokens.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/token-handler/src/mint_tokens.rs b/token-handler/src/mint_tokens.rs index f970aed6..54c3ae99 100644 --- a/token-handler/src/mint_tokens.rs +++ b/token-handler/src/mint_tokens.rs @@ -53,7 +53,7 @@ pub trait MintTokensModule: ) .sync_call(); } else { - let arg_buffer = self.prepare_nft_create_args( + let arg_buffer = self.get_nft_create_args( &operation_token.token_identifier, &operation_token.token_nonce, &operation_token.token_data, @@ -82,7 +82,7 @@ pub trait MintTokensModule: self.distribute_payments(&hash_of_hashes, &operation_tuple); } - fn prepare_nft_create_args( + fn get_nft_create_args( &self, token_identifier: &TokenIdentifier, token_nonce: &u64, From d6940e0fd7504c90684185d2b1120b7801f772b1 Mon Sep 17 00:00:00 2001 From: Andrei Baltariu Date: Fri, 26 Jul 2024 10:31:13 +0300 Subject: [PATCH 191/523] Added enshrine esdt address whitelist Signed-off-by: Andrei Baltariu --- token-handler/src/common/storage.rs | 8 +++++++- token-handler/src/lib.rs | 21 +++++++++++++++++++++ 2 files changed, 28 insertions(+), 1 deletion(-) diff --git a/token-handler/src/common/storage.rs b/token-handler/src/common/storage.rs index ce708adb..2c491160 100644 --- a/token-handler/src/common/storage.rs +++ b/token-handler/src/common/storage.rs @@ -1,7 +1,13 @@ -use multiversx_sc::imports::SingleValueMapper; +use multiversx_sc::{ + imports::{SingleValueMapper, UnorderedSetMapper}, + types::ManagedAddress, +}; #[multiversx_sc::module] pub trait CommonStorage { #[storage_mapper] fn sov_prefix(&self) -> SingleValueMapper; + + #[storage_mapper("enshrineEsdtWhitelist")] + fn enshrine_esdt_whitelist(&self) -> UnorderedSetMapper>; } diff --git a/token-handler/src/lib.rs b/token-handler/src/lib.rs index 1b225737..9c367eea 100644 --- a/token-handler/src/lib.rs +++ b/token-handler/src/lib.rs @@ -23,4 +23,25 @@ pub trait TokenHandler: #[upgrade] fn upgrade(&self) {} + + #[only_owner] + #[endpoint(setEnshrineEsdtWhitelist)] + fn set_enshrine_esdt_whitelist( + &self, + enshrine_esdt_addresses: MultiValueEncoded>, + ) { + require!( + !enshrine_esdt_addresses.is_empty(), + "There are no addresses sent to be registered" + ); + + for esdt_address in enshrine_esdt_addresses.into_iter() { + require!( + self.blockchain().is_smart_contract(&esdt_address), + "One of the addresses passed is not a valid smart contract address" + ); + + self.enshrine_esdt_whitelist().insert(esdt_address); + } + } } From 315a3a2e651aadd67a912a2f93e0da5f568b760d Mon Sep 17 00:00:00 2001 From: Andrei Baltariu Date: Fri, 26 Jul 2024 10:32:40 +0300 Subject: [PATCH 192/523] Regenerated proxy Signed-off-by: Andrei Baltariu --- enshrine-esdt-safe/src/token_handler_proxy.rs | 13 +++++++++++++ token-handler/src/token_handler_proxy.rs | 13 +++++++++++++ token-handler/wasm-token-handler-full/src/lib.rs | 5 +++-- token-handler/wasm/src/lib.rs | 5 +++-- 4 files changed, 32 insertions(+), 4 deletions(-) diff --git a/enshrine-esdt-safe/src/token_handler_proxy.rs b/enshrine-esdt-safe/src/token_handler_proxy.rs index 83c00023..acf15410 100644 --- a/enshrine-esdt-safe/src/token_handler_proxy.rs +++ b/enshrine-esdt-safe/src/token_handler_proxy.rs @@ -85,6 +85,19 @@ where To: TxTo, Gas: TxGas, { + pub fn set_enshrine_esdt_whitelist< + Arg0: ProxyArg>>, + >( + self, + enshrine_esdt_addresses: Arg0, + ) -> TxTypedCall { + self.wrapped_tx + .payment(NotPayable) + .raw_call("setEnshrineEsdtWhitelist") + .argument(&enshrine_esdt_addresses) + .original_result() + } + pub fn mint_tokens< Arg0: ProxyArg>>, >( diff --git a/token-handler/src/token_handler_proxy.rs b/token-handler/src/token_handler_proxy.rs index 83c00023..acf15410 100644 --- a/token-handler/src/token_handler_proxy.rs +++ b/token-handler/src/token_handler_proxy.rs @@ -85,6 +85,19 @@ where To: TxTo, Gas: TxGas, { + pub fn set_enshrine_esdt_whitelist< + Arg0: ProxyArg>>, + >( + self, + enshrine_esdt_addresses: Arg0, + ) -> TxTypedCall { + self.wrapped_tx + .payment(NotPayable) + .raw_call("setEnshrineEsdtWhitelist") + .argument(&enshrine_esdt_addresses) + .original_result() + } + pub fn mint_tokens< Arg0: ProxyArg>>, >( diff --git a/token-handler/wasm-token-handler-full/src/lib.rs b/token-handler/wasm-token-handler-full/src/lib.rs index 79bf8a84..d8344d4d 100644 --- a/token-handler/wasm-token-handler-full/src/lib.rs +++ b/token-handler/wasm-token-handler-full/src/lib.rs @@ -6,9 +6,9 @@ // Init: 1 // Upgrade: 1 -// Endpoints: 2 +// Endpoints: 3 // Async Callback (empty): 1 -// Total number of exported functions: 5 +// Total number of exported functions: 6 #![no_std] @@ -20,6 +20,7 @@ multiversx_sc_wasm_adapter::endpoints! { ( init => init upgrade => upgrade + setEnshrineEsdtWhitelist => set_enshrine_esdt_whitelist mintTokens => mint_tokens burnTokens => burn_tokens ) diff --git a/token-handler/wasm/src/lib.rs b/token-handler/wasm/src/lib.rs index 79bf8a84..d8344d4d 100644 --- a/token-handler/wasm/src/lib.rs +++ b/token-handler/wasm/src/lib.rs @@ -6,9 +6,9 @@ // Init: 1 // Upgrade: 1 -// Endpoints: 2 +// Endpoints: 3 // Async Callback (empty): 1 -// Total number of exported functions: 5 +// Total number of exported functions: 6 #![no_std] @@ -20,6 +20,7 @@ multiversx_sc_wasm_adapter::endpoints! { ( init => init upgrade => upgrade + setEnshrineEsdtWhitelist => set_enshrine_esdt_whitelist mintTokens => mint_tokens burnTokens => burn_tokens ) From 56093cbc599fed60c46ec9926c10093d19611a96 Mon Sep 17 00:00:00 2001 From: Andrei Baltariu Date: Fri, 26 Jul 2024 10:39:33 +0300 Subject: [PATCH 193/523] Added whitelist check in mint tokens module Signed-off-by: Andrei Baltariu --- token-handler/src/mint_tokens.rs | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/token-handler/src/mint_tokens.rs b/token-handler/src/mint_tokens.rs index e31dedf5..e64e9745 100644 --- a/token-handler/src/mint_tokens.rs +++ b/token-handler/src/mint_tokens.rs @@ -1,7 +1,7 @@ use multiversx_sc::api::ESDT_NFT_CREATE_FUNC_NAME; use multiversx_sc::types::ManagedArgBuffer; use multiversx_sc::types::{ManagedVec, MultiValueEncoded}; -use multiversx_sc::{codec, err_msg}; +use multiversx_sc::{codec, err_msg, require}; use transaction::OperationEsdtPayment; use crate::common; @@ -10,6 +10,8 @@ use crate::common; pub trait MintTokens: utils::UtilsModule + common::storage::CommonStorage { #[endpoint(mintTokens)] fn mint_tokens(&self, operation_tokens: MultiValueEncoded>) { + self.require_caller_to_be_whitelisted(); + let mut output_payments: ManagedVec> = ManagedVec::new(); @@ -76,4 +78,13 @@ pub trait MintTokens: utils::UtilsModule + common::storage::CommonStorage { }); } } + + fn require_caller_to_be_whitelisted(&self) { + let caller = self.blockchain().get_caller(); + + require!( + self.enshrine_esdt_whitelist().contains(&caller), + "Caller is not whitelisted" + ); + } } From fdd1b5675a2e9faddbe7a2e0ab659a92d8c02a54 Mon Sep 17 00:00:00 2001 From: Andrei Baltariu Date: Fri, 26 Jul 2024 10:41:30 +0300 Subject: [PATCH 194/523] Moved whitelist check in common storage module Signed-off-by: Andrei Baltariu --- token-handler/src/burn_tokens.rs | 2 ++ token-handler/src/common/storage.rs | 10 ++++++++++ token-handler/src/mint_tokens.rs | 11 +---------- 3 files changed, 13 insertions(+), 10 deletions(-) diff --git a/token-handler/src/burn_tokens.rs b/token-handler/src/burn_tokens.rs index 1dc2e29c..c7e88b80 100644 --- a/token-handler/src/burn_tokens.rs +++ b/token-handler/src/burn_tokens.rs @@ -5,6 +5,8 @@ use transaction::Operation; pub trait BurnTokens: utils::UtilsModule + common::storage::CommonStorage { #[endpoint(burnTokens)] fn burn_tokens(&self, operation: Operation) { + self.require_caller_to_be_whitelisted(); + let sov_prefix = self.sov_prefix().get(); for token in operation.tokens.iter() { diff --git a/token-handler/src/common/storage.rs b/token-handler/src/common/storage.rs index 2c491160..27e728c4 100644 --- a/token-handler/src/common/storage.rs +++ b/token-handler/src/common/storage.rs @@ -1,5 +1,6 @@ use multiversx_sc::{ imports::{SingleValueMapper, UnorderedSetMapper}, + require, types::ManagedAddress, }; @@ -10,4 +11,13 @@ pub trait CommonStorage { #[storage_mapper("enshrineEsdtWhitelist")] fn enshrine_esdt_whitelist(&self) -> UnorderedSetMapper>; + + fn require_caller_to_be_whitelisted(&self) { + let caller = self.blockchain().get_caller(); + + require!( + self.enshrine_esdt_whitelist().contains(&caller), + "Caller is not whitelisted" + ); + } } diff --git a/token-handler/src/mint_tokens.rs b/token-handler/src/mint_tokens.rs index e64e9745..6274fccb 100644 --- a/token-handler/src/mint_tokens.rs +++ b/token-handler/src/mint_tokens.rs @@ -1,7 +1,7 @@ use multiversx_sc::api::ESDT_NFT_CREATE_FUNC_NAME; use multiversx_sc::types::ManagedArgBuffer; use multiversx_sc::types::{ManagedVec, MultiValueEncoded}; -use multiversx_sc::{codec, err_msg, require}; +use multiversx_sc::{codec, err_msg}; use transaction::OperationEsdtPayment; use crate::common; @@ -78,13 +78,4 @@ pub trait MintTokens: utils::UtilsModule + common::storage::CommonStorage { }); } } - - fn require_caller_to_be_whitelisted(&self) { - let caller = self.blockchain().get_caller(); - - require!( - self.enshrine_esdt_whitelist().contains(&caller), - "Caller is not whitelisted" - ); - } } From a281c360775edfaa1eceffa5dda578e1304f3b24 Mon Sep 17 00:00:00 2001 From: Andrei Baltariu Date: Fri, 26 Jul 2024 11:18:29 +0300 Subject: [PATCH 195/523] Renamed module and endpoint to transfer tokens Signed-off-by: Andrei Baltariu --- enshrine-esdt-safe/src/token_handler_proxy.rs | 4 ++-- token-handler/src/lib.rs | 2 +- token-handler/src/mint_tokens.rs | 10 +++++----- token-handler/src/token_handler_proxy.rs | 4 ++-- token-handler/wasm-token-handler-full/src/lib.rs | 2 +- token-handler/wasm/src/lib.rs | 2 +- 6 files changed, 12 insertions(+), 12 deletions(-) diff --git a/enshrine-esdt-safe/src/token_handler_proxy.rs b/enshrine-esdt-safe/src/token_handler_proxy.rs index 994ef106..1f8fc52a 100644 --- a/enshrine-esdt-safe/src/token_handler_proxy.rs +++ b/enshrine-esdt-safe/src/token_handler_proxy.rs @@ -88,7 +88,7 @@ where To: TxTo, Gas: TxGas, { - pub fn mint_tokens< + pub fn transfer_tokens< Arg0: ProxyArg>, Arg1: ProxyArg>, >( @@ -98,7 +98,7 @@ where ) -> TxTypedCall { self.wrapped_tx .payment(NotPayable) - .raw_call("mintTokens") + .raw_call("transferTokens") .argument(&hash_of_hashes) .argument(&operation_tuple) .original_result() diff --git a/token-handler/src/lib.rs b/token-handler/src/lib.rs index d16a485c..11a7820e 100644 --- a/token-handler/src/lib.rs +++ b/token-handler/src/lib.rs @@ -10,7 +10,7 @@ pub mod token_handler_proxy; #[multiversx_sc::contract] pub trait TokenHandler: - mint_tokens::MintTokensModule + mint_tokens::TransferTokensModule + burn_tokens::BurnTokensModule + utils::UtilsModule + common::storage::CommonStorage diff --git a/token-handler/src/mint_tokens.rs b/token-handler/src/mint_tokens.rs index 54c3ae99..901b6d7c 100644 --- a/token-handler/src/mint_tokens.rs +++ b/token-handler/src/mint_tokens.rs @@ -16,15 +16,15 @@ const TRANSACTION_GAS: GasLimit = 30_000_000; use crate::{burn_tokens, common}; #[multiversx_sc::module] -pub trait MintTokensModule: +pub trait TransferTokensModule: utils::UtilsModule + common::storage::CommonStorage + common::events::EventsModule + burn_tokens::BurnTokensModule + tx_batch_module::TxBatchModule { - #[endpoint(mintTokens)] - fn mint_tokens( + #[endpoint(transferTokens)] + fn transfer_tokens( &self, hash_of_hashes: ManagedBuffer, operation_tuple: OperationTuple, @@ -143,7 +143,7 @@ pub trait MintTokensModule: .multi_esdt(mapped_tokens.clone()) .gas(transfer_data.gas_limit) .callback( - ::callbacks(self) + ::callbacks(self) .execute(&hash_of_hashes, &operation_tuple), ) .gas_for_callback(CALLBACK_GAS) @@ -160,7 +160,7 @@ pub trait MintTokensModule: .arguments_raw(args) .gas(TRANSACTION_GAS) .callback( - ::callbacks(self) + ::callbacks(self) .execute(&hash_of_hashes, &operation_tuple), ) .register_promise(); diff --git a/token-handler/src/token_handler_proxy.rs b/token-handler/src/token_handler_proxy.rs index 994ef106..1f8fc52a 100644 --- a/token-handler/src/token_handler_proxy.rs +++ b/token-handler/src/token_handler_proxy.rs @@ -88,7 +88,7 @@ where To: TxTo, Gas: TxGas, { - pub fn mint_tokens< + pub fn transfer_tokens< Arg0: ProxyArg>, Arg1: ProxyArg>, >( @@ -98,7 +98,7 @@ where ) -> TxTypedCall { self.wrapped_tx .payment(NotPayable) - .raw_call("mintTokens") + .raw_call("transferTokens") .argument(&hash_of_hashes) .argument(&operation_tuple) .original_result() diff --git a/token-handler/wasm-token-handler-full/src/lib.rs b/token-handler/wasm-token-handler-full/src/lib.rs index fda7d7f9..da87de37 100644 --- a/token-handler/wasm-token-handler-full/src/lib.rs +++ b/token-handler/wasm-token-handler-full/src/lib.rs @@ -21,7 +21,7 @@ multiversx_sc_wasm_adapter::endpoints! { ( init => init upgrade => upgrade - mintTokens => mint_tokens + transferTokens => transfer_tokens burnTokens => burn_tokens_endpoint setMaxTxBatchSize => set_max_tx_batch_size setMaxTxBatchBlockDuration => set_max_tx_batch_block_duration diff --git a/token-handler/wasm/src/lib.rs b/token-handler/wasm/src/lib.rs index fda7d7f9..da87de37 100644 --- a/token-handler/wasm/src/lib.rs +++ b/token-handler/wasm/src/lib.rs @@ -21,7 +21,7 @@ multiversx_sc_wasm_adapter::endpoints! { ( init => init upgrade => upgrade - mintTokens => mint_tokens + transferTokens => transfer_tokens burnTokens => burn_tokens_endpoint setMaxTxBatchSize => set_max_tx_batch_size setMaxTxBatchBlockDuration => set_max_tx_batch_block_duration From 652991817566eac5ed0d39b2874d2dbe18b0b99b Mon Sep 17 00:00:00 2001 From: Andrei Baltariu Date: Fri, 26 Jul 2024 11:20:52 +0300 Subject: [PATCH 196/523] Used new endpoint name and removed unnecessary one Signed-off-by: Andrei Baltariu --- .../src/from_sovereign/transfer_tokens.rs | 37 +------------------ 1 file changed, 1 insertion(+), 36 deletions(-) diff --git a/enshrine-esdt-safe/src/from_sovereign/transfer_tokens.rs b/enshrine-esdt-safe/src/from_sovereign/transfer_tokens.rs index d1aff64d..a97d9e3d 100644 --- a/enshrine-esdt-safe/src/from_sovereign/transfer_tokens.rs +++ b/enshrine-esdt-safe/src/from_sovereign/transfer_tokens.rs @@ -55,45 +55,10 @@ pub trait TransferTokensModule: self.tx() .to(token_handler_address) .typed(token_handler_proxy::TokenHandlerProxy) - .mint_tokens(hash_of_hashes, OperationTuple { op_hash, operation }) + .transfer_tokens(hash_of_hashes, OperationTuple { op_hash, operation }) .sync_call(); } - #[endpoint] - fn call_token_handler_mint_endpoint( - &self, - hash_of_hashes: ManagedBuffer, - operation_tuple: OperationTuple, - ) { - let token_handler_address = self.token_handler_address().get(); - - self.tx() - .to(token_handler_address) - .typed(token_handler_proxy::TokenHandlerProxy) - .mint_tokens(hash_of_hashes, operation_tuple) - .callback(::callbacks(self).save_minted_tokens()) - .async_call_and_exit(); - } - - #[promises_callback] - fn save_minted_tokens( - &self, - #[call_result] result: ManagedAsyncCallResult< - MultiValueEncoded>, - >, - ) { - match result { - ManagedAsyncCallResult::Ok(tokens) => { - for token in tokens { - self.minted_tokens().push(&token); - } - } - ManagedAsyncCallResult::Err(_) => { - sc_panic!("Error at minting tokens"); - } - } - } - #[endpoint(registerNewTokenID)] #[payable("*")] fn register_new_token_id(&self, tokens: MultiValueEncoded) { From 984238b82c80241db4cfaf892b0882ce01d58590 Mon Sep 17 00:00:00 2001 From: Andrei Baltariu Date: Fri, 26 Jul 2024 12:51:55 +0300 Subject: [PATCH 197/523] Added deposit event back to enshrine Signed-off-by: Andrei Baltariu --- .../src/from_sovereign/transfer_tokens.rs | 22 ++++++++++++------- token-handler/src/mint_tokens.rs | 19 ++++++---------- 2 files changed, 21 insertions(+), 20 deletions(-) diff --git a/enshrine-esdt-safe/src/from_sovereign/transfer_tokens.rs b/enshrine-esdt-safe/src/from_sovereign/transfer_tokens.rs index a97d9e3d..1868efdc 100644 --- a/enshrine-esdt-safe/src/from_sovereign/transfer_tokens.rs +++ b/enshrine-esdt-safe/src/from_sovereign/transfer_tokens.rs @@ -28,15 +28,13 @@ pub trait TransferTokensModule: require!(self.not_paused(), "Cannot transfer while paused"); - let (op_hash, is_registered) = - self.calculate_operation_hash(hash_of_hashes.clone(), operation.clone()); + let (op_hash, is_registered) = self.calculate_operation_hash(&hash_of_hashes, &operation); if !is_registered { sc_panic!("Operation is not registered"); } - let are_tokens_registered = - self.verify_operation_tokens_issue_paid(operation.tokens.clone()); + let are_tokens_registered = self.verify_operation_tokens_issue_paid(&operation.tokens); if !are_tokens_registered { self.emit_transfer_failed_events( @@ -55,8 +53,16 @@ pub trait TransferTokensModule: self.tx() .to(token_handler_address) .typed(token_handler_proxy::TokenHandlerProxy) - .transfer_tokens(hash_of_hashes, OperationTuple { op_hash, operation }) + .transfer_tokens( + hash_of_hashes.clone(), + OperationTuple { + op_hash: op_hash.clone(), + operation, + }, + ) .sync_call(); + + self.execute_bridge_operation_event(hash_of_hashes, op_hash); } #[endpoint(registerNewTokenID)] @@ -82,7 +88,7 @@ pub trait TransferTokensModule: fn verify_operation_tokens_issue_paid( &self, - tokens: ManagedVec>, + tokens: &ManagedVec>, ) -> bool { let sov_prefix = self.get_sovereign_prefix(); @@ -127,8 +133,8 @@ pub trait TransferTokensModule: // use pending_operations as param fn calculate_operation_hash( &self, - hash_of_hashes: ManagedBuffer, - operation: Operation, + hash_of_hashes: &ManagedBuffer, + operation: &Operation, ) -> (ManagedBuffer, bool) { let mut serialized_data = ManagedBuffer::new(); let mut storage_key = StorageKey::from("pending_hashes"); diff --git a/token-handler/src/mint_tokens.rs b/token-handler/src/mint_tokens.rs index 901b6d7c..812ab16a 100644 --- a/token-handler/src/mint_tokens.rs +++ b/token-handler/src/mint_tokens.rs @@ -177,24 +177,19 @@ pub trait TransferTokensModule: ) { match result { ManagedAsyncCallResult::Ok(_) => { - self.execute_bridge_operation_event( - hash_of_hashes.clone(), - operation_tuple.op_hash.clone(), - ); + let header_verifier_address = self.header_verifier_address().get(); + + self.tx() + .to(header_verifier_address) + .typed(header_verifier_proxy::HeaderverifierProxy) + .remove_executed_hash(hash_of_hashes, &operation_tuple.op_hash) + .sync_call(); } ManagedAsyncCallResult::Err(_) => { self.burn_tokens(&operation_tuple.operation); self.emit_transfer_failed_events(hash_of_hashes, operation_tuple); } } - - let header_verifier_address = self.header_verifier_address().get(); - - self.tx() - .to(header_verifier_address) - .typed(header_verifier_proxy::HeaderverifierProxy) - .remove_executed_hash(hash_of_hashes, &operation_tuple.op_hash) - .sync_call(); } fn get_contract_call_args( From ddc375072866abab5a747ad68df89d88c4f7b63e Mon Sep 17 00:00:00 2001 From: Andrei Baltariu Date: Fri, 26 Jul 2024 12:53:58 +0300 Subject: [PATCH 198/523] Regenerated proxy Signed-off-by: Andrei Baltariu --- .../src/enshrine_esdt_safe_proxy.rs | 16 ---------------- .../wasm-enshrine-esdt-safe-full/src/lib.rs | 7 ++----- enshrine-esdt-safe/wasm/src/lib.rs | 7 ++----- 3 files changed, 4 insertions(+), 26 deletions(-) diff --git a/enshrine-esdt-safe/src/enshrine_esdt_safe_proxy.rs b/enshrine-esdt-safe/src/enshrine_esdt_safe_proxy.rs index e2acf342..cb57fb68 100644 --- a/enshrine-esdt-safe/src/enshrine_esdt_safe_proxy.rs +++ b/enshrine-esdt-safe/src/enshrine_esdt_safe_proxy.rs @@ -190,22 +190,6 @@ where .original_result() } - pub fn call_token_handler_mint_endpoint< - Arg0: ProxyArg>, - Arg1: ProxyArg>, - >( - self, - hash_of_hashes: Arg0, - operation_tuple: Arg1, - ) -> TxTypedCall { - self.wrapped_tx - .payment(NotPayable) - .raw_call("call_token_handler_mint_endpoint") - .argument(&hash_of_hashes) - .argument(&operation_tuple) - .original_result() - } - pub fn register_new_token_id< Arg0: ProxyArg>>, >( diff --git a/enshrine-esdt-safe/wasm-enshrine-esdt-safe-full/src/lib.rs b/enshrine-esdt-safe/wasm-enshrine-esdt-safe-full/src/lib.rs index ece84b89..04d8d191 100644 --- a/enshrine-esdt-safe/wasm-enshrine-esdt-safe-full/src/lib.rs +++ b/enshrine-esdt-safe/wasm-enshrine-esdt-safe-full/src/lib.rs @@ -6,10 +6,9 @@ // Init: 1 // Upgrade: 1 -// Endpoints: 29 +// Endpoints: 28 // Async Callback: 1 -// Promise callbacks: 1 -// Total number of exported functions: 33 +// Total number of exported functions: 31 #![no_std] @@ -28,7 +27,6 @@ multiversx_sc_wasm_adapter::endpoints! { addSigners => add_signers removeSigners => remove_signers executeBridgeOps => execute_operations - call_token_handler_mint_endpoint => call_token_handler_mint_endpoint registerNewTokenID => register_new_token_id setMaxTxBatchSize => set_max_tx_batch_size setMaxTxBatchBlockDuration => set_max_tx_batch_block_duration @@ -50,7 +48,6 @@ multiversx_sc_wasm_adapter::endpoints! { pause => pause_endpoint unpause => unpause_endpoint isPaused => paused_status - save_minted_tokens => save_minted_tokens ) } diff --git a/enshrine-esdt-safe/wasm/src/lib.rs b/enshrine-esdt-safe/wasm/src/lib.rs index ece84b89..04d8d191 100644 --- a/enshrine-esdt-safe/wasm/src/lib.rs +++ b/enshrine-esdt-safe/wasm/src/lib.rs @@ -6,10 +6,9 @@ // Init: 1 // Upgrade: 1 -// Endpoints: 29 +// Endpoints: 28 // Async Callback: 1 -// Promise callbacks: 1 -// Total number of exported functions: 33 +// Total number of exported functions: 31 #![no_std] @@ -28,7 +27,6 @@ multiversx_sc_wasm_adapter::endpoints! { addSigners => add_signers removeSigners => remove_signers executeBridgeOps => execute_operations - call_token_handler_mint_endpoint => call_token_handler_mint_endpoint registerNewTokenID => register_new_token_id setMaxTxBatchSize => set_max_tx_batch_size setMaxTxBatchBlockDuration => set_max_tx_batch_block_duration @@ -50,7 +48,6 @@ multiversx_sc_wasm_adapter::endpoints! { pause => pause_endpoint unpause => unpause_endpoint isPaused => paused_status - save_minted_tokens => save_minted_tokens ) } From f1f98607589d2d3a3065210222d6d12613dda458 Mon Sep 17 00:00:00 2001 From: Andrei Baltariu Date: Fri, 26 Jul 2024 14:49:55 +0300 Subject: [PATCH 199/523] Moved remove executed hash logic to enshrine + clippy fixes Signed-off-by: Andrei Baltariu --- .../src/from_sovereign/transfer_tokens.rs | 12 ++++++++++++ enshrine-esdt-safe/src/token_handler_proxy.rs | 7 ++----- token-handler/src/burn_tokens.rs | 2 +- token-handler/src/common/storage.rs | 3 --- token-handler/src/lib.rs | 9 +-------- token-handler/src/mint_tokens.rs | 17 ++++------------- token-handler/src/token_handler_proxy.rs | 7 ++----- 7 files changed, 22 insertions(+), 35 deletions(-) diff --git a/enshrine-esdt-safe/src/from_sovereign/transfer_tokens.rs b/enshrine-esdt-safe/src/from_sovereign/transfer_tokens.rs index 1868efdc..feac20f6 100644 --- a/enshrine-esdt-safe/src/from_sovereign/transfer_tokens.rs +++ b/enshrine-esdt-safe/src/from_sovereign/transfer_tokens.rs @@ -1,4 +1,5 @@ use crate::{common, to_sovereign, token_handler_proxy}; +use header_verifier::header_verifier_proxy; use multiversx_sc::imports::*; use multiversx_sc::storage::StorageKey; use transaction::{Operation, OperationData, OperationEsdtPayment, OperationTuple}; @@ -62,6 +63,7 @@ pub trait TransferTokensModule: ) .sync_call(); + self.remove_executed_hash(&hash_of_hashes, &op_hash); self.execute_bridge_operation_event(hash_of_hashes, op_hash); } @@ -105,6 +107,16 @@ pub trait TransferTokensModule: true } + fn remove_executed_hash(&self, hash_of_hashes: &ManagedBuffer, op_hash: &ManagedBuffer) { + let header_verifier_address = self.header_verifier_address().get(); + + self.tx() + .to(header_verifier_address) + .typed(header_verifier_proxy::HeaderverifierProxy) + .remove_executed_hash(hash_of_hashes, op_hash) + .sync_call(); + } + fn emit_transfer_failed_events( &self, hash_of_hashes: &ManagedBuffer, diff --git a/enshrine-esdt-safe/src/token_handler_proxy.rs b/enshrine-esdt-safe/src/token_handler_proxy.rs index 1f8fc52a..2fa9a001 100644 --- a/enshrine-esdt-safe/src/token_handler_proxy.rs +++ b/enshrine-esdt-safe/src/token_handler_proxy.rs @@ -44,17 +44,14 @@ where Gas: TxGas, { pub fn init< - Arg0: ProxyArg>, - Arg1: ProxyArg>, + Arg0: ProxyArg>, >( self, - header_verifier_address: Arg0, - chain_prefix: Arg1, + chain_prefix: Arg0, ) -> TxTypedDeploy { self.wrapped_tx .payment(NotPayable) .raw_deploy() - .argument(&header_verifier_address) .argument(&chain_prefix) .original_result() } diff --git a/token-handler/src/burn_tokens.rs b/token-handler/src/burn_tokens.rs index 026b62af..d43292e9 100644 --- a/token-handler/src/burn_tokens.rs +++ b/token-handler/src/burn_tokens.rs @@ -14,7 +14,7 @@ pub trait BurnTokensModule: utils::UtilsModule + common::storage::CommonStorage #[endpoint(burnTokens)] fn burn_tokens_endpoint(&self, operation: Operation) { require!( - operation.tokens.len() > 0, + !operation.tokens.is_empty(), "Operation tokens array is empty" ); diff --git a/token-handler/src/common/storage.rs b/token-handler/src/common/storage.rs index 46ab6d16..ce708adb 100644 --- a/token-handler/src/common/storage.rs +++ b/token-handler/src/common/storage.rs @@ -4,7 +4,4 @@ use multiversx_sc::imports::SingleValueMapper; pub trait CommonStorage { #[storage_mapper] fn sov_prefix(&self) -> SingleValueMapper; - - #[storage_mapper] - fn header_verifier_address(&self) -> SingleValueMapper; } diff --git a/token-handler/src/lib.rs b/token-handler/src/lib.rs index 11a7820e..0c708ad8 100644 --- a/token-handler/src/lib.rs +++ b/token-handler/src/lib.rs @@ -18,14 +18,7 @@ pub trait TokenHandler: + common::events::EventsModule { #[init] - fn init(&self, header_verifier_address: ManagedAddress, chain_prefix: ManagedBuffer) { - require!( - self.blockchain() - .is_smart_contract(&header_verifier_address), - "Header Verifier address is not a SC contract address" - ); - - self.header_verifier_address().set(header_verifier_address); + fn init(&self, chain_prefix: ManagedBuffer) { self.sov_prefix().set(chain_prefix); } diff --git a/token-handler/src/mint_tokens.rs b/token-handler/src/mint_tokens.rs index 812ab16a..8c257e95 100644 --- a/token-handler/src/mint_tokens.rs +++ b/token-handler/src/mint_tokens.rs @@ -1,4 +1,3 @@ -use header_verifier::header_verifier_proxy; use multiversx_sc::api::{ESDT_MULTI_TRANSFER_FUNC_NAME, ESDT_NFT_CREATE_FUNC_NAME}; use multiversx_sc::imports::IgnoreValue; use multiversx_sc::types::{ @@ -91,7 +90,7 @@ pub trait TransferTokensModule: let mut arg_buffer = ManagedArgBuffer::new(); let cloned_token_data = token_data.clone(); - arg_buffer.push_arg(&token_identifier); + arg_buffer.push_arg(token_identifier); arg_buffer.push_arg(cloned_token_data.amount); arg_buffer.push_arg(cloned_token_data.name); arg_buffer.push_arg(cloned_token_data.royalties); @@ -144,7 +143,7 @@ pub trait TransferTokensModule: .gas(transfer_data.gas_limit) .callback( ::callbacks(self) - .execute(&hash_of_hashes, &operation_tuple), + .execute(hash_of_hashes, operation_tuple), ) .gas_for_callback(CALLBACK_GAS) .register_promise(); @@ -161,7 +160,7 @@ pub trait TransferTokensModule: .gas(TRANSACTION_GAS) .callback( ::callbacks(self) - .execute(&hash_of_hashes, &operation_tuple), + .execute(hash_of_hashes, operation_tuple), ) .register_promise(); } @@ -176,15 +175,7 @@ pub trait TransferTokensModule: #[call_result] result: ManagedAsyncCallResult, ) { match result { - ManagedAsyncCallResult::Ok(_) => { - let header_verifier_address = self.header_verifier_address().get(); - - self.tx() - .to(header_verifier_address) - .typed(header_verifier_proxy::HeaderverifierProxy) - .remove_executed_hash(hash_of_hashes, &operation_tuple.op_hash) - .sync_call(); - } + ManagedAsyncCallResult::Ok(_) => {} ManagedAsyncCallResult::Err(_) => { self.burn_tokens(&operation_tuple.operation); self.emit_transfer_failed_events(hash_of_hashes, operation_tuple); diff --git a/token-handler/src/token_handler_proxy.rs b/token-handler/src/token_handler_proxy.rs index 1f8fc52a..2fa9a001 100644 --- a/token-handler/src/token_handler_proxy.rs +++ b/token-handler/src/token_handler_proxy.rs @@ -44,17 +44,14 @@ where Gas: TxGas, { pub fn init< - Arg0: ProxyArg>, - Arg1: ProxyArg>, + Arg0: ProxyArg>, >( self, - header_verifier_address: Arg0, - chain_prefix: Arg1, + chain_prefix: Arg0, ) -> TxTypedDeploy { self.wrapped_tx .payment(NotPayable) .raw_deploy() - .argument(&header_verifier_address) .argument(&chain_prefix) .original_result() } From e4f4af74ccd910ddaac42508a107a2b4d34e423e Mon Sep 17 00:00:00 2001 From: Andrei Baltariu Date: Fri, 26 Jul 2024 15:04:00 +0300 Subject: [PATCH 200/523] Modified whitelisting enshrine esdt Signed-off-by: Andrei Baltariu --- enshrine-esdt-safe/src/token_handler_proxy.rs | 10 +++++----- token-handler/src/lib.rs | 20 +++++-------------- token-handler/src/token_handler_proxy.rs | 10 +++++----- .../wasm-token-handler-full/src/lib.rs | 2 +- token-handler/wasm/src/lib.rs | 2 +- 5 files changed, 17 insertions(+), 27 deletions(-) diff --git a/enshrine-esdt-safe/src/token_handler_proxy.rs b/enshrine-esdt-safe/src/token_handler_proxy.rs index acf15410..88dc1807 100644 --- a/enshrine-esdt-safe/src/token_handler_proxy.rs +++ b/enshrine-esdt-safe/src/token_handler_proxy.rs @@ -85,16 +85,16 @@ where To: TxTo, Gas: TxGas, { - pub fn set_enshrine_esdt_whitelist< - Arg0: ProxyArg>>, + pub fn whitelist_enshrine_esdt< + Arg0: ProxyArg>, >( self, - enshrine_esdt_addresses: Arg0, + enshrine_esdt_address: Arg0, ) -> TxTypedCall { self.wrapped_tx .payment(NotPayable) - .raw_call("setEnshrineEsdtWhitelist") - .argument(&enshrine_esdt_addresses) + .raw_call("whitelistEnshrineEsdt") + .argument(&enshrine_esdt_address) .original_result() } diff --git a/token-handler/src/lib.rs b/token-handler/src/lib.rs index 9c367eea..98bab3f8 100644 --- a/token-handler/src/lib.rs +++ b/token-handler/src/lib.rs @@ -25,23 +25,13 @@ pub trait TokenHandler: fn upgrade(&self) {} #[only_owner] - #[endpoint(setEnshrineEsdtWhitelist)] - fn set_enshrine_esdt_whitelist( - &self, - enshrine_esdt_addresses: MultiValueEncoded>, - ) { + #[endpoint(whitelistEnshrineEsdt)] + fn whitelist_enshrine_esdt(&self, enshrine_esdt_address: ManagedAddress) { require!( - !enshrine_esdt_addresses.is_empty(), - "There are no addresses sent to be registered" + self.blockchain().is_smart_contract(&enshrine_esdt_address), + "Address passed to be registered is not a valid smart contract address" ); - for esdt_address in enshrine_esdt_addresses.into_iter() { - require!( - self.blockchain().is_smart_contract(&esdt_address), - "One of the addresses passed is not a valid smart contract address" - ); - - self.enshrine_esdt_whitelist().insert(esdt_address); - } + self.enshrine_esdt_whitelist().insert(enshrine_esdt_address); } } diff --git a/token-handler/src/token_handler_proxy.rs b/token-handler/src/token_handler_proxy.rs index acf15410..88dc1807 100644 --- a/token-handler/src/token_handler_proxy.rs +++ b/token-handler/src/token_handler_proxy.rs @@ -85,16 +85,16 @@ where To: TxTo, Gas: TxGas, { - pub fn set_enshrine_esdt_whitelist< - Arg0: ProxyArg>>, + pub fn whitelist_enshrine_esdt< + Arg0: ProxyArg>, >( self, - enshrine_esdt_addresses: Arg0, + enshrine_esdt_address: Arg0, ) -> TxTypedCall { self.wrapped_tx .payment(NotPayable) - .raw_call("setEnshrineEsdtWhitelist") - .argument(&enshrine_esdt_addresses) + .raw_call("whitelistEnshrineEsdt") + .argument(&enshrine_esdt_address) .original_result() } diff --git a/token-handler/wasm-token-handler-full/src/lib.rs b/token-handler/wasm-token-handler-full/src/lib.rs index d8344d4d..45c3b217 100644 --- a/token-handler/wasm-token-handler-full/src/lib.rs +++ b/token-handler/wasm-token-handler-full/src/lib.rs @@ -20,7 +20,7 @@ multiversx_sc_wasm_adapter::endpoints! { ( init => init upgrade => upgrade - setEnshrineEsdtWhitelist => set_enshrine_esdt_whitelist + whitelistEnshrineEsdt => whitelist_enshrine_esdt mintTokens => mint_tokens burnTokens => burn_tokens ) diff --git a/token-handler/wasm/src/lib.rs b/token-handler/wasm/src/lib.rs index d8344d4d..45c3b217 100644 --- a/token-handler/wasm/src/lib.rs +++ b/token-handler/wasm/src/lib.rs @@ -20,7 +20,7 @@ multiversx_sc_wasm_adapter::endpoints! { ( init => init upgrade => upgrade - setEnshrineEsdtWhitelist => set_enshrine_esdt_whitelist + whitelistEnshrineEsdt => whitelist_enshrine_esdt mintTokens => mint_tokens burnTokens => burn_tokens ) From 4ef8a04d18c8c01b3c7b9a75c724c38c5a471db2 Mon Sep 17 00:00:00 2001 From: Andrei Baltariu Date: Sat, 27 Jul 2024 14:32:49 +0300 Subject: [PATCH 201/523] Modified transfer tokens and token handler endpoint call Signed-off-by: Andrei Baltariu --- .../src/from_sovereign/transfer_tokens.rs | 37 +++++++---- enshrine-esdt-safe/src/token_handler_proxy.rs | 18 +++--- token-handler/src/mint_tokens.rs | 64 ++++++------------- token-handler/src/token_handler_proxy.rs | 18 +++--- .../wasm-token-handler-full/src/lib.rs | 4 +- token-handler/wasm/src/lib.rs | 4 +- 6 files changed, 65 insertions(+), 80 deletions(-) diff --git a/enshrine-esdt-safe/src/from_sovereign/transfer_tokens.rs b/enshrine-esdt-safe/src/from_sovereign/transfer_tokens.rs index feac20f6..bfc06c46 100644 --- a/enshrine-esdt-safe/src/from_sovereign/transfer_tokens.rs +++ b/enshrine-esdt-safe/src/from_sovereign/transfer_tokens.rs @@ -35,32 +35,31 @@ pub trait TransferTokensModule: sc_panic!("Operation is not registered"); } - let are_tokens_registered = self.verify_operation_tokens_issue_paid(&operation.tokens); + let (sov_tokens, non_sov_tokens, are_tokens_registered) = + self.split_payments_for_prefix_and_fee(&operation.tokens); if !are_tokens_registered { self.emit_transfer_failed_events( &hash_of_hashes, - &OperationTuple { - op_hash: op_hash.clone(), - operation: operation.clone(), - }, + &OperationTuple { op_hash, operation }, ); return; } let token_handler_address = self.token_handler_address().get(); + let multi_value_tokens: MultiValueEncoded> = + non_sov_tokens.into(); self.tx() .to(token_handler_address) .typed(token_handler_proxy::TokenHandlerProxy) .transfer_tokens( - hash_of_hashes.clone(), - OperationTuple { - op_hash: op_hash.clone(), - operation, - }, + operation.data.opt_transfer_data, + operation.to, + multi_value_tokens, ) + .multi_esdt(sov_tokens) .sync_call(); self.remove_executed_hash(&hash_of_hashes, &op_hash); @@ -88,23 +87,33 @@ pub trait TransferTokensModule: } } - fn verify_operation_tokens_issue_paid( + fn split_payments_for_prefix_and_fee( &self, tokens: &ManagedVec>, - ) -> bool { + ) -> ( + ManagedVec>, + ManagedVec>, + bool, + ) { let sov_prefix = self.get_sovereign_prefix(); + let mut sov_tokens: ManagedVec> = ManagedVec::new(); + let mut non_sov_tokens: ManagedVec> = + ManagedVec::new(); for token in tokens.iter() { if !self.has_sov_prefix(&token.token_identifier, &sov_prefix) { + non_sov_tokens.push(token); continue; } if !self.paid_issued_tokens().contains(&token.token_identifier) { - return false; + return (ManagedVec::new(), ManagedVec::new(), false); } + + sov_tokens.push(token.into()); } - true + (sov_tokens, non_sov_tokens, true) } fn remove_executed_hash(&self, hash_of_hashes: &ManagedBuffer, op_hash: &ManagedBuffer) { diff --git a/enshrine-esdt-safe/src/token_handler_proxy.rs b/enshrine-esdt-safe/src/token_handler_proxy.rs index 2fa9a001..55d5ec54 100644 --- a/enshrine-esdt-safe/src/token_handler_proxy.rs +++ b/enshrine-esdt-safe/src/token_handler_proxy.rs @@ -86,18 +86,20 @@ where Gas: TxGas, { pub fn transfer_tokens< - Arg0: ProxyArg>, - Arg1: ProxyArg>, + Arg0: ProxyArg>>, + Arg1: ProxyArg>, + Arg2: ProxyArg>>, >( self, - hash_of_hashes: Arg0, - operation_tuple: Arg1, - ) -> TxTypedCall { + opt_transfer_data: Arg0, + to: Arg1, + tokens: Arg2, + ) -> TxTypedCall { self.wrapped_tx - .payment(NotPayable) .raw_call("transferTokens") - .argument(&hash_of_hashes) - .argument(&operation_tuple) + .argument(&opt_transfer_data) + .argument(&to) + .argument(&tokens) .original_result() } diff --git a/token-handler/src/mint_tokens.rs b/token-handler/src/mint_tokens.rs index 8c257e95..6433531a 100644 --- a/token-handler/src/mint_tokens.rs +++ b/token-handler/src/mint_tokens.rs @@ -1,12 +1,14 @@ use multiversx_sc::api::{ESDT_MULTI_TRANSFER_FUNC_NAME, ESDT_NFT_CREATE_FUNC_NAME}; use multiversx_sc::imports::IgnoreValue; use multiversx_sc::types::{ - system_proxy, EsdtTokenPayment, ManagedArgBuffer, ManagedAsyncCallResult, ToSelf, + system_proxy, EsdtTokenPayment, ManagedArgBuffer, ManagedAsyncCallResult, MultiValueEncoded, + ToSelf, }; use multiversx_sc::types::{ManagedVec, TokenIdentifier}; use multiversx_sc::{codec, err_msg}; use transaction::{ - GasLimit, OperationData, OperationEsdtPayment, OperationTuple, StolenFromFrameworkEsdtTokenData, + GasLimit, OperationData, OperationEsdtPayment, OperationTuple, + StolenFromFrameworkEsdtTokenData, TransferData, }; const CALLBACK_GAS: GasLimit = 10_000_000; // Increase if not enough @@ -22,16 +24,19 @@ pub trait TransferTokensModule: + burn_tokens::BurnTokensModule + tx_batch_module::TxBatchModule { + #[payable("*")] #[endpoint(transferTokens)] fn transfer_tokens( &self, - hash_of_hashes: ManagedBuffer, - operation_tuple: OperationTuple, + opt_transfer_data: Option>, + to: ManagedAddress, + tokens: MultiValueEncoded>, ) { let mut output_payments: ManagedVec> = ManagedVec::new(); - for operation_token in operation_tuple.operation.tokens.iter() { + // TODO: Check if you can remove the clone here + for operation_token in tokens.clone() { let sov_prefix = self.sov_prefix().get(); if !self.has_sov_prefix(&operation_token.token_identifier, &sov_prefix) { @@ -78,7 +83,7 @@ pub trait TransferTokensModule: }); } - self.distribute_payments(&hash_of_hashes, &operation_tuple); + self.distribute_payments(&tokens.to_vec(), &opt_transfer_data, &to); } fn get_nft_create_args( @@ -118,17 +123,14 @@ pub trait TransferTokensModule: fn distribute_payments( &self, - hash_of_hashes: &ManagedBuffer, - operation_tuple: &OperationTuple, + tokens: &ManagedVec>, + opt_transfer_data: &Option>, + to: &ManagedAddress, ) { - let mapped_tokens: ManagedVec> = operation_tuple - .operation - .tokens - .iter() - .map(|token| token.into()) - .collect(); - - match &operation_tuple.operation.data.opt_transfer_data { + let mapped_tokens: ManagedVec> = + tokens.iter().map(|token| token.into()).collect(); + + match &opt_transfer_data { Some(transfer_data) => { let mut args = ManagedArgBuffer::new(); for arg in &transfer_data.args { @@ -136,53 +138,27 @@ pub trait TransferTokensModule: } self.tx() - .to(&operation_tuple.operation.to) + .to(to) .raw_call(transfer_data.function.clone()) .arguments_raw(args.clone()) .multi_esdt(mapped_tokens.clone()) .gas(transfer_data.gas_limit) - .callback( - ::callbacks(self) - .execute(hash_of_hashes, operation_tuple), - ) - .gas_for_callback(CALLBACK_GAS) .register_promise(); } None => { let own_address = self.blockchain().get_sc_address(); - let args = - self.get_contract_call_args(&operation_tuple.operation.to, &mapped_tokens); + let args = self.get_contract_call_args(&to, &mapped_tokens); self.tx() .to(own_address) .raw_call(ESDT_MULTI_TRANSFER_FUNC_NAME) .arguments_raw(args) .gas(TRANSACTION_GAS) - .callback( - ::callbacks(self) - .execute(hash_of_hashes, operation_tuple), - ) .register_promise(); } } } - #[promises_callback] - fn execute( - &self, - hash_of_hashes: &ManagedBuffer, - operation_tuple: &OperationTuple, - #[call_result] result: ManagedAsyncCallResult, - ) { - match result { - ManagedAsyncCallResult::Ok(_) => {} - ManagedAsyncCallResult::Err(_) => { - self.burn_tokens(&operation_tuple.operation); - self.emit_transfer_failed_events(hash_of_hashes, operation_tuple); - } - } - } - fn get_contract_call_args( self, to: &ManagedAddress, diff --git a/token-handler/src/token_handler_proxy.rs b/token-handler/src/token_handler_proxy.rs index 2fa9a001..55d5ec54 100644 --- a/token-handler/src/token_handler_proxy.rs +++ b/token-handler/src/token_handler_proxy.rs @@ -86,18 +86,20 @@ where Gas: TxGas, { pub fn transfer_tokens< - Arg0: ProxyArg>, - Arg1: ProxyArg>, + Arg0: ProxyArg>>, + Arg1: ProxyArg>, + Arg2: ProxyArg>>, >( self, - hash_of_hashes: Arg0, - operation_tuple: Arg1, - ) -> TxTypedCall { + opt_transfer_data: Arg0, + to: Arg1, + tokens: Arg2, + ) -> TxTypedCall { self.wrapped_tx - .payment(NotPayable) .raw_call("transferTokens") - .argument(&hash_of_hashes) - .argument(&operation_tuple) + .argument(&opt_transfer_data) + .argument(&to) + .argument(&tokens) .original_result() } diff --git a/token-handler/wasm-token-handler-full/src/lib.rs b/token-handler/wasm-token-handler-full/src/lib.rs index da87de37..17cff7e3 100644 --- a/token-handler/wasm-token-handler-full/src/lib.rs +++ b/token-handler/wasm-token-handler-full/src/lib.rs @@ -8,8 +8,7 @@ // Upgrade: 1 // Endpoints: 10 // Async Callback (empty): 1 -// Promise callbacks: 1 -// Total number of exported functions: 14 +// Total number of exported functions: 13 #![no_std] @@ -31,7 +30,6 @@ multiversx_sc_wasm_adapter::endpoints! { getBatchStatus => get_batch_status getFirstBatchId => first_batch_id getLastBatchId => last_batch_id - execute => execute ) } diff --git a/token-handler/wasm/src/lib.rs b/token-handler/wasm/src/lib.rs index da87de37..17cff7e3 100644 --- a/token-handler/wasm/src/lib.rs +++ b/token-handler/wasm/src/lib.rs @@ -8,8 +8,7 @@ // Upgrade: 1 // Endpoints: 10 // Async Callback (empty): 1 -// Promise callbacks: 1 -// Total number of exported functions: 14 +// Total number of exported functions: 13 #![no_std] @@ -31,7 +30,6 @@ multiversx_sc_wasm_adapter::endpoints! { getBatchStatus => get_batch_status getFirstBatchId => first_batch_id getLastBatchId => last_batch_id - execute => execute ) } From dd8ca00dfc3c77ea0fb44b852574fba6d0662ff4 Mon Sep 17 00:00:00 2001 From: Andrei Baltariu Date: Sat, 27 Jul 2024 14:38:22 +0300 Subject: [PATCH 202/523] Added function to call esdt nft create function Signed-off-by: Andrei Baltariu --- token-handler/src/mint_tokens.rs | 25 ++++++++++++++----------- 1 file changed, 14 insertions(+), 11 deletions(-) diff --git a/token-handler/src/mint_tokens.rs b/token-handler/src/mint_tokens.rs index 6433531a..8307a815 100644 --- a/token-handler/src/mint_tokens.rs +++ b/token-handler/src/mint_tokens.rs @@ -63,17 +63,7 @@ pub trait TransferTokensModule: &operation_token.token_data, ); - let output = self.send_raw().call_local_esdt_built_in_function( - self.blockchain().get_gas_left(), - &ManagedBuffer::from(ESDT_NFT_CREATE_FUNC_NAME), - &arg_buffer, - ); - - if let Some(first_result_bytes) = output.try_get(0) { - nonce = first_result_bytes.parse_as_u64().unwrap_or_default() - } else { - nonce = 0 - } + nonce = self.call_nft_create_built_in_function(&arg_buffer); } output_payments.push(OperationEsdtPayment { @@ -86,6 +76,19 @@ pub trait TransferTokensModule: self.distribute_payments(&tokens.to_vec(), &opt_transfer_data, &to); } + fn call_nft_create_built_in_function(&self, arg_buffer: &ManagedArgBuffer) -> u64 { + let output = self.send_raw().call_local_esdt_built_in_function( + self.blockchain().get_gas_left(), + &ManagedBuffer::from(ESDT_NFT_CREATE_FUNC_NAME), + &arg_buffer, + ); + + if let Some(first_result_bytes) = output.try_get(0) { + first_result_bytes.parse_as_u64().unwrap_or_default() + } else { + 0 + } + } fn get_nft_create_args( &self, token_identifier: &TokenIdentifier, From 4b93c7b52e9acaf6563b7f950b8d9f34cac730fb Mon Sep 17 00:00:00 2001 From: Andrei Baltariu Date: Sat, 27 Jul 2024 14:44:17 +0300 Subject: [PATCH 203/523] Clippy fixes Signed-off-by: Andrei Baltariu --- token-handler/src/mint_tokens.rs | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/token-handler/src/mint_tokens.rs b/token-handler/src/mint_tokens.rs index 8307a815..3ac6eaa0 100644 --- a/token-handler/src/mint_tokens.rs +++ b/token-handler/src/mint_tokens.rs @@ -1,8 +1,6 @@ use multiversx_sc::api::{ESDT_MULTI_TRANSFER_FUNC_NAME, ESDT_NFT_CREATE_FUNC_NAME}; -use multiversx_sc::imports::IgnoreValue; use multiversx_sc::types::{ - system_proxy, EsdtTokenPayment, ManagedArgBuffer, ManagedAsyncCallResult, MultiValueEncoded, - ToSelf, + system_proxy, EsdtTokenPayment, ManagedArgBuffer, MultiValueEncoded, ToSelf, }; use multiversx_sc::types::{ManagedVec, TokenIdentifier}; use multiversx_sc::{codec, err_msg}; @@ -11,7 +9,6 @@ use transaction::{ StolenFromFrameworkEsdtTokenData, TransferData, }; -const CALLBACK_GAS: GasLimit = 10_000_000; // Increase if not enough const TRANSACTION_GAS: GasLimit = 30_000_000; use crate::{burn_tokens, common}; @@ -80,7 +77,7 @@ pub trait TransferTokensModule: let output = self.send_raw().call_local_esdt_built_in_function( self.blockchain().get_gas_left(), &ManagedBuffer::from(ESDT_NFT_CREATE_FUNC_NAME), - &arg_buffer, + arg_buffer, ); if let Some(first_result_bytes) = output.try_get(0) { @@ -89,6 +86,7 @@ pub trait TransferTokensModule: 0 } } + fn get_nft_create_args( &self, token_identifier: &TokenIdentifier, @@ -150,7 +148,7 @@ pub trait TransferTokensModule: } None => { let own_address = self.blockchain().get_sc_address(); - let args = self.get_contract_call_args(&to, &mapped_tokens); + let args = self.get_contract_call_args(to, &mapped_tokens); self.tx() .to(own_address) From 6cb366a41cf61cd2b7e7217915ca27ccece305b7 Mon Sep 17 00:00:00 2001 From: Andrei Baltariu Date: Sat, 27 Jul 2024 15:45:12 +0300 Subject: [PATCH 204/523] Removed clone() Signed-off-by: Andrei Baltariu --- token-handler/src/mint_tokens.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/token-handler/src/mint_tokens.rs b/token-handler/src/mint_tokens.rs index 3ac6eaa0..6d0162e1 100644 --- a/token-handler/src/mint_tokens.rs +++ b/token-handler/src/mint_tokens.rs @@ -31,9 +31,9 @@ pub trait TransferTokensModule: ) { let mut output_payments: ManagedVec> = ManagedVec::new(); + let tokens_vec = tokens.to_vec(); - // TODO: Check if you can remove the clone here - for operation_token in tokens.clone() { + for operation_token in tokens_vec.iter() { let sov_prefix = self.sov_prefix().get(); if !self.has_sov_prefix(&operation_token.token_identifier, &sov_prefix) { @@ -70,7 +70,7 @@ pub trait TransferTokensModule: }); } - self.distribute_payments(&tokens.to_vec(), &opt_transfer_data, &to); + self.distribute_payments(&tokens_vec, &opt_transfer_data, &to); } fn call_nft_create_built_in_function(&self, arg_buffer: &ManagedArgBuffer) -> u64 { From eca2f4e9f9d891d8d38be32edb821943a95c53b0 Mon Sep 17 00:00:00 2001 From: Andrei Baltariu Date: Mon, 29 Jul 2024 13:00:40 +0300 Subject: [PATCH 205/523] Removed unused new() function Signed-off-by: Andrei Baltariu --- common/transaction/src/lib.rs | 8 -------- 1 file changed, 8 deletions(-) diff --git a/common/transaction/src/lib.rs b/common/transaction/src/lib.rs index 93d88c41..c3b5267f 100644 --- a/common/transaction/src/lib.rs +++ b/common/transaction/src/lib.rs @@ -36,14 +36,6 @@ pub struct Operation { } impl Operation { - pub fn new( - to: ManagedAddress, - tokens: ManagedVec>, - data: OperationData, - ) -> Self { - Operation { to, tokens, data } - } - pub fn get_tokens_as_tuple_arr( &self, ) -> MultiValueEncoded, u64, EsdtTokenData>> { From b92f93cfa732bba5f6c151bc2488ca44e67f8e60 Mon Sep 17 00:00:00 2001 From: Andrei Baltariu Date: Mon, 29 Jul 2024 13:03:14 +0300 Subject: [PATCH 206/523] Created unit tests file Signed-off-by: Andrei Baltariu --- token-handler/tests/token_handler_blackbox_tests.rs | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 token-handler/tests/token_handler_blackbox_tests.rs diff --git a/token-handler/tests/token_handler_blackbox_tests.rs b/token-handler/tests/token_handler_blackbox_tests.rs new file mode 100644 index 00000000..f80dc6a9 --- /dev/null +++ b/token-handler/tests/token_handler_blackbox_tests.rs @@ -0,0 +1,7 @@ +use multiversx_sc_scenario::ScenarioWorld; + +fn world() -> ScenarioWorld { + let mut blockchain = ScenarioWorld::new(); + + blockchain +} From 74b7877256dade952df063f7f112c049bbb85f9f Mon Sep 17 00:00:00 2001 From: Andrei Baltariu Date: Mon, 29 Jul 2024 15:04:47 +0300 Subject: [PATCH 207/523] Added test file + deploy unit test Signed-off-by: Andrei Baltariu --- .../tests/token_handler_blackbox_tests.rs | 48 ++++++++++++++++++- .../tests/token_handler_scenario_go_test.rs | 10 ---- .../tests/token_handler_scenario_rs_test.rs | 13 ----- 3 files changed, 47 insertions(+), 24 deletions(-) delete mode 100644 token-handler/tests/token_handler_scenario_go_test.rs delete mode 100644 token-handler/tests/token_handler_scenario_rs_test.rs diff --git a/token-handler/tests/token_handler_blackbox_tests.rs b/token-handler/tests/token_handler_blackbox_tests.rs index f80dc6a9..4b15da14 100644 --- a/token-handler/tests/token_handler_blackbox_tests.rs +++ b/token-handler/tests/token_handler_blackbox_tests.rs @@ -1,7 +1,53 @@ -use multiversx_sc_scenario::ScenarioWorld; +use multiversx_sc::types::{ManagedBuffer, TestAddress, TestSCAddress}; +use multiversx_sc_scenario::ScenarioTxRun; +use multiversx_sc_scenario::{api::StaticApi, imports::MxscPath, ScenarioWorld}; +use token_handler::token_handler_proxy; + +const TOKEN_HANDLER_ADDRESS: TestSCAddress = TestSCAddress::new("token-handler"); +const TOKEN_HANDLER_CODE_PATH: MxscPath = MxscPath::new("output/token-handler.mxsc.json"); +const OWNER_ADDRESS: TestAddress = TestAddress::new("token-handler-owner"); + +const OWNER_BALANCE: u64 = 100_000_000; +const CHAIN_PREFIX: &str = "sov"; fn world() -> ScenarioWorld { let mut blockchain = ScenarioWorld::new(); + blockchain.register_contract(TOKEN_HANDLER_CODE_PATH, token_handler::ContractBuilder); + blockchain } + +struct TokenHandlerTestState { + world: ScenarioWorld, +} + +impl TokenHandlerTestState { + fn new() -> Self { + let mut world = world(); + + world.account(OWNER_ADDRESS).nonce(1).balance(OWNER_BALANCE); + + Self { world } + } + + fn propose_deploy(&mut self, chain_prefix: ManagedBuffer) -> &mut Self { + self.world + .tx() + .from(OWNER_ADDRESS) + .typed(token_handler_proxy::TokenHandlerProxy) + .init(chain_prefix) + .code(TOKEN_HANDLER_CODE_PATH) + .new_address(TOKEN_HANDLER_ADDRESS) + .run(); + + self + } +} + +#[test] +fn test_deploy() { + let mut state = TokenHandlerTestState::new(); + + state.propose_deploy(CHAIN_PREFIX.into()); +} diff --git a/token-handler/tests/token_handler_scenario_go_test.rs b/token-handler/tests/token_handler_scenario_go_test.rs deleted file mode 100644 index 057832d6..00000000 --- a/token-handler/tests/token_handler_scenario_go_test.rs +++ /dev/null @@ -1,10 +0,0 @@ -use multiversx_sc_scenario::*; - -fn world() -> ScenarioWorld { - ScenarioWorld::vm_go() -} - -#[test] -fn empty_go() { - world().run("scenarios/token_handler.scen.json"); -} diff --git a/token-handler/tests/token_handler_scenario_rs_test.rs b/token-handler/tests/token_handler_scenario_rs_test.rs deleted file mode 100644 index ca953346..00000000 --- a/token-handler/tests/token_handler_scenario_rs_test.rs +++ /dev/null @@ -1,13 +0,0 @@ -use multiversx_sc_scenario::*; - -fn world() -> ScenarioWorld { - let mut blockchain = ScenarioWorld::new(); - - blockchain.register_contract("mxsc:output/token-handler.mxsc.json", token_handler::ContractBuilder); - blockchain -} - -#[test] -fn empty_rs() { - world().run("scenarios/token_handler.scen.json"); -} From 5cc3cb5913d203935effe7d60326eae1f8090931 Mon Sep 17 00:00:00 2001 From: Andrei Baltariu Date: Tue, 30 Jul 2024 06:13:21 +0300 Subject: [PATCH 208/523] Added test for token transfer Signed-off-by: Andrei Baltariu --- .../tests/token_handler_blackbox_tests.rs | 95 ++++++++++++++++++- 1 file changed, 92 insertions(+), 3 deletions(-) diff --git a/token-handler/tests/token_handler_blackbox_tests.rs b/token-handler/tests/token_handler_blackbox_tests.rs index 4b15da14..584c3083 100644 --- a/token-handler/tests/token_handler_blackbox_tests.rs +++ b/token-handler/tests/token_handler_blackbox_tests.rs @@ -1,12 +1,23 @@ -use multiversx_sc::types::{ManagedBuffer, TestAddress, TestSCAddress}; -use multiversx_sc_scenario::ScenarioTxRun; +use multiversx_sc::types::{ + Address, BigUint, EsdtTokenPayment, ManagedAddress, ManagedBuffer, ManagedVec, + MultiValueEncoded, TestAddress, TestSCAddress, TestTokenIdentifier, +}; use multiversx_sc_scenario::{api::StaticApi, imports::MxscPath, ScenarioWorld}; +use multiversx_sc_scenario::{managed_address, ScenarioTxRun}; use token_handler::token_handler_proxy; +use transaction::{OperationEsdtPayment, StolenFromFrameworkEsdtTokenData, TransferData}; const TOKEN_HANDLER_ADDRESS: TestSCAddress = TestSCAddress::new("token-handler"); const TOKEN_HANDLER_CODE_PATH: MxscPath = MxscPath::new("output/token-handler.mxsc.json"); const OWNER_ADDRESS: TestAddress = TestAddress::new("token-handler-owner"); +const USER_ADDRESS: TestAddress = TestAddress::new("user"); +const NFT_TOKEN_ID: TestTokenIdentifier = TestTokenIdentifier::new("NFT-123456"); +const CROWD_TOKEN_ID: TestTokenIdentifier = TestTokenIdentifier::new("CROWD-123456"); +const FUNGIBLE_TOKEN_ID: TestTokenIdentifier = TestTokenIdentifier::new("FUNG-123456"); +const PREFIX_NFT_TOKEN_ID: TestTokenIdentifier = TestTokenIdentifier::new("sov-NFT-123456"); + +const WEGLD_BALANCE: u128 = 100_000_000_000_000_000; const OWNER_BALANCE: u64 = 100_000_000; const CHAIN_PREFIX: &str = "sov"; @@ -26,7 +37,19 @@ impl TokenHandlerTestState { fn new() -> Self { let mut world = world(); - world.account(OWNER_ADDRESS).nonce(1).balance(OWNER_BALANCE); + world + .account(OWNER_ADDRESS) + .esdt_nft_balance(NFT_TOKEN_ID, 1, 100_000, ManagedBuffer::new()) + .esdt_balance(CROWD_TOKEN_ID, 100_000) + .balance(BigUint::from(WEGLD_BALANCE)) + .nonce(1); + + world + .account(USER_ADDRESS) + .esdt_nft_balance(NFT_TOKEN_ID, 1, 100_000, ManagedBuffer::new()) + .esdt_balance(CROWD_TOKEN_ID, 100_000) + .balance(BigUint::from(WEGLD_BALANCE)) + .nonce(1); Self { world } } @@ -43,6 +66,54 @@ impl TokenHandlerTestState { self } + + fn propose_transfer_tokens( + &mut self, + esdt_payment: Option>, + opt_transfer_data: Option>, + to: ManagedAddress, + tokens: MultiValueEncoded>, + ) { + match esdt_payment { + Option::Some(payment) => self + .world + .tx() + .from(OWNER_ADDRESS) + .to(TOKEN_HANDLER_ADDRESS) + .typed(token_handler_proxy::TokenHandlerProxy) + .transfer_tokens(opt_transfer_data, to, tokens) + .esdt(payment) + .run(), + Option::None => self + .world + .tx() + .from(OWNER_ADDRESS) + .to(TOKEN_HANDLER_ADDRESS) + .typed(token_handler_proxy::TokenHandlerProxy) + .transfer_tokens(opt_transfer_data, to, tokens) + .run(), + } + } + + fn setup_payments( + &mut self, + token_ids: &Vec, + ) -> MultiValueEncoded> { + let mut tokens: MultiValueEncoded> = + MultiValueEncoded::new(); + + for token_id in token_ids { + let payment: OperationEsdtPayment = OperationEsdtPayment { + token_identifier: token_id.clone().into(), + token_nonce: 1, + token_data: StolenFromFrameworkEsdtTokenData::default(), + }; + + tokens.push(payment); + } + + tokens + } } #[test] @@ -51,3 +122,21 @@ fn test_deploy() { state.propose_deploy(CHAIN_PREFIX.into()); } + +#[test] +fn test_transfer_tokens_no_payment() { + let mut state = TokenHandlerTestState::new(); + let token_ids = [NFT_TOKEN_ID, FUNGIBLE_TOKEN_ID]; + let tokens = state.setup_payments(&token_ids.to_vec()); + let esdt_payment = Option::None; + let opt_transfer_data = Option::None; + + state.propose_deploy(CHAIN_PREFIX.into()); + + state.propose_transfer_tokens( + esdt_payment, + opt_transfer_data, + USER_ADDRESS.to_managed_address(), + tokens, + ) +} From 167a6c4aebe97ca60b108b27233af40d964fa320 Mon Sep 17 00:00:00 2001 From: Andrei Baltariu Date: Tue, 30 Jul 2024 09:05:13 +0300 Subject: [PATCH 209/523] Added balance check after token transfer Signed-off-by: Andrei Baltariu --- token-handler/tests/token_handler_blackbox_tests.rs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/token-handler/tests/token_handler_blackbox_tests.rs b/token-handler/tests/token_handler_blackbox_tests.rs index 584c3083..a1938fb0 100644 --- a/token-handler/tests/token_handler_blackbox_tests.rs +++ b/token-handler/tests/token_handler_blackbox_tests.rs @@ -138,5 +138,10 @@ fn test_transfer_tokens_no_payment() { opt_transfer_data, USER_ADDRESS.to_managed_address(), tokens, - ) + ); + + state + .world + .check_account(USER_ADDRESS) + .esdt_balance(FUNGIBLE_TOKEN_ID, 0); } From cdb9d217e283fc67765f8721029c9d6daebed33c Mon Sep 17 00:00:00 2001 From: Andrei Baltariu Date: Tue, 30 Jul 2024 09:24:52 +0300 Subject: [PATCH 210/523] Added token transfer with payment Signed-off-by: Andrei Baltariu --- .../tests/token_handler_blackbox_tests.rs | 33 +++++++++++++++++-- 1 file changed, 31 insertions(+), 2 deletions(-) diff --git a/token-handler/tests/token_handler_blackbox_tests.rs b/token-handler/tests/token_handler_blackbox_tests.rs index a1938fb0..d51d5e5d 100644 --- a/token-handler/tests/token_handler_blackbox_tests.rs +++ b/token-handler/tests/token_handler_blackbox_tests.rs @@ -40,6 +40,7 @@ impl TokenHandlerTestState { world .account(OWNER_ADDRESS) .esdt_nft_balance(NFT_TOKEN_ID, 1, 100_000, ManagedBuffer::new()) + .esdt_nft_balance(FUNGIBLE_TOKEN_ID, 0, 100_000, ManagedBuffer::new()) .esdt_balance(CROWD_TOKEN_ID, 100_000) .balance(BigUint::from(WEGLD_BALANCE)) .nonce(1); @@ -47,6 +48,7 @@ impl TokenHandlerTestState { world .account(USER_ADDRESS) .esdt_nft_balance(NFT_TOKEN_ID, 1, 100_000, ManagedBuffer::new()) + .esdt_nft_balance(FUNGIBLE_TOKEN_ID, 0, 100_000, ManagedBuffer::new()) .esdt_balance(CROWD_TOKEN_ID, 100_000) .balance(BigUint::from(WEGLD_BALANCE)) .nonce(1); @@ -82,7 +84,7 @@ impl TokenHandlerTestState { .to(TOKEN_HANDLER_ADDRESS) .typed(token_handler_proxy::TokenHandlerProxy) .transfer_tokens(opt_transfer_data, to, tokens) - .esdt(payment) + .multi_esdt(payment) .run(), Option::None => self .world @@ -142,6 +144,33 @@ fn test_transfer_tokens_no_payment() { state .world - .check_account(USER_ADDRESS) + .check_account(TOKEN_HANDLER_ADDRESS) .esdt_balance(FUNGIBLE_TOKEN_ID, 0); } + +#[test] +fn test_transfer_tokens_fungieble_payment() { + let mut state = TokenHandlerTestState::new(); + let token_ids = [NFT_TOKEN_ID, FUNGIBLE_TOKEN_ID]; + let tokens = state.setup_payments(&token_ids.to_vec()); + let esdt_payment = Option::Some(EsdtTokenPayment { + token_identifier: FUNGIBLE_TOKEN_ID.into(), + token_nonce: 0, + amount: BigUint::from(100u64), + }); + let opt_transfer_data = Option::None; + + state.propose_deploy(CHAIN_PREFIX.into()); + + state.propose_transfer_tokens( + esdt_payment, + opt_transfer_data, + USER_ADDRESS.to_managed_address(), + tokens, + ); + + state + .world + .check_account(TOKEN_HANDLER_ADDRESS) + .esdt_balance(FUNGIBLE_TOKEN_ID, 100); +} From f03272a776260008a9ff9d4dc3b9338889f0fe01 Mon Sep 17 00:00:00 2001 From: Andrei Baltariu Date: Tue, 30 Jul 2024 09:26:03 +0300 Subject: [PATCH 211/523] Fixed typo Signed-off-by: Andrei Baltariu --- token-handler/tests/token_handler_blackbox_tests.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/token-handler/tests/token_handler_blackbox_tests.rs b/token-handler/tests/token_handler_blackbox_tests.rs index d51d5e5d..bf8fd8a3 100644 --- a/token-handler/tests/token_handler_blackbox_tests.rs +++ b/token-handler/tests/token_handler_blackbox_tests.rs @@ -149,7 +149,7 @@ fn test_transfer_tokens_no_payment() { } #[test] -fn test_transfer_tokens_fungieble_payment() { +fn test_transfer_tokens_fungible_payment() { let mut state = TokenHandlerTestState::new(); let token_ids = [NFT_TOKEN_ID, FUNGIBLE_TOKEN_ID]; let tokens = state.setup_payments(&token_ids.to_vec()); From ed85c31208151807501e8527562b5d6cdca91779 Mon Sep 17 00:00:00 2001 From: Andrei Baltariu Date: Tue, 30 Jul 2024 09:32:55 +0300 Subject: [PATCH 212/523] Removed unused const and imports Signed-off-by: Andrei Baltariu --- token-handler/tests/token_handler_blackbox_tests.rs | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/token-handler/tests/token_handler_blackbox_tests.rs b/token-handler/tests/token_handler_blackbox_tests.rs index bf8fd8a3..6a43c75b 100644 --- a/token-handler/tests/token_handler_blackbox_tests.rs +++ b/token-handler/tests/token_handler_blackbox_tests.rs @@ -1,9 +1,9 @@ use multiversx_sc::types::{ - Address, BigUint, EsdtTokenPayment, ManagedAddress, ManagedBuffer, ManagedVec, - MultiValueEncoded, TestAddress, TestSCAddress, TestTokenIdentifier, + BigUint, EsdtTokenPayment, ManagedAddress, ManagedBuffer, MultiValueEncoded, TestAddress, + TestSCAddress, TestTokenIdentifier, }; +use multiversx_sc_scenario::ScenarioTxRun; use multiversx_sc_scenario::{api::StaticApi, imports::MxscPath, ScenarioWorld}; -use multiversx_sc_scenario::{managed_address, ScenarioTxRun}; use token_handler::token_handler_proxy; use transaction::{OperationEsdtPayment, StolenFromFrameworkEsdtTokenData, TransferData}; @@ -15,10 +15,9 @@ const USER_ADDRESS: TestAddress = TestAddress::new("user"); const NFT_TOKEN_ID: TestTokenIdentifier = TestTokenIdentifier::new("NFT-123456"); const CROWD_TOKEN_ID: TestTokenIdentifier = TestTokenIdentifier::new("CROWD-123456"); const FUNGIBLE_TOKEN_ID: TestTokenIdentifier = TestTokenIdentifier::new("FUNG-123456"); -const PREFIX_NFT_TOKEN_ID: TestTokenIdentifier = TestTokenIdentifier::new("sov-NFT-123456"); +const _PREFIX_NFT_TOKEN_ID: TestTokenIdentifier = TestTokenIdentifier::new("sov-NFT-123456"); const WEGLD_BALANCE: u128 = 100_000_000_000_000_000; -const OWNER_BALANCE: u64 = 100_000_000; const CHAIN_PREFIX: &str = "sov"; fn world() -> ScenarioWorld { From 84e8363ac4a089cc73eb361c23f511f4290ee417 Mon Sep 17 00:00:00 2001 From: Andrei Baltariu Date: Tue, 30 Jul 2024 09:38:23 +0300 Subject: [PATCH 213/523] Added new() function for Operation and modified unit tests Signed-off-by: Andrei Baltariu --- common/transaction/src/lib.rs | 8 +++++++ .../tests/enshrine_esdt_safe_blackbox_test.rs | 21 ++++++++----------- 2 files changed, 17 insertions(+), 12 deletions(-) diff --git a/common/transaction/src/lib.rs b/common/transaction/src/lib.rs index c3b5267f..93d88c41 100644 --- a/common/transaction/src/lib.rs +++ b/common/transaction/src/lib.rs @@ -36,6 +36,14 @@ pub struct Operation { } impl Operation { + pub fn new( + to: ManagedAddress, + tokens: ManagedVec>, + data: OperationData, + ) -> Self { + Operation { to, tokens, data } + } + pub fn get_tokens_as_tuple_arr( &self, ) -> MultiValueEncoded, u64, EsdtTokenData>> { diff --git a/enshrine-esdt-safe/tests/enshrine_esdt_safe_blackbox_test.rs b/enshrine-esdt-safe/tests/enshrine_esdt_safe_blackbox_test.rs index 203041d9..92614498 100644 --- a/enshrine-esdt-safe/tests/enshrine_esdt_safe_blackbox_test.rs +++ b/enshrine-esdt-safe/tests/enshrine_esdt_safe_blackbox_test.rs @@ -1,6 +1,7 @@ use bls_signature::BlsSignature; use enshrine_esdt_safe::enshrine_esdt_safe_proxy; use header_verifier::header_verifier_proxy; +use multiversx_sc::api::StaticVarApi; use multiversx_sc::codec::TopEncode; use multiversx_sc::types::{ Address, BigUint, EsdtTokenPayment, ManagedBuffer, ManagedByteArray, ManagedVec, @@ -193,7 +194,7 @@ impl EnshrineTestState { ) { let (tokens, data) = self.setup_payments(tokens); let to = managed_address!(&Address::from(&RECEIVER_ADDRESS.eval_to_array())); - let operation = Operation { to, tokens, data }; + let operation = Operation::new(to, tokens, data); let operation_hash = self.get_operation_hash(&operation); let hash_of_hashes: ManagedBuffer = ManagedBuffer::from(&sha256(&operation_hash.to_vec())); @@ -225,7 +226,7 @@ impl EnshrineTestState { fn propose_register_operation(&mut self, tokens: &Vec) { let (tokens, data) = self.setup_payments(tokens); let to = managed_address!(&Address::from(RECEIVER_ADDRESS.eval_to_array())); - let operation = Operation { to, tokens, data }; + let operation = Operation::new(to, tokens, data); let operation_hash = self.get_operation_hash(&operation); let mut operations_hashes = MultiValueEncoded::new(); @@ -305,21 +306,17 @@ impl EnshrineTestState { let mut tokens: ManagedVec> = ManagedVec::new(); for token_id in token_ids { - let payment: OperationEsdtPayment = OperationEsdtPayment { - token_identifier: token_id.clone().into(), - token_nonce: 1, - token_data: StolenFromFrameworkEsdtTokenData::default(), - }; + let payment: OperationEsdtPayment = OperationEsdtPayment::new( + token_id.clone().into(), + 1, + StolenFromFrameworkEsdtTokenData::default(), + ); tokens.push(payment); } let op_sender = managed_address!(&Address::from(&USER_ADDRESS.eval_to_array())); - let data: OperationData = OperationData { - op_nonce: 1, - op_sender, - opt_transfer_data: Option::None, - }; + let data: OperationData = OperationData::new(1, op_sender, Option::None); (tokens, data) } From 7e1a1b24baf78cb635457f260e5b322d0b62de00 Mon Sep 17 00:00:00 2001 From: Andrei Baltariu Date: Tue, 30 Jul 2024 09:44:05 +0300 Subject: [PATCH 214/523] Built contracts and regenerated proxy Signed-off-by: Andrei Baltariu --- enshrine-esdt-safe/src/token_handler_proxy.rs | 15 ++++++++++++++- token-handler/src/token_handler_proxy.rs | 15 ++++++++++++++- token-handler/wasm-token-handler-full/src/lib.rs | 7 ++++--- token-handler/wasm/src/lib.rs | 7 ++++--- 4 files changed, 36 insertions(+), 8 deletions(-) diff --git a/enshrine-esdt-safe/src/token_handler_proxy.rs b/enshrine-esdt-safe/src/token_handler_proxy.rs index 55d5ec54..400000e9 100644 --- a/enshrine-esdt-safe/src/token_handler_proxy.rs +++ b/enshrine-esdt-safe/src/token_handler_proxy.rs @@ -85,6 +85,19 @@ where To: TxTo, Gas: TxGas, { + pub fn whitelist_enshrine_esdt< + Arg0: ProxyArg>, + >( + self, + enshrine_esdt_address: Arg0, + ) -> TxTypedCall { + self.wrapped_tx + .payment(NotPayable) + .raw_call("whitelistEnshrineEsdt") + .argument(&enshrine_esdt_address) + .original_result() + } + pub fn transfer_tokens< Arg0: ProxyArg>>, Arg1: ProxyArg>, @@ -103,7 +116,7 @@ where .original_result() } - pub fn burn_tokens_endpoint< + pub fn burn_tokens< Arg0: ProxyArg>, >( self, diff --git a/token-handler/src/token_handler_proxy.rs b/token-handler/src/token_handler_proxy.rs index 55d5ec54..400000e9 100644 --- a/token-handler/src/token_handler_proxy.rs +++ b/token-handler/src/token_handler_proxy.rs @@ -85,6 +85,19 @@ where To: TxTo, Gas: TxGas, { + pub fn whitelist_enshrine_esdt< + Arg0: ProxyArg>, + >( + self, + enshrine_esdt_address: Arg0, + ) -> TxTypedCall { + self.wrapped_tx + .payment(NotPayable) + .raw_call("whitelistEnshrineEsdt") + .argument(&enshrine_esdt_address) + .original_result() + } + pub fn transfer_tokens< Arg0: ProxyArg>>, Arg1: ProxyArg>, @@ -103,7 +116,7 @@ where .original_result() } - pub fn burn_tokens_endpoint< + pub fn burn_tokens< Arg0: ProxyArg>, >( self, diff --git a/token-handler/wasm-token-handler-full/src/lib.rs b/token-handler/wasm-token-handler-full/src/lib.rs index 17cff7e3..d80c4404 100644 --- a/token-handler/wasm-token-handler-full/src/lib.rs +++ b/token-handler/wasm-token-handler-full/src/lib.rs @@ -6,9 +6,9 @@ // Init: 1 // Upgrade: 1 -// Endpoints: 10 +// Endpoints: 11 // Async Callback (empty): 1 -// Total number of exported functions: 13 +// Total number of exported functions: 14 #![no_std] @@ -20,8 +20,9 @@ multiversx_sc_wasm_adapter::endpoints! { ( init => init upgrade => upgrade + whitelistEnshrineEsdt => whitelist_enshrine_esdt transferTokens => transfer_tokens - burnTokens => burn_tokens_endpoint + burnTokens => burn_tokens setMaxTxBatchSize => set_max_tx_batch_size setMaxTxBatchBlockDuration => set_max_tx_batch_block_duration getCurrentTxBatch => get_current_tx_batch diff --git a/token-handler/wasm/src/lib.rs b/token-handler/wasm/src/lib.rs index 17cff7e3..d80c4404 100644 --- a/token-handler/wasm/src/lib.rs +++ b/token-handler/wasm/src/lib.rs @@ -6,9 +6,9 @@ // Init: 1 // Upgrade: 1 -// Endpoints: 10 +// Endpoints: 11 // Async Callback (empty): 1 -// Total number of exported functions: 13 +// Total number of exported functions: 14 #![no_std] @@ -20,8 +20,9 @@ multiversx_sc_wasm_adapter::endpoints! { ( init => init upgrade => upgrade + whitelistEnshrineEsdt => whitelist_enshrine_esdt transferTokens => transfer_tokens - burnTokens => burn_tokens_endpoint + burnTokens => burn_tokens setMaxTxBatchSize => set_max_tx_batch_size setMaxTxBatchBlockDuration => set_max_tx_batch_block_duration getCurrentTxBatch => get_current_tx_batch From d15262f04c300a083cbe34c2919a0d20fbd3f19f Mon Sep 17 00:00:00 2001 From: Andrei Baltariu Date: Wed, 31 Jul 2024 12:01:48 +0300 Subject: [PATCH 215/523] Framework upgrade to 0.52.0 Signed-off-by: Andrei Baltariu --- Cargo.lock | 40 +++++++++---------- chain-config/Cargo.toml | 6 +-- chain-config/meta/Cargo.toml | 2 +- chain-config/wasm/Cargo.lock | 28 ++++++------- chain-config/wasm/Cargo.toml | 2 +- chain-factory/Cargo.toml | 4 +- chain-factory/meta/Cargo.toml | 2 +- chain-factory/wasm/Cargo.lock | 28 ++++++------- chain-factory/wasm/Cargo.toml | 2 +- common/bls-signature/Cargo.toml | 4 +- common/max-bridged-amount-module/Cargo.toml | 4 +- common/setup-phase/Cargo.toml | 4 +- common/token-whitelist/Cargo.toml | 4 +- common/transaction/Cargo.toml | 2 +- common/tx-batch-module/Cargo.toml | 4 +- common/utils/Cargo.toml | 2 +- enshrine-esdt-safe/Cargo.toml | 6 +-- enshrine-esdt-safe/meta/Cargo.toml | 2 +- .../wasm-enshrine-esdt-safe-full/Cargo.lock | 28 ++++++------- .../wasm-enshrine-esdt-safe-full/Cargo.toml | 2 +- .../wasm-enshrine-esdt-safe-view/Cargo.lock | 28 ++++++------- .../wasm-enshrine-esdt-safe-view/Cargo.toml | 2 +- enshrine-esdt-safe/wasm/Cargo.lock | 28 ++++++------- enshrine-esdt-safe/wasm/Cargo.toml | 2 +- esdt-safe/Cargo.toml | 6 +-- esdt-safe/meta/Cargo.toml | 2 +- esdt-safe/wasm-esdt-safe-full/Cargo.lock | 28 ++++++------- esdt-safe/wasm-esdt-safe-full/Cargo.toml | 2 +- esdt-safe/wasm-esdt-safe-view/Cargo.lock | 28 ++++++------- esdt-safe/wasm-esdt-safe-view/Cargo.toml | 2 +- esdt-safe/wasm/Cargo.lock | 28 ++++++------- esdt-safe/wasm/Cargo.toml | 2 +- fee-market/Cargo.toml | 4 +- fee-market/meta/Cargo.toml | 2 +- fee-market/wasm-fee-marker-full/Cargo.lock | 24 +++++------ fee-market/wasm-fee-marker-full/Cargo.toml | 2 +- fee-market/wasm-multisig-view/Cargo.lock | 24 +++++------ fee-market/wasm-multisig-view/Cargo.toml | 2 +- fee-market/wasm/Cargo.lock | 24 +++++------ fee-market/wasm/Cargo.toml | 2 +- header-verifier/Cargo.toml | 4 +- header-verifier/meta/Cargo.toml | 2 +- .../wasm-header-verifier-full/Cargo.lock | 24 +++++------ .../wasm-header-verifier-full/Cargo.toml | 2 +- header-verifier/wasm-multisig-view/Cargo.lock | 24 +++++------ header-verifier/wasm-multisig-view/Cargo.toml | 2 +- header-verifier/wasm/Cargo.lock | 24 +++++------ header-verifier/wasm/Cargo.toml | 2 +- pair-mock/Cargo.toml | 4 +- pair-mock/meta/Cargo.toml | 2 +- pair-mock/wasm/Cargo.lock | 24 +++++------ pair-mock/wasm/Cargo.toml | 2 +- router-mock/Cargo.toml | 4 +- router-mock/meta/Cargo.toml | 2 +- router-mock/wasm/Cargo.lock | 24 +++++------ router-mock/wasm/Cargo.toml | 2 +- 56 files changed, 283 insertions(+), 283 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 35328cfa..415d8f80 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -602,9 +602,9 @@ checksum = "b59072fa0624b55ae5ae3fa6bfa91515bbeb4ac440214bc4a509e2c8806d6e9f" [[package]] name = "multiversx-sc" -version = "0.51.1" +version = "0.52.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "236f7890b2208796df8b5ac73b8572ffaf5e2b1531c7ad549d669328b715b657" +checksum = "31bcb4dc736ef975b59878720de1c731788aa1a5a197888606e7d3d6600b1925" dependencies = [ "bitflags", "hex-literal", @@ -616,9 +616,9 @@ dependencies = [ [[package]] name = "multiversx-sc-codec" -version = "0.20.0" +version = "0.20.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fcecd449ea708b72f92edaa17158fe4859c1780aed9b52b14de45f26124ccb8b" +checksum = "ad4f318427761faecf26c1f3115a3beeb5f61858845a60547d9763aa981ddd2d" dependencies = [ "arrayvec", "multiversx-sc-codec-derive", @@ -628,9 +628,9 @@ dependencies = [ [[package]] name = "multiversx-sc-codec-derive" -version = "0.20.0" +version = "0.20.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "68f7fa25402e5e8054d719951289306fd79e481f7c21b2565b5549b6bc359772" +checksum = "476501462b0c2654b64f9dec6f2c480e24b4e9b7133ec10b7167e64acda35d04" dependencies = [ "hex", "proc-macro2", @@ -640,9 +640,9 @@ dependencies = [ [[package]] name = "multiversx-sc-derive" -version = "0.51.1" +version = "0.52.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eb683bc78d0e2eb43c16cac790144f53cc2ab27912aeb1484433895742ce698d" +checksum = "ae92e4121bad55ffc476028c25722bc01ba989b4953837fb7f4b6be9dba398ed" dependencies = [ "hex", "proc-macro2", @@ -653,9 +653,9 @@ dependencies = [ [[package]] name = "multiversx-sc-meta-lib" -version = "0.51.1" +version = "0.52.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eb12232450627cb0e9f3ba9493b0bd7445a40066f0e311e19e84de812bbffd56" +checksum = "77add452483515e992d633c1820557941d17cb59dbc0c4783d5b9585b8f5a0a4" dependencies = [ "clap", "colored", @@ -674,18 +674,18 @@ dependencies = [ [[package]] name = "multiversx-sc-modules" -version = "0.51.1" +version = "0.52.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "16af268784dff8a34cb696605413c325253da793d85f81b00dcb0e66f82963c9" +checksum = "1aca2fbccb7cd84f3c4d7a13c78d90fac484bf9cab30ed73c9b5f5e31f513b6f" dependencies = [ "multiversx-sc", ] [[package]] name = "multiversx-sc-scenario" -version = "0.51.1" +version = "0.52.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6b7a5e1289d021c89c44688d77110d78edf83ea52b2eff40481a8119ad2f0411" +checksum = "6975f54ad39d3e35e4e4299e32dbb2bd8a8e371775418324640ca33fc401a9d1" dependencies = [ "base64", "bech32", @@ -1039,9 +1039,9 @@ checksum = "81cdd64d312baedb58e21336b31bc043b77e01cc99033ce76ef539f78e965ebc" [[package]] name = "syn" -version = "2.0.68" +version = "2.0.72" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "901fa70d88b9d6c98022e23b4136f9f3e54e4662c3bc1bd1d84a42a9a0f0c1e9" +checksum = "dc4b9b9bf2add8093d3f2c0204471e951b2285580335de42f9d2534f3ae7a8af" dependencies = [ "proc-macro2", "quote", @@ -1177,9 +1177,9 @@ checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" [[package]] name = "wasmparser" -version = "0.212.0" +version = "0.214.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8d28bc49ba1e5c5b61ffa7a2eace10820443c4b7d1c0b144109261d14570fdf8" +checksum = "5309c1090e3e84dad0d382f42064e9933fdaedb87e468cc239f0eabea73ddcb6" dependencies = [ "ahash", "bitflags", @@ -1191,9 +1191,9 @@ dependencies = [ [[package]] name = "wasmprinter" -version = "0.212.0" +version = "0.214.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dfac65326cc561112af88c3028f6dfdb140acff67ede33a8e86be2dc6b8956f7" +checksum = "58d4f2b3f7bd2ba10f99e03f885ff90d5db3455e163bccecebbbf60406bd8980" dependencies = [ "anyhow", "termcolor", diff --git a/chain-config/Cargo.toml b/chain-config/Cargo.toml index 82b182fe..84acceac 100644 --- a/chain-config/Cargo.toml +++ b/chain-config/Cargo.toml @@ -12,10 +12,10 @@ path = "src/lib.rs" num-bigint = "0.4.2" [dev-dependencies.multiversx-sc-scenario] -version = "=0.51.1" +version = "=0.52.0" [dependencies.multiversx-sc] -version = "=0.51.1" +version = "=0.52.0" [dependencies.multiversx-sc-modules] -version = "=0.51.1" +version = "=0.52.0" diff --git a/chain-config/meta/Cargo.toml b/chain-config/meta/Cargo.toml index 33929c62..335fbd16 100644 --- a/chain-config/meta/Cargo.toml +++ b/chain-config/meta/Cargo.toml @@ -11,4 +11,4 @@ authors = ["you"] path = ".." [dependencies.multiversx-sc-meta-lib] -version = "=0.51.1" +version = "=0.52.0" diff --git a/chain-config/wasm/Cargo.lock b/chain-config/wasm/Cargo.lock index 3d943e47..8d2c5de6 100644 --- a/chain-config/wasm/Cargo.lock +++ b/chain-config/wasm/Cargo.lock @@ -56,9 +56,9 @@ checksum = "6fe2267d4ed49bc07b63801559be28c718ea06c4738b7a03c94df7386d2cde46" [[package]] name = "multiversx-sc" -version = "0.51.1" +version = "0.52.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "236f7890b2208796df8b5ac73b8572ffaf5e2b1531c7ad549d669328b715b657" +checksum = "31bcb4dc736ef975b59878720de1c731788aa1a5a197888606e7d3d6600b1925" dependencies = [ "bitflags", "hex-literal", @@ -70,9 +70,9 @@ dependencies = [ [[package]] name = "multiversx-sc-codec" -version = "0.20.0" +version = "0.20.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fcecd449ea708b72f92edaa17158fe4859c1780aed9b52b14de45f26124ccb8b" +checksum = "ad4f318427761faecf26c1f3115a3beeb5f61858845a60547d9763aa981ddd2d" dependencies = [ "arrayvec", "multiversx-sc-codec-derive", @@ -81,9 +81,9 @@ dependencies = [ [[package]] name = "multiversx-sc-codec-derive" -version = "0.20.0" +version = "0.20.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "68f7fa25402e5e8054d719951289306fd79e481f7c21b2565b5549b6bc359772" +checksum = "476501462b0c2654b64f9dec6f2c480e24b4e9b7133ec10b7167e64acda35d04" dependencies = [ "hex", "proc-macro2", @@ -93,9 +93,9 @@ dependencies = [ [[package]] name = "multiversx-sc-derive" -version = "0.51.1" +version = "0.52.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eb683bc78d0e2eb43c16cac790144f53cc2ab27912aeb1484433895742ce698d" +checksum = "ae92e4121bad55ffc476028c25722bc01ba989b4953837fb7f4b6be9dba398ed" dependencies = [ "hex", "proc-macro2", @@ -106,18 +106,18 @@ dependencies = [ [[package]] name = "multiversx-sc-modules" -version = "0.51.1" +version = "0.52.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "16af268784dff8a34cb696605413c325253da793d85f81b00dcb0e66f82963c9" +checksum = "1aca2fbccb7cd84f3c4d7a13c78d90fac484bf9cab30ed73c9b5f5e31f513b6f" dependencies = [ "multiversx-sc", ] [[package]] name = "multiversx-sc-wasm-adapter" -version = "0.51.1" +version = "0.52.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b2f0d6be22f911ce45427491a9bec94612a1678eab2769dd08c9c9731d13da53" +checksum = "bbb8f0bf218a2e3f02d37c3112fd099bdd72d307e69e97b4773fa8c16bf6ab87" dependencies = [ "multiversx-sc", ] @@ -176,9 +176,9 @@ checksum = "3c5e1a9a646d36c3599cd173a41282daf47c44583ad367b8e6837255952e5c67" [[package]] name = "syn" -version = "2.0.68" +version = "2.0.72" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "901fa70d88b9d6c98022e23b4136f9f3e54e4662c3bc1bd1d84a42a9a0f0c1e9" +checksum = "dc4b9b9bf2add8093d3f2c0204471e951b2285580335de42f9d2534f3ae7a8af" dependencies = [ "proc-macro2", "quote", diff --git a/chain-config/wasm/Cargo.toml b/chain-config/wasm/Cargo.toml index 218930e9..96fa548a 100644 --- a/chain-config/wasm/Cargo.toml +++ b/chain-config/wasm/Cargo.toml @@ -28,7 +28,7 @@ panic = "abort" path = ".." [dependencies.multiversx-sc-wasm-adapter] -version = "=0.51.1" +version = "=0.52.0" [workspace] members = ["."] diff --git a/chain-factory/Cargo.toml b/chain-factory/Cargo.toml index d7af8a33..015fff9a 100644 --- a/chain-factory/Cargo.toml +++ b/chain-factory/Cargo.toml @@ -12,10 +12,10 @@ path = "src/lib.rs" num-bigint = "0.4.2" [dev-dependencies.multiversx-sc-scenario] -version = "=0.51.1" +version = "=0.52.0" [dependencies.multiversx-sc] -version = "=0.51.1" +version = "=0.52.0" [dependencies.utils] path = "../common/utils" diff --git a/chain-factory/meta/Cargo.toml b/chain-factory/meta/Cargo.toml index d6b9bf02..bb60a180 100644 --- a/chain-factory/meta/Cargo.toml +++ b/chain-factory/meta/Cargo.toml @@ -11,4 +11,4 @@ authors = ["you"] path = ".." [dependencies.multiversx-sc-meta-lib] -version = "=0.51.1" +version = "=0.52.0" diff --git a/chain-factory/wasm/Cargo.lock b/chain-factory/wasm/Cargo.lock index 30ac35b8..f2681839 100644 --- a/chain-factory/wasm/Cargo.lock +++ b/chain-factory/wasm/Cargo.lock @@ -74,9 +74,9 @@ checksum = "6fe2267d4ed49bc07b63801559be28c718ea06c4738b7a03c94df7386d2cde46" [[package]] name = "multiversx-sc" -version = "0.51.1" +version = "0.52.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "236f7890b2208796df8b5ac73b8572ffaf5e2b1531c7ad549d669328b715b657" +checksum = "31bcb4dc736ef975b59878720de1c731788aa1a5a197888606e7d3d6600b1925" dependencies = [ "bitflags", "hex-literal", @@ -88,9 +88,9 @@ dependencies = [ [[package]] name = "multiversx-sc-codec" -version = "0.20.0" +version = "0.20.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fcecd449ea708b72f92edaa17158fe4859c1780aed9b52b14de45f26124ccb8b" +checksum = "ad4f318427761faecf26c1f3115a3beeb5f61858845a60547d9763aa981ddd2d" dependencies = [ "arrayvec", "multiversx-sc-codec-derive", @@ -99,9 +99,9 @@ dependencies = [ [[package]] name = "multiversx-sc-codec-derive" -version = "0.20.0" +version = "0.20.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "68f7fa25402e5e8054d719951289306fd79e481f7c21b2565b5549b6bc359772" +checksum = "476501462b0c2654b64f9dec6f2c480e24b4e9b7133ec10b7167e64acda35d04" dependencies = [ "hex", "proc-macro2", @@ -111,9 +111,9 @@ dependencies = [ [[package]] name = "multiversx-sc-derive" -version = "0.51.1" +version = "0.52.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eb683bc78d0e2eb43c16cac790144f53cc2ab27912aeb1484433895742ce698d" +checksum = "ae92e4121bad55ffc476028c25722bc01ba989b4953837fb7f4b6be9dba398ed" dependencies = [ "hex", "proc-macro2", @@ -124,18 +124,18 @@ dependencies = [ [[package]] name = "multiversx-sc-modules" -version = "0.51.1" +version = "0.52.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "16af268784dff8a34cb696605413c325253da793d85f81b00dcb0e66f82963c9" +checksum = "1aca2fbccb7cd84f3c4d7a13c78d90fac484bf9cab30ed73c9b5f5e31f513b6f" dependencies = [ "multiversx-sc", ] [[package]] name = "multiversx-sc-wasm-adapter" -version = "0.51.1" +version = "0.52.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b2f0d6be22f911ce45427491a9bec94612a1678eab2769dd08c9c9731d13da53" +checksum = "bbb8f0bf218a2e3f02d37c3112fd099bdd72d307e69e97b4773fa8c16bf6ab87" dependencies = [ "multiversx-sc", ] @@ -194,9 +194,9 @@ checksum = "3c5e1a9a646d36c3599cd173a41282daf47c44583ad367b8e6837255952e5c67" [[package]] name = "syn" -version = "2.0.68" +version = "2.0.72" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "901fa70d88b9d6c98022e23b4136f9f3e54e4662c3bc1bd1d84a42a9a0f0c1e9" +checksum = "dc4b9b9bf2add8093d3f2c0204471e951b2285580335de42f9d2534f3ae7a8af" dependencies = [ "proc-macro2", "quote", diff --git a/chain-factory/wasm/Cargo.toml b/chain-factory/wasm/Cargo.toml index f5aeac10..2b5dc60b 100644 --- a/chain-factory/wasm/Cargo.toml +++ b/chain-factory/wasm/Cargo.toml @@ -28,7 +28,7 @@ panic = "abort" path = ".." [dependencies.multiversx-sc-wasm-adapter] -version = "=0.51.1" +version = "=0.52.0" [workspace] members = ["."] diff --git a/common/bls-signature/Cargo.toml b/common/bls-signature/Cargo.toml index 063f8c6c..d678cca4 100644 --- a/common/bls-signature/Cargo.toml +++ b/common/bls-signature/Cargo.toml @@ -5,10 +5,10 @@ authors = ["dorin-iancu "] edition = "2018" [dependencies.multiversx-sc] -version = "=0.51.1" +version = "=0.52.0" [dependencies.transaction] path = "../transaction" [dev-dependencies.multiversx-sc-scenario] -version = "=0.51.1" +version = "=0.52.0" diff --git a/common/max-bridged-amount-module/Cargo.toml b/common/max-bridged-amount-module/Cargo.toml index c0b0234a..36c1ec72 100644 --- a/common/max-bridged-amount-module/Cargo.toml +++ b/common/max-bridged-amount-module/Cargo.toml @@ -5,7 +5,7 @@ authors = ["dorin-iancu "] edition = "2018" [dependencies.multiversx-sc] -version = "=0.51.1" +version = "=0.52.0" [dev-dependencies.multiversx-sc-scenario] -version = "=0.51.1" +version = "=0.52.0" diff --git a/common/setup-phase/Cargo.toml b/common/setup-phase/Cargo.toml index 7904852b..c1017162 100644 --- a/common/setup-phase/Cargo.toml +++ b/common/setup-phase/Cargo.toml @@ -5,7 +5,7 @@ authors = ["dorin-iancu "] edition = "2018" [dependencies.multiversx-sc] -version = "=0.51.1" +version = "=0.52.0" [dev-dependencies.multiversx-sc-scenario] -version = "=0.51.1" +version = "=0.52.0" diff --git a/common/token-whitelist/Cargo.toml b/common/token-whitelist/Cargo.toml index f775623d..98fb4826 100644 --- a/common/token-whitelist/Cargo.toml +++ b/common/token-whitelist/Cargo.toml @@ -14,7 +14,7 @@ path = "../setup-phase" path = "../utils" [dependencies.multiversx-sc] -version = "=0.51.1" +version = "=0.52.0" [dev-dependencies.multiversx-sc-scenario] -version = "=0.51.1" +version = "=0.52.0" diff --git a/common/transaction/Cargo.toml b/common/transaction/Cargo.toml index 529b5578..3ece8582 100644 --- a/common/transaction/Cargo.toml +++ b/common/transaction/Cargo.toml @@ -8,4 +8,4 @@ edition = "2018" path = "src/lib.rs" [dependencies.multiversx-sc] -version = "=0.51.1" +version = "=0.52.0" diff --git a/common/tx-batch-module/Cargo.toml b/common/tx-batch-module/Cargo.toml index df0582e0..880c9b7c 100644 --- a/common/tx-batch-module/Cargo.toml +++ b/common/tx-batch-module/Cargo.toml @@ -5,10 +5,10 @@ authors = ["dorin-iancu "] edition = "2018" [dependencies.multiversx-sc] -version = "=0.51.1" +version = "=0.52.0" [dependencies.transaction] path = "../transaction" [dev-dependencies.multiversx-sc-scenario] -version = "=0.51.1" +version = "=0.52.0" diff --git a/common/utils/Cargo.toml b/common/utils/Cargo.toml index 2175cda3..978ed2fa 100644 --- a/common/utils/Cargo.toml +++ b/common/utils/Cargo.toml @@ -11,5 +11,5 @@ path = "src/lib.rs" path = "../bls-signature" [dependencies.multiversx-sc] -version = "=0.51.1" +version = "=0.52.0" features = ["esdt-token-payment-legacy-decode"] diff --git a/enshrine-esdt-safe/Cargo.toml b/enshrine-esdt-safe/Cargo.toml index 9a970b70..4e359b2f 100644 --- a/enshrine-esdt-safe/Cargo.toml +++ b/enshrine-esdt-safe/Cargo.toml @@ -36,10 +36,10 @@ path = "../fee-market" path = "../header-verifier" [dependencies.multiversx-sc] -version = "=0.51.1" +version = "=0.52.0" [dependencies.multiversx-sc-modules] -version = "=0.51.1" +version = "=0.52.0" [dev-dependencies] num-bigint = "0.4.2" @@ -47,4 +47,4 @@ num-traits = "0.2" hex = "0.4" [dev-dependencies.multiversx-sc-scenario] -version = "=0.51.1" +version = "=0.52.0" diff --git a/enshrine-esdt-safe/meta/Cargo.toml b/enshrine-esdt-safe/meta/Cargo.toml index 3667dafc..456f6d6a 100644 --- a/enshrine-esdt-safe/meta/Cargo.toml +++ b/enshrine-esdt-safe/meta/Cargo.toml @@ -8,5 +8,5 @@ publish = false path = ".." [dependencies.multiversx-sc-meta-lib] -version = "0.51.1" +version = "0.52.0" default-features = false diff --git a/enshrine-esdt-safe/wasm-enshrine-esdt-safe-full/Cargo.lock b/enshrine-esdt-safe/wasm-enshrine-esdt-safe-full/Cargo.lock index 9677d66b..70ab0b3c 100644 --- a/enshrine-esdt-safe/wasm-enshrine-esdt-safe-full/Cargo.lock +++ b/enshrine-esdt-safe/wasm-enshrine-esdt-safe-full/Cargo.lock @@ -101,9 +101,9 @@ dependencies = [ [[package]] name = "multiversx-sc" -version = "0.51.1" +version = "0.52.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "236f7890b2208796df8b5ac73b8572ffaf5e2b1531c7ad549d669328b715b657" +checksum = "31bcb4dc736ef975b59878720de1c731788aa1a5a197888606e7d3d6600b1925" dependencies = [ "bitflags", "hex-literal", @@ -115,9 +115,9 @@ dependencies = [ [[package]] name = "multiversx-sc-codec" -version = "0.20.0" +version = "0.20.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fcecd449ea708b72f92edaa17158fe4859c1780aed9b52b14de45f26124ccb8b" +checksum = "ad4f318427761faecf26c1f3115a3beeb5f61858845a60547d9763aa981ddd2d" dependencies = [ "arrayvec", "multiversx-sc-codec-derive", @@ -126,9 +126,9 @@ dependencies = [ [[package]] name = "multiversx-sc-codec-derive" -version = "0.20.0" +version = "0.20.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "68f7fa25402e5e8054d719951289306fd79e481f7c21b2565b5549b6bc359772" +checksum = "476501462b0c2654b64f9dec6f2c480e24b4e9b7133ec10b7167e64acda35d04" dependencies = [ "hex", "proc-macro2", @@ -138,9 +138,9 @@ dependencies = [ [[package]] name = "multiversx-sc-derive" -version = "0.51.1" +version = "0.52.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eb683bc78d0e2eb43c16cac790144f53cc2ab27912aeb1484433895742ce698d" +checksum = "ae92e4121bad55ffc476028c25722bc01ba989b4953837fb7f4b6be9dba398ed" dependencies = [ "hex", "proc-macro2", @@ -151,18 +151,18 @@ dependencies = [ [[package]] name = "multiversx-sc-modules" -version = "0.51.1" +version = "0.52.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "16af268784dff8a34cb696605413c325253da793d85f81b00dcb0e66f82963c9" +checksum = "1aca2fbccb7cd84f3c4d7a13c78d90fac484bf9cab30ed73c9b5f5e31f513b6f" dependencies = [ "multiversx-sc", ] [[package]] name = "multiversx-sc-wasm-adapter" -version = "0.51.1" +version = "0.52.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b2f0d6be22f911ce45427491a9bec94612a1678eab2769dd08c9c9731d13da53" +checksum = "bbb8f0bf218a2e3f02d37c3112fd099bdd72d307e69e97b4773fa8c16bf6ab87" dependencies = [ "multiversx-sc", ] @@ -242,9 +242,9 @@ checksum = "3c5e1a9a646d36c3599cd173a41282daf47c44583ad367b8e6837255952e5c67" [[package]] name = "syn" -version = "2.0.68" +version = "2.0.72" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "901fa70d88b9d6c98022e23b4136f9f3e54e4662c3bc1bd1d84a42a9a0f0c1e9" +checksum = "dc4b9b9bf2add8093d3f2c0204471e951b2285580335de42f9d2534f3ae7a8af" dependencies = [ "proc-macro2", "quote", diff --git a/enshrine-esdt-safe/wasm-enshrine-esdt-safe-full/Cargo.toml b/enshrine-esdt-safe/wasm-enshrine-esdt-safe-full/Cargo.toml index 71f28b83..b32142ea 100644 --- a/enshrine-esdt-safe/wasm-enshrine-esdt-safe-full/Cargo.toml +++ b/enshrine-esdt-safe/wasm-enshrine-esdt-safe-full/Cargo.toml @@ -28,7 +28,7 @@ panic = "abort" path = ".." [dependencies.multiversx-sc-wasm-adapter] -version = "=0.51.1" +version = "=0.52.0" [workspace] members = ["."] diff --git a/enshrine-esdt-safe/wasm-enshrine-esdt-safe-view/Cargo.lock b/enshrine-esdt-safe/wasm-enshrine-esdt-safe-view/Cargo.lock index 1cecede7..bcb418d4 100644 --- a/enshrine-esdt-safe/wasm-enshrine-esdt-safe-view/Cargo.lock +++ b/enshrine-esdt-safe/wasm-enshrine-esdt-safe-view/Cargo.lock @@ -101,9 +101,9 @@ dependencies = [ [[package]] name = "multiversx-sc" -version = "0.51.1" +version = "0.52.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "236f7890b2208796df8b5ac73b8572ffaf5e2b1531c7ad549d669328b715b657" +checksum = "31bcb4dc736ef975b59878720de1c731788aa1a5a197888606e7d3d6600b1925" dependencies = [ "bitflags", "hex-literal", @@ -115,9 +115,9 @@ dependencies = [ [[package]] name = "multiversx-sc-codec" -version = "0.20.0" +version = "0.20.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fcecd449ea708b72f92edaa17158fe4859c1780aed9b52b14de45f26124ccb8b" +checksum = "ad4f318427761faecf26c1f3115a3beeb5f61858845a60547d9763aa981ddd2d" dependencies = [ "arrayvec", "multiversx-sc-codec-derive", @@ -126,9 +126,9 @@ dependencies = [ [[package]] name = "multiversx-sc-codec-derive" -version = "0.20.0" +version = "0.20.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "68f7fa25402e5e8054d719951289306fd79e481f7c21b2565b5549b6bc359772" +checksum = "476501462b0c2654b64f9dec6f2c480e24b4e9b7133ec10b7167e64acda35d04" dependencies = [ "hex", "proc-macro2", @@ -138,9 +138,9 @@ dependencies = [ [[package]] name = "multiversx-sc-derive" -version = "0.51.1" +version = "0.52.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eb683bc78d0e2eb43c16cac790144f53cc2ab27912aeb1484433895742ce698d" +checksum = "ae92e4121bad55ffc476028c25722bc01ba989b4953837fb7f4b6be9dba398ed" dependencies = [ "hex", "proc-macro2", @@ -151,18 +151,18 @@ dependencies = [ [[package]] name = "multiversx-sc-modules" -version = "0.51.1" +version = "0.52.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "16af268784dff8a34cb696605413c325253da793d85f81b00dcb0e66f82963c9" +checksum = "1aca2fbccb7cd84f3c4d7a13c78d90fac484bf9cab30ed73c9b5f5e31f513b6f" dependencies = [ "multiversx-sc", ] [[package]] name = "multiversx-sc-wasm-adapter" -version = "0.51.1" +version = "0.52.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b2f0d6be22f911ce45427491a9bec94612a1678eab2769dd08c9c9731d13da53" +checksum = "bbb8f0bf218a2e3f02d37c3112fd099bdd72d307e69e97b4773fa8c16bf6ab87" dependencies = [ "multiversx-sc", ] @@ -242,9 +242,9 @@ checksum = "3c5e1a9a646d36c3599cd173a41282daf47c44583ad367b8e6837255952e5c67" [[package]] name = "syn" -version = "2.0.68" +version = "2.0.72" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "901fa70d88b9d6c98022e23b4136f9f3e54e4662c3bc1bd1d84a42a9a0f0c1e9" +checksum = "dc4b9b9bf2add8093d3f2c0204471e951b2285580335de42f9d2534f3ae7a8af" dependencies = [ "proc-macro2", "quote", diff --git a/enshrine-esdt-safe/wasm-enshrine-esdt-safe-view/Cargo.toml b/enshrine-esdt-safe/wasm-enshrine-esdt-safe-view/Cargo.toml index 09dbe893..2bd6b9bd 100644 --- a/enshrine-esdt-safe/wasm-enshrine-esdt-safe-view/Cargo.toml +++ b/enshrine-esdt-safe/wasm-enshrine-esdt-safe-view/Cargo.toml @@ -28,7 +28,7 @@ panic = "abort" path = ".." [dependencies.multiversx-sc-wasm-adapter] -version = "=0.51.1" +version = "=0.52.0" [workspace] members = ["."] diff --git a/enshrine-esdt-safe/wasm/Cargo.lock b/enshrine-esdt-safe/wasm/Cargo.lock index 060a012b..0caf2d3a 100644 --- a/enshrine-esdt-safe/wasm/Cargo.lock +++ b/enshrine-esdt-safe/wasm/Cargo.lock @@ -101,9 +101,9 @@ dependencies = [ [[package]] name = "multiversx-sc" -version = "0.51.1" +version = "0.52.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "236f7890b2208796df8b5ac73b8572ffaf5e2b1531c7ad549d669328b715b657" +checksum = "31bcb4dc736ef975b59878720de1c731788aa1a5a197888606e7d3d6600b1925" dependencies = [ "bitflags", "hex-literal", @@ -115,9 +115,9 @@ dependencies = [ [[package]] name = "multiversx-sc-codec" -version = "0.20.0" +version = "0.20.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fcecd449ea708b72f92edaa17158fe4859c1780aed9b52b14de45f26124ccb8b" +checksum = "ad4f318427761faecf26c1f3115a3beeb5f61858845a60547d9763aa981ddd2d" dependencies = [ "arrayvec", "multiversx-sc-codec-derive", @@ -126,9 +126,9 @@ dependencies = [ [[package]] name = "multiversx-sc-codec-derive" -version = "0.20.0" +version = "0.20.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "68f7fa25402e5e8054d719951289306fd79e481f7c21b2565b5549b6bc359772" +checksum = "476501462b0c2654b64f9dec6f2c480e24b4e9b7133ec10b7167e64acda35d04" dependencies = [ "hex", "proc-macro2", @@ -138,9 +138,9 @@ dependencies = [ [[package]] name = "multiversx-sc-derive" -version = "0.51.1" +version = "0.52.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eb683bc78d0e2eb43c16cac790144f53cc2ab27912aeb1484433895742ce698d" +checksum = "ae92e4121bad55ffc476028c25722bc01ba989b4953837fb7f4b6be9dba398ed" dependencies = [ "hex", "proc-macro2", @@ -151,18 +151,18 @@ dependencies = [ [[package]] name = "multiversx-sc-modules" -version = "0.51.1" +version = "0.52.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "16af268784dff8a34cb696605413c325253da793d85f81b00dcb0e66f82963c9" +checksum = "1aca2fbccb7cd84f3c4d7a13c78d90fac484bf9cab30ed73c9b5f5e31f513b6f" dependencies = [ "multiversx-sc", ] [[package]] name = "multiversx-sc-wasm-adapter" -version = "0.51.1" +version = "0.52.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b2f0d6be22f911ce45427491a9bec94612a1678eab2769dd08c9c9731d13da53" +checksum = "bbb8f0bf218a2e3f02d37c3112fd099bdd72d307e69e97b4773fa8c16bf6ab87" dependencies = [ "multiversx-sc", ] @@ -242,9 +242,9 @@ checksum = "3c5e1a9a646d36c3599cd173a41282daf47c44583ad367b8e6837255952e5c67" [[package]] name = "syn" -version = "2.0.68" +version = "2.0.72" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "901fa70d88b9d6c98022e23b4136f9f3e54e4662c3bc1bd1d84a42a9a0f0c1e9" +checksum = "dc4b9b9bf2add8093d3f2c0204471e951b2285580335de42f9d2534f3ae7a8af" dependencies = [ "proc-macro2", "quote", diff --git a/enshrine-esdt-safe/wasm/Cargo.toml b/enshrine-esdt-safe/wasm/Cargo.toml index e8c6bf60..b80c98e6 100644 --- a/enshrine-esdt-safe/wasm/Cargo.toml +++ b/enshrine-esdt-safe/wasm/Cargo.toml @@ -28,7 +28,7 @@ panic = "abort" path = ".." [dependencies.multiversx-sc-wasm-adapter] -version = "=0.51.1" +version = "=0.52.0" [workspace] members = ["."] diff --git a/esdt-safe/Cargo.toml b/esdt-safe/Cargo.toml index 2aa892ef..425c615c 100644 --- a/esdt-safe/Cargo.toml +++ b/esdt-safe/Cargo.toml @@ -36,10 +36,10 @@ path = "../fee-market" path = "../header-verifier" [dependencies.multiversx-sc] -version = "=0.51.1" +version = "=0.52.0" [dependencies.multiversx-sc-modules] -version = "=0.51.1" +version = "=0.52.0" [dev-dependencies] num-bigint = "0.4.2" @@ -47,4 +47,4 @@ num-traits = "0.2" hex = "0.4" [dev-dependencies.multiversx-sc-scenario] -version = "=0.51.1" +version = "=0.52.0" diff --git a/esdt-safe/meta/Cargo.toml b/esdt-safe/meta/Cargo.toml index 934d5f37..f7ba77e2 100644 --- a/esdt-safe/meta/Cargo.toml +++ b/esdt-safe/meta/Cargo.toml @@ -11,4 +11,4 @@ publish = false path = ".." [dependencies.multiversx-sc-meta-lib] -version = "=0.51.1" +version = "=0.52.0" diff --git a/esdt-safe/wasm-esdt-safe-full/Cargo.lock b/esdt-safe/wasm-esdt-safe-full/Cargo.lock index 07451e04..55379f88 100644 --- a/esdt-safe/wasm-esdt-safe-full/Cargo.lock +++ b/esdt-safe/wasm-esdt-safe-full/Cargo.lock @@ -101,9 +101,9 @@ dependencies = [ [[package]] name = "multiversx-sc" -version = "0.51.1" +version = "0.52.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "236f7890b2208796df8b5ac73b8572ffaf5e2b1531c7ad549d669328b715b657" +checksum = "31bcb4dc736ef975b59878720de1c731788aa1a5a197888606e7d3d6600b1925" dependencies = [ "bitflags", "hex-literal", @@ -115,9 +115,9 @@ dependencies = [ [[package]] name = "multiversx-sc-codec" -version = "0.20.0" +version = "0.20.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fcecd449ea708b72f92edaa17158fe4859c1780aed9b52b14de45f26124ccb8b" +checksum = "ad4f318427761faecf26c1f3115a3beeb5f61858845a60547d9763aa981ddd2d" dependencies = [ "arrayvec", "multiversx-sc-codec-derive", @@ -126,9 +126,9 @@ dependencies = [ [[package]] name = "multiversx-sc-codec-derive" -version = "0.20.0" +version = "0.20.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "68f7fa25402e5e8054d719951289306fd79e481f7c21b2565b5549b6bc359772" +checksum = "476501462b0c2654b64f9dec6f2c480e24b4e9b7133ec10b7167e64acda35d04" dependencies = [ "hex", "proc-macro2", @@ -138,9 +138,9 @@ dependencies = [ [[package]] name = "multiversx-sc-derive" -version = "0.51.1" +version = "0.52.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eb683bc78d0e2eb43c16cac790144f53cc2ab27912aeb1484433895742ce698d" +checksum = "ae92e4121bad55ffc476028c25722bc01ba989b4953837fb7f4b6be9dba398ed" dependencies = [ "hex", "proc-macro2", @@ -151,18 +151,18 @@ dependencies = [ [[package]] name = "multiversx-sc-modules" -version = "0.51.1" +version = "0.52.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "16af268784dff8a34cb696605413c325253da793d85f81b00dcb0e66f82963c9" +checksum = "1aca2fbccb7cd84f3c4d7a13c78d90fac484bf9cab30ed73c9b5f5e31f513b6f" dependencies = [ "multiversx-sc", ] [[package]] name = "multiversx-sc-wasm-adapter" -version = "0.51.1" +version = "0.52.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b2f0d6be22f911ce45427491a9bec94612a1678eab2769dd08c9c9731d13da53" +checksum = "bbb8f0bf218a2e3f02d37c3112fd099bdd72d307e69e97b4773fa8c16bf6ab87" dependencies = [ "multiversx-sc", ] @@ -242,9 +242,9 @@ checksum = "3c5e1a9a646d36c3599cd173a41282daf47c44583ad367b8e6837255952e5c67" [[package]] name = "syn" -version = "2.0.68" +version = "2.0.72" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "901fa70d88b9d6c98022e23b4136f9f3e54e4662c3bc1bd1d84a42a9a0f0c1e9" +checksum = "dc4b9b9bf2add8093d3f2c0204471e951b2285580335de42f9d2534f3ae7a8af" dependencies = [ "proc-macro2", "quote", diff --git a/esdt-safe/wasm-esdt-safe-full/Cargo.toml b/esdt-safe/wasm-esdt-safe-full/Cargo.toml index 66c52792..28350897 100644 --- a/esdt-safe/wasm-esdt-safe-full/Cargo.toml +++ b/esdt-safe/wasm-esdt-safe-full/Cargo.toml @@ -28,7 +28,7 @@ panic = "abort" path = ".." [dependencies.multiversx-sc-wasm-adapter] -version = "=0.51.1" +version = "=0.52.0" [workspace] members = ["."] diff --git a/esdt-safe/wasm-esdt-safe-view/Cargo.lock b/esdt-safe/wasm-esdt-safe-view/Cargo.lock index 7dd7b721..8b658b43 100644 --- a/esdt-safe/wasm-esdt-safe-view/Cargo.lock +++ b/esdt-safe/wasm-esdt-safe-view/Cargo.lock @@ -101,9 +101,9 @@ dependencies = [ [[package]] name = "multiversx-sc" -version = "0.51.1" +version = "0.52.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "236f7890b2208796df8b5ac73b8572ffaf5e2b1531c7ad549d669328b715b657" +checksum = "31bcb4dc736ef975b59878720de1c731788aa1a5a197888606e7d3d6600b1925" dependencies = [ "bitflags", "hex-literal", @@ -115,9 +115,9 @@ dependencies = [ [[package]] name = "multiversx-sc-codec" -version = "0.20.0" +version = "0.20.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fcecd449ea708b72f92edaa17158fe4859c1780aed9b52b14de45f26124ccb8b" +checksum = "ad4f318427761faecf26c1f3115a3beeb5f61858845a60547d9763aa981ddd2d" dependencies = [ "arrayvec", "multiversx-sc-codec-derive", @@ -126,9 +126,9 @@ dependencies = [ [[package]] name = "multiversx-sc-codec-derive" -version = "0.20.0" +version = "0.20.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "68f7fa25402e5e8054d719951289306fd79e481f7c21b2565b5549b6bc359772" +checksum = "476501462b0c2654b64f9dec6f2c480e24b4e9b7133ec10b7167e64acda35d04" dependencies = [ "hex", "proc-macro2", @@ -138,9 +138,9 @@ dependencies = [ [[package]] name = "multiversx-sc-derive" -version = "0.51.1" +version = "0.52.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eb683bc78d0e2eb43c16cac790144f53cc2ab27912aeb1484433895742ce698d" +checksum = "ae92e4121bad55ffc476028c25722bc01ba989b4953837fb7f4b6be9dba398ed" dependencies = [ "hex", "proc-macro2", @@ -151,18 +151,18 @@ dependencies = [ [[package]] name = "multiversx-sc-modules" -version = "0.51.1" +version = "0.52.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "16af268784dff8a34cb696605413c325253da793d85f81b00dcb0e66f82963c9" +checksum = "1aca2fbccb7cd84f3c4d7a13c78d90fac484bf9cab30ed73c9b5f5e31f513b6f" dependencies = [ "multiversx-sc", ] [[package]] name = "multiversx-sc-wasm-adapter" -version = "0.51.1" +version = "0.52.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b2f0d6be22f911ce45427491a9bec94612a1678eab2769dd08c9c9731d13da53" +checksum = "bbb8f0bf218a2e3f02d37c3112fd099bdd72d307e69e97b4773fa8c16bf6ab87" dependencies = [ "multiversx-sc", ] @@ -242,9 +242,9 @@ checksum = "3c5e1a9a646d36c3599cd173a41282daf47c44583ad367b8e6837255952e5c67" [[package]] name = "syn" -version = "2.0.68" +version = "2.0.72" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "901fa70d88b9d6c98022e23b4136f9f3e54e4662c3bc1bd1d84a42a9a0f0c1e9" +checksum = "dc4b9b9bf2add8093d3f2c0204471e951b2285580335de42f9d2534f3ae7a8af" dependencies = [ "proc-macro2", "quote", diff --git a/esdt-safe/wasm-esdt-safe-view/Cargo.toml b/esdt-safe/wasm-esdt-safe-view/Cargo.toml index 9a8bf4bc..f813f824 100644 --- a/esdt-safe/wasm-esdt-safe-view/Cargo.toml +++ b/esdt-safe/wasm-esdt-safe-view/Cargo.toml @@ -28,7 +28,7 @@ panic = "abort" path = ".." [dependencies.multiversx-sc-wasm-adapter] -version = "=0.51.1" +version = "=0.52.0" [workspace] members = ["."] diff --git a/esdt-safe/wasm/Cargo.lock b/esdt-safe/wasm/Cargo.lock index b9e789ac..2d554e53 100644 --- a/esdt-safe/wasm/Cargo.lock +++ b/esdt-safe/wasm/Cargo.lock @@ -101,9 +101,9 @@ dependencies = [ [[package]] name = "multiversx-sc" -version = "0.51.1" +version = "0.52.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "236f7890b2208796df8b5ac73b8572ffaf5e2b1531c7ad549d669328b715b657" +checksum = "31bcb4dc736ef975b59878720de1c731788aa1a5a197888606e7d3d6600b1925" dependencies = [ "bitflags", "hex-literal", @@ -115,9 +115,9 @@ dependencies = [ [[package]] name = "multiversx-sc-codec" -version = "0.20.0" +version = "0.20.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fcecd449ea708b72f92edaa17158fe4859c1780aed9b52b14de45f26124ccb8b" +checksum = "ad4f318427761faecf26c1f3115a3beeb5f61858845a60547d9763aa981ddd2d" dependencies = [ "arrayvec", "multiversx-sc-codec-derive", @@ -126,9 +126,9 @@ dependencies = [ [[package]] name = "multiversx-sc-codec-derive" -version = "0.20.0" +version = "0.20.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "68f7fa25402e5e8054d719951289306fd79e481f7c21b2565b5549b6bc359772" +checksum = "476501462b0c2654b64f9dec6f2c480e24b4e9b7133ec10b7167e64acda35d04" dependencies = [ "hex", "proc-macro2", @@ -138,9 +138,9 @@ dependencies = [ [[package]] name = "multiversx-sc-derive" -version = "0.51.1" +version = "0.52.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eb683bc78d0e2eb43c16cac790144f53cc2ab27912aeb1484433895742ce698d" +checksum = "ae92e4121bad55ffc476028c25722bc01ba989b4953837fb7f4b6be9dba398ed" dependencies = [ "hex", "proc-macro2", @@ -151,18 +151,18 @@ dependencies = [ [[package]] name = "multiversx-sc-modules" -version = "0.51.1" +version = "0.52.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "16af268784dff8a34cb696605413c325253da793d85f81b00dcb0e66f82963c9" +checksum = "1aca2fbccb7cd84f3c4d7a13c78d90fac484bf9cab30ed73c9b5f5e31f513b6f" dependencies = [ "multiversx-sc", ] [[package]] name = "multiversx-sc-wasm-adapter" -version = "0.51.1" +version = "0.52.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b2f0d6be22f911ce45427491a9bec94612a1678eab2769dd08c9c9731d13da53" +checksum = "bbb8f0bf218a2e3f02d37c3112fd099bdd72d307e69e97b4773fa8c16bf6ab87" dependencies = [ "multiversx-sc", ] @@ -242,9 +242,9 @@ checksum = "3c5e1a9a646d36c3599cd173a41282daf47c44583ad367b8e6837255952e5c67" [[package]] name = "syn" -version = "2.0.68" +version = "2.0.72" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "901fa70d88b9d6c98022e23b4136f9f3e54e4662c3bc1bd1d84a42a9a0f0c1e9" +checksum = "dc4b9b9bf2add8093d3f2c0204471e951b2285580335de42f9d2534f3ae7a8af" dependencies = [ "proc-macro2", "quote", diff --git a/esdt-safe/wasm/Cargo.toml b/esdt-safe/wasm/Cargo.toml index 85d6a0ab..6bbf37eb 100644 --- a/esdt-safe/wasm/Cargo.toml +++ b/esdt-safe/wasm/Cargo.toml @@ -28,7 +28,7 @@ panic = "abort" path = ".." [dependencies.multiversx-sc-wasm-adapter] -version = "=0.51.1" +version = "=0.52.0" [workspace] members = ["."] diff --git a/fee-market/Cargo.toml b/fee-market/Cargo.toml index 2a971578..1296fcb4 100644 --- a/fee-market/Cargo.toml +++ b/fee-market/Cargo.toml @@ -24,10 +24,10 @@ path = "../pair-mock" path = "../router-mock" [dependencies.multiversx-sc] -version = "=0.51.1" +version = "=0.52.0" [dev-dependencies] num-bigint = "0.4.2" [dev-dependencies.multiversx-sc-scenario] -version = "=0.51.1" +version = "=0.52.0" diff --git a/fee-market/meta/Cargo.toml b/fee-market/meta/Cargo.toml index 8625fe32..e2b4d125 100644 --- a/fee-market/meta/Cargo.toml +++ b/fee-market/meta/Cargo.toml @@ -8,5 +8,5 @@ publish = false path = ".." [dependencies.multiversx-sc-meta-lib] -version = "=0.51.1" +version = "=0.52.0" default-features = false diff --git a/fee-market/wasm-fee-marker-full/Cargo.lock b/fee-market/wasm-fee-marker-full/Cargo.lock index d86c3bdd..2e11189f 100644 --- a/fee-market/wasm-fee-marker-full/Cargo.lock +++ b/fee-market/wasm-fee-marker-full/Cargo.lock @@ -68,9 +68,9 @@ checksum = "6fe2267d4ed49bc07b63801559be28c718ea06c4738b7a03c94df7386d2cde46" [[package]] name = "multiversx-sc" -version = "0.51.1" +version = "0.52.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "236f7890b2208796df8b5ac73b8572ffaf5e2b1531c7ad549d669328b715b657" +checksum = "31bcb4dc736ef975b59878720de1c731788aa1a5a197888606e7d3d6600b1925" dependencies = [ "bitflags", "hex-literal", @@ -82,9 +82,9 @@ dependencies = [ [[package]] name = "multiversx-sc-codec" -version = "0.20.0" +version = "0.20.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fcecd449ea708b72f92edaa17158fe4859c1780aed9b52b14de45f26124ccb8b" +checksum = "ad4f318427761faecf26c1f3115a3beeb5f61858845a60547d9763aa981ddd2d" dependencies = [ "arrayvec", "multiversx-sc-codec-derive", @@ -93,9 +93,9 @@ dependencies = [ [[package]] name = "multiversx-sc-codec-derive" -version = "0.20.0" +version = "0.20.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "68f7fa25402e5e8054d719951289306fd79e481f7c21b2565b5549b6bc359772" +checksum = "476501462b0c2654b64f9dec6f2c480e24b4e9b7133ec10b7167e64acda35d04" dependencies = [ "hex", "proc-macro2", @@ -105,9 +105,9 @@ dependencies = [ [[package]] name = "multiversx-sc-derive" -version = "0.51.1" +version = "0.52.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eb683bc78d0e2eb43c16cac790144f53cc2ab27912aeb1484433895742ce698d" +checksum = "ae92e4121bad55ffc476028c25722bc01ba989b4953837fb7f4b6be9dba398ed" dependencies = [ "hex", "proc-macro2", @@ -118,9 +118,9 @@ dependencies = [ [[package]] name = "multiversx-sc-wasm-adapter" -version = "0.51.1" +version = "0.52.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b2f0d6be22f911ce45427491a9bec94612a1678eab2769dd08c9c9731d13da53" +checksum = "bbb8f0bf218a2e3f02d37c3112fd099bdd72d307e69e97b4773fa8c16bf6ab87" dependencies = [ "multiversx-sc", ] @@ -193,9 +193,9 @@ checksum = "3c5e1a9a646d36c3599cd173a41282daf47c44583ad367b8e6837255952e5c67" [[package]] name = "syn" -version = "2.0.68" +version = "2.0.72" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "901fa70d88b9d6c98022e23b4136f9f3e54e4662c3bc1bd1d84a42a9a0f0c1e9" +checksum = "dc4b9b9bf2add8093d3f2c0204471e951b2285580335de42f9d2534f3ae7a8af" dependencies = [ "proc-macro2", "quote", diff --git a/fee-market/wasm-fee-marker-full/Cargo.toml b/fee-market/wasm-fee-marker-full/Cargo.toml index e5dd8492..96dea3d5 100644 --- a/fee-market/wasm-fee-marker-full/Cargo.toml +++ b/fee-market/wasm-fee-marker-full/Cargo.toml @@ -28,7 +28,7 @@ panic = "abort" path = ".." [dependencies.multiversx-sc-wasm-adapter] -version = "=0.51.1" +version = "=0.52.0" [workspace] members = ["."] diff --git a/fee-market/wasm-multisig-view/Cargo.lock b/fee-market/wasm-multisig-view/Cargo.lock index 0daf4b2f..73140ef8 100644 --- a/fee-market/wasm-multisig-view/Cargo.lock +++ b/fee-market/wasm-multisig-view/Cargo.lock @@ -68,9 +68,9 @@ dependencies = [ [[package]] name = "multiversx-sc" -version = "0.51.1" +version = "0.52.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "236f7890b2208796df8b5ac73b8572ffaf5e2b1531c7ad549d669328b715b657" +checksum = "31bcb4dc736ef975b59878720de1c731788aa1a5a197888606e7d3d6600b1925" dependencies = [ "bitflags", "hex-literal", @@ -82,9 +82,9 @@ dependencies = [ [[package]] name = "multiversx-sc-codec" -version = "0.20.0" +version = "0.20.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fcecd449ea708b72f92edaa17158fe4859c1780aed9b52b14de45f26124ccb8b" +checksum = "ad4f318427761faecf26c1f3115a3beeb5f61858845a60547d9763aa981ddd2d" dependencies = [ "arrayvec", "multiversx-sc-codec-derive", @@ -93,9 +93,9 @@ dependencies = [ [[package]] name = "multiversx-sc-codec-derive" -version = "0.20.0" +version = "0.20.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "68f7fa25402e5e8054d719951289306fd79e481f7c21b2565b5549b6bc359772" +checksum = "476501462b0c2654b64f9dec6f2c480e24b4e9b7133ec10b7167e64acda35d04" dependencies = [ "hex", "proc-macro2", @@ -105,9 +105,9 @@ dependencies = [ [[package]] name = "multiversx-sc-derive" -version = "0.51.1" +version = "0.52.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eb683bc78d0e2eb43c16cac790144f53cc2ab27912aeb1484433895742ce698d" +checksum = "ae92e4121bad55ffc476028c25722bc01ba989b4953837fb7f4b6be9dba398ed" dependencies = [ "hex", "proc-macro2", @@ -118,9 +118,9 @@ dependencies = [ [[package]] name = "multiversx-sc-wasm-adapter" -version = "0.51.1" +version = "0.52.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b2f0d6be22f911ce45427491a9bec94612a1678eab2769dd08c9c9731d13da53" +checksum = "bbb8f0bf218a2e3f02d37c3112fd099bdd72d307e69e97b4773fa8c16bf6ab87" dependencies = [ "multiversx-sc", ] @@ -193,9 +193,9 @@ checksum = "3c5e1a9a646d36c3599cd173a41282daf47c44583ad367b8e6837255952e5c67" [[package]] name = "syn" -version = "2.0.68" +version = "2.0.72" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "901fa70d88b9d6c98022e23b4136f9f3e54e4662c3bc1bd1d84a42a9a0f0c1e9" +checksum = "dc4b9b9bf2add8093d3f2c0204471e951b2285580335de42f9d2534f3ae7a8af" dependencies = [ "proc-macro2", "quote", diff --git a/fee-market/wasm-multisig-view/Cargo.toml b/fee-market/wasm-multisig-view/Cargo.toml index 5b53275a..a94e1b06 100644 --- a/fee-market/wasm-multisig-view/Cargo.toml +++ b/fee-market/wasm-multisig-view/Cargo.toml @@ -28,7 +28,7 @@ panic = "abort" path = ".." [dependencies.multiversx-sc-wasm-adapter] -version = "=0.51.1" +version = "=0.52.0" [workspace] members = ["."] diff --git a/fee-market/wasm/Cargo.lock b/fee-market/wasm/Cargo.lock index 473bedd6..faf454e5 100644 --- a/fee-market/wasm/Cargo.lock +++ b/fee-market/wasm/Cargo.lock @@ -68,9 +68,9 @@ checksum = "6fe2267d4ed49bc07b63801559be28c718ea06c4738b7a03c94df7386d2cde46" [[package]] name = "multiversx-sc" -version = "0.51.1" +version = "0.52.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "236f7890b2208796df8b5ac73b8572ffaf5e2b1531c7ad549d669328b715b657" +checksum = "31bcb4dc736ef975b59878720de1c731788aa1a5a197888606e7d3d6600b1925" dependencies = [ "bitflags", "hex-literal", @@ -82,9 +82,9 @@ dependencies = [ [[package]] name = "multiversx-sc-codec" -version = "0.20.0" +version = "0.20.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fcecd449ea708b72f92edaa17158fe4859c1780aed9b52b14de45f26124ccb8b" +checksum = "ad4f318427761faecf26c1f3115a3beeb5f61858845a60547d9763aa981ddd2d" dependencies = [ "arrayvec", "multiversx-sc-codec-derive", @@ -93,9 +93,9 @@ dependencies = [ [[package]] name = "multiversx-sc-codec-derive" -version = "0.20.0" +version = "0.20.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "68f7fa25402e5e8054d719951289306fd79e481f7c21b2565b5549b6bc359772" +checksum = "476501462b0c2654b64f9dec6f2c480e24b4e9b7133ec10b7167e64acda35d04" dependencies = [ "hex", "proc-macro2", @@ -105,9 +105,9 @@ dependencies = [ [[package]] name = "multiversx-sc-derive" -version = "0.51.1" +version = "0.52.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eb683bc78d0e2eb43c16cac790144f53cc2ab27912aeb1484433895742ce698d" +checksum = "ae92e4121bad55ffc476028c25722bc01ba989b4953837fb7f4b6be9dba398ed" dependencies = [ "hex", "proc-macro2", @@ -118,9 +118,9 @@ dependencies = [ [[package]] name = "multiversx-sc-wasm-adapter" -version = "0.51.1" +version = "0.52.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b2f0d6be22f911ce45427491a9bec94612a1678eab2769dd08c9c9731d13da53" +checksum = "bbb8f0bf218a2e3f02d37c3112fd099bdd72d307e69e97b4773fa8c16bf6ab87" dependencies = [ "multiversx-sc", ] @@ -193,9 +193,9 @@ checksum = "3c5e1a9a646d36c3599cd173a41282daf47c44583ad367b8e6837255952e5c67" [[package]] name = "syn" -version = "2.0.68" +version = "2.0.72" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "901fa70d88b9d6c98022e23b4136f9f3e54e4662c3bc1bd1d84a42a9a0f0c1e9" +checksum = "dc4b9b9bf2add8093d3f2c0204471e951b2285580335de42f9d2534f3ae7a8af" dependencies = [ "proc-macro2", "quote", diff --git a/fee-market/wasm/Cargo.toml b/fee-market/wasm/Cargo.toml index ef37bca1..4b496b75 100644 --- a/fee-market/wasm/Cargo.toml +++ b/fee-market/wasm/Cargo.toml @@ -28,7 +28,7 @@ panic = "abort" path = ".." [dependencies.multiversx-sc-wasm-adapter] -version = "=0.51.1" +version = "=0.52.0" [workspace] members = ["."] diff --git a/header-verifier/Cargo.toml b/header-verifier/Cargo.toml index ce5901a5..d017af4a 100644 --- a/header-verifier/Cargo.toml +++ b/header-verifier/Cargo.toml @@ -9,7 +9,7 @@ publish = false path = "src/lib.rs" [dependencies.multiversx-sc] -version = "0.51.1" +version = "0.52.0" [dependencies.bls-signature] path = "../common/bls-signature" @@ -21,4 +21,4 @@ path = "../common/transaction" num-bigint = "0.4.2" [dev-dependencies.multiversx-sc-scenario] -version = "0.51.1" +version = "0.52.0" diff --git a/header-verifier/meta/Cargo.toml b/header-verifier/meta/Cargo.toml index 2758e4c9..e1844a7f 100644 --- a/header-verifier/meta/Cargo.toml +++ b/header-verifier/meta/Cargo.toml @@ -8,5 +8,5 @@ publish = false path = ".." [dependencies.multiversx-sc-meta-lib] -version = "0.51.1" +version = "0.52.0" default-features = false diff --git a/header-verifier/wasm-header-verifier-full/Cargo.lock b/header-verifier/wasm-header-verifier-full/Cargo.lock index 06de2fdf..43d6c763 100644 --- a/header-verifier/wasm-header-verifier-full/Cargo.lock +++ b/header-verifier/wasm-header-verifier-full/Cargo.lock @@ -65,9 +65,9 @@ checksum = "6fe2267d4ed49bc07b63801559be28c718ea06c4738b7a03c94df7386d2cde46" [[package]] name = "multiversx-sc" -version = "0.51.1" +version = "0.52.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "236f7890b2208796df8b5ac73b8572ffaf5e2b1531c7ad549d669328b715b657" +checksum = "31bcb4dc736ef975b59878720de1c731788aa1a5a197888606e7d3d6600b1925" dependencies = [ "bitflags", "hex-literal", @@ -79,9 +79,9 @@ dependencies = [ [[package]] name = "multiversx-sc-codec" -version = "0.20.0" +version = "0.20.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fcecd449ea708b72f92edaa17158fe4859c1780aed9b52b14de45f26124ccb8b" +checksum = "ad4f318427761faecf26c1f3115a3beeb5f61858845a60547d9763aa981ddd2d" dependencies = [ "arrayvec", "multiversx-sc-codec-derive", @@ -90,9 +90,9 @@ dependencies = [ [[package]] name = "multiversx-sc-codec-derive" -version = "0.20.0" +version = "0.20.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "68f7fa25402e5e8054d719951289306fd79e481f7c21b2565b5549b6bc359772" +checksum = "476501462b0c2654b64f9dec6f2c480e24b4e9b7133ec10b7167e64acda35d04" dependencies = [ "hex", "proc-macro2", @@ -102,9 +102,9 @@ dependencies = [ [[package]] name = "multiversx-sc-derive" -version = "0.51.1" +version = "0.52.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eb683bc78d0e2eb43c16cac790144f53cc2ab27912aeb1484433895742ce698d" +checksum = "ae92e4121bad55ffc476028c25722bc01ba989b4953837fb7f4b6be9dba398ed" dependencies = [ "hex", "proc-macro2", @@ -115,9 +115,9 @@ dependencies = [ [[package]] name = "multiversx-sc-wasm-adapter" -version = "0.51.1" +version = "0.52.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b2f0d6be22f911ce45427491a9bec94612a1678eab2769dd08c9c9731d13da53" +checksum = "bbb8f0bf218a2e3f02d37c3112fd099bdd72d307e69e97b4773fa8c16bf6ab87" dependencies = [ "multiversx-sc", ] @@ -176,9 +176,9 @@ checksum = "3c5e1a9a646d36c3599cd173a41282daf47c44583ad367b8e6837255952e5c67" [[package]] name = "syn" -version = "2.0.68" +version = "2.0.72" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "901fa70d88b9d6c98022e23b4136f9f3e54e4662c3bc1bd1d84a42a9a0f0c1e9" +checksum = "dc4b9b9bf2add8093d3f2c0204471e951b2285580335de42f9d2534f3ae7a8af" dependencies = [ "proc-macro2", "quote", diff --git a/header-verifier/wasm-header-verifier-full/Cargo.toml b/header-verifier/wasm-header-verifier-full/Cargo.toml index 58458b66..82108857 100644 --- a/header-verifier/wasm-header-verifier-full/Cargo.toml +++ b/header-verifier/wasm-header-verifier-full/Cargo.toml @@ -28,7 +28,7 @@ panic = "abort" path = ".." [dependencies.multiversx-sc-wasm-adapter] -version = "0.51.1" +version = "0.52.0" [workspace] members = ["."] diff --git a/header-verifier/wasm-multisig-view/Cargo.lock b/header-verifier/wasm-multisig-view/Cargo.lock index 71231a21..9cce39ba 100644 --- a/header-verifier/wasm-multisig-view/Cargo.lock +++ b/header-verifier/wasm-multisig-view/Cargo.lock @@ -65,9 +65,9 @@ dependencies = [ [[package]] name = "multiversx-sc" -version = "0.51.1" +version = "0.52.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "236f7890b2208796df8b5ac73b8572ffaf5e2b1531c7ad549d669328b715b657" +checksum = "31bcb4dc736ef975b59878720de1c731788aa1a5a197888606e7d3d6600b1925" dependencies = [ "bitflags", "hex-literal", @@ -79,9 +79,9 @@ dependencies = [ [[package]] name = "multiversx-sc-codec" -version = "0.20.0" +version = "0.20.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fcecd449ea708b72f92edaa17158fe4859c1780aed9b52b14de45f26124ccb8b" +checksum = "ad4f318427761faecf26c1f3115a3beeb5f61858845a60547d9763aa981ddd2d" dependencies = [ "arrayvec", "multiversx-sc-codec-derive", @@ -90,9 +90,9 @@ dependencies = [ [[package]] name = "multiversx-sc-codec-derive" -version = "0.20.0" +version = "0.20.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "68f7fa25402e5e8054d719951289306fd79e481f7c21b2565b5549b6bc359772" +checksum = "476501462b0c2654b64f9dec6f2c480e24b4e9b7133ec10b7167e64acda35d04" dependencies = [ "hex", "proc-macro2", @@ -102,9 +102,9 @@ dependencies = [ [[package]] name = "multiversx-sc-derive" -version = "0.51.1" +version = "0.52.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eb683bc78d0e2eb43c16cac790144f53cc2ab27912aeb1484433895742ce698d" +checksum = "ae92e4121bad55ffc476028c25722bc01ba989b4953837fb7f4b6be9dba398ed" dependencies = [ "hex", "proc-macro2", @@ -115,9 +115,9 @@ dependencies = [ [[package]] name = "multiversx-sc-wasm-adapter" -version = "0.51.1" +version = "0.52.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b2f0d6be22f911ce45427491a9bec94612a1678eab2769dd08c9c9731d13da53" +checksum = "bbb8f0bf218a2e3f02d37c3112fd099bdd72d307e69e97b4773fa8c16bf6ab87" dependencies = [ "multiversx-sc", ] @@ -176,9 +176,9 @@ checksum = "3c5e1a9a646d36c3599cd173a41282daf47c44583ad367b8e6837255952e5c67" [[package]] name = "syn" -version = "2.0.68" +version = "2.0.72" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "901fa70d88b9d6c98022e23b4136f9f3e54e4662c3bc1bd1d84a42a9a0f0c1e9" +checksum = "dc4b9b9bf2add8093d3f2c0204471e951b2285580335de42f9d2534f3ae7a8af" dependencies = [ "proc-macro2", "quote", diff --git a/header-verifier/wasm-multisig-view/Cargo.toml b/header-verifier/wasm-multisig-view/Cargo.toml index ae13b76d..3734afa1 100644 --- a/header-verifier/wasm-multisig-view/Cargo.toml +++ b/header-verifier/wasm-multisig-view/Cargo.toml @@ -28,7 +28,7 @@ panic = "abort" path = ".." [dependencies.multiversx-sc-wasm-adapter] -version = "0.51.1" +version = "0.52.0" [workspace] members = ["."] diff --git a/header-verifier/wasm/Cargo.lock b/header-verifier/wasm/Cargo.lock index 3f7bdd6b..efcb7d38 100644 --- a/header-verifier/wasm/Cargo.lock +++ b/header-verifier/wasm/Cargo.lock @@ -65,9 +65,9 @@ checksum = "6fe2267d4ed49bc07b63801559be28c718ea06c4738b7a03c94df7386d2cde46" [[package]] name = "multiversx-sc" -version = "0.51.1" +version = "0.52.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "236f7890b2208796df8b5ac73b8572ffaf5e2b1531c7ad549d669328b715b657" +checksum = "31bcb4dc736ef975b59878720de1c731788aa1a5a197888606e7d3d6600b1925" dependencies = [ "bitflags", "hex-literal", @@ -79,9 +79,9 @@ dependencies = [ [[package]] name = "multiversx-sc-codec" -version = "0.20.0" +version = "0.20.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fcecd449ea708b72f92edaa17158fe4859c1780aed9b52b14de45f26124ccb8b" +checksum = "ad4f318427761faecf26c1f3115a3beeb5f61858845a60547d9763aa981ddd2d" dependencies = [ "arrayvec", "multiversx-sc-codec-derive", @@ -90,9 +90,9 @@ dependencies = [ [[package]] name = "multiversx-sc-codec-derive" -version = "0.20.0" +version = "0.20.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "68f7fa25402e5e8054d719951289306fd79e481f7c21b2565b5549b6bc359772" +checksum = "476501462b0c2654b64f9dec6f2c480e24b4e9b7133ec10b7167e64acda35d04" dependencies = [ "hex", "proc-macro2", @@ -102,9 +102,9 @@ dependencies = [ [[package]] name = "multiversx-sc-derive" -version = "0.51.1" +version = "0.52.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eb683bc78d0e2eb43c16cac790144f53cc2ab27912aeb1484433895742ce698d" +checksum = "ae92e4121bad55ffc476028c25722bc01ba989b4953837fb7f4b6be9dba398ed" dependencies = [ "hex", "proc-macro2", @@ -115,9 +115,9 @@ dependencies = [ [[package]] name = "multiversx-sc-wasm-adapter" -version = "0.51.1" +version = "0.52.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b2f0d6be22f911ce45427491a9bec94612a1678eab2769dd08c9c9731d13da53" +checksum = "bbb8f0bf218a2e3f02d37c3112fd099bdd72d307e69e97b4773fa8c16bf6ab87" dependencies = [ "multiversx-sc", ] @@ -176,9 +176,9 @@ checksum = "3c5e1a9a646d36c3599cd173a41282daf47c44583ad367b8e6837255952e5c67" [[package]] name = "syn" -version = "2.0.68" +version = "2.0.72" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "901fa70d88b9d6c98022e23b4136f9f3e54e4662c3bc1bd1d84a42a9a0f0c1e9" +checksum = "dc4b9b9bf2add8093d3f2c0204471e951b2285580335de42f9d2534f3ae7a8af" dependencies = [ "proc-macro2", "quote", diff --git a/header-verifier/wasm/Cargo.toml b/header-verifier/wasm/Cargo.toml index 769535b3..e0da32e6 100644 --- a/header-verifier/wasm/Cargo.toml +++ b/header-verifier/wasm/Cargo.toml @@ -28,7 +28,7 @@ panic = "abort" path = ".." [dependencies.multiversx-sc-wasm-adapter] -version = "0.51.1" +version = "0.52.0" [workspace] members = ["."] diff --git a/pair-mock/Cargo.toml b/pair-mock/Cargo.toml index e0ea6ae1..c80b4137 100644 --- a/pair-mock/Cargo.toml +++ b/pair-mock/Cargo.toml @@ -9,10 +9,10 @@ publish = false path = "src/pair_mock.rs" [dependencies.multiversx-sc] -version = "0.51.1" +version = "0.52.0" [dev-dependencies] num-bigint = "0.4" [dev-dependencies.multiversx-sc-scenario] -version = "0.51.1" +version = "0.52.0" diff --git a/pair-mock/meta/Cargo.toml b/pair-mock/meta/Cargo.toml index 4aedd584..3d453ea8 100644 --- a/pair-mock/meta/Cargo.toml +++ b/pair-mock/meta/Cargo.toml @@ -8,5 +8,5 @@ publish = false path = ".." [dependencies.multiversx-sc-meta-lib] -version = "0.51.1" +version = "0.52.0" default-features = false diff --git a/pair-mock/wasm/Cargo.lock b/pair-mock/wasm/Cargo.lock index c30e0685..1f10731c 100644 --- a/pair-mock/wasm/Cargo.lock +++ b/pair-mock/wasm/Cargo.lock @@ -40,9 +40,9 @@ checksum = "6fe2267d4ed49bc07b63801559be28c718ea06c4738b7a03c94df7386d2cde46" [[package]] name = "multiversx-sc" -version = "0.51.1" +version = "0.52.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "236f7890b2208796df8b5ac73b8572ffaf5e2b1531c7ad549d669328b715b657" +checksum = "31bcb4dc736ef975b59878720de1c731788aa1a5a197888606e7d3d6600b1925" dependencies = [ "bitflags", "hex-literal", @@ -54,9 +54,9 @@ dependencies = [ [[package]] name = "multiversx-sc-codec" -version = "0.20.0" +version = "0.20.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fcecd449ea708b72f92edaa17158fe4859c1780aed9b52b14de45f26124ccb8b" +checksum = "ad4f318427761faecf26c1f3115a3beeb5f61858845a60547d9763aa981ddd2d" dependencies = [ "arrayvec", "multiversx-sc-codec-derive", @@ -65,9 +65,9 @@ dependencies = [ [[package]] name = "multiversx-sc-codec-derive" -version = "0.20.0" +version = "0.20.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "68f7fa25402e5e8054d719951289306fd79e481f7c21b2565b5549b6bc359772" +checksum = "476501462b0c2654b64f9dec6f2c480e24b4e9b7133ec10b7167e64acda35d04" dependencies = [ "hex", "proc-macro2", @@ -77,9 +77,9 @@ dependencies = [ [[package]] name = "multiversx-sc-derive" -version = "0.51.1" +version = "0.52.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eb683bc78d0e2eb43c16cac790144f53cc2ab27912aeb1484433895742ce698d" +checksum = "ae92e4121bad55ffc476028c25722bc01ba989b4953837fb7f4b6be9dba398ed" dependencies = [ "hex", "proc-macro2", @@ -90,9 +90,9 @@ dependencies = [ [[package]] name = "multiversx-sc-wasm-adapter" -version = "0.51.1" +version = "0.52.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b2f0d6be22f911ce45427491a9bec94612a1678eab2769dd08c9c9731d13da53" +checksum = "bbb8f0bf218a2e3f02d37c3112fd099bdd72d307e69e97b4773fa8c16bf6ab87" dependencies = [ "multiversx-sc", ] @@ -166,9 +166,9 @@ checksum = "3c5e1a9a646d36c3599cd173a41282daf47c44583ad367b8e6837255952e5c67" [[package]] name = "syn" -version = "2.0.68" +version = "2.0.72" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "901fa70d88b9d6c98022e23b4136f9f3e54e4662c3bc1bd1d84a42a9a0f0c1e9" +checksum = "dc4b9b9bf2add8093d3f2c0204471e951b2285580335de42f9d2534f3ae7a8af" dependencies = [ "proc-macro2", "quote", diff --git a/pair-mock/wasm/Cargo.toml b/pair-mock/wasm/Cargo.toml index 7311470b..dc1b6a59 100644 --- a/pair-mock/wasm/Cargo.toml +++ b/pair-mock/wasm/Cargo.toml @@ -28,7 +28,7 @@ panic = "abort" path = ".." [dependencies.multiversx-sc-wasm-adapter] -version = "0.51.1" +version = "0.52.0" [workspace] members = ["."] diff --git a/router-mock/Cargo.toml b/router-mock/Cargo.toml index d8738601..a97c8b0d 100644 --- a/router-mock/Cargo.toml +++ b/router-mock/Cargo.toml @@ -9,10 +9,10 @@ publish = false path = "src/router_mock.rs" [dependencies.multiversx-sc] -version = "0.51.1" +version = "0.52.0" [dev-dependencies] num-bigint = "0.4" [dev-dependencies.multiversx-sc-scenario] -version = "0.51.1" +version = "0.52.0" diff --git a/router-mock/meta/Cargo.toml b/router-mock/meta/Cargo.toml index 76847b8d..57071012 100644 --- a/router-mock/meta/Cargo.toml +++ b/router-mock/meta/Cargo.toml @@ -8,5 +8,5 @@ publish = false path = ".." [dependencies.multiversx-sc-meta-lib] -version = "0.51.1" +version = "0.52.0" default-features = false diff --git a/router-mock/wasm/Cargo.lock b/router-mock/wasm/Cargo.lock index b3023fdc..b6a7beff 100644 --- a/router-mock/wasm/Cargo.lock +++ b/router-mock/wasm/Cargo.lock @@ -40,9 +40,9 @@ checksum = "6fe2267d4ed49bc07b63801559be28c718ea06c4738b7a03c94df7386d2cde46" [[package]] name = "multiversx-sc" -version = "0.51.1" +version = "0.52.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "236f7890b2208796df8b5ac73b8572ffaf5e2b1531c7ad549d669328b715b657" +checksum = "31bcb4dc736ef975b59878720de1c731788aa1a5a197888606e7d3d6600b1925" dependencies = [ "bitflags", "hex-literal", @@ -54,9 +54,9 @@ dependencies = [ [[package]] name = "multiversx-sc-codec" -version = "0.20.0" +version = "0.20.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fcecd449ea708b72f92edaa17158fe4859c1780aed9b52b14de45f26124ccb8b" +checksum = "ad4f318427761faecf26c1f3115a3beeb5f61858845a60547d9763aa981ddd2d" dependencies = [ "arrayvec", "multiversx-sc-codec-derive", @@ -65,9 +65,9 @@ dependencies = [ [[package]] name = "multiversx-sc-codec-derive" -version = "0.20.0" +version = "0.20.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "68f7fa25402e5e8054d719951289306fd79e481f7c21b2565b5549b6bc359772" +checksum = "476501462b0c2654b64f9dec6f2c480e24b4e9b7133ec10b7167e64acda35d04" dependencies = [ "hex", "proc-macro2", @@ -77,9 +77,9 @@ dependencies = [ [[package]] name = "multiversx-sc-derive" -version = "0.51.1" +version = "0.52.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eb683bc78d0e2eb43c16cac790144f53cc2ab27912aeb1484433895742ce698d" +checksum = "ae92e4121bad55ffc476028c25722bc01ba989b4953837fb7f4b6be9dba398ed" dependencies = [ "hex", "proc-macro2", @@ -90,9 +90,9 @@ dependencies = [ [[package]] name = "multiversx-sc-wasm-adapter" -version = "0.51.1" +version = "0.52.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b2f0d6be22f911ce45427491a9bec94612a1678eab2769dd08c9c9731d13da53" +checksum = "bbb8f0bf218a2e3f02d37c3112fd099bdd72d307e69e97b4773fa8c16bf6ab87" dependencies = [ "multiversx-sc", ] @@ -166,9 +166,9 @@ checksum = "3c5e1a9a646d36c3599cd173a41282daf47c44583ad367b8e6837255952e5c67" [[package]] name = "syn" -version = "2.0.68" +version = "2.0.72" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "901fa70d88b9d6c98022e23b4136f9f3e54e4662c3bc1bd1d84a42a9a0f0c1e9" +checksum = "dc4b9b9bf2add8093d3f2c0204471e951b2285580335de42f9d2534f3ae7a8af" dependencies = [ "proc-macro2", "quote", diff --git a/router-mock/wasm/Cargo.toml b/router-mock/wasm/Cargo.toml index 32eee391..2984bd64 100644 --- a/router-mock/wasm/Cargo.toml +++ b/router-mock/wasm/Cargo.toml @@ -28,7 +28,7 @@ panic = "abort" path = ".." [dependencies.multiversx-sc-wasm-adapter] -version = "0.51.1" +version = "0.52.0" [workspace] members = ["."] From febd2ece7ccaf7f4e754a314db72aa42ea23aa20 Mon Sep 17 00:00:00 2001 From: Andrei Baltariu Date: Wed, 31 Jul 2024 13:21:53 +0300 Subject: [PATCH 216/523] Switched types for tokens Signed-off-by: Andrei Baltariu --- enshrine-esdt-safe/src/from_sovereign/transfer_tokens.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/enshrine-esdt-safe/src/from_sovereign/transfer_tokens.rs b/enshrine-esdt-safe/src/from_sovereign/transfer_tokens.rs index bfc06c46..6272e59d 100644 --- a/enshrine-esdt-safe/src/from_sovereign/transfer_tokens.rs +++ b/enshrine-esdt-safe/src/from_sovereign/transfer_tokens.rs @@ -35,7 +35,7 @@ pub trait TransferTokensModule: sc_panic!("Operation is not registered"); } - let (sov_tokens, non_sov_tokens, are_tokens_registered) = + let (non_sov_tokens, sov_tokens, are_tokens_registered) = self.split_payments_for_prefix_and_fee(&operation.tokens); if !are_tokens_registered { @@ -49,7 +49,7 @@ pub trait TransferTokensModule: let token_handler_address = self.token_handler_address().get(); let multi_value_tokens: MultiValueEncoded> = - non_sov_tokens.into(); + sov_tokens.into(); self.tx() .to(token_handler_address) @@ -59,7 +59,7 @@ pub trait TransferTokensModule: operation.to, multi_value_tokens, ) - .multi_esdt(sov_tokens) + .multi_esdt(non_sov_tokens) .sync_call(); self.remove_executed_hash(&hash_of_hashes, &op_hash); From ca7d20750d77994f48966d1a0d8a2b17c0f8c105 Mon Sep 17 00:00:00 2001 From: Andrei Baltariu Date: Wed, 31 Jul 2024 13:26:33 +0300 Subject: [PATCH 217/523] Framework upgrade Signed-off-by: Andrei Baltariu --- token-handler/Cargo.toml | 4 ++-- token-handler/meta/Cargo.toml | 2 +- .../wasm-token-handler-full/Cargo.lock | 24 +++++++++---------- .../wasm-token-handler-full/Cargo.toml | 2 +- .../wasm-token-handler-view/Cargo.lock | 24 +++++++++---------- .../wasm-token-handler-view/Cargo.toml | 2 +- token-handler/wasm/Cargo.lock | 24 +++++++++---------- token-handler/wasm/Cargo.toml | 2 +- 8 files changed, 42 insertions(+), 42 deletions(-) diff --git a/token-handler/Cargo.toml b/token-handler/Cargo.toml index 981a20ce..b5c987b2 100644 --- a/token-handler/Cargo.toml +++ b/token-handler/Cargo.toml @@ -18,10 +18,10 @@ path = "../common/transaction" path = "../common/bls-signature/" [dependencies.multiversx-sc] -version = "0.51.1" +version = "0.52.0" [dev-dependencies] num-bigint = "0.4" [dev-dependencies.multiversx-sc-scenario] -version = "0.51.1" +version = "0.52.0" diff --git a/token-handler/meta/Cargo.toml b/token-handler/meta/Cargo.toml index 4a40c246..bacc8236 100644 --- a/token-handler/meta/Cargo.toml +++ b/token-handler/meta/Cargo.toml @@ -8,5 +8,5 @@ publish = false path = ".." [dependencies.multiversx-sc-meta-lib] -version = "0.51.1" +version = "0.52.0" default-features = false diff --git a/token-handler/wasm-token-handler-full/Cargo.lock b/token-handler/wasm-token-handler-full/Cargo.lock index 8fe79e0b..8eb9f7a8 100644 --- a/token-handler/wasm-token-handler-full/Cargo.lock +++ b/token-handler/wasm-token-handler-full/Cargo.lock @@ -48,9 +48,9 @@ checksum = "6fe2267d4ed49bc07b63801559be28c718ea06c4738b7a03c94df7386d2cde46" [[package]] name = "multiversx-sc" -version = "0.51.1" +version = "0.52.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "236f7890b2208796df8b5ac73b8572ffaf5e2b1531c7ad549d669328b715b657" +checksum = "31bcb4dc736ef975b59878720de1c731788aa1a5a197888606e7d3d6600b1925" dependencies = [ "bitflags", "hex-literal", @@ -62,9 +62,9 @@ dependencies = [ [[package]] name = "multiversx-sc-codec" -version = "0.20.0" +version = "0.20.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fcecd449ea708b72f92edaa17158fe4859c1780aed9b52b14de45f26124ccb8b" +checksum = "ad4f318427761faecf26c1f3115a3beeb5f61858845a60547d9763aa981ddd2d" dependencies = [ "arrayvec", "multiversx-sc-codec-derive", @@ -73,9 +73,9 @@ dependencies = [ [[package]] name = "multiversx-sc-codec-derive" -version = "0.20.0" +version = "0.20.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "68f7fa25402e5e8054d719951289306fd79e481f7c21b2565b5549b6bc359772" +checksum = "476501462b0c2654b64f9dec6f2c480e24b4e9b7133ec10b7167e64acda35d04" dependencies = [ "hex", "proc-macro2", @@ -85,9 +85,9 @@ dependencies = [ [[package]] name = "multiversx-sc-derive" -version = "0.51.1" +version = "0.52.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eb683bc78d0e2eb43c16cac790144f53cc2ab27912aeb1484433895742ce698d" +checksum = "ae92e4121bad55ffc476028c25722bc01ba989b4953837fb7f4b6be9dba398ed" dependencies = [ "hex", "proc-macro2", @@ -98,9 +98,9 @@ dependencies = [ [[package]] name = "multiversx-sc-wasm-adapter" -version = "0.51.1" +version = "0.52.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b2f0d6be22f911ce45427491a9bec94612a1678eab2769dd08c9c9731d13da53" +checksum = "bbb8f0bf218a2e3f02d37c3112fd099bdd72d307e69e97b4773fa8c16bf6ab87" dependencies = [ "multiversx-sc", ] @@ -159,9 +159,9 @@ checksum = "3c5e1a9a646d36c3599cd173a41282daf47c44583ad367b8e6837255952e5c67" [[package]] name = "syn" -version = "2.0.68" +version = "2.0.72" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "901fa70d88b9d6c98022e23b4136f9f3e54e4662c3bc1bd1d84a42a9a0f0c1e9" +checksum = "dc4b9b9bf2add8093d3f2c0204471e951b2285580335de42f9d2534f3ae7a8af" dependencies = [ "proc-macro2", "quote", diff --git a/token-handler/wasm-token-handler-full/Cargo.toml b/token-handler/wasm-token-handler-full/Cargo.toml index 1f5fceb0..345c69c4 100644 --- a/token-handler/wasm-token-handler-full/Cargo.toml +++ b/token-handler/wasm-token-handler-full/Cargo.toml @@ -28,7 +28,7 @@ panic = "abort" path = ".." [dependencies.multiversx-sc-wasm-adapter] -version = "0.51.1" +version = "0.52.0" [workspace] members = ["."] diff --git a/token-handler/wasm-token-handler-view/Cargo.lock b/token-handler/wasm-token-handler-view/Cargo.lock index c74b749f..f5c173f9 100644 --- a/token-handler/wasm-token-handler-view/Cargo.lock +++ b/token-handler/wasm-token-handler-view/Cargo.lock @@ -48,9 +48,9 @@ checksum = "6fe2267d4ed49bc07b63801559be28c718ea06c4738b7a03c94df7386d2cde46" [[package]] name = "multiversx-sc" -version = "0.51.1" +version = "0.52.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "236f7890b2208796df8b5ac73b8572ffaf5e2b1531c7ad549d669328b715b657" +checksum = "31bcb4dc736ef975b59878720de1c731788aa1a5a197888606e7d3d6600b1925" dependencies = [ "bitflags", "hex-literal", @@ -62,9 +62,9 @@ dependencies = [ [[package]] name = "multiversx-sc-codec" -version = "0.20.0" +version = "0.20.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fcecd449ea708b72f92edaa17158fe4859c1780aed9b52b14de45f26124ccb8b" +checksum = "ad4f318427761faecf26c1f3115a3beeb5f61858845a60547d9763aa981ddd2d" dependencies = [ "arrayvec", "multiversx-sc-codec-derive", @@ -73,9 +73,9 @@ dependencies = [ [[package]] name = "multiversx-sc-codec-derive" -version = "0.20.0" +version = "0.20.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "68f7fa25402e5e8054d719951289306fd79e481f7c21b2565b5549b6bc359772" +checksum = "476501462b0c2654b64f9dec6f2c480e24b4e9b7133ec10b7167e64acda35d04" dependencies = [ "hex", "proc-macro2", @@ -85,9 +85,9 @@ dependencies = [ [[package]] name = "multiversx-sc-derive" -version = "0.51.1" +version = "0.52.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eb683bc78d0e2eb43c16cac790144f53cc2ab27912aeb1484433895742ce698d" +checksum = "ae92e4121bad55ffc476028c25722bc01ba989b4953837fb7f4b6be9dba398ed" dependencies = [ "hex", "proc-macro2", @@ -98,9 +98,9 @@ dependencies = [ [[package]] name = "multiversx-sc-wasm-adapter" -version = "0.51.1" +version = "0.52.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b2f0d6be22f911ce45427491a9bec94612a1678eab2769dd08c9c9731d13da53" +checksum = "bbb8f0bf218a2e3f02d37c3112fd099bdd72d307e69e97b4773fa8c16bf6ab87" dependencies = [ "multiversx-sc", ] @@ -159,9 +159,9 @@ checksum = "3c5e1a9a646d36c3599cd173a41282daf47c44583ad367b8e6837255952e5c67" [[package]] name = "syn" -version = "2.0.68" +version = "2.0.72" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "901fa70d88b9d6c98022e23b4136f9f3e54e4662c3bc1bd1d84a42a9a0f0c1e9" +checksum = "dc4b9b9bf2add8093d3f2c0204471e951b2285580335de42f9d2534f3ae7a8af" dependencies = [ "proc-macro2", "quote", diff --git a/token-handler/wasm-token-handler-view/Cargo.toml b/token-handler/wasm-token-handler-view/Cargo.toml index 127091ef..b591a177 100644 --- a/token-handler/wasm-token-handler-view/Cargo.toml +++ b/token-handler/wasm-token-handler-view/Cargo.toml @@ -28,7 +28,7 @@ panic = "abort" path = ".." [dependencies.multiversx-sc-wasm-adapter] -version = "0.51.1" +version = "0.52.0" [workspace] members = ["."] diff --git a/token-handler/wasm/Cargo.lock b/token-handler/wasm/Cargo.lock index bbca5a3b..6ff2995f 100644 --- a/token-handler/wasm/Cargo.lock +++ b/token-handler/wasm/Cargo.lock @@ -48,9 +48,9 @@ checksum = "6fe2267d4ed49bc07b63801559be28c718ea06c4738b7a03c94df7386d2cde46" [[package]] name = "multiversx-sc" -version = "0.51.1" +version = "0.52.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "236f7890b2208796df8b5ac73b8572ffaf5e2b1531c7ad549d669328b715b657" +checksum = "31bcb4dc736ef975b59878720de1c731788aa1a5a197888606e7d3d6600b1925" dependencies = [ "bitflags", "hex-literal", @@ -62,9 +62,9 @@ dependencies = [ [[package]] name = "multiversx-sc-codec" -version = "0.20.0" +version = "0.20.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fcecd449ea708b72f92edaa17158fe4859c1780aed9b52b14de45f26124ccb8b" +checksum = "ad4f318427761faecf26c1f3115a3beeb5f61858845a60547d9763aa981ddd2d" dependencies = [ "arrayvec", "multiversx-sc-codec-derive", @@ -73,9 +73,9 @@ dependencies = [ [[package]] name = "multiversx-sc-codec-derive" -version = "0.20.0" +version = "0.20.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "68f7fa25402e5e8054d719951289306fd79e481f7c21b2565b5549b6bc359772" +checksum = "476501462b0c2654b64f9dec6f2c480e24b4e9b7133ec10b7167e64acda35d04" dependencies = [ "hex", "proc-macro2", @@ -85,9 +85,9 @@ dependencies = [ [[package]] name = "multiversx-sc-derive" -version = "0.51.1" +version = "0.52.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eb683bc78d0e2eb43c16cac790144f53cc2ab27912aeb1484433895742ce698d" +checksum = "ae92e4121bad55ffc476028c25722bc01ba989b4953837fb7f4b6be9dba398ed" dependencies = [ "hex", "proc-macro2", @@ -98,9 +98,9 @@ dependencies = [ [[package]] name = "multiversx-sc-wasm-adapter" -version = "0.51.1" +version = "0.52.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b2f0d6be22f911ce45427491a9bec94612a1678eab2769dd08c9c9731d13da53" +checksum = "bbb8f0bf218a2e3f02d37c3112fd099bdd72d307e69e97b4773fa8c16bf6ab87" dependencies = [ "multiversx-sc", ] @@ -159,9 +159,9 @@ checksum = "3c5e1a9a646d36c3599cd173a41282daf47c44583ad367b8e6837255952e5c67" [[package]] name = "syn" -version = "2.0.68" +version = "2.0.72" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "901fa70d88b9d6c98022e23b4136f9f3e54e4662c3bc1bd1d84a42a9a0f0c1e9" +checksum = "dc4b9b9bf2add8093d3f2c0204471e951b2285580335de42f9d2534f3ae7a8af" dependencies = [ "proc-macro2", "quote", diff --git a/token-handler/wasm/Cargo.toml b/token-handler/wasm/Cargo.toml index 2b7be507..408c2c94 100644 --- a/token-handler/wasm/Cargo.toml +++ b/token-handler/wasm/Cargo.toml @@ -28,7 +28,7 @@ panic = "abort" path = ".." [dependencies.multiversx-sc-wasm-adapter] -version = "0.51.1" +version = "0.52.0" [workspace] members = ["."] From 8fc50b4d3d070108f74cdea1545eadf6a700edec Mon Sep 17 00:00:00 2001 From: Andrei Baltariu Date: Wed, 31 Jul 2024 13:39:42 +0300 Subject: [PATCH 218/523] Fixed tests Signed-off-by: Andrei Baltariu --- .../tests/enshrine_esdt_safe_blackbox_test.rs | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/enshrine-esdt-safe/tests/enshrine_esdt_safe_blackbox_test.rs b/enshrine-esdt-safe/tests/enshrine_esdt_safe_blackbox_test.rs index 203041d9..77e81979 100644 --- a/enshrine-esdt-safe/tests/enshrine_esdt_safe_blackbox_test.rs +++ b/enshrine-esdt-safe/tests/enshrine_esdt_safe_blackbox_test.rs @@ -344,20 +344,28 @@ fn test_deploy() { fn test_sovereign_prefix_no_prefix() { let mut state = EnshrineTestState::new(); let token_vec = Vec::from([NFT_TOKEN_ID, CROWD_TOKEN_ID]); + let error_status = Option::Some(ErrorStatus { + code: 4, + error_message: "Operation is not registered", + }); state.propose_setup_contracts(false); state.propose_register_operation(&token_vec); - state.propose_execute_operation(None, &token_vec); + state.propose_execute_operation(error_status, &token_vec); } #[test] fn test_sovereign_prefix_has_prefix() { let mut state = EnshrineTestState::new(); let token_vec = Vec::from([PREFIX_NFT_TOKEN_ID, CROWD_TOKEN_ID]); + let error_status = Option::Some(ErrorStatus { + code: 4, + error_message: "Operation is not registered", + }); state.propose_setup_contracts(false); state.propose_register_operation(&token_vec); - state.propose_execute_operation(None, &token_vec); + state.propose_execute_operation(error_status, &token_vec); } #[test] From d6c5a23e329ec687f175506425f8c87a845205e2 Mon Sep 17 00:00:00 2001 From: Andrei Baltariu Date: Wed, 31 Jul 2024 13:46:33 +0300 Subject: [PATCH 219/523] Removed events module Signed-off-by: Andrei Baltariu --- token-handler/src/common/events.rs | 21 -------------------- token-handler/src/common/mod.rs | 1 - token-handler/src/lib.rs | 1 - token-handler/src/mint_tokens.rs | 31 +----------------------------- 4 files changed, 1 insertion(+), 53 deletions(-) delete mode 100644 token-handler/src/common/events.rs diff --git a/token-handler/src/common/events.rs b/token-handler/src/common/events.rs deleted file mode 100644 index dfce962d..00000000 --- a/token-handler/src/common/events.rs +++ /dev/null @@ -1,21 +0,0 @@ -use transaction::OperationData; - -multiversx_sc::imports!(); - -#[multiversx_sc::module] -pub trait EventsModule { - #[event("executedBridgeOp")] - fn execute_bridge_operation_event( - &self, - #[indexed] hash_of_hashes: ManagedBuffer, - #[indexed] hash_of_bridge_op: ManagedBuffer, - ); - - #[event("deposit")] - fn deposit_event( - &self, - #[indexed] dest_address: &ManagedAddress, - #[indexed] tokens: &MultiValueEncoded>, - event_data: OperationData, - ); -} diff --git a/token-handler/src/common/mod.rs b/token-handler/src/common/mod.rs index 663b8166..30f61eb6 100644 --- a/token-handler/src/common/mod.rs +++ b/token-handler/src/common/mod.rs @@ -1,2 +1 @@ -pub mod events; pub mod storage; diff --git a/token-handler/src/lib.rs b/token-handler/src/lib.rs index 0c708ad8..3be30e53 100644 --- a/token-handler/src/lib.rs +++ b/token-handler/src/lib.rs @@ -15,7 +15,6 @@ pub trait TokenHandler: + utils::UtilsModule + common::storage::CommonStorage + tx_batch_module::TxBatchModule - + common::events::EventsModule { #[init] fn init(&self, chain_prefix: ManagedBuffer) { diff --git a/token-handler/src/mint_tokens.rs b/token-handler/src/mint_tokens.rs index 6d0162e1..3572cec7 100644 --- a/token-handler/src/mint_tokens.rs +++ b/token-handler/src/mint_tokens.rs @@ -4,10 +4,7 @@ use multiversx_sc::types::{ }; use multiversx_sc::types::{ManagedVec, TokenIdentifier}; use multiversx_sc::{codec, err_msg}; -use transaction::{ - GasLimit, OperationData, OperationEsdtPayment, OperationTuple, - StolenFromFrameworkEsdtTokenData, TransferData, -}; +use transaction::{GasLimit, OperationEsdtPayment, StolenFromFrameworkEsdtTokenData, TransferData}; const TRANSACTION_GAS: GasLimit = 30_000_000; @@ -17,7 +14,6 @@ use crate::{burn_tokens, common}; pub trait TransferTokensModule: utils::UtilsModule + common::storage::CommonStorage - + common::events::EventsModule + burn_tokens::BurnTokensModule + tx_batch_module::TxBatchModule { @@ -177,29 +173,4 @@ pub trait TransferTokensModule: args } - - fn emit_transfer_failed_events( - &self, - hash_of_hashes: &ManagedBuffer, - operation_tuple: &OperationTuple, - ) { - self.execute_bridge_operation_event( - hash_of_hashes.clone(), - operation_tuple.op_hash.clone(), - ); - - // deposit back mainchain tokens into user account - let sc_address = self.blockchain().get_sc_address(); - let tx_nonce = self.get_and_save_next_tx_id(); - - self.deposit_event( - &operation_tuple.operation.data.op_sender, - &operation_tuple.operation.get_tokens_as_tuple_arr(), - OperationData { - op_nonce: tx_nonce, - op_sender: sc_address.clone(), - opt_transfer_data: None, - }, - ); - } } From ac3ef05954be4f41e523aa5deed30be3aa6b90da Mon Sep 17 00:00:00 2001 From: Andrei Baltariu Date: Wed, 31 Jul 2024 13:47:51 +0300 Subject: [PATCH 220/523] Removed chain_prefix from init Signed-off-by: Andrei Baltariu --- token-handler/src/lib.rs | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/token-handler/src/lib.rs b/token-handler/src/lib.rs index 3be30e53..5be6e3a1 100644 --- a/token-handler/src/lib.rs +++ b/token-handler/src/lib.rs @@ -17,9 +17,7 @@ pub trait TokenHandler: + tx_batch_module::TxBatchModule { #[init] - fn init(&self, chain_prefix: ManagedBuffer) { - self.sov_prefix().set(chain_prefix); - } + fn init(&self) {} #[upgrade] fn upgrade(&self) {} From d095641ac43329ab0ba745e64a5bbba93a35a439 Mon Sep 17 00:00:00 2001 From: Andrei Baltariu Date: Wed, 31 Jul 2024 13:56:43 +0300 Subject: [PATCH 221/523] Added transfer tokens endpoint argument for the future Signed-off-by: Andrei Baltariu --- enshrine-esdt-safe/src/from_sovereign/transfer_tokens.rs | 1 + token-handler/src/mint_tokens.rs | 2 ++ 2 files changed, 3 insertions(+) diff --git a/enshrine-esdt-safe/src/from_sovereign/transfer_tokens.rs b/enshrine-esdt-safe/src/from_sovereign/transfer_tokens.rs index 6272e59d..df0f1eb9 100644 --- a/enshrine-esdt-safe/src/from_sovereign/transfer_tokens.rs +++ b/enshrine-esdt-safe/src/from_sovereign/transfer_tokens.rs @@ -57,6 +57,7 @@ pub trait TransferTokensModule: .transfer_tokens( operation.data.opt_transfer_data, operation.to, + // operation.data.opt_sender multi_value_tokens, ) .multi_esdt(non_sov_tokens) diff --git a/token-handler/src/mint_tokens.rs b/token-handler/src/mint_tokens.rs index 3572cec7..6e0a3c5d 100644 --- a/token-handler/src/mint_tokens.rs +++ b/token-handler/src/mint_tokens.rs @@ -17,12 +17,14 @@ pub trait TransferTokensModule: + burn_tokens::BurnTokensModule + tx_batch_module::TxBatchModule { + // NOTE: will use operation.data.op_sender as well when TransferAndExecuteByUser is implemented #[payable("*")] #[endpoint(transferTokens)] fn transfer_tokens( &self, opt_transfer_data: Option>, to: ManagedAddress, + // original_sender: ManagedAddress, tokens: MultiValueEncoded>, ) { let mut output_payments: ManagedVec> = From c20eedf6e0276a8c1dd2902b5e2695331c46b301 Mon Sep 17 00:00:00 2001 From: Andrei Baltariu Date: Wed, 31 Jul 2024 14:10:24 +0300 Subject: [PATCH 222/523] Added mint function and modified transfer tokens endpoint Signed-off-by: Andrei Baltariu --- token-handler/src/mint_tokens.rs | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/token-handler/src/mint_tokens.rs b/token-handler/src/mint_tokens.rs index 6e0a3c5d..75460ba5 100644 --- a/token-handler/src/mint_tokens.rs +++ b/token-handler/src/mint_tokens.rs @@ -27,18 +27,18 @@ pub trait TransferTokensModule: // original_sender: ManagedAddress, tokens: MultiValueEncoded>, ) { + let output_payments = self.mint_tokens(&tokens.to_vec()); + self.distribute_payments(&output_payments, &opt_transfer_data, &to); + } + + fn mint_tokens( + &self, + tokens: &ManagedVec>, + ) -> ManagedVec> { let mut output_payments: ManagedVec> = ManagedVec::new(); - let tokens_vec = tokens.to_vec(); - - for operation_token in tokens_vec.iter() { - let sov_prefix = self.sov_prefix().get(); - - if !self.has_sov_prefix(&operation_token.token_identifier, &sov_prefix) { - output_payments.push(operation_token.clone()); - continue; - } + for operation_token in tokens.iter() { let mut nonce = operation_token.token_nonce; if nonce == 0 { @@ -68,7 +68,7 @@ pub trait TransferTokensModule: }); } - self.distribute_payments(&tokens_vec, &opt_transfer_data, &to); + output_payments } fn call_nft_create_built_in_function(&self, arg_buffer: &ManagedArgBuffer) -> u64 { From 597689de585570b2bda237d6791a475db0ff53b6 Mon Sep 17 00:00:00 2001 From: Andrei Baltariu Date: Wed, 31 Jul 2024 14:11:32 +0300 Subject: [PATCH 223/523] Added token type to arg buffer Signed-off-by: Andrei Baltariu --- token-handler/src/mint_tokens.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/token-handler/src/mint_tokens.rs b/token-handler/src/mint_tokens.rs index 75460ba5..acc575b8 100644 --- a/token-handler/src/mint_tokens.rs +++ b/token-handler/src/mint_tokens.rs @@ -114,6 +114,7 @@ pub trait TransferTokensModule: } } + arg_buffer.push_arg(cloned_token_data.token_type); arg_buffer.push_arg(token_nonce); arg_buffer.push_arg(cloned_token_data.creator); From f8c1864879b98b296ca1305aaafbcd7e51476221 Mon Sep 17 00:00:00 2001 From: Andrei Baltariu Date: Wed, 31 Jul 2024 14:13:13 +0300 Subject: [PATCH 224/523] Reordered and renamed function args Signed-off-by: Andrei Baltariu --- token-handler/src/mint_tokens.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/token-handler/src/mint_tokens.rs b/token-handler/src/mint_tokens.rs index acc575b8..81a003c9 100644 --- a/token-handler/src/mint_tokens.rs +++ b/token-handler/src/mint_tokens.rs @@ -28,7 +28,7 @@ pub trait TransferTokensModule: tokens: MultiValueEncoded>, ) { let output_payments = self.mint_tokens(&tokens.to_vec()); - self.distribute_payments(&output_payments, &opt_transfer_data, &to); + self.distribute_payments(&to, &output_payments, &opt_transfer_data); } fn mint_tokens( @@ -123,9 +123,9 @@ pub trait TransferTokensModule: fn distribute_payments( &self, + receiver: &ManagedAddress, tokens: &ManagedVec>, opt_transfer_data: &Option>, - to: &ManagedAddress, ) { let mapped_tokens: ManagedVec> = tokens.iter().map(|token| token.into()).collect(); @@ -138,7 +138,7 @@ pub trait TransferTokensModule: } self.tx() - .to(to) + .to(receiver) .raw_call(transfer_data.function.clone()) .arguments_raw(args.clone()) .multi_esdt(mapped_tokens.clone()) @@ -147,7 +147,7 @@ pub trait TransferTokensModule: } None => { let own_address = self.blockchain().get_sc_address(); - let args = self.get_contract_call_args(to, &mapped_tokens); + let args = self.get_contract_call_args(receiver, &mapped_tokens); self.tx() .to(own_address) From 8d2be4bfa7cfe1f8e49bf5f6e7ca9be96e2f6680 Mon Sep 17 00:00:00 2001 From: Andrei Baltariu Date: Wed, 31 Jul 2024 15:08:15 +0300 Subject: [PATCH 225/523] Extended the output payments vec Added a trait for OperationEsdtPayment to be converted From EsdtTokenPayment for an easier mapping Signed-off-by: Andrei Baltariu --- common/transaction/src/lib.rs | 6 ++++++ token-handler/src/mint_tokens.rs | 10 +++++++++- 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/common/transaction/src/lib.rs b/common/transaction/src/lib.rs index 2e9a2e03..6ac4874b 100644 --- a/common/transaction/src/lib.rs +++ b/common/transaction/src/lib.rs @@ -80,6 +80,12 @@ pub struct OperationEsdtPayment { pub token_data: StolenFromFrameworkEsdtTokenData, } +impl From> for OperationEsdtPayment { + fn from(payment: EsdtTokenPayment) -> Self { + payment.into() + } +} + impl From> for EsdtTokenPayment { fn from(payment: OperationEsdtPayment) -> Self { EsdtTokenPayment { diff --git a/token-handler/src/mint_tokens.rs b/token-handler/src/mint_tokens.rs index 81a003c9..2daeff4e 100644 --- a/token-handler/src/mint_tokens.rs +++ b/token-handler/src/mint_tokens.rs @@ -27,7 +27,15 @@ pub trait TransferTokensModule: // original_sender: ManagedAddress, tokens: MultiValueEncoded>, ) { - let output_payments = self.mint_tokens(&tokens.to_vec()); + let mut output_payments = self.mint_tokens(&tokens.to_vec()); + let call_value_esdt_transfer = self.call_value().all_esdt_transfers(); + let mapped_esdt_transfers: ManagedVec> = + call_value_esdt_transfer + .iter() + .map(|transfer| transfer.into()) + .collect(); + output_payments.extend(&mapped_esdt_transfers); + self.distribute_payments(&to, &output_payments, &opt_transfer_data); } From d4f33ced4c6c3ae3bcdacc3c98c6842dfea6593b Mon Sep 17 00:00:00 2001 From: Andrei Baltariu Date: Wed, 31 Jul 2024 15:12:34 +0300 Subject: [PATCH 226/523] Regenerated proxy Signed-off-by: Andrei Baltariu --- enshrine-esdt-safe/src/token_handler_proxy.rs | 6 +----- token-handler/src/token_handler_proxy.rs | 6 +----- 2 files changed, 2 insertions(+), 10 deletions(-) diff --git a/enshrine-esdt-safe/src/token_handler_proxy.rs b/enshrine-esdt-safe/src/token_handler_proxy.rs index 55d5ec54..66f13b99 100644 --- a/enshrine-esdt-safe/src/token_handler_proxy.rs +++ b/enshrine-esdt-safe/src/token_handler_proxy.rs @@ -43,16 +43,12 @@ where From: TxFrom, Gas: TxGas, { - pub fn init< - Arg0: ProxyArg>, - >( + pub fn init( self, - chain_prefix: Arg0, ) -> TxTypedDeploy { self.wrapped_tx .payment(NotPayable) .raw_deploy() - .argument(&chain_prefix) .original_result() } } diff --git a/token-handler/src/token_handler_proxy.rs b/token-handler/src/token_handler_proxy.rs index 55d5ec54..66f13b99 100644 --- a/token-handler/src/token_handler_proxy.rs +++ b/token-handler/src/token_handler_proxy.rs @@ -43,16 +43,12 @@ where From: TxFrom, Gas: TxGas, { - pub fn init< - Arg0: ProxyArg>, - >( + pub fn init( self, - chain_prefix: Arg0, ) -> TxTypedDeploy { self.wrapped_tx .payment(NotPayable) .raw_deploy() - .argument(&chain_prefix) .original_result() } } From 2fcf6f1222600f65d482c8ba03df427953aaef3a Mon Sep 17 00:00:00 2001 From: Andrei Baltariu Date: Fri, 2 Aug 2024 00:49:23 +0300 Subject: [PATCH 227/523] Renamed transfer tokens file Signed-off-by: Andrei Baltariu --- token-handler/src/lib.rs | 4 ++-- token-handler/src/{mint_tokens.rs => transfer_tokens.rs} | 0 2 files changed, 2 insertions(+), 2 deletions(-) rename token-handler/src/{mint_tokens.rs => transfer_tokens.rs} (100%) diff --git a/token-handler/src/lib.rs b/token-handler/src/lib.rs index 5be6e3a1..ddd6c811 100644 --- a/token-handler/src/lib.rs +++ b/token-handler/src/lib.rs @@ -5,12 +5,12 @@ use multiversx_sc::imports::*; pub mod burn_tokens; pub mod common; -pub mod mint_tokens; pub mod token_handler_proxy; +pub mod transfer_tokens; #[multiversx_sc::contract] pub trait TokenHandler: - mint_tokens::TransferTokensModule + transfer_tokens::TransferTokensModule + burn_tokens::BurnTokensModule + utils::UtilsModule + common::storage::CommonStorage diff --git a/token-handler/src/mint_tokens.rs b/token-handler/src/transfer_tokens.rs similarity index 100% rename from token-handler/src/mint_tokens.rs rename to token-handler/src/transfer_tokens.rs From d04575050c9fcfe9d1791de8ad609b2095737dcf Mon Sep 17 00:00:00 2001 From: Andrei Baltariu Date: Fri, 2 Aug 2024 00:56:16 +0300 Subject: [PATCH 228/523] Switched splitted tokens type for th endpoint call Signed-off-by: Andrei Baltariu --- enshrine-esdt-safe/src/from_sovereign/transfer_tokens.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/enshrine-esdt-safe/src/from_sovereign/transfer_tokens.rs b/enshrine-esdt-safe/src/from_sovereign/transfer_tokens.rs index df0f1eb9..bd35d10b 100644 --- a/enshrine-esdt-safe/src/from_sovereign/transfer_tokens.rs +++ b/enshrine-esdt-safe/src/from_sovereign/transfer_tokens.rs @@ -35,7 +35,7 @@ pub trait TransferTokensModule: sc_panic!("Operation is not registered"); } - let (non_sov_tokens, sov_tokens, are_tokens_registered) = + let (sov_tokens, non_sov_tokens, are_tokens_registered) = self.split_payments_for_prefix_and_fee(&operation.tokens); if !are_tokens_registered { @@ -49,7 +49,7 @@ pub trait TransferTokensModule: let token_handler_address = self.token_handler_address().get(); let multi_value_tokens: MultiValueEncoded> = - sov_tokens.into(); + non_sov_tokens.into(); self.tx() .to(token_handler_address) @@ -60,7 +60,7 @@ pub trait TransferTokensModule: // operation.data.opt_sender multi_value_tokens, ) - .multi_esdt(non_sov_tokens) + .multi_esdt(sov_tokens) .sync_call(); self.remove_executed_hash(&hash_of_hashes, &op_hash); From c0a2ecb5597bbb04f5eb1c395902d87243d14410 Mon Sep 17 00:00:00 2001 From: Andrei Baltariu Date: Fri, 2 Aug 2024 01:17:07 +0300 Subject: [PATCH 229/523] 0.52.2 fw upgrade Signed-off-by: Andrei Baltariu --- Cargo.lock | 20 +++++++++---------- chain-config/Cargo.toml | 6 +++--- chain-config/meta/Cargo.toml | 2 +- chain-config/wasm/Cargo.lock | 16 +++++++-------- chain-config/wasm/Cargo.toml | 2 +- chain-factory/Cargo.toml | 4 ++-- chain-factory/meta/Cargo.toml | 2 +- chain-factory/wasm/Cargo.lock | 16 +++++++-------- chain-factory/wasm/Cargo.toml | 2 +- common/bls-signature/Cargo.toml | 4 ++-- common/max-bridged-amount-module/Cargo.toml | 4 ++-- common/setup-phase/Cargo.toml | 4 ++-- common/token-whitelist/Cargo.toml | 4 ++-- common/transaction/Cargo.toml | 2 +- common/tx-batch-module/Cargo.toml | 4 ++-- common/utils/Cargo.toml | 2 +- enshrine-esdt-safe/Cargo.toml | 6 +++--- enshrine-esdt-safe/meta/Cargo.toml | 2 +- .../wasm-enshrine-esdt-safe-full/Cargo.lock | 16 +++++++-------- .../wasm-enshrine-esdt-safe-full/Cargo.toml | 2 +- .../wasm-enshrine-esdt-safe-view/Cargo.lock | 16 +++++++-------- .../wasm-enshrine-esdt-safe-view/Cargo.toml | 2 +- enshrine-esdt-safe/wasm/Cargo.lock | 16 +++++++-------- enshrine-esdt-safe/wasm/Cargo.toml | 2 +- esdt-safe/Cargo.toml | 6 +++--- esdt-safe/meta/Cargo.toml | 2 +- esdt-safe/wasm-esdt-safe-full/Cargo.lock | 16 +++++++-------- esdt-safe/wasm-esdt-safe-full/Cargo.toml | 2 +- esdt-safe/wasm-esdt-safe-view/Cargo.lock | 16 +++++++-------- esdt-safe/wasm-esdt-safe-view/Cargo.toml | 2 +- esdt-safe/wasm/Cargo.lock | 16 +++++++-------- esdt-safe/wasm/Cargo.toml | 2 +- fee-market/Cargo.toml | 4 ++-- fee-market/meta/Cargo.toml | 2 +- fee-market/wasm-fee-marker-full/Cargo.lock | 12 +++++------ fee-market/wasm-fee-marker-full/Cargo.toml | 2 +- fee-market/wasm-multisig-view/Cargo.lock | 12 +++++------ fee-market/wasm-multisig-view/Cargo.toml | 2 +- fee-market/wasm/Cargo.lock | 12 +++++------ fee-market/wasm/Cargo.toml | 2 +- header-verifier/Cargo.toml | 4 ++-- header-verifier/meta/Cargo.toml | 2 +- .../wasm-header-verifier-full/Cargo.lock | 12 +++++------ .../wasm-header-verifier-full/Cargo.toml | 2 +- header-verifier/wasm-multisig-view/Cargo.lock | 12 +++++------ header-verifier/wasm-multisig-view/Cargo.toml | 2 +- header-verifier/wasm/Cargo.lock | 12 +++++------ header-verifier/wasm/Cargo.toml | 2 +- pair-mock/Cargo.toml | 4 ++-- pair-mock/meta/Cargo.toml | 2 +- pair-mock/wasm/Cargo.lock | 12 +++++------ pair-mock/wasm/Cargo.toml | 2 +- router-mock/Cargo.toml | 4 ++-- router-mock/meta/Cargo.toml | 2 +- router-mock/wasm/Cargo.lock | 12 +++++------ router-mock/wasm/Cargo.toml | 2 +- 56 files changed, 177 insertions(+), 177 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 415d8f80..c44b4c3c 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -602,9 +602,9 @@ checksum = "b59072fa0624b55ae5ae3fa6bfa91515bbeb4ac440214bc4a509e2c8806d6e9f" [[package]] name = "multiversx-sc" -version = "0.52.0" +version = "0.52.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "31bcb4dc736ef975b59878720de1c731788aa1a5a197888606e7d3d6600b1925" +checksum = "290e945d3d268d2b0b7cc68f3c74844d35eaa06c1b7861a18ded3726bc6e6587" dependencies = [ "bitflags", "hex-literal", @@ -640,9 +640,9 @@ dependencies = [ [[package]] name = "multiversx-sc-derive" -version = "0.52.0" +version = "0.52.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ae92e4121bad55ffc476028c25722bc01ba989b4953837fb7f4b6be9dba398ed" +checksum = "f6363ecf098fa4687ca532d621af1222890ffe97ed333e19b6b206d621c3f9d4" dependencies = [ "hex", "proc-macro2", @@ -653,9 +653,9 @@ dependencies = [ [[package]] name = "multiversx-sc-meta-lib" -version = "0.52.0" +version = "0.52.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "77add452483515e992d633c1820557941d17cb59dbc0c4783d5b9585b8f5a0a4" +checksum = "e16b278a68a3ce17064e2eda0f08391b898a9af96c244e214b34e7a7351e65cc" dependencies = [ "clap", "colored", @@ -674,18 +674,18 @@ dependencies = [ [[package]] name = "multiversx-sc-modules" -version = "0.52.0" +version = "0.52.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1aca2fbccb7cd84f3c4d7a13c78d90fac484bf9cab30ed73c9b5f5e31f513b6f" +checksum = "795f323df153249e27a84b13234625cb76122188e024d320e8882bef469ab51b" dependencies = [ "multiversx-sc", ] [[package]] name = "multiversx-sc-scenario" -version = "0.52.0" +version = "0.52.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6975f54ad39d3e35e4e4299e32dbb2bd8a8e371775418324640ca33fc401a9d1" +checksum = "c3ac0a22a23f65c07e43a10c1165f2553dc87bce6cbff06ef4f65dad05cdfc4a" dependencies = [ "base64", "bech32", diff --git a/chain-config/Cargo.toml b/chain-config/Cargo.toml index 84acceac..ce6a790d 100644 --- a/chain-config/Cargo.toml +++ b/chain-config/Cargo.toml @@ -12,10 +12,10 @@ path = "src/lib.rs" num-bigint = "0.4.2" [dev-dependencies.multiversx-sc-scenario] -version = "=0.52.0" +version = "=0.52.2" [dependencies.multiversx-sc] -version = "=0.52.0" +version = "=0.52.2" [dependencies.multiversx-sc-modules] -version = "=0.52.0" +version = "=0.52.2" diff --git a/chain-config/meta/Cargo.toml b/chain-config/meta/Cargo.toml index 335fbd16..aee17fc3 100644 --- a/chain-config/meta/Cargo.toml +++ b/chain-config/meta/Cargo.toml @@ -11,4 +11,4 @@ authors = ["you"] path = ".." [dependencies.multiversx-sc-meta-lib] -version = "=0.52.0" +version = "=0.52.2" diff --git a/chain-config/wasm/Cargo.lock b/chain-config/wasm/Cargo.lock index 8d2c5de6..9d9f34d2 100644 --- a/chain-config/wasm/Cargo.lock +++ b/chain-config/wasm/Cargo.lock @@ -56,9 +56,9 @@ checksum = "6fe2267d4ed49bc07b63801559be28c718ea06c4738b7a03c94df7386d2cde46" [[package]] name = "multiversx-sc" -version = "0.52.0" +version = "0.52.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "31bcb4dc736ef975b59878720de1c731788aa1a5a197888606e7d3d6600b1925" +checksum = "290e945d3d268d2b0b7cc68f3c74844d35eaa06c1b7861a18ded3726bc6e6587" dependencies = [ "bitflags", "hex-literal", @@ -93,9 +93,9 @@ dependencies = [ [[package]] name = "multiversx-sc-derive" -version = "0.52.0" +version = "0.52.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ae92e4121bad55ffc476028c25722bc01ba989b4953837fb7f4b6be9dba398ed" +checksum = "f6363ecf098fa4687ca532d621af1222890ffe97ed333e19b6b206d621c3f9d4" dependencies = [ "hex", "proc-macro2", @@ -106,18 +106,18 @@ dependencies = [ [[package]] name = "multiversx-sc-modules" -version = "0.52.0" +version = "0.52.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1aca2fbccb7cd84f3c4d7a13c78d90fac484bf9cab30ed73c9b5f5e31f513b6f" +checksum = "795f323df153249e27a84b13234625cb76122188e024d320e8882bef469ab51b" dependencies = [ "multiversx-sc", ] [[package]] name = "multiversx-sc-wasm-adapter" -version = "0.52.0" +version = "0.52.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bbb8f0bf218a2e3f02d37c3112fd099bdd72d307e69e97b4773fa8c16bf6ab87" +checksum = "d3a7ef581b703ca0cef3ebc500ee2bf739c4def405ab2490e8b680a039e3408d" dependencies = [ "multiversx-sc", ] diff --git a/chain-config/wasm/Cargo.toml b/chain-config/wasm/Cargo.toml index 96fa548a..8704883b 100644 --- a/chain-config/wasm/Cargo.toml +++ b/chain-config/wasm/Cargo.toml @@ -28,7 +28,7 @@ panic = "abort" path = ".." [dependencies.multiversx-sc-wasm-adapter] -version = "=0.52.0" +version = "=0.52.2" [workspace] members = ["."] diff --git a/chain-factory/Cargo.toml b/chain-factory/Cargo.toml index 015fff9a..96296e6a 100644 --- a/chain-factory/Cargo.toml +++ b/chain-factory/Cargo.toml @@ -12,10 +12,10 @@ path = "src/lib.rs" num-bigint = "0.4.2" [dev-dependencies.multiversx-sc-scenario] -version = "=0.52.0" +version = "=0.52.2" [dependencies.multiversx-sc] -version = "=0.52.0" +version = "=0.52.2" [dependencies.utils] path = "../common/utils" diff --git a/chain-factory/meta/Cargo.toml b/chain-factory/meta/Cargo.toml index bb60a180..76422b05 100644 --- a/chain-factory/meta/Cargo.toml +++ b/chain-factory/meta/Cargo.toml @@ -11,4 +11,4 @@ authors = ["you"] path = ".." [dependencies.multiversx-sc-meta-lib] -version = "=0.52.0" +version = "=0.52.2" diff --git a/chain-factory/wasm/Cargo.lock b/chain-factory/wasm/Cargo.lock index f2681839..546843b3 100644 --- a/chain-factory/wasm/Cargo.lock +++ b/chain-factory/wasm/Cargo.lock @@ -74,9 +74,9 @@ checksum = "6fe2267d4ed49bc07b63801559be28c718ea06c4738b7a03c94df7386d2cde46" [[package]] name = "multiversx-sc" -version = "0.52.0" +version = "0.52.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "31bcb4dc736ef975b59878720de1c731788aa1a5a197888606e7d3d6600b1925" +checksum = "290e945d3d268d2b0b7cc68f3c74844d35eaa06c1b7861a18ded3726bc6e6587" dependencies = [ "bitflags", "hex-literal", @@ -111,9 +111,9 @@ dependencies = [ [[package]] name = "multiversx-sc-derive" -version = "0.52.0" +version = "0.52.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ae92e4121bad55ffc476028c25722bc01ba989b4953837fb7f4b6be9dba398ed" +checksum = "f6363ecf098fa4687ca532d621af1222890ffe97ed333e19b6b206d621c3f9d4" dependencies = [ "hex", "proc-macro2", @@ -124,18 +124,18 @@ dependencies = [ [[package]] name = "multiversx-sc-modules" -version = "0.52.0" +version = "0.52.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1aca2fbccb7cd84f3c4d7a13c78d90fac484bf9cab30ed73c9b5f5e31f513b6f" +checksum = "795f323df153249e27a84b13234625cb76122188e024d320e8882bef469ab51b" dependencies = [ "multiversx-sc", ] [[package]] name = "multiversx-sc-wasm-adapter" -version = "0.52.0" +version = "0.52.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bbb8f0bf218a2e3f02d37c3112fd099bdd72d307e69e97b4773fa8c16bf6ab87" +checksum = "d3a7ef581b703ca0cef3ebc500ee2bf739c4def405ab2490e8b680a039e3408d" dependencies = [ "multiversx-sc", ] diff --git a/chain-factory/wasm/Cargo.toml b/chain-factory/wasm/Cargo.toml index 2b5dc60b..158338ba 100644 --- a/chain-factory/wasm/Cargo.toml +++ b/chain-factory/wasm/Cargo.toml @@ -28,7 +28,7 @@ panic = "abort" path = ".." [dependencies.multiversx-sc-wasm-adapter] -version = "=0.52.0" +version = "=0.52.2" [workspace] members = ["."] diff --git a/common/bls-signature/Cargo.toml b/common/bls-signature/Cargo.toml index d678cca4..21e1506c 100644 --- a/common/bls-signature/Cargo.toml +++ b/common/bls-signature/Cargo.toml @@ -5,10 +5,10 @@ authors = ["dorin-iancu "] edition = "2018" [dependencies.multiversx-sc] -version = "=0.52.0" +version = "=0.52.2" [dependencies.transaction] path = "../transaction" [dev-dependencies.multiversx-sc-scenario] -version = "=0.52.0" +version = "=0.52.2" diff --git a/common/max-bridged-amount-module/Cargo.toml b/common/max-bridged-amount-module/Cargo.toml index 36c1ec72..4e5f6a63 100644 --- a/common/max-bridged-amount-module/Cargo.toml +++ b/common/max-bridged-amount-module/Cargo.toml @@ -5,7 +5,7 @@ authors = ["dorin-iancu "] edition = "2018" [dependencies.multiversx-sc] -version = "=0.52.0" +version = "=0.52.2" [dev-dependencies.multiversx-sc-scenario] -version = "=0.52.0" +version = "=0.52.2" diff --git a/common/setup-phase/Cargo.toml b/common/setup-phase/Cargo.toml index c1017162..7b22c596 100644 --- a/common/setup-phase/Cargo.toml +++ b/common/setup-phase/Cargo.toml @@ -5,7 +5,7 @@ authors = ["dorin-iancu "] edition = "2018" [dependencies.multiversx-sc] -version = "=0.52.0" +version = "=0.52.2" [dev-dependencies.multiversx-sc-scenario] -version = "=0.52.0" +version = "=0.52.2" diff --git a/common/token-whitelist/Cargo.toml b/common/token-whitelist/Cargo.toml index 98fb4826..90a6bf4b 100644 --- a/common/token-whitelist/Cargo.toml +++ b/common/token-whitelist/Cargo.toml @@ -14,7 +14,7 @@ path = "../setup-phase" path = "../utils" [dependencies.multiversx-sc] -version = "=0.52.0" +version = "=0.52.2" [dev-dependencies.multiversx-sc-scenario] -version = "=0.52.0" +version = "=0.52.2" diff --git a/common/transaction/Cargo.toml b/common/transaction/Cargo.toml index 3ece8582..d446f24e 100644 --- a/common/transaction/Cargo.toml +++ b/common/transaction/Cargo.toml @@ -8,4 +8,4 @@ edition = "2018" path = "src/lib.rs" [dependencies.multiversx-sc] -version = "=0.52.0" +version = "=0.52.2" diff --git a/common/tx-batch-module/Cargo.toml b/common/tx-batch-module/Cargo.toml index 880c9b7c..0f76b99c 100644 --- a/common/tx-batch-module/Cargo.toml +++ b/common/tx-batch-module/Cargo.toml @@ -5,10 +5,10 @@ authors = ["dorin-iancu "] edition = "2018" [dependencies.multiversx-sc] -version = "=0.52.0" +version = "=0.52.2" [dependencies.transaction] path = "../transaction" [dev-dependencies.multiversx-sc-scenario] -version = "=0.52.0" +version = "=0.52.2" diff --git a/common/utils/Cargo.toml b/common/utils/Cargo.toml index 978ed2fa..80e99c7b 100644 --- a/common/utils/Cargo.toml +++ b/common/utils/Cargo.toml @@ -11,5 +11,5 @@ path = "src/lib.rs" path = "../bls-signature" [dependencies.multiversx-sc] -version = "=0.52.0" +version = "=0.52.2" features = ["esdt-token-payment-legacy-decode"] diff --git a/enshrine-esdt-safe/Cargo.toml b/enshrine-esdt-safe/Cargo.toml index 4e359b2f..fe19781f 100644 --- a/enshrine-esdt-safe/Cargo.toml +++ b/enshrine-esdt-safe/Cargo.toml @@ -36,10 +36,10 @@ path = "../fee-market" path = "../header-verifier" [dependencies.multiversx-sc] -version = "=0.52.0" +version = "=0.52.2" [dependencies.multiversx-sc-modules] -version = "=0.52.0" +version = "=0.52.2" [dev-dependencies] num-bigint = "0.4.2" @@ -47,4 +47,4 @@ num-traits = "0.2" hex = "0.4" [dev-dependencies.multiversx-sc-scenario] -version = "=0.52.0" +version = "=0.52.2" diff --git a/enshrine-esdt-safe/meta/Cargo.toml b/enshrine-esdt-safe/meta/Cargo.toml index 456f6d6a..4bf6b644 100644 --- a/enshrine-esdt-safe/meta/Cargo.toml +++ b/enshrine-esdt-safe/meta/Cargo.toml @@ -8,5 +8,5 @@ publish = false path = ".." [dependencies.multiversx-sc-meta-lib] -version = "0.52.0" +version = "0.52.2" default-features = false diff --git a/enshrine-esdt-safe/wasm-enshrine-esdt-safe-full/Cargo.lock b/enshrine-esdt-safe/wasm-enshrine-esdt-safe-full/Cargo.lock index 70ab0b3c..0aadf27b 100644 --- a/enshrine-esdt-safe/wasm-enshrine-esdt-safe-full/Cargo.lock +++ b/enshrine-esdt-safe/wasm-enshrine-esdt-safe-full/Cargo.lock @@ -101,9 +101,9 @@ dependencies = [ [[package]] name = "multiversx-sc" -version = "0.52.0" +version = "0.52.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "31bcb4dc736ef975b59878720de1c731788aa1a5a197888606e7d3d6600b1925" +checksum = "290e945d3d268d2b0b7cc68f3c74844d35eaa06c1b7861a18ded3726bc6e6587" dependencies = [ "bitflags", "hex-literal", @@ -138,9 +138,9 @@ dependencies = [ [[package]] name = "multiversx-sc-derive" -version = "0.52.0" +version = "0.52.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ae92e4121bad55ffc476028c25722bc01ba989b4953837fb7f4b6be9dba398ed" +checksum = "f6363ecf098fa4687ca532d621af1222890ffe97ed333e19b6b206d621c3f9d4" dependencies = [ "hex", "proc-macro2", @@ -151,18 +151,18 @@ dependencies = [ [[package]] name = "multiversx-sc-modules" -version = "0.52.0" +version = "0.52.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1aca2fbccb7cd84f3c4d7a13c78d90fac484bf9cab30ed73c9b5f5e31f513b6f" +checksum = "795f323df153249e27a84b13234625cb76122188e024d320e8882bef469ab51b" dependencies = [ "multiversx-sc", ] [[package]] name = "multiversx-sc-wasm-adapter" -version = "0.52.0" +version = "0.52.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bbb8f0bf218a2e3f02d37c3112fd099bdd72d307e69e97b4773fa8c16bf6ab87" +checksum = "d3a7ef581b703ca0cef3ebc500ee2bf739c4def405ab2490e8b680a039e3408d" dependencies = [ "multiversx-sc", ] diff --git a/enshrine-esdt-safe/wasm-enshrine-esdt-safe-full/Cargo.toml b/enshrine-esdt-safe/wasm-enshrine-esdt-safe-full/Cargo.toml index b32142ea..c8025c42 100644 --- a/enshrine-esdt-safe/wasm-enshrine-esdt-safe-full/Cargo.toml +++ b/enshrine-esdt-safe/wasm-enshrine-esdt-safe-full/Cargo.toml @@ -28,7 +28,7 @@ panic = "abort" path = ".." [dependencies.multiversx-sc-wasm-adapter] -version = "=0.52.0" +version = "=0.52.2" [workspace] members = ["."] diff --git a/enshrine-esdt-safe/wasm-enshrine-esdt-safe-view/Cargo.lock b/enshrine-esdt-safe/wasm-enshrine-esdt-safe-view/Cargo.lock index bcb418d4..45d69791 100644 --- a/enshrine-esdt-safe/wasm-enshrine-esdt-safe-view/Cargo.lock +++ b/enshrine-esdt-safe/wasm-enshrine-esdt-safe-view/Cargo.lock @@ -101,9 +101,9 @@ dependencies = [ [[package]] name = "multiversx-sc" -version = "0.52.0" +version = "0.52.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "31bcb4dc736ef975b59878720de1c731788aa1a5a197888606e7d3d6600b1925" +checksum = "290e945d3d268d2b0b7cc68f3c74844d35eaa06c1b7861a18ded3726bc6e6587" dependencies = [ "bitflags", "hex-literal", @@ -138,9 +138,9 @@ dependencies = [ [[package]] name = "multiversx-sc-derive" -version = "0.52.0" +version = "0.52.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ae92e4121bad55ffc476028c25722bc01ba989b4953837fb7f4b6be9dba398ed" +checksum = "f6363ecf098fa4687ca532d621af1222890ffe97ed333e19b6b206d621c3f9d4" dependencies = [ "hex", "proc-macro2", @@ -151,18 +151,18 @@ dependencies = [ [[package]] name = "multiversx-sc-modules" -version = "0.52.0" +version = "0.52.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1aca2fbccb7cd84f3c4d7a13c78d90fac484bf9cab30ed73c9b5f5e31f513b6f" +checksum = "795f323df153249e27a84b13234625cb76122188e024d320e8882bef469ab51b" dependencies = [ "multiversx-sc", ] [[package]] name = "multiversx-sc-wasm-adapter" -version = "0.52.0" +version = "0.52.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bbb8f0bf218a2e3f02d37c3112fd099bdd72d307e69e97b4773fa8c16bf6ab87" +checksum = "d3a7ef581b703ca0cef3ebc500ee2bf739c4def405ab2490e8b680a039e3408d" dependencies = [ "multiversx-sc", ] diff --git a/enshrine-esdt-safe/wasm-enshrine-esdt-safe-view/Cargo.toml b/enshrine-esdt-safe/wasm-enshrine-esdt-safe-view/Cargo.toml index 2bd6b9bd..80672c5d 100644 --- a/enshrine-esdt-safe/wasm-enshrine-esdt-safe-view/Cargo.toml +++ b/enshrine-esdt-safe/wasm-enshrine-esdt-safe-view/Cargo.toml @@ -28,7 +28,7 @@ panic = "abort" path = ".." [dependencies.multiversx-sc-wasm-adapter] -version = "=0.52.0" +version = "=0.52.2" [workspace] members = ["."] diff --git a/enshrine-esdt-safe/wasm/Cargo.lock b/enshrine-esdt-safe/wasm/Cargo.lock index 0caf2d3a..be40a5a8 100644 --- a/enshrine-esdt-safe/wasm/Cargo.lock +++ b/enshrine-esdt-safe/wasm/Cargo.lock @@ -101,9 +101,9 @@ dependencies = [ [[package]] name = "multiversx-sc" -version = "0.52.0" +version = "0.52.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "31bcb4dc736ef975b59878720de1c731788aa1a5a197888606e7d3d6600b1925" +checksum = "290e945d3d268d2b0b7cc68f3c74844d35eaa06c1b7861a18ded3726bc6e6587" dependencies = [ "bitflags", "hex-literal", @@ -138,9 +138,9 @@ dependencies = [ [[package]] name = "multiversx-sc-derive" -version = "0.52.0" +version = "0.52.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ae92e4121bad55ffc476028c25722bc01ba989b4953837fb7f4b6be9dba398ed" +checksum = "f6363ecf098fa4687ca532d621af1222890ffe97ed333e19b6b206d621c3f9d4" dependencies = [ "hex", "proc-macro2", @@ -151,18 +151,18 @@ dependencies = [ [[package]] name = "multiversx-sc-modules" -version = "0.52.0" +version = "0.52.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1aca2fbccb7cd84f3c4d7a13c78d90fac484bf9cab30ed73c9b5f5e31f513b6f" +checksum = "795f323df153249e27a84b13234625cb76122188e024d320e8882bef469ab51b" dependencies = [ "multiversx-sc", ] [[package]] name = "multiversx-sc-wasm-adapter" -version = "0.52.0" +version = "0.52.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bbb8f0bf218a2e3f02d37c3112fd099bdd72d307e69e97b4773fa8c16bf6ab87" +checksum = "d3a7ef581b703ca0cef3ebc500ee2bf739c4def405ab2490e8b680a039e3408d" dependencies = [ "multiversx-sc", ] diff --git a/enshrine-esdt-safe/wasm/Cargo.toml b/enshrine-esdt-safe/wasm/Cargo.toml index b80c98e6..16e79387 100644 --- a/enshrine-esdt-safe/wasm/Cargo.toml +++ b/enshrine-esdt-safe/wasm/Cargo.toml @@ -28,7 +28,7 @@ panic = "abort" path = ".." [dependencies.multiversx-sc-wasm-adapter] -version = "=0.52.0" +version = "=0.52.2" [workspace] members = ["."] diff --git a/esdt-safe/Cargo.toml b/esdt-safe/Cargo.toml index 425c615c..d384f12d 100644 --- a/esdt-safe/Cargo.toml +++ b/esdt-safe/Cargo.toml @@ -36,10 +36,10 @@ path = "../fee-market" path = "../header-verifier" [dependencies.multiversx-sc] -version = "=0.52.0" +version = "=0.52.2" [dependencies.multiversx-sc-modules] -version = "=0.52.0" +version = "=0.52.2" [dev-dependencies] num-bigint = "0.4.2" @@ -47,4 +47,4 @@ num-traits = "0.2" hex = "0.4" [dev-dependencies.multiversx-sc-scenario] -version = "=0.52.0" +version = "=0.52.2" diff --git a/esdt-safe/meta/Cargo.toml b/esdt-safe/meta/Cargo.toml index f7ba77e2..2f2fde20 100644 --- a/esdt-safe/meta/Cargo.toml +++ b/esdt-safe/meta/Cargo.toml @@ -11,4 +11,4 @@ publish = false path = ".." [dependencies.multiversx-sc-meta-lib] -version = "=0.52.0" +version = "=0.52.2" diff --git a/esdt-safe/wasm-esdt-safe-full/Cargo.lock b/esdt-safe/wasm-esdt-safe-full/Cargo.lock index 55379f88..722db0ac 100644 --- a/esdt-safe/wasm-esdt-safe-full/Cargo.lock +++ b/esdt-safe/wasm-esdt-safe-full/Cargo.lock @@ -101,9 +101,9 @@ dependencies = [ [[package]] name = "multiversx-sc" -version = "0.52.0" +version = "0.52.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "31bcb4dc736ef975b59878720de1c731788aa1a5a197888606e7d3d6600b1925" +checksum = "290e945d3d268d2b0b7cc68f3c74844d35eaa06c1b7861a18ded3726bc6e6587" dependencies = [ "bitflags", "hex-literal", @@ -138,9 +138,9 @@ dependencies = [ [[package]] name = "multiversx-sc-derive" -version = "0.52.0" +version = "0.52.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ae92e4121bad55ffc476028c25722bc01ba989b4953837fb7f4b6be9dba398ed" +checksum = "f6363ecf098fa4687ca532d621af1222890ffe97ed333e19b6b206d621c3f9d4" dependencies = [ "hex", "proc-macro2", @@ -151,18 +151,18 @@ dependencies = [ [[package]] name = "multiversx-sc-modules" -version = "0.52.0" +version = "0.52.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1aca2fbccb7cd84f3c4d7a13c78d90fac484bf9cab30ed73c9b5f5e31f513b6f" +checksum = "795f323df153249e27a84b13234625cb76122188e024d320e8882bef469ab51b" dependencies = [ "multiversx-sc", ] [[package]] name = "multiversx-sc-wasm-adapter" -version = "0.52.0" +version = "0.52.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bbb8f0bf218a2e3f02d37c3112fd099bdd72d307e69e97b4773fa8c16bf6ab87" +checksum = "d3a7ef581b703ca0cef3ebc500ee2bf739c4def405ab2490e8b680a039e3408d" dependencies = [ "multiversx-sc", ] diff --git a/esdt-safe/wasm-esdt-safe-full/Cargo.toml b/esdt-safe/wasm-esdt-safe-full/Cargo.toml index 28350897..d05d99cf 100644 --- a/esdt-safe/wasm-esdt-safe-full/Cargo.toml +++ b/esdt-safe/wasm-esdt-safe-full/Cargo.toml @@ -28,7 +28,7 @@ panic = "abort" path = ".." [dependencies.multiversx-sc-wasm-adapter] -version = "=0.52.0" +version = "=0.52.2" [workspace] members = ["."] diff --git a/esdt-safe/wasm-esdt-safe-view/Cargo.lock b/esdt-safe/wasm-esdt-safe-view/Cargo.lock index 8b658b43..437abc07 100644 --- a/esdt-safe/wasm-esdt-safe-view/Cargo.lock +++ b/esdt-safe/wasm-esdt-safe-view/Cargo.lock @@ -101,9 +101,9 @@ dependencies = [ [[package]] name = "multiversx-sc" -version = "0.52.0" +version = "0.52.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "31bcb4dc736ef975b59878720de1c731788aa1a5a197888606e7d3d6600b1925" +checksum = "290e945d3d268d2b0b7cc68f3c74844d35eaa06c1b7861a18ded3726bc6e6587" dependencies = [ "bitflags", "hex-literal", @@ -138,9 +138,9 @@ dependencies = [ [[package]] name = "multiversx-sc-derive" -version = "0.52.0" +version = "0.52.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ae92e4121bad55ffc476028c25722bc01ba989b4953837fb7f4b6be9dba398ed" +checksum = "f6363ecf098fa4687ca532d621af1222890ffe97ed333e19b6b206d621c3f9d4" dependencies = [ "hex", "proc-macro2", @@ -151,18 +151,18 @@ dependencies = [ [[package]] name = "multiversx-sc-modules" -version = "0.52.0" +version = "0.52.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1aca2fbccb7cd84f3c4d7a13c78d90fac484bf9cab30ed73c9b5f5e31f513b6f" +checksum = "795f323df153249e27a84b13234625cb76122188e024d320e8882bef469ab51b" dependencies = [ "multiversx-sc", ] [[package]] name = "multiversx-sc-wasm-adapter" -version = "0.52.0" +version = "0.52.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bbb8f0bf218a2e3f02d37c3112fd099bdd72d307e69e97b4773fa8c16bf6ab87" +checksum = "d3a7ef581b703ca0cef3ebc500ee2bf739c4def405ab2490e8b680a039e3408d" dependencies = [ "multiversx-sc", ] diff --git a/esdt-safe/wasm-esdt-safe-view/Cargo.toml b/esdt-safe/wasm-esdt-safe-view/Cargo.toml index f813f824..5fa960f9 100644 --- a/esdt-safe/wasm-esdt-safe-view/Cargo.toml +++ b/esdt-safe/wasm-esdt-safe-view/Cargo.toml @@ -28,7 +28,7 @@ panic = "abort" path = ".." [dependencies.multiversx-sc-wasm-adapter] -version = "=0.52.0" +version = "=0.52.2" [workspace] members = ["."] diff --git a/esdt-safe/wasm/Cargo.lock b/esdt-safe/wasm/Cargo.lock index 2d554e53..0ec20a41 100644 --- a/esdt-safe/wasm/Cargo.lock +++ b/esdt-safe/wasm/Cargo.lock @@ -101,9 +101,9 @@ dependencies = [ [[package]] name = "multiversx-sc" -version = "0.52.0" +version = "0.52.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "31bcb4dc736ef975b59878720de1c731788aa1a5a197888606e7d3d6600b1925" +checksum = "290e945d3d268d2b0b7cc68f3c74844d35eaa06c1b7861a18ded3726bc6e6587" dependencies = [ "bitflags", "hex-literal", @@ -138,9 +138,9 @@ dependencies = [ [[package]] name = "multiversx-sc-derive" -version = "0.52.0" +version = "0.52.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ae92e4121bad55ffc476028c25722bc01ba989b4953837fb7f4b6be9dba398ed" +checksum = "f6363ecf098fa4687ca532d621af1222890ffe97ed333e19b6b206d621c3f9d4" dependencies = [ "hex", "proc-macro2", @@ -151,18 +151,18 @@ dependencies = [ [[package]] name = "multiversx-sc-modules" -version = "0.52.0" +version = "0.52.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1aca2fbccb7cd84f3c4d7a13c78d90fac484bf9cab30ed73c9b5f5e31f513b6f" +checksum = "795f323df153249e27a84b13234625cb76122188e024d320e8882bef469ab51b" dependencies = [ "multiversx-sc", ] [[package]] name = "multiversx-sc-wasm-adapter" -version = "0.52.0" +version = "0.52.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bbb8f0bf218a2e3f02d37c3112fd099bdd72d307e69e97b4773fa8c16bf6ab87" +checksum = "d3a7ef581b703ca0cef3ebc500ee2bf739c4def405ab2490e8b680a039e3408d" dependencies = [ "multiversx-sc", ] diff --git a/esdt-safe/wasm/Cargo.toml b/esdt-safe/wasm/Cargo.toml index 6bbf37eb..8ed314d3 100644 --- a/esdt-safe/wasm/Cargo.toml +++ b/esdt-safe/wasm/Cargo.toml @@ -28,7 +28,7 @@ panic = "abort" path = ".." [dependencies.multiversx-sc-wasm-adapter] -version = "=0.52.0" +version = "=0.52.2" [workspace] members = ["."] diff --git a/fee-market/Cargo.toml b/fee-market/Cargo.toml index 1296fcb4..bdd79af3 100644 --- a/fee-market/Cargo.toml +++ b/fee-market/Cargo.toml @@ -24,10 +24,10 @@ path = "../pair-mock" path = "../router-mock" [dependencies.multiversx-sc] -version = "=0.52.0" +version = "=0.52.2" [dev-dependencies] num-bigint = "0.4.2" [dev-dependencies.multiversx-sc-scenario] -version = "=0.52.0" +version = "=0.52.2" diff --git a/fee-market/meta/Cargo.toml b/fee-market/meta/Cargo.toml index e2b4d125..e5fed42e 100644 --- a/fee-market/meta/Cargo.toml +++ b/fee-market/meta/Cargo.toml @@ -8,5 +8,5 @@ publish = false path = ".." [dependencies.multiversx-sc-meta-lib] -version = "=0.52.0" +version = "=0.52.2" default-features = false diff --git a/fee-market/wasm-fee-marker-full/Cargo.lock b/fee-market/wasm-fee-marker-full/Cargo.lock index 2e11189f..cad73ead 100644 --- a/fee-market/wasm-fee-marker-full/Cargo.lock +++ b/fee-market/wasm-fee-marker-full/Cargo.lock @@ -68,9 +68,9 @@ checksum = "6fe2267d4ed49bc07b63801559be28c718ea06c4738b7a03c94df7386d2cde46" [[package]] name = "multiversx-sc" -version = "0.52.0" +version = "0.52.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "31bcb4dc736ef975b59878720de1c731788aa1a5a197888606e7d3d6600b1925" +checksum = "290e945d3d268d2b0b7cc68f3c74844d35eaa06c1b7861a18ded3726bc6e6587" dependencies = [ "bitflags", "hex-literal", @@ -105,9 +105,9 @@ dependencies = [ [[package]] name = "multiversx-sc-derive" -version = "0.52.0" +version = "0.52.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ae92e4121bad55ffc476028c25722bc01ba989b4953837fb7f4b6be9dba398ed" +checksum = "f6363ecf098fa4687ca532d621af1222890ffe97ed333e19b6b206d621c3f9d4" dependencies = [ "hex", "proc-macro2", @@ -118,9 +118,9 @@ dependencies = [ [[package]] name = "multiversx-sc-wasm-adapter" -version = "0.52.0" +version = "0.52.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bbb8f0bf218a2e3f02d37c3112fd099bdd72d307e69e97b4773fa8c16bf6ab87" +checksum = "d3a7ef581b703ca0cef3ebc500ee2bf739c4def405ab2490e8b680a039e3408d" dependencies = [ "multiversx-sc", ] diff --git a/fee-market/wasm-fee-marker-full/Cargo.toml b/fee-market/wasm-fee-marker-full/Cargo.toml index 96dea3d5..5511c2cb 100644 --- a/fee-market/wasm-fee-marker-full/Cargo.toml +++ b/fee-market/wasm-fee-marker-full/Cargo.toml @@ -28,7 +28,7 @@ panic = "abort" path = ".." [dependencies.multiversx-sc-wasm-adapter] -version = "=0.52.0" +version = "=0.52.2" [workspace] members = ["."] diff --git a/fee-market/wasm-multisig-view/Cargo.lock b/fee-market/wasm-multisig-view/Cargo.lock index 73140ef8..361c68fb 100644 --- a/fee-market/wasm-multisig-view/Cargo.lock +++ b/fee-market/wasm-multisig-view/Cargo.lock @@ -68,9 +68,9 @@ dependencies = [ [[package]] name = "multiversx-sc" -version = "0.52.0" +version = "0.52.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "31bcb4dc736ef975b59878720de1c731788aa1a5a197888606e7d3d6600b1925" +checksum = "290e945d3d268d2b0b7cc68f3c74844d35eaa06c1b7861a18ded3726bc6e6587" dependencies = [ "bitflags", "hex-literal", @@ -105,9 +105,9 @@ dependencies = [ [[package]] name = "multiversx-sc-derive" -version = "0.52.0" +version = "0.52.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ae92e4121bad55ffc476028c25722bc01ba989b4953837fb7f4b6be9dba398ed" +checksum = "f6363ecf098fa4687ca532d621af1222890ffe97ed333e19b6b206d621c3f9d4" dependencies = [ "hex", "proc-macro2", @@ -118,9 +118,9 @@ dependencies = [ [[package]] name = "multiversx-sc-wasm-adapter" -version = "0.52.0" +version = "0.52.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bbb8f0bf218a2e3f02d37c3112fd099bdd72d307e69e97b4773fa8c16bf6ab87" +checksum = "d3a7ef581b703ca0cef3ebc500ee2bf739c4def405ab2490e8b680a039e3408d" dependencies = [ "multiversx-sc", ] diff --git a/fee-market/wasm-multisig-view/Cargo.toml b/fee-market/wasm-multisig-view/Cargo.toml index a94e1b06..a691d6ab 100644 --- a/fee-market/wasm-multisig-view/Cargo.toml +++ b/fee-market/wasm-multisig-view/Cargo.toml @@ -28,7 +28,7 @@ panic = "abort" path = ".." [dependencies.multiversx-sc-wasm-adapter] -version = "=0.52.0" +version = "=0.52.2" [workspace] members = ["."] diff --git a/fee-market/wasm/Cargo.lock b/fee-market/wasm/Cargo.lock index faf454e5..129b7bab 100644 --- a/fee-market/wasm/Cargo.lock +++ b/fee-market/wasm/Cargo.lock @@ -68,9 +68,9 @@ checksum = "6fe2267d4ed49bc07b63801559be28c718ea06c4738b7a03c94df7386d2cde46" [[package]] name = "multiversx-sc" -version = "0.52.0" +version = "0.52.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "31bcb4dc736ef975b59878720de1c731788aa1a5a197888606e7d3d6600b1925" +checksum = "290e945d3d268d2b0b7cc68f3c74844d35eaa06c1b7861a18ded3726bc6e6587" dependencies = [ "bitflags", "hex-literal", @@ -105,9 +105,9 @@ dependencies = [ [[package]] name = "multiversx-sc-derive" -version = "0.52.0" +version = "0.52.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ae92e4121bad55ffc476028c25722bc01ba989b4953837fb7f4b6be9dba398ed" +checksum = "f6363ecf098fa4687ca532d621af1222890ffe97ed333e19b6b206d621c3f9d4" dependencies = [ "hex", "proc-macro2", @@ -118,9 +118,9 @@ dependencies = [ [[package]] name = "multiversx-sc-wasm-adapter" -version = "0.52.0" +version = "0.52.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bbb8f0bf218a2e3f02d37c3112fd099bdd72d307e69e97b4773fa8c16bf6ab87" +checksum = "d3a7ef581b703ca0cef3ebc500ee2bf739c4def405ab2490e8b680a039e3408d" dependencies = [ "multiversx-sc", ] diff --git a/fee-market/wasm/Cargo.toml b/fee-market/wasm/Cargo.toml index 4b496b75..609a2b00 100644 --- a/fee-market/wasm/Cargo.toml +++ b/fee-market/wasm/Cargo.toml @@ -28,7 +28,7 @@ panic = "abort" path = ".." [dependencies.multiversx-sc-wasm-adapter] -version = "=0.52.0" +version = "=0.52.2" [workspace] members = ["."] diff --git a/header-verifier/Cargo.toml b/header-verifier/Cargo.toml index d017af4a..c95c0f84 100644 --- a/header-verifier/Cargo.toml +++ b/header-verifier/Cargo.toml @@ -9,7 +9,7 @@ publish = false path = "src/lib.rs" [dependencies.multiversx-sc] -version = "0.52.0" +version = "0.52.2" [dependencies.bls-signature] path = "../common/bls-signature" @@ -21,4 +21,4 @@ path = "../common/transaction" num-bigint = "0.4.2" [dev-dependencies.multiversx-sc-scenario] -version = "0.52.0" +version = "0.52.2" diff --git a/header-verifier/meta/Cargo.toml b/header-verifier/meta/Cargo.toml index e1844a7f..fe3a30b7 100644 --- a/header-verifier/meta/Cargo.toml +++ b/header-verifier/meta/Cargo.toml @@ -8,5 +8,5 @@ publish = false path = ".." [dependencies.multiversx-sc-meta-lib] -version = "0.52.0" +version = "0.52.2" default-features = false diff --git a/header-verifier/wasm-header-verifier-full/Cargo.lock b/header-verifier/wasm-header-verifier-full/Cargo.lock index 43d6c763..3f2e0c9f 100644 --- a/header-verifier/wasm-header-verifier-full/Cargo.lock +++ b/header-verifier/wasm-header-verifier-full/Cargo.lock @@ -65,9 +65,9 @@ checksum = "6fe2267d4ed49bc07b63801559be28c718ea06c4738b7a03c94df7386d2cde46" [[package]] name = "multiversx-sc" -version = "0.52.0" +version = "0.52.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "31bcb4dc736ef975b59878720de1c731788aa1a5a197888606e7d3d6600b1925" +checksum = "290e945d3d268d2b0b7cc68f3c74844d35eaa06c1b7861a18ded3726bc6e6587" dependencies = [ "bitflags", "hex-literal", @@ -102,9 +102,9 @@ dependencies = [ [[package]] name = "multiversx-sc-derive" -version = "0.52.0" +version = "0.52.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ae92e4121bad55ffc476028c25722bc01ba989b4953837fb7f4b6be9dba398ed" +checksum = "f6363ecf098fa4687ca532d621af1222890ffe97ed333e19b6b206d621c3f9d4" dependencies = [ "hex", "proc-macro2", @@ -115,9 +115,9 @@ dependencies = [ [[package]] name = "multiversx-sc-wasm-adapter" -version = "0.52.0" +version = "0.52.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bbb8f0bf218a2e3f02d37c3112fd099bdd72d307e69e97b4773fa8c16bf6ab87" +checksum = "d3a7ef581b703ca0cef3ebc500ee2bf739c4def405ab2490e8b680a039e3408d" dependencies = [ "multiversx-sc", ] diff --git a/header-verifier/wasm-header-verifier-full/Cargo.toml b/header-verifier/wasm-header-verifier-full/Cargo.toml index 82108857..bc315cdb 100644 --- a/header-verifier/wasm-header-verifier-full/Cargo.toml +++ b/header-verifier/wasm-header-verifier-full/Cargo.toml @@ -28,7 +28,7 @@ panic = "abort" path = ".." [dependencies.multiversx-sc-wasm-adapter] -version = "0.52.0" +version = "0.52.2" [workspace] members = ["."] diff --git a/header-verifier/wasm-multisig-view/Cargo.lock b/header-verifier/wasm-multisig-view/Cargo.lock index 9cce39ba..e988cf67 100644 --- a/header-verifier/wasm-multisig-view/Cargo.lock +++ b/header-verifier/wasm-multisig-view/Cargo.lock @@ -65,9 +65,9 @@ dependencies = [ [[package]] name = "multiversx-sc" -version = "0.52.0" +version = "0.52.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "31bcb4dc736ef975b59878720de1c731788aa1a5a197888606e7d3d6600b1925" +checksum = "290e945d3d268d2b0b7cc68f3c74844d35eaa06c1b7861a18ded3726bc6e6587" dependencies = [ "bitflags", "hex-literal", @@ -102,9 +102,9 @@ dependencies = [ [[package]] name = "multiversx-sc-derive" -version = "0.52.0" +version = "0.52.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ae92e4121bad55ffc476028c25722bc01ba989b4953837fb7f4b6be9dba398ed" +checksum = "f6363ecf098fa4687ca532d621af1222890ffe97ed333e19b6b206d621c3f9d4" dependencies = [ "hex", "proc-macro2", @@ -115,9 +115,9 @@ dependencies = [ [[package]] name = "multiversx-sc-wasm-adapter" -version = "0.52.0" +version = "0.52.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bbb8f0bf218a2e3f02d37c3112fd099bdd72d307e69e97b4773fa8c16bf6ab87" +checksum = "d3a7ef581b703ca0cef3ebc500ee2bf739c4def405ab2490e8b680a039e3408d" dependencies = [ "multiversx-sc", ] diff --git a/header-verifier/wasm-multisig-view/Cargo.toml b/header-verifier/wasm-multisig-view/Cargo.toml index 3734afa1..db1ab918 100644 --- a/header-verifier/wasm-multisig-view/Cargo.toml +++ b/header-verifier/wasm-multisig-view/Cargo.toml @@ -28,7 +28,7 @@ panic = "abort" path = ".." [dependencies.multiversx-sc-wasm-adapter] -version = "0.52.0" +version = "0.52.2" [workspace] members = ["."] diff --git a/header-verifier/wasm/Cargo.lock b/header-verifier/wasm/Cargo.lock index efcb7d38..befe0cda 100644 --- a/header-verifier/wasm/Cargo.lock +++ b/header-verifier/wasm/Cargo.lock @@ -65,9 +65,9 @@ checksum = "6fe2267d4ed49bc07b63801559be28c718ea06c4738b7a03c94df7386d2cde46" [[package]] name = "multiversx-sc" -version = "0.52.0" +version = "0.52.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "31bcb4dc736ef975b59878720de1c731788aa1a5a197888606e7d3d6600b1925" +checksum = "290e945d3d268d2b0b7cc68f3c74844d35eaa06c1b7861a18ded3726bc6e6587" dependencies = [ "bitflags", "hex-literal", @@ -102,9 +102,9 @@ dependencies = [ [[package]] name = "multiversx-sc-derive" -version = "0.52.0" +version = "0.52.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ae92e4121bad55ffc476028c25722bc01ba989b4953837fb7f4b6be9dba398ed" +checksum = "f6363ecf098fa4687ca532d621af1222890ffe97ed333e19b6b206d621c3f9d4" dependencies = [ "hex", "proc-macro2", @@ -115,9 +115,9 @@ dependencies = [ [[package]] name = "multiversx-sc-wasm-adapter" -version = "0.52.0" +version = "0.52.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bbb8f0bf218a2e3f02d37c3112fd099bdd72d307e69e97b4773fa8c16bf6ab87" +checksum = "d3a7ef581b703ca0cef3ebc500ee2bf739c4def405ab2490e8b680a039e3408d" dependencies = [ "multiversx-sc", ] diff --git a/header-verifier/wasm/Cargo.toml b/header-verifier/wasm/Cargo.toml index e0da32e6..f429491b 100644 --- a/header-verifier/wasm/Cargo.toml +++ b/header-verifier/wasm/Cargo.toml @@ -28,7 +28,7 @@ panic = "abort" path = ".." [dependencies.multiversx-sc-wasm-adapter] -version = "0.52.0" +version = "0.52.2" [workspace] members = ["."] diff --git a/pair-mock/Cargo.toml b/pair-mock/Cargo.toml index c80b4137..a36be0aa 100644 --- a/pair-mock/Cargo.toml +++ b/pair-mock/Cargo.toml @@ -9,10 +9,10 @@ publish = false path = "src/pair_mock.rs" [dependencies.multiversx-sc] -version = "0.52.0" +version = "0.52.2" [dev-dependencies] num-bigint = "0.4" [dev-dependencies.multiversx-sc-scenario] -version = "0.52.0" +version = "0.52.2" diff --git a/pair-mock/meta/Cargo.toml b/pair-mock/meta/Cargo.toml index 3d453ea8..5e2e2e19 100644 --- a/pair-mock/meta/Cargo.toml +++ b/pair-mock/meta/Cargo.toml @@ -8,5 +8,5 @@ publish = false path = ".." [dependencies.multiversx-sc-meta-lib] -version = "0.52.0" +version = "0.52.2" default-features = false diff --git a/pair-mock/wasm/Cargo.lock b/pair-mock/wasm/Cargo.lock index 1f10731c..859a5906 100644 --- a/pair-mock/wasm/Cargo.lock +++ b/pair-mock/wasm/Cargo.lock @@ -40,9 +40,9 @@ checksum = "6fe2267d4ed49bc07b63801559be28c718ea06c4738b7a03c94df7386d2cde46" [[package]] name = "multiversx-sc" -version = "0.52.0" +version = "0.52.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "31bcb4dc736ef975b59878720de1c731788aa1a5a197888606e7d3d6600b1925" +checksum = "290e945d3d268d2b0b7cc68f3c74844d35eaa06c1b7861a18ded3726bc6e6587" dependencies = [ "bitflags", "hex-literal", @@ -77,9 +77,9 @@ dependencies = [ [[package]] name = "multiversx-sc-derive" -version = "0.52.0" +version = "0.52.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ae92e4121bad55ffc476028c25722bc01ba989b4953837fb7f4b6be9dba398ed" +checksum = "f6363ecf098fa4687ca532d621af1222890ffe97ed333e19b6b206d621c3f9d4" dependencies = [ "hex", "proc-macro2", @@ -90,9 +90,9 @@ dependencies = [ [[package]] name = "multiversx-sc-wasm-adapter" -version = "0.52.0" +version = "0.52.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bbb8f0bf218a2e3f02d37c3112fd099bdd72d307e69e97b4773fa8c16bf6ab87" +checksum = "d3a7ef581b703ca0cef3ebc500ee2bf739c4def405ab2490e8b680a039e3408d" dependencies = [ "multiversx-sc", ] diff --git a/pair-mock/wasm/Cargo.toml b/pair-mock/wasm/Cargo.toml index dc1b6a59..0d2bce8f 100644 --- a/pair-mock/wasm/Cargo.toml +++ b/pair-mock/wasm/Cargo.toml @@ -28,7 +28,7 @@ panic = "abort" path = ".." [dependencies.multiversx-sc-wasm-adapter] -version = "0.52.0" +version = "0.52.2" [workspace] members = ["."] diff --git a/router-mock/Cargo.toml b/router-mock/Cargo.toml index a97c8b0d..eafe1c29 100644 --- a/router-mock/Cargo.toml +++ b/router-mock/Cargo.toml @@ -9,10 +9,10 @@ publish = false path = "src/router_mock.rs" [dependencies.multiversx-sc] -version = "0.52.0" +version = "0.52.2" [dev-dependencies] num-bigint = "0.4" [dev-dependencies.multiversx-sc-scenario] -version = "0.52.0" +version = "0.52.2" diff --git a/router-mock/meta/Cargo.toml b/router-mock/meta/Cargo.toml index 57071012..ab903f34 100644 --- a/router-mock/meta/Cargo.toml +++ b/router-mock/meta/Cargo.toml @@ -8,5 +8,5 @@ publish = false path = ".." [dependencies.multiversx-sc-meta-lib] -version = "0.52.0" +version = "0.52.2" default-features = false diff --git a/router-mock/wasm/Cargo.lock b/router-mock/wasm/Cargo.lock index b6a7beff..edbf9182 100644 --- a/router-mock/wasm/Cargo.lock +++ b/router-mock/wasm/Cargo.lock @@ -40,9 +40,9 @@ checksum = "6fe2267d4ed49bc07b63801559be28c718ea06c4738b7a03c94df7386d2cde46" [[package]] name = "multiversx-sc" -version = "0.52.0" +version = "0.52.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "31bcb4dc736ef975b59878720de1c731788aa1a5a197888606e7d3d6600b1925" +checksum = "290e945d3d268d2b0b7cc68f3c74844d35eaa06c1b7861a18ded3726bc6e6587" dependencies = [ "bitflags", "hex-literal", @@ -77,9 +77,9 @@ dependencies = [ [[package]] name = "multiversx-sc-derive" -version = "0.52.0" +version = "0.52.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ae92e4121bad55ffc476028c25722bc01ba989b4953837fb7f4b6be9dba398ed" +checksum = "f6363ecf098fa4687ca532d621af1222890ffe97ed333e19b6b206d621c3f9d4" dependencies = [ "hex", "proc-macro2", @@ -90,9 +90,9 @@ dependencies = [ [[package]] name = "multiversx-sc-wasm-adapter" -version = "0.52.0" +version = "0.52.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bbb8f0bf218a2e3f02d37c3112fd099bdd72d307e69e97b4773fa8c16bf6ab87" +checksum = "d3a7ef581b703ca0cef3ebc500ee2bf739c4def405ab2490e8b680a039e3408d" dependencies = [ "multiversx-sc", ] diff --git a/router-mock/wasm/Cargo.toml b/router-mock/wasm/Cargo.toml index 2984bd64..9087a3d1 100644 --- a/router-mock/wasm/Cargo.toml +++ b/router-mock/wasm/Cargo.toml @@ -28,7 +28,7 @@ panic = "abort" path = ".." [dependencies.multiversx-sc-wasm-adapter] -version = "0.52.0" +version = "0.52.2" [workspace] members = ["."] From 87613bbdd5892bec1c7573ee859f3d0fc761d162 Mon Sep 17 00:00:00 2001 From: Andrei Baltariu Date: Fri, 2 Aug 2024 01:20:12 +0300 Subject: [PATCH 230/523] Removed call_nft_create function Signed-off-by: Andrei Baltariu --- token-handler/src/transfer_tokens.rs | 20 +++++--------------- 1 file changed, 5 insertions(+), 15 deletions(-) diff --git a/token-handler/src/transfer_tokens.rs b/token-handler/src/transfer_tokens.rs index 2daeff4e..b52f45b8 100644 --- a/token-handler/src/transfer_tokens.rs +++ b/token-handler/src/transfer_tokens.rs @@ -66,7 +66,11 @@ pub trait TransferTokensModule: &operation_token.token_data, ); - nonce = self.call_nft_create_built_in_function(&arg_buffer); + self.send_raw().call_local_esdt_built_in_function( + self.blockchain().get_gas_left(), + &ManagedBuffer::from(ESDT_NFT_CREATE_FUNC_NAME), + &arg_buffer, + ); } output_payments.push(OperationEsdtPayment { @@ -79,20 +83,6 @@ pub trait TransferTokensModule: output_payments } - fn call_nft_create_built_in_function(&self, arg_buffer: &ManagedArgBuffer) -> u64 { - let output = self.send_raw().call_local_esdt_built_in_function( - self.blockchain().get_gas_left(), - &ManagedBuffer::from(ESDT_NFT_CREATE_FUNC_NAME), - arg_buffer, - ); - - if let Some(first_result_bytes) = output.try_get(0) { - first_result_bytes.parse_as_u64().unwrap_or_default() - } else { - 0 - } - } - fn get_nft_create_args( &self, token_identifier: &TokenIdentifier, From 580621f0e7ea8a6d6ed24ad51a5f531e251932fc Mon Sep 17 00:00:00 2001 From: Andrei Baltariu Date: Fri, 2 Aug 2024 01:24:08 +0300 Subject: [PATCH 231/523] Used operation token nonce for condition and call Signed-off-by: Andrei Baltariu --- token-handler/src/transfer_tokens.rs | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/token-handler/src/transfer_tokens.rs b/token-handler/src/transfer_tokens.rs index b52f45b8..c3233987 100644 --- a/token-handler/src/transfer_tokens.rs +++ b/token-handler/src/transfer_tokens.rs @@ -47,9 +47,7 @@ pub trait TransferTokensModule: ManagedVec::new(); for operation_token in tokens.iter() { - let mut nonce = operation_token.token_nonce; - - if nonce == 0 { + if operation_token.token_nonce == 0 { self.tx() .to(ToSelf) .typed(system_proxy::UserBuiltinProxy) @@ -75,7 +73,7 @@ pub trait TransferTokensModule: output_payments.push(OperationEsdtPayment { token_identifier: operation_token.token_identifier, - token_nonce: nonce, + token_nonce: operation_token.token_nonce, token_data: operation_token.token_data, }); } From eab8e988e9b160201a8aa537814b070159403acc Mon Sep 17 00:00:00 2001 From: Andrei Baltariu Date: Fri, 2 Aug 2024 01:30:26 +0300 Subject: [PATCH 232/523] Added whitelist require Signed-off-by: Andrei Baltariu --- token-handler/src/mint_tokens.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/token-handler/src/mint_tokens.rs b/token-handler/src/mint_tokens.rs index 6d0162e1..0571e349 100644 --- a/token-handler/src/mint_tokens.rs +++ b/token-handler/src/mint_tokens.rs @@ -29,6 +29,7 @@ pub trait TransferTokensModule: to: ManagedAddress, tokens: MultiValueEncoded>, ) { + self.require_caller_to_be_whitelisted(); let mut output_payments: ManagedVec> = ManagedVec::new(); let tokens_vec = tokens.to_vec(); From 0fc2313c8d72c4a6b6d9ef10e895dba3375108c8 Mon Sep 17 00:00:00 2001 From: Andrei Baltariu Date: Fri, 2 Aug 2024 01:31:05 +0300 Subject: [PATCH 233/523] Removed unused import Signed-off-by: Andrei Baltariu --- token-handler/src/burn_tokens.rs | 1 - 1 file changed, 1 deletion(-) diff --git a/token-handler/src/burn_tokens.rs b/token-handler/src/burn_tokens.rs index ef3a60b3..99ed4fc3 100644 --- a/token-handler/src/burn_tokens.rs +++ b/token-handler/src/burn_tokens.rs @@ -1,7 +1,6 @@ use crate::{common, err_msg}; use multiversx_sc::{ hex_literal::hex, - require, types::{system_proxy, ToSelf}, }; use transaction::Operation; From 6dc524d1a855236010a3ffb506277e489a66a77c Mon Sep 17 00:00:00 2001 From: Andrei Baltariu Date: Fri, 2 Aug 2024 01:53:58 +0300 Subject: [PATCH 234/523] Switched to EsdtTokenPayment struct from Op EsdtTokenPayment Signed-off-by: Andrei Baltariu --- token-handler/src/transfer_tokens.rs | 26 +++++++++++--------------- 1 file changed, 11 insertions(+), 15 deletions(-) diff --git a/token-handler/src/transfer_tokens.rs b/token-handler/src/transfer_tokens.rs index c3233987..a1cf620a 100644 --- a/token-handler/src/transfer_tokens.rs +++ b/token-handler/src/transfer_tokens.rs @@ -29,12 +29,7 @@ pub trait TransferTokensModule: ) { let mut output_payments = self.mint_tokens(&tokens.to_vec()); let call_value_esdt_transfer = self.call_value().all_esdt_transfers(); - let mapped_esdt_transfers: ManagedVec> = - call_value_esdt_transfer - .iter() - .map(|transfer| transfer.into()) - .collect(); - output_payments.extend(&mapped_esdt_transfers); + output_payments.extend(&call_value_esdt_transfer.clone_value()); self.distribute_payments(&to, &output_payments, &opt_transfer_data); } @@ -42,9 +37,8 @@ pub trait TransferTokensModule: fn mint_tokens( &self, tokens: &ManagedVec>, - ) -> ManagedVec> { - let mut output_payments: ManagedVec> = - ManagedVec::new(); + ) -> ManagedVec> { + let mut output_payments: ManagedVec = ManagedVec::new(); for operation_token in tokens.iter() { if operation_token.token_nonce == 0 { @@ -71,11 +65,13 @@ pub trait TransferTokensModule: ); } - output_payments.push(OperationEsdtPayment { - token_identifier: operation_token.token_identifier, - token_nonce: operation_token.token_nonce, - token_data: operation_token.token_data, - }); + let esdt_token_payment = EsdtTokenPayment::new( + operation_token.token_identifier, + operation_token.token_nonce, + operation_token.token_data.amount, + ); + + output_payments.push(esdt_token_payment); } output_payments @@ -120,7 +116,7 @@ pub trait TransferTokensModule: fn distribute_payments( &self, receiver: &ManagedAddress, - tokens: &ManagedVec>, + tokens: &ManagedVec>, opt_transfer_data: &Option>, ) { let mapped_tokens: ManagedVec> = From 6b5eb37bdc958d53860cf15caf4225ebab159473 Mon Sep 17 00:00:00 2001 From: Andrei Baltariu Date: Fri, 2 Aug 2024 01:57:31 +0300 Subject: [PATCH 235/523] Removed mapping and tokens Signed-off-by: Andrei Baltariu --- token-handler/src/transfer_tokens.rs | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/token-handler/src/transfer_tokens.rs b/token-handler/src/transfer_tokens.rs index a1cf620a..179a4f06 100644 --- a/token-handler/src/transfer_tokens.rs +++ b/token-handler/src/transfer_tokens.rs @@ -119,9 +119,6 @@ pub trait TransferTokensModule: tokens: &ManagedVec>, opt_transfer_data: &Option>, ) { - let mapped_tokens: ManagedVec> = - tokens.iter().map(|token| token.into()).collect(); - match &opt_transfer_data { Some(transfer_data) => { let mut args = ManagedArgBuffer::new(); @@ -133,13 +130,13 @@ pub trait TransferTokensModule: .to(receiver) .raw_call(transfer_data.function.clone()) .arguments_raw(args.clone()) - .multi_esdt(mapped_tokens.clone()) + .payment(tokens) .gas(transfer_data.gas_limit) .register_promise(); } None => { let own_address = self.blockchain().get_sc_address(); - let args = self.get_contract_call_args(receiver, &mapped_tokens); + let args = self.get_contract_call_args(receiver, tokens); self.tx() .to(own_address) From 7c9931dd60065091830623cbbbdc0b7642a7497e Mon Sep 17 00:00:00 2001 From: Andrei Baltariu Date: Fri, 2 Aug 2024 02:12:39 +0300 Subject: [PATCH 236/523] Fixed deploy setup Signed-off-by: Andrei Baltariu --- token-handler/tests/token_handler_blackbox_tests.rs | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/token-handler/tests/token_handler_blackbox_tests.rs b/token-handler/tests/token_handler_blackbox_tests.rs index 6a43c75b..d6fb4e5b 100644 --- a/token-handler/tests/token_handler_blackbox_tests.rs +++ b/token-handler/tests/token_handler_blackbox_tests.rs @@ -18,7 +18,6 @@ const FUNGIBLE_TOKEN_ID: TestTokenIdentifier = TestTokenIdentifier::new("FUNG-12 const _PREFIX_NFT_TOKEN_ID: TestTokenIdentifier = TestTokenIdentifier::new("sov-NFT-123456"); const WEGLD_BALANCE: u128 = 100_000_000_000_000_000; -const CHAIN_PREFIX: &str = "sov"; fn world() -> ScenarioWorld { let mut blockchain = ScenarioWorld::new(); @@ -55,12 +54,12 @@ impl TokenHandlerTestState { Self { world } } - fn propose_deploy(&mut self, chain_prefix: ManagedBuffer) -> &mut Self { + fn propose_deploy(&mut self) -> &mut Self { self.world .tx() .from(OWNER_ADDRESS) .typed(token_handler_proxy::TokenHandlerProxy) - .init(chain_prefix) + .init() .code(TOKEN_HANDLER_CODE_PATH) .new_address(TOKEN_HANDLER_ADDRESS) .run(); @@ -121,7 +120,7 @@ impl TokenHandlerTestState { fn test_deploy() { let mut state = TokenHandlerTestState::new(); - state.propose_deploy(CHAIN_PREFIX.into()); + state.propose_deploy(); } #[test] @@ -132,7 +131,7 @@ fn test_transfer_tokens_no_payment() { let esdt_payment = Option::None; let opt_transfer_data = Option::None; - state.propose_deploy(CHAIN_PREFIX.into()); + state.propose_deploy(); state.propose_transfer_tokens( esdt_payment, @@ -159,7 +158,7 @@ fn test_transfer_tokens_fungible_payment() { }); let opt_transfer_data = Option::None; - state.propose_deploy(CHAIN_PREFIX.into()); + state.propose_deploy(); state.propose_transfer_tokens( esdt_payment, From cbcb4b78d5f1ced7559e8038a42b64e5305bd224 Mon Sep 17 00:00:00 2001 From: Andrei Baltariu Date: Fri, 2 Aug 2024 02:18:29 +0300 Subject: [PATCH 237/523] Moved distribute_payments Signed-off-by: Andrei Baltariu --- token-handler/src/transfer_tokens.rs | 70 ++++++++++++++-------------- 1 file changed, 35 insertions(+), 35 deletions(-) diff --git a/token-handler/src/transfer_tokens.rs b/token-handler/src/transfer_tokens.rs index 179a4f06..4840616c 100644 --- a/token-handler/src/transfer_tokens.rs +++ b/token-handler/src/transfer_tokens.rs @@ -34,6 +34,41 @@ pub trait TransferTokensModule: self.distribute_payments(&to, &output_payments, &opt_transfer_data); } + fn distribute_payments( + &self, + receiver: &ManagedAddress, + tokens: &ManagedVec>, + opt_transfer_data: &Option>, + ) { + match &opt_transfer_data { + Some(transfer_data) => { + let mut args = ManagedArgBuffer::new(); + for arg in &transfer_data.args { + args.push_arg(arg); + } + + self.tx() + .to(receiver) + .raw_call(transfer_data.function.clone()) + .arguments_raw(args.clone()) + .payment(tokens) + .gas(transfer_data.gas_limit) + .register_promise(); + } + None => { + let own_address = self.blockchain().get_sc_address(); + let args = self.get_contract_call_args(receiver, tokens); + + self.tx() + .to(own_address) + .raw_call(ESDT_MULTI_TRANSFER_FUNC_NAME) + .arguments_raw(args) + .gas(TRANSACTION_GAS) + .register_promise(); + } + } + } + fn mint_tokens( &self, tokens: &ManagedVec>, @@ -113,41 +148,6 @@ pub trait TransferTokensModule: arg_buffer } - fn distribute_payments( - &self, - receiver: &ManagedAddress, - tokens: &ManagedVec>, - opt_transfer_data: &Option>, - ) { - match &opt_transfer_data { - Some(transfer_data) => { - let mut args = ManagedArgBuffer::new(); - for arg in &transfer_data.args { - args.push_arg(arg); - } - - self.tx() - .to(receiver) - .raw_call(transfer_data.function.clone()) - .arguments_raw(args.clone()) - .payment(tokens) - .gas(transfer_data.gas_limit) - .register_promise(); - } - None => { - let own_address = self.blockchain().get_sc_address(); - let args = self.get_contract_call_args(receiver, tokens); - - self.tx() - .to(own_address) - .raw_call(ESDT_MULTI_TRANSFER_FUNC_NAME) - .arguments_raw(args) - .gas(TRANSACTION_GAS) - .register_promise(); - } - } - } - fn get_contract_call_args( self, to: &ManagedAddress, From 2216ca357914eb3362fa478d19e68e932c623cf8 Mon Sep 17 00:00:00 2001 From: Andrei Baltariu Date: Fri, 2 Aug 2024 12:47:24 +0300 Subject: [PATCH 238/523] Added .into() Signed-off-by: Andrei Baltariu --- token-handler/src/transfer_tokens.rs | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/token-handler/src/transfer_tokens.rs b/token-handler/src/transfer_tokens.rs index 4840616c..48d8ff73 100644 --- a/token-handler/src/transfer_tokens.rs +++ b/token-handler/src/transfer_tokens.rs @@ -100,13 +100,7 @@ pub trait TransferTokensModule: ); } - let esdt_token_payment = EsdtTokenPayment::new( - operation_token.token_identifier, - operation_token.token_nonce, - operation_token.token_data.amount, - ); - - output_payments.push(esdt_token_payment); + output_payments.push(operation_token.into()); } output_payments From 6a16fb03e3296888c960ff20f556977c733e3fee Mon Sep 17 00:00:00 2001 From: Andrei Baltariu Date: Fri, 2 Aug 2024 02:18:29 +0300 Subject: [PATCH 239/523] Moved distribute_payments Signed-off-by: Andrei Baltariu --- token-handler/src/transfer_tokens.rs | 70 ++++++++++++++-------------- 1 file changed, 35 insertions(+), 35 deletions(-) diff --git a/token-handler/src/transfer_tokens.rs b/token-handler/src/transfer_tokens.rs index 179a4f06..4840616c 100644 --- a/token-handler/src/transfer_tokens.rs +++ b/token-handler/src/transfer_tokens.rs @@ -34,6 +34,41 @@ pub trait TransferTokensModule: self.distribute_payments(&to, &output_payments, &opt_transfer_data); } + fn distribute_payments( + &self, + receiver: &ManagedAddress, + tokens: &ManagedVec>, + opt_transfer_data: &Option>, + ) { + match &opt_transfer_data { + Some(transfer_data) => { + let mut args = ManagedArgBuffer::new(); + for arg in &transfer_data.args { + args.push_arg(arg); + } + + self.tx() + .to(receiver) + .raw_call(transfer_data.function.clone()) + .arguments_raw(args.clone()) + .payment(tokens) + .gas(transfer_data.gas_limit) + .register_promise(); + } + None => { + let own_address = self.blockchain().get_sc_address(); + let args = self.get_contract_call_args(receiver, tokens); + + self.tx() + .to(own_address) + .raw_call(ESDT_MULTI_TRANSFER_FUNC_NAME) + .arguments_raw(args) + .gas(TRANSACTION_GAS) + .register_promise(); + } + } + } + fn mint_tokens( &self, tokens: &ManagedVec>, @@ -113,41 +148,6 @@ pub trait TransferTokensModule: arg_buffer } - fn distribute_payments( - &self, - receiver: &ManagedAddress, - tokens: &ManagedVec>, - opt_transfer_data: &Option>, - ) { - match &opt_transfer_data { - Some(transfer_data) => { - let mut args = ManagedArgBuffer::new(); - for arg in &transfer_data.args { - args.push_arg(arg); - } - - self.tx() - .to(receiver) - .raw_call(transfer_data.function.clone()) - .arguments_raw(args.clone()) - .payment(tokens) - .gas(transfer_data.gas_limit) - .register_promise(); - } - None => { - let own_address = self.blockchain().get_sc_address(); - let args = self.get_contract_call_args(receiver, tokens); - - self.tx() - .to(own_address) - .raw_call(ESDT_MULTI_TRANSFER_FUNC_NAME) - .arguments_raw(args) - .gas(TRANSACTION_GAS) - .register_promise(); - } - } - } - fn get_contract_call_args( self, to: &ManagedAddress, From 5226cd753b9659046a913fcc55cee24ee51d73b6 Mon Sep 17 00:00:00 2001 From: Andrei Baltariu Date: Fri, 2 Aug 2024 12:47:24 +0300 Subject: [PATCH 240/523] Added .into() Signed-off-by: Andrei Baltariu --- token-handler/src/transfer_tokens.rs | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/token-handler/src/transfer_tokens.rs b/token-handler/src/transfer_tokens.rs index 4840616c..48d8ff73 100644 --- a/token-handler/src/transfer_tokens.rs +++ b/token-handler/src/transfer_tokens.rs @@ -100,13 +100,7 @@ pub trait TransferTokensModule: ); } - let esdt_token_payment = EsdtTokenPayment::new( - operation_token.token_identifier, - operation_token.token_nonce, - operation_token.token_data.amount, - ); - - output_payments.push(esdt_token_payment); + output_payments.push(operation_token.into()); } output_payments From 26e7ca9617fc0d9a807eb8a86220ecb287bc67ab Mon Sep 17 00:00:00 2001 From: Andrei Baltariu Date: Fri, 2 Aug 2024 12:47:31 +0300 Subject: [PATCH 241/523] Removed burn tokens module Signed-off-by: Andrei Baltariu --- token-handler/src/burn_tokens.rs | 43 -------------------------------- token-handler/src/lib.rs | 2 -- 2 files changed, 45 deletions(-) delete mode 100644 token-handler/src/burn_tokens.rs diff --git a/token-handler/src/burn_tokens.rs b/token-handler/src/burn_tokens.rs deleted file mode 100644 index d43292e9..00000000 --- a/token-handler/src/burn_tokens.rs +++ /dev/null @@ -1,43 +0,0 @@ -use crate::{common, err_msg}; -use multiversx_sc::{ - hex_literal::hex, - require, - types::{system_proxy, ToSelf}, -}; -use transaction::Operation; - -pub const ESDT_SYSTEM_SC_ADDRESS: [u8; 32] = - hex!("000000000000000000010000000000000000000000000000000000000002ffff"); - -#[multiversx_sc::module] -pub trait BurnTokensModule: utils::UtilsModule + common::storage::CommonStorage { - #[endpoint(burnTokens)] - fn burn_tokens_endpoint(&self, operation: Operation) { - require!( - !operation.tokens.is_empty(), - "Operation tokens array is empty" - ); - - self.burn_tokens(&operation); - } - - fn burn_tokens(&self, operation: &Operation) { - let sov_prefix = self.sov_prefix().get(); - - for token in operation.tokens.iter() { - if self.has_sov_prefix(&token.token_identifier, &sov_prefix) { - continue; - } - - self.tx() - .to(ToSelf) - .typed(system_proxy::UserBuiltinProxy) - .esdt_local_burn( - &token.token_identifier, - token.token_nonce, - &token.token_data.amount, - ) - .sync_call(); - } - } -} diff --git a/token-handler/src/lib.rs b/token-handler/src/lib.rs index ddd6c811..9495083c 100644 --- a/token-handler/src/lib.rs +++ b/token-handler/src/lib.rs @@ -3,7 +3,6 @@ #[allow(unused_imports)] use multiversx_sc::imports::*; -pub mod burn_tokens; pub mod common; pub mod token_handler_proxy; pub mod transfer_tokens; @@ -11,7 +10,6 @@ pub mod transfer_tokens; #[multiversx_sc::contract] pub trait TokenHandler: transfer_tokens::TransferTokensModule - + burn_tokens::BurnTokensModule + utils::UtilsModule + common::storage::CommonStorage + tx_batch_module::TxBatchModule From 21199bb0a02a63e8adb03cc9ba665f5642302dde Mon Sep 17 00:00:00 2001 From: Andrei Baltariu Date: Fri, 2 Aug 2024 12:51:01 +0300 Subject: [PATCH 242/523] Moved storage module Signed-off-by: Andrei Baltariu --- token-handler/src/common/mod.rs | 1 - token-handler/src/lib.rs | 4 ++-- token-handler/src/{common => }/storage.rs | 0 token-handler/src/transfer_tokens.rs | 9 +-------- token-handler/wasm-token-handler-full/src/lib.rs | 5 ++--- token-handler/wasm/src/lib.rs | 5 ++--- 6 files changed, 7 insertions(+), 17 deletions(-) delete mode 100644 token-handler/src/common/mod.rs rename token-handler/src/{common => }/storage.rs (100%) diff --git a/token-handler/src/common/mod.rs b/token-handler/src/common/mod.rs deleted file mode 100644 index 30f61eb6..00000000 --- a/token-handler/src/common/mod.rs +++ /dev/null @@ -1 +0,0 @@ -pub mod storage; diff --git a/token-handler/src/lib.rs b/token-handler/src/lib.rs index 9495083c..6c386b81 100644 --- a/token-handler/src/lib.rs +++ b/token-handler/src/lib.rs @@ -3,7 +3,7 @@ #[allow(unused_imports)] use multiversx_sc::imports::*; -pub mod common; +pub mod storage; pub mod token_handler_proxy; pub mod transfer_tokens; @@ -11,7 +11,7 @@ pub mod transfer_tokens; pub trait TokenHandler: transfer_tokens::TransferTokensModule + utils::UtilsModule - + common::storage::CommonStorage + + storage::CommonStorage + tx_batch_module::TxBatchModule { #[init] diff --git a/token-handler/src/common/storage.rs b/token-handler/src/storage.rs similarity index 100% rename from token-handler/src/common/storage.rs rename to token-handler/src/storage.rs diff --git a/token-handler/src/transfer_tokens.rs b/token-handler/src/transfer_tokens.rs index 48d8ff73..b7b465e9 100644 --- a/token-handler/src/transfer_tokens.rs +++ b/token-handler/src/transfer_tokens.rs @@ -8,15 +8,8 @@ use transaction::{GasLimit, OperationEsdtPayment, StolenFromFrameworkEsdtTokenDa const TRANSACTION_GAS: GasLimit = 30_000_000; -use crate::{burn_tokens, common}; - #[multiversx_sc::module] -pub trait TransferTokensModule: - utils::UtilsModule - + common::storage::CommonStorage - + burn_tokens::BurnTokensModule - + tx_batch_module::TxBatchModule -{ +pub trait TransferTokensModule: utils::UtilsModule + tx_batch_module::TxBatchModule { // NOTE: will use operation.data.op_sender as well when TransferAndExecuteByUser is implemented #[payable("*")] #[endpoint(transferTokens)] diff --git a/token-handler/wasm-token-handler-full/src/lib.rs b/token-handler/wasm-token-handler-full/src/lib.rs index 17cff7e3..46cce38e 100644 --- a/token-handler/wasm-token-handler-full/src/lib.rs +++ b/token-handler/wasm-token-handler-full/src/lib.rs @@ -6,9 +6,9 @@ // Init: 1 // Upgrade: 1 -// Endpoints: 10 +// Endpoints: 9 // Async Callback (empty): 1 -// Total number of exported functions: 13 +// Total number of exported functions: 12 #![no_std] @@ -21,7 +21,6 @@ multiversx_sc_wasm_adapter::endpoints! { init => init upgrade => upgrade transferTokens => transfer_tokens - burnTokens => burn_tokens_endpoint setMaxTxBatchSize => set_max_tx_batch_size setMaxTxBatchBlockDuration => set_max_tx_batch_block_duration getCurrentTxBatch => get_current_tx_batch diff --git a/token-handler/wasm/src/lib.rs b/token-handler/wasm/src/lib.rs index 17cff7e3..46cce38e 100644 --- a/token-handler/wasm/src/lib.rs +++ b/token-handler/wasm/src/lib.rs @@ -6,9 +6,9 @@ // Init: 1 // Upgrade: 1 -// Endpoints: 10 +// Endpoints: 9 // Async Callback (empty): 1 -// Total number of exported functions: 13 +// Total number of exported functions: 12 #![no_std] @@ -21,7 +21,6 @@ multiversx_sc_wasm_adapter::endpoints! { init => init upgrade => upgrade transferTokens => transfer_tokens - burnTokens => burn_tokens_endpoint setMaxTxBatchSize => set_max_tx_batch_size setMaxTxBatchBlockDuration => set_max_tx_batch_block_duration getCurrentTxBatch => get_current_tx_batch From 1fb71ea34409ef543441d1b8a0258ffd443185d8 Mon Sep 17 00:00:00 2001 From: Andrei Baltariu Date: Fri, 2 Aug 2024 12:47:31 +0300 Subject: [PATCH 243/523] Removed burn tokens module Signed-off-by: Andrei Baltariu --- token-handler/src/burn_tokens.rs | 43 -------------------------------- token-handler/src/lib.rs | 2 -- 2 files changed, 45 deletions(-) delete mode 100644 token-handler/src/burn_tokens.rs diff --git a/token-handler/src/burn_tokens.rs b/token-handler/src/burn_tokens.rs deleted file mode 100644 index d43292e9..00000000 --- a/token-handler/src/burn_tokens.rs +++ /dev/null @@ -1,43 +0,0 @@ -use crate::{common, err_msg}; -use multiversx_sc::{ - hex_literal::hex, - require, - types::{system_proxy, ToSelf}, -}; -use transaction::Operation; - -pub const ESDT_SYSTEM_SC_ADDRESS: [u8; 32] = - hex!("000000000000000000010000000000000000000000000000000000000002ffff"); - -#[multiversx_sc::module] -pub trait BurnTokensModule: utils::UtilsModule + common::storage::CommonStorage { - #[endpoint(burnTokens)] - fn burn_tokens_endpoint(&self, operation: Operation) { - require!( - !operation.tokens.is_empty(), - "Operation tokens array is empty" - ); - - self.burn_tokens(&operation); - } - - fn burn_tokens(&self, operation: &Operation) { - let sov_prefix = self.sov_prefix().get(); - - for token in operation.tokens.iter() { - if self.has_sov_prefix(&token.token_identifier, &sov_prefix) { - continue; - } - - self.tx() - .to(ToSelf) - .typed(system_proxy::UserBuiltinProxy) - .esdt_local_burn( - &token.token_identifier, - token.token_nonce, - &token.token_data.amount, - ) - .sync_call(); - } - } -} diff --git a/token-handler/src/lib.rs b/token-handler/src/lib.rs index ddd6c811..9495083c 100644 --- a/token-handler/src/lib.rs +++ b/token-handler/src/lib.rs @@ -3,7 +3,6 @@ #[allow(unused_imports)] use multiversx_sc::imports::*; -pub mod burn_tokens; pub mod common; pub mod token_handler_proxy; pub mod transfer_tokens; @@ -11,7 +10,6 @@ pub mod transfer_tokens; #[multiversx_sc::contract] pub trait TokenHandler: transfer_tokens::TransferTokensModule - + burn_tokens::BurnTokensModule + utils::UtilsModule + common::storage::CommonStorage + tx_batch_module::TxBatchModule From 38eaab7b33996dbc3220af1d9abf39a4673bc6d8 Mon Sep 17 00:00:00 2001 From: Andrei Baltariu Date: Fri, 2 Aug 2024 12:58:38 +0300 Subject: [PATCH 244/523] Regenerated proxy Signed-off-by: Andrei Baltariu --- enshrine-esdt-safe/src/token_handler_proxy.rs | 13 ------------- token-handler/src/token_handler_proxy.rs | 13 ------------- 2 files changed, 26 deletions(-) diff --git a/enshrine-esdt-safe/src/token_handler_proxy.rs b/enshrine-esdt-safe/src/token_handler_proxy.rs index 66f13b99..3926efe7 100644 --- a/enshrine-esdt-safe/src/token_handler_proxy.rs +++ b/enshrine-esdt-safe/src/token_handler_proxy.rs @@ -99,19 +99,6 @@ where .original_result() } - pub fn burn_tokens_endpoint< - Arg0: ProxyArg>, - >( - self, - operation: Arg0, - ) -> TxTypedCall { - self.wrapped_tx - .payment(NotPayable) - .raw_call("burnTokens") - .argument(&operation) - .original_result() - } - pub fn set_max_tx_batch_size< Arg0: ProxyArg, >( diff --git a/token-handler/src/token_handler_proxy.rs b/token-handler/src/token_handler_proxy.rs index 66f13b99..3926efe7 100644 --- a/token-handler/src/token_handler_proxy.rs +++ b/token-handler/src/token_handler_proxy.rs @@ -99,19 +99,6 @@ where .original_result() } - pub fn burn_tokens_endpoint< - Arg0: ProxyArg>, - >( - self, - operation: Arg0, - ) -> TxTypedCall { - self.wrapped_tx - .payment(NotPayable) - .raw_call("burnTokens") - .argument(&operation) - .original_result() - } - pub fn set_max_tx_batch_size< Arg0: ProxyArg, >( From 71fa75b4d6bdd89cd7645d1fd79469bc8c0bf32e Mon Sep 17 00:00:00 2001 From: Andrei Baltariu Date: Fri, 2 Aug 2024 13:45:07 +0300 Subject: [PATCH 245/523] Fw upgrade Signed-off-by: Andrei Baltariu --- token-handler/Cargo.toml | 4 ++-- token-handler/meta/Cargo.toml | 2 +- token-handler/wasm-token-handler-full/Cargo.lock | 12 ++++++------ token-handler/wasm-token-handler-full/Cargo.toml | 2 +- token-handler/wasm-token-handler-view/Cargo.lock | 12 ++++++------ token-handler/wasm-token-handler-view/Cargo.toml | 2 +- token-handler/wasm/Cargo.lock | 12 ++++++------ token-handler/wasm/Cargo.toml | 2 +- 8 files changed, 24 insertions(+), 24 deletions(-) diff --git a/token-handler/Cargo.toml b/token-handler/Cargo.toml index b5c987b2..4d4f4fd3 100644 --- a/token-handler/Cargo.toml +++ b/token-handler/Cargo.toml @@ -18,10 +18,10 @@ path = "../common/transaction" path = "../common/bls-signature/" [dependencies.multiversx-sc] -version = "0.52.0" +version = "0.52.2" [dev-dependencies] num-bigint = "0.4" [dev-dependencies.multiversx-sc-scenario] -version = "0.52.0" +version = "0.52.2" diff --git a/token-handler/meta/Cargo.toml b/token-handler/meta/Cargo.toml index bacc8236..eea7da7e 100644 --- a/token-handler/meta/Cargo.toml +++ b/token-handler/meta/Cargo.toml @@ -8,5 +8,5 @@ publish = false path = ".." [dependencies.multiversx-sc-meta-lib] -version = "0.52.0" +version = "0.52.2" default-features = false diff --git a/token-handler/wasm-token-handler-full/Cargo.lock b/token-handler/wasm-token-handler-full/Cargo.lock index 8eb9f7a8..f11166a9 100644 --- a/token-handler/wasm-token-handler-full/Cargo.lock +++ b/token-handler/wasm-token-handler-full/Cargo.lock @@ -48,9 +48,9 @@ checksum = "6fe2267d4ed49bc07b63801559be28c718ea06c4738b7a03c94df7386d2cde46" [[package]] name = "multiversx-sc" -version = "0.52.0" +version = "0.52.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "31bcb4dc736ef975b59878720de1c731788aa1a5a197888606e7d3d6600b1925" +checksum = "290e945d3d268d2b0b7cc68f3c74844d35eaa06c1b7861a18ded3726bc6e6587" dependencies = [ "bitflags", "hex-literal", @@ -85,9 +85,9 @@ dependencies = [ [[package]] name = "multiversx-sc-derive" -version = "0.52.0" +version = "0.52.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ae92e4121bad55ffc476028c25722bc01ba989b4953837fb7f4b6be9dba398ed" +checksum = "f6363ecf098fa4687ca532d621af1222890ffe97ed333e19b6b206d621c3f9d4" dependencies = [ "hex", "proc-macro2", @@ -98,9 +98,9 @@ dependencies = [ [[package]] name = "multiversx-sc-wasm-adapter" -version = "0.52.0" +version = "0.52.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bbb8f0bf218a2e3f02d37c3112fd099bdd72d307e69e97b4773fa8c16bf6ab87" +checksum = "d3a7ef581b703ca0cef3ebc500ee2bf739c4def405ab2490e8b680a039e3408d" dependencies = [ "multiversx-sc", ] diff --git a/token-handler/wasm-token-handler-full/Cargo.toml b/token-handler/wasm-token-handler-full/Cargo.toml index 345c69c4..7785a5cd 100644 --- a/token-handler/wasm-token-handler-full/Cargo.toml +++ b/token-handler/wasm-token-handler-full/Cargo.toml @@ -28,7 +28,7 @@ panic = "abort" path = ".." [dependencies.multiversx-sc-wasm-adapter] -version = "0.52.0" +version = "0.52.2" [workspace] members = ["."] diff --git a/token-handler/wasm-token-handler-view/Cargo.lock b/token-handler/wasm-token-handler-view/Cargo.lock index f5c173f9..b9d0c4c4 100644 --- a/token-handler/wasm-token-handler-view/Cargo.lock +++ b/token-handler/wasm-token-handler-view/Cargo.lock @@ -48,9 +48,9 @@ checksum = "6fe2267d4ed49bc07b63801559be28c718ea06c4738b7a03c94df7386d2cde46" [[package]] name = "multiversx-sc" -version = "0.52.0" +version = "0.52.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "31bcb4dc736ef975b59878720de1c731788aa1a5a197888606e7d3d6600b1925" +checksum = "290e945d3d268d2b0b7cc68f3c74844d35eaa06c1b7861a18ded3726bc6e6587" dependencies = [ "bitflags", "hex-literal", @@ -85,9 +85,9 @@ dependencies = [ [[package]] name = "multiversx-sc-derive" -version = "0.52.0" +version = "0.52.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ae92e4121bad55ffc476028c25722bc01ba989b4953837fb7f4b6be9dba398ed" +checksum = "f6363ecf098fa4687ca532d621af1222890ffe97ed333e19b6b206d621c3f9d4" dependencies = [ "hex", "proc-macro2", @@ -98,9 +98,9 @@ dependencies = [ [[package]] name = "multiversx-sc-wasm-adapter" -version = "0.52.0" +version = "0.52.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bbb8f0bf218a2e3f02d37c3112fd099bdd72d307e69e97b4773fa8c16bf6ab87" +checksum = "d3a7ef581b703ca0cef3ebc500ee2bf739c4def405ab2490e8b680a039e3408d" dependencies = [ "multiversx-sc", ] diff --git a/token-handler/wasm-token-handler-view/Cargo.toml b/token-handler/wasm-token-handler-view/Cargo.toml index b591a177..42c0e04e 100644 --- a/token-handler/wasm-token-handler-view/Cargo.toml +++ b/token-handler/wasm-token-handler-view/Cargo.toml @@ -28,7 +28,7 @@ panic = "abort" path = ".." [dependencies.multiversx-sc-wasm-adapter] -version = "0.52.0" +version = "0.52.2" [workspace] members = ["."] diff --git a/token-handler/wasm/Cargo.lock b/token-handler/wasm/Cargo.lock index 6ff2995f..40a195fe 100644 --- a/token-handler/wasm/Cargo.lock +++ b/token-handler/wasm/Cargo.lock @@ -48,9 +48,9 @@ checksum = "6fe2267d4ed49bc07b63801559be28c718ea06c4738b7a03c94df7386d2cde46" [[package]] name = "multiversx-sc" -version = "0.52.0" +version = "0.52.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "31bcb4dc736ef975b59878720de1c731788aa1a5a197888606e7d3d6600b1925" +checksum = "290e945d3d268d2b0b7cc68f3c74844d35eaa06c1b7861a18ded3726bc6e6587" dependencies = [ "bitflags", "hex-literal", @@ -85,9 +85,9 @@ dependencies = [ [[package]] name = "multiversx-sc-derive" -version = "0.52.0" +version = "0.52.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ae92e4121bad55ffc476028c25722bc01ba989b4953837fb7f4b6be9dba398ed" +checksum = "f6363ecf098fa4687ca532d621af1222890ffe97ed333e19b6b206d621c3f9d4" dependencies = [ "hex", "proc-macro2", @@ -98,9 +98,9 @@ dependencies = [ [[package]] name = "multiversx-sc-wasm-adapter" -version = "0.52.0" +version = "0.52.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bbb8f0bf218a2e3f02d37c3112fd099bdd72d307e69e97b4773fa8c16bf6ab87" +checksum = "d3a7ef581b703ca0cef3ebc500ee2bf739c4def405ab2490e8b680a039e3408d" dependencies = [ "multiversx-sc", ] diff --git a/token-handler/wasm/Cargo.toml b/token-handler/wasm/Cargo.toml index 408c2c94..816582c9 100644 --- a/token-handler/wasm/Cargo.toml +++ b/token-handler/wasm/Cargo.toml @@ -28,7 +28,7 @@ panic = "abort" path = ".." [dependencies.multiversx-sc-wasm-adapter] -version = "0.52.0" +version = "0.52.2" [workspace] members = ["."] From 43f2f6ba1c60bdd4d23fdc5c78e536aeb68b555b Mon Sep 17 00:00:00 2001 From: Andrei Baltariu Date: Fri, 2 Aug 2024 14:00:08 +0300 Subject: [PATCH 246/523] Added storage module dependency and use of function Signed-off-by: Andrei Baltariu --- token-handler/src/transfer_tokens.rs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/token-handler/src/transfer_tokens.rs b/token-handler/src/transfer_tokens.rs index b7b465e9..a0795d67 100644 --- a/token-handler/src/transfer_tokens.rs +++ b/token-handler/src/transfer_tokens.rs @@ -6,10 +6,14 @@ use multiversx_sc::types::{ManagedVec, TokenIdentifier}; use multiversx_sc::{codec, err_msg}; use transaction::{GasLimit, OperationEsdtPayment, StolenFromFrameworkEsdtTokenData, TransferData}; +use crate::storage; + const TRANSACTION_GAS: GasLimit = 30_000_000; #[multiversx_sc::module] -pub trait TransferTokensModule: utils::UtilsModule + tx_batch_module::TxBatchModule { +pub trait TransferTokensModule: + utils::UtilsModule + tx_batch_module::TxBatchModule + storage::CommonStorage +{ // NOTE: will use operation.data.op_sender as well when TransferAndExecuteByUser is implemented #[payable("*")] #[endpoint(transferTokens)] @@ -20,6 +24,7 @@ pub trait TransferTokensModule: utils::UtilsModule + tx_batch_module::TxBatchMod // original_sender: ManagedAddress, tokens: MultiValueEncoded>, ) { + self.require_caller_to_be_whitelisted(); let mut output_payments = self.mint_tokens(&tokens.to_vec()); let call_value_esdt_transfer = self.call_value().all_esdt_transfers(); output_payments.extend(&call_value_esdt_transfer.clone_value()); From ea43883da81f27f51460eff727ce1dedd4f42ea7 Mon Sep 17 00:00:00 2001 From: Andrei Baltariu Date: Fri, 2 Aug 2024 14:01:57 +0300 Subject: [PATCH 247/523] Removed storage.rs file Signed-off-by: Andrei Baltariu --- token-handler/src/lib.rs | 6 +----- token-handler/src/storage.rs | 7 ------- 2 files changed, 1 insertion(+), 12 deletions(-) delete mode 100644 token-handler/src/storage.rs diff --git a/token-handler/src/lib.rs b/token-handler/src/lib.rs index 6c386b81..e2d64508 100644 --- a/token-handler/src/lib.rs +++ b/token-handler/src/lib.rs @@ -3,16 +3,12 @@ #[allow(unused_imports)] use multiversx_sc::imports::*; -pub mod storage; pub mod token_handler_proxy; pub mod transfer_tokens; #[multiversx_sc::contract] pub trait TokenHandler: - transfer_tokens::TransferTokensModule - + utils::UtilsModule - + storage::CommonStorage - + tx_batch_module::TxBatchModule + transfer_tokens::TransferTokensModule + utils::UtilsModule + tx_batch_module::TxBatchModule { #[init] fn init(&self) {} diff --git a/token-handler/src/storage.rs b/token-handler/src/storage.rs deleted file mode 100644 index ce708adb..00000000 --- a/token-handler/src/storage.rs +++ /dev/null @@ -1,7 +0,0 @@ -use multiversx_sc::imports::SingleValueMapper; - -#[multiversx_sc::module] -pub trait CommonStorage { - #[storage_mapper] - fn sov_prefix(&self) -> SingleValueMapper; -} From 4a57dec1d1ca264ea19067e88cada0325a1de0d0 Mon Sep 17 00:00:00 2001 From: Andrei Baltariu Date: Tue, 6 Aug 2024 10:19:20 +0300 Subject: [PATCH 248/523] Renamed storage file and removed some dependencies Signed-off-by: Andrei Baltariu --- Cargo.lock | 2 -- token-handler/Cargo.toml | 6 ---- token-handler/src/burn_tokens.rs | 35 ------------------- .../src/{storage.rs => common_storage.rs} | 0 token-handler/src/lib.rs | 3 +- token-handler/src/transfer_tokens.rs | 6 ++-- 6 files changed, 4 insertions(+), 48 deletions(-) delete mode 100644 token-handler/src/burn_tokens.rs rename token-handler/src/{storage.rs => common_storage.rs} (100%) diff --git a/Cargo.lock b/Cargo.lock index 3809ed72..73780f6e 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1062,13 +1062,11 @@ dependencies = [ name = "token-handler" version = "0.0.0" dependencies = [ - "bls-signature", "header-verifier", "multiversx-sc", "multiversx-sc-scenario", "num-bigint", "transaction", - "tx-batch-module", "utils", ] diff --git a/token-handler/Cargo.toml b/token-handler/Cargo.toml index d1055a00..3dc43f0c 100644 --- a/token-handler/Cargo.toml +++ b/token-handler/Cargo.toml @@ -14,15 +14,9 @@ path = "../common/utils" [dependencies.transaction] path = "../common/transaction" -[dependencies.bls-signature] -path = "../common/bls-signature/" - [dependencies.header-verifier] path = "../header-verifier/" -[dependencies.tx-batch-module] -path = "../common/tx-batch-module" - [dependencies.multiversx-sc] version = "0.52.2" diff --git a/token-handler/src/burn_tokens.rs b/token-handler/src/burn_tokens.rs deleted file mode 100644 index 99ed4fc3..00000000 --- a/token-handler/src/burn_tokens.rs +++ /dev/null @@ -1,35 +0,0 @@ -use crate::{common, err_msg}; -use multiversx_sc::{ - hex_literal::hex, - types::{system_proxy, ToSelf}, -}; -use transaction::Operation; - -pub const ESDT_SYSTEM_SC_ADDRESS: [u8; 32] = - hex!("000000000000000000010000000000000000000000000000000000000002ffff"); - -#[multiversx_sc::module] -pub trait BurnTokensModule: utils::UtilsModule + common::storage::CommonStorage { - #[endpoint(burnTokens)] - fn burn_tokens(&self, operation: Operation) { - self.require_caller_to_be_whitelisted(); - - let sov_prefix = self.sov_prefix().get(); - - for token in operation.tokens.iter() { - if self.has_sov_prefix(&token.token_identifier, &sov_prefix) { - continue; - } - - self.tx() - .to(ToSelf) - .typed(system_proxy::UserBuiltinProxy) - .esdt_local_burn( - &token.token_identifier, - token.token_nonce, - &token.token_data.amount, - ) - .sync_call(); - } - } -} diff --git a/token-handler/src/storage.rs b/token-handler/src/common_storage.rs similarity index 100% rename from token-handler/src/storage.rs rename to token-handler/src/common_storage.rs diff --git a/token-handler/src/lib.rs b/token-handler/src/lib.rs index 0405c5a5..4b4ed7c3 100644 --- a/token-handler/src/lib.rs +++ b/token-handler/src/lib.rs @@ -3,12 +3,13 @@ #[allow(unused_imports)] use multiversx_sc::imports::*; +pub mod common_storage; pub mod token_handler_proxy; pub mod transfer_tokens; #[multiversx_sc::contract] pub trait TokenHandler: - transfer_tokens::TransferTokensModule + utils::UtilsModule + tx_batch_module::TxBatchModule + transfer_tokens::TransferTokensModule + utils::UtilsModule + common_storage::CommonStorage { #[init] fn init(&self) {} diff --git a/token-handler/src/transfer_tokens.rs b/token-handler/src/transfer_tokens.rs index a0795d67..9f3d3ae8 100644 --- a/token-handler/src/transfer_tokens.rs +++ b/token-handler/src/transfer_tokens.rs @@ -6,14 +6,12 @@ use multiversx_sc::types::{ManagedVec, TokenIdentifier}; use multiversx_sc::{codec, err_msg}; use transaction::{GasLimit, OperationEsdtPayment, StolenFromFrameworkEsdtTokenData, TransferData}; -use crate::storage; +use crate::common_storage; const TRANSACTION_GAS: GasLimit = 30_000_000; #[multiversx_sc::module] -pub trait TransferTokensModule: - utils::UtilsModule + tx_batch_module::TxBatchModule + storage::CommonStorage -{ +pub trait TransferTokensModule: utils::UtilsModule + common_storage::CommonStorage { // NOTE: will use operation.data.op_sender as well when TransferAndExecuteByUser is implemented #[payable("*")] #[endpoint(transferTokens)] From 6b860a7bb48cf0640cad9bd47910878b97a4e664 Mon Sep 17 00:00:00 2001 From: Andrei Baltariu Date: Tue, 6 Aug 2024 10:26:43 +0300 Subject: [PATCH 249/523] Removed unused dependencies Signed-off-by: Andrei Baltariu --- Cargo.lock | 3 - enshrine-esdt-safe/src/token_handler_proxy.rs | 88 ------------------- token-handler/Cargo.toml | 9 -- token-handler/src/lib.rs | 4 +- token-handler/src/token_handler_proxy.rs | 88 ------------------- token-handler/src/transfer_tokens.rs | 4 +- .../wasm-token-handler-full/Cargo.lock | 19 ---- .../wasm-token-handler-full/src/lib.rs | 12 +-- .../wasm-token-handler-view/Cargo.lock | 19 ---- token-handler/wasm/Cargo.lock | 19 ---- token-handler/wasm/src/lib.rs | 12 +-- 11 files changed, 7 insertions(+), 270 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 3809ed72..a995ecd9 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1062,14 +1062,11 @@ dependencies = [ name = "token-handler" version = "0.0.0" dependencies = [ - "bls-signature", "header-verifier", "multiversx-sc", "multiversx-sc-scenario", "num-bigint", "transaction", - "tx-batch-module", - "utils", ] [[package]] diff --git a/enshrine-esdt-safe/src/token_handler_proxy.rs b/enshrine-esdt-safe/src/token_handler_proxy.rs index 3926efe7..c46b8475 100644 --- a/enshrine-esdt-safe/src/token_handler_proxy.rs +++ b/enshrine-esdt-safe/src/token_handler_proxy.rs @@ -98,92 +98,4 @@ where .argument(&tokens) .original_result() } - - pub fn set_max_tx_batch_size< - Arg0: ProxyArg, - >( - self, - new_max_tx_batch_size: Arg0, - ) -> TxTypedCall { - self.wrapped_tx - .payment(NotPayable) - .raw_call("setMaxTxBatchSize") - .argument(&new_max_tx_batch_size) - .original_result() - } - - pub fn set_max_tx_batch_block_duration< - Arg0: ProxyArg, - >( - self, - new_max_tx_batch_block_duration: Arg0, - ) -> TxTypedCall { - self.wrapped_tx - .payment(NotPayable) - .raw_call("setMaxTxBatchBlockDuration") - .argument(&new_max_tx_batch_block_duration) - .original_result() - } - - pub fn get_current_tx_batch( - self, - ) -> TxTypedCall, ManagedAddress, ManagedVec>, ManagedVec>, Option>>>>>> { - self.wrapped_tx - .payment(NotPayable) - .raw_call("getCurrentTxBatch") - .original_result() - } - - pub fn get_first_batch_any_status( - self, - ) -> TxTypedCall, ManagedAddress, ManagedVec>, ManagedVec>, Option>>>>>> { - self.wrapped_tx - .payment(NotPayable) - .raw_call("getFirstBatchAnyStatus") - .original_result() - } - - pub fn get_batch< - Arg0: ProxyArg, - >( - self, - batch_id: Arg0, - ) -> TxTypedCall, ManagedAddress, ManagedVec>, ManagedVec>, Option>>>>>> { - self.wrapped_tx - .payment(NotPayable) - .raw_call("getBatch") - .argument(&batch_id) - .original_result() - } - - pub fn get_batch_status< - Arg0: ProxyArg, - >( - self, - batch_id: Arg0, - ) -> TxTypedCall> { - self.wrapped_tx - .payment(NotPayable) - .raw_call("getBatchStatus") - .argument(&batch_id) - .original_result() - } - - pub fn first_batch_id( - self, - ) -> TxTypedCall { - self.wrapped_tx - .payment(NotPayable) - .raw_call("getFirstBatchId") - .original_result() - } - - pub fn last_batch_id( - self, - ) -> TxTypedCall { - self.wrapped_tx - .payment(NotPayable) - .raw_call("getLastBatchId") - .original_result() - } } diff --git a/token-handler/Cargo.toml b/token-handler/Cargo.toml index d1055a00..e8da8c3a 100644 --- a/token-handler/Cargo.toml +++ b/token-handler/Cargo.toml @@ -8,21 +8,12 @@ publish = false [lib] path = "src/lib.rs" -[dependencies.utils] -path = "../common/utils" - [dependencies.transaction] path = "../common/transaction" -[dependencies.bls-signature] -path = "../common/bls-signature/" - [dependencies.header-verifier] path = "../header-verifier/" -[dependencies.tx-batch-module] -path = "../common/tx-batch-module" - [dependencies.multiversx-sc] version = "0.52.2" diff --git a/token-handler/src/lib.rs b/token-handler/src/lib.rs index e2d64508..bcb67509 100644 --- a/token-handler/src/lib.rs +++ b/token-handler/src/lib.rs @@ -7,9 +7,7 @@ pub mod token_handler_proxy; pub mod transfer_tokens; #[multiversx_sc::contract] -pub trait TokenHandler: - transfer_tokens::TransferTokensModule + utils::UtilsModule + tx_batch_module::TxBatchModule -{ +pub trait TokenHandler: transfer_tokens::TransferTokensModule { #[init] fn init(&self) {} diff --git a/token-handler/src/token_handler_proxy.rs b/token-handler/src/token_handler_proxy.rs index 3926efe7..c46b8475 100644 --- a/token-handler/src/token_handler_proxy.rs +++ b/token-handler/src/token_handler_proxy.rs @@ -98,92 +98,4 @@ where .argument(&tokens) .original_result() } - - pub fn set_max_tx_batch_size< - Arg0: ProxyArg, - >( - self, - new_max_tx_batch_size: Arg0, - ) -> TxTypedCall { - self.wrapped_tx - .payment(NotPayable) - .raw_call("setMaxTxBatchSize") - .argument(&new_max_tx_batch_size) - .original_result() - } - - pub fn set_max_tx_batch_block_duration< - Arg0: ProxyArg, - >( - self, - new_max_tx_batch_block_duration: Arg0, - ) -> TxTypedCall { - self.wrapped_tx - .payment(NotPayable) - .raw_call("setMaxTxBatchBlockDuration") - .argument(&new_max_tx_batch_block_duration) - .original_result() - } - - pub fn get_current_tx_batch( - self, - ) -> TxTypedCall, ManagedAddress, ManagedVec>, ManagedVec>, Option>>>>>> { - self.wrapped_tx - .payment(NotPayable) - .raw_call("getCurrentTxBatch") - .original_result() - } - - pub fn get_first_batch_any_status( - self, - ) -> TxTypedCall, ManagedAddress, ManagedVec>, ManagedVec>, Option>>>>>> { - self.wrapped_tx - .payment(NotPayable) - .raw_call("getFirstBatchAnyStatus") - .original_result() - } - - pub fn get_batch< - Arg0: ProxyArg, - >( - self, - batch_id: Arg0, - ) -> TxTypedCall, ManagedAddress, ManagedVec>, ManagedVec>, Option>>>>>> { - self.wrapped_tx - .payment(NotPayable) - .raw_call("getBatch") - .argument(&batch_id) - .original_result() - } - - pub fn get_batch_status< - Arg0: ProxyArg, - >( - self, - batch_id: Arg0, - ) -> TxTypedCall> { - self.wrapped_tx - .payment(NotPayable) - .raw_call("getBatchStatus") - .argument(&batch_id) - .original_result() - } - - pub fn first_batch_id( - self, - ) -> TxTypedCall { - self.wrapped_tx - .payment(NotPayable) - .raw_call("getFirstBatchId") - .original_result() - } - - pub fn last_batch_id( - self, - ) -> TxTypedCall { - self.wrapped_tx - .payment(NotPayable) - .raw_call("getLastBatchId") - .original_result() - } } diff --git a/token-handler/src/transfer_tokens.rs b/token-handler/src/transfer_tokens.rs index b7b465e9..cfe4e7b0 100644 --- a/token-handler/src/transfer_tokens.rs +++ b/token-handler/src/transfer_tokens.rs @@ -1,15 +1,15 @@ use multiversx_sc::api::{ESDT_MULTI_TRANSFER_FUNC_NAME, ESDT_NFT_CREATE_FUNC_NAME}; +use multiversx_sc::codec; use multiversx_sc::types::{ system_proxy, EsdtTokenPayment, ManagedArgBuffer, MultiValueEncoded, ToSelf, }; use multiversx_sc::types::{ManagedVec, TokenIdentifier}; -use multiversx_sc::{codec, err_msg}; use transaction::{GasLimit, OperationEsdtPayment, StolenFromFrameworkEsdtTokenData, TransferData}; const TRANSACTION_GAS: GasLimit = 30_000_000; #[multiversx_sc::module] -pub trait TransferTokensModule: utils::UtilsModule + tx_batch_module::TxBatchModule { +pub trait TransferTokensModule { // NOTE: will use operation.data.op_sender as well when TransferAndExecuteByUser is implemented #[payable("*")] #[endpoint(transferTokens)] diff --git a/token-handler/wasm-token-handler-full/Cargo.lock b/token-handler/wasm-token-handler-full/Cargo.lock index ea1c3f2c..0efac6dd 100644 --- a/token-handler/wasm-token-handler-full/Cargo.lock +++ b/token-handler/wasm-token-handler-full/Cargo.lock @@ -181,12 +181,9 @@ dependencies = [ name = "token-handler" version = "0.0.0" dependencies = [ - "bls-signature", "header-verifier", "multiversx-sc", "transaction", - "tx-batch-module", - "utils", ] [[package]] @@ -204,14 +201,6 @@ dependencies = [ "multiversx-sc", ] -[[package]] -name = "tx-batch-module" -version = "0.0.0" -dependencies = [ - "multiversx-sc", - "transaction", -] - [[package]] name = "unicode-ident" version = "1.0.12" @@ -223,11 +212,3 @@ name = "unwrap-infallible" version = "0.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "151ac09978d3c2862c4e39b557f4eceee2cc72150bc4cb4f16abf061b6e381fb" - -[[package]] -name = "utils" -version = "0.0.0" -dependencies = [ - "bls-signature", - "multiversx-sc", -] diff --git a/token-handler/wasm-token-handler-full/src/lib.rs b/token-handler/wasm-token-handler-full/src/lib.rs index 46cce38e..fa8921dc 100644 --- a/token-handler/wasm-token-handler-full/src/lib.rs +++ b/token-handler/wasm-token-handler-full/src/lib.rs @@ -6,9 +6,9 @@ // Init: 1 // Upgrade: 1 -// Endpoints: 9 +// Endpoints: 1 // Async Callback (empty): 1 -// Total number of exported functions: 12 +// Total number of exported functions: 4 #![no_std] @@ -21,14 +21,6 @@ multiversx_sc_wasm_adapter::endpoints! { init => init upgrade => upgrade transferTokens => transfer_tokens - setMaxTxBatchSize => set_max_tx_batch_size - setMaxTxBatchBlockDuration => set_max_tx_batch_block_duration - getCurrentTxBatch => get_current_tx_batch - getFirstBatchAnyStatus => get_first_batch_any_status - getBatch => get_batch - getBatchStatus => get_batch_status - getFirstBatchId => first_batch_id - getLastBatchId => last_batch_id ) } diff --git a/token-handler/wasm-token-handler-view/Cargo.lock b/token-handler/wasm-token-handler-view/Cargo.lock index e302be6f..890de623 100644 --- a/token-handler/wasm-token-handler-view/Cargo.lock +++ b/token-handler/wasm-token-handler-view/Cargo.lock @@ -181,12 +181,9 @@ dependencies = [ name = "token-handler" version = "0.0.0" dependencies = [ - "bls-signature", "header-verifier", "multiversx-sc", "transaction", - "tx-batch-module", - "utils", ] [[package]] @@ -204,14 +201,6 @@ dependencies = [ "multiversx-sc", ] -[[package]] -name = "tx-batch-module" -version = "0.0.0" -dependencies = [ - "multiversx-sc", - "transaction", -] - [[package]] name = "unicode-ident" version = "1.0.12" @@ -223,11 +212,3 @@ name = "unwrap-infallible" version = "0.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "151ac09978d3c2862c4e39b557f4eceee2cc72150bc4cb4f16abf061b6e381fb" - -[[package]] -name = "utils" -version = "0.0.0" -dependencies = [ - "bls-signature", - "multiversx-sc", -] diff --git a/token-handler/wasm/Cargo.lock b/token-handler/wasm/Cargo.lock index 10f81889..6a2664cd 100644 --- a/token-handler/wasm/Cargo.lock +++ b/token-handler/wasm/Cargo.lock @@ -181,12 +181,9 @@ dependencies = [ name = "token-handler" version = "0.0.0" dependencies = [ - "bls-signature", "header-verifier", "multiversx-sc", "transaction", - "tx-batch-module", - "utils", ] [[package]] @@ -204,14 +201,6 @@ dependencies = [ "multiversx-sc", ] -[[package]] -name = "tx-batch-module" -version = "0.0.0" -dependencies = [ - "multiversx-sc", - "transaction", -] - [[package]] name = "unicode-ident" version = "1.0.12" @@ -223,11 +212,3 @@ name = "unwrap-infallible" version = "0.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "151ac09978d3c2862c4e39b557f4eceee2cc72150bc4cb4f16abf061b6e381fb" - -[[package]] -name = "utils" -version = "0.0.0" -dependencies = [ - "bls-signature", - "multiversx-sc", -] diff --git a/token-handler/wasm/src/lib.rs b/token-handler/wasm/src/lib.rs index 46cce38e..fa8921dc 100644 --- a/token-handler/wasm/src/lib.rs +++ b/token-handler/wasm/src/lib.rs @@ -6,9 +6,9 @@ // Init: 1 // Upgrade: 1 -// Endpoints: 9 +// Endpoints: 1 // Async Callback (empty): 1 -// Total number of exported functions: 12 +// Total number of exported functions: 4 #![no_std] @@ -21,14 +21,6 @@ multiversx_sc_wasm_adapter::endpoints! { init => init upgrade => upgrade transferTokens => transfer_tokens - setMaxTxBatchSize => set_max_tx_batch_size - setMaxTxBatchBlockDuration => set_max_tx_batch_block_duration - getCurrentTxBatch => get_current_tx_batch - getFirstBatchAnyStatus => get_first_batch_any_status - getBatch => get_batch - getBatchStatus => get_batch_status - getFirstBatchId => first_batch_id - getLastBatchId => last_batch_id ) } From 072ccd3e6cf9e19b2ee7c6d89acd90769e949687 Mon Sep 17 00:00:00 2001 From: Andrei Baltariu Date: Tue, 6 Aug 2024 10:31:17 +0300 Subject: [PATCH 250/523] Updated wasm files after build Signed-off-by: Andrei Baltariu --- enshrine-esdt-safe/wasm-enshrine-esdt-safe-full/Cargo.lock | 3 --- enshrine-esdt-safe/wasm-enshrine-esdt-safe-view/Cargo.lock | 3 --- enshrine-esdt-safe/wasm/Cargo.lock | 3 --- 3 files changed, 9 deletions(-) diff --git a/enshrine-esdt-safe/wasm-enshrine-esdt-safe-full/Cargo.lock b/enshrine-esdt-safe/wasm-enshrine-esdt-safe-full/Cargo.lock index a2885cf0..eb452b33 100644 --- a/enshrine-esdt-safe/wasm-enshrine-esdt-safe-full/Cargo.lock +++ b/enshrine-esdt-safe/wasm-enshrine-esdt-safe-full/Cargo.lock @@ -256,12 +256,9 @@ dependencies = [ name = "token-handler" version = "0.0.0" dependencies = [ - "bls-signature", "header-verifier", "multiversx-sc", "transaction", - "tx-batch-module", - "utils", ] [[package]] diff --git a/enshrine-esdt-safe/wasm-enshrine-esdt-safe-view/Cargo.lock b/enshrine-esdt-safe/wasm-enshrine-esdt-safe-view/Cargo.lock index d4f017d3..e45287d0 100644 --- a/enshrine-esdt-safe/wasm-enshrine-esdt-safe-view/Cargo.lock +++ b/enshrine-esdt-safe/wasm-enshrine-esdt-safe-view/Cargo.lock @@ -256,12 +256,9 @@ dependencies = [ name = "token-handler" version = "0.0.0" dependencies = [ - "bls-signature", "header-verifier", "multiversx-sc", "transaction", - "tx-batch-module", - "utils", ] [[package]] diff --git a/enshrine-esdt-safe/wasm/Cargo.lock b/enshrine-esdt-safe/wasm/Cargo.lock index 5041fc1a..5711ab60 100644 --- a/enshrine-esdt-safe/wasm/Cargo.lock +++ b/enshrine-esdt-safe/wasm/Cargo.lock @@ -256,12 +256,9 @@ dependencies = [ name = "token-handler" version = "0.0.0" dependencies = [ - "bls-signature", "header-verifier", "multiversx-sc", "transaction", - "tx-batch-module", - "utils", ] [[package]] From 16dde796c142594074f34f26c44e22ee86c19daa Mon Sep 17 00:00:00 2001 From: Andrei Baltariu Date: Tue, 6 Aug 2024 10:59:32 +0300 Subject: [PATCH 251/523] Added whitelist module as dependency Signed-off-by: Andrei Baltariu --- token-handler/src/lib.rs | 4 +++- token-handler/src/transfer_tokens.rs | 3 ++- token-handler/wasm-token-handler-full/src/lib.rs | 4 ++-- token-handler/wasm/src/lib.rs | 4 ++-- 4 files changed, 9 insertions(+), 6 deletions(-) diff --git a/token-handler/src/lib.rs b/token-handler/src/lib.rs index 7eacde48..abbd8b3b 100644 --- a/token-handler/src/lib.rs +++ b/token-handler/src/lib.rs @@ -8,7 +8,9 @@ pub mod token_handler_proxy; pub mod transfer_tokens; #[multiversx_sc::contract] -pub trait TokenHandler: transfer_tokens::TransferTokensModule { +pub trait TokenHandler: + transfer_tokens::TransferTokensModule + common_storage::CommonStorage +{ #[init] fn init(&self) {} diff --git a/token-handler/src/transfer_tokens.rs b/token-handler/src/transfer_tokens.rs index c25433aa..a87fd313 100644 --- a/token-handler/src/transfer_tokens.rs +++ b/token-handler/src/transfer_tokens.rs @@ -1,5 +1,6 @@ use multiversx_sc::api::{ESDT_MULTI_TRANSFER_FUNC_NAME, ESDT_NFT_CREATE_FUNC_NAME}; use multiversx_sc::codec; +use multiversx_sc::err_msg; use multiversx_sc::types::{ system_proxy, EsdtTokenPayment, ManagedArgBuffer, MultiValueEncoded, ToSelf, }; @@ -11,7 +12,7 @@ use crate::common_storage; const TRANSACTION_GAS: GasLimit = 30_000_000; #[multiversx_sc::module] -pub trait TransferTokensModule { +pub trait TransferTokensModule: common_storage::CommonStorage { // NOTE: will use operation.data.op_sender as well when TransferAndExecuteByUser is implemented #[payable("*")] #[endpoint(transferTokens)] diff --git a/token-handler/wasm-token-handler-full/src/lib.rs b/token-handler/wasm-token-handler-full/src/lib.rs index 9d8bd29e..f03013a9 100644 --- a/token-handler/wasm-token-handler-full/src/lib.rs +++ b/token-handler/wasm-token-handler-full/src/lib.rs @@ -6,9 +6,9 @@ // Init: 1 // Upgrade: 1 -// Endpoints: 1 +// Endpoints: 2 // Async Callback (empty): 1 -// Total number of exported functions: 4 +// Total number of exported functions: 5 #![no_std] diff --git a/token-handler/wasm/src/lib.rs b/token-handler/wasm/src/lib.rs index 9d8bd29e..f03013a9 100644 --- a/token-handler/wasm/src/lib.rs +++ b/token-handler/wasm/src/lib.rs @@ -6,9 +6,9 @@ // Init: 1 // Upgrade: 1 -// Endpoints: 1 +// Endpoints: 2 // Async Callback (empty): 1 -// Total number of exported functions: 4 +// Total number of exported functions: 5 #![no_std] From 256ec4cf9336a72c6db62cfbc41cebd6029201fc Mon Sep 17 00:00:00 2001 From: Andrei Baltariu Date: Tue, 6 Aug 2024 11:14:48 +0300 Subject: [PATCH 252/523] White line Signed-off-by: Andrei Baltariu --- token-handler/src/transfer_tokens.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/token-handler/src/transfer_tokens.rs b/token-handler/src/transfer_tokens.rs index a87fd313..4245e7da 100644 --- a/token-handler/src/transfer_tokens.rs +++ b/token-handler/src/transfer_tokens.rs @@ -24,6 +24,7 @@ pub trait TransferTokensModule: common_storage::CommonStorage { tokens: MultiValueEncoded>, ) { self.require_caller_to_be_whitelisted(); + let mut output_payments = self.mint_tokens(&tokens.to_vec()); let call_value_esdt_transfer = self.call_value().all_esdt_transfers(); output_payments.extend(&call_value_esdt_transfer.clone_value()); From 5637709fa1ff035c24ca6d99355905c09cf23a3b Mon Sep 17 00:00:00 2001 From: Andrei Baltariu Date: Tue, 6 Aug 2024 13:56:20 +0300 Subject: [PATCH 253/523] Added init parameter for factoryScAddress Signed-off-by: Andrei Baltariu --- Cargo.lock | 1 + enshrine-esdt-safe/src/token_handler_proxy.rs | 6 +++++- .../wasm-enshrine-esdt-safe-full/Cargo.lock | 1 + .../wasm-enshrine-esdt-safe-view/Cargo.lock | 1 + enshrine-esdt-safe/wasm/Cargo.lock | 1 + token-handler/Cargo.toml | 3 +++ token-handler/src/common_storage.rs | 3 +++ token-handler/src/lib.rs | 9 ++++++++- token-handler/src/token_handler_proxy.rs | 6 +++++- token-handler/wasm-token-handler-full/Cargo.lock | 10 ++++++++++ token-handler/wasm-token-handler-view/Cargo.lock | 10 ++++++++++ token-handler/wasm/Cargo.lock | 10 ++++++++++ 12 files changed, 58 insertions(+), 3 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index a995ecd9..e86cbf3b 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1064,6 +1064,7 @@ version = "0.0.0" dependencies = [ "header-verifier", "multiversx-sc", + "multiversx-sc-modules", "multiversx-sc-scenario", "num-bigint", "transaction", diff --git a/enshrine-esdt-safe/src/token_handler_proxy.rs b/enshrine-esdt-safe/src/token_handler_proxy.rs index 319f4ad4..b2c3dad9 100644 --- a/enshrine-esdt-safe/src/token_handler_proxy.rs +++ b/enshrine-esdt-safe/src/token_handler_proxy.rs @@ -43,12 +43,16 @@ where From: TxFrom, Gas: TxGas, { - pub fn init( + pub fn init< + Arg0: ProxyArg>, + >( self, + factory_sc_address: Arg0, ) -> TxTypedDeploy { self.wrapped_tx .payment(NotPayable) .raw_deploy() + .argument(&factory_sc_address) .original_result() } } diff --git a/enshrine-esdt-safe/wasm-enshrine-esdt-safe-full/Cargo.lock b/enshrine-esdt-safe/wasm-enshrine-esdt-safe-full/Cargo.lock index eb452b33..3e8f4c2c 100644 --- a/enshrine-esdt-safe/wasm-enshrine-esdt-safe-full/Cargo.lock +++ b/enshrine-esdt-safe/wasm-enshrine-esdt-safe-full/Cargo.lock @@ -258,6 +258,7 @@ version = "0.0.0" dependencies = [ "header-verifier", "multiversx-sc", + "multiversx-sc-modules", "transaction", ] diff --git a/enshrine-esdt-safe/wasm-enshrine-esdt-safe-view/Cargo.lock b/enshrine-esdt-safe/wasm-enshrine-esdt-safe-view/Cargo.lock index e45287d0..af160519 100644 --- a/enshrine-esdt-safe/wasm-enshrine-esdt-safe-view/Cargo.lock +++ b/enshrine-esdt-safe/wasm-enshrine-esdt-safe-view/Cargo.lock @@ -258,6 +258,7 @@ version = "0.0.0" dependencies = [ "header-verifier", "multiversx-sc", + "multiversx-sc-modules", "transaction", ] diff --git a/enshrine-esdt-safe/wasm/Cargo.lock b/enshrine-esdt-safe/wasm/Cargo.lock index 5711ab60..7e9feb27 100644 --- a/enshrine-esdt-safe/wasm/Cargo.lock +++ b/enshrine-esdt-safe/wasm/Cargo.lock @@ -258,6 +258,7 @@ version = "0.0.0" dependencies = [ "header-verifier", "multiversx-sc", + "multiversx-sc-modules", "transaction", ] diff --git a/token-handler/Cargo.toml b/token-handler/Cargo.toml index e8da8c3a..8f5408d9 100644 --- a/token-handler/Cargo.toml +++ b/token-handler/Cargo.toml @@ -22,3 +22,6 @@ num-bigint = "0.4" [dev-dependencies.multiversx-sc-scenario] version = "0.52.2" + +[dependencies.multiversx-sc-modules] +version = "0.52.2" diff --git a/token-handler/src/common_storage.rs b/token-handler/src/common_storage.rs index 27e728c4..4cf0fe0f 100644 --- a/token-handler/src/common_storage.rs +++ b/token-handler/src/common_storage.rs @@ -6,6 +6,9 @@ use multiversx_sc::{ #[multiversx_sc::module] pub trait CommonStorage { + #[storage_mapper("factoryScAddress")] + fn factory_sc_address(&self) -> SingleValueMapper; + #[storage_mapper] fn sov_prefix(&self) -> SingleValueMapper; diff --git a/token-handler/src/lib.rs b/token-handler/src/lib.rs index abbd8b3b..ca89c4ee 100644 --- a/token-handler/src/lib.rs +++ b/token-handler/src/lib.rs @@ -12,7 +12,14 @@ pub trait TokenHandler: transfer_tokens::TransferTokensModule + common_storage::CommonStorage { #[init] - fn init(&self) {} + fn init(&self, factory_sc_address: ManagedAddress) { + require!( + self.blockchain().is_smart_contract(&factory_sc_address), + "The caller must be a SC" + ); + + self.factory_sc_address().set(&factory_sc_address); + } #[upgrade] fn upgrade(&self) {} diff --git a/token-handler/src/token_handler_proxy.rs b/token-handler/src/token_handler_proxy.rs index 319f4ad4..b2c3dad9 100644 --- a/token-handler/src/token_handler_proxy.rs +++ b/token-handler/src/token_handler_proxy.rs @@ -43,12 +43,16 @@ where From: TxFrom, Gas: TxGas, { - pub fn init( + pub fn init< + Arg0: ProxyArg>, + >( self, + factory_sc_address: Arg0, ) -> TxTypedDeploy { self.wrapped_tx .payment(NotPayable) .raw_deploy() + .argument(&factory_sc_address) .original_result() } } diff --git a/token-handler/wasm-token-handler-full/Cargo.lock b/token-handler/wasm-token-handler-full/Cargo.lock index 0efac6dd..7ce278ee 100644 --- a/token-handler/wasm-token-handler-full/Cargo.lock +++ b/token-handler/wasm-token-handler-full/Cargo.lock @@ -105,6 +105,15 @@ dependencies = [ "syn", ] +[[package]] +name = "multiversx-sc-modules" +version = "0.52.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "795f323df153249e27a84b13234625cb76122188e024d320e8882bef469ab51b" +dependencies = [ + "multiversx-sc", +] + [[package]] name = "multiversx-sc-wasm-adapter" version = "0.52.2" @@ -183,6 +192,7 @@ version = "0.0.0" dependencies = [ "header-verifier", "multiversx-sc", + "multiversx-sc-modules", "transaction", ] diff --git a/token-handler/wasm-token-handler-view/Cargo.lock b/token-handler/wasm-token-handler-view/Cargo.lock index 890de623..6fc14854 100644 --- a/token-handler/wasm-token-handler-view/Cargo.lock +++ b/token-handler/wasm-token-handler-view/Cargo.lock @@ -105,6 +105,15 @@ dependencies = [ "syn", ] +[[package]] +name = "multiversx-sc-modules" +version = "0.52.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "795f323df153249e27a84b13234625cb76122188e024d320e8882bef469ab51b" +dependencies = [ + "multiversx-sc", +] + [[package]] name = "multiversx-sc-wasm-adapter" version = "0.52.2" @@ -183,6 +192,7 @@ version = "0.0.0" dependencies = [ "header-verifier", "multiversx-sc", + "multiversx-sc-modules", "transaction", ] diff --git a/token-handler/wasm/Cargo.lock b/token-handler/wasm/Cargo.lock index 6a2664cd..f7e37b3c 100644 --- a/token-handler/wasm/Cargo.lock +++ b/token-handler/wasm/Cargo.lock @@ -105,6 +105,15 @@ dependencies = [ "syn", ] +[[package]] +name = "multiversx-sc-modules" +version = "0.52.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "795f323df153249e27a84b13234625cb76122188e024d320e8882bef469ab51b" +dependencies = [ + "multiversx-sc", +] + [[package]] name = "multiversx-sc-wasm-adapter" version = "0.52.2" @@ -183,6 +192,7 @@ version = "0.0.0" dependencies = [ "header-verifier", "multiversx-sc", + "multiversx-sc-modules", "transaction", ] From fdba7702541bd2491ad7fc91eec14873ba179343 Mon Sep 17 00:00:00 2001 From: Andrei Baltariu Date: Tue, 6 Aug 2024 14:28:35 +0300 Subject: [PATCH 254/523] Removed factoryScAddress mapper and insert Signed-off-by: Andrei Baltariu --- enshrine-esdt-safe/src/token_handler_proxy.rs | 6 +----- token-handler/src/common_storage.rs | 3 --- token-handler/src/lib.rs | 9 +-------- token-handler/src/token_handler_proxy.rs | 6 +----- 4 files changed, 3 insertions(+), 21 deletions(-) diff --git a/enshrine-esdt-safe/src/token_handler_proxy.rs b/enshrine-esdt-safe/src/token_handler_proxy.rs index b2c3dad9..319f4ad4 100644 --- a/enshrine-esdt-safe/src/token_handler_proxy.rs +++ b/enshrine-esdt-safe/src/token_handler_proxy.rs @@ -43,16 +43,12 @@ where From: TxFrom, Gas: TxGas, { - pub fn init< - Arg0: ProxyArg>, - >( + pub fn init( self, - factory_sc_address: Arg0, ) -> TxTypedDeploy { self.wrapped_tx .payment(NotPayable) .raw_deploy() - .argument(&factory_sc_address) .original_result() } } diff --git a/token-handler/src/common_storage.rs b/token-handler/src/common_storage.rs index 4cf0fe0f..27e728c4 100644 --- a/token-handler/src/common_storage.rs +++ b/token-handler/src/common_storage.rs @@ -6,9 +6,6 @@ use multiversx_sc::{ #[multiversx_sc::module] pub trait CommonStorage { - #[storage_mapper("factoryScAddress")] - fn factory_sc_address(&self) -> SingleValueMapper; - #[storage_mapper] fn sov_prefix(&self) -> SingleValueMapper; diff --git a/token-handler/src/lib.rs b/token-handler/src/lib.rs index ca89c4ee..abbd8b3b 100644 --- a/token-handler/src/lib.rs +++ b/token-handler/src/lib.rs @@ -12,14 +12,7 @@ pub trait TokenHandler: transfer_tokens::TransferTokensModule + common_storage::CommonStorage { #[init] - fn init(&self, factory_sc_address: ManagedAddress) { - require!( - self.blockchain().is_smart_contract(&factory_sc_address), - "The caller must be a SC" - ); - - self.factory_sc_address().set(&factory_sc_address); - } + fn init(&self) {} #[upgrade] fn upgrade(&self) {} diff --git a/token-handler/src/token_handler_proxy.rs b/token-handler/src/token_handler_proxy.rs index b2c3dad9..319f4ad4 100644 --- a/token-handler/src/token_handler_proxy.rs +++ b/token-handler/src/token_handler_proxy.rs @@ -43,16 +43,12 @@ where From: TxFrom, Gas: TxGas, { - pub fn init< - Arg0: ProxyArg>, - >( + pub fn init( self, - factory_sc_address: Arg0, ) -> TxTypedDeploy { self.wrapped_tx .payment(NotPayable) .raw_deploy() - .argument(&factory_sc_address) .original_result() } } From 7f5f18c6d7fb2668fd5fdedf0f9a61d93660e4ed Mon Sep 17 00:00:00 2001 From: Andrei Baltariu Date: Tue, 6 Aug 2024 14:32:44 +0300 Subject: [PATCH 255/523] Removed unused storage Signed-off-by: Andrei Baltariu --- Cargo.lock | 1 - token-handler/Cargo.toml | 3 --- token-handler/src/common_storage.rs | 9 +-------- 3 files changed, 1 insertion(+), 12 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index e86cbf3b..a995ecd9 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1064,7 +1064,6 @@ version = "0.0.0" dependencies = [ "header-verifier", "multiversx-sc", - "multiversx-sc-modules", "multiversx-sc-scenario", "num-bigint", "transaction", diff --git a/token-handler/Cargo.toml b/token-handler/Cargo.toml index 8f5408d9..e8da8c3a 100644 --- a/token-handler/Cargo.toml +++ b/token-handler/Cargo.toml @@ -22,6 +22,3 @@ num-bigint = "0.4" [dev-dependencies.multiversx-sc-scenario] version = "0.52.2" - -[dependencies.multiversx-sc-modules] -version = "0.52.2" diff --git a/token-handler/src/common_storage.rs b/token-handler/src/common_storage.rs index 27e728c4..e0312c10 100644 --- a/token-handler/src/common_storage.rs +++ b/token-handler/src/common_storage.rs @@ -1,14 +1,7 @@ -use multiversx_sc::{ - imports::{SingleValueMapper, UnorderedSetMapper}, - require, - types::ManagedAddress, -}; +use multiversx_sc::{imports::UnorderedSetMapper, require, types::ManagedAddress}; #[multiversx_sc::module] pub trait CommonStorage { - #[storage_mapper] - fn sov_prefix(&self) -> SingleValueMapper; - #[storage_mapper("enshrineEsdtWhitelist")] fn enshrine_esdt_whitelist(&self) -> UnorderedSetMapper>; From d66dfa364e5530292a54f961401dedbf0d81ac45 Mon Sep 17 00:00:00 2001 From: Andrei Baltariu Date: Tue, 6 Aug 2024 14:43:34 +0300 Subject: [PATCH 256/523] Built contracts Signed-off-by: Andrei Baltariu --- .../wasm-enshrine-esdt-safe-full/Cargo.lock | 1 - .../wasm-enshrine-esdt-safe-view/Cargo.lock | 1 - enshrine-esdt-safe/wasm/Cargo.lock | 1 - token-handler/wasm-token-handler-full/Cargo.lock | 10 ---------- token-handler/wasm-token-handler-view/Cargo.lock | 10 ---------- token-handler/wasm/Cargo.lock | 10 ---------- 6 files changed, 33 deletions(-) diff --git a/enshrine-esdt-safe/wasm-enshrine-esdt-safe-full/Cargo.lock b/enshrine-esdt-safe/wasm-enshrine-esdt-safe-full/Cargo.lock index 3e8f4c2c..eb452b33 100644 --- a/enshrine-esdt-safe/wasm-enshrine-esdt-safe-full/Cargo.lock +++ b/enshrine-esdt-safe/wasm-enshrine-esdt-safe-full/Cargo.lock @@ -258,7 +258,6 @@ version = "0.0.0" dependencies = [ "header-verifier", "multiversx-sc", - "multiversx-sc-modules", "transaction", ] diff --git a/enshrine-esdt-safe/wasm-enshrine-esdt-safe-view/Cargo.lock b/enshrine-esdt-safe/wasm-enshrine-esdt-safe-view/Cargo.lock index af160519..e45287d0 100644 --- a/enshrine-esdt-safe/wasm-enshrine-esdt-safe-view/Cargo.lock +++ b/enshrine-esdt-safe/wasm-enshrine-esdt-safe-view/Cargo.lock @@ -258,7 +258,6 @@ version = "0.0.0" dependencies = [ "header-verifier", "multiversx-sc", - "multiversx-sc-modules", "transaction", ] diff --git a/enshrine-esdt-safe/wasm/Cargo.lock b/enshrine-esdt-safe/wasm/Cargo.lock index 7e9feb27..5711ab60 100644 --- a/enshrine-esdt-safe/wasm/Cargo.lock +++ b/enshrine-esdt-safe/wasm/Cargo.lock @@ -258,7 +258,6 @@ version = "0.0.0" dependencies = [ "header-verifier", "multiversx-sc", - "multiversx-sc-modules", "transaction", ] diff --git a/token-handler/wasm-token-handler-full/Cargo.lock b/token-handler/wasm-token-handler-full/Cargo.lock index 7ce278ee..0efac6dd 100644 --- a/token-handler/wasm-token-handler-full/Cargo.lock +++ b/token-handler/wasm-token-handler-full/Cargo.lock @@ -105,15 +105,6 @@ dependencies = [ "syn", ] -[[package]] -name = "multiversx-sc-modules" -version = "0.52.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "795f323df153249e27a84b13234625cb76122188e024d320e8882bef469ab51b" -dependencies = [ - "multiversx-sc", -] - [[package]] name = "multiversx-sc-wasm-adapter" version = "0.52.2" @@ -192,7 +183,6 @@ version = "0.0.0" dependencies = [ "header-verifier", "multiversx-sc", - "multiversx-sc-modules", "transaction", ] diff --git a/token-handler/wasm-token-handler-view/Cargo.lock b/token-handler/wasm-token-handler-view/Cargo.lock index 6fc14854..890de623 100644 --- a/token-handler/wasm-token-handler-view/Cargo.lock +++ b/token-handler/wasm-token-handler-view/Cargo.lock @@ -105,15 +105,6 @@ dependencies = [ "syn", ] -[[package]] -name = "multiversx-sc-modules" -version = "0.52.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "795f323df153249e27a84b13234625cb76122188e024d320e8882bef469ab51b" -dependencies = [ - "multiversx-sc", -] - [[package]] name = "multiversx-sc-wasm-adapter" version = "0.52.2" @@ -192,7 +183,6 @@ version = "0.0.0" dependencies = [ "header-verifier", "multiversx-sc", - "multiversx-sc-modules", "transaction", ] diff --git a/token-handler/wasm/Cargo.lock b/token-handler/wasm/Cargo.lock index f7e37b3c..6a2664cd 100644 --- a/token-handler/wasm/Cargo.lock +++ b/token-handler/wasm/Cargo.lock @@ -105,15 +105,6 @@ dependencies = [ "syn", ] -[[package]] -name = "multiversx-sc-modules" -version = "0.52.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "795f323df153249e27a84b13234625cb76122188e024d320e8882bef469ab51b" -dependencies = [ - "multiversx-sc", -] - [[package]] name = "multiversx-sc-wasm-adapter" version = "0.52.2" @@ -192,7 +183,6 @@ version = "0.0.0" dependencies = [ "header-verifier", "multiversx-sc", - "multiversx-sc-modules", "transaction", ] From 65ace54e3b497fe63ab55904743f5e0c355abbfb Mon Sep 17 00:00:00 2001 From: Andrei Baltariu Date: Tue, 6 Aug 2024 17:13:02 +0300 Subject: [PATCH 257/523] Framework upgrade Signed-off-by: Andrei Baltariu --- Cargo.lock | 20 +++++++++---------- chain-config/Cargo.toml | 6 +++--- chain-config/meta/Cargo.toml | 2 +- chain-config/wasm/Cargo.lock | 16 +++++++-------- chain-config/wasm/Cargo.toml | 2 +- chain-factory/Cargo.toml | 4 ++-- chain-factory/meta/Cargo.toml | 2 +- chain-factory/wasm/Cargo.lock | 16 +++++++-------- chain-factory/wasm/Cargo.toml | 2 +- common/bls-signature/Cargo.toml | 4 ++-- common/max-bridged-amount-module/Cargo.toml | 4 ++-- common/setup-phase/Cargo.toml | 4 ++-- common/token-whitelist/Cargo.toml | 4 ++-- common/transaction/Cargo.toml | 2 +- common/tx-batch-module/Cargo.toml | 4 ++-- common/utils/Cargo.toml | 2 +- enshrine-esdt-safe/Cargo.toml | 6 +++--- enshrine-esdt-safe/meta/Cargo.toml | 2 +- .../wasm-enshrine-esdt-safe-full/Cargo.lock | 16 +++++++-------- .../wasm-enshrine-esdt-safe-full/Cargo.toml | 2 +- .../wasm-enshrine-esdt-safe-view/Cargo.lock | 16 +++++++-------- .../wasm-enshrine-esdt-safe-view/Cargo.toml | 2 +- enshrine-esdt-safe/wasm/Cargo.lock | 16 +++++++-------- enshrine-esdt-safe/wasm/Cargo.toml | 2 +- esdt-safe/Cargo.toml | 6 +++--- esdt-safe/meta/Cargo.toml | 2 +- esdt-safe/wasm-esdt-safe-full/Cargo.lock | 16 +++++++-------- esdt-safe/wasm-esdt-safe-full/Cargo.toml | 2 +- esdt-safe/wasm-esdt-safe-view/Cargo.lock | 16 +++++++-------- esdt-safe/wasm-esdt-safe-view/Cargo.toml | 2 +- esdt-safe/wasm/Cargo.lock | 16 +++++++-------- esdt-safe/wasm/Cargo.toml | 2 +- fee-market/Cargo.toml | 4 ++-- fee-market/meta/Cargo.toml | 2 +- fee-market/wasm-fee-marker-full/Cargo.lock | 12 +++++------ fee-market/wasm-fee-marker-full/Cargo.toml | 2 +- fee-market/wasm-multisig-view/Cargo.lock | 12 +++++------ fee-market/wasm-multisig-view/Cargo.toml | 2 +- fee-market/wasm/Cargo.lock | 12 +++++------ fee-market/wasm/Cargo.toml | 2 +- header-verifier/Cargo.toml | 4 ++-- header-verifier/meta/Cargo.toml | 2 +- .../wasm-header-verifier-full/Cargo.lock | 12 +++++------ .../wasm-header-verifier-full/Cargo.toml | 2 +- header-verifier/wasm-multisig-view/Cargo.lock | 12 +++++------ header-verifier/wasm-multisig-view/Cargo.toml | 2 +- header-verifier/wasm/Cargo.lock | 12 +++++------ header-verifier/wasm/Cargo.toml | 2 +- pair-mock/Cargo.toml | 4 ++-- pair-mock/meta/Cargo.toml | 2 +- pair-mock/wasm/Cargo.lock | 12 +++++------ pair-mock/wasm/Cargo.toml | 2 +- router-mock/Cargo.toml | 4 ++-- router-mock/meta/Cargo.toml | 2 +- router-mock/wasm/Cargo.lock | 12 +++++------ router-mock/wasm/Cargo.toml | 2 +- 56 files changed, 177 insertions(+), 177 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index c44b4c3c..fb981ccc 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -602,9 +602,9 @@ checksum = "b59072fa0624b55ae5ae3fa6bfa91515bbeb4ac440214bc4a509e2c8806d6e9f" [[package]] name = "multiversx-sc" -version = "0.52.2" +version = "0.52.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "290e945d3d268d2b0b7cc68f3c74844d35eaa06c1b7861a18ded3726bc6e6587" +checksum = "526760b1d6236c011285b264a70a0a9dd3b3dbc53c3b5f76932f4bcfd3a8910c" dependencies = [ "bitflags", "hex-literal", @@ -640,9 +640,9 @@ dependencies = [ [[package]] name = "multiversx-sc-derive" -version = "0.52.2" +version = "0.52.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f6363ecf098fa4687ca532d621af1222890ffe97ed333e19b6b206d621c3f9d4" +checksum = "3557f2f12640a8a07fa6af66cc2a13b188c5b61bed72db22fe631fb3a60c3e96" dependencies = [ "hex", "proc-macro2", @@ -653,9 +653,9 @@ dependencies = [ [[package]] name = "multiversx-sc-meta-lib" -version = "0.52.2" +version = "0.52.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e16b278a68a3ce17064e2eda0f08391b898a9af96c244e214b34e7a7351e65cc" +checksum = "b8deccfcc760b8fd281e2603268fa1a453ed65e4caac7a51a2d71c40cec37ae3" dependencies = [ "clap", "colored", @@ -674,18 +674,18 @@ dependencies = [ [[package]] name = "multiversx-sc-modules" -version = "0.52.2" +version = "0.52.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "795f323df153249e27a84b13234625cb76122188e024d320e8882bef469ab51b" +checksum = "61f5c29c6044f3dc9e866858feee625d7fae5604a68ac7bd66dec683eee97563" dependencies = [ "multiversx-sc", ] [[package]] name = "multiversx-sc-scenario" -version = "0.52.2" +version = "0.52.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c3ac0a22a23f65c07e43a10c1165f2553dc87bce6cbff06ef4f65dad05cdfc4a" +checksum = "5d3024d52e2cb7d455f5a560218be8968e446eabc7c31dc9fc479c329f45e05e" dependencies = [ "base64", "bech32", diff --git a/chain-config/Cargo.toml b/chain-config/Cargo.toml index ce6a790d..8994f3c6 100644 --- a/chain-config/Cargo.toml +++ b/chain-config/Cargo.toml @@ -12,10 +12,10 @@ path = "src/lib.rs" num-bigint = "0.4.2" [dev-dependencies.multiversx-sc-scenario] -version = "=0.52.2" +version = "=0.52.3" [dependencies.multiversx-sc] -version = "=0.52.2" +version = "=0.52.3" [dependencies.multiversx-sc-modules] -version = "=0.52.2" +version = "=0.52.3" diff --git a/chain-config/meta/Cargo.toml b/chain-config/meta/Cargo.toml index aee17fc3..8be3ab02 100644 --- a/chain-config/meta/Cargo.toml +++ b/chain-config/meta/Cargo.toml @@ -11,4 +11,4 @@ authors = ["you"] path = ".." [dependencies.multiversx-sc-meta-lib] -version = "=0.52.2" +version = "=0.52.3" diff --git a/chain-config/wasm/Cargo.lock b/chain-config/wasm/Cargo.lock index 9d9f34d2..dc270c85 100644 --- a/chain-config/wasm/Cargo.lock +++ b/chain-config/wasm/Cargo.lock @@ -56,9 +56,9 @@ checksum = "6fe2267d4ed49bc07b63801559be28c718ea06c4738b7a03c94df7386d2cde46" [[package]] name = "multiversx-sc" -version = "0.52.2" +version = "0.52.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "290e945d3d268d2b0b7cc68f3c74844d35eaa06c1b7861a18ded3726bc6e6587" +checksum = "526760b1d6236c011285b264a70a0a9dd3b3dbc53c3b5f76932f4bcfd3a8910c" dependencies = [ "bitflags", "hex-literal", @@ -93,9 +93,9 @@ dependencies = [ [[package]] name = "multiversx-sc-derive" -version = "0.52.2" +version = "0.52.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f6363ecf098fa4687ca532d621af1222890ffe97ed333e19b6b206d621c3f9d4" +checksum = "3557f2f12640a8a07fa6af66cc2a13b188c5b61bed72db22fe631fb3a60c3e96" dependencies = [ "hex", "proc-macro2", @@ -106,18 +106,18 @@ dependencies = [ [[package]] name = "multiversx-sc-modules" -version = "0.52.2" +version = "0.52.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "795f323df153249e27a84b13234625cb76122188e024d320e8882bef469ab51b" +checksum = "61f5c29c6044f3dc9e866858feee625d7fae5604a68ac7bd66dec683eee97563" dependencies = [ "multiversx-sc", ] [[package]] name = "multiversx-sc-wasm-adapter" -version = "0.52.2" +version = "0.52.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d3a7ef581b703ca0cef3ebc500ee2bf739c4def405ab2490e8b680a039e3408d" +checksum = "ed13aaca9cbdbc6911174cd3029e750a7563d85dd3daaa1107b1fd31c7f17245" dependencies = [ "multiversx-sc", ] diff --git a/chain-config/wasm/Cargo.toml b/chain-config/wasm/Cargo.toml index 8704883b..653873d2 100644 --- a/chain-config/wasm/Cargo.toml +++ b/chain-config/wasm/Cargo.toml @@ -28,7 +28,7 @@ panic = "abort" path = ".." [dependencies.multiversx-sc-wasm-adapter] -version = "=0.52.2" +version = "=0.52.3" [workspace] members = ["."] diff --git a/chain-factory/Cargo.toml b/chain-factory/Cargo.toml index 96296e6a..2ea3a0b7 100644 --- a/chain-factory/Cargo.toml +++ b/chain-factory/Cargo.toml @@ -12,10 +12,10 @@ path = "src/lib.rs" num-bigint = "0.4.2" [dev-dependencies.multiversx-sc-scenario] -version = "=0.52.2" +version = "=0.52.3" [dependencies.multiversx-sc] -version = "=0.52.2" +version = "=0.52.3" [dependencies.utils] path = "../common/utils" diff --git a/chain-factory/meta/Cargo.toml b/chain-factory/meta/Cargo.toml index 76422b05..c6c62a0f 100644 --- a/chain-factory/meta/Cargo.toml +++ b/chain-factory/meta/Cargo.toml @@ -11,4 +11,4 @@ authors = ["you"] path = ".." [dependencies.multiversx-sc-meta-lib] -version = "=0.52.2" +version = "=0.52.3" diff --git a/chain-factory/wasm/Cargo.lock b/chain-factory/wasm/Cargo.lock index 546843b3..b36ff0e8 100644 --- a/chain-factory/wasm/Cargo.lock +++ b/chain-factory/wasm/Cargo.lock @@ -74,9 +74,9 @@ checksum = "6fe2267d4ed49bc07b63801559be28c718ea06c4738b7a03c94df7386d2cde46" [[package]] name = "multiversx-sc" -version = "0.52.2" +version = "0.52.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "290e945d3d268d2b0b7cc68f3c74844d35eaa06c1b7861a18ded3726bc6e6587" +checksum = "526760b1d6236c011285b264a70a0a9dd3b3dbc53c3b5f76932f4bcfd3a8910c" dependencies = [ "bitflags", "hex-literal", @@ -111,9 +111,9 @@ dependencies = [ [[package]] name = "multiversx-sc-derive" -version = "0.52.2" +version = "0.52.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f6363ecf098fa4687ca532d621af1222890ffe97ed333e19b6b206d621c3f9d4" +checksum = "3557f2f12640a8a07fa6af66cc2a13b188c5b61bed72db22fe631fb3a60c3e96" dependencies = [ "hex", "proc-macro2", @@ -124,18 +124,18 @@ dependencies = [ [[package]] name = "multiversx-sc-modules" -version = "0.52.2" +version = "0.52.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "795f323df153249e27a84b13234625cb76122188e024d320e8882bef469ab51b" +checksum = "61f5c29c6044f3dc9e866858feee625d7fae5604a68ac7bd66dec683eee97563" dependencies = [ "multiversx-sc", ] [[package]] name = "multiversx-sc-wasm-adapter" -version = "0.52.2" +version = "0.52.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d3a7ef581b703ca0cef3ebc500ee2bf739c4def405ab2490e8b680a039e3408d" +checksum = "ed13aaca9cbdbc6911174cd3029e750a7563d85dd3daaa1107b1fd31c7f17245" dependencies = [ "multiversx-sc", ] diff --git a/chain-factory/wasm/Cargo.toml b/chain-factory/wasm/Cargo.toml index 158338ba..c0204755 100644 --- a/chain-factory/wasm/Cargo.toml +++ b/chain-factory/wasm/Cargo.toml @@ -28,7 +28,7 @@ panic = "abort" path = ".." [dependencies.multiversx-sc-wasm-adapter] -version = "=0.52.2" +version = "=0.52.3" [workspace] members = ["."] diff --git a/common/bls-signature/Cargo.toml b/common/bls-signature/Cargo.toml index 21e1506c..a5fcec20 100644 --- a/common/bls-signature/Cargo.toml +++ b/common/bls-signature/Cargo.toml @@ -5,10 +5,10 @@ authors = ["dorin-iancu "] edition = "2018" [dependencies.multiversx-sc] -version = "=0.52.2" +version = "=0.52.3" [dependencies.transaction] path = "../transaction" [dev-dependencies.multiversx-sc-scenario] -version = "=0.52.2" +version = "=0.52.3" diff --git a/common/max-bridged-amount-module/Cargo.toml b/common/max-bridged-amount-module/Cargo.toml index 4e5f6a63..2ec891a5 100644 --- a/common/max-bridged-amount-module/Cargo.toml +++ b/common/max-bridged-amount-module/Cargo.toml @@ -5,7 +5,7 @@ authors = ["dorin-iancu "] edition = "2018" [dependencies.multiversx-sc] -version = "=0.52.2" +version = "=0.52.3" [dev-dependencies.multiversx-sc-scenario] -version = "=0.52.2" +version = "=0.52.3" diff --git a/common/setup-phase/Cargo.toml b/common/setup-phase/Cargo.toml index 7b22c596..5f94007e 100644 --- a/common/setup-phase/Cargo.toml +++ b/common/setup-phase/Cargo.toml @@ -5,7 +5,7 @@ authors = ["dorin-iancu "] edition = "2018" [dependencies.multiversx-sc] -version = "=0.52.2" +version = "=0.52.3" [dev-dependencies.multiversx-sc-scenario] -version = "=0.52.2" +version = "=0.52.3" diff --git a/common/token-whitelist/Cargo.toml b/common/token-whitelist/Cargo.toml index 90a6bf4b..33535b0b 100644 --- a/common/token-whitelist/Cargo.toml +++ b/common/token-whitelist/Cargo.toml @@ -14,7 +14,7 @@ path = "../setup-phase" path = "../utils" [dependencies.multiversx-sc] -version = "=0.52.2" +version = "=0.52.3" [dev-dependencies.multiversx-sc-scenario] -version = "=0.52.2" +version = "=0.52.3" diff --git a/common/transaction/Cargo.toml b/common/transaction/Cargo.toml index d446f24e..2efc619f 100644 --- a/common/transaction/Cargo.toml +++ b/common/transaction/Cargo.toml @@ -8,4 +8,4 @@ edition = "2018" path = "src/lib.rs" [dependencies.multiversx-sc] -version = "=0.52.2" +version = "=0.52.3" diff --git a/common/tx-batch-module/Cargo.toml b/common/tx-batch-module/Cargo.toml index 0f76b99c..c255f2d0 100644 --- a/common/tx-batch-module/Cargo.toml +++ b/common/tx-batch-module/Cargo.toml @@ -5,10 +5,10 @@ authors = ["dorin-iancu "] edition = "2018" [dependencies.multiversx-sc] -version = "=0.52.2" +version = "=0.52.3" [dependencies.transaction] path = "../transaction" [dev-dependencies.multiversx-sc-scenario] -version = "=0.52.2" +version = "=0.52.3" diff --git a/common/utils/Cargo.toml b/common/utils/Cargo.toml index 80e99c7b..d8c33113 100644 --- a/common/utils/Cargo.toml +++ b/common/utils/Cargo.toml @@ -11,5 +11,5 @@ path = "src/lib.rs" path = "../bls-signature" [dependencies.multiversx-sc] -version = "=0.52.2" +version = "=0.52.3" features = ["esdt-token-payment-legacy-decode"] diff --git a/enshrine-esdt-safe/Cargo.toml b/enshrine-esdt-safe/Cargo.toml index fe19781f..6d70ceea 100644 --- a/enshrine-esdt-safe/Cargo.toml +++ b/enshrine-esdt-safe/Cargo.toml @@ -36,10 +36,10 @@ path = "../fee-market" path = "../header-verifier" [dependencies.multiversx-sc] -version = "=0.52.2" +version = "=0.52.3" [dependencies.multiversx-sc-modules] -version = "=0.52.2" +version = "=0.52.3" [dev-dependencies] num-bigint = "0.4.2" @@ -47,4 +47,4 @@ num-traits = "0.2" hex = "0.4" [dev-dependencies.multiversx-sc-scenario] -version = "=0.52.2" +version = "=0.52.3" diff --git a/enshrine-esdt-safe/meta/Cargo.toml b/enshrine-esdt-safe/meta/Cargo.toml index 4bf6b644..50d1d790 100644 --- a/enshrine-esdt-safe/meta/Cargo.toml +++ b/enshrine-esdt-safe/meta/Cargo.toml @@ -8,5 +8,5 @@ publish = false path = ".." [dependencies.multiversx-sc-meta-lib] -version = "0.52.2" +version = "0.52.3" default-features = false diff --git a/enshrine-esdt-safe/wasm-enshrine-esdt-safe-full/Cargo.lock b/enshrine-esdt-safe/wasm-enshrine-esdt-safe-full/Cargo.lock index 0aadf27b..bc210a3f 100644 --- a/enshrine-esdt-safe/wasm-enshrine-esdt-safe-full/Cargo.lock +++ b/enshrine-esdt-safe/wasm-enshrine-esdt-safe-full/Cargo.lock @@ -101,9 +101,9 @@ dependencies = [ [[package]] name = "multiversx-sc" -version = "0.52.2" +version = "0.52.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "290e945d3d268d2b0b7cc68f3c74844d35eaa06c1b7861a18ded3726bc6e6587" +checksum = "526760b1d6236c011285b264a70a0a9dd3b3dbc53c3b5f76932f4bcfd3a8910c" dependencies = [ "bitflags", "hex-literal", @@ -138,9 +138,9 @@ dependencies = [ [[package]] name = "multiversx-sc-derive" -version = "0.52.2" +version = "0.52.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f6363ecf098fa4687ca532d621af1222890ffe97ed333e19b6b206d621c3f9d4" +checksum = "3557f2f12640a8a07fa6af66cc2a13b188c5b61bed72db22fe631fb3a60c3e96" dependencies = [ "hex", "proc-macro2", @@ -151,18 +151,18 @@ dependencies = [ [[package]] name = "multiversx-sc-modules" -version = "0.52.2" +version = "0.52.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "795f323df153249e27a84b13234625cb76122188e024d320e8882bef469ab51b" +checksum = "61f5c29c6044f3dc9e866858feee625d7fae5604a68ac7bd66dec683eee97563" dependencies = [ "multiversx-sc", ] [[package]] name = "multiversx-sc-wasm-adapter" -version = "0.52.2" +version = "0.52.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d3a7ef581b703ca0cef3ebc500ee2bf739c4def405ab2490e8b680a039e3408d" +checksum = "ed13aaca9cbdbc6911174cd3029e750a7563d85dd3daaa1107b1fd31c7f17245" dependencies = [ "multiversx-sc", ] diff --git a/enshrine-esdt-safe/wasm-enshrine-esdt-safe-full/Cargo.toml b/enshrine-esdt-safe/wasm-enshrine-esdt-safe-full/Cargo.toml index c8025c42..96fcabcf 100644 --- a/enshrine-esdt-safe/wasm-enshrine-esdt-safe-full/Cargo.toml +++ b/enshrine-esdt-safe/wasm-enshrine-esdt-safe-full/Cargo.toml @@ -28,7 +28,7 @@ panic = "abort" path = ".." [dependencies.multiversx-sc-wasm-adapter] -version = "=0.52.2" +version = "=0.52.3" [workspace] members = ["."] diff --git a/enshrine-esdt-safe/wasm-enshrine-esdt-safe-view/Cargo.lock b/enshrine-esdt-safe/wasm-enshrine-esdt-safe-view/Cargo.lock index 45d69791..8440f3c5 100644 --- a/enshrine-esdt-safe/wasm-enshrine-esdt-safe-view/Cargo.lock +++ b/enshrine-esdt-safe/wasm-enshrine-esdt-safe-view/Cargo.lock @@ -101,9 +101,9 @@ dependencies = [ [[package]] name = "multiversx-sc" -version = "0.52.2" +version = "0.52.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "290e945d3d268d2b0b7cc68f3c74844d35eaa06c1b7861a18ded3726bc6e6587" +checksum = "526760b1d6236c011285b264a70a0a9dd3b3dbc53c3b5f76932f4bcfd3a8910c" dependencies = [ "bitflags", "hex-literal", @@ -138,9 +138,9 @@ dependencies = [ [[package]] name = "multiversx-sc-derive" -version = "0.52.2" +version = "0.52.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f6363ecf098fa4687ca532d621af1222890ffe97ed333e19b6b206d621c3f9d4" +checksum = "3557f2f12640a8a07fa6af66cc2a13b188c5b61bed72db22fe631fb3a60c3e96" dependencies = [ "hex", "proc-macro2", @@ -151,18 +151,18 @@ dependencies = [ [[package]] name = "multiversx-sc-modules" -version = "0.52.2" +version = "0.52.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "795f323df153249e27a84b13234625cb76122188e024d320e8882bef469ab51b" +checksum = "61f5c29c6044f3dc9e866858feee625d7fae5604a68ac7bd66dec683eee97563" dependencies = [ "multiversx-sc", ] [[package]] name = "multiversx-sc-wasm-adapter" -version = "0.52.2" +version = "0.52.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d3a7ef581b703ca0cef3ebc500ee2bf739c4def405ab2490e8b680a039e3408d" +checksum = "ed13aaca9cbdbc6911174cd3029e750a7563d85dd3daaa1107b1fd31c7f17245" dependencies = [ "multiversx-sc", ] diff --git a/enshrine-esdt-safe/wasm-enshrine-esdt-safe-view/Cargo.toml b/enshrine-esdt-safe/wasm-enshrine-esdt-safe-view/Cargo.toml index 80672c5d..0b1059ba 100644 --- a/enshrine-esdt-safe/wasm-enshrine-esdt-safe-view/Cargo.toml +++ b/enshrine-esdt-safe/wasm-enshrine-esdt-safe-view/Cargo.toml @@ -28,7 +28,7 @@ panic = "abort" path = ".." [dependencies.multiversx-sc-wasm-adapter] -version = "=0.52.2" +version = "=0.52.3" [workspace] members = ["."] diff --git a/enshrine-esdt-safe/wasm/Cargo.lock b/enshrine-esdt-safe/wasm/Cargo.lock index be40a5a8..7b70cfa7 100644 --- a/enshrine-esdt-safe/wasm/Cargo.lock +++ b/enshrine-esdt-safe/wasm/Cargo.lock @@ -101,9 +101,9 @@ dependencies = [ [[package]] name = "multiversx-sc" -version = "0.52.2" +version = "0.52.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "290e945d3d268d2b0b7cc68f3c74844d35eaa06c1b7861a18ded3726bc6e6587" +checksum = "526760b1d6236c011285b264a70a0a9dd3b3dbc53c3b5f76932f4bcfd3a8910c" dependencies = [ "bitflags", "hex-literal", @@ -138,9 +138,9 @@ dependencies = [ [[package]] name = "multiversx-sc-derive" -version = "0.52.2" +version = "0.52.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f6363ecf098fa4687ca532d621af1222890ffe97ed333e19b6b206d621c3f9d4" +checksum = "3557f2f12640a8a07fa6af66cc2a13b188c5b61bed72db22fe631fb3a60c3e96" dependencies = [ "hex", "proc-macro2", @@ -151,18 +151,18 @@ dependencies = [ [[package]] name = "multiversx-sc-modules" -version = "0.52.2" +version = "0.52.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "795f323df153249e27a84b13234625cb76122188e024d320e8882bef469ab51b" +checksum = "61f5c29c6044f3dc9e866858feee625d7fae5604a68ac7bd66dec683eee97563" dependencies = [ "multiversx-sc", ] [[package]] name = "multiversx-sc-wasm-adapter" -version = "0.52.2" +version = "0.52.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d3a7ef581b703ca0cef3ebc500ee2bf739c4def405ab2490e8b680a039e3408d" +checksum = "ed13aaca9cbdbc6911174cd3029e750a7563d85dd3daaa1107b1fd31c7f17245" dependencies = [ "multiversx-sc", ] diff --git a/enshrine-esdt-safe/wasm/Cargo.toml b/enshrine-esdt-safe/wasm/Cargo.toml index 16e79387..14e87d29 100644 --- a/enshrine-esdt-safe/wasm/Cargo.toml +++ b/enshrine-esdt-safe/wasm/Cargo.toml @@ -28,7 +28,7 @@ panic = "abort" path = ".." [dependencies.multiversx-sc-wasm-adapter] -version = "=0.52.2" +version = "=0.52.3" [workspace] members = ["."] diff --git a/esdt-safe/Cargo.toml b/esdt-safe/Cargo.toml index d384f12d..4348f79d 100644 --- a/esdt-safe/Cargo.toml +++ b/esdt-safe/Cargo.toml @@ -36,10 +36,10 @@ path = "../fee-market" path = "../header-verifier" [dependencies.multiversx-sc] -version = "=0.52.2" +version = "=0.52.3" [dependencies.multiversx-sc-modules] -version = "=0.52.2" +version = "=0.52.3" [dev-dependencies] num-bigint = "0.4.2" @@ -47,4 +47,4 @@ num-traits = "0.2" hex = "0.4" [dev-dependencies.multiversx-sc-scenario] -version = "=0.52.2" +version = "=0.52.3" diff --git a/esdt-safe/meta/Cargo.toml b/esdt-safe/meta/Cargo.toml index 2f2fde20..22e1d15e 100644 --- a/esdt-safe/meta/Cargo.toml +++ b/esdt-safe/meta/Cargo.toml @@ -11,4 +11,4 @@ publish = false path = ".." [dependencies.multiversx-sc-meta-lib] -version = "=0.52.2" +version = "=0.52.3" diff --git a/esdt-safe/wasm-esdt-safe-full/Cargo.lock b/esdt-safe/wasm-esdt-safe-full/Cargo.lock index 722db0ac..88c6e071 100644 --- a/esdt-safe/wasm-esdt-safe-full/Cargo.lock +++ b/esdt-safe/wasm-esdt-safe-full/Cargo.lock @@ -101,9 +101,9 @@ dependencies = [ [[package]] name = "multiversx-sc" -version = "0.52.2" +version = "0.52.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "290e945d3d268d2b0b7cc68f3c74844d35eaa06c1b7861a18ded3726bc6e6587" +checksum = "526760b1d6236c011285b264a70a0a9dd3b3dbc53c3b5f76932f4bcfd3a8910c" dependencies = [ "bitflags", "hex-literal", @@ -138,9 +138,9 @@ dependencies = [ [[package]] name = "multiversx-sc-derive" -version = "0.52.2" +version = "0.52.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f6363ecf098fa4687ca532d621af1222890ffe97ed333e19b6b206d621c3f9d4" +checksum = "3557f2f12640a8a07fa6af66cc2a13b188c5b61bed72db22fe631fb3a60c3e96" dependencies = [ "hex", "proc-macro2", @@ -151,18 +151,18 @@ dependencies = [ [[package]] name = "multiversx-sc-modules" -version = "0.52.2" +version = "0.52.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "795f323df153249e27a84b13234625cb76122188e024d320e8882bef469ab51b" +checksum = "61f5c29c6044f3dc9e866858feee625d7fae5604a68ac7bd66dec683eee97563" dependencies = [ "multiversx-sc", ] [[package]] name = "multiversx-sc-wasm-adapter" -version = "0.52.2" +version = "0.52.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d3a7ef581b703ca0cef3ebc500ee2bf739c4def405ab2490e8b680a039e3408d" +checksum = "ed13aaca9cbdbc6911174cd3029e750a7563d85dd3daaa1107b1fd31c7f17245" dependencies = [ "multiversx-sc", ] diff --git a/esdt-safe/wasm-esdt-safe-full/Cargo.toml b/esdt-safe/wasm-esdt-safe-full/Cargo.toml index d05d99cf..86359c31 100644 --- a/esdt-safe/wasm-esdt-safe-full/Cargo.toml +++ b/esdt-safe/wasm-esdt-safe-full/Cargo.toml @@ -28,7 +28,7 @@ panic = "abort" path = ".." [dependencies.multiversx-sc-wasm-adapter] -version = "=0.52.2" +version = "=0.52.3" [workspace] members = ["."] diff --git a/esdt-safe/wasm-esdt-safe-view/Cargo.lock b/esdt-safe/wasm-esdt-safe-view/Cargo.lock index 437abc07..2e4c78d9 100644 --- a/esdt-safe/wasm-esdt-safe-view/Cargo.lock +++ b/esdt-safe/wasm-esdt-safe-view/Cargo.lock @@ -101,9 +101,9 @@ dependencies = [ [[package]] name = "multiversx-sc" -version = "0.52.2" +version = "0.52.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "290e945d3d268d2b0b7cc68f3c74844d35eaa06c1b7861a18ded3726bc6e6587" +checksum = "526760b1d6236c011285b264a70a0a9dd3b3dbc53c3b5f76932f4bcfd3a8910c" dependencies = [ "bitflags", "hex-literal", @@ -138,9 +138,9 @@ dependencies = [ [[package]] name = "multiversx-sc-derive" -version = "0.52.2" +version = "0.52.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f6363ecf098fa4687ca532d621af1222890ffe97ed333e19b6b206d621c3f9d4" +checksum = "3557f2f12640a8a07fa6af66cc2a13b188c5b61bed72db22fe631fb3a60c3e96" dependencies = [ "hex", "proc-macro2", @@ -151,18 +151,18 @@ dependencies = [ [[package]] name = "multiversx-sc-modules" -version = "0.52.2" +version = "0.52.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "795f323df153249e27a84b13234625cb76122188e024d320e8882bef469ab51b" +checksum = "61f5c29c6044f3dc9e866858feee625d7fae5604a68ac7bd66dec683eee97563" dependencies = [ "multiversx-sc", ] [[package]] name = "multiversx-sc-wasm-adapter" -version = "0.52.2" +version = "0.52.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d3a7ef581b703ca0cef3ebc500ee2bf739c4def405ab2490e8b680a039e3408d" +checksum = "ed13aaca9cbdbc6911174cd3029e750a7563d85dd3daaa1107b1fd31c7f17245" dependencies = [ "multiversx-sc", ] diff --git a/esdt-safe/wasm-esdt-safe-view/Cargo.toml b/esdt-safe/wasm-esdt-safe-view/Cargo.toml index 5fa960f9..306e0f97 100644 --- a/esdt-safe/wasm-esdt-safe-view/Cargo.toml +++ b/esdt-safe/wasm-esdt-safe-view/Cargo.toml @@ -28,7 +28,7 @@ panic = "abort" path = ".." [dependencies.multiversx-sc-wasm-adapter] -version = "=0.52.2" +version = "=0.52.3" [workspace] members = ["."] diff --git a/esdt-safe/wasm/Cargo.lock b/esdt-safe/wasm/Cargo.lock index 0ec20a41..f2f28457 100644 --- a/esdt-safe/wasm/Cargo.lock +++ b/esdt-safe/wasm/Cargo.lock @@ -101,9 +101,9 @@ dependencies = [ [[package]] name = "multiversx-sc" -version = "0.52.2" +version = "0.52.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "290e945d3d268d2b0b7cc68f3c74844d35eaa06c1b7861a18ded3726bc6e6587" +checksum = "526760b1d6236c011285b264a70a0a9dd3b3dbc53c3b5f76932f4bcfd3a8910c" dependencies = [ "bitflags", "hex-literal", @@ -138,9 +138,9 @@ dependencies = [ [[package]] name = "multiversx-sc-derive" -version = "0.52.2" +version = "0.52.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f6363ecf098fa4687ca532d621af1222890ffe97ed333e19b6b206d621c3f9d4" +checksum = "3557f2f12640a8a07fa6af66cc2a13b188c5b61bed72db22fe631fb3a60c3e96" dependencies = [ "hex", "proc-macro2", @@ -151,18 +151,18 @@ dependencies = [ [[package]] name = "multiversx-sc-modules" -version = "0.52.2" +version = "0.52.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "795f323df153249e27a84b13234625cb76122188e024d320e8882bef469ab51b" +checksum = "61f5c29c6044f3dc9e866858feee625d7fae5604a68ac7bd66dec683eee97563" dependencies = [ "multiversx-sc", ] [[package]] name = "multiversx-sc-wasm-adapter" -version = "0.52.2" +version = "0.52.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d3a7ef581b703ca0cef3ebc500ee2bf739c4def405ab2490e8b680a039e3408d" +checksum = "ed13aaca9cbdbc6911174cd3029e750a7563d85dd3daaa1107b1fd31c7f17245" dependencies = [ "multiversx-sc", ] diff --git a/esdt-safe/wasm/Cargo.toml b/esdt-safe/wasm/Cargo.toml index 8ed314d3..9b79e7d4 100644 --- a/esdt-safe/wasm/Cargo.toml +++ b/esdt-safe/wasm/Cargo.toml @@ -28,7 +28,7 @@ panic = "abort" path = ".." [dependencies.multiversx-sc-wasm-adapter] -version = "=0.52.2" +version = "=0.52.3" [workspace] members = ["."] diff --git a/fee-market/Cargo.toml b/fee-market/Cargo.toml index bdd79af3..4bc194d4 100644 --- a/fee-market/Cargo.toml +++ b/fee-market/Cargo.toml @@ -24,10 +24,10 @@ path = "../pair-mock" path = "../router-mock" [dependencies.multiversx-sc] -version = "=0.52.2" +version = "=0.52.3" [dev-dependencies] num-bigint = "0.4.2" [dev-dependencies.multiversx-sc-scenario] -version = "=0.52.2" +version = "=0.52.3" diff --git a/fee-market/meta/Cargo.toml b/fee-market/meta/Cargo.toml index e5fed42e..3a468fe5 100644 --- a/fee-market/meta/Cargo.toml +++ b/fee-market/meta/Cargo.toml @@ -8,5 +8,5 @@ publish = false path = ".." [dependencies.multiversx-sc-meta-lib] -version = "=0.52.2" +version = "=0.52.3" default-features = false diff --git a/fee-market/wasm-fee-marker-full/Cargo.lock b/fee-market/wasm-fee-marker-full/Cargo.lock index cad73ead..f7b36191 100644 --- a/fee-market/wasm-fee-marker-full/Cargo.lock +++ b/fee-market/wasm-fee-marker-full/Cargo.lock @@ -68,9 +68,9 @@ checksum = "6fe2267d4ed49bc07b63801559be28c718ea06c4738b7a03c94df7386d2cde46" [[package]] name = "multiversx-sc" -version = "0.52.2" +version = "0.52.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "290e945d3d268d2b0b7cc68f3c74844d35eaa06c1b7861a18ded3726bc6e6587" +checksum = "526760b1d6236c011285b264a70a0a9dd3b3dbc53c3b5f76932f4bcfd3a8910c" dependencies = [ "bitflags", "hex-literal", @@ -105,9 +105,9 @@ dependencies = [ [[package]] name = "multiversx-sc-derive" -version = "0.52.2" +version = "0.52.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f6363ecf098fa4687ca532d621af1222890ffe97ed333e19b6b206d621c3f9d4" +checksum = "3557f2f12640a8a07fa6af66cc2a13b188c5b61bed72db22fe631fb3a60c3e96" dependencies = [ "hex", "proc-macro2", @@ -118,9 +118,9 @@ dependencies = [ [[package]] name = "multiversx-sc-wasm-adapter" -version = "0.52.2" +version = "0.52.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d3a7ef581b703ca0cef3ebc500ee2bf739c4def405ab2490e8b680a039e3408d" +checksum = "ed13aaca9cbdbc6911174cd3029e750a7563d85dd3daaa1107b1fd31c7f17245" dependencies = [ "multiversx-sc", ] diff --git a/fee-market/wasm-fee-marker-full/Cargo.toml b/fee-market/wasm-fee-marker-full/Cargo.toml index 5511c2cb..6587d274 100644 --- a/fee-market/wasm-fee-marker-full/Cargo.toml +++ b/fee-market/wasm-fee-marker-full/Cargo.toml @@ -28,7 +28,7 @@ panic = "abort" path = ".." [dependencies.multiversx-sc-wasm-adapter] -version = "=0.52.2" +version = "=0.52.3" [workspace] members = ["."] diff --git a/fee-market/wasm-multisig-view/Cargo.lock b/fee-market/wasm-multisig-view/Cargo.lock index 361c68fb..40383188 100644 --- a/fee-market/wasm-multisig-view/Cargo.lock +++ b/fee-market/wasm-multisig-view/Cargo.lock @@ -68,9 +68,9 @@ dependencies = [ [[package]] name = "multiversx-sc" -version = "0.52.2" +version = "0.52.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "290e945d3d268d2b0b7cc68f3c74844d35eaa06c1b7861a18ded3726bc6e6587" +checksum = "526760b1d6236c011285b264a70a0a9dd3b3dbc53c3b5f76932f4bcfd3a8910c" dependencies = [ "bitflags", "hex-literal", @@ -105,9 +105,9 @@ dependencies = [ [[package]] name = "multiversx-sc-derive" -version = "0.52.2" +version = "0.52.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f6363ecf098fa4687ca532d621af1222890ffe97ed333e19b6b206d621c3f9d4" +checksum = "3557f2f12640a8a07fa6af66cc2a13b188c5b61bed72db22fe631fb3a60c3e96" dependencies = [ "hex", "proc-macro2", @@ -118,9 +118,9 @@ dependencies = [ [[package]] name = "multiversx-sc-wasm-adapter" -version = "0.52.2" +version = "0.52.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d3a7ef581b703ca0cef3ebc500ee2bf739c4def405ab2490e8b680a039e3408d" +checksum = "ed13aaca9cbdbc6911174cd3029e750a7563d85dd3daaa1107b1fd31c7f17245" dependencies = [ "multiversx-sc", ] diff --git a/fee-market/wasm-multisig-view/Cargo.toml b/fee-market/wasm-multisig-view/Cargo.toml index a691d6ab..dce079a0 100644 --- a/fee-market/wasm-multisig-view/Cargo.toml +++ b/fee-market/wasm-multisig-view/Cargo.toml @@ -28,7 +28,7 @@ panic = "abort" path = ".." [dependencies.multiversx-sc-wasm-adapter] -version = "=0.52.2" +version = "=0.52.3" [workspace] members = ["."] diff --git a/fee-market/wasm/Cargo.lock b/fee-market/wasm/Cargo.lock index 129b7bab..6f9601eb 100644 --- a/fee-market/wasm/Cargo.lock +++ b/fee-market/wasm/Cargo.lock @@ -68,9 +68,9 @@ checksum = "6fe2267d4ed49bc07b63801559be28c718ea06c4738b7a03c94df7386d2cde46" [[package]] name = "multiversx-sc" -version = "0.52.2" +version = "0.52.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "290e945d3d268d2b0b7cc68f3c74844d35eaa06c1b7861a18ded3726bc6e6587" +checksum = "526760b1d6236c011285b264a70a0a9dd3b3dbc53c3b5f76932f4bcfd3a8910c" dependencies = [ "bitflags", "hex-literal", @@ -105,9 +105,9 @@ dependencies = [ [[package]] name = "multiversx-sc-derive" -version = "0.52.2" +version = "0.52.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f6363ecf098fa4687ca532d621af1222890ffe97ed333e19b6b206d621c3f9d4" +checksum = "3557f2f12640a8a07fa6af66cc2a13b188c5b61bed72db22fe631fb3a60c3e96" dependencies = [ "hex", "proc-macro2", @@ -118,9 +118,9 @@ dependencies = [ [[package]] name = "multiversx-sc-wasm-adapter" -version = "0.52.2" +version = "0.52.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d3a7ef581b703ca0cef3ebc500ee2bf739c4def405ab2490e8b680a039e3408d" +checksum = "ed13aaca9cbdbc6911174cd3029e750a7563d85dd3daaa1107b1fd31c7f17245" dependencies = [ "multiversx-sc", ] diff --git a/fee-market/wasm/Cargo.toml b/fee-market/wasm/Cargo.toml index 609a2b00..05b7cbb4 100644 --- a/fee-market/wasm/Cargo.toml +++ b/fee-market/wasm/Cargo.toml @@ -28,7 +28,7 @@ panic = "abort" path = ".." [dependencies.multiversx-sc-wasm-adapter] -version = "=0.52.2" +version = "=0.52.3" [workspace] members = ["."] diff --git a/header-verifier/Cargo.toml b/header-verifier/Cargo.toml index c95c0f84..e97e0ff4 100644 --- a/header-verifier/Cargo.toml +++ b/header-verifier/Cargo.toml @@ -9,7 +9,7 @@ publish = false path = "src/lib.rs" [dependencies.multiversx-sc] -version = "0.52.2" +version = "0.52.3" [dependencies.bls-signature] path = "../common/bls-signature" @@ -21,4 +21,4 @@ path = "../common/transaction" num-bigint = "0.4.2" [dev-dependencies.multiversx-sc-scenario] -version = "0.52.2" +version = "0.52.3" diff --git a/header-verifier/meta/Cargo.toml b/header-verifier/meta/Cargo.toml index fe3a30b7..81c2fb87 100644 --- a/header-verifier/meta/Cargo.toml +++ b/header-verifier/meta/Cargo.toml @@ -8,5 +8,5 @@ publish = false path = ".." [dependencies.multiversx-sc-meta-lib] -version = "0.52.2" +version = "0.52.3" default-features = false diff --git a/header-verifier/wasm-header-verifier-full/Cargo.lock b/header-verifier/wasm-header-verifier-full/Cargo.lock index 3f2e0c9f..395a8037 100644 --- a/header-verifier/wasm-header-verifier-full/Cargo.lock +++ b/header-verifier/wasm-header-verifier-full/Cargo.lock @@ -65,9 +65,9 @@ checksum = "6fe2267d4ed49bc07b63801559be28c718ea06c4738b7a03c94df7386d2cde46" [[package]] name = "multiversx-sc" -version = "0.52.2" +version = "0.52.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "290e945d3d268d2b0b7cc68f3c74844d35eaa06c1b7861a18ded3726bc6e6587" +checksum = "526760b1d6236c011285b264a70a0a9dd3b3dbc53c3b5f76932f4bcfd3a8910c" dependencies = [ "bitflags", "hex-literal", @@ -102,9 +102,9 @@ dependencies = [ [[package]] name = "multiversx-sc-derive" -version = "0.52.2" +version = "0.52.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f6363ecf098fa4687ca532d621af1222890ffe97ed333e19b6b206d621c3f9d4" +checksum = "3557f2f12640a8a07fa6af66cc2a13b188c5b61bed72db22fe631fb3a60c3e96" dependencies = [ "hex", "proc-macro2", @@ -115,9 +115,9 @@ dependencies = [ [[package]] name = "multiversx-sc-wasm-adapter" -version = "0.52.2" +version = "0.52.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d3a7ef581b703ca0cef3ebc500ee2bf739c4def405ab2490e8b680a039e3408d" +checksum = "ed13aaca9cbdbc6911174cd3029e750a7563d85dd3daaa1107b1fd31c7f17245" dependencies = [ "multiversx-sc", ] diff --git a/header-verifier/wasm-header-verifier-full/Cargo.toml b/header-verifier/wasm-header-verifier-full/Cargo.toml index bc315cdb..c173ea6f 100644 --- a/header-verifier/wasm-header-verifier-full/Cargo.toml +++ b/header-verifier/wasm-header-verifier-full/Cargo.toml @@ -28,7 +28,7 @@ panic = "abort" path = ".." [dependencies.multiversx-sc-wasm-adapter] -version = "0.52.2" +version = "0.52.3" [workspace] members = ["."] diff --git a/header-verifier/wasm-multisig-view/Cargo.lock b/header-verifier/wasm-multisig-view/Cargo.lock index e988cf67..4ecfc521 100644 --- a/header-verifier/wasm-multisig-view/Cargo.lock +++ b/header-verifier/wasm-multisig-view/Cargo.lock @@ -65,9 +65,9 @@ dependencies = [ [[package]] name = "multiversx-sc" -version = "0.52.2" +version = "0.52.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "290e945d3d268d2b0b7cc68f3c74844d35eaa06c1b7861a18ded3726bc6e6587" +checksum = "526760b1d6236c011285b264a70a0a9dd3b3dbc53c3b5f76932f4bcfd3a8910c" dependencies = [ "bitflags", "hex-literal", @@ -102,9 +102,9 @@ dependencies = [ [[package]] name = "multiversx-sc-derive" -version = "0.52.2" +version = "0.52.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f6363ecf098fa4687ca532d621af1222890ffe97ed333e19b6b206d621c3f9d4" +checksum = "3557f2f12640a8a07fa6af66cc2a13b188c5b61bed72db22fe631fb3a60c3e96" dependencies = [ "hex", "proc-macro2", @@ -115,9 +115,9 @@ dependencies = [ [[package]] name = "multiversx-sc-wasm-adapter" -version = "0.52.2" +version = "0.52.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d3a7ef581b703ca0cef3ebc500ee2bf739c4def405ab2490e8b680a039e3408d" +checksum = "ed13aaca9cbdbc6911174cd3029e750a7563d85dd3daaa1107b1fd31c7f17245" dependencies = [ "multiversx-sc", ] diff --git a/header-verifier/wasm-multisig-view/Cargo.toml b/header-verifier/wasm-multisig-view/Cargo.toml index db1ab918..c566f4ce 100644 --- a/header-verifier/wasm-multisig-view/Cargo.toml +++ b/header-verifier/wasm-multisig-view/Cargo.toml @@ -28,7 +28,7 @@ panic = "abort" path = ".." [dependencies.multiversx-sc-wasm-adapter] -version = "0.52.2" +version = "0.52.3" [workspace] members = ["."] diff --git a/header-verifier/wasm/Cargo.lock b/header-verifier/wasm/Cargo.lock index befe0cda..82ccad84 100644 --- a/header-verifier/wasm/Cargo.lock +++ b/header-verifier/wasm/Cargo.lock @@ -65,9 +65,9 @@ checksum = "6fe2267d4ed49bc07b63801559be28c718ea06c4738b7a03c94df7386d2cde46" [[package]] name = "multiversx-sc" -version = "0.52.2" +version = "0.52.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "290e945d3d268d2b0b7cc68f3c74844d35eaa06c1b7861a18ded3726bc6e6587" +checksum = "526760b1d6236c011285b264a70a0a9dd3b3dbc53c3b5f76932f4bcfd3a8910c" dependencies = [ "bitflags", "hex-literal", @@ -102,9 +102,9 @@ dependencies = [ [[package]] name = "multiversx-sc-derive" -version = "0.52.2" +version = "0.52.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f6363ecf098fa4687ca532d621af1222890ffe97ed333e19b6b206d621c3f9d4" +checksum = "3557f2f12640a8a07fa6af66cc2a13b188c5b61bed72db22fe631fb3a60c3e96" dependencies = [ "hex", "proc-macro2", @@ -115,9 +115,9 @@ dependencies = [ [[package]] name = "multiversx-sc-wasm-adapter" -version = "0.52.2" +version = "0.52.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d3a7ef581b703ca0cef3ebc500ee2bf739c4def405ab2490e8b680a039e3408d" +checksum = "ed13aaca9cbdbc6911174cd3029e750a7563d85dd3daaa1107b1fd31c7f17245" dependencies = [ "multiversx-sc", ] diff --git a/header-verifier/wasm/Cargo.toml b/header-verifier/wasm/Cargo.toml index f429491b..15dec3f5 100644 --- a/header-verifier/wasm/Cargo.toml +++ b/header-verifier/wasm/Cargo.toml @@ -28,7 +28,7 @@ panic = "abort" path = ".." [dependencies.multiversx-sc-wasm-adapter] -version = "0.52.2" +version = "0.52.3" [workspace] members = ["."] diff --git a/pair-mock/Cargo.toml b/pair-mock/Cargo.toml index a36be0aa..e43474ba 100644 --- a/pair-mock/Cargo.toml +++ b/pair-mock/Cargo.toml @@ -9,10 +9,10 @@ publish = false path = "src/pair_mock.rs" [dependencies.multiversx-sc] -version = "0.52.2" +version = "0.52.3" [dev-dependencies] num-bigint = "0.4" [dev-dependencies.multiversx-sc-scenario] -version = "0.52.2" +version = "0.52.3" diff --git a/pair-mock/meta/Cargo.toml b/pair-mock/meta/Cargo.toml index 5e2e2e19..be84cf5b 100644 --- a/pair-mock/meta/Cargo.toml +++ b/pair-mock/meta/Cargo.toml @@ -8,5 +8,5 @@ publish = false path = ".." [dependencies.multiversx-sc-meta-lib] -version = "0.52.2" +version = "0.52.3" default-features = false diff --git a/pair-mock/wasm/Cargo.lock b/pair-mock/wasm/Cargo.lock index 859a5906..5f02efc6 100644 --- a/pair-mock/wasm/Cargo.lock +++ b/pair-mock/wasm/Cargo.lock @@ -40,9 +40,9 @@ checksum = "6fe2267d4ed49bc07b63801559be28c718ea06c4738b7a03c94df7386d2cde46" [[package]] name = "multiversx-sc" -version = "0.52.2" +version = "0.52.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "290e945d3d268d2b0b7cc68f3c74844d35eaa06c1b7861a18ded3726bc6e6587" +checksum = "526760b1d6236c011285b264a70a0a9dd3b3dbc53c3b5f76932f4bcfd3a8910c" dependencies = [ "bitflags", "hex-literal", @@ -77,9 +77,9 @@ dependencies = [ [[package]] name = "multiversx-sc-derive" -version = "0.52.2" +version = "0.52.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f6363ecf098fa4687ca532d621af1222890ffe97ed333e19b6b206d621c3f9d4" +checksum = "3557f2f12640a8a07fa6af66cc2a13b188c5b61bed72db22fe631fb3a60c3e96" dependencies = [ "hex", "proc-macro2", @@ -90,9 +90,9 @@ dependencies = [ [[package]] name = "multiversx-sc-wasm-adapter" -version = "0.52.2" +version = "0.52.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d3a7ef581b703ca0cef3ebc500ee2bf739c4def405ab2490e8b680a039e3408d" +checksum = "ed13aaca9cbdbc6911174cd3029e750a7563d85dd3daaa1107b1fd31c7f17245" dependencies = [ "multiversx-sc", ] diff --git a/pair-mock/wasm/Cargo.toml b/pair-mock/wasm/Cargo.toml index 0d2bce8f..a056c104 100644 --- a/pair-mock/wasm/Cargo.toml +++ b/pair-mock/wasm/Cargo.toml @@ -28,7 +28,7 @@ panic = "abort" path = ".." [dependencies.multiversx-sc-wasm-adapter] -version = "0.52.2" +version = "0.52.3" [workspace] members = ["."] diff --git a/router-mock/Cargo.toml b/router-mock/Cargo.toml index eafe1c29..93f9d007 100644 --- a/router-mock/Cargo.toml +++ b/router-mock/Cargo.toml @@ -9,10 +9,10 @@ publish = false path = "src/router_mock.rs" [dependencies.multiversx-sc] -version = "0.52.2" +version = "0.52.3" [dev-dependencies] num-bigint = "0.4" [dev-dependencies.multiversx-sc-scenario] -version = "0.52.2" +version = "0.52.3" diff --git a/router-mock/meta/Cargo.toml b/router-mock/meta/Cargo.toml index ab903f34..71a56756 100644 --- a/router-mock/meta/Cargo.toml +++ b/router-mock/meta/Cargo.toml @@ -8,5 +8,5 @@ publish = false path = ".." [dependencies.multiversx-sc-meta-lib] -version = "0.52.2" +version = "0.52.3" default-features = false diff --git a/router-mock/wasm/Cargo.lock b/router-mock/wasm/Cargo.lock index edbf9182..cd300e3d 100644 --- a/router-mock/wasm/Cargo.lock +++ b/router-mock/wasm/Cargo.lock @@ -40,9 +40,9 @@ checksum = "6fe2267d4ed49bc07b63801559be28c718ea06c4738b7a03c94df7386d2cde46" [[package]] name = "multiversx-sc" -version = "0.52.2" +version = "0.52.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "290e945d3d268d2b0b7cc68f3c74844d35eaa06c1b7861a18ded3726bc6e6587" +checksum = "526760b1d6236c011285b264a70a0a9dd3b3dbc53c3b5f76932f4bcfd3a8910c" dependencies = [ "bitflags", "hex-literal", @@ -77,9 +77,9 @@ dependencies = [ [[package]] name = "multiversx-sc-derive" -version = "0.52.2" +version = "0.52.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f6363ecf098fa4687ca532d621af1222890ffe97ed333e19b6b206d621c3f9d4" +checksum = "3557f2f12640a8a07fa6af66cc2a13b188c5b61bed72db22fe631fb3a60c3e96" dependencies = [ "hex", "proc-macro2", @@ -90,9 +90,9 @@ dependencies = [ [[package]] name = "multiversx-sc-wasm-adapter" -version = "0.52.2" +version = "0.52.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d3a7ef581b703ca0cef3ebc500ee2bf739c4def405ab2490e8b680a039e3408d" +checksum = "ed13aaca9cbdbc6911174cd3029e750a7563d85dd3daaa1107b1fd31c7f17245" dependencies = [ "multiversx-sc", ] diff --git a/router-mock/wasm/Cargo.toml b/router-mock/wasm/Cargo.toml index 9087a3d1..e417750e 100644 --- a/router-mock/wasm/Cargo.toml +++ b/router-mock/wasm/Cargo.toml @@ -28,7 +28,7 @@ panic = "abort" path = ".." [dependencies.multiversx-sc-wasm-adapter] -version = "0.52.2" +version = "0.52.3" [workspace] members = ["."] From 1ec2e8f473074dc3727926b50c9bc28edf361538 Mon Sep 17 00:00:00 2001 From: Andrei Baltariu Date: Tue, 6 Aug 2024 18:29:37 +0300 Subject: [PATCH 258/523] Built contracts Signed-off-by: Andrei Baltariu --- token-handler/wasm-token-handler-full/Cargo.lock | 12 ++++++------ token-handler/wasm-token-handler-view/Cargo.lock | 12 ++++++------ token-handler/wasm/Cargo.lock | 12 ++++++------ 3 files changed, 18 insertions(+), 18 deletions(-) diff --git a/token-handler/wasm-token-handler-full/Cargo.lock b/token-handler/wasm-token-handler-full/Cargo.lock index 0efac6dd..77afdc48 100644 --- a/token-handler/wasm-token-handler-full/Cargo.lock +++ b/token-handler/wasm-token-handler-full/Cargo.lock @@ -57,9 +57,9 @@ checksum = "6fe2267d4ed49bc07b63801559be28c718ea06c4738b7a03c94df7386d2cde46" [[package]] name = "multiversx-sc" -version = "0.52.2" +version = "0.52.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "290e945d3d268d2b0b7cc68f3c74844d35eaa06c1b7861a18ded3726bc6e6587" +checksum = "526760b1d6236c011285b264a70a0a9dd3b3dbc53c3b5f76932f4bcfd3a8910c" dependencies = [ "bitflags", "hex-literal", @@ -94,9 +94,9 @@ dependencies = [ [[package]] name = "multiversx-sc-derive" -version = "0.52.2" +version = "0.52.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f6363ecf098fa4687ca532d621af1222890ffe97ed333e19b6b206d621c3f9d4" +checksum = "3557f2f12640a8a07fa6af66cc2a13b188c5b61bed72db22fe631fb3a60c3e96" dependencies = [ "hex", "proc-macro2", @@ -107,9 +107,9 @@ dependencies = [ [[package]] name = "multiversx-sc-wasm-adapter" -version = "0.52.2" +version = "0.52.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d3a7ef581b703ca0cef3ebc500ee2bf739c4def405ab2490e8b680a039e3408d" +checksum = "ed13aaca9cbdbc6911174cd3029e750a7563d85dd3daaa1107b1fd31c7f17245" dependencies = [ "multiversx-sc", ] diff --git a/token-handler/wasm-token-handler-view/Cargo.lock b/token-handler/wasm-token-handler-view/Cargo.lock index 890de623..60c30acc 100644 --- a/token-handler/wasm-token-handler-view/Cargo.lock +++ b/token-handler/wasm-token-handler-view/Cargo.lock @@ -57,9 +57,9 @@ checksum = "6fe2267d4ed49bc07b63801559be28c718ea06c4738b7a03c94df7386d2cde46" [[package]] name = "multiversx-sc" -version = "0.52.2" +version = "0.52.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "290e945d3d268d2b0b7cc68f3c74844d35eaa06c1b7861a18ded3726bc6e6587" +checksum = "526760b1d6236c011285b264a70a0a9dd3b3dbc53c3b5f76932f4bcfd3a8910c" dependencies = [ "bitflags", "hex-literal", @@ -94,9 +94,9 @@ dependencies = [ [[package]] name = "multiversx-sc-derive" -version = "0.52.2" +version = "0.52.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f6363ecf098fa4687ca532d621af1222890ffe97ed333e19b6b206d621c3f9d4" +checksum = "3557f2f12640a8a07fa6af66cc2a13b188c5b61bed72db22fe631fb3a60c3e96" dependencies = [ "hex", "proc-macro2", @@ -107,9 +107,9 @@ dependencies = [ [[package]] name = "multiversx-sc-wasm-adapter" -version = "0.52.2" +version = "0.52.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d3a7ef581b703ca0cef3ebc500ee2bf739c4def405ab2490e8b680a039e3408d" +checksum = "ed13aaca9cbdbc6911174cd3029e750a7563d85dd3daaa1107b1fd31c7f17245" dependencies = [ "multiversx-sc", ] diff --git a/token-handler/wasm/Cargo.lock b/token-handler/wasm/Cargo.lock index 6a2664cd..e4aa8210 100644 --- a/token-handler/wasm/Cargo.lock +++ b/token-handler/wasm/Cargo.lock @@ -57,9 +57,9 @@ checksum = "6fe2267d4ed49bc07b63801559be28c718ea06c4738b7a03c94df7386d2cde46" [[package]] name = "multiversx-sc" -version = "0.52.2" +version = "0.52.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "290e945d3d268d2b0b7cc68f3c74844d35eaa06c1b7861a18ded3726bc6e6587" +checksum = "526760b1d6236c011285b264a70a0a9dd3b3dbc53c3b5f76932f4bcfd3a8910c" dependencies = [ "bitflags", "hex-literal", @@ -94,9 +94,9 @@ dependencies = [ [[package]] name = "multiversx-sc-derive" -version = "0.52.2" +version = "0.52.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f6363ecf098fa4687ca532d621af1222890ffe97ed333e19b6b206d621c3f9d4" +checksum = "3557f2f12640a8a07fa6af66cc2a13b188c5b61bed72db22fe631fb3a60c3e96" dependencies = [ "hex", "proc-macro2", @@ -107,9 +107,9 @@ dependencies = [ [[package]] name = "multiversx-sc-wasm-adapter" -version = "0.52.2" +version = "0.52.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d3a7ef581b703ca0cef3ebc500ee2bf739c4def405ab2490e8b680a039e3408d" +checksum = "ed13aaca9cbdbc6911174cd3029e750a7563d85dd3daaa1107b1fd31c7f17245" dependencies = [ "multiversx-sc", ] From 020aa8c757d1b8a1933b9c52edd589869d01423b Mon Sep 17 00:00:00 2001 From: Andrei Baltariu Date: Tue, 6 Aug 2024 19:13:39 +0300 Subject: [PATCH 259/523] Token Handler upgrade Signed-off-by: Andrei Baltariu --- token-handler/Cargo.toml | 4 ++-- token-handler/meta/Cargo.toml | 2 +- token-handler/wasm-token-handler-full/Cargo.toml | 2 +- token-handler/wasm-token-handler-view/Cargo.toml | 2 +- token-handler/wasm/Cargo.toml | 2 +- 5 files changed, 6 insertions(+), 6 deletions(-) diff --git a/token-handler/Cargo.toml b/token-handler/Cargo.toml index e8da8c3a..6a4c6ab8 100644 --- a/token-handler/Cargo.toml +++ b/token-handler/Cargo.toml @@ -15,10 +15,10 @@ path = "../common/transaction" path = "../header-verifier/" [dependencies.multiversx-sc] -version = "0.52.2" +version = "0.52.3" [dev-dependencies] num-bigint = "0.4" [dev-dependencies.multiversx-sc-scenario] -version = "0.52.2" +version = "0.52.3" diff --git a/token-handler/meta/Cargo.toml b/token-handler/meta/Cargo.toml index eea7da7e..a7f4f9c9 100644 --- a/token-handler/meta/Cargo.toml +++ b/token-handler/meta/Cargo.toml @@ -8,5 +8,5 @@ publish = false path = ".." [dependencies.multiversx-sc-meta-lib] -version = "0.52.2" +version = "0.52.3" default-features = false diff --git a/token-handler/wasm-token-handler-full/Cargo.toml b/token-handler/wasm-token-handler-full/Cargo.toml index 7785a5cd..6dbbb67a 100644 --- a/token-handler/wasm-token-handler-full/Cargo.toml +++ b/token-handler/wasm-token-handler-full/Cargo.toml @@ -28,7 +28,7 @@ panic = "abort" path = ".." [dependencies.multiversx-sc-wasm-adapter] -version = "0.52.2" +version = "0.52.3" [workspace] members = ["."] diff --git a/token-handler/wasm-token-handler-view/Cargo.toml b/token-handler/wasm-token-handler-view/Cargo.toml index 42c0e04e..cb8b0f66 100644 --- a/token-handler/wasm-token-handler-view/Cargo.toml +++ b/token-handler/wasm-token-handler-view/Cargo.toml @@ -28,7 +28,7 @@ panic = "abort" path = ".." [dependencies.multiversx-sc-wasm-adapter] -version = "0.52.2" +version = "0.52.3" [workspace] members = ["."] diff --git a/token-handler/wasm/Cargo.toml b/token-handler/wasm/Cargo.toml index 816582c9..c6f0f649 100644 --- a/token-handler/wasm/Cargo.toml +++ b/token-handler/wasm/Cargo.toml @@ -28,7 +28,7 @@ panic = "abort" path = ".." [dependencies.multiversx-sc-wasm-adapter] -version = "0.52.2" +version = "0.52.3" [workspace] members = ["."] From a734800753ab125d742ba91a7e98b7023508e9d6 Mon Sep 17 00:00:00 2001 From: Andrei Baltariu Date: Tue, 6 Aug 2024 20:12:04 +0300 Subject: [PATCH 260/523] Added tests for whitelisting enshrine address Signed-off-by: Andrei Baltariu --- .../tests/token_handler_blackbox_tests.rs | 57 ++++++++++++++++++- 1 file changed, 56 insertions(+), 1 deletion(-) diff --git a/token-handler/tests/token_handler_blackbox_tests.rs b/token-handler/tests/token_handler_blackbox_tests.rs index d6fb4e5b..487628d7 100644 --- a/token-handler/tests/token_handler_blackbox_tests.rs +++ b/token-handler/tests/token_handler_blackbox_tests.rs @@ -2,8 +2,8 @@ use multiversx_sc::types::{ BigUint, EsdtTokenPayment, ManagedAddress, ManagedBuffer, MultiValueEncoded, TestAddress, TestSCAddress, TestTokenIdentifier, }; -use multiversx_sc_scenario::ScenarioTxRun; use multiversx_sc_scenario::{api::StaticApi, imports::MxscPath, ScenarioWorld}; +use multiversx_sc_scenario::{ExpectError, ScenarioTxRun}; use token_handler::token_handler_proxy; use transaction::{OperationEsdtPayment, StolenFromFrameworkEsdtTokenData, TransferData}; @@ -11,6 +11,7 @@ const TOKEN_HANDLER_ADDRESS: TestSCAddress = TestSCAddress::new("token-handler") const TOKEN_HANDLER_CODE_PATH: MxscPath = MxscPath::new("output/token-handler.mxsc.json"); const OWNER_ADDRESS: TestAddress = TestAddress::new("token-handler-owner"); const USER_ADDRESS: TestAddress = TestAddress::new("user"); +const ENSRHINE_ADDRESS: TestSCAddress = TestSCAddress::new("enshrine"); const NFT_TOKEN_ID: TestTokenIdentifier = TestTokenIdentifier::new("NFT-123456"); const CROWD_TOKEN_ID: TestTokenIdentifier = TestTokenIdentifier::new("CROWD-123456"); @@ -19,6 +20,11 @@ const _PREFIX_NFT_TOKEN_ID: TestTokenIdentifier = TestTokenIdentifier::new("sov- const WEGLD_BALANCE: u128 = 100_000_000_000_000_000; +pub struct ErrorStatus<'a> { + code: u64, + message: &'a str, +} + fn world() -> ScenarioWorld { let mut blockchain = ScenarioWorld::new(); @@ -95,6 +101,33 @@ impl TokenHandlerTestState { } } + fn propose_whitelist_caller( + &mut self, + caller: TestAddress, + enshrine_address: TestSCAddress, + error: Option, + ) { + match error { + None => self + .world + .tx() + .to(TOKEN_HANDLER_ADDRESS) + .from(caller) + .typed(token_handler_proxy::TokenHandlerProxy) + .whitelist_enshrine_esdt(enshrine_address) + .run(), + Some(error_status) => self + .world + .tx() + .to(TOKEN_HANDLER_ADDRESS) + .from(caller) + .typed(token_handler_proxy::TokenHandlerProxy) + .whitelist_enshrine_esdt(enshrine_address) + .returns(ExpectError(error_status.code, error_status.message)) + .run(), + } + } + fn setup_payments( &mut self, token_ids: &Vec, @@ -123,6 +156,26 @@ fn test_deploy() { state.propose_deploy(); } +#[test] +fn test_whitelist_ensrhine_esdt_caller_not_owner() { + let mut state = TokenHandlerTestState::new(); + let error = ErrorStatus { + code: 4, + message: "Endpoint can only be called by owner", + }; + + state.propose_deploy(); + state.propose_whitelist_caller(USER_ADDRESS, ENSRHINE_ADDRESS, Some(error)); +} + +#[test] +fn test_whitelist_ensrhine() { + let mut state = TokenHandlerTestState::new(); + + state.propose_deploy(); + state.propose_whitelist_caller(OWNER_ADDRESS, ENSRHINE_ADDRESS, None); +} + #[test] fn test_transfer_tokens_no_payment() { let mut state = TokenHandlerTestState::new(); @@ -133,6 +186,8 @@ fn test_transfer_tokens_no_payment() { state.propose_deploy(); + state.propose_whitelist_caller(OWNER_ADDRESS, ENSRHINE_ADDRESS, None); + state.propose_transfer_tokens( esdt_payment, opt_transfer_data, From 2ce06843eb4abc4e167f65885613ecf818195ba8 Mon Sep 17 00:00:00 2001 From: Andrei Baltariu Date: Tue, 6 Aug 2024 20:57:04 +0300 Subject: [PATCH 261/523] Added dummy contract as Enshrine in tests Signed-off-by: Andrei Baltariu --- Cargo.lock | 1 + token-handler/Cargo.toml | 3 +++ .../tests/token_handler_blackbox_tests.rs | 20 +++++++++++++------ 3 files changed, 18 insertions(+), 6 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index ef696892..bf776448 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1066,6 +1066,7 @@ dependencies = [ "multiversx-sc", "multiversx-sc-scenario", "num-bigint", + "pair-mock", "transaction", ] diff --git a/token-handler/Cargo.toml b/token-handler/Cargo.toml index 6a4c6ab8..a991fdbe 100644 --- a/token-handler/Cargo.toml +++ b/token-handler/Cargo.toml @@ -14,6 +14,9 @@ path = "../common/transaction" [dependencies.header-verifier] path = "../header-verifier/" +[dependencies.pair-mock] +path = "../pair-mock/" + [dependencies.multiversx-sc] version = "0.52.3" diff --git a/token-handler/tests/token_handler_blackbox_tests.rs b/token-handler/tests/token_handler_blackbox_tests.rs index 487628d7..5097841f 100644 --- a/token-handler/tests/token_handler_blackbox_tests.rs +++ b/token-handler/tests/token_handler_blackbox_tests.rs @@ -10,8 +10,12 @@ use transaction::{OperationEsdtPayment, StolenFromFrameworkEsdtTokenData, Transf const TOKEN_HANDLER_ADDRESS: TestSCAddress = TestSCAddress::new("token-handler"); const TOKEN_HANDLER_CODE_PATH: MxscPath = MxscPath::new("output/token-handler.mxsc.json"); const OWNER_ADDRESS: TestAddress = TestAddress::new("token-handler-owner"); + const USER_ADDRESS: TestAddress = TestAddress::new("user"); -const ENSRHINE_ADDRESS: TestSCAddress = TestSCAddress::new("enshrine"); + +const DUMMY_ENSRHINE_ADDRESS: TestSCAddress = TestSCAddress::new("enshrine"); +const DUMMY_ENSHRINE_CODE_PATH: MxscPath = + MxscPath::new("../enshrine-esdt-safe/output/enshrine-esdt-safe.mxsc.json"); const NFT_TOKEN_ID: TestTokenIdentifier = TestTokenIdentifier::new("NFT-123456"); const CROWD_TOKEN_ID: TestTokenIdentifier = TestTokenIdentifier::new("CROWD-123456"); @@ -29,6 +33,7 @@ fn world() -> ScenarioWorld { let mut blockchain = ScenarioWorld::new(); blockchain.register_contract(TOKEN_HANDLER_CODE_PATH, token_handler::ContractBuilder); + blockchain.register_contract(DUMMY_ENSHRINE_CODE_PATH, pair_mock::ContractBuilder); blockchain } @@ -75,6 +80,7 @@ impl TokenHandlerTestState { fn propose_transfer_tokens( &mut self, + caller: TestSCAddress, esdt_payment: Option>, opt_transfer_data: Option>, to: ManagedAddress, @@ -84,7 +90,7 @@ impl TokenHandlerTestState { Option::Some(payment) => self .world .tx() - .from(OWNER_ADDRESS) + .from(caller) .to(TOKEN_HANDLER_ADDRESS) .typed(token_handler_proxy::TokenHandlerProxy) .transfer_tokens(opt_transfer_data, to, tokens) @@ -93,7 +99,7 @@ impl TokenHandlerTestState { Option::None => self .world .tx() - .from(OWNER_ADDRESS) + .from(caller) .to(TOKEN_HANDLER_ADDRESS) .typed(token_handler_proxy::TokenHandlerProxy) .transfer_tokens(opt_transfer_data, to, tokens) @@ -165,7 +171,7 @@ fn test_whitelist_ensrhine_esdt_caller_not_owner() { }; state.propose_deploy(); - state.propose_whitelist_caller(USER_ADDRESS, ENSRHINE_ADDRESS, Some(error)); + state.propose_whitelist_caller(USER_ADDRESS, DUMMY_ENSRHINE_ADDRESS, Some(error)); } #[test] @@ -173,7 +179,7 @@ fn test_whitelist_ensrhine() { let mut state = TokenHandlerTestState::new(); state.propose_deploy(); - state.propose_whitelist_caller(OWNER_ADDRESS, ENSRHINE_ADDRESS, None); + state.propose_whitelist_caller(OWNER_ADDRESS, DUMMY_ENSRHINE_ADDRESS, None); } #[test] @@ -186,9 +192,10 @@ fn test_transfer_tokens_no_payment() { state.propose_deploy(); - state.propose_whitelist_caller(OWNER_ADDRESS, ENSRHINE_ADDRESS, None); + state.propose_whitelist_caller(OWNER_ADDRESS, DUMMY_ENSRHINE_ADDRESS, None); state.propose_transfer_tokens( + DUMMY_ENSRHINE_ADDRESS, esdt_payment, opt_transfer_data, USER_ADDRESS.to_managed_address(), @@ -216,6 +223,7 @@ fn test_transfer_tokens_fungible_payment() { state.propose_deploy(); state.propose_transfer_tokens( + DUMMY_ENSRHINE_ADDRESS, esdt_payment, opt_transfer_data, USER_ADDRESS.to_managed_address(), From 9d1eb1d29119c1a684f65994db2f090ddf2ee436 Mon Sep 17 00:00:00 2001 From: Andrei Baltariu Date: Tue, 6 Aug 2024 21:04:51 +0300 Subject: [PATCH 262/523] Added new function and fixed failing enshrine tests Signed-off-by: Andrei Baltariu --- common/transaction/src/lib.rs | 14 ++++++++++++++ .../tests/enshrine_esdt_safe_blackbox_test.rs | 3 +-- 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/common/transaction/src/lib.rs b/common/transaction/src/lib.rs index 8ff53ae0..f6d88c65 100644 --- a/common/transaction/src/lib.rs +++ b/common/transaction/src/lib.rs @@ -108,6 +108,20 @@ pub struct OperationEsdtPayment { pub token_data: StolenFromFrameworkEsdtTokenData, } +impl OperationEsdtPayment { + pub fn new( + token_identifier: TokenIdentifier, + token_nonce: u64, + token_data: StolenFromFrameworkEsdtTokenData, + ) -> Self { + OperationEsdtPayment { + token_identifier, + token_nonce, + token_data, + } + } +} + impl From> for OperationEsdtPayment { fn from(payment: EsdtTokenPayment) -> Self { payment.into() diff --git a/enshrine-esdt-safe/tests/enshrine_esdt_safe_blackbox_test.rs b/enshrine-esdt-safe/tests/enshrine_esdt_safe_blackbox_test.rs index dc022efd..9f87f6c9 100644 --- a/enshrine-esdt-safe/tests/enshrine_esdt_safe_blackbox_test.rs +++ b/enshrine-esdt-safe/tests/enshrine_esdt_safe_blackbox_test.rs @@ -1,7 +1,6 @@ use bls_signature::BlsSignature; use enshrine_esdt_safe::enshrine_esdt_safe_proxy; use header_verifier::header_verifier_proxy; -use multiversx_sc::api::StaticVarApi; use multiversx_sc::codec::TopEncode; use multiversx_sc::types::{ Address, BigUint, EsdtTokenPayment, ManagedBuffer, ManagedByteArray, ManagedVec, @@ -166,7 +165,7 @@ impl EnshrineTestState { .tx() .from(ENSHRINE_ESDT_OWNER_ADDRESS) .typed(token_handler_proxy::TokenHandlerProxy) - .init(SOVEREIGN_TOKEN_PREFIX) + .init() .code(TOKEN_HANDLER_CODE_PATH) .new_address(TOKEN_HANDLER_ADDRESS) .run(); From 2ac2be067094f720aec6b213f3e21c46763f70c9 Mon Sep 17 00:00:00 2001 From: Andrei Baltariu Date: Tue, 6 Aug 2024 21:08:25 +0300 Subject: [PATCH 263/523] Built contracts Signed-off-by: Andrei Baltariu --- .../wasm-enshrine-esdt-safe-full/Cargo.lock | 1 + .../wasm-enshrine-esdt-safe-view/Cargo.lock | 1 + enshrine-esdt-safe/wasm/Cargo.lock | 1 + token-handler/wasm-token-handler-full/Cargo.lock | 8 ++++++++ token-handler/wasm-token-handler-view/Cargo.lock | 8 ++++++++ token-handler/wasm/Cargo.lock | 8 ++++++++ 6 files changed, 27 insertions(+) diff --git a/enshrine-esdt-safe/wasm-enshrine-esdt-safe-full/Cargo.lock b/enshrine-esdt-safe/wasm-enshrine-esdt-safe-full/Cargo.lock index 92bab5a1..fe9cbb64 100644 --- a/enshrine-esdt-safe/wasm-enshrine-esdt-safe-full/Cargo.lock +++ b/enshrine-esdt-safe/wasm-enshrine-esdt-safe-full/Cargo.lock @@ -258,6 +258,7 @@ version = "0.0.0" dependencies = [ "header-verifier", "multiversx-sc", + "pair-mock", "transaction", ] diff --git a/enshrine-esdt-safe/wasm-enshrine-esdt-safe-view/Cargo.lock b/enshrine-esdt-safe/wasm-enshrine-esdt-safe-view/Cargo.lock index 62501227..8467465c 100644 --- a/enshrine-esdt-safe/wasm-enshrine-esdt-safe-view/Cargo.lock +++ b/enshrine-esdt-safe/wasm-enshrine-esdt-safe-view/Cargo.lock @@ -258,6 +258,7 @@ version = "0.0.0" dependencies = [ "header-verifier", "multiversx-sc", + "pair-mock", "transaction", ] diff --git a/enshrine-esdt-safe/wasm/Cargo.lock b/enshrine-esdt-safe/wasm/Cargo.lock index a33e1d14..5f02eee1 100644 --- a/enshrine-esdt-safe/wasm/Cargo.lock +++ b/enshrine-esdt-safe/wasm/Cargo.lock @@ -258,6 +258,7 @@ version = "0.0.0" dependencies = [ "header-verifier", "multiversx-sc", + "pair-mock", "transaction", ] diff --git a/token-handler/wasm-token-handler-full/Cargo.lock b/token-handler/wasm-token-handler-full/Cargo.lock index 77afdc48..98fc8e7f 100644 --- a/token-handler/wasm-token-handler-full/Cargo.lock +++ b/token-handler/wasm-token-handler-full/Cargo.lock @@ -132,6 +132,13 @@ dependencies = [ "autocfg", ] +[[package]] +name = "pair-mock" +version = "0.0.0" +dependencies = [ + "multiversx-sc", +] + [[package]] name = "proc-macro2" version = "1.0.86" @@ -183,6 +190,7 @@ version = "0.0.0" dependencies = [ "header-verifier", "multiversx-sc", + "pair-mock", "transaction", ] diff --git a/token-handler/wasm-token-handler-view/Cargo.lock b/token-handler/wasm-token-handler-view/Cargo.lock index 60c30acc..22e2fb93 100644 --- a/token-handler/wasm-token-handler-view/Cargo.lock +++ b/token-handler/wasm-token-handler-view/Cargo.lock @@ -132,6 +132,13 @@ dependencies = [ "autocfg", ] +[[package]] +name = "pair-mock" +version = "0.0.0" +dependencies = [ + "multiversx-sc", +] + [[package]] name = "proc-macro2" version = "1.0.86" @@ -183,6 +190,7 @@ version = "0.0.0" dependencies = [ "header-verifier", "multiversx-sc", + "pair-mock", "transaction", ] diff --git a/token-handler/wasm/Cargo.lock b/token-handler/wasm/Cargo.lock index e4aa8210..b5f395be 100644 --- a/token-handler/wasm/Cargo.lock +++ b/token-handler/wasm/Cargo.lock @@ -132,6 +132,13 @@ dependencies = [ "autocfg", ] +[[package]] +name = "pair-mock" +version = "0.0.0" +dependencies = [ + "multiversx-sc", +] + [[package]] name = "proc-macro2" version = "1.0.86" @@ -183,6 +190,7 @@ version = "0.0.0" dependencies = [ "header-verifier", "multiversx-sc", + "pair-mock", "transaction", ] From b2fb05ee7afad43757f63b779bf6e2986bfa4d51 Mon Sep 17 00:00:00 2001 From: Andrei Baltariu Date: Tue, 6 Aug 2024 23:28:25 +0300 Subject: [PATCH 264/523] Added dummy enshrine and tests for it Signed-off-by: Andrei Baltariu --- pair-mock/sc-config.toml | 22 +++++ pair-mock/src/pair_mock_proxy.rs | 87 +++++++++++++++++++ pair-mock/wasm-pair-mock-full/Cargo.toml | 34 ++++++++ pair-mock/wasm-pair-mock-full/src/lib.rs | 25 ++++++ pair-mock/wasm-pair-mock-view/Cargo.toml | 34 ++++++++ pair-mock/wasm-pair-mock-view/src/lib.rs | 25 ++++++ token-handler/src/dummy_enshrine_proxy.rs | 87 +++++++++++++++++++ token-handler/src/lib.rs | 1 + .../tests/token_handler_blackbox_tests.rs | 47 ++++++++-- 9 files changed, 353 insertions(+), 9 deletions(-) create mode 100644 pair-mock/sc-config.toml create mode 100644 pair-mock/src/pair_mock_proxy.rs create mode 100644 pair-mock/wasm-pair-mock-full/Cargo.toml create mode 100644 pair-mock/wasm-pair-mock-full/src/lib.rs create mode 100644 pair-mock/wasm-pair-mock-view/Cargo.toml create mode 100644 pair-mock/wasm-pair-mock-view/src/lib.rs create mode 100644 token-handler/src/dummy_enshrine_proxy.rs diff --git a/pair-mock/sc-config.toml b/pair-mock/sc-config.toml new file mode 100644 index 00000000..9fcdabe3 --- /dev/null +++ b/pair-mock/sc-config.toml @@ -0,0 +1,22 @@ +[settings] +main = "main" + +[contracts.main] +name = "pair-mock" + +[contracts.full] +name = "pair-mock-full" +add-unlabelled = true +add-labels = ["pair-mock-external-view"] + +[contracts.view] +name = "pair-mock-view" +external-view = true +add-unlabelled = false +add-labels = ["pair-mock-external-view"] + +[[proxy]] +path = "src/pair_mock_proxy.rs" + +[[proxy]] +path = "../token-handler/src/dummy_enshrine_proxy.rs" diff --git a/pair-mock/src/pair_mock_proxy.rs b/pair-mock/src/pair_mock_proxy.rs new file mode 100644 index 00000000..c51cfd2c --- /dev/null +++ b/pair-mock/src/pair_mock_proxy.rs @@ -0,0 +1,87 @@ +// Code generated by the multiversx-sc proxy generator. DO NOT EDIT. + +//////////////////////////////////////////////////// +////////////////// AUTO-GENERATED ////////////////// +//////////////////////////////////////////////////// + +#![allow(dead_code)] +#![allow(clippy::all)] + +use multiversx_sc::proxy_imports::*; + +pub struct PairMockProxy; + +impl TxProxyTrait for PairMockProxy +where + Env: TxEnv, + From: TxFrom, + To: TxTo, + Gas: TxGas, +{ + type TxProxyMethods = PairMockProxyMethods; + + fn proxy_methods(self, tx: Tx) -> Self::TxProxyMethods { + PairMockProxyMethods { wrapped_tx: tx } + } +} + +pub struct PairMockProxyMethods +where + Env: TxEnv, + From: TxFrom, + To: TxTo, + Gas: TxGas, +{ + wrapped_tx: Tx, +} + +#[rustfmt::skip] +impl PairMockProxyMethods +where + Env: TxEnv, + Env::Api: VMApi, + From: TxFrom, + Gas: TxGas, +{ + pub fn init< + Arg0: ProxyArg>, + >( + self, + usdc_token_id: Arg0, + ) -> TxTypedDeploy { + self.wrapped_tx + .payment(NotPayable) + .raw_deploy() + .argument(&usdc_token_id) + .original_result() + } +} + +#[rustfmt::skip] +impl PairMockProxyMethods +where + Env: TxEnv, + Env::Api: VMApi, + From: TxFrom, + To: TxTo, + Gas: TxGas, +{ + pub fn get_safe_price_by_timestamp_offset< + Arg0: ProxyArg>, + Arg1: ProxyArg, + Arg2: ProxyArg>, + >( + self, + _pair_address: Arg0, + _timestamp_offset: Arg1, + input_payment: Arg2, + ) -> TxTypedCall> { + self.wrapped_tx + .payment(NotPayable) + .raw_call("getSafePriceByTimestampOffset") + .argument(&_pair_address) + .argument(&_timestamp_offset) + .argument(&input_payment) + .original_result() + } +} diff --git a/pair-mock/wasm-pair-mock-full/Cargo.toml b/pair-mock/wasm-pair-mock-full/Cargo.toml new file mode 100644 index 00000000..60c80e18 --- /dev/null +++ b/pair-mock/wasm-pair-mock-full/Cargo.toml @@ -0,0 +1,34 @@ +# Code generated by the multiversx-sc build system. DO NOT EDIT. + +# ########################################## +# ############## AUTO-GENERATED ############# +# ########################################## + +[package] +name = "pair-mock-full-wasm" +version = "0.0.0" +edition = "2021" +publish = false + +[lib] +crate-type = ["cdylib"] + +[profile.release] +codegen-units = 1 +opt-level = "z" +lto = true +debug = false +panic = "abort" +overflow-checks = false + +[profile.dev] +panic = "abort" + +[dependencies.pair-mock] +path = ".." + +[dependencies.multiversx-sc-wasm-adapter] +version = "0.52.3" + +[workspace] +members = ["."] diff --git a/pair-mock/wasm-pair-mock-full/src/lib.rs b/pair-mock/wasm-pair-mock-full/src/lib.rs new file mode 100644 index 00000000..e87dd4d4 --- /dev/null +++ b/pair-mock/wasm-pair-mock-full/src/lib.rs @@ -0,0 +1,25 @@ +// Code generated by the multiversx-sc build system. DO NOT EDIT. + +//////////////////////////////////////////////////// +////////////////// AUTO-GENERATED ////////////////// +//////////////////////////////////////////////////// + +// Init: 1 +// Endpoints: 1 +// Async Callback (empty): 1 +// Total number of exported functions: 3 + +#![no_std] + +multiversx_sc_wasm_adapter::allocator!(); +multiversx_sc_wasm_adapter::panic_handler!(); + +multiversx_sc_wasm_adapter::endpoints! { + pair_mock + ( + init => init + getSafePriceByTimestampOffset => get_safe_price_by_timestamp_offset + ) +} + +multiversx_sc_wasm_adapter::async_callback_empty! {} diff --git a/pair-mock/wasm-pair-mock-view/Cargo.toml b/pair-mock/wasm-pair-mock-view/Cargo.toml new file mode 100644 index 00000000..224b5dc7 --- /dev/null +++ b/pair-mock/wasm-pair-mock-view/Cargo.toml @@ -0,0 +1,34 @@ +# Code generated by the multiversx-sc build system. DO NOT EDIT. + +# ########################################## +# ############## AUTO-GENERATED ############# +# ########################################## + +[package] +name = "pair-mock-view-wasm" +version = "0.0.0" +edition = "2021" +publish = false + +[lib] +crate-type = ["cdylib"] + +[profile.release] +codegen-units = 1 +opt-level = "z" +lto = true +debug = false +panic = "abort" +overflow-checks = false + +[profile.dev] +panic = "abort" + +[dependencies.pair-mock] +path = ".." + +[dependencies.multiversx-sc-wasm-adapter] +version = "0.52.3" + +[workspace] +members = ["."] diff --git a/pair-mock/wasm-pair-mock-view/src/lib.rs b/pair-mock/wasm-pair-mock-view/src/lib.rs new file mode 100644 index 00000000..5b9e4edc --- /dev/null +++ b/pair-mock/wasm-pair-mock-view/src/lib.rs @@ -0,0 +1,25 @@ +// Code generated by the multiversx-sc build system. DO NOT EDIT. + +//////////////////////////////////////////////////// +////////////////// AUTO-GENERATED ////////////////// +//////////////////////////////////////////////////// + +// Init: 1 +// Endpoints: 0 +// Async Callback (empty): 1 +// Total number of exported functions: 2 + +#![no_std] + +multiversx_sc_wasm_adapter::allocator!(); +multiversx_sc_wasm_adapter::panic_handler!(); + +multiversx_sc_wasm_adapter::external_view_init! {} + +multiversx_sc_wasm_adapter::external_view_endpoints! { + pair_mock + ( + ) +} + +multiversx_sc_wasm_adapter::async_callback_empty! {} diff --git a/token-handler/src/dummy_enshrine_proxy.rs b/token-handler/src/dummy_enshrine_proxy.rs new file mode 100644 index 00000000..c51cfd2c --- /dev/null +++ b/token-handler/src/dummy_enshrine_proxy.rs @@ -0,0 +1,87 @@ +// Code generated by the multiversx-sc proxy generator. DO NOT EDIT. + +//////////////////////////////////////////////////// +////////////////// AUTO-GENERATED ////////////////// +//////////////////////////////////////////////////// + +#![allow(dead_code)] +#![allow(clippy::all)] + +use multiversx_sc::proxy_imports::*; + +pub struct PairMockProxy; + +impl TxProxyTrait for PairMockProxy +where + Env: TxEnv, + From: TxFrom, + To: TxTo, + Gas: TxGas, +{ + type TxProxyMethods = PairMockProxyMethods; + + fn proxy_methods(self, tx: Tx) -> Self::TxProxyMethods { + PairMockProxyMethods { wrapped_tx: tx } + } +} + +pub struct PairMockProxyMethods +where + Env: TxEnv, + From: TxFrom, + To: TxTo, + Gas: TxGas, +{ + wrapped_tx: Tx, +} + +#[rustfmt::skip] +impl PairMockProxyMethods +where + Env: TxEnv, + Env::Api: VMApi, + From: TxFrom, + Gas: TxGas, +{ + pub fn init< + Arg0: ProxyArg>, + >( + self, + usdc_token_id: Arg0, + ) -> TxTypedDeploy { + self.wrapped_tx + .payment(NotPayable) + .raw_deploy() + .argument(&usdc_token_id) + .original_result() + } +} + +#[rustfmt::skip] +impl PairMockProxyMethods +where + Env: TxEnv, + Env::Api: VMApi, + From: TxFrom, + To: TxTo, + Gas: TxGas, +{ + pub fn get_safe_price_by_timestamp_offset< + Arg0: ProxyArg>, + Arg1: ProxyArg, + Arg2: ProxyArg>, + >( + self, + _pair_address: Arg0, + _timestamp_offset: Arg1, + input_payment: Arg2, + ) -> TxTypedCall> { + self.wrapped_tx + .payment(NotPayable) + .raw_call("getSafePriceByTimestampOffset") + .argument(&_pair_address) + .argument(&_timestamp_offset) + .argument(&input_payment) + .original_result() + } +} diff --git a/token-handler/src/lib.rs b/token-handler/src/lib.rs index abbd8b3b..4dc06dfb 100644 --- a/token-handler/src/lib.rs +++ b/token-handler/src/lib.rs @@ -4,6 +4,7 @@ use multiversx_sc::imports::*; pub mod common_storage; +pub mod dummy_enshrine_proxy; pub mod token_handler_proxy; pub mod transfer_tokens; diff --git a/token-handler/tests/token_handler_blackbox_tests.rs b/token-handler/tests/token_handler_blackbox_tests.rs index 5097841f..0ec6cba3 100644 --- a/token-handler/tests/token_handler_blackbox_tests.rs +++ b/token-handler/tests/token_handler_blackbox_tests.rs @@ -4,7 +4,7 @@ use multiversx_sc::types::{ }; use multiversx_sc_scenario::{api::StaticApi, imports::MxscPath, ScenarioWorld}; use multiversx_sc_scenario::{ExpectError, ScenarioTxRun}; -use token_handler::token_handler_proxy; +use token_handler::{dummy_enshrine_proxy, token_handler_proxy}; use transaction::{OperationEsdtPayment, StolenFromFrameworkEsdtTokenData, TransferData}; const TOKEN_HANDLER_ADDRESS: TestSCAddress = TestSCAddress::new("token-handler"); @@ -14,8 +14,7 @@ const OWNER_ADDRESS: TestAddress = TestAddress::new("token-handler-owner"); const USER_ADDRESS: TestAddress = TestAddress::new("user"); const DUMMY_ENSRHINE_ADDRESS: TestSCAddress = TestSCAddress::new("enshrine"); -const DUMMY_ENSHRINE_CODE_PATH: MxscPath = - MxscPath::new("../enshrine-esdt-safe/output/enshrine-esdt-safe.mxsc.json"); +const DUMMY_ENSHRINE_CODE_PATH: MxscPath = MxscPath::new("../pair-mock/output/pair-mock.mxsc.json"); const NFT_TOKEN_ID: TestTokenIdentifier = TestTokenIdentifier::new("NFT-123456"); const CROWD_TOKEN_ID: TestTokenIdentifier = TestTokenIdentifier::new("CROWD-123456"); @@ -65,7 +64,7 @@ impl TokenHandlerTestState { Self { world } } - fn propose_deploy(&mut self) -> &mut Self { + fn propose_deploy_token_handler(&mut self) -> &mut Self { self.world .tx() .from(OWNER_ADDRESS) @@ -78,6 +77,19 @@ impl TokenHandlerTestState { self } + fn propose_deploy_dummy_enshrine(&mut self) -> &mut Self { + self.world + .tx() + .from(OWNER_ADDRESS) + .typed(dummy_enshrine_proxy::PairMockProxy) + .init(NFT_TOKEN_ID) + .code(DUMMY_ENSHRINE_CODE_PATH) + .new_address(DUMMY_ENSRHINE_ADDRESS) + .run(); + + self + } + fn propose_transfer_tokens( &mut self, caller: TestSCAddress, @@ -159,7 +171,8 @@ impl TokenHandlerTestState { fn test_deploy() { let mut state = TokenHandlerTestState::new(); - state.propose_deploy(); + state.propose_deploy_token_handler(); + state.propose_deploy_dummy_enshrine(); } #[test] @@ -170,7 +183,7 @@ fn test_whitelist_ensrhine_esdt_caller_not_owner() { message: "Endpoint can only be called by owner", }; - state.propose_deploy(); + state.propose_deploy_token_handler(); state.propose_whitelist_caller(USER_ADDRESS, DUMMY_ENSRHINE_ADDRESS, Some(error)); } @@ -178,7 +191,7 @@ fn test_whitelist_ensrhine_esdt_caller_not_owner() { fn test_whitelist_ensrhine() { let mut state = TokenHandlerTestState::new(); - state.propose_deploy(); + state.propose_deploy_token_handler(); state.propose_whitelist_caller(OWNER_ADDRESS, DUMMY_ENSRHINE_ADDRESS, None); } @@ -190,7 +203,15 @@ fn test_transfer_tokens_no_payment() { let esdt_payment = Option::None; let opt_transfer_data = Option::None; - state.propose_deploy(); + state.propose_deploy_token_handler(); + state.propose_deploy_dummy_enshrine(); + + state + .world + .set_esdt_balance(DUMMY_ENSRHINE_ADDRESS, b"NFT_TOKEN_ID", 100); + state + .world + .set_esdt_balance(DUMMY_ENSRHINE_ADDRESS, b"FUNGIBLE_TOKEN_ID", 100); state.propose_whitelist_caller(OWNER_ADDRESS, DUMMY_ENSRHINE_ADDRESS, None); @@ -220,7 +241,15 @@ fn test_transfer_tokens_fungible_payment() { }); let opt_transfer_data = Option::None; - state.propose_deploy(); + state.propose_deploy_token_handler(); + state.propose_deploy_dummy_enshrine(); + + state + .world + .set_esdt_balance(DUMMY_ENSRHINE_ADDRESS, b"NFT_TOKEN_ID", 100); + state + .world + .set_esdt_balance(DUMMY_ENSRHINE_ADDRESS, b"FUNGIBLE_TOKEN_ID", 200); state.propose_transfer_tokens( DUMMY_ENSRHINE_ADDRESS, From 90f31511edab113dc2c4ea88101c32294576df74 Mon Sep 17 00:00:00 2001 From: Dorin Marian Iancu Date: Wed, 7 Aug 2024 11:33:19 +0300 Subject: [PATCH 265/523] code changes --- common/transaction/src/lib.rs | 111 ++++++------------ common/utils/src/lib.rs | 2 +- .../src/enshrine_esdt_safe_proxy.rs | 6 +- .../src/from_sovereign/transfer_tokens.rs | 69 ++++++----- .../src/to_sovereign/create_tx.rs | 49 ++++---- .../tests/enshrine_esdt_safe_blackbox_test.rs | 16 +-- esdt-safe/src/esdt_safe_proxy.rs | 6 +- esdt-safe/src/from_sovereign/token_mapping.rs | 95 ++++++++------- .../src/from_sovereign/transfer_tokens.rs | 4 +- esdt-safe/tests/bridge_blackbox_tests.rs | 9 +- fee-market/src/subtract_fee.rs | 3 +- header-verifier/src/lib.rs | 5 +- token-handler/src/common_storage.rs | 1 - token-handler/src/transfer_tokens.rs | 5 +- .../tests/token_handler_scenario_rs_test.rs | 5 +- 15 files changed, 178 insertions(+), 208 deletions(-) diff --git a/common/transaction/src/lib.rs b/common/transaction/src/lib.rs index 8ff53ae0..d8822282 100644 --- a/common/transaction/src/lib.rs +++ b/common/transaction/src/lib.rs @@ -22,7 +22,7 @@ pub type TxAsMultiValue = MultiValue7< SenderAddress, ReceiverAddress, ManagedVec>, - ManagedVec>, + ManagedVec>, Option>, >; pub type PaymentsVec = ManagedVec>; @@ -36,6 +36,7 @@ pub struct Operation { } impl Operation { + #[inline] pub fn new( to: ManagedAddress, tokens: ManagedVec>, @@ -44,20 +45,23 @@ impl Operation { Operation { to, tokens, data } } - pub fn get_tokens_as_tuple_arr( + pub fn get_tokens_as_multi_value_encoded( &self, ) -> MultiValueEncoded, u64, EsdtTokenData>> { - let mut tuple_arr = MultiValueEncoded::new(); + let mut tuples = MultiValueEncoded::new(); for token in &self.tokens { - tuple_arr.push(MultiValue3::from(( - token.token_identifier, - token.token_nonce, - token.token_data.into(), - ))); + tuples.push( + ( + token.token_identifier, + token.token_nonce, + token.token_data.into(), + ) + .into(), + ); } - tuple_arr + tuples } } @@ -76,6 +80,7 @@ pub struct OperationData { } impl OperationData { + #[inline] pub fn new( op_nonce: TxId, op_sender: ManagedAddress, @@ -96,6 +101,7 @@ pub struct OperationTuple { } impl OperationTuple { + #[inline] pub fn new(op_hash: ManagedBuffer, operation: Operation) -> Self { OperationTuple { op_hash, operation } } @@ -105,16 +111,33 @@ impl OperationTuple { pub struct OperationEsdtPayment { pub token_identifier: TokenIdentifier, pub token_nonce: u64, - pub token_data: StolenFromFrameworkEsdtTokenData, + pub token_data: EsdtTokenData, +} + +impl OperationEsdtPayment { + #[inline] + pub fn new( + token_identifier: TokenIdentifier, + token_nonce: u64, + token_data: EsdtTokenData, + ) -> Self { + Self { + token_identifier, + token_nonce, + token_data, + } + } } impl From> for OperationEsdtPayment { + #[inline] fn from(payment: EsdtTokenPayment) -> Self { payment.into() } } impl From> for EsdtTokenPayment { + #[inline] fn from(payment: OperationEsdtPayment) -> Self { EsdtTokenPayment { token_identifier: payment.token_identifier, @@ -129,71 +152,7 @@ impl Default for OperationEsdtPayment { OperationEsdtPayment { token_identifier: TokenIdentifier::from(ManagedBuffer::new()), token_nonce: 0, - token_data: StolenFromFrameworkEsdtTokenData::default(), - } - } -} - -// Temporary until Clone is implemented for EsdtTokenData -#[derive( - TopDecode, TopEncode, NestedDecode, NestedEncode, TypeAbi, Debug, ManagedVecItem, Clone, -)] -pub struct StolenFromFrameworkEsdtTokenData { - pub token_type: EsdtTokenType, - pub amount: BigUint, - pub frozen: bool, - pub hash: ManagedBuffer, - pub name: ManagedBuffer, - pub attributes: ManagedBuffer, - pub creator: ManagedAddress, - pub royalties: BigUint, - pub uris: ManagedVec>, -} - -impl Default for StolenFromFrameworkEsdtTokenData { - fn default() -> Self { - StolenFromFrameworkEsdtTokenData { - token_type: EsdtTokenType::Fungible, - amount: BigUint::zero(), - frozen: false, - hash: ManagedBuffer::new(), - name: ManagedBuffer::new(), - attributes: ManagedBuffer::new(), - creator: ManagedAddress::zero(), - royalties: BigUint::zero(), - uris: ManagedVec::new(), - } - } -} - -impl From> for StolenFromFrameworkEsdtTokenData { - fn from(value: EsdtTokenData) -> Self { - StolenFromFrameworkEsdtTokenData { - token_type: value.token_type, - amount: value.amount, - frozen: value.frozen, - hash: value.hash, - name: value.name, - attributes: value.attributes, - creator: value.creator, - royalties: value.royalties, - uris: value.uris, - } - } -} - -impl From> for EsdtTokenData { - fn from(token_data: StolenFromFrameworkEsdtTokenData) -> Self { - EsdtTokenData { - token_type: token_data.token_type, - amount: token_data.amount, - frozen: token_data.frozen, - hash: token_data.hash, - name: token_data.name, - attributes: token_data.attributes, - creator: token_data.creator, - royalties: token_data.royalties, - uris: token_data.uris, + token_data: EsdtTokenData::default(), } } } @@ -205,7 +164,7 @@ pub struct Transaction { pub from: ManagedAddress, pub to: ManagedAddress, pub tokens: ManagedVec>, - pub token_data: ManagedVec>, + pub token_data: ManagedVec>, pub opt_transfer_data: Option>, pub is_refund_tx: bool, } diff --git a/common/utils/src/lib.rs b/common/utils/src/lib.rs index 501e3ea2..41808895 100644 --- a/common/utils/src/lib.rs +++ b/common/utils/src/lib.rs @@ -65,7 +65,7 @@ pub trait UtilsModule { // // list // } - // + fn has_prefix(&self, token_id: &TokenIdentifier) -> bool { let buffer = token_id.as_managed_buffer(); let mut array_buffer = [0u8; MAX_TOKEN_ID_LEN]; diff --git a/enshrine-esdt-safe/src/enshrine_esdt_safe_proxy.rs b/enshrine-esdt-safe/src/enshrine_esdt_safe_proxy.rs index cb57fb68..981c5d9d 100644 --- a/enshrine-esdt-safe/src/enshrine_esdt_safe_proxy.rs +++ b/enshrine-esdt-safe/src/enshrine_esdt_safe_proxy.rs @@ -230,7 +230,7 @@ where pub fn get_current_tx_batch( self, - ) -> TxTypedCall, ManagedAddress, ManagedVec>, ManagedVec>, Option>>>>>> { + ) -> TxTypedCall, ManagedAddress, ManagedVec>, ManagedVec>, Option>>>>>> { self.wrapped_tx .payment(NotPayable) .raw_call("getCurrentTxBatch") @@ -239,7 +239,7 @@ where pub fn get_first_batch_any_status( self, - ) -> TxTypedCall, ManagedAddress, ManagedVec>, ManagedVec>, Option>>>>>> { + ) -> TxTypedCall, ManagedAddress, ManagedVec>, ManagedVec>, Option>>>>>> { self.wrapped_tx .payment(NotPayable) .raw_call("getFirstBatchAnyStatus") @@ -251,7 +251,7 @@ where >( self, batch_id: Arg0, - ) -> TxTypedCall, ManagedAddress, ManagedVec>, ManagedVec>, Option>>>>>> { + ) -> TxTypedCall, ManagedAddress, ManagedVec>, ManagedVec>, Option>>>>>> { self.wrapped_tx .payment(NotPayable) .raw_call("getBatch") diff --git a/enshrine-esdt-safe/src/from_sovereign/transfer_tokens.rs b/enshrine-esdt-safe/src/from_sovereign/transfer_tokens.rs index 74d4d720..65ebe30b 100644 --- a/enshrine-esdt-safe/src/from_sovereign/transfer_tokens.rs +++ b/enshrine-esdt-safe/src/from_sovereign/transfer_tokens.rs @@ -1,10 +1,26 @@ use crate::{common, to_sovereign, token_handler_proxy}; use header_verifier::header_verifier_proxy; use multiversx_sc::imports::*; -use multiversx_sc::storage::StorageKey; use transaction::{Operation, OperationData, OperationEsdtPayment, OperationTuple}; -const DEFAULT_ISSUE_COST: u64 = 50000000000000000; +const DEFAULT_ISSUE_COST: u64 = 50_000_000_000_000_000; // 0.05 * 10^18 + +struct SplitResult { + sov_tokens: ManagedVec>, + non_sov_tokens: ManagedVec>, + are_tokens_registered: bool, +} + +impl Default for SplitResult { + #[inline] + fn default() -> Self { + Self { + sov_tokens: ManagedVec::new(), + non_sov_tokens: ManagedVec::new(), + are_tokens_registered: false, + } + } +} #[multiversx_sc::module] pub trait TransferTokensModule: @@ -21,24 +37,19 @@ pub trait TransferTokensModule: #[endpoint(executeBridgeOps)] fn execute_operations(&self, hash_of_hashes: ManagedBuffer, operation: Operation) { let is_sovereign_chain = self.is_sovereign_chain().get(); - require!( !is_sovereign_chain, "Invalid method to call in current chain" ); - require!(self.not_paused(), "Cannot transfer while paused"); let (op_hash, is_registered) = self.calculate_operation_hash(&hash_of_hashes, &operation); - if !is_registered { sc_panic!("Operation is not registered"); } - let (sov_tokens, non_sov_tokens, are_tokens_registered) = - self.split_payments_for_prefix_and_fee(&operation.tokens); - - if !are_tokens_registered { + let split_result = self.split_payments_for_prefix_and_fee(&operation.tokens); + if !split_result.are_tokens_registered { self.emit_transfer_failed_events( &hash_of_hashes, &OperationTuple::new(op_hash, operation), @@ -49,7 +60,7 @@ pub trait TransferTokensModule: let token_handler_address = self.token_handler_address().get(); let multi_value_tokens: MultiValueEncoded> = - non_sov_tokens.into(); + split_result.non_sov_tokens.into(); self.tx() .to(token_handler_address) @@ -60,7 +71,7 @@ pub trait TransferTokensModule: // operation.data.opt_sender multi_value_tokens, ) - .multi_esdt(sov_tokens) + .multi_esdt(split_result.sov_tokens) .sync_call(); self.remove_executed_hash(&hash_of_hashes, &op_hash); @@ -72,12 +83,10 @@ pub trait TransferTokensModule: fn register_new_token_id(&self, tokens: MultiValueEncoded) { let call_payment = self.call_value().single_esdt().clone(); let wegld_identifier = self.wegld_identifier().get(); - require!( call_payment.token_identifier == wegld_identifier, "WEGLD is the only token accepted as register fee" ); - require!( call_payment.amount == DEFAULT_ISSUE_COST * tokens.len() as u64, "WEGLD fee amount is not met" @@ -91,11 +100,7 @@ pub trait TransferTokensModule: fn split_payments_for_prefix_and_fee( &self, tokens: &ManagedVec>, - ) -> ( - ManagedVec>, - ManagedVec>, - bool, - ) { + ) -> SplitResult { let sov_prefix = self.get_sovereign_prefix(); let mut sov_tokens: ManagedVec> = ManagedVec::new(); let mut non_sov_tokens: ManagedVec> = @@ -104,22 +109,26 @@ pub trait TransferTokensModule: for token in tokens.iter() { if !self.has_sov_prefix(&token.token_identifier, &sov_prefix) { non_sov_tokens.push(token); + continue; } if !self.paid_issued_tokens().contains(&token.token_identifier) { - return (ManagedVec::new(), ManagedVec::new(), false); + return SplitResult::default(); } sov_tokens.push(token.into()); } - (sov_tokens, non_sov_tokens, true) + SplitResult { + sov_tokens, + non_sov_tokens, + are_tokens_registered: true, + } } fn remove_executed_hash(&self, hash_of_hashes: &ManagedBuffer, op_hash: &ManagedBuffer) { let header_verifier_address = self.header_verifier_address().get(); - self.tx() .to(header_verifier_address) .typed(header_verifier_proxy::HeaderverifierProxy) @@ -143,7 +152,9 @@ pub trait TransferTokensModule: self.deposit_event( &operation_tuple.operation.data.op_sender, - &operation_tuple.operation.get_tokens_as_tuple_arr(), + &operation_tuple + .operation + .get_tokens_as_multi_value_encoded(), OperationData::new(tx_nonce, sc_address.clone(), None), ); } @@ -155,11 +166,9 @@ pub trait TransferTokensModule: operation: &Operation, ) -> (ManagedBuffer, bool) { let mut serialized_data = ManagedBuffer::new(); - let mut storage_key = StorageKey::from("pending_hashes"); - storage_key.append_item(&hash_of_hashes); - + let header_verifier_address = self.header_verifier_address().get(); let pending_operations_mapper = - UnorderedSetMapper::new_from_address(self.header_verifier_address().get(), storage_key); + self.external_pending_hashes(header_verifier_address, hash_of_hashes); if let core::result::Result::Err(err) = operation.top_encode(&mut serialized_data) { sc_panic!("Transfer data encode error: {}", err.message_bytes()); @@ -167,7 +176,6 @@ pub trait TransferTokensModule: let sha256 = self.crypto().sha256(&serialized_data); let hash = sha256.as_managed_buffer().clone(); - if pending_operations_mapper.contains(&hash) { (hash, true) } else { @@ -198,4 +206,11 @@ pub trait TransferTokensModule: #[storage_mapper("paidIssuedTokens")] fn paid_issued_tokens(&self) -> UnorderedSetMapper>; + + #[storage_mapper_from_address("pending_hashes")] + fn external_pending_hashes( + &self, + sc_address: ManagedAddress, + hash_of_hashes: &ManagedBuffer, + ) -> UnorderedSetMapper; } diff --git a/enshrine-esdt-safe/src/to_sovereign/create_tx.rs b/enshrine-esdt-safe/src/to_sovereign/create_tx.rs index 59d0f9ae..ec2e6a22 100644 --- a/enshrine-esdt-safe/src/to_sovereign/create_tx.rs +++ b/enshrine-esdt-safe/src/to_sovereign/create_tx.rs @@ -1,12 +1,9 @@ use crate::common; use fee_market::fee_market_proxy; -use multiversx_sc::{hex_literal::hex, storage::StorageKey}; use transaction::{GasLimit, OperationData, TransferData}; use multiversx_sc::imports::*; -pub const ESDT_SYSTEM_SC_ADDRESS: [u8; 32] = - hex!("000000000000000000010000000000000000000000000000000000000002ffff"); const MAX_TRANSFERS_PER_TX: usize = 10; #[multiversx_sc::module] @@ -34,18 +31,16 @@ pub trait CreateTxModule: require!(self.not_paused(), "Cannot create transaction while paused"); let (fees_payment, payments) = self.check_and_extract_fee().into_tuple(); - require!(!payments.is_empty(), "Nothing to transfer"); require!(payments.len() <= MAX_TRANSFERS_PER_TX, "Too many tokens"); + let mut total_tokens_for_fees = 0usize; + let mut event_payments = MultiValueEncoded::new(); + let mut refundable_payments = ManagedVec::::new(); + let opt_transfer_data = self.process_transfer_data(opt_transfer_data); let own_sc_address = self.blockchain().get_sc_address(); - let mut total_tokens_for_fees = 0usize; - let mut event_payments: MultiValueEncoded< - MultiValue3, - > = MultiValueEncoded::new(); - let mut refundable_payments: ManagedVec> = - ManagedVec::new(); + let is_sov_chain = self.is_sovereign_chain().get(); for payment in &payments { self.require_below_max_amount(&payment.token_identifier, &payment.amount); @@ -66,10 +61,9 @@ pub trait CreateTxModule: &payment.token_identifier, payment.token_nonce, ); - current_token_data.amount = payment.amount.clone(); - if self.is_sovereign_chain().get() || self.has_prefix(&payment.token_identifier) { + if is_sov_chain || self.has_prefix(&payment.token_identifier) { self.send().esdt_local_burn( &payment.token_identifier, payment.token_nonce, @@ -77,23 +71,25 @@ pub trait CreateTxModule: ); } - event_payments.push(MultiValue3(( - payment.token_identifier.clone(), - payment.token_nonce, - current_token_data.clone(), - ))); + event_payments.push( + ( + payment.token_identifier.clone(), + payment.token_nonce, + current_token_data.clone(), + ) + .into(), + ); } - let caller = self.blockchain().get_caller(); self.match_fee_payment(total_tokens_for_fees, &fees_payment, &opt_transfer_data); // refund refundable_tokens + let caller = self.blockchain().get_caller(); for payment in &refundable_payments { self.send().direct_non_zero_esdt_payment(&caller, &payment); } let tx_nonce = self.get_and_save_next_tx_id(); - self.deposit_event( &to, &event_payments, @@ -114,13 +110,8 @@ pub trait CreateTxModule: require!(payments.len() <= MAX_TRANSFERS_PER_TX, "Too many tokens"); let fee_market_address = self.fee_market_address().get(); - let fee_enabled_mapper = SingleValueMapper::new_from_address( - fee_market_address.clone(), - StorageKey::from("feeEnabledFlag"), - ) - .get(); - - let opt_transfer_data = if fee_enabled_mapper { + let fee_enabled = self.external_fee_enabled(fee_market_address).get(); + let opt_transfer_data = if fee_enabled { OptionalValue::Some(self.pop_first_payment(&mut payments)) } else { OptionalValue::None @@ -196,4 +187,10 @@ pub trait CreateTxModule: #[storage_mapper("bannedEndpointNames")] fn banned_endpoint_names(&self) -> UnorderedSetMapper; + + #[storage_mapper_from_address("feeEnabledFlag")] + fn external_fee_enabled( + &self, + sc_address: ManagedAddress, + ) -> SingleValueMapper; } diff --git a/enshrine-esdt-safe/tests/enshrine_esdt_safe_blackbox_test.rs b/enshrine-esdt-safe/tests/enshrine_esdt_safe_blackbox_test.rs index dc022efd..00be95ac 100644 --- a/enshrine-esdt-safe/tests/enshrine_esdt_safe_blackbox_test.rs +++ b/enshrine-esdt-safe/tests/enshrine_esdt_safe_blackbox_test.rs @@ -1,10 +1,9 @@ use bls_signature::BlsSignature; use enshrine_esdt_safe::enshrine_esdt_safe_proxy; use header_verifier::header_verifier_proxy; -use multiversx_sc::api::StaticVarApi; use multiversx_sc::codec::TopEncode; use multiversx_sc::types::{ - Address, BigUint, EsdtTokenPayment, ManagedBuffer, ManagedByteArray, ManagedVec, + Address, BigUint, EsdtTokenData, EsdtTokenPayment, ManagedBuffer, ManagedByteArray, ManagedVec, MultiValueEncoded, TestAddress, TestSCAddress, TestTokenIdentifier, TokenIdentifier, }; use multiversx_sc_scenario::api::StaticApi; @@ -12,9 +11,7 @@ use multiversx_sc_scenario::multiversx_chain_vm::crypto_functions::sha256; use multiversx_sc_scenario::{imports::MxscPath, ScenarioWorld}; use multiversx_sc_scenario::{managed_address, ExpectError, ScenarioTxRun}; use token_handler::token_handler_proxy; -use transaction::{ - Operation, OperationData, OperationEsdtPayment, StolenFromFrameworkEsdtTokenData, -}; +use transaction::{Operation, OperationData, OperationEsdtPayment}; const ENSHRINE_ESDT_ADDRESS: TestSCAddress = TestSCAddress::new("enshrine-esdt"); const ENSHRINE_ESDT_CODE_PATH: MxscPath = MxscPath::new("output/enshrine-esdt-safe.mxsc-json"); @@ -166,7 +163,7 @@ impl EnshrineTestState { .tx() .from(ENSHRINE_ESDT_OWNER_ADDRESS) .typed(token_handler_proxy::TokenHandlerProxy) - .init(SOVEREIGN_TOKEN_PREFIX) + .init(/* SOVEREIGN_TOKEN_PREFIX */) .code(TOKEN_HANDLER_CODE_PATH) .new_address(TOKEN_HANDLER_ADDRESS) .run(); @@ -306,11 +303,8 @@ impl EnshrineTestState { let mut tokens: ManagedVec> = ManagedVec::new(); for token_id in token_ids { - let payment: OperationEsdtPayment = OperationEsdtPayment::new( - token_id.clone().into(), - 1, - StolenFromFrameworkEsdtTokenData::default(), - ); + let payment: OperationEsdtPayment = + OperationEsdtPayment::new(token_id.clone().into(), 1, EsdtTokenData::default()); tokens.push(payment); } diff --git a/esdt-safe/src/esdt_safe_proxy.rs b/esdt-safe/src/esdt_safe_proxy.rs index 0d69917a..1c463ded 100644 --- a/esdt-safe/src/esdt_safe_proxy.rs +++ b/esdt-safe/src/esdt_safe_proxy.rs @@ -233,7 +233,7 @@ where pub fn get_current_tx_batch( self, - ) -> TxTypedCall, ManagedAddress, ManagedVec>, ManagedVec>, Option>>>>>> { + ) -> TxTypedCall, ManagedAddress, ManagedVec>, ManagedVec>, Option>>>>>> { self.wrapped_tx .payment(NotPayable) .raw_call("getCurrentTxBatch") @@ -242,7 +242,7 @@ where pub fn get_first_batch_any_status( self, - ) -> TxTypedCall, ManagedAddress, ManagedVec>, ManagedVec>, Option>>>>>> { + ) -> TxTypedCall, ManagedAddress, ManagedVec>, ManagedVec>, Option>>>>>> { self.wrapped_tx .payment(NotPayable) .raw_call("getFirstBatchAnyStatus") @@ -254,7 +254,7 @@ where >( self, batch_id: Arg0, - ) -> TxTypedCall, ManagedAddress, ManagedVec>, ManagedVec>, Option>>>>>> { + ) -> TxTypedCall, ManagedAddress, ManagedVec>, ManagedVec>, Option>>>>>> { self.wrapped_tx .payment(NotPayable) .raw_call("getBatch") diff --git a/esdt-safe/src/from_sovereign/token_mapping.rs b/esdt-safe/src/from_sovereign/token_mapping.rs index 14314a80..aa7ce360 100644 --- a/esdt-safe/src/from_sovereign/token_mapping.rs +++ b/esdt-safe/src/from_sovereign/token_mapping.rs @@ -1,6 +1,7 @@ multiversx_sc::imports!(); multiversx_sc::derive_imports!(); -const DEFAULT_ISSUE_COST: u64 = 50000000000000000; + +const DEFAULT_ISSUE_COST: u64 = 50_000_000_000_000_000; // 0.05 EGLD #[derive(TopEncode, TopDecode, NestedEncode, NestedDecode, TypeAbi, ManagedVecItem, Clone)] pub struct EsdtTokenInfo { @@ -8,6 +9,23 @@ pub struct EsdtTokenInfo { pub token_nonce: u64, } +struct FungibleTokenArgs { + sov_token_id: TokenIdentifier, + issue_cost: BigUint, + token_display_name: ManagedBuffer, + token_ticker: ManagedBuffer, + num_decimals: usize, +} + +struct NonFungibleTokenArgs { + sov_token_id: TokenIdentifier, + token_type: EsdtTokenType, + issue_cost: BigUint, + token_display_name: ManagedBuffer, + token_ticker: ManagedBuffer, + num_decimals: usize, +} + #[multiversx_sc::module] pub trait TokenMappingModule: multiversx_sc_modules::default_issue_callbacks::DefaultIssueCallbacksModule @@ -28,28 +46,31 @@ pub trait TokenMappingModule: ); let issue_cost = self.call_value().egld_value().clone_value(); - - require!(issue_cost == DEFAULT_ISSUE_COST, "eGLD value should be 0.5"); + require!( + issue_cost == DEFAULT_ISSUE_COST, + "eGLD value should be 0.05" + ); match token_type { EsdtTokenType::Invalid => sc_panic!("Invalid type"), - EsdtTokenType::Fungible => self.handle_fungible_token_type( - sov_token_id.clone(), + EsdtTokenType::Fungible => self.handle_fungible_token_type(FungibleTokenArgs { + sov_token_id: sov_token_id.clone(), issue_cost, token_display_name, token_ticker, num_decimals, - ), - _ => self.handle_nonfungible_token_type( - sov_token_id.clone(), + }), + _ => self.handle_nonfungible_token_type(NonFungibleTokenArgs { + sov_token_id: sov_token_id.clone(), token_type, issue_cost, token_display_name, token_ticker, num_decimals, - ), + }), } + // !!! Unreachable code !!! match self.sovereign_to_multiversx_token_id(&sov_token_id).get() { TokenMapperState::NotSet => sc_panic!("Token ID not set"), TokenMapperState::Pending => {} @@ -60,45 +81,31 @@ pub trait TokenMappingModule: } } - fn handle_fungible_token_type( - &self, - sov_token_id: TokenIdentifier, - issue_cost: BigUint, - token_display_name: ManagedBuffer, - token_ticker: ManagedBuffer, - num_decimals: usize, - ) { - self.multiversx_to_sovereign_token_id(&sov_token_id) - .set(sov_token_id.clone()); - - self.fungible_token(&sov_token_id).issue_and_set_all_roles( - issue_cost, - token_display_name, - token_ticker, - num_decimals, - None, - ); + fn handle_fungible_token_type(&self, args: FungibleTokenArgs) { + self.multiversx_to_sovereign_token_id(&args.sov_token_id) + .set(args.sov_token_id.clone()); + + self.fungible_token(&args.sov_token_id) + .issue_and_set_all_roles( + args.issue_cost, + args.token_display_name, + args.token_ticker, + args.num_decimals, + None, + ); } - fn handle_nonfungible_token_type( - &self, - sov_token_id: TokenIdentifier, - token_type: EsdtTokenType, - issue_cost: BigUint, - token_display_name: ManagedBuffer, - token_ticker: ManagedBuffer, - num_decimals: usize, - ) { - self.multiversx_to_sovereign_token_id(&sov_token_id) - .set(sov_token_id.clone()); + fn handle_nonfungible_token_type(&self, args: NonFungibleTokenArgs) { + self.multiversx_to_sovereign_token_id(&args.sov_token_id) + .set(args.sov_token_id.clone()); - self.non_fungible_token(&sov_token_id) + self.non_fungible_token(&args.sov_token_id) .issue_and_set_all_roles( - token_type, - issue_cost, - token_display_name, - token_ticker, - num_decimals, + args.token_type, + args.issue_cost, + args.token_display_name, + args.token_ticker, + args.num_decimals, None, ); } diff --git a/esdt-safe/src/from_sovereign/transfer_tokens.rs b/esdt-safe/src/from_sovereign/transfer_tokens.rs index 6b44bc31..029b1387 100644 --- a/esdt-safe/src/from_sovereign/transfer_tokens.rs +++ b/esdt-safe/src/from_sovereign/transfer_tokens.rs @@ -272,7 +272,9 @@ pub trait TransferTokensModule: self.deposit_event( &operation_tuple.operation.data.op_sender, - &operation_tuple.operation.get_tokens_as_tuple_arr(), + &operation_tuple + .operation + .get_tokens_as_multi_value_encoded(), OperationData { op_nonce: tx_nonce, op_sender: sc_address.clone(), diff --git a/esdt-safe/tests/bridge_blackbox_tests.rs b/esdt-safe/tests/bridge_blackbox_tests.rs index bbe07ff3..ac0d11d0 100644 --- a/esdt-safe/tests/bridge_blackbox_tests.rs +++ b/esdt-safe/tests/bridge_blackbox_tests.rs @@ -4,7 +4,8 @@ use fee_market::fee_market_proxy::{self, FeeType}; use header_verifier::header_verifier_proxy; use multiversx_sc::codec::TopEncode; use multiversx_sc::types::{ - Address, ManagedByteArray, MultiValueEncoded, TestTokenIdentifier, TokenIdentifier, + Address, EsdtTokenData, ManagedByteArray, MultiValueEncoded, TestTokenIdentifier, + TokenIdentifier, }; use multiversx_sc::{ imports::{MultiValue3, OptionalValue}, @@ -18,9 +19,7 @@ use multiversx_sc_scenario::multiversx_chain_vm::crypto_functions::sha256; use multiversx_sc_scenario::{ api::StaticApi, imports::MxscPath, ExpectError, ScenarioTxRun, ScenarioWorld, }; -use transaction::{ - Operation, OperationData, OperationEsdtPayment, StolenFromFrameworkEsdtTokenData, -}; +use transaction::{Operation, OperationData, OperationEsdtPayment}; const BRIDGE_ADDRESS: TestSCAddress = TestSCAddress::new("bridge"); const BRIDGE_CODE_PATH: MxscPath = MxscPath::new("output/esdt-safe.mxsc.json"); @@ -331,7 +330,7 @@ impl BridgeTestState { let payment: OperationEsdtPayment = OperationEsdtPayment { token_identifier: token_id.into(), token_nonce: 1, - token_data: StolenFromFrameworkEsdtTokenData::default(), + token_data: EsdtTokenData::default(), }; tokens.push(payment); diff --git a/fee-market/src/subtract_fee.rs b/fee-market/src/subtract_fee.rs index 458eda40..ac86550b 100644 --- a/fee-market/src/subtract_fee.rs +++ b/fee-market/src/subtract_fee.rs @@ -68,6 +68,7 @@ pub trait SubtractFeeModule: }); percentage_sum += percentage as u64; } + require!( percentage_sum == TOTAL_PERCENTAGE as u64, "Invalid percentage sum" @@ -80,7 +81,6 @@ pub trait SubtractFeeModule: } let mut remaining_fees = accumulated_fees.clone(); - for pair in &pairs { let amount_to_send = &(&accumulated_fees * &BigUint::from(pair.percentage)) / &percentage_total; @@ -197,7 +197,6 @@ pub trait SubtractFeeModule: } let mut payment = args.payment; - require!(total_fee <= payment.amount, "Payment does not cover fee"); payment.amount -= &total_fee; diff --git a/header-verifier/src/lib.rs b/header-verifier/src/lib.rs index a881f3b1..0367fc57 100644 --- a/header-verifier/src/lib.rs +++ b/header-verifier/src/lib.rs @@ -33,7 +33,6 @@ pub trait Headerverifier: bls_signature::BlsSignatureModule { ); let is_bls_valid = self.verify_bls(&signature, &bridge_operations_hash); - require!(is_bls_valid, "BLS signature is not valid"); self.calculate_and_check_transfers_hashes( @@ -58,7 +57,6 @@ pub trait Headerverifier: bls_signature::BlsSignatureModule { #[endpoint(removeExecutedHash)] fn remove_executed_hash(&self, hash_of_hashes: &ManagedBuffer, operation_hash: &ManagedBuffer) { let caller = self.blockchain().get_caller(); - require!( caller == self.esdt_safe_address().get(), "Only ESDT Safe contract can call this endpoint" @@ -74,20 +72,19 @@ pub trait Headerverifier: bls_signature::BlsSignatureModule { transfers_data: MultiValueEncoded, ) { let mut transfers_hashes = ManagedBuffer::new(); - for transfer in transfers_data { transfers_hashes.append(&transfer); } let hash_of_hashes_sha256 = self.crypto().sha256(&transfers_hashes); let hash_of_hashes = hash_of_hashes_sha256.as_managed_buffer(); - require!( transfers_hash.eq(hash_of_hashes), "Hash of all operations doesn't match the hash of transfer data" ); } + // TODO fn verify_bls( &self, _signature: &BlsSignature, diff --git a/token-handler/src/common_storage.rs b/token-handler/src/common_storage.rs index e0312c10..0de234be 100644 --- a/token-handler/src/common_storage.rs +++ b/token-handler/src/common_storage.rs @@ -7,7 +7,6 @@ pub trait CommonStorage { fn require_caller_to_be_whitelisted(&self) { let caller = self.blockchain().get_caller(); - require!( self.enshrine_esdt_whitelist().contains(&caller), "Caller is not whitelisted" diff --git a/token-handler/src/transfer_tokens.rs b/token-handler/src/transfer_tokens.rs index 4245e7da..be527c31 100644 --- a/token-handler/src/transfer_tokens.rs +++ b/token-handler/src/transfer_tokens.rs @@ -5,7 +5,7 @@ use multiversx_sc::types::{ system_proxy, EsdtTokenPayment, ManagedArgBuffer, MultiValueEncoded, ToSelf, }; use multiversx_sc::types::{ManagedVec, TokenIdentifier}; -use transaction::{GasLimit, OperationEsdtPayment, StolenFromFrameworkEsdtTokenData, TransferData}; +use transaction::{GasLimit, OperationEsdtPayment, TransferData}; use crate::common_storage; @@ -108,7 +108,7 @@ pub trait TransferTokensModule: common_storage::CommonStorage { &self, token_identifier: &TokenIdentifier, token_nonce: &u64, - token_data: &StolenFromFrameworkEsdtTokenData, + token_data: &EsdtTokenData, ) -> ManagedArgBuffer { let mut arg_buffer = ManagedArgBuffer::new(); let cloned_token_data = token_data.clone(); @@ -121,7 +121,6 @@ pub trait TransferTokensModule: common_storage::CommonStorage { arg_buffer.push_arg(cloned_token_data.attributes); let uris = token_data.uris.clone(); - if uris.is_empty() { // at least one URI is required, so we push an empty one arg_buffer.push_arg(codec::Empty); diff --git a/token-handler/tests/token_handler_scenario_rs_test.rs b/token-handler/tests/token_handler_scenario_rs_test.rs index ca953346..ef046cf2 100644 --- a/token-handler/tests/token_handler_scenario_rs_test.rs +++ b/token-handler/tests/token_handler_scenario_rs_test.rs @@ -3,7 +3,10 @@ use multiversx_sc_scenario::*; fn world() -> ScenarioWorld { let mut blockchain = ScenarioWorld::new(); - blockchain.register_contract("mxsc:output/token-handler.mxsc.json", token_handler::ContractBuilder); + blockchain.register_contract( + "mxsc:output/token-handler.mxsc.json", + token_handler::ContractBuilder, + ); blockchain } From c9c7696ce27db7627ca28f9fad8c843b445b2672 Mon Sep 17 00:00:00 2001 From: Andrei Baltariu Date: Wed, 7 Aug 2024 14:24:48 +0300 Subject: [PATCH 266/523] Removed duplicate new() method Signed-off-by: Andrei Baltariu --- common/transaction/src/lib.rs | 14 -------------- 1 file changed, 14 deletions(-) diff --git a/common/transaction/src/lib.rs b/common/transaction/src/lib.rs index 3f7ab400..d8822282 100644 --- a/common/transaction/src/lib.rs +++ b/common/transaction/src/lib.rs @@ -129,20 +129,6 @@ impl OperationEsdtPayment { } } -impl OperationEsdtPayment { - pub fn new( - token_identifier: TokenIdentifier, - token_nonce: u64, - token_data: StolenFromFrameworkEsdtTokenData, - ) -> Self { - OperationEsdtPayment { - token_identifier, - token_nonce, - token_data, - } - } -} - impl From> for OperationEsdtPayment { #[inline] fn from(payment: EsdtTokenPayment) -> Self { From 312d2e810ef1fe1cfe56c0383c40962ad519d05d Mon Sep 17 00:00:00 2001 From: Andrei Baltariu Date: Wed, 7 Aug 2024 14:29:07 +0300 Subject: [PATCH 267/523] Added workspace resolver Signed-off-by: Andrei Baltariu --- Cargo.toml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Cargo.toml b/Cargo.toml index e29fcca9..862e3f41 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,4 +1,6 @@ [workspace] +resolver = "2" + members = [ "chain-config", "chain-config/meta", From 2118857017f7615c46acddcbaf9f133aa2985a31 Mon Sep 17 00:00:00 2001 From: Andrei Baltariu Date: Wed, 7 Aug 2024 15:17:15 +0300 Subject: [PATCH 268/523] Added workspace resolver Signed-off-by: Andrei Baltariu --- Cargo.lock | 34 ---------------------------------- Cargo.toml | 2 ++ 2 files changed, 2 insertions(+), 34 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 7ce88418..8d11bf29 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -754,23 +754,6 @@ version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c08d65885ee38876c4f86fa503fb49d7b507c2b62552df7c70b2fce627e06381" -[[package]] -name = "pair-mock" -version = "0.0.0" -dependencies = [ - "multiversx-sc", - "multiversx-sc-scenario", - "num-bigint", -] - -[[package]] -name = "pair-mock-meta" -version = "0.0.0" -dependencies = [ - "multiversx-sc-meta-lib", - "pair-mock", -] - [[package]] name = "pathdiff" version = "0.2.1" @@ -891,23 +874,6 @@ dependencies = [ "rand_core 0.6.4", ] -[[package]] -name = "router-mock" -version = "0.0.0" -dependencies = [ - "multiversx-sc", - "multiversx-sc-scenario", - "num-bigint", -] - -[[package]] -name = "router-mock-meta" -version = "0.0.0" -dependencies = [ - "multiversx-sc-meta-lib", - "router-mock", -] - [[package]] name = "rustc_version" version = "0.4.0" diff --git a/Cargo.toml b/Cargo.toml index 6d3767a1..4d50e05f 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,4 +1,6 @@ [workspace] +resolver = "2" + members = [ "chain-config", "chain-config/meta", From 41bc4a505540ffb9a296cf131cf9343d843b6cb5 Mon Sep 17 00:00:00 2001 From: Andrei Baltariu Date: Wed, 7 Aug 2024 15:43:48 +0300 Subject: [PATCH 269/523] Removed use of custom EsdtTokenData struct Signed-off-by: Andrei Baltariu --- token-handler/tests/token_handler_blackbox_tests.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/token-handler/tests/token_handler_blackbox_tests.rs b/token-handler/tests/token_handler_blackbox_tests.rs index 0ec6cba3..5204793f 100644 --- a/token-handler/tests/token_handler_blackbox_tests.rs +++ b/token-handler/tests/token_handler_blackbox_tests.rs @@ -1,11 +1,11 @@ use multiversx_sc::types::{ - BigUint, EsdtTokenPayment, ManagedAddress, ManagedBuffer, MultiValueEncoded, TestAddress, - TestSCAddress, TestTokenIdentifier, + BigUint, EsdtTokenData, EsdtTokenPayment, ManagedAddress, ManagedBuffer, MultiValueEncoded, + TestAddress, TestSCAddress, TestTokenIdentifier, }; use multiversx_sc_scenario::{api::StaticApi, imports::MxscPath, ScenarioWorld}; use multiversx_sc_scenario::{ExpectError, ScenarioTxRun}; use token_handler::{dummy_enshrine_proxy, token_handler_proxy}; -use transaction::{OperationEsdtPayment, StolenFromFrameworkEsdtTokenData, TransferData}; +use transaction::{OperationEsdtPayment, TransferData}; const TOKEN_HANDLER_ADDRESS: TestSCAddress = TestSCAddress::new("token-handler"); const TOKEN_HANDLER_CODE_PATH: MxscPath = MxscPath::new("output/token-handler.mxsc.json"); @@ -157,7 +157,7 @@ impl TokenHandlerTestState { let payment: OperationEsdtPayment = OperationEsdtPayment { token_identifier: token_id.clone().into(), token_nonce: 1, - token_data: StolenFromFrameworkEsdtTokenData::default(), + token_data: EsdtTokenData::default(), }; tokens.push(payment); From 0c2b06d33a06caf559e8b7019fca52b995de28b3 Mon Sep 17 00:00:00 2001 From: Andrei Baltariu Date: Wed, 7 Aug 2024 16:59:20 +0300 Subject: [PATCH 270/523] Removed dummy enshrine contract and used factory SC Signed-off-by: Andrei Baltariu --- Cargo.lock | 1 + chain-factory/sc-config.toml | 22 ++ chain-factory/src/chain_factory_proxy.rs | 204 ++++++++++++++++ .../wasm-chain-factory-full/Cargo.lock | 231 ++++++++++++++++++ .../wasm-chain-factory-full/Cargo.toml | 34 +++ .../wasm-chain-factory-full/src/lib.rs | 34 +++ .../wasm-chain-factory-view/Cargo.lock | 231 ++++++++++++++++++ .../wasm-chain-factory-view/Cargo.toml | 34 +++ .../wasm-chain-factory-view/src/lib.rs | 25 ++ .../wasm-enshrine-esdt-safe-full/Cargo.lock | 19 ++ .../wasm-enshrine-esdt-safe-view/Cargo.lock | 19 ++ enshrine-esdt-safe/wasm/Cargo.lock | 19 ++ pair-mock/wasm-pair-mock-full/Cargo.lock | 188 ++++++++++++++ pair-mock/wasm-pair-mock-view/Cargo.lock | 188 ++++++++++++++ token-handler/Cargo.toml | 3 + token-handler/src/chain_factory_proxy.rs | 204 ++++++++++++++++ token-handler/src/lib.rs | 1 + .../tests/token_handler_blackbox_tests.rs | 92 +++---- .../wasm-token-handler-full/Cargo.lock | 36 +++ .../wasm-token-handler-view/Cargo.lock | 36 +++ token-handler/wasm/Cargo.lock | 36 +++ 21 files changed, 1601 insertions(+), 56 deletions(-) create mode 100644 chain-factory/sc-config.toml create mode 100644 chain-factory/src/chain_factory_proxy.rs create mode 100644 chain-factory/wasm-chain-factory-full/Cargo.lock create mode 100644 chain-factory/wasm-chain-factory-full/Cargo.toml create mode 100644 chain-factory/wasm-chain-factory-full/src/lib.rs create mode 100644 chain-factory/wasm-chain-factory-view/Cargo.lock create mode 100644 chain-factory/wasm-chain-factory-view/Cargo.toml create mode 100644 chain-factory/wasm-chain-factory-view/src/lib.rs create mode 100644 pair-mock/wasm-pair-mock-full/Cargo.lock create mode 100644 pair-mock/wasm-pair-mock-view/Cargo.lock create mode 100644 token-handler/src/chain_factory_proxy.rs diff --git a/Cargo.lock b/Cargo.lock index bf776448..d98a9b1e 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1062,6 +1062,7 @@ dependencies = [ name = "token-handler" version = "0.0.0" dependencies = [ + "chain-factory", "header-verifier", "multiversx-sc", "multiversx-sc-scenario", diff --git a/chain-factory/sc-config.toml b/chain-factory/sc-config.toml new file mode 100644 index 00000000..91b32130 --- /dev/null +++ b/chain-factory/sc-config.toml @@ -0,0 +1,22 @@ +[settings] +main = "main" + +[contracts.main] +name = "chain-factory" + +[contracts.full] +name = "chain-factory-full" +add-unlabelled = true +add-labels = ["chain-factory-external-view"] + +[contracts.view] +name = "chain-factory-view" +external-view = true +add-unlabelled = false +add-labels = ["chain-factory-external-view"] + +[[proxy]] +path = "src/chain_factory_proxy.rs" + +[[proxy]] +path = "../token-handler/src/chain_factory_proxy.rs" diff --git a/chain-factory/src/chain_factory_proxy.rs b/chain-factory/src/chain_factory_proxy.rs new file mode 100644 index 00000000..72b70ba6 --- /dev/null +++ b/chain-factory/src/chain_factory_proxy.rs @@ -0,0 +1,204 @@ +// Code generated by the multiversx-sc proxy generator. DO NOT EDIT. + +//////////////////////////////////////////////////// +////////////////// AUTO-GENERATED ////////////////// +//////////////////////////////////////////////////// + +#![allow(dead_code)] +#![allow(clippy::all)] + +use multiversx_sc::proxy_imports::*; + +pub struct ChainFactoryContractProxy; + +impl TxProxyTrait for ChainFactoryContractProxy +where + Env: TxEnv, + From: TxFrom, + To: TxTo, + Gas: TxGas, +{ + type TxProxyMethods = ChainFactoryContractProxyMethods; + + fn proxy_methods(self, tx: Tx) -> Self::TxProxyMethods { + ChainFactoryContractProxyMethods { wrapped_tx: tx } + } +} + +pub struct ChainFactoryContractProxyMethods +where + Env: TxEnv, + From: TxFrom, + To: TxTo, + Gas: TxGas, +{ + wrapped_tx: Tx, +} + +#[rustfmt::skip] +impl ChainFactoryContractProxyMethods +where + Env: TxEnv, + Env::Api: VMApi, + From: TxFrom, + Gas: TxGas, +{ + pub fn init< + Arg0: ProxyArg>, + Arg1: ProxyArg>, + Arg2: ProxyArg>, + >( + self, + validators_contract_address: Arg0, + chain_config_template: Arg1, + deploy_cost: Arg2, + ) -> TxTypedDeploy { + self.wrapped_tx + .payment(NotPayable) + .raw_deploy() + .argument(&validators_contract_address) + .argument(&chain_config_template) + .argument(&deploy_cost) + .original_result() + } +} + +#[rustfmt::skip] +impl ChainFactoryContractProxyMethods +where + Env: TxEnv, + Env::Api: VMApi, + From: TxFrom, + To: TxTo, + Gas: TxGas, +{ + pub fn upgrade( + self, + ) -> TxTypedUpgrade { + self.wrapped_tx + .payment(NotPayable) + .raw_upgrade() + .original_result() + } +} + +#[rustfmt::skip] +impl ChainFactoryContractProxyMethods +where + Env: TxEnv, + Env::Api: VMApi, + From: TxFrom, + To: TxTo, + Gas: TxGas, +{ + pub fn deploy_sovereign_chain_config_contract< + Arg0: ProxyArg, + Arg1: ProxyArg, + Arg2: ProxyArg>, + Arg3: ProxyArg, BigUint>>>, + >( + self, + min_validators: Arg0, + max_validators: Arg1, + min_stake: Arg2, + additional_stake_required: Arg3, + ) -> TxTypedCall { + self.wrapped_tx + .raw_call("deploySovereignChainConfigContract") + .argument(&min_validators) + .argument(&max_validators) + .argument(&min_stake) + .argument(&additional_stake_required) + .original_result() + } + + pub fn blacklist_sovereign_chain_sc< + Arg0: ProxyArg>, + >( + self, + sc_address: Arg0, + ) -> TxTypedCall { + self.wrapped_tx + .payment(NotPayable) + .raw_call("blacklistSovereignChainSc") + .argument(&sc_address) + .original_result() + } + + pub fn deploy_cost( + self, + ) -> TxTypedCall> { + self.wrapped_tx + .payment(NotPayable) + .raw_call("getDeployCost") + .original_result() + } + + pub fn slash< + Arg0: ProxyArg>, + Arg1: ProxyArg>, + >( + self, + validator_address: Arg0, + value: Arg1, + ) -> TxTypedCall { + self.wrapped_tx + .payment(NotPayable) + .raw_call("slash") + .argument(&validator_address) + .argument(&value) + .original_result() + } + + pub fn distribute_slashed< + Arg0: ProxyArg, BigUint>>>, + >( + self, + dest_amount_pairs: Arg0, + ) -> TxTypedCall { + self.wrapped_tx + .payment(NotPayable) + .raw_call("distributeSlashed") + .argument(&dest_amount_pairs) + .original_result() + } + + pub fn set_min_valid_signers< + Arg0: ProxyArg, + >( + self, + new_value: Arg0, + ) -> TxTypedCall { + self.wrapped_tx + .payment(NotPayable) + .raw_call("setMinValidSigners") + .argument(&new_value) + .original_result() + } + + pub fn add_signers< + Arg0: ProxyArg>>, + >( + self, + signers: Arg0, + ) -> TxTypedCall { + self.wrapped_tx + .payment(NotPayable) + .raw_call("addSigners") + .argument(&signers) + .original_result() + } + + pub fn remove_signers< + Arg0: ProxyArg>>, + >( + self, + signers: Arg0, + ) -> TxTypedCall { + self.wrapped_tx + .payment(NotPayable) + .raw_call("removeSigners") + .argument(&signers) + .original_result() + } +} diff --git a/chain-factory/wasm-chain-factory-full/Cargo.lock b/chain-factory/wasm-chain-factory-full/Cargo.lock new file mode 100644 index 00000000..3af94498 --- /dev/null +++ b/chain-factory/wasm-chain-factory-full/Cargo.lock @@ -0,0 +1,231 @@ +# 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.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b048fb63fd8b5923fc5aa7b340d8e156aec7ec02f0c78fa8a6ddc2613f6f71de" + +[[package]] +name = "bls-signature" +version = "0.0.0" +dependencies = [ + "multiversx-sc", + "transaction", +] + +[[package]] +name = "chain-config" +version = "0.0.0" +dependencies = [ + "multiversx-sc", + "multiversx-sc-modules", +] + +[[package]] +name = "chain-factory" +version = "0.0.0" +dependencies = [ + "bls-signature", + "chain-config", + "multiversx-sc", + "utils", +] + +[[package]] +name = "chain-factory-full-wasm" +version = "0.0.0" +dependencies = [ + "chain-factory", + "multiversx-sc-wasm-adapter", +] + +[[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.52.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "526760b1d6236c011285b264a70a0a9dd3b3dbc53c3b5f76932f4bcfd3a8910c" +dependencies = [ + "bitflags", + "hex-literal", + "multiversx-sc-codec", + "multiversx-sc-derive", + "num-traits", + "unwrap-infallible", +] + +[[package]] +name = "multiversx-sc-codec" +version = "0.20.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ad4f318427761faecf26c1f3115a3beeb5f61858845a60547d9763aa981ddd2d" +dependencies = [ + "arrayvec", + "multiversx-sc-codec-derive", + "unwrap-infallible", +] + +[[package]] +name = "multiversx-sc-codec-derive" +version = "0.20.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "476501462b0c2654b64f9dec6f2c480e24b4e9b7133ec10b7167e64acda35d04" +dependencies = [ + "hex", + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "multiversx-sc-derive" +version = "0.52.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3557f2f12640a8a07fa6af66cc2a13b188c5b61bed72db22fe631fb3a60c3e96" +dependencies = [ + "hex", + "proc-macro2", + "quote", + "radix_trie", + "syn", +] + +[[package]] +name = "multiversx-sc-modules" +version = "0.52.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "61f5c29c6044f3dc9e866858feee625d7fae5604a68ac7bd66dec683eee97563" +dependencies = [ + "multiversx-sc", +] + +[[package]] +name = "multiversx-sc-wasm-adapter" +version = "0.52.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ed13aaca9cbdbc6911174cd3029e750a7563d85dd3daaa1107b1fd31c7f17245" +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.19" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "071dfc062690e90b734c0b2273ce72ad0ffa95f0c74596bc250dcfd960262841" +dependencies = [ + "autocfg", +] + +[[package]] +name = "proc-macro2" +version = "1.0.86" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5e719e8df665df0d1c8fbfd238015744736151d4445ec0836b8e628aae103b77" +dependencies = [ + "unicode-ident", +] + +[[package]] +name = "quote" +version = "1.0.36" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0fa76aaf39101c457836aec0ce2316dbdc3ab723cdda1c6bd4e6ad4208acaca7" +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.72" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dc4b9b9bf2add8093d3f2c0204471e951b2285580335de42f9d2534f3ae7a8af" +dependencies = [ + "proc-macro2", + "quote", + "unicode-ident", +] + +[[package]] +name = "transaction" +version = "0.0.0" +dependencies = [ + "multiversx-sc", +] + +[[package]] +name = "unicode-ident" +version = "1.0.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3354b9ac3fae1ff6755cb6db53683adb661634f67557942dea4facebec0fee4b" + +[[package]] +name = "unwrap-infallible" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "151ac09978d3c2862c4e39b557f4eceee2cc72150bc4cb4f16abf061b6e381fb" + +[[package]] +name = "utils" +version = "0.0.0" +dependencies = [ + "bls-signature", + "multiversx-sc", +] diff --git a/chain-factory/wasm-chain-factory-full/Cargo.toml b/chain-factory/wasm-chain-factory-full/Cargo.toml new file mode 100644 index 00000000..d0fa9d63 --- /dev/null +++ b/chain-factory/wasm-chain-factory-full/Cargo.toml @@ -0,0 +1,34 @@ +# Code generated by the multiversx-sc build system. DO NOT EDIT. + +# ########################################## +# ############## AUTO-GENERATED ############# +# ########################################## + +[package] +name = "chain-factory-full-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 + +[profile.dev] +panic = "abort" + +[dependencies.chain-factory] +path = ".." + +[dependencies.multiversx-sc-wasm-adapter] +version = "=0.52.3" + +[workspace] +members = ["."] diff --git a/chain-factory/wasm-chain-factory-full/src/lib.rs b/chain-factory/wasm-chain-factory-full/src/lib.rs new file mode 100644 index 00000000..1de5eb2a --- /dev/null +++ b/chain-factory/wasm-chain-factory-full/src/lib.rs @@ -0,0 +1,34 @@ +// Code generated by the multiversx-sc build system. DO NOT EDIT. + +//////////////////////////////////////////////////// +////////////////// AUTO-GENERATED ////////////////// +//////////////////////////////////////////////////// + +// Init: 1 +// Upgrade: 1 +// Endpoints: 8 +// Async Callback (empty): 1 +// Total number of exported functions: 11 + +#![no_std] + +multiversx_sc_wasm_adapter::allocator!(); +multiversx_sc_wasm_adapter::panic_handler!(); + +multiversx_sc_wasm_adapter::endpoints! { + chain_factory + ( + init => init + upgrade => upgrade + deploySovereignChainConfigContract => deploy_sovereign_chain_config_contract + blacklistSovereignChainSc => blacklist_sovereign_chain_sc + getDeployCost => deploy_cost + slash => slash + distributeSlashed => distribute_slashed + setMinValidSigners => set_min_valid_signers + addSigners => add_signers + removeSigners => remove_signers + ) +} + +multiversx_sc_wasm_adapter::async_callback_empty! {} diff --git a/chain-factory/wasm-chain-factory-view/Cargo.lock b/chain-factory/wasm-chain-factory-view/Cargo.lock new file mode 100644 index 00000000..9b0e4093 --- /dev/null +++ b/chain-factory/wasm-chain-factory-view/Cargo.lock @@ -0,0 +1,231 @@ +# 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.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b048fb63fd8b5923fc5aa7b340d8e156aec7ec02f0c78fa8a6ddc2613f6f71de" + +[[package]] +name = "bls-signature" +version = "0.0.0" +dependencies = [ + "multiversx-sc", + "transaction", +] + +[[package]] +name = "chain-config" +version = "0.0.0" +dependencies = [ + "multiversx-sc", + "multiversx-sc-modules", +] + +[[package]] +name = "chain-factory" +version = "0.0.0" +dependencies = [ + "bls-signature", + "chain-config", + "multiversx-sc", + "utils", +] + +[[package]] +name = "chain-factory-view-wasm" +version = "0.0.0" +dependencies = [ + "chain-factory", + "multiversx-sc-wasm-adapter", +] + +[[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.52.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "526760b1d6236c011285b264a70a0a9dd3b3dbc53c3b5f76932f4bcfd3a8910c" +dependencies = [ + "bitflags", + "hex-literal", + "multiversx-sc-codec", + "multiversx-sc-derive", + "num-traits", + "unwrap-infallible", +] + +[[package]] +name = "multiversx-sc-codec" +version = "0.20.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ad4f318427761faecf26c1f3115a3beeb5f61858845a60547d9763aa981ddd2d" +dependencies = [ + "arrayvec", + "multiversx-sc-codec-derive", + "unwrap-infallible", +] + +[[package]] +name = "multiversx-sc-codec-derive" +version = "0.20.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "476501462b0c2654b64f9dec6f2c480e24b4e9b7133ec10b7167e64acda35d04" +dependencies = [ + "hex", + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "multiversx-sc-derive" +version = "0.52.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3557f2f12640a8a07fa6af66cc2a13b188c5b61bed72db22fe631fb3a60c3e96" +dependencies = [ + "hex", + "proc-macro2", + "quote", + "radix_trie", + "syn", +] + +[[package]] +name = "multiversx-sc-modules" +version = "0.52.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "61f5c29c6044f3dc9e866858feee625d7fae5604a68ac7bd66dec683eee97563" +dependencies = [ + "multiversx-sc", +] + +[[package]] +name = "multiversx-sc-wasm-adapter" +version = "0.52.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ed13aaca9cbdbc6911174cd3029e750a7563d85dd3daaa1107b1fd31c7f17245" +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.19" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "071dfc062690e90b734c0b2273ce72ad0ffa95f0c74596bc250dcfd960262841" +dependencies = [ + "autocfg", +] + +[[package]] +name = "proc-macro2" +version = "1.0.86" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5e719e8df665df0d1c8fbfd238015744736151d4445ec0836b8e628aae103b77" +dependencies = [ + "unicode-ident", +] + +[[package]] +name = "quote" +version = "1.0.36" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0fa76aaf39101c457836aec0ce2316dbdc3ab723cdda1c6bd4e6ad4208acaca7" +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.72" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dc4b9b9bf2add8093d3f2c0204471e951b2285580335de42f9d2534f3ae7a8af" +dependencies = [ + "proc-macro2", + "quote", + "unicode-ident", +] + +[[package]] +name = "transaction" +version = "0.0.0" +dependencies = [ + "multiversx-sc", +] + +[[package]] +name = "unicode-ident" +version = "1.0.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3354b9ac3fae1ff6755cb6db53683adb661634f67557942dea4facebec0fee4b" + +[[package]] +name = "unwrap-infallible" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "151ac09978d3c2862c4e39b557f4eceee2cc72150bc4cb4f16abf061b6e381fb" + +[[package]] +name = "utils" +version = "0.0.0" +dependencies = [ + "bls-signature", + "multiversx-sc", +] diff --git a/chain-factory/wasm-chain-factory-view/Cargo.toml b/chain-factory/wasm-chain-factory-view/Cargo.toml new file mode 100644 index 00000000..9ae6f348 --- /dev/null +++ b/chain-factory/wasm-chain-factory-view/Cargo.toml @@ -0,0 +1,34 @@ +# Code generated by the multiversx-sc build system. DO NOT EDIT. + +# ########################################## +# ############## AUTO-GENERATED ############# +# ########################################## + +[package] +name = "chain-factory-view-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 + +[profile.dev] +panic = "abort" + +[dependencies.chain-factory] +path = ".." + +[dependencies.multiversx-sc-wasm-adapter] +version = "=0.52.3" + +[workspace] +members = ["."] diff --git a/chain-factory/wasm-chain-factory-view/src/lib.rs b/chain-factory/wasm-chain-factory-view/src/lib.rs new file mode 100644 index 00000000..af98b8da --- /dev/null +++ b/chain-factory/wasm-chain-factory-view/src/lib.rs @@ -0,0 +1,25 @@ +// Code generated by the multiversx-sc build system. DO NOT EDIT. + +//////////////////////////////////////////////////// +////////////////// AUTO-GENERATED ////////////////// +//////////////////////////////////////////////////// + +// Init: 1 +// Endpoints: 0 +// Async Callback (empty): 1 +// Total number of exported functions: 2 + +#![no_std] + +multiversx_sc_wasm_adapter::allocator!(); +multiversx_sc_wasm_adapter::panic_handler!(); + +multiversx_sc_wasm_adapter::external_view_init! {} + +multiversx_sc_wasm_adapter::external_view_endpoints! { + chain_factory + ( + ) +} + +multiversx_sc_wasm_adapter::async_callback_empty! {} diff --git a/enshrine-esdt-safe/wasm-enshrine-esdt-safe-full/Cargo.lock b/enshrine-esdt-safe/wasm-enshrine-esdt-safe-full/Cargo.lock index fe9cbb64..e1367867 100644 --- a/enshrine-esdt-safe/wasm-enshrine-esdt-safe-full/Cargo.lock +++ b/enshrine-esdt-safe/wasm-enshrine-esdt-safe-full/Cargo.lock @@ -28,6 +28,24 @@ dependencies = [ "transaction", ] +[[package]] +name = "chain-config" +version = "0.0.0" +dependencies = [ + "multiversx-sc", + "multiversx-sc-modules", +] + +[[package]] +name = "chain-factory" +version = "0.0.0" +dependencies = [ + "bls-signature", + "chain-config", + "multiversx-sc", + "utils", +] + [[package]] name = "endian-type" version = "0.1.2" @@ -256,6 +274,7 @@ dependencies = [ name = "token-handler" version = "0.0.0" dependencies = [ + "chain-factory", "header-verifier", "multiversx-sc", "pair-mock", diff --git a/enshrine-esdt-safe/wasm-enshrine-esdt-safe-view/Cargo.lock b/enshrine-esdt-safe/wasm-enshrine-esdt-safe-view/Cargo.lock index 8467465c..20a3ebc3 100644 --- a/enshrine-esdt-safe/wasm-enshrine-esdt-safe-view/Cargo.lock +++ b/enshrine-esdt-safe/wasm-enshrine-esdt-safe-view/Cargo.lock @@ -28,6 +28,24 @@ dependencies = [ "transaction", ] +[[package]] +name = "chain-config" +version = "0.0.0" +dependencies = [ + "multiversx-sc", + "multiversx-sc-modules", +] + +[[package]] +name = "chain-factory" +version = "0.0.0" +dependencies = [ + "bls-signature", + "chain-config", + "multiversx-sc", + "utils", +] + [[package]] name = "endian-type" version = "0.1.2" @@ -256,6 +274,7 @@ dependencies = [ name = "token-handler" version = "0.0.0" dependencies = [ + "chain-factory", "header-verifier", "multiversx-sc", "pair-mock", diff --git a/enshrine-esdt-safe/wasm/Cargo.lock b/enshrine-esdt-safe/wasm/Cargo.lock index 5f02eee1..1965655e 100644 --- a/enshrine-esdt-safe/wasm/Cargo.lock +++ b/enshrine-esdt-safe/wasm/Cargo.lock @@ -28,6 +28,24 @@ dependencies = [ "transaction", ] +[[package]] +name = "chain-config" +version = "0.0.0" +dependencies = [ + "multiversx-sc", + "multiversx-sc-modules", +] + +[[package]] +name = "chain-factory" +version = "0.0.0" +dependencies = [ + "bls-signature", + "chain-config", + "multiversx-sc", + "utils", +] + [[package]] name = "endian-type" version = "0.1.2" @@ -256,6 +274,7 @@ dependencies = [ name = "token-handler" version = "0.0.0" dependencies = [ + "chain-factory", "header-verifier", "multiversx-sc", "pair-mock", diff --git a/pair-mock/wasm-pair-mock-full/Cargo.lock b/pair-mock/wasm-pair-mock-full/Cargo.lock new file mode 100644 index 00000000..08baa23b --- /dev/null +++ b/pair-mock/wasm-pair-mock-full/Cargo.lock @@ -0,0 +1,188 @@ +# 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.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b048fb63fd8b5923fc5aa7b340d8e156aec7ec02f0c78fa8a6ddc2613f6f71de" + +[[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.52.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "526760b1d6236c011285b264a70a0a9dd3b3dbc53c3b5f76932f4bcfd3a8910c" +dependencies = [ + "bitflags", + "hex-literal", + "multiversx-sc-codec", + "multiversx-sc-derive", + "num-traits", + "unwrap-infallible", +] + +[[package]] +name = "multiversx-sc-codec" +version = "0.20.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ad4f318427761faecf26c1f3115a3beeb5f61858845a60547d9763aa981ddd2d" +dependencies = [ + "arrayvec", + "multiversx-sc-codec-derive", + "unwrap-infallible", +] + +[[package]] +name = "multiversx-sc-codec-derive" +version = "0.20.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "476501462b0c2654b64f9dec6f2c480e24b4e9b7133ec10b7167e64acda35d04" +dependencies = [ + "hex", + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "multiversx-sc-derive" +version = "0.52.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3557f2f12640a8a07fa6af66cc2a13b188c5b61bed72db22fe631fb3a60c3e96" +dependencies = [ + "hex", + "proc-macro2", + "quote", + "radix_trie", + "syn", +] + +[[package]] +name = "multiversx-sc-wasm-adapter" +version = "0.52.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ed13aaca9cbdbc6911174cd3029e750a7563d85dd3daaa1107b1fd31c7f17245" +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.19" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "071dfc062690e90b734c0b2273ce72ad0ffa95f0c74596bc250dcfd960262841" +dependencies = [ + "autocfg", +] + +[[package]] +name = "pair-mock" +version = "0.0.0" +dependencies = [ + "multiversx-sc", +] + +[[package]] +name = "pair-mock-full-wasm" +version = "0.0.0" +dependencies = [ + "multiversx-sc-wasm-adapter", + "pair-mock", +] + +[[package]] +name = "proc-macro2" +version = "1.0.86" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5e719e8df665df0d1c8fbfd238015744736151d4445ec0836b8e628aae103b77" +dependencies = [ + "unicode-ident", +] + +[[package]] +name = "quote" +version = "1.0.36" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0fa76aaf39101c457836aec0ce2316dbdc3ab723cdda1c6bd4e6ad4208acaca7" +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.72" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dc4b9b9bf2add8093d3f2c0204471e951b2285580335de42f9d2534f3ae7a8af" +dependencies = [ + "proc-macro2", + "quote", + "unicode-ident", +] + +[[package]] +name = "unicode-ident" +version = "1.0.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3354b9ac3fae1ff6755cb6db53683adb661634f67557942dea4facebec0fee4b" + +[[package]] +name = "unwrap-infallible" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "151ac09978d3c2862c4e39b557f4eceee2cc72150bc4cb4f16abf061b6e381fb" diff --git a/pair-mock/wasm-pair-mock-view/Cargo.lock b/pair-mock/wasm-pair-mock-view/Cargo.lock new file mode 100644 index 00000000..e8edd028 --- /dev/null +++ b/pair-mock/wasm-pair-mock-view/Cargo.lock @@ -0,0 +1,188 @@ +# 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.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b048fb63fd8b5923fc5aa7b340d8e156aec7ec02f0c78fa8a6ddc2613f6f71de" + +[[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.52.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "526760b1d6236c011285b264a70a0a9dd3b3dbc53c3b5f76932f4bcfd3a8910c" +dependencies = [ + "bitflags", + "hex-literal", + "multiversx-sc-codec", + "multiversx-sc-derive", + "num-traits", + "unwrap-infallible", +] + +[[package]] +name = "multiversx-sc-codec" +version = "0.20.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ad4f318427761faecf26c1f3115a3beeb5f61858845a60547d9763aa981ddd2d" +dependencies = [ + "arrayvec", + "multiversx-sc-codec-derive", + "unwrap-infallible", +] + +[[package]] +name = "multiversx-sc-codec-derive" +version = "0.20.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "476501462b0c2654b64f9dec6f2c480e24b4e9b7133ec10b7167e64acda35d04" +dependencies = [ + "hex", + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "multiversx-sc-derive" +version = "0.52.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3557f2f12640a8a07fa6af66cc2a13b188c5b61bed72db22fe631fb3a60c3e96" +dependencies = [ + "hex", + "proc-macro2", + "quote", + "radix_trie", + "syn", +] + +[[package]] +name = "multiversx-sc-wasm-adapter" +version = "0.52.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ed13aaca9cbdbc6911174cd3029e750a7563d85dd3daaa1107b1fd31c7f17245" +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.19" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "071dfc062690e90b734c0b2273ce72ad0ffa95f0c74596bc250dcfd960262841" +dependencies = [ + "autocfg", +] + +[[package]] +name = "pair-mock" +version = "0.0.0" +dependencies = [ + "multiversx-sc", +] + +[[package]] +name = "pair-mock-view-wasm" +version = "0.0.0" +dependencies = [ + "multiversx-sc-wasm-adapter", + "pair-mock", +] + +[[package]] +name = "proc-macro2" +version = "1.0.86" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5e719e8df665df0d1c8fbfd238015744736151d4445ec0836b8e628aae103b77" +dependencies = [ + "unicode-ident", +] + +[[package]] +name = "quote" +version = "1.0.36" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0fa76aaf39101c457836aec0ce2316dbdc3ab723cdda1c6bd4e6ad4208acaca7" +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.72" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dc4b9b9bf2add8093d3f2c0204471e951b2285580335de42f9d2534f3ae7a8af" +dependencies = [ + "proc-macro2", + "quote", + "unicode-ident", +] + +[[package]] +name = "unicode-ident" +version = "1.0.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3354b9ac3fae1ff6755cb6db53683adb661634f67557942dea4facebec0fee4b" + +[[package]] +name = "unwrap-infallible" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "151ac09978d3c2862c4e39b557f4eceee2cc72150bc4cb4f16abf061b6e381fb" diff --git a/token-handler/Cargo.toml b/token-handler/Cargo.toml index a991fdbe..ec608a29 100644 --- a/token-handler/Cargo.toml +++ b/token-handler/Cargo.toml @@ -14,6 +14,9 @@ path = "../common/transaction" [dependencies.header-verifier] path = "../header-verifier/" +[dependencies.chain-factory] +path = "../chain-factory/" + [dependencies.pair-mock] path = "../pair-mock/" diff --git a/token-handler/src/chain_factory_proxy.rs b/token-handler/src/chain_factory_proxy.rs new file mode 100644 index 00000000..72b70ba6 --- /dev/null +++ b/token-handler/src/chain_factory_proxy.rs @@ -0,0 +1,204 @@ +// Code generated by the multiversx-sc proxy generator. DO NOT EDIT. + +//////////////////////////////////////////////////// +////////////////// AUTO-GENERATED ////////////////// +//////////////////////////////////////////////////// + +#![allow(dead_code)] +#![allow(clippy::all)] + +use multiversx_sc::proxy_imports::*; + +pub struct ChainFactoryContractProxy; + +impl TxProxyTrait for ChainFactoryContractProxy +where + Env: TxEnv, + From: TxFrom, + To: TxTo, + Gas: TxGas, +{ + type TxProxyMethods = ChainFactoryContractProxyMethods; + + fn proxy_methods(self, tx: Tx) -> Self::TxProxyMethods { + ChainFactoryContractProxyMethods { wrapped_tx: tx } + } +} + +pub struct ChainFactoryContractProxyMethods +where + Env: TxEnv, + From: TxFrom, + To: TxTo, + Gas: TxGas, +{ + wrapped_tx: Tx, +} + +#[rustfmt::skip] +impl ChainFactoryContractProxyMethods +where + Env: TxEnv, + Env::Api: VMApi, + From: TxFrom, + Gas: TxGas, +{ + pub fn init< + Arg0: ProxyArg>, + Arg1: ProxyArg>, + Arg2: ProxyArg>, + >( + self, + validators_contract_address: Arg0, + chain_config_template: Arg1, + deploy_cost: Arg2, + ) -> TxTypedDeploy { + self.wrapped_tx + .payment(NotPayable) + .raw_deploy() + .argument(&validators_contract_address) + .argument(&chain_config_template) + .argument(&deploy_cost) + .original_result() + } +} + +#[rustfmt::skip] +impl ChainFactoryContractProxyMethods +where + Env: TxEnv, + Env::Api: VMApi, + From: TxFrom, + To: TxTo, + Gas: TxGas, +{ + pub fn upgrade( + self, + ) -> TxTypedUpgrade { + self.wrapped_tx + .payment(NotPayable) + .raw_upgrade() + .original_result() + } +} + +#[rustfmt::skip] +impl ChainFactoryContractProxyMethods +where + Env: TxEnv, + Env::Api: VMApi, + From: TxFrom, + To: TxTo, + Gas: TxGas, +{ + pub fn deploy_sovereign_chain_config_contract< + Arg0: ProxyArg, + Arg1: ProxyArg, + Arg2: ProxyArg>, + Arg3: ProxyArg, BigUint>>>, + >( + self, + min_validators: Arg0, + max_validators: Arg1, + min_stake: Arg2, + additional_stake_required: Arg3, + ) -> TxTypedCall { + self.wrapped_tx + .raw_call("deploySovereignChainConfigContract") + .argument(&min_validators) + .argument(&max_validators) + .argument(&min_stake) + .argument(&additional_stake_required) + .original_result() + } + + pub fn blacklist_sovereign_chain_sc< + Arg0: ProxyArg>, + >( + self, + sc_address: Arg0, + ) -> TxTypedCall { + self.wrapped_tx + .payment(NotPayable) + .raw_call("blacklistSovereignChainSc") + .argument(&sc_address) + .original_result() + } + + pub fn deploy_cost( + self, + ) -> TxTypedCall> { + self.wrapped_tx + .payment(NotPayable) + .raw_call("getDeployCost") + .original_result() + } + + pub fn slash< + Arg0: ProxyArg>, + Arg1: ProxyArg>, + >( + self, + validator_address: Arg0, + value: Arg1, + ) -> TxTypedCall { + self.wrapped_tx + .payment(NotPayable) + .raw_call("slash") + .argument(&validator_address) + .argument(&value) + .original_result() + } + + pub fn distribute_slashed< + Arg0: ProxyArg, BigUint>>>, + >( + self, + dest_amount_pairs: Arg0, + ) -> TxTypedCall { + self.wrapped_tx + .payment(NotPayable) + .raw_call("distributeSlashed") + .argument(&dest_amount_pairs) + .original_result() + } + + pub fn set_min_valid_signers< + Arg0: ProxyArg, + >( + self, + new_value: Arg0, + ) -> TxTypedCall { + self.wrapped_tx + .payment(NotPayable) + .raw_call("setMinValidSigners") + .argument(&new_value) + .original_result() + } + + pub fn add_signers< + Arg0: ProxyArg>>, + >( + self, + signers: Arg0, + ) -> TxTypedCall { + self.wrapped_tx + .payment(NotPayable) + .raw_call("addSigners") + .argument(&signers) + .original_result() + } + + pub fn remove_signers< + Arg0: ProxyArg>>, + >( + self, + signers: Arg0, + ) -> TxTypedCall { + self.wrapped_tx + .payment(NotPayable) + .raw_call("removeSigners") + .argument(&signers) + .original_result() + } +} diff --git a/token-handler/src/lib.rs b/token-handler/src/lib.rs index 4dc06dfb..5d408459 100644 --- a/token-handler/src/lib.rs +++ b/token-handler/src/lib.rs @@ -3,6 +3,7 @@ #[allow(unused_imports)] use multiversx_sc::imports::*; +pub mod chain_factory_proxy; pub mod common_storage; pub mod dummy_enshrine_proxy; pub mod token_handler_proxy; diff --git a/token-handler/tests/token_handler_blackbox_tests.rs b/token-handler/tests/token_handler_blackbox_tests.rs index 5204793f..1123e759 100644 --- a/token-handler/tests/token_handler_blackbox_tests.rs +++ b/token-handler/tests/token_handler_blackbox_tests.rs @@ -1,10 +1,10 @@ use multiversx_sc::types::{ - BigUint, EsdtTokenData, EsdtTokenPayment, ManagedAddress, ManagedBuffer, MultiValueEncoded, - TestAddress, TestSCAddress, TestTokenIdentifier, + BigUint, EsdtLocalRole, EsdtTokenData, EsdtTokenPayment, ManagedAddress, ManagedBuffer, + MultiValueEncoded, TestAddress, TestSCAddress, TestTokenIdentifier, }; use multiversx_sc_scenario::{api::StaticApi, imports::MxscPath, ScenarioWorld}; use multiversx_sc_scenario::{ExpectError, ScenarioTxRun}; -use token_handler::{dummy_enshrine_proxy, token_handler_proxy}; +use token_handler::{chain_factory_proxy, token_handler_proxy}; use transaction::{OperationEsdtPayment, TransferData}; const TOKEN_HANDLER_ADDRESS: TestSCAddress = TestSCAddress::new("token-handler"); @@ -13,8 +13,9 @@ const OWNER_ADDRESS: TestAddress = TestAddress::new("token-handler-owner"); const USER_ADDRESS: TestAddress = TestAddress::new("user"); -const DUMMY_ENSRHINE_ADDRESS: TestSCAddress = TestSCAddress::new("enshrine"); -const DUMMY_ENSHRINE_CODE_PATH: MxscPath = MxscPath::new("../pair-mock/output/pair-mock.mxsc.json"); +const FACTORY_ADDRESS: TestSCAddress = TestSCAddress::new("factorySC"); +const FACTORY_CODE_PATH: MxscPath = + MxscPath::new("../chain-factory/output/chain-factory.mxsc.json"); const NFT_TOKEN_ID: TestTokenIdentifier = TestTokenIdentifier::new("NFT-123456"); const CROWD_TOKEN_ID: TestTokenIdentifier = TestTokenIdentifier::new("CROWD-123456"); @@ -32,7 +33,7 @@ fn world() -> ScenarioWorld { let mut blockchain = ScenarioWorld::new(); blockchain.register_contract(TOKEN_HANDLER_CODE_PATH, token_handler::ContractBuilder); - blockchain.register_contract(DUMMY_ENSHRINE_CODE_PATH, pair_mock::ContractBuilder); + blockchain.register_contract(FACTORY_CODE_PATH, chain_factory::ContractBuilder); blockchain } @@ -77,14 +78,14 @@ impl TokenHandlerTestState { self } - fn propose_deploy_dummy_enshrine(&mut self) -> &mut Self { + fn propose_deploy_factory_sc(&mut self) -> &mut Self { self.world .tx() .from(OWNER_ADDRESS) - .typed(dummy_enshrine_proxy::PairMockProxy) - .init(NFT_TOKEN_ID) - .code(DUMMY_ENSHRINE_CODE_PATH) - .new_address(DUMMY_ENSRHINE_ADDRESS) + .typed(chain_factory_proxy::ChainFactoryContractProxy) + .init(FACTORY_ADDRESS, FACTORY_ADDRESS, BigUint::from(10u32)) + .code(FACTORY_CODE_PATH) + .new_address(FACTORY_ADDRESS) .run(); self @@ -107,6 +108,7 @@ impl TokenHandlerTestState { .typed(token_handler_proxy::TokenHandlerProxy) .transfer_tokens(opt_transfer_data, to, tokens) .multi_esdt(payment) + .returns(ExpectError(10, "action is not allowed")) .run(), Option::None => self .world @@ -115,6 +117,7 @@ impl TokenHandlerTestState { .to(TOKEN_HANDLER_ADDRESS) .typed(token_handler_proxy::TokenHandlerProxy) .transfer_tokens(opt_transfer_data, to, tokens) + .returns(ExpectError(10, "action is not allowed")) .run(), } } @@ -172,7 +175,7 @@ fn test_deploy() { let mut state = TokenHandlerTestState::new(); state.propose_deploy_token_handler(); - state.propose_deploy_dummy_enshrine(); + state.propose_deploy_factory_sc(); } #[test] @@ -184,7 +187,7 @@ fn test_whitelist_ensrhine_esdt_caller_not_owner() { }; state.propose_deploy_token_handler(); - state.propose_whitelist_caller(USER_ADDRESS, DUMMY_ENSRHINE_ADDRESS, Some(error)); + state.propose_whitelist_caller(USER_ADDRESS, FACTORY_ADDRESS, Some(error)); } #[test] @@ -192,9 +195,12 @@ fn test_whitelist_ensrhine() { let mut state = TokenHandlerTestState::new(); state.propose_deploy_token_handler(); - state.propose_whitelist_caller(OWNER_ADDRESS, DUMMY_ENSRHINE_ADDRESS, None); + state.propose_whitelist_caller(OWNER_ADDRESS, FACTORY_ADDRESS, None); } +//TODO: +// Use byte array instead of TestTokenIdentifier in test +// and create the TestTokenIndetifiers in helper functions #[test] fn test_transfer_tokens_no_payment() { let mut state = TokenHandlerTestState::new(); @@ -204,55 +210,29 @@ fn test_transfer_tokens_no_payment() { let opt_transfer_data = Option::None; state.propose_deploy_token_handler(); - state.propose_deploy_dummy_enshrine(); + state.propose_deploy_factory_sc(); state .world - .set_esdt_balance(DUMMY_ENSRHINE_ADDRESS, b"NFT_TOKEN_ID", 100); + .set_esdt_balance(FACTORY_ADDRESS, b"NFT_TOKEN_ID", 100); state .world - .set_esdt_balance(DUMMY_ENSRHINE_ADDRESS, b"FUNGIBLE_TOKEN_ID", 100); - - state.propose_whitelist_caller(OWNER_ADDRESS, DUMMY_ENSRHINE_ADDRESS, None); - - state.propose_transfer_tokens( - DUMMY_ENSRHINE_ADDRESS, - esdt_payment, - opt_transfer_data, - USER_ADDRESS.to_managed_address(), - tokens, + .set_esdt_balance(FACTORY_ADDRESS, b"FUNGIBLE_TOKEN_ID", 100); + + state.propose_whitelist_caller(OWNER_ADDRESS, FACTORY_ADDRESS, None); + + state.world.set_esdt_local_roles( + TOKEN_HANDLER_ADDRESS, + b"NFT_TOKEN_ID", + &[ + EsdtLocalRole::NftCreate, + EsdtLocalRole::Mint, + EsdtLocalRole::NftBurn, + ], ); - state - .world - .check_account(TOKEN_HANDLER_ADDRESS) - .esdt_balance(FUNGIBLE_TOKEN_ID, 0); -} - -#[test] -fn test_transfer_tokens_fungible_payment() { - let mut state = TokenHandlerTestState::new(); - let token_ids = [NFT_TOKEN_ID, FUNGIBLE_TOKEN_ID]; - let tokens = state.setup_payments(&token_ids.to_vec()); - let esdt_payment = Option::Some(EsdtTokenPayment { - token_identifier: FUNGIBLE_TOKEN_ID.into(), - token_nonce: 0, - amount: BigUint::from(100u64), - }); - let opt_transfer_data = Option::None; - - state.propose_deploy_token_handler(); - state.propose_deploy_dummy_enshrine(); - - state - .world - .set_esdt_balance(DUMMY_ENSRHINE_ADDRESS, b"NFT_TOKEN_ID", 100); - state - .world - .set_esdt_balance(DUMMY_ENSRHINE_ADDRESS, b"FUNGIBLE_TOKEN_ID", 200); - state.propose_transfer_tokens( - DUMMY_ENSRHINE_ADDRESS, + FACTORY_ADDRESS, esdt_payment, opt_transfer_data, USER_ADDRESS.to_managed_address(), @@ -262,5 +242,5 @@ fn test_transfer_tokens_fungible_payment() { state .world .check_account(TOKEN_HANDLER_ADDRESS) - .esdt_balance(FUNGIBLE_TOKEN_ID, 100); + .esdt_balance(FUNGIBLE_TOKEN_ID, 0); } diff --git a/token-handler/wasm-token-handler-full/Cargo.lock b/token-handler/wasm-token-handler-full/Cargo.lock index 98fc8e7f..056b118c 100644 --- a/token-handler/wasm-token-handler-full/Cargo.lock +++ b/token-handler/wasm-token-handler-full/Cargo.lock @@ -28,6 +28,24 @@ dependencies = [ "transaction", ] +[[package]] +name = "chain-config" +version = "0.0.0" +dependencies = [ + "multiversx-sc", + "multiversx-sc-modules", +] + +[[package]] +name = "chain-factory" +version = "0.0.0" +dependencies = [ + "bls-signature", + "chain-config", + "multiversx-sc", + "utils", +] + [[package]] name = "endian-type" version = "0.1.2" @@ -105,6 +123,15 @@ dependencies = [ "syn", ] +[[package]] +name = "multiversx-sc-modules" +version = "0.52.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "61f5c29c6044f3dc9e866858feee625d7fae5604a68ac7bd66dec683eee97563" +dependencies = [ + "multiversx-sc", +] + [[package]] name = "multiversx-sc-wasm-adapter" version = "0.52.3" @@ -188,6 +215,7 @@ dependencies = [ name = "token-handler" version = "0.0.0" dependencies = [ + "chain-factory", "header-verifier", "multiversx-sc", "pair-mock", @@ -220,3 +248,11 @@ name = "unwrap-infallible" version = "0.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "151ac09978d3c2862c4e39b557f4eceee2cc72150bc4cb4f16abf061b6e381fb" + +[[package]] +name = "utils" +version = "0.0.0" +dependencies = [ + "bls-signature", + "multiversx-sc", +] diff --git a/token-handler/wasm-token-handler-view/Cargo.lock b/token-handler/wasm-token-handler-view/Cargo.lock index 22e2fb93..46297402 100644 --- a/token-handler/wasm-token-handler-view/Cargo.lock +++ b/token-handler/wasm-token-handler-view/Cargo.lock @@ -28,6 +28,24 @@ dependencies = [ "transaction", ] +[[package]] +name = "chain-config" +version = "0.0.0" +dependencies = [ + "multiversx-sc", + "multiversx-sc-modules", +] + +[[package]] +name = "chain-factory" +version = "0.0.0" +dependencies = [ + "bls-signature", + "chain-config", + "multiversx-sc", + "utils", +] + [[package]] name = "endian-type" version = "0.1.2" @@ -105,6 +123,15 @@ dependencies = [ "syn", ] +[[package]] +name = "multiversx-sc-modules" +version = "0.52.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "61f5c29c6044f3dc9e866858feee625d7fae5604a68ac7bd66dec683eee97563" +dependencies = [ + "multiversx-sc", +] + [[package]] name = "multiversx-sc-wasm-adapter" version = "0.52.3" @@ -188,6 +215,7 @@ dependencies = [ name = "token-handler" version = "0.0.0" dependencies = [ + "chain-factory", "header-verifier", "multiversx-sc", "pair-mock", @@ -220,3 +248,11 @@ name = "unwrap-infallible" version = "0.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "151ac09978d3c2862c4e39b557f4eceee2cc72150bc4cb4f16abf061b6e381fb" + +[[package]] +name = "utils" +version = "0.0.0" +dependencies = [ + "bls-signature", + "multiversx-sc", +] diff --git a/token-handler/wasm/Cargo.lock b/token-handler/wasm/Cargo.lock index b5f395be..790b094f 100644 --- a/token-handler/wasm/Cargo.lock +++ b/token-handler/wasm/Cargo.lock @@ -28,6 +28,24 @@ dependencies = [ "transaction", ] +[[package]] +name = "chain-config" +version = "0.0.0" +dependencies = [ + "multiversx-sc", + "multiversx-sc-modules", +] + +[[package]] +name = "chain-factory" +version = "0.0.0" +dependencies = [ + "bls-signature", + "chain-config", + "multiversx-sc", + "utils", +] + [[package]] name = "endian-type" version = "0.1.2" @@ -105,6 +123,15 @@ dependencies = [ "syn", ] +[[package]] +name = "multiversx-sc-modules" +version = "0.52.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "61f5c29c6044f3dc9e866858feee625d7fae5604a68ac7bd66dec683eee97563" +dependencies = [ + "multiversx-sc", +] + [[package]] name = "multiversx-sc-wasm-adapter" version = "0.52.3" @@ -188,6 +215,7 @@ dependencies = [ name = "token-handler" version = "0.0.0" dependencies = [ + "chain-factory", "header-verifier", "multiversx-sc", "pair-mock", @@ -220,3 +248,11 @@ name = "unwrap-infallible" version = "0.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "151ac09978d3c2862c4e39b557f4eceee2cc72150bc4cb4f16abf061b6e381fb" + +[[package]] +name = "utils" +version = "0.0.0" +dependencies = [ + "bls-signature", + "multiversx-sc", +] From ffeba32ba507d076d46e257d2f0ebdc2a3dbc836 Mon Sep 17 00:00:00 2001 From: Andrei Baltariu Date: Wed, 7 Aug 2024 17:08:34 +0300 Subject: [PATCH 271/523] Added NOTE instead of TODO Signed-off-by: Andrei Baltariu --- token-handler/tests/token_handler_blackbox_tests.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/token-handler/tests/token_handler_blackbox_tests.rs b/token-handler/tests/token_handler_blackbox_tests.rs index 1123e759..5bc5b2db 100644 --- a/token-handler/tests/token_handler_blackbox_tests.rs +++ b/token-handler/tests/token_handler_blackbox_tests.rs @@ -198,9 +198,9 @@ fn test_whitelist_ensrhine() { state.propose_whitelist_caller(OWNER_ADDRESS, FACTORY_ADDRESS, None); } -//TODO: -// Use byte array instead of TestTokenIdentifier in test -// and create the TestTokenIndetifiers in helper functions +// NOTE: +// This test at the moment is expected to fail since there is no way +// to give the correct permissions to the TokenHandler SC #[test] fn test_transfer_tokens_no_payment() { let mut state = TokenHandlerTestState::new(); From 5646db8e8dafbc0def14edbf695727554e79c08c Mon Sep 17 00:00:00 2001 From: Andrei Baltariu Date: Wed, 7 Aug 2024 17:44:25 +0300 Subject: [PATCH 272/523] Built contracts + remove pair depedency Signed-off-by: Andrei Baltariu --- Cargo.lock | 1 - .../wasm-enshrine-esdt-safe-full/Cargo.lock | 1 - .../wasm-enshrine-esdt-safe-view/Cargo.lock | 1 - enshrine-esdt-safe/wasm/Cargo.lock | 1 - token-handler/Cargo.toml | 3 --- token-handler/wasm-token-handler-full/Cargo.lock | 8 -------- token-handler/wasm-token-handler-view/Cargo.lock | 8 -------- token-handler/wasm/Cargo.lock | 8 -------- 8 files changed, 31 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 20fde71e..07e62d64 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1031,7 +1031,6 @@ dependencies = [ "multiversx-sc", "multiversx-sc-scenario", "num-bigint", - "pair-mock", "transaction", ] diff --git a/enshrine-esdt-safe/wasm-enshrine-esdt-safe-full/Cargo.lock b/enshrine-esdt-safe/wasm-enshrine-esdt-safe-full/Cargo.lock index 18e699bd..5a223154 100644 --- a/enshrine-esdt-safe/wasm-enshrine-esdt-safe-full/Cargo.lock +++ b/enshrine-esdt-safe/wasm-enshrine-esdt-safe-full/Cargo.lock @@ -261,7 +261,6 @@ dependencies = [ "chain-factory", "header-verifier", "multiversx-sc", - "pair-mock", "transaction", ] diff --git a/enshrine-esdt-safe/wasm-enshrine-esdt-safe-view/Cargo.lock b/enshrine-esdt-safe/wasm-enshrine-esdt-safe-view/Cargo.lock index 40b4ea47..c96735c7 100644 --- a/enshrine-esdt-safe/wasm-enshrine-esdt-safe-view/Cargo.lock +++ b/enshrine-esdt-safe/wasm-enshrine-esdt-safe-view/Cargo.lock @@ -261,7 +261,6 @@ dependencies = [ "chain-factory", "header-verifier", "multiversx-sc", - "pair-mock", "transaction", ] diff --git a/enshrine-esdt-safe/wasm/Cargo.lock b/enshrine-esdt-safe/wasm/Cargo.lock index 734d0f68..6fb3155b 100644 --- a/enshrine-esdt-safe/wasm/Cargo.lock +++ b/enshrine-esdt-safe/wasm/Cargo.lock @@ -261,7 +261,6 @@ dependencies = [ "chain-factory", "header-verifier", "multiversx-sc", - "pair-mock", "transaction", ] diff --git a/token-handler/Cargo.toml b/token-handler/Cargo.toml index ec608a29..0c6880a4 100644 --- a/token-handler/Cargo.toml +++ b/token-handler/Cargo.toml @@ -17,9 +17,6 @@ path = "../header-verifier/" [dependencies.chain-factory] path = "../chain-factory/" -[dependencies.pair-mock] -path = "../pair-mock/" - [dependencies.multiversx-sc] version = "0.52.3" diff --git a/token-handler/wasm-token-handler-full/Cargo.lock b/token-handler/wasm-token-handler-full/Cargo.lock index 056b118c..bc23486f 100644 --- a/token-handler/wasm-token-handler-full/Cargo.lock +++ b/token-handler/wasm-token-handler-full/Cargo.lock @@ -159,13 +159,6 @@ dependencies = [ "autocfg", ] -[[package]] -name = "pair-mock" -version = "0.0.0" -dependencies = [ - "multiversx-sc", -] - [[package]] name = "proc-macro2" version = "1.0.86" @@ -218,7 +211,6 @@ dependencies = [ "chain-factory", "header-verifier", "multiversx-sc", - "pair-mock", "transaction", ] diff --git a/token-handler/wasm-token-handler-view/Cargo.lock b/token-handler/wasm-token-handler-view/Cargo.lock index 46297402..28880238 100644 --- a/token-handler/wasm-token-handler-view/Cargo.lock +++ b/token-handler/wasm-token-handler-view/Cargo.lock @@ -159,13 +159,6 @@ dependencies = [ "autocfg", ] -[[package]] -name = "pair-mock" -version = "0.0.0" -dependencies = [ - "multiversx-sc", -] - [[package]] name = "proc-macro2" version = "1.0.86" @@ -218,7 +211,6 @@ dependencies = [ "chain-factory", "header-verifier", "multiversx-sc", - "pair-mock", "transaction", ] diff --git a/token-handler/wasm/Cargo.lock b/token-handler/wasm/Cargo.lock index 790b094f..cdafc170 100644 --- a/token-handler/wasm/Cargo.lock +++ b/token-handler/wasm/Cargo.lock @@ -159,13 +159,6 @@ dependencies = [ "autocfg", ] -[[package]] -name = "pair-mock" -version = "0.0.0" -dependencies = [ - "multiversx-sc", -] - [[package]] name = "proc-macro2" version = "1.0.86" @@ -218,7 +211,6 @@ dependencies = [ "chain-factory", "header-verifier", "multiversx-sc", - "pair-mock", "transaction", ] From 17b4726870580736aa85efc607057215e220a31e Mon Sep 17 00:00:00 2001 From: Andrei Baltariu Date: Wed, 14 Aug 2024 08:52:26 +0300 Subject: [PATCH 273/523] Removed unnecessary arguments Signed-off-by: Andrei Baltariu --- esdt-safe/tests/bridge_blackbox_tests.rs | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/esdt-safe/tests/bridge_blackbox_tests.rs b/esdt-safe/tests/bridge_blackbox_tests.rs index ac0d11d0..c79b58c6 100644 --- a/esdt-safe/tests/bridge_blackbox_tests.rs +++ b/esdt-safe/tests/bridge_blackbox_tests.rs @@ -98,19 +98,11 @@ impl BridgeTestState { } fn deploy_fee_market_contract(&mut self) -> &mut Self { - let usdc_token_id = TestTokenIdentifier::new("USDC"); - let wegld_token_id = TestTokenIdentifier::new("WEGLD"); - self.world .tx() .from(BRIDGE_OWNER_ADDRESS) .typed(fee_market_proxy::FeeMarketProxy) - .init( - BRIDGE_ADDRESS, - PRICE_AGGREGATOR_ADDRESS, - usdc_token_id, - wegld_token_id, - ) + .init(BRIDGE_ADDRESS, PRICE_AGGREGATOR_ADDRESS) .code(FEE_MARKET_CODE_PATH) .new_address(FEE_MARKET_ADDRESS) .run(); From 57db8468e1aaf61aca208a78c1547ddefa1430f6 Mon Sep 17 00:00:00 2001 From: Andrei Baltariu Date: Mon, 19 Aug 2024 09:27:46 +0300 Subject: [PATCH 274/523] Removed mock SCs Signed-off-by: Andrei Baltariu --- pair-mock/Cargo.toml | 18 -- pair-mock/meta/Cargo.toml | 12 -- pair-mock/meta/src/main.rs | 3 - pair-mock/sc-config.toml | 22 -- pair-mock/src/pair_mock_proxy.rs | 87 -------- pair-mock/tests/pair_mock_scenario_rs_test.rs | 17 -- pair-mock/wasm-pair-mock-full/Cargo.lock | 188 ------------------ pair-mock/wasm-pair-mock-full/Cargo.toml | 34 ---- pair-mock/wasm-pair-mock-full/src/lib.rs | 25 --- pair-mock/wasm-pair-mock-view/Cargo.lock | 188 ------------------ pair-mock/wasm-pair-mock-view/Cargo.toml | 34 ---- pair-mock/wasm-pair-mock-view/src/lib.rs | 25 --- pair-mock/wasm/Cargo.lock | 188 ------------------ pair-mock/wasm/Cargo.toml | 34 ---- router-mock/Cargo.toml | 18 -- router-mock/meta/Cargo.toml | 12 -- router-mock/meta/src/main.rs | 3 - .../tests/router_mock_scenario_rs_test.rs | 17 -- router-mock/wasm/Cargo.lock | 188 ------------------ router-mock/wasm/Cargo.toml | 34 ---- 20 files changed, 1147 deletions(-) delete mode 100644 pair-mock/Cargo.toml delete mode 100644 pair-mock/meta/Cargo.toml delete mode 100644 pair-mock/meta/src/main.rs delete mode 100644 pair-mock/sc-config.toml delete mode 100644 pair-mock/src/pair_mock_proxy.rs delete mode 100644 pair-mock/tests/pair_mock_scenario_rs_test.rs delete mode 100644 pair-mock/wasm-pair-mock-full/Cargo.lock delete mode 100644 pair-mock/wasm-pair-mock-full/Cargo.toml delete mode 100644 pair-mock/wasm-pair-mock-full/src/lib.rs delete mode 100644 pair-mock/wasm-pair-mock-view/Cargo.lock delete mode 100644 pair-mock/wasm-pair-mock-view/Cargo.toml delete mode 100644 pair-mock/wasm-pair-mock-view/src/lib.rs delete mode 100644 pair-mock/wasm/Cargo.lock delete mode 100644 pair-mock/wasm/Cargo.toml delete mode 100644 router-mock/Cargo.toml delete mode 100644 router-mock/meta/Cargo.toml delete mode 100644 router-mock/meta/src/main.rs delete mode 100644 router-mock/tests/router_mock_scenario_rs_test.rs delete mode 100644 router-mock/wasm/Cargo.lock delete mode 100644 router-mock/wasm/Cargo.toml diff --git a/pair-mock/Cargo.toml b/pair-mock/Cargo.toml deleted file mode 100644 index e43474ba..00000000 --- a/pair-mock/Cargo.toml +++ /dev/null @@ -1,18 +0,0 @@ -[package] -name = "pair-mock" -version = "0.0.0" -authors = ["you"] -edition = "2021" -publish = false - -[lib] -path = "src/pair_mock.rs" - -[dependencies.multiversx-sc] -version = "0.52.3" - -[dev-dependencies] -num-bigint = "0.4" - -[dev-dependencies.multiversx-sc-scenario] -version = "0.52.3" diff --git a/pair-mock/meta/Cargo.toml b/pair-mock/meta/Cargo.toml deleted file mode 100644 index be84cf5b..00000000 --- a/pair-mock/meta/Cargo.toml +++ /dev/null @@ -1,12 +0,0 @@ -[package] -name = "pair-mock-meta" -version = "0.0.0" -edition = "2021" -publish = false - -[dependencies.pair-mock] -path = ".." - -[dependencies.multiversx-sc-meta-lib] -version = "0.52.3" -default-features = false diff --git a/pair-mock/meta/src/main.rs b/pair-mock/meta/src/main.rs deleted file mode 100644 index 17e5421a..00000000 --- a/pair-mock/meta/src/main.rs +++ /dev/null @@ -1,3 +0,0 @@ -fn main() { - multiversx_sc_meta_lib::cli_main::(); -} diff --git a/pair-mock/sc-config.toml b/pair-mock/sc-config.toml deleted file mode 100644 index 9fcdabe3..00000000 --- a/pair-mock/sc-config.toml +++ /dev/null @@ -1,22 +0,0 @@ -[settings] -main = "main" - -[contracts.main] -name = "pair-mock" - -[contracts.full] -name = "pair-mock-full" -add-unlabelled = true -add-labels = ["pair-mock-external-view"] - -[contracts.view] -name = "pair-mock-view" -external-view = true -add-unlabelled = false -add-labels = ["pair-mock-external-view"] - -[[proxy]] -path = "src/pair_mock_proxy.rs" - -[[proxy]] -path = "../token-handler/src/dummy_enshrine_proxy.rs" diff --git a/pair-mock/src/pair_mock_proxy.rs b/pair-mock/src/pair_mock_proxy.rs deleted file mode 100644 index c51cfd2c..00000000 --- a/pair-mock/src/pair_mock_proxy.rs +++ /dev/null @@ -1,87 +0,0 @@ -// Code generated by the multiversx-sc proxy generator. DO NOT EDIT. - -//////////////////////////////////////////////////// -////////////////// AUTO-GENERATED ////////////////// -//////////////////////////////////////////////////// - -#![allow(dead_code)] -#![allow(clippy::all)] - -use multiversx_sc::proxy_imports::*; - -pub struct PairMockProxy; - -impl TxProxyTrait for PairMockProxy -where - Env: TxEnv, - From: TxFrom, - To: TxTo, - Gas: TxGas, -{ - type TxProxyMethods = PairMockProxyMethods; - - fn proxy_methods(self, tx: Tx) -> Self::TxProxyMethods { - PairMockProxyMethods { wrapped_tx: tx } - } -} - -pub struct PairMockProxyMethods -where - Env: TxEnv, - From: TxFrom, - To: TxTo, - Gas: TxGas, -{ - wrapped_tx: Tx, -} - -#[rustfmt::skip] -impl PairMockProxyMethods -where - Env: TxEnv, - Env::Api: VMApi, - From: TxFrom, - Gas: TxGas, -{ - pub fn init< - Arg0: ProxyArg>, - >( - self, - usdc_token_id: Arg0, - ) -> TxTypedDeploy { - self.wrapped_tx - .payment(NotPayable) - .raw_deploy() - .argument(&usdc_token_id) - .original_result() - } -} - -#[rustfmt::skip] -impl PairMockProxyMethods -where - Env: TxEnv, - Env::Api: VMApi, - From: TxFrom, - To: TxTo, - Gas: TxGas, -{ - pub fn get_safe_price_by_timestamp_offset< - Arg0: ProxyArg>, - Arg1: ProxyArg, - Arg2: ProxyArg>, - >( - self, - _pair_address: Arg0, - _timestamp_offset: Arg1, - input_payment: Arg2, - ) -> TxTypedCall> { - self.wrapped_tx - .payment(NotPayable) - .raw_call("getSafePriceByTimestampOffset") - .argument(&_pair_address) - .argument(&_timestamp_offset) - .argument(&input_payment) - .original_result() - } -} diff --git a/pair-mock/tests/pair_mock_scenario_rs_test.rs b/pair-mock/tests/pair_mock_scenario_rs_test.rs deleted file mode 100644 index 996f6215..00000000 --- a/pair-mock/tests/pair_mock_scenario_rs_test.rs +++ /dev/null @@ -1,17 +0,0 @@ -use multiversx_sc_scenario::*; - -fn world() -> ScenarioWorld { - let mut blockchain = ScenarioWorld::new(); - // blockchain.set_current_dir_from_workspace("relative path to your workspace, if applicable"); - - blockchain.register_contract( - "mxsc:output/pair-mock.mxsc.json", - pair_mock::ContractBuilder, - ); - blockchain -} - -#[test] -fn empty_rs() { - world().run("scenarios/pair_mock.scen.json"); -} diff --git a/pair-mock/wasm-pair-mock-full/Cargo.lock b/pair-mock/wasm-pair-mock-full/Cargo.lock deleted file mode 100644 index 08baa23b..00000000 --- a/pair-mock/wasm-pair-mock-full/Cargo.lock +++ /dev/null @@ -1,188 +0,0 @@ -# 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.6.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b048fb63fd8b5923fc5aa7b340d8e156aec7ec02f0c78fa8a6ddc2613f6f71de" - -[[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.52.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "526760b1d6236c011285b264a70a0a9dd3b3dbc53c3b5f76932f4bcfd3a8910c" -dependencies = [ - "bitflags", - "hex-literal", - "multiversx-sc-codec", - "multiversx-sc-derive", - "num-traits", - "unwrap-infallible", -] - -[[package]] -name = "multiversx-sc-codec" -version = "0.20.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ad4f318427761faecf26c1f3115a3beeb5f61858845a60547d9763aa981ddd2d" -dependencies = [ - "arrayvec", - "multiversx-sc-codec-derive", - "unwrap-infallible", -] - -[[package]] -name = "multiversx-sc-codec-derive" -version = "0.20.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "476501462b0c2654b64f9dec6f2c480e24b4e9b7133ec10b7167e64acda35d04" -dependencies = [ - "hex", - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "multiversx-sc-derive" -version = "0.52.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3557f2f12640a8a07fa6af66cc2a13b188c5b61bed72db22fe631fb3a60c3e96" -dependencies = [ - "hex", - "proc-macro2", - "quote", - "radix_trie", - "syn", -] - -[[package]] -name = "multiversx-sc-wasm-adapter" -version = "0.52.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ed13aaca9cbdbc6911174cd3029e750a7563d85dd3daaa1107b1fd31c7f17245" -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.19" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "071dfc062690e90b734c0b2273ce72ad0ffa95f0c74596bc250dcfd960262841" -dependencies = [ - "autocfg", -] - -[[package]] -name = "pair-mock" -version = "0.0.0" -dependencies = [ - "multiversx-sc", -] - -[[package]] -name = "pair-mock-full-wasm" -version = "0.0.0" -dependencies = [ - "multiversx-sc-wasm-adapter", - "pair-mock", -] - -[[package]] -name = "proc-macro2" -version = "1.0.86" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5e719e8df665df0d1c8fbfd238015744736151d4445ec0836b8e628aae103b77" -dependencies = [ - "unicode-ident", -] - -[[package]] -name = "quote" -version = "1.0.36" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0fa76aaf39101c457836aec0ce2316dbdc3ab723cdda1c6bd4e6ad4208acaca7" -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.72" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dc4b9b9bf2add8093d3f2c0204471e951b2285580335de42f9d2534f3ae7a8af" -dependencies = [ - "proc-macro2", - "quote", - "unicode-ident", -] - -[[package]] -name = "unicode-ident" -version = "1.0.12" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3354b9ac3fae1ff6755cb6db53683adb661634f67557942dea4facebec0fee4b" - -[[package]] -name = "unwrap-infallible" -version = "0.1.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "151ac09978d3c2862c4e39b557f4eceee2cc72150bc4cb4f16abf061b6e381fb" diff --git a/pair-mock/wasm-pair-mock-full/Cargo.toml b/pair-mock/wasm-pair-mock-full/Cargo.toml deleted file mode 100644 index 60c80e18..00000000 --- a/pair-mock/wasm-pair-mock-full/Cargo.toml +++ /dev/null @@ -1,34 +0,0 @@ -# Code generated by the multiversx-sc build system. DO NOT EDIT. - -# ########################################## -# ############## AUTO-GENERATED ############# -# ########################################## - -[package] -name = "pair-mock-full-wasm" -version = "0.0.0" -edition = "2021" -publish = false - -[lib] -crate-type = ["cdylib"] - -[profile.release] -codegen-units = 1 -opt-level = "z" -lto = true -debug = false -panic = "abort" -overflow-checks = false - -[profile.dev] -panic = "abort" - -[dependencies.pair-mock] -path = ".." - -[dependencies.multiversx-sc-wasm-adapter] -version = "0.52.3" - -[workspace] -members = ["."] diff --git a/pair-mock/wasm-pair-mock-full/src/lib.rs b/pair-mock/wasm-pair-mock-full/src/lib.rs deleted file mode 100644 index e87dd4d4..00000000 --- a/pair-mock/wasm-pair-mock-full/src/lib.rs +++ /dev/null @@ -1,25 +0,0 @@ -// Code generated by the multiversx-sc build system. DO NOT EDIT. - -//////////////////////////////////////////////////// -////////////////// AUTO-GENERATED ////////////////// -//////////////////////////////////////////////////// - -// Init: 1 -// Endpoints: 1 -// Async Callback (empty): 1 -// Total number of exported functions: 3 - -#![no_std] - -multiversx_sc_wasm_adapter::allocator!(); -multiversx_sc_wasm_adapter::panic_handler!(); - -multiversx_sc_wasm_adapter::endpoints! { - pair_mock - ( - init => init - getSafePriceByTimestampOffset => get_safe_price_by_timestamp_offset - ) -} - -multiversx_sc_wasm_adapter::async_callback_empty! {} diff --git a/pair-mock/wasm-pair-mock-view/Cargo.lock b/pair-mock/wasm-pair-mock-view/Cargo.lock deleted file mode 100644 index e8edd028..00000000 --- a/pair-mock/wasm-pair-mock-view/Cargo.lock +++ /dev/null @@ -1,188 +0,0 @@ -# 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.6.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b048fb63fd8b5923fc5aa7b340d8e156aec7ec02f0c78fa8a6ddc2613f6f71de" - -[[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.52.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "526760b1d6236c011285b264a70a0a9dd3b3dbc53c3b5f76932f4bcfd3a8910c" -dependencies = [ - "bitflags", - "hex-literal", - "multiversx-sc-codec", - "multiversx-sc-derive", - "num-traits", - "unwrap-infallible", -] - -[[package]] -name = "multiversx-sc-codec" -version = "0.20.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ad4f318427761faecf26c1f3115a3beeb5f61858845a60547d9763aa981ddd2d" -dependencies = [ - "arrayvec", - "multiversx-sc-codec-derive", - "unwrap-infallible", -] - -[[package]] -name = "multiversx-sc-codec-derive" -version = "0.20.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "476501462b0c2654b64f9dec6f2c480e24b4e9b7133ec10b7167e64acda35d04" -dependencies = [ - "hex", - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "multiversx-sc-derive" -version = "0.52.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3557f2f12640a8a07fa6af66cc2a13b188c5b61bed72db22fe631fb3a60c3e96" -dependencies = [ - "hex", - "proc-macro2", - "quote", - "radix_trie", - "syn", -] - -[[package]] -name = "multiversx-sc-wasm-adapter" -version = "0.52.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ed13aaca9cbdbc6911174cd3029e750a7563d85dd3daaa1107b1fd31c7f17245" -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.19" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "071dfc062690e90b734c0b2273ce72ad0ffa95f0c74596bc250dcfd960262841" -dependencies = [ - "autocfg", -] - -[[package]] -name = "pair-mock" -version = "0.0.0" -dependencies = [ - "multiversx-sc", -] - -[[package]] -name = "pair-mock-view-wasm" -version = "0.0.0" -dependencies = [ - "multiversx-sc-wasm-adapter", - "pair-mock", -] - -[[package]] -name = "proc-macro2" -version = "1.0.86" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5e719e8df665df0d1c8fbfd238015744736151d4445ec0836b8e628aae103b77" -dependencies = [ - "unicode-ident", -] - -[[package]] -name = "quote" -version = "1.0.36" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0fa76aaf39101c457836aec0ce2316dbdc3ab723cdda1c6bd4e6ad4208acaca7" -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.72" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dc4b9b9bf2add8093d3f2c0204471e951b2285580335de42f9d2534f3ae7a8af" -dependencies = [ - "proc-macro2", - "quote", - "unicode-ident", -] - -[[package]] -name = "unicode-ident" -version = "1.0.12" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3354b9ac3fae1ff6755cb6db53683adb661634f67557942dea4facebec0fee4b" - -[[package]] -name = "unwrap-infallible" -version = "0.1.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "151ac09978d3c2862c4e39b557f4eceee2cc72150bc4cb4f16abf061b6e381fb" diff --git a/pair-mock/wasm-pair-mock-view/Cargo.toml b/pair-mock/wasm-pair-mock-view/Cargo.toml deleted file mode 100644 index 224b5dc7..00000000 --- a/pair-mock/wasm-pair-mock-view/Cargo.toml +++ /dev/null @@ -1,34 +0,0 @@ -# Code generated by the multiversx-sc build system. DO NOT EDIT. - -# ########################################## -# ############## AUTO-GENERATED ############# -# ########################################## - -[package] -name = "pair-mock-view-wasm" -version = "0.0.0" -edition = "2021" -publish = false - -[lib] -crate-type = ["cdylib"] - -[profile.release] -codegen-units = 1 -opt-level = "z" -lto = true -debug = false -panic = "abort" -overflow-checks = false - -[profile.dev] -panic = "abort" - -[dependencies.pair-mock] -path = ".." - -[dependencies.multiversx-sc-wasm-adapter] -version = "0.52.3" - -[workspace] -members = ["."] diff --git a/pair-mock/wasm-pair-mock-view/src/lib.rs b/pair-mock/wasm-pair-mock-view/src/lib.rs deleted file mode 100644 index 5b9e4edc..00000000 --- a/pair-mock/wasm-pair-mock-view/src/lib.rs +++ /dev/null @@ -1,25 +0,0 @@ -// Code generated by the multiversx-sc build system. DO NOT EDIT. - -//////////////////////////////////////////////////// -////////////////// AUTO-GENERATED ////////////////// -//////////////////////////////////////////////////// - -// Init: 1 -// Endpoints: 0 -// Async Callback (empty): 1 -// Total number of exported functions: 2 - -#![no_std] - -multiversx_sc_wasm_adapter::allocator!(); -multiversx_sc_wasm_adapter::panic_handler!(); - -multiversx_sc_wasm_adapter::external_view_init! {} - -multiversx_sc_wasm_adapter::external_view_endpoints! { - pair_mock - ( - ) -} - -multiversx_sc_wasm_adapter::async_callback_empty! {} diff --git a/pair-mock/wasm/Cargo.lock b/pair-mock/wasm/Cargo.lock deleted file mode 100644 index 5f02efc6..00000000 --- a/pair-mock/wasm/Cargo.lock +++ /dev/null @@ -1,188 +0,0 @@ -# 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.6.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b048fb63fd8b5923fc5aa7b340d8e156aec7ec02f0c78fa8a6ddc2613f6f71de" - -[[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.52.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "526760b1d6236c011285b264a70a0a9dd3b3dbc53c3b5f76932f4bcfd3a8910c" -dependencies = [ - "bitflags", - "hex-literal", - "multiversx-sc-codec", - "multiversx-sc-derive", - "num-traits", - "unwrap-infallible", -] - -[[package]] -name = "multiversx-sc-codec" -version = "0.20.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ad4f318427761faecf26c1f3115a3beeb5f61858845a60547d9763aa981ddd2d" -dependencies = [ - "arrayvec", - "multiversx-sc-codec-derive", - "unwrap-infallible", -] - -[[package]] -name = "multiversx-sc-codec-derive" -version = "0.20.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "476501462b0c2654b64f9dec6f2c480e24b4e9b7133ec10b7167e64acda35d04" -dependencies = [ - "hex", - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "multiversx-sc-derive" -version = "0.52.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3557f2f12640a8a07fa6af66cc2a13b188c5b61bed72db22fe631fb3a60c3e96" -dependencies = [ - "hex", - "proc-macro2", - "quote", - "radix_trie", - "syn", -] - -[[package]] -name = "multiversx-sc-wasm-adapter" -version = "0.52.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ed13aaca9cbdbc6911174cd3029e750a7563d85dd3daaa1107b1fd31c7f17245" -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.19" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "071dfc062690e90b734c0b2273ce72ad0ffa95f0c74596bc250dcfd960262841" -dependencies = [ - "autocfg", -] - -[[package]] -name = "pair-mock" -version = "0.0.0" -dependencies = [ - "multiversx-sc", -] - -[[package]] -name = "pair-mock-wasm" -version = "0.0.0" -dependencies = [ - "multiversx-sc-wasm-adapter", - "pair-mock", -] - -[[package]] -name = "proc-macro2" -version = "1.0.86" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5e719e8df665df0d1c8fbfd238015744736151d4445ec0836b8e628aae103b77" -dependencies = [ - "unicode-ident", -] - -[[package]] -name = "quote" -version = "1.0.36" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0fa76aaf39101c457836aec0ce2316dbdc3ab723cdda1c6bd4e6ad4208acaca7" -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.72" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dc4b9b9bf2add8093d3f2c0204471e951b2285580335de42f9d2534f3ae7a8af" -dependencies = [ - "proc-macro2", - "quote", - "unicode-ident", -] - -[[package]] -name = "unicode-ident" -version = "1.0.12" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3354b9ac3fae1ff6755cb6db53683adb661634f67557942dea4facebec0fee4b" - -[[package]] -name = "unwrap-infallible" -version = "0.1.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "151ac09978d3c2862c4e39b557f4eceee2cc72150bc4cb4f16abf061b6e381fb" diff --git a/pair-mock/wasm/Cargo.toml b/pair-mock/wasm/Cargo.toml deleted file mode 100644 index a056c104..00000000 --- a/pair-mock/wasm/Cargo.toml +++ /dev/null @@ -1,34 +0,0 @@ -# Code generated by the multiversx-sc build system. DO NOT EDIT. - -# ########################################## -# ############## AUTO-GENERATED ############# -# ########################################## - -[package] -name = "pair-mock-wasm" -version = "0.0.0" -edition = "2021" -publish = false - -[lib] -crate-type = ["cdylib"] - -[profile.release] -codegen-units = 1 -opt-level = "z" -lto = true -debug = false -panic = "abort" -overflow-checks = false - -[profile.dev] -panic = "abort" - -[dependencies.pair-mock] -path = ".." - -[dependencies.multiversx-sc-wasm-adapter] -version = "0.52.3" - -[workspace] -members = ["."] diff --git a/router-mock/Cargo.toml b/router-mock/Cargo.toml deleted file mode 100644 index 93f9d007..00000000 --- a/router-mock/Cargo.toml +++ /dev/null @@ -1,18 +0,0 @@ -[package] -name = "router-mock" -version = "0.0.0" -authors = ["you"] -edition = "2021" -publish = false - -[lib] -path = "src/router_mock.rs" - -[dependencies.multiversx-sc] -version = "0.52.3" - -[dev-dependencies] -num-bigint = "0.4" - -[dev-dependencies.multiversx-sc-scenario] -version = "0.52.3" diff --git a/router-mock/meta/Cargo.toml b/router-mock/meta/Cargo.toml deleted file mode 100644 index 71a56756..00000000 --- a/router-mock/meta/Cargo.toml +++ /dev/null @@ -1,12 +0,0 @@ -[package] -name = "router-mock-meta" -version = "0.0.0" -edition = "2021" -publish = false - -[dependencies.router-mock] -path = ".." - -[dependencies.multiversx-sc-meta-lib] -version = "0.52.3" -default-features = false diff --git a/router-mock/meta/src/main.rs b/router-mock/meta/src/main.rs deleted file mode 100644 index c0eaaddb..00000000 --- a/router-mock/meta/src/main.rs +++ /dev/null @@ -1,3 +0,0 @@ -fn main() { - multiversx_sc_meta_lib::cli_main::(); -} diff --git a/router-mock/tests/router_mock_scenario_rs_test.rs b/router-mock/tests/router_mock_scenario_rs_test.rs deleted file mode 100644 index a3a9aa15..00000000 --- a/router-mock/tests/router_mock_scenario_rs_test.rs +++ /dev/null @@ -1,17 +0,0 @@ -use multiversx_sc_scenario::*; - -fn world() -> ScenarioWorld { - let mut blockchain = ScenarioWorld::new(); - // blockchain.set_current_dir_from_workspace("relative path to your workspace, if applicable"); - - blockchain.register_contract( - "mxsc:output/router-mock.mxsc.json", - router_mock::ContractBuilder, - ); - blockchain -} - -#[test] -fn empty_rs() { - world().run("scenarios/router_mock.scen.json"); -} diff --git a/router-mock/wasm/Cargo.lock b/router-mock/wasm/Cargo.lock deleted file mode 100644 index cd300e3d..00000000 --- a/router-mock/wasm/Cargo.lock +++ /dev/null @@ -1,188 +0,0 @@ -# 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.6.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b048fb63fd8b5923fc5aa7b340d8e156aec7ec02f0c78fa8a6ddc2613f6f71de" - -[[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.52.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "526760b1d6236c011285b264a70a0a9dd3b3dbc53c3b5f76932f4bcfd3a8910c" -dependencies = [ - "bitflags", - "hex-literal", - "multiversx-sc-codec", - "multiversx-sc-derive", - "num-traits", - "unwrap-infallible", -] - -[[package]] -name = "multiversx-sc-codec" -version = "0.20.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ad4f318427761faecf26c1f3115a3beeb5f61858845a60547d9763aa981ddd2d" -dependencies = [ - "arrayvec", - "multiversx-sc-codec-derive", - "unwrap-infallible", -] - -[[package]] -name = "multiversx-sc-codec-derive" -version = "0.20.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "476501462b0c2654b64f9dec6f2c480e24b4e9b7133ec10b7167e64acda35d04" -dependencies = [ - "hex", - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "multiversx-sc-derive" -version = "0.52.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3557f2f12640a8a07fa6af66cc2a13b188c5b61bed72db22fe631fb3a60c3e96" -dependencies = [ - "hex", - "proc-macro2", - "quote", - "radix_trie", - "syn", -] - -[[package]] -name = "multiversx-sc-wasm-adapter" -version = "0.52.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ed13aaca9cbdbc6911174cd3029e750a7563d85dd3daaa1107b1fd31c7f17245" -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.19" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "071dfc062690e90b734c0b2273ce72ad0ffa95f0c74596bc250dcfd960262841" -dependencies = [ - "autocfg", -] - -[[package]] -name = "proc-macro2" -version = "1.0.86" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5e719e8df665df0d1c8fbfd238015744736151d4445ec0836b8e628aae103b77" -dependencies = [ - "unicode-ident", -] - -[[package]] -name = "quote" -version = "1.0.36" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0fa76aaf39101c457836aec0ce2316dbdc3ab723cdda1c6bd4e6ad4208acaca7" -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 = "router-mock" -version = "0.0.0" -dependencies = [ - "multiversx-sc", -] - -[[package]] -name = "router-mock-wasm" -version = "0.0.0" -dependencies = [ - "multiversx-sc-wasm-adapter", - "router-mock", -] - -[[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.72" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dc4b9b9bf2add8093d3f2c0204471e951b2285580335de42f9d2534f3ae7a8af" -dependencies = [ - "proc-macro2", - "quote", - "unicode-ident", -] - -[[package]] -name = "unicode-ident" -version = "1.0.12" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3354b9ac3fae1ff6755cb6db53683adb661634f67557942dea4facebec0fee4b" - -[[package]] -name = "unwrap-infallible" -version = "0.1.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "151ac09978d3c2862c4e39b557f4eceee2cc72150bc4cb4f16abf061b6e381fb" diff --git a/router-mock/wasm/Cargo.toml b/router-mock/wasm/Cargo.toml deleted file mode 100644 index e417750e..00000000 --- a/router-mock/wasm/Cargo.toml +++ /dev/null @@ -1,34 +0,0 @@ -# Code generated by the multiversx-sc build system. DO NOT EDIT. - -# ########################################## -# ############## AUTO-GENERATED ############# -# ########################################## - -[package] -name = "router-mock-wasm" -version = "0.0.0" -edition = "2021" -publish = false - -[lib] -crate-type = ["cdylib"] - -[profile.release] -codegen-units = 1 -opt-level = "z" -lto = true -debug = false -panic = "abort" -overflow-checks = false - -[profile.dev] -panic = "abort" - -[dependencies.router-mock] -path = ".." - -[dependencies.multiversx-sc-wasm-adapter] -version = "0.52.3" - -[workspace] -members = ["."] From 35194704950e3705fc9dda3668e4cbc023ca58dd Mon Sep 17 00:00:00 2001 From: Andrei Baltariu Date: Tue, 20 Aug 2024 13:59:13 +0300 Subject: [PATCH 275/523] Added error return to fix test Signed-off-by: Andrei Baltariu --- esdt-safe/tests/bridge_blackbox_tests.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/esdt-safe/tests/bridge_blackbox_tests.rs b/esdt-safe/tests/bridge_blackbox_tests.rs index c79b58c6..6140a5eb 100644 --- a/esdt-safe/tests/bridge_blackbox_tests.rs +++ b/esdt-safe/tests/bridge_blackbox_tests.rs @@ -270,6 +270,7 @@ impl BridgeTestState { .to(BRIDGE_ADDRESS) .typed(esdt_safe_proxy::EsdtSafeProxy) .execute_operations(hash_of_hashes, operation) + .returns(ExpectError(4, "Operation is not registered")) .run(); } From 163266b24a9dc224eba4a6c802fbf6b1d64a6dd8 Mon Sep 17 00:00:00 2001 From: Andrei Baltariu Date: Wed, 21 Aug 2024 12:16:43 +0300 Subject: [PATCH 276/523] Fixed test and added CamelCase for storage mappers Signed-off-by: Andrei Baltariu --- esdt-safe/src/from_sovereign/transfer_tokens.rs | 6 +++--- esdt-safe/tests/bridge_blackbox_tests.rs | 1 - 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/esdt-safe/src/from_sovereign/transfer_tokens.rs b/esdt-safe/src/from_sovereign/transfer_tokens.rs index 029b1387..941ffc74 100644 --- a/esdt-safe/src/from_sovereign/transfer_tokens.rs +++ b/esdt-safe/src/from_sovereign/transfer_tokens.rs @@ -290,7 +290,7 @@ pub trait TransferTokensModule: operation: Operation, ) -> (ManagedBuffer, bool) { let mut serialized_data = ManagedBuffer::new(); - let mut storage_key = StorageKey::from("pending_hashes"); + let mut storage_key = StorageKey::from("pendingHashes"); storage_key.append_item(&hash_of_hashes); let pending_operations_mapper = @@ -310,9 +310,9 @@ pub trait TransferTokensModule: } } - #[storage_mapper("pending_hashes")] + #[storage_mapper("pendingHashes")] fn pending_hashes(&self, hash_of_hashes: &ManagedBuffer) -> UnorderedSetMapper; - #[storage_mapper("header_verifier_address")] + #[storage_mapper("headerVerifierAddress")] fn header_verifier_address(&self) -> SingleValueMapper; } diff --git a/esdt-safe/tests/bridge_blackbox_tests.rs b/esdt-safe/tests/bridge_blackbox_tests.rs index 6140a5eb..c79b58c6 100644 --- a/esdt-safe/tests/bridge_blackbox_tests.rs +++ b/esdt-safe/tests/bridge_blackbox_tests.rs @@ -270,7 +270,6 @@ impl BridgeTestState { .to(BRIDGE_ADDRESS) .typed(esdt_safe_proxy::EsdtSafeProxy) .execute_operations(hash_of_hashes, operation) - .returns(ExpectError(4, "Operation is not registered")) .run(); } From 623919252b168ff26600411b2133e5de4f955863 Mon Sep 17 00:00:00 2001 From: Andrei Baltariu Date: Wed, 21 Aug 2024 13:52:30 +0300 Subject: [PATCH 277/523] Fixed clippy errors Signed-off-by: Andrei Baltariu --- common/transaction/src/lib.rs | 16 +--------------- 1 file changed, 1 insertion(+), 15 deletions(-) diff --git a/common/transaction/src/lib.rs b/common/transaction/src/lib.rs index d8822282..c5336c0a 100644 --- a/common/transaction/src/lib.rs +++ b/common/transaction/src/lib.rs @@ -51,14 +51,7 @@ impl Operation { let mut tuples = MultiValueEncoded::new(); for token in &self.tokens { - tuples.push( - ( - token.token_identifier, - token.token_nonce, - token.token_data.into(), - ) - .into(), - ); + tuples.push((token.token_identifier, token.token_nonce, token.token_data).into()); } tuples @@ -129,13 +122,6 @@ impl OperationEsdtPayment { } } -impl From> for OperationEsdtPayment { - #[inline] - fn from(payment: EsdtTokenPayment) -> Self { - payment.into() - } -} - impl From> for EsdtTokenPayment { #[inline] fn from(payment: OperationEsdtPayment) -> Self { From b47576956f098981ce7968b47429409a020754b8 Mon Sep 17 00:00:00 2001 From: Andrei Baltariu Date: Wed, 21 Aug 2024 18:33:31 +0300 Subject: [PATCH 278/523] More clippy fixes Signed-off-by: Andrei Baltariu --- .../tests/enshrine_esdt_safe_blackbox_test.rs | 6 +++--- token-handler/tests/token_handler_blackbox_tests.rs | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/enshrine-esdt-safe/tests/enshrine_esdt_safe_blackbox_test.rs b/enshrine-esdt-safe/tests/enshrine_esdt_safe_blackbox_test.rs index d02d9628..3cdc89d3 100644 --- a/enshrine-esdt-safe/tests/enshrine_esdt_safe_blackbox_test.rs +++ b/enshrine-esdt-safe/tests/enshrine_esdt_safe_blackbox_test.rs @@ -263,7 +263,7 @@ impl EnshrineTestState { Some(status) => self .world .tx() - .from(sender.clone()) + .from(*sender) .to(ENSHRINE_ESDT_ADDRESS) .typed(enshrine_esdt_safe_proxy::EnshrineEsdtSafeProxy) .register_new_token_id(managed_token_ids) @@ -273,7 +273,7 @@ impl EnshrineTestState { None => self .world .tx() - .from(sender.clone()) + .from(*sender) .to(ENSHRINE_ESDT_ADDRESS) .typed(enshrine_esdt_safe_proxy::EnshrineEsdtSafeProxy) .register_new_token_id(managed_token_ids) @@ -304,7 +304,7 @@ impl EnshrineTestState { for token_id in token_ids { let payment: OperationEsdtPayment = - OperationEsdtPayment::new(token_id.clone().into(), 1, EsdtTokenData::default()); + OperationEsdtPayment::new((*token_id).into(), 1, EsdtTokenData::default()); tokens.push(payment); } diff --git a/token-handler/tests/token_handler_blackbox_tests.rs b/token-handler/tests/token_handler_blackbox_tests.rs index 5bc5b2db..a9692e4d 100644 --- a/token-handler/tests/token_handler_blackbox_tests.rs +++ b/token-handler/tests/token_handler_blackbox_tests.rs @@ -158,7 +158,7 @@ impl TokenHandlerTestState { for token_id in token_ids { let payment: OperationEsdtPayment = OperationEsdtPayment { - token_identifier: token_id.clone().into(), + token_identifier: (*token_id).into(), token_nonce: 1, token_data: EsdtTokenData::default(), }; From 9d894c074ab1502316fd75a936b7dca05c0d4297 Mon Sep 17 00:00:00 2001 From: Andrei Baltariu Date: Fri, 23 Aug 2024 23:31:04 +0300 Subject: [PATCH 279/523] Added methods for transfer data + option Signed-off-by: Andrei Baltariu --- common/transaction/src/lib.rs | 41 +++++++++++++++++++ .../src/to_sovereign/create_tx.rs | 10 +++-- 2 files changed, 48 insertions(+), 3 deletions(-) diff --git a/common/transaction/src/lib.rs b/common/transaction/src/lib.rs index c5336c0a..8875dcb3 100644 --- a/common/transaction/src/lib.rs +++ b/common/transaction/src/lib.rs @@ -65,6 +65,35 @@ pub struct TransferData { pub args: ManagedVec>, } +impl TransferData { + #[inline] + pub fn new( + gas_limit: GasLimit, + function: ManagedBuffer, + args: ManagedVec>, + ) -> Self { + TransferData { + gas_limit, + function, + args, + } + } + + // TODO: Should use a reference + pub fn optional_value_to_option( + opt_value_transfer_data: OptionalValue< + MultiValue3, ManagedVec>>, + >, + ) -> Option { + match opt_value_transfer_data { + OptionalValue::Some(multi_value_transfer_data) => { + return Option::Some(multi_value_transfer_data.into()) + } + OptionalValue::None => return Option::None, + } + } +} + #[derive(TopEncode, TopDecode, NestedEncode, NestedDecode, TypeAbi, ManagedVecItem, Clone)] pub struct OperationData { pub op_nonce: TxId, @@ -87,6 +116,18 @@ impl OperationData { } } +impl + From, ManagedVec>>> + for TransferData +{ + fn from( + value: MultiValue3, ManagedVec>>, + ) -> Self { + let (gas_limit, function, vec) = value.into_tuple(); + TransferData::new(gas_limit, function, vec) + } +} + #[derive(TopEncode, TopDecode, NestedEncode, NestedDecode, TypeAbi, ManagedVecItem, Clone)] pub struct OperationTuple { pub op_hash: ManagedBuffer, diff --git a/enshrine-esdt-safe/src/to_sovereign/create_tx.rs b/enshrine-esdt-safe/src/to_sovereign/create_tx.rs index ec2e6a22..e1e991f8 100644 --- a/enshrine-esdt-safe/src/to_sovereign/create_tx.rs +++ b/enshrine-esdt-safe/src/to_sovereign/create_tx.rs @@ -38,7 +38,6 @@ pub trait CreateTxModule: let mut event_payments = MultiValueEncoded::new(); let mut refundable_payments = ManagedVec::::new(); - let opt_transfer_data = self.process_transfer_data(opt_transfer_data); let own_sc_address = self.blockchain().get_sc_address(); let is_sov_chain = self.is_sovereign_chain().get(); @@ -81,7 +80,12 @@ pub trait CreateTxModule: ); } - self.match_fee_payment(total_tokens_for_fees, &fees_payment, &opt_transfer_data); + let option_transfer_data = TransferData::optional_value_to_option(opt_transfer_data); + self.match_fee_payment( + total_tokens_for_fees, + &fees_payment, + &(option_transfer_data), + ); // refund refundable_tokens let caller = self.blockchain().get_caller(); @@ -96,7 +100,7 @@ pub trait CreateTxModule: OperationData { op_nonce: tx_nonce, op_sender: caller, - opt_transfer_data, + opt_transfer_data: option_transfer_data, }, ); } From 73956bf3515bf6b573914490f36c9ec2393131f7 Mon Sep 17 00:00:00 2001 From: Andrei Baltariu Date: Fri, 23 Aug 2024 23:37:03 +0300 Subject: [PATCH 280/523] Used new() for OperationData Signed-off-by: Andrei Baltariu --- enshrine-esdt-safe/src/to_sovereign/create_tx.rs | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/enshrine-esdt-safe/src/to_sovereign/create_tx.rs b/enshrine-esdt-safe/src/to_sovereign/create_tx.rs index e1e991f8..4fda6b6b 100644 --- a/enshrine-esdt-safe/src/to_sovereign/create_tx.rs +++ b/enshrine-esdt-safe/src/to_sovereign/create_tx.rs @@ -81,11 +81,7 @@ pub trait CreateTxModule: } let option_transfer_data = TransferData::optional_value_to_option(opt_transfer_data); - self.match_fee_payment( - total_tokens_for_fees, - &fees_payment, - &(option_transfer_data), - ); + self.match_fee_payment(total_tokens_for_fees, &fees_payment, &option_transfer_data); // refund refundable_tokens let caller = self.blockchain().get_caller(); @@ -97,11 +93,7 @@ pub trait CreateTxModule: self.deposit_event( &to, &event_payments, - OperationData { - op_nonce: tx_nonce, - op_sender: caller, - opt_transfer_data: option_transfer_data, - }, + OperationData::new(tx_nonce, caller, option_transfer_data), ); } From 200b5c61665ee1cc4d807c62db1cad589bb73415 Mon Sep 17 00:00:00 2001 From: Andrei Baltariu Date: Sat, 24 Aug 2024 09:43:16 +0300 Subject: [PATCH 281/523] Removed match function for transfer_data Signed-off-by: Andrei Baltariu --- .../src/to_sovereign/create_tx.rs | 45 +++++++------------ 1 file changed, 17 insertions(+), 28 deletions(-) diff --git a/enshrine-esdt-safe/src/to_sovereign/create_tx.rs b/enshrine-esdt-safe/src/to_sovereign/create_tx.rs index 4fda6b6b..02f1e87c 100644 --- a/enshrine-esdt-safe/src/to_sovereign/create_tx.rs +++ b/enshrine-esdt-safe/src/to_sovereign/create_tx.rs @@ -81,6 +81,11 @@ pub trait CreateTxModule: } let option_transfer_data = TransferData::optional_value_to_option(opt_transfer_data); + + if let Some(transfer_data) = option_transfer_data.as_ref() { + self.require_gas_limit_under_limit(&transfer_data.gas_limit); + self.require_endpoint_not_banned(&transfer_data.function); + } self.match_fee_payment(total_tokens_for_fees, &fees_payment, &option_transfer_data); // refund refundable_tokens @@ -116,34 +121,6 @@ pub trait CreateTxModule: MultiValue2::from((opt_transfer_data, payments)) } - fn process_transfer_data( - &self, - opt_transfer_data: OptionalValue< - MultiValue3>, - >, - ) -> Option> { - match &opt_transfer_data { - OptionalValue::Some(transfer_data) => { - let (gas_limit, function, args) = transfer_data.clone().into_tuple(); - let max_gas_limit = self.max_user_tx_gas_limit().get(); - - require!(gas_limit <= max_gas_limit, "Gas limit too high"); - - require!( - !self.banned_endpoint_names().contains(&function), - "Banned endpoint name" - ); - - Some(TransferData { - gas_limit, - function, - args, - }) - } - OptionalValue::None => None, - } - } - fn match_fee_payment( &self, total_tokens_for_fees: usize, @@ -172,6 +149,18 @@ pub trait CreateTxModule: }; } + fn require_gas_limit_under_limit(&self, gas_limit: &GasLimit) { + let max_gas_limit = self.max_user_tx_gas_limit().get(); + require!(gas_limit <= &max_gas_limit, "Gas limit too high"); + } + + fn require_endpoint_not_banned(&self, function: &ManagedBuffer) { + require!( + !self.banned_endpoint_names().contains(function), + "Banned endpoint name" + ); + } + #[storage_mapper("feeMarketAddress")] fn fee_market_address(&self) -> SingleValueMapper; From eea21e32dfaa4e082b3b70bdb7678a7e35981081 Mon Sep 17 00:00:00 2001 From: Andrei Baltariu Date: Sat, 24 Aug 2024 09:48:05 +0300 Subject: [PATCH 282/523] Added function for token refund Signed-off-by: Andrei Baltariu --- enshrine-esdt-safe/src/to_sovereign/create_tx.rs | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/enshrine-esdt-safe/src/to_sovereign/create_tx.rs b/enshrine-esdt-safe/src/to_sovereign/create_tx.rs index 02f1e87c..b75f025a 100644 --- a/enshrine-esdt-safe/src/to_sovereign/create_tx.rs +++ b/enshrine-esdt-safe/src/to_sovereign/create_tx.rs @@ -90,9 +90,7 @@ pub trait CreateTxModule: // refund refundable_tokens let caller = self.blockchain().get_caller(); - for payment in &refundable_payments { - self.send().direct_non_zero_esdt_payment(&caller, &payment); - } + self.refund_tokens(&caller, &refundable_payments); let tx_nonce = self.get_and_save_next_tx_id(); self.deposit_event( @@ -121,6 +119,16 @@ pub trait CreateTxModule: MultiValue2::from((opt_transfer_data, payments)) } + fn refund_tokens( + &self, + caller: &ManagedAddress, + refundable_payments: &ManagedVec, + ) { + for payment in refundable_payments { + self.send().direct_non_zero_esdt_payment(caller, &payment); + } + } + fn match_fee_payment( &self, total_tokens_for_fees: usize, From f49d36a8de938b065d3f4f50e86440a140c9a520 Mon Sep 17 00:00:00 2001 From: Andrei Baltariu Date: Sun, 25 Aug 2024 17:11:38 +0300 Subject: [PATCH 283/523] Removed unnecessary clone() Signed-off-by: Andrei Baltariu --- enshrine-esdt-safe/src/to_sovereign/create_tx.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/enshrine-esdt-safe/src/to_sovereign/create_tx.rs b/enshrine-esdt-safe/src/to_sovereign/create_tx.rs index b75f025a..2f6bd90f 100644 --- a/enshrine-esdt-safe/src/to_sovereign/create_tx.rs +++ b/enshrine-esdt-safe/src/to_sovereign/create_tx.rs @@ -72,9 +72,9 @@ pub trait CreateTxModule: event_payments.push( ( - payment.token_identifier.clone(), + payment.token_identifier, payment.token_nonce, - current_token_data.clone(), + current_token_data, ) .into(), ); From f32e4de70da6c3ac36c1ac0460a2c048939b0586 Mon Sep 17 00:00:00 2001 From: Andrei Baltariu Date: Mon, 26 Aug 2024 10:05:43 +0300 Subject: [PATCH 284/523] Removed reference for gas limit Signed-off-by: Andrei Baltariu --- enshrine-esdt-safe/src/to_sovereign/create_tx.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/enshrine-esdt-safe/src/to_sovereign/create_tx.rs b/enshrine-esdt-safe/src/to_sovereign/create_tx.rs index 2f6bd90f..db070530 100644 --- a/enshrine-esdt-safe/src/to_sovereign/create_tx.rs +++ b/enshrine-esdt-safe/src/to_sovereign/create_tx.rs @@ -83,7 +83,7 @@ pub trait CreateTxModule: let option_transfer_data = TransferData::optional_value_to_option(opt_transfer_data); if let Some(transfer_data) = option_transfer_data.as_ref() { - self.require_gas_limit_under_limit(&transfer_data.gas_limit); + self.require_gas_limit_under_limit(transfer_data.gas_limit); self.require_endpoint_not_banned(&transfer_data.function); } self.match_fee_payment(total_tokens_for_fees, &fees_payment, &option_transfer_data); @@ -157,9 +157,9 @@ pub trait CreateTxModule: }; } - fn require_gas_limit_under_limit(&self, gas_limit: &GasLimit) { + fn require_gas_limit_under_limit(&self, gas_limit: GasLimit) { let max_gas_limit = self.max_user_tx_gas_limit().get(); - require!(gas_limit <= &max_gas_limit, "Gas limit too high"); + require!(gas_limit <= max_gas_limit, "Gas limit too high"); } fn require_endpoint_not_banned(&self, function: &ManagedBuffer) { From 9b7e6d7ce418f475c7e4ce8268495efc2921415a Mon Sep 17 00:00:00 2001 From: Andrei Baltariu Date: Mon, 26 Aug 2024 10:10:11 +0300 Subject: [PATCH 285/523] Removed TODO Signed-off-by: Andrei Baltariu --- common/transaction/src/lib.rs | 1 - 1 file changed, 1 deletion(-) diff --git a/common/transaction/src/lib.rs b/common/transaction/src/lib.rs index 8875dcb3..8aea203c 100644 --- a/common/transaction/src/lib.rs +++ b/common/transaction/src/lib.rs @@ -79,7 +79,6 @@ impl TransferData { } } - // TODO: Should use a reference pub fn optional_value_to_option( opt_value_transfer_data: OptionalValue< MultiValue3, ManagedVec>>, From 138a8dd7f68297b476b079bdc4de96d958bcffbc Mon Sep 17 00:00:00 2001 From: Andrei Baltariu Date: Mon, 26 Aug 2024 10:16:45 +0300 Subject: [PATCH 286/523] Renamed method Signed-off-by: Andrei Baltariu --- common/transaction/src/lib.rs | 2 +- enshrine-esdt-safe/src/to_sovereign/create_tx.rs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/common/transaction/src/lib.rs b/common/transaction/src/lib.rs index 8aea203c..01a7c7de 100644 --- a/common/transaction/src/lib.rs +++ b/common/transaction/src/lib.rs @@ -79,7 +79,7 @@ impl TransferData { } } - pub fn optional_value_to_option( + pub fn from_optional_value( opt_value_transfer_data: OptionalValue< MultiValue3, ManagedVec>>, >, diff --git a/enshrine-esdt-safe/src/to_sovereign/create_tx.rs b/enshrine-esdt-safe/src/to_sovereign/create_tx.rs index db070530..8427a063 100644 --- a/enshrine-esdt-safe/src/to_sovereign/create_tx.rs +++ b/enshrine-esdt-safe/src/to_sovereign/create_tx.rs @@ -80,7 +80,7 @@ pub trait CreateTxModule: ); } - let option_transfer_data = TransferData::optional_value_to_option(opt_transfer_data); + let option_transfer_data = TransferData::from_optional_value(opt_transfer_data); if let Some(transfer_data) = option_transfer_data.as_ref() { self.require_gas_limit_under_limit(transfer_data.gas_limit); From 5d29318c6b3c714b9dbcc1c0eef231489b0c4ece Mon Sep 17 00:00:00 2001 From: Andrei Baltariu Date: Wed, 28 Aug 2024 14:40:26 +0300 Subject: [PATCH 287/523] Clippy fixes Signed-off-by: Andrei Baltariu --- common/transaction/src/lib.rs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/common/transaction/src/lib.rs b/common/transaction/src/lib.rs index 01a7c7de..27d04c17 100644 --- a/common/transaction/src/lib.rs +++ b/common/transaction/src/lib.rs @@ -27,6 +27,8 @@ pub type TxAsMultiValue = MultiValue7< >; pub type PaymentsVec = ManagedVec>; pub type TxBatchSplitInFields = MultiValue2>>; +pub type OptionalValueTransferDataTuple = + OptionalValue, ManagedVec>>>; #[derive(TopEncode, TopDecode, NestedEncode, NestedDecode, TypeAbi, ManagedVecItem, Clone)] pub struct Operation { @@ -80,15 +82,13 @@ impl TransferData { } pub fn from_optional_value( - opt_value_transfer_data: OptionalValue< - MultiValue3, ManagedVec>>, - >, + opt_value_transfer_data: OptionalValueTransferDataTuple, ) -> Option { match opt_value_transfer_data { OptionalValue::Some(multi_value_transfer_data) => { - return Option::Some(multi_value_transfer_data.into()) + Option::Some(multi_value_transfer_data.into()) } - OptionalValue::None => return Option::None, + OptionalValue::None => Option::None, } } } From 66d0c9168a8e9ca7f143fd542b17f2dd7de6e9f2 Mon Sep 17 00:00:00 2001 From: Andrei Baltariu Date: Wed, 4 Sep 2024 11:03:32 +0300 Subject: [PATCH 288/523] Added require for fee market address + unit test Signed-off-by: Andrei Baltariu --- .../src/to_sovereign/create_tx.rs | 5 ++ .../tests/enshrine_esdt_safe_blackbox_test.rs | 67 ++++++++++++++++++- 2 files changed, 71 insertions(+), 1 deletion(-) diff --git a/enshrine-esdt-safe/src/to_sovereign/create_tx.rs b/enshrine-esdt-safe/src/to_sovereign/create_tx.rs index 8427a063..74800edd 100644 --- a/enshrine-esdt-safe/src/to_sovereign/create_tx.rs +++ b/enshrine-esdt-safe/src/to_sovereign/create_tx.rs @@ -108,6 +108,11 @@ pub trait CreateTxModule: require!(!payments.is_empty(), "Nothing to transfer"); require!(payments.len() <= MAX_TRANSFERS_PER_TX, "Too many tokens"); + require!( + !self.fee_market_address().is_empty(), + "Fee market address is not set" + ); + let fee_market_address = self.fee_market_address().get(); let fee_enabled = self.external_fee_enabled(fee_market_address).get(); let opt_transfer_data = if fee_enabled { diff --git a/enshrine-esdt-safe/tests/enshrine_esdt_safe_blackbox_test.rs b/enshrine-esdt-safe/tests/enshrine_esdt_safe_blackbox_test.rs index 3cdc89d3..2245f5a9 100644 --- a/enshrine-esdt-safe/tests/enshrine_esdt_safe_blackbox_test.rs +++ b/enshrine-esdt-safe/tests/enshrine_esdt_safe_blackbox_test.rs @@ -1,7 +1,9 @@ use bls_signature::BlsSignature; use enshrine_esdt_safe::enshrine_esdt_safe_proxy; +use fee_market::fee_market_proxy; use header_verifier::header_verifier_proxy; use multiversx_sc::codec::TopEncode; +use multiversx_sc::imports::{MultiValue3, OptionalValue}; use multiversx_sc::types::{ Address, BigUint, EsdtTokenData, EsdtTokenPayment, ManagedBuffer, ManagedByteArray, ManagedVec, MultiValueEncoded, TestAddress, TestSCAddress, TestTokenIdentifier, TokenIdentifier, @@ -11,7 +13,7 @@ use multiversx_sc_scenario::multiversx_chain_vm::crypto_functions::sha256; use multiversx_sc_scenario::{imports::MxscPath, ScenarioWorld}; use multiversx_sc_scenario::{managed_address, ExpectError, ScenarioTxRun}; use token_handler::token_handler_proxy; -use transaction::{Operation, OperationData, OperationEsdtPayment}; +use transaction::{GasLimit, Operation, OperationData, OperationEsdtPayment}; const ENSHRINE_ESDT_ADDRESS: TestSCAddress = TestSCAddress::new("enshrine-esdt"); const ENSHRINE_ESDT_CODE_PATH: MxscPath = MxscPath::new("output/enshrine-esdt-safe.mxsc-json"); @@ -47,6 +49,9 @@ pub struct ErrorStatus<'a> { error_message: &'a str, } +type OptionalTransferData = + OptionalValue, ManagedVec>>>; + fn world() -> ScenarioWorld { let mut blockchain = ScenarioWorld::new(); @@ -282,6 +287,37 @@ impl EnshrineTestState { } } + fn propose_deposit( + &mut self, + from: TestAddress, + to: TestAddress, + payment: EsdtTokenPayment, + deposit_args: OptionalTransferData, + error_status: Option, + ) { + match error_status { + Some(status) => self + .world + .tx() + .from(from) + .to(ENSHRINE_ESDT_ADDRESS) + .typed(enshrine_esdt_safe_proxy::EnshrineEsdtSafeProxy) + .deposit(to, deposit_args) + .esdt(payment) + .returns(ExpectError(status.code, status.error_message)) + .run(), + None => self + .world + .tx() + .from(from) + .to(ENSHRINE_ESDT_ADDRESS) + .typed(enshrine_esdt_safe_proxy::EnshrineEsdtSafeProxy) + .deposit(to, deposit_args) + .esdt(payment) + .run(), + } + } + fn mock_bls_signature( &mut self, operation_hash: &ManagedBuffer, @@ -322,6 +358,16 @@ impl EnshrineTestState { ManagedBuffer::new_from_bytes(&sha256) } + + fn propose_register_fee_market_address(&mut self, fee_market_address: TestSCAddress) { + self.world + .tx() + .from(ENSHRINE_ESDT_OWNER_ADDRESS) + .to(ENSHRINE_ESDT_ADDRESS) + .typed(enshrine_esdt_safe_proxy::EnshrineEsdtSafeProxy) + .set_fee_market_address(fee_market_address) + .run(); + } } #[test] @@ -441,3 +487,22 @@ fn test_register_tokens_insufficient_wegld() { }), ); } + +#[test] +fn test_deposit_fee_market_address_not_set() { + let mut state = EnshrineTestState::new(); + let payment = EsdtTokenPayment::new(WEGLD_IDENTIFIER.into(), 0, BigUint::from(10000u64)); + let error_status = ErrorStatus { + code: 4, + error_message: "Fee market address is not set", + }; + + state.propose_setup_contracts(false); + state.propose_deposit( + ENSHRINE_ESDT_OWNER_ADDRESS, + USER_ADDRESS, + payment, + OptionalValue::None, + Some(error_status), + ) +} From fdee76efc4833f91e91d03383b00ab97552582e9 Mon Sep 17 00:00:00 2001 From: Andrei Baltariu Date: Wed, 4 Sep 2024 11:23:21 +0300 Subject: [PATCH 289/523] Added fee market deploy + `deposit` unit test Signed-off-by: Andrei Baltariu --- .../tests/enshrine_esdt_safe_blackbox_test.rs | 38 +++++++++++++++++++ 1 file changed, 38 insertions(+) diff --git a/enshrine-esdt-safe/tests/enshrine_esdt_safe_blackbox_test.rs b/enshrine-esdt-safe/tests/enshrine_esdt_safe_blackbox_test.rs index 2245f5a9..6e380e2c 100644 --- a/enshrine-esdt-safe/tests/enshrine_esdt_safe_blackbox_test.rs +++ b/enshrine-esdt-safe/tests/enshrine_esdt_safe_blackbox_test.rs @@ -31,6 +31,9 @@ const TOKEN_HANDLER_ADDRESS: TestSCAddress = TestSCAddress::new("token_handler") const TOKEN_HANDLER_CODE_PATH: MxscPath = MxscPath::new("../token-handler/output/token-handler.mxsc.json"); +const FEE_MARKET_ADDRESS: TestSCAddress = TestSCAddress::new("fee-market"); +const FEE_MARKET_CODE_PATH: MxscPath = MxscPath::new("../fee-market/output/fee-market.mxsc.json"); + const USER_ADDRESS: TestAddress = TestAddress::new("user"); const INSUFFICIENT_WEGLD_ADDRESS: TestAddress = TestAddress::new("insufficient_wegld"); const RECEIVER_ADDRESS: TestAddress = TestAddress::new("receiver"); @@ -58,6 +61,7 @@ fn world() -> ScenarioWorld { blockchain.register_contract(ENSHRINE_ESDT_CODE_PATH, enshrine_esdt_safe::ContractBuilder); blockchain.register_contract(HEADER_VERIFIER_CODE_PATH, header_verifier::ContractBuilder); blockchain.register_contract(TOKEN_HANDLER_CODE_PATH, token_handler::ContractBuilder); + blockchain.register_contract(FEE_MARKET_CODE_PATH, fee_market::ContractBuilder); blockchain } @@ -146,6 +150,19 @@ impl EnshrineTestState { self } + fn deploy_fee_market_contract(&mut self) -> &mut Self { + self.world + .tx() + .from(ENSHRINE_ESDT_OWNER_ADDRESS) + .typed(fee_market_proxy::FeeMarketProxy) + .init(ENSHRINE_ESDT_ADDRESS, ENSHRINE_ESDT_ADDRESS) + .code(FEE_MARKET_CODE_PATH) + .new_address(FEE_MARKET_ADDRESS) + .run(); + + self + } + fn deploy_header_verifier_contract(&mut self) -> &mut Self { let bls_pub_key: ManagedBuffer = ManagedBuffer::new(); let mut bls_pub_keys = MultiValueEncoded::new(); @@ -506,3 +523,24 @@ fn test_deposit_fee_market_address_not_set() { Some(error_status), ) } + +#[test] +fn test_deposit_fee_enabled_nothing_to_transfer() { + let mut state = EnshrineTestState::new(); + let payment = EsdtTokenPayment::new(WEGLD_IDENTIFIER.into(), 0, BigUint::from(10000u64)); + let error_status = ErrorStatus { + code: 4, + error_message: "Nothing to transfer", + }; + + state.propose_setup_contracts(false); + state.propose_register_fee_market_address(FEE_MARKET_ADDRESS); + state.deploy_fee_market_contract(); + state.propose_deposit( + ENSHRINE_ESDT_OWNER_ADDRESS, + USER_ADDRESS, + payment, + OptionalValue::None, + Some(error_status), + ) +} From 9ab03fee00fe57365e087ebea89c5d28d2ce6621 Mon Sep 17 00:00:00 2001 From: Andrei Baltariu Date: Wed, 4 Sep 2024 11:55:06 +0300 Subject: [PATCH 290/523] Added deposit test + check balance Signed-off-by: Andrei Baltariu --- .../tests/enshrine_esdt_safe_blackbox_test.rs | 49 +++++++++++++------ 1 file changed, 34 insertions(+), 15 deletions(-) diff --git a/enshrine-esdt-safe/tests/enshrine_esdt_safe_blackbox_test.rs b/enshrine-esdt-safe/tests/enshrine_esdt_safe_blackbox_test.rs index 6e380e2c..301b290b 100644 --- a/enshrine-esdt-safe/tests/enshrine_esdt_safe_blackbox_test.rs +++ b/enshrine-esdt-safe/tests/enshrine_esdt_safe_blackbox_test.rs @@ -1,6 +1,6 @@ use bls_signature::BlsSignature; use enshrine_esdt_safe::enshrine_esdt_safe_proxy; -use fee_market::fee_market_proxy; +use fee_market::fee_market_proxy::{self}; use header_verifier::header_verifier_proxy; use multiversx_sc::codec::TopEncode; use multiversx_sc::imports::{MultiValue3, OptionalValue}; @@ -14,6 +14,7 @@ use multiversx_sc_scenario::{imports::MxscPath, ScenarioWorld}; use multiversx_sc_scenario::{managed_address, ExpectError, ScenarioTxRun}; use token_handler::token_handler_proxy; use transaction::{GasLimit, Operation, OperationData, OperationEsdtPayment}; +use utils::PaymentsVec; const ENSHRINE_ESDT_ADDRESS: TestSCAddress = TestSCAddress::new("enshrine-esdt"); const ENSHRINE_ESDT_CODE_PATH: MxscPath = MxscPath::new("output/enshrine-esdt-safe.mxsc-json"); @@ -308,7 +309,7 @@ impl EnshrineTestState { &mut self, from: TestAddress, to: TestAddress, - payment: EsdtTokenPayment, + payment: PaymentsVec, deposit_args: OptionalTransferData, error_status: Option, ) { @@ -320,7 +321,7 @@ impl EnshrineTestState { .to(ENSHRINE_ESDT_ADDRESS) .typed(enshrine_esdt_safe_proxy::EnshrineEsdtSafeProxy) .deposit(to, deposit_args) - .esdt(payment) + .payment(payment) .returns(ExpectError(status.code, status.error_message)) .run(), None => self @@ -330,7 +331,7 @@ impl EnshrineTestState { .to(ENSHRINE_ESDT_ADDRESS) .typed(enshrine_esdt_safe_proxy::EnshrineEsdtSafeProxy) .deposit(to, deposit_args) - .esdt(payment) + .payment(payment) .run(), } } @@ -508,7 +509,11 @@ fn test_register_tokens_insufficient_wegld() { #[test] fn test_deposit_fee_market_address_not_set() { let mut state = EnshrineTestState::new(); - let payment = EsdtTokenPayment::new(WEGLD_IDENTIFIER.into(), 0, BigUint::from(10000u64)); + let payment = PaymentsVec::from(EsdtTokenPayment::new( + WEGLD_IDENTIFIER.into(), + 0, + BigUint::from(10000u64), + )); let error_status = ErrorStatus { code: 4, error_message: "Fee market address is not set", @@ -525,22 +530,36 @@ fn test_deposit_fee_market_address_not_set() { } #[test] -fn test_deposit_fee_enabled_nothing_to_transfer() { +fn test_deposit() { let mut state = EnshrineTestState::new(); - let payment = EsdtTokenPayment::new(WEGLD_IDENTIFIER.into(), 0, BigUint::from(10000u64)); - let error_status = ErrorStatus { - code: 4, - error_message: "Nothing to transfer", - }; + let amount = BigUint::from(10000u64); + let wegld_payment = EsdtTokenPayment::new(WEGLD_IDENTIFIER.into(), 0, amount.clone()); + let crowd_payment = EsdtTokenPayment::new(CROWD_TOKEN_ID.into(), 0, amount); + let mut payments = PaymentsVec::new(); + + payments.push(wegld_payment); + payments.push(crowd_payment); state.propose_setup_contracts(false); - state.propose_register_fee_market_address(FEE_MARKET_ADDRESS); state.deploy_fee_market_contract(); + state.propose_register_fee_market_address(FEE_MARKET_ADDRESS); state.propose_deposit( ENSHRINE_ESDT_OWNER_ADDRESS, USER_ADDRESS, - payment, + payments, OptionalValue::None, - Some(error_status), - ) + None, + ); + + let expected_wegld_amount = BigUint::from(WEGLD_BALANCE) - BigUint::from(10000u64); + + state + .world + .check_account(ENSHRINE_ESDT_OWNER_ADDRESS) + .esdt_balance(WEGLD_IDENTIFIER, &expected_wegld_amount); + + state + .world + .check_account(ENSHRINE_ESDT_OWNER_ADDRESS) + .esdt_balance(WEGLD_IDENTIFIER, &expected_wegld_amount); } From 9f983afd9cab6364a583745221d3f9fb291d3d1a Mon Sep 17 00:00:00 2001 From: Andrei Baltariu Date: Wed, 4 Sep 2024 12:12:23 +0300 Subject: [PATCH 291/523] Added nothing to transfer unit test Signed-off-by: Andrei Baltariu --- .../tests/enshrine_esdt_safe_blackbox_test.rs | 25 +++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/enshrine-esdt-safe/tests/enshrine_esdt_safe_blackbox_test.rs b/enshrine-esdt-safe/tests/enshrine_esdt_safe_blackbox_test.rs index 301b290b..4934978c 100644 --- a/enshrine-esdt-safe/tests/enshrine_esdt_safe_blackbox_test.rs +++ b/enshrine-esdt-safe/tests/enshrine_esdt_safe_blackbox_test.rs @@ -529,6 +529,31 @@ fn test_deposit_fee_market_address_not_set() { ) } +#[test] +fn test_deposit_nothing_to_transfer() { + let mut state = EnshrineTestState::new(); + let amount = BigUint::from(10000u64); + let wegld_payment = EsdtTokenPayment::new(WEGLD_IDENTIFIER.into(), 0, amount.clone()); + let mut payments = PaymentsVec::new(); + let error_status = ErrorStatus { + code: 4, + error_message: "Nothing to transfer", + }; + + payments.push(wegld_payment); + + state.propose_setup_contracts(false); + state.deploy_fee_market_contract(); + state.propose_register_fee_market_address(FEE_MARKET_ADDRESS); + state.propose_deposit( + ENSHRINE_ESDT_OWNER_ADDRESS, + USER_ADDRESS, + payments, + OptionalValue::None, + Some(error_status), + ); +} + #[test] fn test_deposit() { let mut state = EnshrineTestState::new(); From 95fab095ff1fb691c3c716815f3b9892fa7824d2 Mon Sep 17 00:00:00 2001 From: Andrei Baltariu Date: Wed, 4 Sep 2024 12:17:55 +0300 Subject: [PATCH 292/523] Added too many tokens test Signed-off-by: Andrei Baltariu --- .../tests/enshrine_esdt_safe_blackbox_test.rs | 25 +++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/enshrine-esdt-safe/tests/enshrine_esdt_safe_blackbox_test.rs b/enshrine-esdt-safe/tests/enshrine_esdt_safe_blackbox_test.rs index 4934978c..f456ec88 100644 --- a/enshrine-esdt-safe/tests/enshrine_esdt_safe_blackbox_test.rs +++ b/enshrine-esdt-safe/tests/enshrine_esdt_safe_blackbox_test.rs @@ -554,6 +554,31 @@ fn test_deposit_nothing_to_transfer() { ); } +#[test] +fn test_deposit_max_transfers_exceeded() { + let mut state = EnshrineTestState::new(); + let amount = BigUint::from(10000u64); + let wegld_payment = EsdtTokenPayment::new(WEGLD_IDENTIFIER.into(), 0, amount.clone()); + let mut payments = PaymentsVec::new(); + let error_status = ErrorStatus { + code: 4, + error_message: "Too many tokens", + }; + + payments.extend(std::iter::repeat(wegld_payment).take(11)); + + state.propose_setup_contracts(false); + state.deploy_fee_market_contract(); + state.propose_register_fee_market_address(FEE_MARKET_ADDRESS); + state.propose_deposit( + ENSHRINE_ESDT_OWNER_ADDRESS, + USER_ADDRESS, + payments, + OptionalValue::None, + Some(error_status), + ); +} + #[test] fn test_deposit() { let mut state = EnshrineTestState::new(); From 1c6f6e22185445754fed31a4bd11a8344b91d6bd Mon Sep 17 00:00:00 2001 From: Andrei Baltariu Date: Wed, 4 Sep 2024 12:34:11 +0300 Subject: [PATCH 293/523] Added test for gas limit too high scenario Signed-off-by: Andrei Baltariu --- .../tests/enshrine_esdt_safe_blackbox_test.rs | 66 +++++++++++++++---- 1 file changed, 55 insertions(+), 11 deletions(-) diff --git a/enshrine-esdt-safe/tests/enshrine_esdt_safe_blackbox_test.rs b/enshrine-esdt-safe/tests/enshrine_esdt_safe_blackbox_test.rs index f456ec88..645dc597 100644 --- a/enshrine-esdt-safe/tests/enshrine_esdt_safe_blackbox_test.rs +++ b/enshrine-esdt-safe/tests/enshrine_esdt_safe_blackbox_test.rs @@ -268,6 +268,16 @@ impl EnshrineTestState { .run(); } + fn propose_register_fee_market_address(&mut self, fee_market_address: TestSCAddress) { + self.world + .tx() + .from(ENSHRINE_ESDT_OWNER_ADDRESS) + .to(ENSHRINE_ESDT_ADDRESS) + .typed(enshrine_esdt_safe_proxy::EnshrineEsdtSafeProxy) + .set_fee_market_address(fee_market_address) + .run(); + } + fn propose_register_tokens( &mut self, sender: &TestAddress, @@ -369,6 +379,15 @@ impl EnshrineTestState { (tokens, data) } + fn setup_transfer_data( + &mut self, + gas_limit: GasLimit, + function: ManagedBuffer, + args: ManagedVec>, + ) -> OptionalTransferData { + OptionalValue::Some((gas_limit, function, args).into()) + } + fn get_operation_hash(&mut self, operation: &Operation) -> ManagedBuffer { let mut serialized_operation: ManagedBuffer = ManagedBuffer::new(); let _ = operation.top_encode(&mut serialized_operation); @@ -376,16 +395,6 @@ impl EnshrineTestState { ManagedBuffer::new_from_bytes(&sha256) } - - fn propose_register_fee_market_address(&mut self, fee_market_address: TestSCAddress) { - self.world - .tx() - .from(ENSHRINE_ESDT_OWNER_ADDRESS) - .to(ENSHRINE_ESDT_ADDRESS) - .typed(enshrine_esdt_safe_proxy::EnshrineEsdtSafeProxy) - .set_fee_market_address(fee_market_address) - .run(); - } } #[test] @@ -580,7 +589,7 @@ fn test_deposit_max_transfers_exceeded() { } #[test] -fn test_deposit() { +fn test_deposit_no_transfer_data() { let mut state = EnshrineTestState::new(); let amount = BigUint::from(10000u64); let wegld_payment = EsdtTokenPayment::new(WEGLD_IDENTIFIER.into(), 0, amount.clone()); @@ -613,3 +622,38 @@ fn test_deposit() { .check_account(ENSHRINE_ESDT_OWNER_ADDRESS) .esdt_balance(WEGLD_IDENTIFIER, &expected_wegld_amount); } + +#[test] +fn test_deposit_with_transfer_data_gas_limit_too_high() { + let mut state = EnshrineTestState::new(); + let amount = BigUint::from(10000u64); + let wegld_payment = EsdtTokenPayment::new(WEGLD_IDENTIFIER.into(), 0, amount.clone()); + let crowd_payment = EsdtTokenPayment::new(CROWD_TOKEN_ID.into(), 0, amount); + let mut payments = PaymentsVec::new(); + let gas_limit = 1000000000000000000 as u64; + let function = ManagedBuffer::from("some_function"); + let arg = ManagedBuffer::from("arg"); + let mut args = ManagedVec::new(); + args.push(arg); + + let transfer_data = state.setup_transfer_data(gas_limit, function, args); + + payments.push(wegld_payment); + payments.push(crowd_payment); + + let error_status = ErrorStatus { + code: 4, + error_message: "Gas limit too high", + }; + + state.propose_setup_contracts(false); + state.deploy_fee_market_contract(); + state.propose_register_fee_market_address(FEE_MARKET_ADDRESS); + state.propose_deposit( + ENSHRINE_ESDT_OWNER_ADDRESS, + USER_ADDRESS, + payments, + transfer_data, + Some(error_status), + ); +} From f088e5e451a80882353dc1ee46b4f402b2988d9f Mon Sep 17 00:00:00 2001 From: Andrei Baltariu Date: Wed, 4 Sep 2024 12:45:08 +0300 Subject: [PATCH 294/523] Added max gas limit endpoint Signed-off-by: Andrei Baltariu --- enshrine-esdt-safe/src/lib.rs | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/enshrine-esdt-safe/src/lib.rs b/enshrine-esdt-safe/src/lib.rs index ac47139f..c68f4bbf 100644 --- a/enshrine-esdt-safe/src/lib.rs +++ b/enshrine-esdt-safe/src/lib.rs @@ -1,6 +1,7 @@ #![no_std] use multiversx_sc::imports::*; +use transaction::GasLimit; pub mod common; pub mod enshrine_esdt_safe_proxy; @@ -75,6 +76,12 @@ pub trait EnshrineEsdtSafe: self.header_verifier_address().set(&header_verifier_address); } + #[only_owner] + #[endpoint(setHeaderVerifierAddress)] + fn set_max_user_tx_gas_limit(&self, max_user_tx_gas_limit: GasLimit) { + self.max_user_tx_gas_limit().set(&max_user_tx_gas_limit); + } + #[upgrade] fn upgrade(&self) {} } From 7105a95e4f3f9e3a72e925f7b5ba8e709a290ab8 Mon Sep 17 00:00:00 2001 From: Andrei Baltariu Date: Wed, 4 Sep 2024 12:54:37 +0300 Subject: [PATCH 295/523] Renamed endpoint alias + proxy regeneration Signed-off-by: Andrei Baltariu --- enshrine-esdt-safe/src/enshrine_esdt_safe_proxy.rs | 13 +++++++++++++ enshrine-esdt-safe/src/lib.rs | 2 +- .../wasm-enshrine-esdt-safe-full/src/lib.rs | 5 +++-- enshrine-esdt-safe/wasm/src/lib.rs | 5 +++-- 4 files changed, 20 insertions(+), 5 deletions(-) diff --git a/enshrine-esdt-safe/src/enshrine_esdt_safe_proxy.rs b/enshrine-esdt-safe/src/enshrine_esdt_safe_proxy.rs index 981c5d9d..7eff8748 100644 --- a/enshrine-esdt-safe/src/enshrine_esdt_safe_proxy.rs +++ b/enshrine-esdt-safe/src/enshrine_esdt_safe_proxy.rs @@ -120,6 +120,19 @@ where .original_result() } + pub fn set_max_user_tx_gas_limit< + Arg0: ProxyArg, + >( + self, + max_user_tx_gas_limit: Arg0, + ) -> TxTypedCall { + self.wrapped_tx + .payment(NotPayable) + .raw_call("setMaxTxGasLimit") + .argument(&max_user_tx_gas_limit) + .original_result() + } + pub fn deposit< Arg0: ProxyArg>, Arg1: ProxyArg, ManagedVec>>>>, diff --git a/enshrine-esdt-safe/src/lib.rs b/enshrine-esdt-safe/src/lib.rs index c68f4bbf..f088b003 100644 --- a/enshrine-esdt-safe/src/lib.rs +++ b/enshrine-esdt-safe/src/lib.rs @@ -77,7 +77,7 @@ pub trait EnshrineEsdtSafe: } #[only_owner] - #[endpoint(setHeaderVerifierAddress)] + #[endpoint(setMaxTxGasLimit)] fn set_max_user_tx_gas_limit(&self, max_user_tx_gas_limit: GasLimit) { self.max_user_tx_gas_limit().set(&max_user_tx_gas_limit); } diff --git a/enshrine-esdt-safe/wasm-enshrine-esdt-safe-full/src/lib.rs b/enshrine-esdt-safe/wasm-enshrine-esdt-safe-full/src/lib.rs index 04d8d191..11a4fe9e 100644 --- a/enshrine-esdt-safe/wasm-enshrine-esdt-safe-full/src/lib.rs +++ b/enshrine-esdt-safe/wasm-enshrine-esdt-safe-full/src/lib.rs @@ -6,9 +6,9 @@ // Init: 1 // Upgrade: 1 -// Endpoints: 28 +// Endpoints: 29 // Async Callback: 1 -// Total number of exported functions: 31 +// Total number of exported functions: 32 #![no_std] @@ -22,6 +22,7 @@ multiversx_sc_wasm_adapter::endpoints! { upgrade => upgrade setFeeMarketAddress => set_fee_market_address setHeaderVerifierAddress => set_header_verifier_address + setMaxTxGasLimit => set_max_user_tx_gas_limit deposit => deposit setMinValidSigners => set_min_valid_signers addSigners => add_signers diff --git a/enshrine-esdt-safe/wasm/src/lib.rs b/enshrine-esdt-safe/wasm/src/lib.rs index 04d8d191..11a4fe9e 100644 --- a/enshrine-esdt-safe/wasm/src/lib.rs +++ b/enshrine-esdt-safe/wasm/src/lib.rs @@ -6,9 +6,9 @@ // Init: 1 // Upgrade: 1 -// Endpoints: 28 +// Endpoints: 29 // Async Callback: 1 -// Total number of exported functions: 31 +// Total number of exported functions: 32 #![no_std] @@ -22,6 +22,7 @@ multiversx_sc_wasm_adapter::endpoints! { upgrade => upgrade setFeeMarketAddress => set_fee_market_address setHeaderVerifierAddress => set_header_verifier_address + setMaxTxGasLimit => set_max_user_tx_gas_limit deposit => deposit setMinValidSigners => set_min_valid_signers addSigners => add_signers From ebfde941430910348b2b264e3a3ed66e590d1b3d Mon Sep 17 00:00:00 2001 From: Andrei Baltariu Date: Wed, 4 Sep 2024 12:54:46 +0300 Subject: [PATCH 296/523] Added test for deposit with transfer data Signed-off-by: Andrei Baltariu --- .../tests/enshrine_esdt_safe_blackbox_test.rs | 55 ++++++++++++++++++- 1 file changed, 54 insertions(+), 1 deletion(-) diff --git a/enshrine-esdt-safe/tests/enshrine_esdt_safe_blackbox_test.rs b/enshrine-esdt-safe/tests/enshrine_esdt_safe_blackbox_test.rs index 645dc597..1ffc2e40 100644 --- a/enshrine-esdt-safe/tests/enshrine_esdt_safe_blackbox_test.rs +++ b/enshrine-esdt-safe/tests/enshrine_esdt_safe_blackbox_test.rs @@ -346,6 +346,16 @@ impl EnshrineTestState { } } + fn propose_set_max_user_tx_gas_limit(&mut self, max_gas_limit: GasLimit) { + self.world + .tx() + .from(ENSHRINE_ESDT_OWNER_ADDRESS) + .to(ENSHRINE_ESDT_ADDRESS) + .typed(enshrine_esdt_safe_proxy::EnshrineEsdtSafeProxy) + .set_max_user_tx_gas_limit(max_gas_limit) + .run(); + } + fn mock_bls_signature( &mut self, operation_hash: &ManagedBuffer, @@ -620,7 +630,7 @@ fn test_deposit_no_transfer_data() { state .world .check_account(ENSHRINE_ESDT_OWNER_ADDRESS) - .esdt_balance(WEGLD_IDENTIFIER, &expected_wegld_amount); + .esdt_balance(CROWD_TOKEN_ID, &expected_wegld_amount); } #[test] @@ -657,3 +667,46 @@ fn test_deposit_with_transfer_data_gas_limit_too_high() { Some(error_status), ); } + +#[test] +fn test_deposit_with_transfer_data() { + let mut state = EnshrineTestState::new(); + let amount = BigUint::from(10000u64); + let wegld_payment = EsdtTokenPayment::new(WEGLD_IDENTIFIER.into(), 0, amount.clone()); + let crowd_payment = EsdtTokenPayment::new(CROWD_TOKEN_ID.into(), 0, amount); + let mut payments = PaymentsVec::new(); + let gas_limit = 1000000000 as u64; + let function = ManagedBuffer::from("some_function"); + let arg = ManagedBuffer::from("arg"); + let mut args = ManagedVec::new(); + args.push(arg); + + let transfer_data = state.setup_transfer_data(gas_limit, function, args); + + payments.push(wegld_payment); + payments.push(crowd_payment); + + state.propose_setup_contracts(false); + state.deploy_fee_market_contract(); + state.propose_register_fee_market_address(FEE_MARKET_ADDRESS); + state.propose_set_max_user_tx_gas_limit(gas_limit); + state.propose_deposit( + ENSHRINE_ESDT_OWNER_ADDRESS, + USER_ADDRESS, + payments, + transfer_data, + None, + ); + + let expected_wegld_amount = BigUint::from(WEGLD_BALANCE) - BigUint::from(10000u64); + + state + .world + .check_account(ENSHRINE_ESDT_OWNER_ADDRESS) + .esdt_balance(WEGLD_IDENTIFIER, &expected_wegld_amount); + + state + .world + .check_account(ENSHRINE_ESDT_OWNER_ADDRESS) + .esdt_balance(CROWD_TOKEN_ID, &expected_wegld_amount); +} From 7762ba598ff7be03b6735f2ce7453e87393d49c4 Mon Sep 17 00:00:00 2001 From: Andrei Baltariu Date: Wed, 4 Sep 2024 12:58:00 +0300 Subject: [PATCH 297/523] Added banned endpoint name endpoint Signed-off-by: Andrei Baltariu --- enshrine-esdt-safe/src/enshrine_esdt_safe_proxy.rs | 13 +++++++++++++ enshrine-esdt-safe/src/lib.rs | 6 ++++++ .../wasm-enshrine-esdt-safe-full/src/lib.rs | 5 +++-- enshrine-esdt-safe/wasm/src/lib.rs | 5 +++-- 4 files changed, 25 insertions(+), 4 deletions(-) diff --git a/enshrine-esdt-safe/src/enshrine_esdt_safe_proxy.rs b/enshrine-esdt-safe/src/enshrine_esdt_safe_proxy.rs index 7eff8748..3f984122 100644 --- a/enshrine-esdt-safe/src/enshrine_esdt_safe_proxy.rs +++ b/enshrine-esdt-safe/src/enshrine_esdt_safe_proxy.rs @@ -133,6 +133,19 @@ where .original_result() } + pub fn set_banned_endpoint< + Arg0: ProxyArg>, + >( + self, + endpoint_name: Arg0, + ) -> TxTypedCall { + self.wrapped_tx + .payment(NotPayable) + .raw_call("setBannedEndpoint") + .argument(&endpoint_name) + .original_result() + } + pub fn deposit< Arg0: ProxyArg>, Arg1: ProxyArg, ManagedVec>>>>, diff --git a/enshrine-esdt-safe/src/lib.rs b/enshrine-esdt-safe/src/lib.rs index f088b003..7a874fcb 100644 --- a/enshrine-esdt-safe/src/lib.rs +++ b/enshrine-esdt-safe/src/lib.rs @@ -82,6 +82,12 @@ pub trait EnshrineEsdtSafe: self.max_user_tx_gas_limit().set(&max_user_tx_gas_limit); } + #[only_owner] + #[endpoint(setBannedEndpoint)] + fn set_banned_endpoint(&self, endpoint_name: ManagedBuffer) { + self.banned_endpoint_names().insert(endpoint_name); + } + #[upgrade] fn upgrade(&self) {} } diff --git a/enshrine-esdt-safe/wasm-enshrine-esdt-safe-full/src/lib.rs b/enshrine-esdt-safe/wasm-enshrine-esdt-safe-full/src/lib.rs index 11a4fe9e..b31426e6 100644 --- a/enshrine-esdt-safe/wasm-enshrine-esdt-safe-full/src/lib.rs +++ b/enshrine-esdt-safe/wasm-enshrine-esdt-safe-full/src/lib.rs @@ -6,9 +6,9 @@ // Init: 1 // Upgrade: 1 -// Endpoints: 29 +// Endpoints: 30 // Async Callback: 1 -// Total number of exported functions: 32 +// Total number of exported functions: 33 #![no_std] @@ -23,6 +23,7 @@ multiversx_sc_wasm_adapter::endpoints! { setFeeMarketAddress => set_fee_market_address setHeaderVerifierAddress => set_header_verifier_address setMaxTxGasLimit => set_max_user_tx_gas_limit + setBannedEndpoint => set_banned_endpoint deposit => deposit setMinValidSigners => set_min_valid_signers addSigners => add_signers diff --git a/enshrine-esdt-safe/wasm/src/lib.rs b/enshrine-esdt-safe/wasm/src/lib.rs index 11a4fe9e..b31426e6 100644 --- a/enshrine-esdt-safe/wasm/src/lib.rs +++ b/enshrine-esdt-safe/wasm/src/lib.rs @@ -6,9 +6,9 @@ // Init: 1 // Upgrade: 1 -// Endpoints: 29 +// Endpoints: 30 // Async Callback: 1 -// Total number of exported functions: 32 +// Total number of exported functions: 33 #![no_std] @@ -23,6 +23,7 @@ multiversx_sc_wasm_adapter::endpoints! { setFeeMarketAddress => set_fee_market_address setHeaderVerifierAddress => set_header_verifier_address setMaxTxGasLimit => set_max_user_tx_gas_limit + setBannedEndpoint => set_banned_endpoint deposit => deposit setMinValidSigners => set_min_valid_signers addSigners => add_signers From 0fb25c0a712ae4dc1e3ef6ec0846da7254178b67 Mon Sep 17 00:00:00 2001 From: Andrei Baltariu Date: Wed, 4 Sep 2024 13:03:03 +0300 Subject: [PATCH 298/523] Added test for banned endpoint name scenario Signed-off-by: Andrei Baltariu --- .../tests/enshrine_esdt_safe_blackbox_test.rs | 47 +++++++++++++++++++ 1 file changed, 47 insertions(+) diff --git a/enshrine-esdt-safe/tests/enshrine_esdt_safe_blackbox_test.rs b/enshrine-esdt-safe/tests/enshrine_esdt_safe_blackbox_test.rs index 1ffc2e40..80c4ea5a 100644 --- a/enshrine-esdt-safe/tests/enshrine_esdt_safe_blackbox_test.rs +++ b/enshrine-esdt-safe/tests/enshrine_esdt_safe_blackbox_test.rs @@ -356,6 +356,16 @@ impl EnshrineTestState { .run(); } + fn propose_set_banned_endpoint(&mut self, endpoint_name: ManagedBuffer) { + self.world + .tx() + .from(ENSHRINE_ESDT_OWNER_ADDRESS) + .to(ENSHRINE_ESDT_ADDRESS) + .typed(enshrine_esdt_safe_proxy::EnshrineEsdtSafeProxy) + .set_banned_endpoint(endpoint_name) + .run(); + } + fn mock_bls_signature( &mut self, operation_hash: &ManagedBuffer, @@ -668,6 +678,43 @@ fn test_deposit_with_transfer_data_gas_limit_too_high() { ); } +#[test] +fn test_deposit_with_transfer_data_banned_endpoint() { + let mut state = EnshrineTestState::new(); + let amount = BigUint::from(10000u64); + let wegld_payment = EsdtTokenPayment::new(WEGLD_IDENTIFIER.into(), 0, amount.clone()); + let crowd_payment = EsdtTokenPayment::new(CROWD_TOKEN_ID.into(), 0, amount); + let mut payments = PaymentsVec::new(); + let gas_limit = 1000000000 as u64; + let function = ManagedBuffer::from("some_function"); + let arg = ManagedBuffer::from("arg"); + let mut args = ManagedVec::new(); + args.push(arg); + + let transfer_data = state.setup_transfer_data(gas_limit, function.clone(), args); + + payments.push(wegld_payment); + payments.push(crowd_payment); + + let error_status = ErrorStatus { + code: 4, + error_message: "Banned endpoint name", + }; + + state.propose_setup_contracts(false); + state.deploy_fee_market_contract(); + state.propose_register_fee_market_address(FEE_MARKET_ADDRESS); + state.propose_set_max_user_tx_gas_limit(gas_limit); + state.propose_set_banned_endpoint(function); + state.propose_deposit( + ENSHRINE_ESDT_OWNER_ADDRESS, + USER_ADDRESS, + payments, + transfer_data, + Some(error_status), + ); +} + #[test] fn test_deposit_with_transfer_data() { let mut state = EnshrineTestState::new(); From 035d278f2a4466e39e7fdcde0a99538bd2f1963f Mon Sep 17 00:00:00 2001 From: Andrei Baltariu Date: Wed, 4 Sep 2024 15:47:39 +0300 Subject: [PATCH 299/523] Added deploy fee market to setup function Signed-off-by: Andrei Baltariu --- .../tests/enshrine_esdt_safe_blackbox_test.rs | 18 ++++-------------- 1 file changed, 4 insertions(+), 14 deletions(-) diff --git a/enshrine-esdt-safe/tests/enshrine_esdt_safe_blackbox_test.rs b/enshrine-esdt-safe/tests/enshrine_esdt_safe_blackbox_test.rs index 80c4ea5a..95ea8169 100644 --- a/enshrine-esdt-safe/tests/enshrine_esdt_safe_blackbox_test.rs +++ b/enshrine-esdt-safe/tests/enshrine_esdt_safe_blackbox_test.rs @@ -202,7 +202,9 @@ impl EnshrineTestState { ); self.deploy_header_verifier_contract(); self.deploy_token_handler_contract(); + self.deploy_fee_market_contract(); self.propose_set_header_verifier_address(); + self.propose_register_fee_market_address(); self } @@ -268,13 +270,13 @@ impl EnshrineTestState { .run(); } - fn propose_register_fee_market_address(&mut self, fee_market_address: TestSCAddress) { + fn propose_register_fee_market_address(&mut self) { self.world .tx() .from(ENSHRINE_ESDT_OWNER_ADDRESS) .to(ENSHRINE_ESDT_ADDRESS) .typed(enshrine_esdt_safe_proxy::EnshrineEsdtSafeProxy) - .set_fee_market_address(fee_market_address) + .set_fee_market_address(FEE_MARKET_ADDRESS) .run(); } @@ -572,8 +574,6 @@ fn test_deposit_nothing_to_transfer() { payments.push(wegld_payment); state.propose_setup_contracts(false); - state.deploy_fee_market_contract(); - state.propose_register_fee_market_address(FEE_MARKET_ADDRESS); state.propose_deposit( ENSHRINE_ESDT_OWNER_ADDRESS, USER_ADDRESS, @@ -597,8 +597,6 @@ fn test_deposit_max_transfers_exceeded() { payments.extend(std::iter::repeat(wegld_payment).take(11)); state.propose_setup_contracts(false); - state.deploy_fee_market_contract(); - state.propose_register_fee_market_address(FEE_MARKET_ADDRESS); state.propose_deposit( ENSHRINE_ESDT_OWNER_ADDRESS, USER_ADDRESS, @@ -620,8 +618,6 @@ fn test_deposit_no_transfer_data() { payments.push(crowd_payment); state.propose_setup_contracts(false); - state.deploy_fee_market_contract(); - state.propose_register_fee_market_address(FEE_MARKET_ADDRESS); state.propose_deposit( ENSHRINE_ESDT_OWNER_ADDRESS, USER_ADDRESS, @@ -667,8 +663,6 @@ fn test_deposit_with_transfer_data_gas_limit_too_high() { }; state.propose_setup_contracts(false); - state.deploy_fee_market_contract(); - state.propose_register_fee_market_address(FEE_MARKET_ADDRESS); state.propose_deposit( ENSHRINE_ESDT_OWNER_ADDRESS, USER_ADDRESS, @@ -702,8 +696,6 @@ fn test_deposit_with_transfer_data_banned_endpoint() { }; state.propose_setup_contracts(false); - state.deploy_fee_market_contract(); - state.propose_register_fee_market_address(FEE_MARKET_ADDRESS); state.propose_set_max_user_tx_gas_limit(gas_limit); state.propose_set_banned_endpoint(function); state.propose_deposit( @@ -734,8 +726,6 @@ fn test_deposit_with_transfer_data() { payments.push(crowd_payment); state.propose_setup_contracts(false); - state.deploy_fee_market_contract(); - state.propose_register_fee_market_address(FEE_MARKET_ADDRESS); state.propose_set_max_user_tx_gas_limit(gas_limit); state.propose_deposit( ENSHRINE_ESDT_OWNER_ADDRESS, From 25455d73cb36f9f5ccdcd123f5b7ec3935c68c86 Mon Sep 17 00:00:00 2001 From: Andrei Baltariu Date: Wed, 4 Sep 2024 15:55:36 +0300 Subject: [PATCH 300/523] Added disable fee option to deploy_contracts setup function Signed-off-by: Andrei Baltariu --- .../tests/enshrine_esdt_safe_blackbox_test.rs | 66 ++++++++----------- 1 file changed, 29 insertions(+), 37 deletions(-) diff --git a/enshrine-esdt-safe/tests/enshrine_esdt_safe_blackbox_test.rs b/enshrine-esdt-safe/tests/enshrine_esdt_safe_blackbox_test.rs index 95ea8169..e58205f0 100644 --- a/enshrine-esdt-safe/tests/enshrine_esdt_safe_blackbox_test.rs +++ b/enshrine-esdt-safe/tests/enshrine_esdt_safe_blackbox_test.rs @@ -194,7 +194,11 @@ impl EnshrineTestState { self } - fn propose_setup_contracts(&mut self, is_sovereign_chain: bool) -> &mut Self { + fn propose_setup_contracts( + &mut self, + is_sovereign_chain: bool, + is_fee_enabled: bool, + ) -> &mut Self { self.deploy_enshrine_esdt_contract( is_sovereign_chain, Some(TokenIdentifier::from(WEGLD_IDENTIFIER)), @@ -203,9 +207,20 @@ impl EnshrineTestState { self.deploy_header_verifier_contract(); self.deploy_token_handler_contract(); self.deploy_fee_market_contract(); + self.propose_set_header_verifier_address(); self.propose_register_fee_market_address(); + if !is_fee_enabled { + self.world + .tx() + .from(ENSHRINE_ESDT_OWNER_ADDRESS) + .to(FEE_MARKET_ADDRESS) + .typed(fee_market_proxy::FeeMarketProxy) + .disable_fee() + .run(); + } + self } @@ -423,7 +438,7 @@ impl EnshrineTestState { fn test_deploy() { let mut state = EnshrineTestState::new(); - state.propose_setup_contracts(false); + state.propose_setup_contracts(false, false); } #[test] @@ -435,7 +450,7 @@ fn test_sovereign_prefix_no_prefix() { error_message: "Operation is not registered", }); - state.propose_setup_contracts(false); + state.propose_setup_contracts(false, false); state.propose_register_operation(&token_vec); state.propose_execute_operation(error_status, &token_vec); } @@ -449,7 +464,7 @@ fn test_sovereign_prefix_has_prefix() { error_message: "Operation is not registered", }); - state.propose_setup_contracts(false); + state.propose_setup_contracts(false, false); state.propose_register_operation(&token_vec); state.propose_execute_operation(error_status, &token_vec); } @@ -463,7 +478,7 @@ fn test_register_tokens_insufficient_funds() { let payment_amount = BigUint::from(DEFAULT_ISSUE_COST * token_vec.len() as u64); let payment = EsdtTokenPayment::new(WEGLD_IDENTIFIER.into(), 0, payment_amount); - state.propose_setup_contracts(false); + state.propose_setup_contracts(false, false); state.propose_register_tokens( &USER_ADDRESS, payment, @@ -484,7 +499,7 @@ fn test_register_tokens_wrong_token_as_fee() { let payment_amount = BigUint::from(DEFAULT_ISSUE_COST * token_vec.len() as u64); let payment = EsdtTokenPayment::new(CROWD_TOKEN_ID.into(), 0, payment_amount); - state.propose_setup_contracts(false); + state.propose_setup_contracts(false, false); state.propose_register_tokens( &ENSHRINE_ESDT_OWNER_ADDRESS, payment, @@ -503,7 +518,7 @@ fn test_register_tokens() { let payment_amount = BigUint::from(DEFAULT_ISSUE_COST * token_vec.len() as u64); let payment = EsdtTokenPayment::new(WEGLD_IDENTIFIER.into(), 0, payment_amount); - state.propose_setup_contracts(false); + state.propose_setup_contracts(false, false); state.propose_register_tokens(&ENSHRINE_ESDT_OWNER_ADDRESS, payment, token_vec, None); state .world @@ -525,7 +540,7 @@ fn test_register_tokens_insufficient_wegld() { let payment_amount = BigUint::from(DEFAULT_ISSUE_COST + token_vec.len() as u64); let payment = EsdtTokenPayment::new(WEGLD_IDENTIFIER.into(), 0, payment_amount); - state.propose_setup_contracts(false); + state.propose_setup_contracts(false, false); state.propose_register_tokens( &ENSHRINE_ESDT_OWNER_ADDRESS, payment, @@ -537,29 +552,6 @@ fn test_register_tokens_insufficient_wegld() { ); } -#[test] -fn test_deposit_fee_market_address_not_set() { - let mut state = EnshrineTestState::new(); - let payment = PaymentsVec::from(EsdtTokenPayment::new( - WEGLD_IDENTIFIER.into(), - 0, - BigUint::from(10000u64), - )); - let error_status = ErrorStatus { - code: 4, - error_message: "Fee market address is not set", - }; - - state.propose_setup_contracts(false); - state.propose_deposit( - ENSHRINE_ESDT_OWNER_ADDRESS, - USER_ADDRESS, - payment, - OptionalValue::None, - Some(error_status), - ) -} - #[test] fn test_deposit_nothing_to_transfer() { let mut state = EnshrineTestState::new(); @@ -573,7 +565,7 @@ fn test_deposit_nothing_to_transfer() { payments.push(wegld_payment); - state.propose_setup_contracts(false); + state.propose_setup_contracts(false, true); state.propose_deposit( ENSHRINE_ESDT_OWNER_ADDRESS, USER_ADDRESS, @@ -596,7 +588,7 @@ fn test_deposit_max_transfers_exceeded() { payments.extend(std::iter::repeat(wegld_payment).take(11)); - state.propose_setup_contracts(false); + state.propose_setup_contracts(false, false); state.propose_deposit( ENSHRINE_ESDT_OWNER_ADDRESS, USER_ADDRESS, @@ -617,7 +609,7 @@ fn test_deposit_no_transfer_data() { payments.push(wegld_payment); payments.push(crowd_payment); - state.propose_setup_contracts(false); + state.propose_setup_contracts(false, false); state.propose_deposit( ENSHRINE_ESDT_OWNER_ADDRESS, USER_ADDRESS, @@ -662,7 +654,7 @@ fn test_deposit_with_transfer_data_gas_limit_too_high() { error_message: "Gas limit too high", }; - state.propose_setup_contracts(false); + state.propose_setup_contracts(false, false); state.propose_deposit( ENSHRINE_ESDT_OWNER_ADDRESS, USER_ADDRESS, @@ -695,7 +687,7 @@ fn test_deposit_with_transfer_data_banned_endpoint() { error_message: "Banned endpoint name", }; - state.propose_setup_contracts(false); + state.propose_setup_contracts(false, false); state.propose_set_max_user_tx_gas_limit(gas_limit); state.propose_set_banned_endpoint(function); state.propose_deposit( @@ -725,7 +717,7 @@ fn test_deposit_with_transfer_data() { payments.push(wegld_payment); payments.push(crowd_payment); - state.propose_setup_contracts(false); + state.propose_setup_contracts(false, false); state.propose_set_max_user_tx_gas_limit(gas_limit); state.propose_deposit( ENSHRINE_ESDT_OWNER_ADDRESS, From 6a08ae7dcab54583f23586b40f96d9716402255e Mon Sep 17 00:00:00 2001 From: Andrei Baltariu Date: Thu, 5 Sep 2024 09:55:55 +0300 Subject: [PATCH 301/523] Token handler fw upgrade Signed-off-by: Andrei Baltariu --- .../wasm-chain-factory-full/Cargo.lock | 36 +++++++++---------- .../wasm-chain-factory-full/Cargo.toml | 2 +- .../wasm-chain-factory-view/Cargo.lock | 36 +++++++++---------- .../wasm-chain-factory-view/Cargo.toml | 2 +- token-handler/Cargo.toml | 4 +-- token-handler/meta/Cargo.toml | 2 +- .../wasm-token-handler-full/Cargo.lock | 36 +++++++++---------- .../wasm-token-handler-full/Cargo.toml | 2 +- .../wasm-token-handler-view/Cargo.lock | 36 +++++++++---------- .../wasm-token-handler-view/Cargo.toml | 2 +- token-handler/wasm/Cargo.lock | 36 +++++++++---------- token-handler/wasm/Cargo.toml | 2 +- 12 files changed, 98 insertions(+), 98 deletions(-) diff --git a/chain-factory/wasm-chain-factory-full/Cargo.lock b/chain-factory/wasm-chain-factory-full/Cargo.lock index 3af94498..429a7753 100644 --- a/chain-factory/wasm-chain-factory-full/Cargo.lock +++ b/chain-factory/wasm-chain-factory-full/Cargo.lock @@ -4,9 +4,9 @@ version = 3 [[package]] name = "arrayvec" -version = "0.7.4" +version = "0.7.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "96d30a06541fbafbc7f82ed10c06164cfbd2c401138f6addd8404629c4b16711" +checksum = "7c02d123df017efcdfbd739ef81735b36c5ba83ec3c59c80a9d7ecc718f92e50" [[package]] name = "autocfg" @@ -74,9 +74,9 @@ checksum = "6fe2267d4ed49bc07b63801559be28c718ea06c4738b7a03c94df7386d2cde46" [[package]] name = "multiversx-sc" -version = "0.52.3" +version = "0.53.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "526760b1d6236c011285b264a70a0a9dd3b3dbc53c3b5f76932f4bcfd3a8910c" +checksum = "2a86a27b04bb7cca97ad8971ee57e6b978619623dde4ba9acae1d4ecb436f062" dependencies = [ "bitflags", "hex-literal", @@ -88,9 +88,9 @@ dependencies = [ [[package]] name = "multiversx-sc-codec" -version = "0.20.1" +version = "0.21.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ad4f318427761faecf26c1f3115a3beeb5f61858845a60547d9763aa981ddd2d" +checksum = "007d7a5a8534e5dc9128cb8f15a65a21dd378e135c6016c7cd1491cd012bc8cb" dependencies = [ "arrayvec", "multiversx-sc-codec-derive", @@ -99,9 +99,9 @@ dependencies = [ [[package]] name = "multiversx-sc-codec-derive" -version = "0.20.1" +version = "0.21.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "476501462b0c2654b64f9dec6f2c480e24b4e9b7133ec10b7167e64acda35d04" +checksum = "dffba1dce273ed5b61ee1b90aeea5c8c744617d0f12624f620768c144d83e753" dependencies = [ "hex", "proc-macro2", @@ -111,9 +111,9 @@ dependencies = [ [[package]] name = "multiversx-sc-derive" -version = "0.52.3" +version = "0.53.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3557f2f12640a8a07fa6af66cc2a13b188c5b61bed72db22fe631fb3a60c3e96" +checksum = "f7a6ee275d6b1c2b86394369df0bc62a3f25018cbab12668a191b89d88fdcf71" dependencies = [ "hex", "proc-macro2", @@ -124,18 +124,18 @@ dependencies = [ [[package]] name = "multiversx-sc-modules" -version = "0.52.3" +version = "0.53.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "61f5c29c6044f3dc9e866858feee625d7fae5604a68ac7bd66dec683eee97563" +checksum = "fece2308326cc59c53fedd682259625e8ecc306e4c3b35051725ca388677b47b" dependencies = [ "multiversx-sc", ] [[package]] name = "multiversx-sc-wasm-adapter" -version = "0.52.3" +version = "0.53.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ed13aaca9cbdbc6911174cd3029e750a7563d85dd3daaa1107b1fd31c7f17245" +checksum = "0ab5bb42b3ce827227a5e38f3c24fbe0fb23d475425b049043e193186e36c590" dependencies = [ "multiversx-sc", ] @@ -169,9 +169,9 @@ dependencies = [ [[package]] name = "quote" -version = "1.0.36" +version = "1.0.37" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0fa76aaf39101c457836aec0ce2316dbdc3ab723cdda1c6bd4e6ad4208acaca7" +checksum = "b5b9d34b8991d19d98081b46eacdd8eb58c6f2b201139f7c5f643cc155a633af" dependencies = [ "proc-macro2", ] @@ -194,9 +194,9 @@ checksum = "3c5e1a9a646d36c3599cd173a41282daf47c44583ad367b8e6837255952e5c67" [[package]] name = "syn" -version = "2.0.72" +version = "2.0.77" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dc4b9b9bf2add8093d3f2c0204471e951b2285580335de42f9d2534f3ae7a8af" +checksum = "9f35bcdf61fd8e7be6caf75f429fdca8beb3ed76584befb503b1569faee373ed" dependencies = [ "proc-macro2", "quote", diff --git a/chain-factory/wasm-chain-factory-full/Cargo.toml b/chain-factory/wasm-chain-factory-full/Cargo.toml index d0fa9d63..a288cafc 100644 --- a/chain-factory/wasm-chain-factory-full/Cargo.toml +++ b/chain-factory/wasm-chain-factory-full/Cargo.toml @@ -28,7 +28,7 @@ panic = "abort" path = ".." [dependencies.multiversx-sc-wasm-adapter] -version = "=0.52.3" +version = "=0.53.0" [workspace] members = ["."] diff --git a/chain-factory/wasm-chain-factory-view/Cargo.lock b/chain-factory/wasm-chain-factory-view/Cargo.lock index 9b0e4093..fd18866c 100644 --- a/chain-factory/wasm-chain-factory-view/Cargo.lock +++ b/chain-factory/wasm-chain-factory-view/Cargo.lock @@ -4,9 +4,9 @@ version = 3 [[package]] name = "arrayvec" -version = "0.7.4" +version = "0.7.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "96d30a06541fbafbc7f82ed10c06164cfbd2c401138f6addd8404629c4b16711" +checksum = "7c02d123df017efcdfbd739ef81735b36c5ba83ec3c59c80a9d7ecc718f92e50" [[package]] name = "autocfg" @@ -74,9 +74,9 @@ checksum = "6fe2267d4ed49bc07b63801559be28c718ea06c4738b7a03c94df7386d2cde46" [[package]] name = "multiversx-sc" -version = "0.52.3" +version = "0.53.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "526760b1d6236c011285b264a70a0a9dd3b3dbc53c3b5f76932f4bcfd3a8910c" +checksum = "2a86a27b04bb7cca97ad8971ee57e6b978619623dde4ba9acae1d4ecb436f062" dependencies = [ "bitflags", "hex-literal", @@ -88,9 +88,9 @@ dependencies = [ [[package]] name = "multiversx-sc-codec" -version = "0.20.1" +version = "0.21.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ad4f318427761faecf26c1f3115a3beeb5f61858845a60547d9763aa981ddd2d" +checksum = "007d7a5a8534e5dc9128cb8f15a65a21dd378e135c6016c7cd1491cd012bc8cb" dependencies = [ "arrayvec", "multiversx-sc-codec-derive", @@ -99,9 +99,9 @@ dependencies = [ [[package]] name = "multiversx-sc-codec-derive" -version = "0.20.1" +version = "0.21.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "476501462b0c2654b64f9dec6f2c480e24b4e9b7133ec10b7167e64acda35d04" +checksum = "dffba1dce273ed5b61ee1b90aeea5c8c744617d0f12624f620768c144d83e753" dependencies = [ "hex", "proc-macro2", @@ -111,9 +111,9 @@ dependencies = [ [[package]] name = "multiversx-sc-derive" -version = "0.52.3" +version = "0.53.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3557f2f12640a8a07fa6af66cc2a13b188c5b61bed72db22fe631fb3a60c3e96" +checksum = "f7a6ee275d6b1c2b86394369df0bc62a3f25018cbab12668a191b89d88fdcf71" dependencies = [ "hex", "proc-macro2", @@ -124,18 +124,18 @@ dependencies = [ [[package]] name = "multiversx-sc-modules" -version = "0.52.3" +version = "0.53.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "61f5c29c6044f3dc9e866858feee625d7fae5604a68ac7bd66dec683eee97563" +checksum = "fece2308326cc59c53fedd682259625e8ecc306e4c3b35051725ca388677b47b" dependencies = [ "multiversx-sc", ] [[package]] name = "multiversx-sc-wasm-adapter" -version = "0.52.3" +version = "0.53.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ed13aaca9cbdbc6911174cd3029e750a7563d85dd3daaa1107b1fd31c7f17245" +checksum = "0ab5bb42b3ce827227a5e38f3c24fbe0fb23d475425b049043e193186e36c590" dependencies = [ "multiversx-sc", ] @@ -169,9 +169,9 @@ dependencies = [ [[package]] name = "quote" -version = "1.0.36" +version = "1.0.37" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0fa76aaf39101c457836aec0ce2316dbdc3ab723cdda1c6bd4e6ad4208acaca7" +checksum = "b5b9d34b8991d19d98081b46eacdd8eb58c6f2b201139f7c5f643cc155a633af" dependencies = [ "proc-macro2", ] @@ -194,9 +194,9 @@ checksum = "3c5e1a9a646d36c3599cd173a41282daf47c44583ad367b8e6837255952e5c67" [[package]] name = "syn" -version = "2.0.72" +version = "2.0.77" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dc4b9b9bf2add8093d3f2c0204471e951b2285580335de42f9d2534f3ae7a8af" +checksum = "9f35bcdf61fd8e7be6caf75f429fdca8beb3ed76584befb503b1569faee373ed" dependencies = [ "proc-macro2", "quote", diff --git a/chain-factory/wasm-chain-factory-view/Cargo.toml b/chain-factory/wasm-chain-factory-view/Cargo.toml index 9ae6f348..4772b569 100644 --- a/chain-factory/wasm-chain-factory-view/Cargo.toml +++ b/chain-factory/wasm-chain-factory-view/Cargo.toml @@ -28,7 +28,7 @@ panic = "abort" path = ".." [dependencies.multiversx-sc-wasm-adapter] -version = "=0.52.3" +version = "=0.53.0" [workspace] members = ["."] diff --git a/token-handler/Cargo.toml b/token-handler/Cargo.toml index 0c6880a4..45280b46 100644 --- a/token-handler/Cargo.toml +++ b/token-handler/Cargo.toml @@ -18,10 +18,10 @@ path = "../header-verifier/" path = "../chain-factory/" [dependencies.multiversx-sc] -version = "0.52.3" +version = "0.53.0" [dev-dependencies] num-bigint = "0.4" [dev-dependencies.multiversx-sc-scenario] -version = "0.52.3" +version = "0.53.0" diff --git a/token-handler/meta/Cargo.toml b/token-handler/meta/Cargo.toml index a7f4f9c9..641f3bb1 100644 --- a/token-handler/meta/Cargo.toml +++ b/token-handler/meta/Cargo.toml @@ -8,5 +8,5 @@ publish = false path = ".." [dependencies.multiversx-sc-meta-lib] -version = "0.52.3" +version = "0.53.0" default-features = false diff --git a/token-handler/wasm-token-handler-full/Cargo.lock b/token-handler/wasm-token-handler-full/Cargo.lock index bc23486f..8e19af57 100644 --- a/token-handler/wasm-token-handler-full/Cargo.lock +++ b/token-handler/wasm-token-handler-full/Cargo.lock @@ -4,9 +4,9 @@ version = 3 [[package]] name = "arrayvec" -version = "0.7.4" +version = "0.7.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "96d30a06541fbafbc7f82ed10c06164cfbd2c401138f6addd8404629c4b16711" +checksum = "7c02d123df017efcdfbd739ef81735b36c5ba83ec3c59c80a9d7ecc718f92e50" [[package]] name = "autocfg" @@ -75,9 +75,9 @@ checksum = "6fe2267d4ed49bc07b63801559be28c718ea06c4738b7a03c94df7386d2cde46" [[package]] name = "multiversx-sc" -version = "0.52.3" +version = "0.53.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "526760b1d6236c011285b264a70a0a9dd3b3dbc53c3b5f76932f4bcfd3a8910c" +checksum = "2a86a27b04bb7cca97ad8971ee57e6b978619623dde4ba9acae1d4ecb436f062" dependencies = [ "bitflags", "hex-literal", @@ -89,9 +89,9 @@ dependencies = [ [[package]] name = "multiversx-sc-codec" -version = "0.20.1" +version = "0.21.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ad4f318427761faecf26c1f3115a3beeb5f61858845a60547d9763aa981ddd2d" +checksum = "007d7a5a8534e5dc9128cb8f15a65a21dd378e135c6016c7cd1491cd012bc8cb" dependencies = [ "arrayvec", "multiversx-sc-codec-derive", @@ -100,9 +100,9 @@ dependencies = [ [[package]] name = "multiversx-sc-codec-derive" -version = "0.20.1" +version = "0.21.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "476501462b0c2654b64f9dec6f2c480e24b4e9b7133ec10b7167e64acda35d04" +checksum = "dffba1dce273ed5b61ee1b90aeea5c8c744617d0f12624f620768c144d83e753" dependencies = [ "hex", "proc-macro2", @@ -112,9 +112,9 @@ dependencies = [ [[package]] name = "multiversx-sc-derive" -version = "0.52.3" +version = "0.53.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3557f2f12640a8a07fa6af66cc2a13b188c5b61bed72db22fe631fb3a60c3e96" +checksum = "f7a6ee275d6b1c2b86394369df0bc62a3f25018cbab12668a191b89d88fdcf71" dependencies = [ "hex", "proc-macro2", @@ -125,18 +125,18 @@ dependencies = [ [[package]] name = "multiversx-sc-modules" -version = "0.52.3" +version = "0.53.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "61f5c29c6044f3dc9e866858feee625d7fae5604a68ac7bd66dec683eee97563" +checksum = "fece2308326cc59c53fedd682259625e8ecc306e4c3b35051725ca388677b47b" dependencies = [ "multiversx-sc", ] [[package]] name = "multiversx-sc-wasm-adapter" -version = "0.52.3" +version = "0.53.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ed13aaca9cbdbc6911174cd3029e750a7563d85dd3daaa1107b1fd31c7f17245" +checksum = "0ab5bb42b3ce827227a5e38f3c24fbe0fb23d475425b049043e193186e36c590" dependencies = [ "multiversx-sc", ] @@ -170,9 +170,9 @@ dependencies = [ [[package]] name = "quote" -version = "1.0.36" +version = "1.0.37" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0fa76aaf39101c457836aec0ce2316dbdc3ab723cdda1c6bd4e6ad4208acaca7" +checksum = "b5b9d34b8991d19d98081b46eacdd8eb58c6f2b201139f7c5f643cc155a633af" dependencies = [ "proc-macro2", ] @@ -195,9 +195,9 @@ checksum = "3c5e1a9a646d36c3599cd173a41282daf47c44583ad367b8e6837255952e5c67" [[package]] name = "syn" -version = "2.0.72" +version = "2.0.77" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dc4b9b9bf2add8093d3f2c0204471e951b2285580335de42f9d2534f3ae7a8af" +checksum = "9f35bcdf61fd8e7be6caf75f429fdca8beb3ed76584befb503b1569faee373ed" dependencies = [ "proc-macro2", "quote", diff --git a/token-handler/wasm-token-handler-full/Cargo.toml b/token-handler/wasm-token-handler-full/Cargo.toml index 6dbbb67a..2c5f1a4d 100644 --- a/token-handler/wasm-token-handler-full/Cargo.toml +++ b/token-handler/wasm-token-handler-full/Cargo.toml @@ -28,7 +28,7 @@ panic = "abort" path = ".." [dependencies.multiversx-sc-wasm-adapter] -version = "0.52.3" +version = "0.53.0" [workspace] members = ["."] diff --git a/token-handler/wasm-token-handler-view/Cargo.lock b/token-handler/wasm-token-handler-view/Cargo.lock index 28880238..dc9f11d5 100644 --- a/token-handler/wasm-token-handler-view/Cargo.lock +++ b/token-handler/wasm-token-handler-view/Cargo.lock @@ -4,9 +4,9 @@ version = 3 [[package]] name = "arrayvec" -version = "0.7.4" +version = "0.7.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "96d30a06541fbafbc7f82ed10c06164cfbd2c401138f6addd8404629c4b16711" +checksum = "7c02d123df017efcdfbd739ef81735b36c5ba83ec3c59c80a9d7ecc718f92e50" [[package]] name = "autocfg" @@ -75,9 +75,9 @@ checksum = "6fe2267d4ed49bc07b63801559be28c718ea06c4738b7a03c94df7386d2cde46" [[package]] name = "multiversx-sc" -version = "0.52.3" +version = "0.53.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "526760b1d6236c011285b264a70a0a9dd3b3dbc53c3b5f76932f4bcfd3a8910c" +checksum = "2a86a27b04bb7cca97ad8971ee57e6b978619623dde4ba9acae1d4ecb436f062" dependencies = [ "bitflags", "hex-literal", @@ -89,9 +89,9 @@ dependencies = [ [[package]] name = "multiversx-sc-codec" -version = "0.20.1" +version = "0.21.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ad4f318427761faecf26c1f3115a3beeb5f61858845a60547d9763aa981ddd2d" +checksum = "007d7a5a8534e5dc9128cb8f15a65a21dd378e135c6016c7cd1491cd012bc8cb" dependencies = [ "arrayvec", "multiversx-sc-codec-derive", @@ -100,9 +100,9 @@ dependencies = [ [[package]] name = "multiversx-sc-codec-derive" -version = "0.20.1" +version = "0.21.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "476501462b0c2654b64f9dec6f2c480e24b4e9b7133ec10b7167e64acda35d04" +checksum = "dffba1dce273ed5b61ee1b90aeea5c8c744617d0f12624f620768c144d83e753" dependencies = [ "hex", "proc-macro2", @@ -112,9 +112,9 @@ dependencies = [ [[package]] name = "multiversx-sc-derive" -version = "0.52.3" +version = "0.53.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3557f2f12640a8a07fa6af66cc2a13b188c5b61bed72db22fe631fb3a60c3e96" +checksum = "f7a6ee275d6b1c2b86394369df0bc62a3f25018cbab12668a191b89d88fdcf71" dependencies = [ "hex", "proc-macro2", @@ -125,18 +125,18 @@ dependencies = [ [[package]] name = "multiversx-sc-modules" -version = "0.52.3" +version = "0.53.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "61f5c29c6044f3dc9e866858feee625d7fae5604a68ac7bd66dec683eee97563" +checksum = "fece2308326cc59c53fedd682259625e8ecc306e4c3b35051725ca388677b47b" dependencies = [ "multiversx-sc", ] [[package]] name = "multiversx-sc-wasm-adapter" -version = "0.52.3" +version = "0.53.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ed13aaca9cbdbc6911174cd3029e750a7563d85dd3daaa1107b1fd31c7f17245" +checksum = "0ab5bb42b3ce827227a5e38f3c24fbe0fb23d475425b049043e193186e36c590" dependencies = [ "multiversx-sc", ] @@ -170,9 +170,9 @@ dependencies = [ [[package]] name = "quote" -version = "1.0.36" +version = "1.0.37" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0fa76aaf39101c457836aec0ce2316dbdc3ab723cdda1c6bd4e6ad4208acaca7" +checksum = "b5b9d34b8991d19d98081b46eacdd8eb58c6f2b201139f7c5f643cc155a633af" dependencies = [ "proc-macro2", ] @@ -195,9 +195,9 @@ checksum = "3c5e1a9a646d36c3599cd173a41282daf47c44583ad367b8e6837255952e5c67" [[package]] name = "syn" -version = "2.0.72" +version = "2.0.77" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dc4b9b9bf2add8093d3f2c0204471e951b2285580335de42f9d2534f3ae7a8af" +checksum = "9f35bcdf61fd8e7be6caf75f429fdca8beb3ed76584befb503b1569faee373ed" dependencies = [ "proc-macro2", "quote", diff --git a/token-handler/wasm-token-handler-view/Cargo.toml b/token-handler/wasm-token-handler-view/Cargo.toml index cb8b0f66..6f76e399 100644 --- a/token-handler/wasm-token-handler-view/Cargo.toml +++ b/token-handler/wasm-token-handler-view/Cargo.toml @@ -28,7 +28,7 @@ panic = "abort" path = ".." [dependencies.multiversx-sc-wasm-adapter] -version = "0.52.3" +version = "0.53.0" [workspace] members = ["."] diff --git a/token-handler/wasm/Cargo.lock b/token-handler/wasm/Cargo.lock index cdafc170..c0c7759f 100644 --- a/token-handler/wasm/Cargo.lock +++ b/token-handler/wasm/Cargo.lock @@ -4,9 +4,9 @@ version = 3 [[package]] name = "arrayvec" -version = "0.7.4" +version = "0.7.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "96d30a06541fbafbc7f82ed10c06164cfbd2c401138f6addd8404629c4b16711" +checksum = "7c02d123df017efcdfbd739ef81735b36c5ba83ec3c59c80a9d7ecc718f92e50" [[package]] name = "autocfg" @@ -75,9 +75,9 @@ checksum = "6fe2267d4ed49bc07b63801559be28c718ea06c4738b7a03c94df7386d2cde46" [[package]] name = "multiversx-sc" -version = "0.52.3" +version = "0.53.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "526760b1d6236c011285b264a70a0a9dd3b3dbc53c3b5f76932f4bcfd3a8910c" +checksum = "2a86a27b04bb7cca97ad8971ee57e6b978619623dde4ba9acae1d4ecb436f062" dependencies = [ "bitflags", "hex-literal", @@ -89,9 +89,9 @@ dependencies = [ [[package]] name = "multiversx-sc-codec" -version = "0.20.1" +version = "0.21.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ad4f318427761faecf26c1f3115a3beeb5f61858845a60547d9763aa981ddd2d" +checksum = "007d7a5a8534e5dc9128cb8f15a65a21dd378e135c6016c7cd1491cd012bc8cb" dependencies = [ "arrayvec", "multiversx-sc-codec-derive", @@ -100,9 +100,9 @@ dependencies = [ [[package]] name = "multiversx-sc-codec-derive" -version = "0.20.1" +version = "0.21.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "476501462b0c2654b64f9dec6f2c480e24b4e9b7133ec10b7167e64acda35d04" +checksum = "dffba1dce273ed5b61ee1b90aeea5c8c744617d0f12624f620768c144d83e753" dependencies = [ "hex", "proc-macro2", @@ -112,9 +112,9 @@ dependencies = [ [[package]] name = "multiversx-sc-derive" -version = "0.52.3" +version = "0.53.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3557f2f12640a8a07fa6af66cc2a13b188c5b61bed72db22fe631fb3a60c3e96" +checksum = "f7a6ee275d6b1c2b86394369df0bc62a3f25018cbab12668a191b89d88fdcf71" dependencies = [ "hex", "proc-macro2", @@ -125,18 +125,18 @@ dependencies = [ [[package]] name = "multiversx-sc-modules" -version = "0.52.3" +version = "0.53.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "61f5c29c6044f3dc9e866858feee625d7fae5604a68ac7bd66dec683eee97563" +checksum = "fece2308326cc59c53fedd682259625e8ecc306e4c3b35051725ca388677b47b" dependencies = [ "multiversx-sc", ] [[package]] name = "multiversx-sc-wasm-adapter" -version = "0.52.3" +version = "0.53.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ed13aaca9cbdbc6911174cd3029e750a7563d85dd3daaa1107b1fd31c7f17245" +checksum = "0ab5bb42b3ce827227a5e38f3c24fbe0fb23d475425b049043e193186e36c590" dependencies = [ "multiversx-sc", ] @@ -170,9 +170,9 @@ dependencies = [ [[package]] name = "quote" -version = "1.0.36" +version = "1.0.37" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0fa76aaf39101c457836aec0ce2316dbdc3ab723cdda1c6bd4e6ad4208acaca7" +checksum = "b5b9d34b8991d19d98081b46eacdd8eb58c6f2b201139f7c5f643cc155a633af" dependencies = [ "proc-macro2", ] @@ -195,9 +195,9 @@ checksum = "3c5e1a9a646d36c3599cd173a41282daf47c44583ad367b8e6837255952e5c67" [[package]] name = "syn" -version = "2.0.72" +version = "2.0.77" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dc4b9b9bf2add8093d3f2c0204471e951b2285580335de42f9d2534f3ae7a8af" +checksum = "9f35bcdf61fd8e7be6caf75f429fdca8beb3ed76584befb503b1569faee373ed" dependencies = [ "proc-macro2", "quote", diff --git a/token-handler/wasm/Cargo.toml b/token-handler/wasm/Cargo.toml index c6f0f649..03d9ecf9 100644 --- a/token-handler/wasm/Cargo.toml +++ b/token-handler/wasm/Cargo.toml @@ -28,7 +28,7 @@ panic = "abort" path = ".." [dependencies.multiversx-sc-wasm-adapter] -version = "0.52.3" +version = "0.53.0" [workspace] members = ["."] From 272736a878cc73b6e3b2756e557110350ca7b173 Mon Sep 17 00:00:00 2001 From: Andrei Baltariu Date: Thu, 5 Sep 2024 11:07:23 +0300 Subject: [PATCH 302/523] Added setup for fee token and fee type inside contract setup func Signed-off-by: Andrei Baltariu --- .../tests/enshrine_esdt_safe_blackbox_test.rs | 55 ++++++++++++++----- 1 file changed, 41 insertions(+), 14 deletions(-) diff --git a/enshrine-esdt-safe/tests/enshrine_esdt_safe_blackbox_test.rs b/enshrine-esdt-safe/tests/enshrine_esdt_safe_blackbox_test.rs index e58205f0..de4fcd1c 100644 --- a/enshrine-esdt-safe/tests/enshrine_esdt_safe_blackbox_test.rs +++ b/enshrine-esdt-safe/tests/enshrine_esdt_safe_blackbox_test.rs @@ -1,6 +1,6 @@ use bls_signature::BlsSignature; use enshrine_esdt_safe::enshrine_esdt_safe_proxy; -use fee_market::fee_market_proxy::{self}; +use fee_market::fee_market_proxy::{self, FeeType}; use header_verifier::header_verifier_proxy; use multiversx_sc::codec::TopEncode; use multiversx_sc::imports::{MultiValue3, OptionalValue}; @@ -198,6 +198,8 @@ impl EnshrineTestState { &mut self, is_sovereign_chain: bool, is_fee_enabled: bool, + fee_token_id: Option, + fee_type: Option>, ) -> &mut Self { self.deploy_enshrine_esdt_contract( is_sovereign_chain, @@ -219,6 +221,11 @@ impl EnshrineTestState { .typed(fee_market_proxy::FeeMarketProxy) .disable_fee() .run(); + } else { + match (fee_token_id, fee_type) { + (Some(token_id), Some(fee_type)) => self.propose_add_fee_token(token_id, fee_type), + _ => (), + } } self @@ -363,6 +370,20 @@ impl EnshrineTestState { } } + fn propose_add_fee_token( + &mut self, + token_id: TestTokenIdentifier, + fee_type: FeeType, + ) { + self.world + .tx() + .from(ENSHRINE_ESDT_OWNER_ADDRESS) + .to(FEE_MARKET_ADDRESS) + .typed(fee_market_proxy::FeeMarketProxy) + .add_fee(token_id, fee_type) + .run(); + } + fn propose_set_max_user_tx_gas_limit(&mut self, max_gas_limit: GasLimit) { self.world .tx() @@ -438,7 +459,7 @@ impl EnshrineTestState { fn test_deploy() { let mut state = EnshrineTestState::new(); - state.propose_setup_contracts(false, false); + state.propose_setup_contracts(false, false, None, None); } #[test] @@ -450,7 +471,7 @@ fn test_sovereign_prefix_no_prefix() { error_message: "Operation is not registered", }); - state.propose_setup_contracts(false, false); + state.propose_setup_contracts(false, false, None, None); state.propose_register_operation(&token_vec); state.propose_execute_operation(error_status, &token_vec); } @@ -464,7 +485,7 @@ fn test_sovereign_prefix_has_prefix() { error_message: "Operation is not registered", }); - state.propose_setup_contracts(false, false); + state.propose_setup_contracts(false, false, None, None); state.propose_register_operation(&token_vec); state.propose_execute_operation(error_status, &token_vec); } @@ -478,7 +499,7 @@ fn test_register_tokens_insufficient_funds() { let payment_amount = BigUint::from(DEFAULT_ISSUE_COST * token_vec.len() as u64); let payment = EsdtTokenPayment::new(WEGLD_IDENTIFIER.into(), 0, payment_amount); - state.propose_setup_contracts(false, false); + state.propose_setup_contracts(false, false, None, None); state.propose_register_tokens( &USER_ADDRESS, payment, @@ -499,7 +520,7 @@ fn test_register_tokens_wrong_token_as_fee() { let payment_amount = BigUint::from(DEFAULT_ISSUE_COST * token_vec.len() as u64); let payment = EsdtTokenPayment::new(CROWD_TOKEN_ID.into(), 0, payment_amount); - state.propose_setup_contracts(false, false); + state.propose_setup_contracts(false, false, None, None); state.propose_register_tokens( &ENSHRINE_ESDT_OWNER_ADDRESS, payment, @@ -518,7 +539,7 @@ fn test_register_tokens() { let payment_amount = BigUint::from(DEFAULT_ISSUE_COST * token_vec.len() as u64); let payment = EsdtTokenPayment::new(WEGLD_IDENTIFIER.into(), 0, payment_amount); - state.propose_setup_contracts(false, false); + state.propose_setup_contracts(false, false, None, None); state.propose_register_tokens(&ENSHRINE_ESDT_OWNER_ADDRESS, payment, token_vec, None); state .world @@ -540,7 +561,7 @@ fn test_register_tokens_insufficient_wegld() { let payment_amount = BigUint::from(DEFAULT_ISSUE_COST + token_vec.len() as u64); let payment = EsdtTokenPayment::new(WEGLD_IDENTIFIER.into(), 0, payment_amount); - state.propose_setup_contracts(false, false); + state.propose_setup_contracts(false, false, None, None); state.propose_register_tokens( &ENSHRINE_ESDT_OWNER_ADDRESS, payment, @@ -565,7 +586,7 @@ fn test_deposit_nothing_to_transfer() { payments.push(wegld_payment); - state.propose_setup_contracts(false, true); + state.propose_setup_contracts(false, false, None, None); state.propose_deposit( ENSHRINE_ESDT_OWNER_ADDRESS, USER_ADDRESS, @@ -588,7 +609,7 @@ fn test_deposit_max_transfers_exceeded() { payments.extend(std::iter::repeat(wegld_payment).take(11)); - state.propose_setup_contracts(false, false); + state.propose_setup_contracts(false, false, None, None); state.propose_deposit( ENSHRINE_ESDT_OWNER_ADDRESS, USER_ADDRESS, @@ -609,7 +630,13 @@ fn test_deposit_no_transfer_data() { payments.push(wegld_payment); payments.push(crowd_payment); - state.propose_setup_contracts(false, false); + let fee_type = FeeType::Fixed { + token: WEGLD_IDENTIFIER.into(), + per_transfer: BigUint::from(1u32), + per_gas: BigUint::from(1u32), + }; + + state.propose_setup_contracts(false, true, Some(WEGLD_IDENTIFIER), Some(fee_type)); state.propose_deposit( ENSHRINE_ESDT_OWNER_ADDRESS, USER_ADDRESS, @@ -654,7 +681,7 @@ fn test_deposit_with_transfer_data_gas_limit_too_high() { error_message: "Gas limit too high", }; - state.propose_setup_contracts(false, false); + state.propose_setup_contracts(false, false, None, None); state.propose_deposit( ENSHRINE_ESDT_OWNER_ADDRESS, USER_ADDRESS, @@ -687,7 +714,7 @@ fn test_deposit_with_transfer_data_banned_endpoint() { error_message: "Banned endpoint name", }; - state.propose_setup_contracts(false, false); + state.propose_setup_contracts(false, false, None, None); state.propose_set_max_user_tx_gas_limit(gas_limit); state.propose_set_banned_endpoint(function); state.propose_deposit( @@ -717,7 +744,7 @@ fn test_deposit_with_transfer_data() { payments.push(wegld_payment); payments.push(crowd_payment); - state.propose_setup_contracts(false, false); + state.propose_setup_contracts(false, false, None, None); state.propose_set_max_user_tx_gas_limit(gas_limit); state.propose_deposit( ENSHRINE_ESDT_OWNER_ADDRESS, From 3ac0c4425b2ee54a91f24de3e89b3f7c38db9b6a Mon Sep 17 00:00:00 2001 From: Andrei Baltariu Date: Thu, 5 Sep 2024 11:17:51 +0300 Subject: [PATCH 303/523] Fixed nothing to transfer test Signed-off-by: Andrei Baltariu --- enshrine-esdt-safe/tests/enshrine_esdt_safe_blackbox_test.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/enshrine-esdt-safe/tests/enshrine_esdt_safe_blackbox_test.rs b/enshrine-esdt-safe/tests/enshrine_esdt_safe_blackbox_test.rs index de4fcd1c..df16771d 100644 --- a/enshrine-esdt-safe/tests/enshrine_esdt_safe_blackbox_test.rs +++ b/enshrine-esdt-safe/tests/enshrine_esdt_safe_blackbox_test.rs @@ -586,7 +586,7 @@ fn test_deposit_nothing_to_transfer() { payments.push(wegld_payment); - state.propose_setup_contracts(false, false, None, None); + state.propose_setup_contracts(false, true, None, None); state.propose_deposit( ENSHRINE_ESDT_OWNER_ADDRESS, USER_ADDRESS, From e7dcb723b9f193e84a389f17c54de86f626f3563 Mon Sep 17 00:00:00 2001 From: Andrei Baltariu Date: Thu, 5 Sep 2024 11:18:11 +0300 Subject: [PATCH 304/523] Made enshrine -> fee market call sync() Signed-off-by: Andrei Baltariu --- enshrine-esdt-safe/src/to_sovereign/create_tx.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/enshrine-esdt-safe/src/to_sovereign/create_tx.rs b/enshrine-esdt-safe/src/to_sovereign/create_tx.rs index 74800edd..c63af3e7 100644 --- a/enshrine-esdt-safe/src/to_sovereign/create_tx.rs +++ b/enshrine-esdt-safe/src/to_sovereign/create_tx.rs @@ -156,7 +156,7 @@ pub trait CreateTxModule: .typed(fee_market_proxy::FeeMarketProxy) .subtract_fee(caller, total_tokens_for_fees, OptionalValue::Some(gas)) .payment(fee.clone()) - .async_call_and_exit(); + .sync_call(); } OptionalValue::None => (), }; From 6a4fd964954668d036c01edc33463b370f5d8de2 Mon Sep 17 00:00:00 2001 From: Andrei Baltariu Date: Fri, 6 Sep 2024 16:30:09 +0300 Subject: [PATCH 305/523] Fixed test and added initiator storage mapper insert Signed-off-by: Andrei Baltariu --- enshrine-esdt-safe/src/lib.rs | 3 +++ .../src/to_sovereign/create_tx.rs | 6 +++--- .../tests/enshrine_esdt_safe_blackbox_test.rs | 18 +++++++++++++++++- 3 files changed, 23 insertions(+), 4 deletions(-) diff --git a/enshrine-esdt-safe/src/lib.rs b/enshrine-esdt-safe/src/lib.rs index 7a874fcb..31a2ef8f 100644 --- a/enshrine-esdt-safe/src/lib.rs +++ b/enshrine-esdt-safe/src/lib.rs @@ -58,6 +58,9 @@ pub trait EnshrineEsdtSafe: Some(prefix) => self.sovereign_tokens_prefix().set(prefix), None => sc_panic!("Sovereign Token Prefix must be set in Mainchain"), } + + let caller = self.blockchain().get_caller(); + self.initiator_address().set(caller); } #[only_owner] diff --git a/enshrine-esdt-safe/src/to_sovereign/create_tx.rs b/enshrine-esdt-safe/src/to_sovereign/create_tx.rs index c63af3e7..5de88edf 100644 --- a/enshrine-esdt-safe/src/to_sovereign/create_tx.rs +++ b/enshrine-esdt-safe/src/to_sovereign/create_tx.rs @@ -44,10 +44,10 @@ pub trait CreateTxModule: for payment in &payments { self.require_below_max_amount(&payment.token_identifier, &payment.amount); self.require_token_not_blacklisted(&payment.token_identifier); + let is_token_whitelist_empty = self.token_whitelist().is_empty(); + let is_token_whitelisted = self.token_whitelist().contains(&payment.token_identifier); - if !self.token_whitelist().is_empty() - && !self.token_whitelist().contains(&payment.token_identifier) - { + if !is_token_whitelist_empty && !is_token_whitelisted { refundable_payments.push(payment.clone()); continue; diff --git a/enshrine-esdt-safe/tests/enshrine_esdt_safe_blackbox_test.rs b/enshrine-esdt-safe/tests/enshrine_esdt_safe_blackbox_test.rs index df16771d..32725537 100644 --- a/enshrine-esdt-safe/tests/enshrine_esdt_safe_blackbox_test.rs +++ b/enshrine-esdt-safe/tests/enshrine_esdt_safe_blackbox_test.rs @@ -302,6 +302,19 @@ impl EnshrineTestState { .run(); } + fn propose_add_token_to_whitelist( + &mut self, + tokens: MultiValueEncoded>, + ) { + self.world + .tx() + .from(ENSHRINE_ESDT_OWNER_ADDRESS) + .to(ENSHRINE_ESDT_ADDRESS) + .typed(enshrine_esdt_safe_proxy::EnshrineEsdtSafeProxy) + .add_tokens_to_whitelist(tokens) + .run(); + } + fn propose_register_tokens( &mut self, sender: &TestAddress, @@ -626,6 +639,8 @@ fn test_deposit_no_transfer_data() { let wegld_payment = EsdtTokenPayment::new(WEGLD_IDENTIFIER.into(), 0, amount.clone()); let crowd_payment = EsdtTokenPayment::new(CROWD_TOKEN_ID.into(), 0, amount); let mut payments = PaymentsVec::new(); + let mut tokens_whitelist = MultiValueEncoded::new(); + tokens_whitelist.push(WEGLD_IDENTIFIER.into()); payments.push(wegld_payment); payments.push(crowd_payment); @@ -637,6 +652,7 @@ fn test_deposit_no_transfer_data() { }; state.propose_setup_contracts(false, true, Some(WEGLD_IDENTIFIER), Some(fee_type)); + state.propose_add_token_to_whitelist(tokens_whitelist); state.propose_deposit( ENSHRINE_ESDT_OWNER_ADDRESS, USER_ADDRESS, @@ -655,7 +671,7 @@ fn test_deposit_no_transfer_data() { state .world .check_account(ENSHRINE_ESDT_OWNER_ADDRESS) - .esdt_balance(CROWD_TOKEN_ID, &expected_wegld_amount); + .esdt_balance(CROWD_TOKEN_ID, &BigUint::from(WEGLD_BALANCE)); } #[test] From 68318c71f677eef489727164734be32ae40d673b Mon Sep 17 00:00:00 2001 From: Andrei Baltariu Date: Mon, 9 Sep 2024 12:47:17 +0300 Subject: [PATCH 306/523] Added whitelisted payment to test Signed-off-by: Andrei Baltariu --- .../tests/enshrine_esdt_safe_blackbox_test.rs | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/enshrine-esdt-safe/tests/enshrine_esdt_safe_blackbox_test.rs b/enshrine-esdt-safe/tests/enshrine_esdt_safe_blackbox_test.rs index 32725537..9dce2f52 100644 --- a/enshrine-esdt-safe/tests/enshrine_esdt_safe_blackbox_test.rs +++ b/enshrine-esdt-safe/tests/enshrine_esdt_safe_blackbox_test.rs @@ -637,18 +637,21 @@ fn test_deposit_no_transfer_data() { let mut state = EnshrineTestState::new(); let amount = BigUint::from(10000u64); let wegld_payment = EsdtTokenPayment::new(WEGLD_IDENTIFIER.into(), 0, amount.clone()); + let fungible_payment = EsdtTokenPayment::new(FUNGIBLE_TOKEN_ID.into(), 0, amount.clone()); let crowd_payment = EsdtTokenPayment::new(CROWD_TOKEN_ID.into(), 0, amount); let mut payments = PaymentsVec::new(); let mut tokens_whitelist = MultiValueEncoded::new(); tokens_whitelist.push(WEGLD_IDENTIFIER.into()); + tokens_whitelist.push(CROWD_TOKEN_ID.into()); payments.push(wegld_payment); + payments.push(fungible_payment); payments.push(crowd_payment); let fee_type = FeeType::Fixed { token: WEGLD_IDENTIFIER.into(), - per_transfer: BigUint::from(1u32), - per_gas: BigUint::from(1u32), + per_transfer: BigUint::from(100u32), + per_gas: BigUint::from(100u32), }; state.propose_setup_contracts(false, true, Some(WEGLD_IDENTIFIER), Some(fee_type)); @@ -661,7 +664,8 @@ fn test_deposit_no_transfer_data() { None, ); - let expected_wegld_amount = BigUint::from(WEGLD_BALANCE) - BigUint::from(10000u64); + let expected_wegld_amount = BigUint::from(WEGLD_BALANCE) - BigUint::from(100u64); + let expected_crowd_amount = BigUint::from(WEGLD_BALANCE) - BigUint::from(10000u64); state .world @@ -671,7 +675,7 @@ fn test_deposit_no_transfer_data() { state .world .check_account(ENSHRINE_ESDT_OWNER_ADDRESS) - .esdt_balance(CROWD_TOKEN_ID, &BigUint::from(WEGLD_BALANCE)); + .esdt_balance(CROWD_TOKEN_ID, &expected_crowd_amount); } #[test] From b216fb78e1a36e4360f7eaa83179f3e13baafb6e Mon Sep 17 00:00:00 2001 From: Andrei Baltariu Date: Mon, 9 Sep 2024 12:48:00 +0300 Subject: [PATCH 307/523] Fixed logic regardind fee token refund Signed-off-by: Andrei Baltariu --- fee-market/src/subtract_fee.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fee-market/src/subtract_fee.rs b/fee-market/src/subtract_fee.rs index ac86550b..371b9c10 100644 --- a/fee-market/src/subtract_fee.rs +++ b/fee-market/src/subtract_fee.rs @@ -130,7 +130,7 @@ pub trait SubtractFeeModule: .update(|amt| *amt += &final_payment.fee.amount); self.send() - .direct_non_zero_esdt_payment(&caller, &final_payment.remaining_tokens); + .direct_non_zero_esdt_payment(&original_caller, &final_payment.remaining_tokens); final_payment } From 2ad0fadc4ce265576cacc75e50fbe56b38847dcb Mon Sep 17 00:00:00 2001 From: Andrei Baltariu Date: Mon, 9 Sep 2024 13:18:21 +0300 Subject: [PATCH 308/523] Modified existing test and added new one for deposit with transfer_data Signed-off-by: Andrei Baltariu --- .../tests/enshrine_esdt_safe_blackbox_test.rs | 63 +++++++++++++++++-- 1 file changed, 57 insertions(+), 6 deletions(-) diff --git a/enshrine-esdt-safe/tests/enshrine_esdt_safe_blackbox_test.rs b/enshrine-esdt-safe/tests/enshrine_esdt_safe_blackbox_test.rs index 9dce2f52..6d34e2a5 100644 --- a/enshrine-esdt-safe/tests/enshrine_esdt_safe_blackbox_test.rs +++ b/enshrine-esdt-safe/tests/enshrine_esdt_safe_blackbox_test.rs @@ -747,11 +747,12 @@ fn test_deposit_with_transfer_data_banned_endpoint() { } #[test] -fn test_deposit_with_transfer_data() { +fn test_deposit_with_transfer_data_enough_for_fee() { let mut state = EnshrineTestState::new(); - let amount = BigUint::from(10000u64); + let amount = BigUint::from(1000000000000000u128); let wegld_payment = EsdtTokenPayment::new(WEGLD_IDENTIFIER.into(), 0, amount.clone()); - let crowd_payment = EsdtTokenPayment::new(CROWD_TOKEN_ID.into(), 0, amount); + let fungible_payment = EsdtTokenPayment::new(FUNGIBLE_TOKEN_ID.into(), 0, amount.clone()); + let crowd_payment = EsdtTokenPayment::new(CROWD_TOKEN_ID.into(), 0, amount.clone()); let mut payments = PaymentsVec::new(); let gas_limit = 1000000000 as u64; let function = ManagedBuffer::from("some_function"); @@ -762,9 +763,16 @@ fn test_deposit_with_transfer_data() { let transfer_data = state.setup_transfer_data(gas_limit, function, args); payments.push(wegld_payment); + payments.push(fungible_payment); payments.push(crowd_payment); - state.propose_setup_contracts(false, false, None, None); + let fee_type = FeeType::Fixed { + token: WEGLD_IDENTIFIER.into(), + per_transfer: BigUint::from(100u32), + per_gas: BigUint::from(100u32), + }; + + state.propose_setup_contracts(false, true, Some(WEGLD_IDENTIFIER), Some(fee_type)); state.propose_set_max_user_tx_gas_limit(gas_limit); state.propose_deposit( ENSHRINE_ESDT_OWNER_ADDRESS, @@ -774,7 +782,8 @@ fn test_deposit_with_transfer_data() { None, ); - let expected_wegld_amount = BigUint::from(WEGLD_BALANCE) - BigUint::from(10000u64); + let expected_wegld_amount = BigUint::from(WEGLD_BALANCE) - BigUint::from(100000000200u64); + let expected_crowd_amount = BigUint::from(WEGLD_BALANCE) - amount; state .world @@ -784,5 +793,47 @@ fn test_deposit_with_transfer_data() { state .world .check_account(ENSHRINE_ESDT_OWNER_ADDRESS) - .esdt_balance(CROWD_TOKEN_ID, &expected_wegld_amount); + .esdt_balance(CROWD_TOKEN_ID, &expected_crowd_amount); +} + +#[test] +fn test_deposit_with_transfer_data_not_enough_for_fee() { + let mut state = EnshrineTestState::new(); + let amount = BigUint::from(100000000000000000u128); + let wegld_payment = EsdtTokenPayment::new(WEGLD_IDENTIFIER.into(), 0, amount.clone()); + let fungible_payment = EsdtTokenPayment::new(FUNGIBLE_TOKEN_ID.into(), 0, amount.clone()); + let crowd_payment = EsdtTokenPayment::new(CROWD_TOKEN_ID.into(), 0, amount.clone()); + let mut payments = PaymentsVec::new(); + let gas_limit = 1000000000000000 as u64; + let function = ManagedBuffer::from("some_function"); + let arg = ManagedBuffer::from("arg"); + let mut args = ManagedVec::new(); + args.push(arg); + + let error_status = ErrorStatus { + code: 4, + error_message: "Payment does not cover fee", + }; + + let transfer_data = state.setup_transfer_data(gas_limit, function, args); + + payments.push(wegld_payment); + payments.push(fungible_payment); + payments.push(crowd_payment); + + let fee_type = FeeType::Fixed { + token: WEGLD_IDENTIFIER.into(), + per_transfer: BigUint::from(100u32), + per_gas: BigUint::from(100u32), + }; + + state.propose_setup_contracts(false, true, Some(WEGLD_IDENTIFIER), Some(fee_type)); + state.propose_set_max_user_tx_gas_limit(gas_limit); + state.propose_deposit( + ENSHRINE_ESDT_OWNER_ADDRESS, + USER_ADDRESS, + payments, + transfer_data, + Some(error_status), + ); } From 81dc9131b4f2ca64e667995ff983b1c074e23c20 Mon Sep 17 00:00:00 2001 From: Andrei Baltariu Date: Mon, 9 Sep 2024 13:23:38 +0300 Subject: [PATCH 309/523] Added variables for fee amounts and removed BigUints declarations Signed-off-by: Andrei Baltariu --- .../tests/enshrine_esdt_safe_blackbox_test.rs | 27 ++++++++++++------- 1 file changed, 18 insertions(+), 9 deletions(-) diff --git a/enshrine-esdt-safe/tests/enshrine_esdt_safe_blackbox_test.rs b/enshrine-esdt-safe/tests/enshrine_esdt_safe_blackbox_test.rs index 6d34e2a5..4f8f6d5f 100644 --- a/enshrine-esdt-safe/tests/enshrine_esdt_safe_blackbox_test.rs +++ b/enshrine-esdt-safe/tests/enshrine_esdt_safe_blackbox_test.rs @@ -638,7 +638,7 @@ fn test_deposit_no_transfer_data() { let amount = BigUint::from(10000u64); let wegld_payment = EsdtTokenPayment::new(WEGLD_IDENTIFIER.into(), 0, amount.clone()); let fungible_payment = EsdtTokenPayment::new(FUNGIBLE_TOKEN_ID.into(), 0, amount.clone()); - let crowd_payment = EsdtTokenPayment::new(CROWD_TOKEN_ID.into(), 0, amount); + let crowd_payment = EsdtTokenPayment::new(CROWD_TOKEN_ID.into(), 0, amount.clone()); let mut payments = PaymentsVec::new(); let mut tokens_whitelist = MultiValueEncoded::new(); tokens_whitelist.push(WEGLD_IDENTIFIER.into()); @@ -648,10 +648,13 @@ fn test_deposit_no_transfer_data() { payments.push(fungible_payment); payments.push(crowd_payment); + let fee_amount_per_transfer = BigUint::from(100u32); + let fee_amount_per_gas = BigUint::from(100u32); + let fee_type = FeeType::Fixed { token: WEGLD_IDENTIFIER.into(), - per_transfer: BigUint::from(100u32), - per_gas: BigUint::from(100u32), + per_transfer: fee_amount_per_transfer.clone(), + per_gas: fee_amount_per_gas, }; state.propose_setup_contracts(false, true, Some(WEGLD_IDENTIFIER), Some(fee_type)); @@ -664,8 +667,8 @@ fn test_deposit_no_transfer_data() { None, ); - let expected_wegld_amount = BigUint::from(WEGLD_BALANCE) - BigUint::from(100u64); - let expected_crowd_amount = BigUint::from(WEGLD_BALANCE) - BigUint::from(10000u64); + let expected_wegld_amount = BigUint::from(WEGLD_BALANCE) - fee_amount_per_transfer; + let expected_crowd_amount = BigUint::from(WEGLD_BALANCE) - amount; state .world @@ -766,10 +769,13 @@ fn test_deposit_with_transfer_data_enough_for_fee() { payments.push(fungible_payment); payments.push(crowd_payment); + let fee_amount_per_transfer = BigUint::from(100u32); + let fee_amount_per_gas = BigUint::from(100u32); + let fee_type = FeeType::Fixed { token: WEGLD_IDENTIFIER.into(), - per_transfer: BigUint::from(100u32), - per_gas: BigUint::from(100u32), + per_transfer: fee_amount_per_transfer.clone(), + per_gas: fee_amount_per_gas, }; state.propose_setup_contracts(false, true, Some(WEGLD_IDENTIFIER), Some(fee_type)); @@ -821,10 +827,13 @@ fn test_deposit_with_transfer_data_not_enough_for_fee() { payments.push(fungible_payment); payments.push(crowd_payment); + let fee_amount_per_transfer = BigUint::from(100u32); + let fee_amount_per_gas = BigUint::from(100u32); + let fee_type = FeeType::Fixed { token: WEGLD_IDENTIFIER.into(), - per_transfer: BigUint::from(100u32), - per_gas: BigUint::from(100u32), + per_transfer: fee_amount_per_transfer.clone(), + per_gas: fee_amount_per_gas, }; state.propose_setup_contracts(false, true, Some(WEGLD_IDENTIFIER), Some(fee_type)); From 53a092cdc898c97e10cb0624d28ab37cdc33f5fa Mon Sep 17 00:00:00 2001 From: Andrei Baltariu Date: Mon, 9 Sep 2024 15:47:01 +0300 Subject: [PATCH 310/523] More unified syntax migration Signed-off-by: Andrei Baltariu --- .../src/to_sovereign/create_tx.rs | 13 ++++++------ fee-market/src/subtract_fee.rs | 20 +++++++++++-------- 2 files changed, 19 insertions(+), 14 deletions(-) diff --git a/enshrine-esdt-safe/src/to_sovereign/create_tx.rs b/enshrine-esdt-safe/src/to_sovereign/create_tx.rs index 5de88edf..451df7f5 100644 --- a/enshrine-esdt-safe/src/to_sovereign/create_tx.rs +++ b/enshrine-esdt-safe/src/to_sovereign/create_tx.rs @@ -1,5 +1,6 @@ use crate::common; use fee_market::fee_market_proxy; +use multiversx_sc_scenario::multiversx_chain_vm::tx_execution::ESDT_SYSTEM_SC_ADDRESS_ARRAY; use transaction::{GasLimit, OperationData, TransferData}; use multiversx_sc::imports::*; @@ -63,11 +64,11 @@ pub trait CreateTxModule: current_token_data.amount = payment.amount.clone(); if is_sov_chain || self.has_prefix(&payment.token_identifier) { - self.send().esdt_local_burn( - &payment.token_identifier, - payment.token_nonce, - &payment.amount, - ); + self.tx() + .to(ToCaller) + .typed(ESDTSystemSCProxy) + .burn(&payment.token_identifier, &payment.amount) + .transfer_execute(); } event_payments.push( @@ -130,7 +131,7 @@ pub trait CreateTxModule: refundable_payments: &ManagedVec, ) { for payment in refundable_payments { - self.send().direct_non_zero_esdt_payment(caller, &payment); + self.tx().to(caller).payment(&payment).transfer(); } } diff --git a/fee-market/src/subtract_fee.rs b/fee-market/src/subtract_fee.rs index 371b9c10..642cfcff 100644 --- a/fee-market/src/subtract_fee.rs +++ b/fee-market/src/subtract_fee.rs @@ -88,8 +88,10 @@ pub trait SubtractFeeModule: if amount_to_send > 0 { remaining_fees -= &amount_to_send; - self.send() - .direct_esdt(&pair.address, &token_id, 0, &amount_to_send); + self.tx() + .to(&pair.address) + .payment(EsdtTokenPayment::new(token_id.clone(), 0, amount_to_send)) + .transfer(); } } @@ -113,8 +115,7 @@ pub trait SubtractFeeModule: let payment = self.call_value().single_esdt(); if !self.is_fee_enabled() || self.users_whitelist().contains(&original_caller) { - self.send() - .direct_esdt(&caller, &payment.token_identifier, 0, &payment.amount); + self.tx().to(&caller).payment(&payment).transfer(); return FinalPayment { fee: EsdtTokenPayment::new(payment.token_identifier.clone(), 0, BigUint::zero()), @@ -123,14 +124,17 @@ pub trait SubtractFeeModule: } let final_payment = self.subtract_fee_by_type(payment, total_transfers, opt_gas_limit); - let _ = self - .tokens_for_fees() + + self.tokens_for_fees() .insert(final_payment.fee.token_identifier.clone()); + self.accumulated_fees(&final_payment.fee.token_identifier) .update(|amt| *amt += &final_payment.fee.amount); - self.send() - .direct_non_zero_esdt_payment(&original_caller, &final_payment.remaining_tokens); + self.tx() + .to(&original_caller) + .payment(&final_payment.remaining_tokens) + .transfer(); final_payment } From 01bcc1c9cb2be02e7e9a482a458b7aad8f1f029e Mon Sep 17 00:00:00 2001 From: Andrei Baltariu Date: Tue, 10 Sep 2024 10:19:37 +0300 Subject: [PATCH 311/523] Added whitelist call to setup function Signed-off-by: Andrei Baltariu --- .../tests/enshrine_esdt_safe_blackbox_test.rs | 106 ++++++++++++++++-- 1 file changed, 96 insertions(+), 10 deletions(-) diff --git a/enshrine-esdt-safe/tests/enshrine_esdt_safe_blackbox_test.rs b/enshrine-esdt-safe/tests/enshrine_esdt_safe_blackbox_test.rs index 4f8f6d5f..655e417e 100644 --- a/enshrine-esdt-safe/tests/enshrine_esdt_safe_blackbox_test.rs +++ b/enshrine-esdt-safe/tests/enshrine_esdt_safe_blackbox_test.rs @@ -1,6 +1,7 @@ use bls_signature::BlsSignature; use enshrine_esdt_safe::enshrine_esdt_safe_proxy; -use fee_market::fee_market_proxy::{self, FeeType}; +use fee_market::fee_market_proxy::{self}; +use fee_market::fee_type::{FeeType, FeeTypeModule}; use header_verifier::header_verifier_proxy; use multiversx_sc::codec::TopEncode; use multiversx_sc::imports::{MultiValue3, OptionalValue}; @@ -11,7 +12,7 @@ use multiversx_sc::types::{ use multiversx_sc_scenario::api::StaticApi; use multiversx_sc_scenario::multiversx_chain_vm::crypto_functions::sha256; use multiversx_sc_scenario::{imports::MxscPath, ScenarioWorld}; -use multiversx_sc_scenario::{managed_address, ExpectError, ScenarioTxRun}; +use multiversx_sc_scenario::{managed_address, ExpectError, ScenarioTxRun, ScenarioTxWhitebox}; use token_handler::token_handler_proxy; use transaction::{GasLimit, Operation, OperationData, OperationEsdtPayment}; use utils::PaymentsVec; @@ -223,7 +224,23 @@ impl EnshrineTestState { .run(); } else { match (fee_token_id, fee_type) { - (Some(token_id), Some(fee_type)) => self.propose_add_fee_token(token_id, fee_type), + (Some(token_id), Some(fee_type)) => { + self.world.query().to(FEE_MARKET_ADDRESS).whitebox( + fee_market::contract_obj, + |sc| { + let token_fee = sc.token_fee(&token_id.into()).get(); + + if let FeeType::None = token_fee { + let error_status = ErrorStatus { + code: 4, + error_message: "Invalid fee type", + }; + + self.propose_add_fee_token(token_id, fee_type, Some(error_status)) + } + }, + ); + } _ => (), } } @@ -387,14 +404,27 @@ impl EnshrineTestState { &mut self, token_id: TestTokenIdentifier, fee_type: FeeType, + error_status: Option, ) { - self.world - .tx() - .from(ENSHRINE_ESDT_OWNER_ADDRESS) - .to(FEE_MARKET_ADDRESS) - .typed(fee_market_proxy::FeeMarketProxy) - .add_fee(token_id, fee_type) - .run(); + match error_status { + Some(error) => self + .world + .tx() + .from(ENSHRINE_ESDT_OWNER_ADDRESS) + .to(FEE_MARKET_ADDRESS) + .typed(fee_market_proxy::FeeMarketProxy) + .add_fee(token_id, fee_type) + .returns(ExpectError(error.code, error.error_message)) + .run(), + None => self + .world + .tx() + .from(ENSHRINE_ESDT_OWNER_ADDRESS) + .to(FEE_MARKET_ADDRESS) + .typed(fee_market_proxy::FeeMarketProxy) + .add_fee(token_id, fee_type) + .run(), + } } fn propose_set_max_user_tx_gas_limit(&mut self, max_gas_limit: GasLimit) { @@ -609,6 +639,62 @@ fn test_deposit_nothing_to_transfer() { ); } +#[test] +fn test_deposit_invalid_fee_type_jeg_de_test() { + let mut state = EnshrineTestState::new(); + let amount = BigUint::from(10000u64); + let wegld_payment = EsdtTokenPayment::new(WEGLD_IDENTIFIER.into(), 0, amount.clone()); + let mut payments = PaymentsVec::new(); + let error_status = ErrorStatus { + code: 4, + error_message: "Invalid fee type", + }; + let fee_type = FeeType::None; + + payments.push(wegld_payment); + + state.propose_setup_contracts(false, true, Some(WEGLD_IDENTIFIER), Some(fee_type)); + state.propose_deposit( + ENSHRINE_ESDT_OWNER_ADDRESS, + USER_ADDRESS, + payments, + OptionalValue::None, + None, + ); +} + +#[test] +fn test_deposit_token_not_accepted_as_fee() { + let mut state = EnshrineTestState::new(); + let amount = BigUint::from(10000u64); + let wegld_payment = EsdtTokenPayment::new(WEGLD_IDENTIFIER.into(), 0, amount.clone()); + let mut payments = PaymentsVec::new(); + let error_status = ErrorStatus { + code: 4, + error_message: "Nothing to transfer", + }; + + let fee_amount_per_transfer = BigUint::from(100u32); + let fee_amount_per_gas = BigUint::from(100u32); + + let fee_type = FeeType::Fixed { + token: WEGLD_IDENTIFIER.into(), + per_transfer: fee_amount_per_transfer, + per_gas: fee_amount_per_gas, + }; + + payments.push(wegld_payment); + + state.propose_setup_contracts(false, true, Some(WEGLD_IDENTIFIER), Some(fee_type)); + state.propose_deposit( + ENSHRINE_ESDT_OWNER_ADDRESS, + USER_ADDRESS, + payments, + OptionalValue::None, + Some(error_status), + ); +} + #[test] fn test_deposit_max_transfers_exceeded() { let mut state = EnshrineTestState::new(); From a066bffc32aae57d2182e529ae8efbc915a4f842 Mon Sep 17 00:00:00 2001 From: Andrei Baltariu Date: Tue, 10 Sep 2024 12:15:48 +0300 Subject: [PATCH 312/523] Added function to check fee market fee token Signed-off-by: Andrei Baltariu --- .../tests/enshrine_esdt_safe_blackbox_test.rs | 97 +++++++++++-------- 1 file changed, 56 insertions(+), 41 deletions(-) diff --git a/enshrine-esdt-safe/tests/enshrine_esdt_safe_blackbox_test.rs b/enshrine-esdt-safe/tests/enshrine_esdt_safe_blackbox_test.rs index 655e417e..ad73fae4 100644 --- a/enshrine-esdt-safe/tests/enshrine_esdt_safe_blackbox_test.rs +++ b/enshrine-esdt-safe/tests/enshrine_esdt_safe_blackbox_test.rs @@ -1,7 +1,6 @@ use bls_signature::BlsSignature; use enshrine_esdt_safe::enshrine_esdt_safe_proxy; -use fee_market::fee_market_proxy::{self}; -use fee_market::fee_type::{FeeType, FeeTypeModule}; +use fee_market::fee_market_proxy::{self, FeeType}; use header_verifier::header_verifier_proxy; use multiversx_sc::codec::TopEncode; use multiversx_sc::imports::{MultiValue3, OptionalValue}; @@ -12,7 +11,7 @@ use multiversx_sc::types::{ use multiversx_sc_scenario::api::StaticApi; use multiversx_sc_scenario::multiversx_chain_vm::crypto_functions::sha256; use multiversx_sc_scenario::{imports::MxscPath, ScenarioWorld}; -use multiversx_sc_scenario::{managed_address, ExpectError, ScenarioTxRun, ScenarioTxWhitebox}; +use multiversx_sc_scenario::{managed_address, ExpectError, ScenarioTxRun}; use token_handler::token_handler_proxy; use transaction::{GasLimit, Operation, OperationData, OperationEsdtPayment}; use utils::PaymentsVec; @@ -201,6 +200,7 @@ impl EnshrineTestState { is_fee_enabled: bool, fee_token_id: Option, fee_type: Option>, + fee_market_error_status: Option, ) -> &mut Self { self.deploy_enshrine_esdt_contract( is_sovereign_chain, @@ -214,6 +214,23 @@ impl EnshrineTestState { self.propose_set_header_verifier_address(); self.propose_register_fee_market_address(); + self.propose_check_is_fee_enabled( + is_fee_enabled, + fee_token_id, + fee_type, + fee_market_error_status, + ); + + self + } + + fn propose_check_is_fee_enabled( + &mut self, + is_fee_enabled: bool, + fee_token_id: Option, + fee_type: Option>, + error_status: Option, + ) -> &mut Self { if !is_fee_enabled { self.world .tx() @@ -222,27 +239,15 @@ impl EnshrineTestState { .typed(fee_market_proxy::FeeMarketProxy) .disable_fee() .run(); - } else { - match (fee_token_id, fee_type) { - (Some(token_id), Some(fee_type)) => { - self.world.query().to(FEE_MARKET_ADDRESS).whitebox( - fee_market::contract_obj, - |sc| { - let token_fee = sc.token_fee(&token_id.into()).get(); - - if let FeeType::None = token_fee { - let error_status = ErrorStatus { - code: 4, - error_message: "Invalid fee type", - }; - - self.propose_add_fee_token(token_id, fee_type, Some(error_status)) - } - }, - ); - } - _ => (), + + return self; + } + + match (fee_token_id, fee_type) { + (Some(token_id), Some(fee_type)) => { + self.propose_add_fee_token(token_id, fee_type, error_status) } + _ => (), } self @@ -502,7 +507,7 @@ impl EnshrineTestState { fn test_deploy() { let mut state = EnshrineTestState::new(); - state.propose_setup_contracts(false, false, None, None); + state.propose_setup_contracts(false, false, None, None, None); } #[test] @@ -514,7 +519,7 @@ fn test_sovereign_prefix_no_prefix() { error_message: "Operation is not registered", }); - state.propose_setup_contracts(false, false, None, None); + state.propose_setup_contracts(false, false, None, None, None); state.propose_register_operation(&token_vec); state.propose_execute_operation(error_status, &token_vec); } @@ -528,7 +533,7 @@ fn test_sovereign_prefix_has_prefix() { error_message: "Operation is not registered", }); - state.propose_setup_contracts(false, false, None, None); + state.propose_setup_contracts(false, false, None, None, None); state.propose_register_operation(&token_vec); state.propose_execute_operation(error_status, &token_vec); } @@ -542,7 +547,7 @@ fn test_register_tokens_insufficient_funds() { let payment_amount = BigUint::from(DEFAULT_ISSUE_COST * token_vec.len() as u64); let payment = EsdtTokenPayment::new(WEGLD_IDENTIFIER.into(), 0, payment_amount); - state.propose_setup_contracts(false, false, None, None); + state.propose_setup_contracts(false, false, None, None, None); state.propose_register_tokens( &USER_ADDRESS, payment, @@ -563,7 +568,7 @@ fn test_register_tokens_wrong_token_as_fee() { let payment_amount = BigUint::from(DEFAULT_ISSUE_COST * token_vec.len() as u64); let payment = EsdtTokenPayment::new(CROWD_TOKEN_ID.into(), 0, payment_amount); - state.propose_setup_contracts(false, false, None, None); + state.propose_setup_contracts(false, false, None, None, None); state.propose_register_tokens( &ENSHRINE_ESDT_OWNER_ADDRESS, payment, @@ -582,7 +587,7 @@ fn test_register_tokens() { let payment_amount = BigUint::from(DEFAULT_ISSUE_COST * token_vec.len() as u64); let payment = EsdtTokenPayment::new(WEGLD_IDENTIFIER.into(), 0, payment_amount); - state.propose_setup_contracts(false, false, None, None); + state.propose_setup_contracts(false, false, None, None, None); state.propose_register_tokens(&ENSHRINE_ESDT_OWNER_ADDRESS, payment, token_vec, None); state .world @@ -604,7 +609,7 @@ fn test_register_tokens_insufficient_wegld() { let payment_amount = BigUint::from(DEFAULT_ISSUE_COST + token_vec.len() as u64); let payment = EsdtTokenPayment::new(WEGLD_IDENTIFIER.into(), 0, payment_amount); - state.propose_setup_contracts(false, false, None, None); + state.propose_setup_contracts(false, false, None, None, None); state.propose_register_tokens( &ENSHRINE_ESDT_OWNER_ADDRESS, payment, @@ -629,7 +634,7 @@ fn test_deposit_nothing_to_transfer() { payments.push(wegld_payment); - state.propose_setup_contracts(false, true, None, None); + state.propose_setup_contracts(false, true, None, None, None); state.propose_deposit( ENSHRINE_ESDT_OWNER_ADDRESS, USER_ADDRESS, @@ -645,21 +650,31 @@ fn test_deposit_invalid_fee_type_jeg_de_test() { let amount = BigUint::from(10000u64); let wegld_payment = EsdtTokenPayment::new(WEGLD_IDENTIFIER.into(), 0, amount.clone()); let mut payments = PaymentsVec::new(); - let error_status = ErrorStatus { + let fee_market_error_status = ErrorStatus { code: 4, error_message: "Invalid fee type", }; + let deposit_error_status = ErrorStatus { + code: 4, + error_message: "Nothing to transfer", + }; let fee_type = FeeType::None; payments.push(wegld_payment); - state.propose_setup_contracts(false, true, Some(WEGLD_IDENTIFIER), Some(fee_type)); + state.propose_setup_contracts( + false, + true, + Some(WEGLD_IDENTIFIER), + Some(fee_type), + Some(fee_market_error_status), + ); state.propose_deposit( ENSHRINE_ESDT_OWNER_ADDRESS, USER_ADDRESS, payments, OptionalValue::None, - None, + Some(deposit_error_status), ); } @@ -685,7 +700,7 @@ fn test_deposit_token_not_accepted_as_fee() { payments.push(wegld_payment); - state.propose_setup_contracts(false, true, Some(WEGLD_IDENTIFIER), Some(fee_type)); + state.propose_setup_contracts(false, true, Some(WEGLD_IDENTIFIER), Some(fee_type), None); state.propose_deposit( ENSHRINE_ESDT_OWNER_ADDRESS, USER_ADDRESS, @@ -708,7 +723,7 @@ fn test_deposit_max_transfers_exceeded() { payments.extend(std::iter::repeat(wegld_payment).take(11)); - state.propose_setup_contracts(false, false, None, None); + state.propose_setup_contracts(false, false, None, None, None); state.propose_deposit( ENSHRINE_ESDT_OWNER_ADDRESS, USER_ADDRESS, @@ -743,7 +758,7 @@ fn test_deposit_no_transfer_data() { per_gas: fee_amount_per_gas, }; - state.propose_setup_contracts(false, true, Some(WEGLD_IDENTIFIER), Some(fee_type)); + state.propose_setup_contracts(false, true, Some(WEGLD_IDENTIFIER), Some(fee_type), None); state.propose_add_token_to_whitelist(tokens_whitelist); state.propose_deposit( ENSHRINE_ESDT_OWNER_ADDRESS, @@ -790,7 +805,7 @@ fn test_deposit_with_transfer_data_gas_limit_too_high() { error_message: "Gas limit too high", }; - state.propose_setup_contracts(false, false, None, None); + state.propose_setup_contracts(false, false, None, None, None); state.propose_deposit( ENSHRINE_ESDT_OWNER_ADDRESS, USER_ADDRESS, @@ -823,7 +838,7 @@ fn test_deposit_with_transfer_data_banned_endpoint() { error_message: "Banned endpoint name", }; - state.propose_setup_contracts(false, false, None, None); + state.propose_setup_contracts(false, false, None, None, None); state.propose_set_max_user_tx_gas_limit(gas_limit); state.propose_set_banned_endpoint(function); state.propose_deposit( @@ -864,7 +879,7 @@ fn test_deposit_with_transfer_data_enough_for_fee() { per_gas: fee_amount_per_gas, }; - state.propose_setup_contracts(false, true, Some(WEGLD_IDENTIFIER), Some(fee_type)); + state.propose_setup_contracts(false, true, Some(WEGLD_IDENTIFIER), Some(fee_type), None); state.propose_set_max_user_tx_gas_limit(gas_limit); state.propose_deposit( ENSHRINE_ESDT_OWNER_ADDRESS, @@ -922,7 +937,7 @@ fn test_deposit_with_transfer_data_not_enough_for_fee() { per_gas: fee_amount_per_gas, }; - state.propose_setup_contracts(false, true, Some(WEGLD_IDENTIFIER), Some(fee_type)); + state.propose_setup_contracts(false, true, Some(WEGLD_IDENTIFIER), Some(fee_type), None); state.propose_set_max_user_tx_gas_limit(gas_limit); state.propose_deposit( ENSHRINE_ESDT_OWNER_ADDRESS, From 492e7b55dbd0ae49e5f51bc0332713f5a4d6124f Mon Sep 17 00:00:00 2001 From: Andrei Baltariu Date: Tue, 10 Sep 2024 12:17:19 +0300 Subject: [PATCH 313/523] Renamed test Signed-off-by: Andrei Baltariu --- enshrine-esdt-safe/tests/enshrine_esdt_safe_blackbox_test.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/enshrine-esdt-safe/tests/enshrine_esdt_safe_blackbox_test.rs b/enshrine-esdt-safe/tests/enshrine_esdt_safe_blackbox_test.rs index ad73fae4..29a174c2 100644 --- a/enshrine-esdt-safe/tests/enshrine_esdt_safe_blackbox_test.rs +++ b/enshrine-esdt-safe/tests/enshrine_esdt_safe_blackbox_test.rs @@ -645,7 +645,7 @@ fn test_deposit_nothing_to_transfer() { } #[test] -fn test_deposit_invalid_fee_type_jeg_de_test() { +fn test_deposit_invalid_fee_type() { let mut state = EnshrineTestState::new(); let amount = BigUint::from(10000u64); let wegld_payment = EsdtTokenPayment::new(WEGLD_IDENTIFIER.into(), 0, amount.clone()); From 48cdb21791d6e0ab46c3fd6c72b6b8a203ac9bd0 Mon Sep 17 00:00:00 2001 From: Andrei Baltariu Date: Tue, 10 Sep 2024 12:36:55 +0300 Subject: [PATCH 314/523] Modified test to fit expected scenario Signed-off-by: Andrei Baltariu --- .../tests/enshrine_esdt_safe_blackbox_test.rs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/enshrine-esdt-safe/tests/enshrine_esdt_safe_blackbox_test.rs b/enshrine-esdt-safe/tests/enshrine_esdt_safe_blackbox_test.rs index 29a174c2..60c4b649 100644 --- a/enshrine-esdt-safe/tests/enshrine_esdt_safe_blackbox_test.rs +++ b/enshrine-esdt-safe/tests/enshrine_esdt_safe_blackbox_test.rs @@ -645,10 +645,11 @@ fn test_deposit_nothing_to_transfer() { } #[test] -fn test_deposit_invalid_fee_type() { +fn test_deposit_token_not_acctepted_as_fee() { let mut state = EnshrineTestState::new(); let amount = BigUint::from(10000u64); let wegld_payment = EsdtTokenPayment::new(WEGLD_IDENTIFIER.into(), 0, amount.clone()); + let crowd_payment = EsdtTokenPayment::new(CROWD_TOKEN_ID.into(), 0, amount.clone()); let mut payments = PaymentsVec::new(); let fee_market_error_status = ErrorStatus { code: 4, @@ -656,11 +657,13 @@ fn test_deposit_invalid_fee_type() { }; let deposit_error_status = ErrorStatus { code: 4, - error_message: "Nothing to transfer", + error_message: "Token not accepted as fee", }; + let fee_type = FeeType::None; payments.push(wegld_payment); + payments.push(crowd_payment); state.propose_setup_contracts( false, From f3408aae770a367812a2c05cc2de9eb1a2ce08d9 Mon Sep 17 00:00:00 2001 From: Andrei Baltariu Date: Tue, 10 Sep 2024 12:44:30 +0300 Subject: [PATCH 315/523] Added formula for fee and token balance checks Signed-off-by: Andrei Baltariu --- .../tests/enshrine_esdt_safe_blackbox_test.rs | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/enshrine-esdt-safe/tests/enshrine_esdt_safe_blackbox_test.rs b/enshrine-esdt-safe/tests/enshrine_esdt_safe_blackbox_test.rs index 60c4b649..70e124b3 100644 --- a/enshrine-esdt-safe/tests/enshrine_esdt_safe_blackbox_test.rs +++ b/enshrine-esdt-safe/tests/enshrine_esdt_safe_blackbox_test.rs @@ -772,13 +772,18 @@ fn test_deposit_no_transfer_data() { ); let expected_wegld_amount = BigUint::from(WEGLD_BALANCE) - fee_amount_per_transfer; - let expected_crowd_amount = BigUint::from(WEGLD_BALANCE) - amount; + let expected_crowd_amount = BigUint::from(WEGLD_BALANCE) - &amount; state .world .check_account(ENSHRINE_ESDT_OWNER_ADDRESS) .esdt_balance(WEGLD_IDENTIFIER, &expected_wegld_amount); + state + .world + .check_account(ENSHRINE_ESDT_OWNER_ADDRESS) + .esdt_balance(FUNGIBLE_TOKEN_ID, BigUint::from(WEGLD_BALANCE)); + state .world .check_account(ENSHRINE_ESDT_OWNER_ADDRESS) @@ -869,6 +874,7 @@ fn test_deposit_with_transfer_data_enough_for_fee() { let transfer_data = state.setup_transfer_data(gas_limit, function, args); + let expected_fungible_amount = BigUint::from(WEGLD_BALANCE) - &fungible_payment.amount; payments.push(wegld_payment); payments.push(fungible_payment); payments.push(crowd_payment); @@ -879,7 +885,7 @@ fn test_deposit_with_transfer_data_enough_for_fee() { let fee_type = FeeType::Fixed { token: WEGLD_IDENTIFIER.into(), per_transfer: fee_amount_per_transfer.clone(), - per_gas: fee_amount_per_gas, + per_gas: fee_amount_per_gas.clone(), }; state.propose_setup_contracts(false, true, Some(WEGLD_IDENTIFIER), Some(fee_type), None); @@ -892,7 +898,9 @@ fn test_deposit_with_transfer_data_enough_for_fee() { None, ); - let expected_wegld_amount = BigUint::from(WEGLD_BALANCE) - BigUint::from(100000000200u64); + let fee = fee_amount_per_transfer * BigUint::from(2u32) + + BigUint::from(gas_limit) * fee_amount_per_gas; + let expected_wegld_amount = BigUint::from(WEGLD_BALANCE) - fee; let expected_crowd_amount = BigUint::from(WEGLD_BALANCE) - amount; state @@ -900,6 +908,11 @@ fn test_deposit_with_transfer_data_enough_for_fee() { .check_account(ENSHRINE_ESDT_OWNER_ADDRESS) .esdt_balance(WEGLD_IDENTIFIER, &expected_wegld_amount); + state + .world + .check_account(ENSHRINE_ESDT_OWNER_ADDRESS) + .esdt_balance(FUNGIBLE_TOKEN_ID, &expected_fungible_amount); + state .world .check_account(ENSHRINE_ESDT_OWNER_ADDRESS) From 706d89677f2d34d6302dedc7cb77705e390b27a5 Mon Sep 17 00:00:00 2001 From: Andrei Baltariu Date: Tue, 10 Sep 2024 13:36:34 +0300 Subject: [PATCH 316/523] More unified syntax migration Signed-off-by: Andrei Baltariu --- .../src/from_sovereign/transfer_tokens.rs | 21 ++++++++++++------- esdt-safe/src/to_sovereign/create_tx.rs | 10 ++++----- 2 files changed, 19 insertions(+), 12 deletions(-) diff --git a/esdt-safe/src/from_sovereign/transfer_tokens.rs b/esdt-safe/src/from_sovereign/transfer_tokens.rs index 941ffc74..f5d863b0 100644 --- a/esdt-safe/src/from_sovereign/transfer_tokens.rs +++ b/esdt-safe/src/from_sovereign/transfer_tokens.rs @@ -74,8 +74,11 @@ pub trait TransferTokensModule: }; if operation_token.token_nonce == 0 { - self.send() - .esdt_local_mint(&mx_token_id, 0, &operation_token.token_data.amount); + self.tx() + .to(ToSelf) + .typed(system_proxy::UserBuiltinProxy) + .esdt_local_mint(&mx_token_id, 0, &operation_token.token_data.amount) + .transfer_execute(); output_payments.push(OperationEsdtPayment { token_identifier: mx_token_id, @@ -258,11 +261,15 @@ pub trait TransferTokensModule: self.multiversx_esdt_token_info_mapper(&mx_token_id, &mx_token_nonce); } - self.send().esdt_local_burn( - &mx_token_id, - mx_token_nonce, - &operation_token.token_data.amount, - ); + self.tx() + .to(ToSelf) + .typed(system_proxy::UserBuiltinProxy) + .esdt_local_burn( + &mx_token_id, + mx_token_nonce, + &operation_token.token_data.amount, + ) + .transfer_execute(); } } diff --git a/esdt-safe/src/to_sovereign/create_tx.rs b/esdt-safe/src/to_sovereign/create_tx.rs index b2c4bce3..9779525d 100644 --- a/esdt-safe/src/to_sovereign/create_tx.rs +++ b/esdt-safe/src/to_sovereign/create_tx.rs @@ -70,11 +70,11 @@ pub trait CreateTxModule: current_token_data.amount = payment.amount.clone(); if self.is_sovereign_chain().get() { - self.send().esdt_local_burn( - &payment.token_identifier, - payment.token_nonce, - &payment.amount, - ); + self.tx() + .to(ToCaller) + .typed(ESDTSystemSCProxy) + .burn(&payment.token_identifier, &payment.amount) + .transfer_execute(); event_payments.push(MultiValue3(( payment.token_identifier.clone(), From f79ce7469a94754a82b0c92627661096d5974d68 Mon Sep 17 00:00:00 2001 From: Andrei Baltariu Date: Tue, 10 Sep 2024 13:39:43 +0300 Subject: [PATCH 317/523] Removed unused import Signed-off-by: Andrei Baltariu --- enshrine-esdt-safe/src/to_sovereign/create_tx.rs | 1 - 1 file changed, 1 deletion(-) diff --git a/enshrine-esdt-safe/src/to_sovereign/create_tx.rs b/enshrine-esdt-safe/src/to_sovereign/create_tx.rs index 451df7f5..94d26721 100644 --- a/enshrine-esdt-safe/src/to_sovereign/create_tx.rs +++ b/enshrine-esdt-safe/src/to_sovereign/create_tx.rs @@ -1,6 +1,5 @@ use crate::common; use fee_market::fee_market_proxy; -use multiversx_sc_scenario::multiversx_chain_vm::tx_execution::ESDT_SYSTEM_SC_ADDRESS_ARRAY; use transaction::{GasLimit, OperationData, TransferData}; use multiversx_sc::imports::*; From de7827b2f38f5888ee39580e16f268df81c4dfe0 Mon Sep 17 00:00:00 2001 From: Andrei Baltariu Date: Tue, 10 Sep 2024 17:49:32 +0300 Subject: [PATCH 318/523] Added separate function for fee checking Signed-off-by: Andrei Baltariu --- .../tests/enshrine_esdt_safe_blackbox_test.rs | 56 ++++++++----------- 1 file changed, 23 insertions(+), 33 deletions(-) diff --git a/enshrine-esdt-safe/tests/enshrine_esdt_safe_blackbox_test.rs b/enshrine-esdt-safe/tests/enshrine_esdt_safe_blackbox_test.rs index 70e124b3..380cbba6 100644 --- a/enshrine-esdt-safe/tests/enshrine_esdt_safe_blackbox_test.rs +++ b/enshrine-esdt-safe/tests/enshrine_esdt_safe_blackbox_test.rs @@ -194,14 +194,7 @@ impl EnshrineTestState { self } - fn propose_setup_contracts( - &mut self, - is_sovereign_chain: bool, - is_fee_enabled: bool, - fee_token_id: Option, - fee_type: Option>, - fee_market_error_status: Option, - ) -> &mut Self { + fn propose_setup_contracts(&mut self, is_sovereign_chain: bool) -> &mut Self { self.deploy_enshrine_esdt_contract( is_sovereign_chain, Some(TokenIdentifier::from(WEGLD_IDENTIFIER)), @@ -214,13 +207,6 @@ impl EnshrineTestState { self.propose_set_header_verifier_address(); self.propose_register_fee_market_address(); - self.propose_check_is_fee_enabled( - is_fee_enabled, - fee_token_id, - fee_type, - fee_market_error_status, - ); - self } @@ -507,7 +493,7 @@ impl EnshrineTestState { fn test_deploy() { let mut state = EnshrineTestState::new(); - state.propose_setup_contracts(false, false, None, None, None); + state.propose_setup_contracts(false); } #[test] @@ -519,7 +505,7 @@ fn test_sovereign_prefix_no_prefix() { error_message: "Operation is not registered", }); - state.propose_setup_contracts(false, false, None, None, None); + state.propose_setup_contracts(false); state.propose_register_operation(&token_vec); state.propose_execute_operation(error_status, &token_vec); } @@ -533,7 +519,7 @@ fn test_sovereign_prefix_has_prefix() { error_message: "Operation is not registered", }); - state.propose_setup_contracts(false, false, None, None, None); + state.propose_setup_contracts(false); state.propose_register_operation(&token_vec); state.propose_execute_operation(error_status, &token_vec); } @@ -547,7 +533,7 @@ fn test_register_tokens_insufficient_funds() { let payment_amount = BigUint::from(DEFAULT_ISSUE_COST * token_vec.len() as u64); let payment = EsdtTokenPayment::new(WEGLD_IDENTIFIER.into(), 0, payment_amount); - state.propose_setup_contracts(false, false, None, None, None); + state.propose_setup_contracts(false); state.propose_register_tokens( &USER_ADDRESS, payment, @@ -568,7 +554,7 @@ fn test_register_tokens_wrong_token_as_fee() { let payment_amount = BigUint::from(DEFAULT_ISSUE_COST * token_vec.len() as u64); let payment = EsdtTokenPayment::new(CROWD_TOKEN_ID.into(), 0, payment_amount); - state.propose_setup_contracts(false, false, None, None, None); + state.propose_setup_contracts(false); state.propose_register_tokens( &ENSHRINE_ESDT_OWNER_ADDRESS, payment, @@ -587,7 +573,7 @@ fn test_register_tokens() { let payment_amount = BigUint::from(DEFAULT_ISSUE_COST * token_vec.len() as u64); let payment = EsdtTokenPayment::new(WEGLD_IDENTIFIER.into(), 0, payment_amount); - state.propose_setup_contracts(false, false, None, None, None); + state.propose_setup_contracts(false); state.propose_register_tokens(&ENSHRINE_ESDT_OWNER_ADDRESS, payment, token_vec, None); state .world @@ -609,7 +595,7 @@ fn test_register_tokens_insufficient_wegld() { let payment_amount = BigUint::from(DEFAULT_ISSUE_COST + token_vec.len() as u64); let payment = EsdtTokenPayment::new(WEGLD_IDENTIFIER.into(), 0, payment_amount); - state.propose_setup_contracts(false, false, None, None, None); + state.propose_setup_contracts(false); state.propose_register_tokens( &ENSHRINE_ESDT_OWNER_ADDRESS, payment, @@ -634,7 +620,7 @@ fn test_deposit_nothing_to_transfer() { payments.push(wegld_payment); - state.propose_setup_contracts(false, true, None, None, None); + state.propose_setup_contracts(false); state.propose_deposit( ENSHRINE_ESDT_OWNER_ADDRESS, USER_ADDRESS, @@ -645,7 +631,7 @@ fn test_deposit_nothing_to_transfer() { } #[test] -fn test_deposit_token_not_acctepted_as_fee() { +fn test_deposit_token_not_accepted_as_fee_wtf() { let mut state = EnshrineTestState::new(); let amount = BigUint::from(10000u64); let wegld_payment = EsdtTokenPayment::new(WEGLD_IDENTIFIER.into(), 0, amount.clone()); @@ -665,8 +651,8 @@ fn test_deposit_token_not_acctepted_as_fee() { payments.push(wegld_payment); payments.push(crowd_payment); - state.propose_setup_contracts( - false, + state.propose_setup_contracts(false); + state.propose_check_is_fee_enabled( true, Some(WEGLD_IDENTIFIER), Some(fee_type), @@ -703,7 +689,8 @@ fn test_deposit_token_not_accepted_as_fee() { payments.push(wegld_payment); - state.propose_setup_contracts(false, true, Some(WEGLD_IDENTIFIER), Some(fee_type), None); + state.propose_setup_contracts(false); + state.propose_check_is_fee_enabled(true, Some(WEGLD_IDENTIFIER), Some(fee_type), None); state.propose_deposit( ENSHRINE_ESDT_OWNER_ADDRESS, USER_ADDRESS, @@ -726,7 +713,7 @@ fn test_deposit_max_transfers_exceeded() { payments.extend(std::iter::repeat(wegld_payment).take(11)); - state.propose_setup_contracts(false, false, None, None, None); + state.propose_setup_contracts(false); state.propose_deposit( ENSHRINE_ESDT_OWNER_ADDRESS, USER_ADDRESS, @@ -761,8 +748,9 @@ fn test_deposit_no_transfer_data() { per_gas: fee_amount_per_gas, }; - state.propose_setup_contracts(false, true, Some(WEGLD_IDENTIFIER), Some(fee_type), None); + state.propose_setup_contracts(false); state.propose_add_token_to_whitelist(tokens_whitelist); + state.propose_check_is_fee_enabled(true, Some(WEGLD_IDENTIFIER), Some(fee_type), None); state.propose_deposit( ENSHRINE_ESDT_OWNER_ADDRESS, USER_ADDRESS, @@ -813,7 +801,7 @@ fn test_deposit_with_transfer_data_gas_limit_too_high() { error_message: "Gas limit too high", }; - state.propose_setup_contracts(false, false, None, None, None); + state.propose_setup_contracts(false); state.propose_deposit( ENSHRINE_ESDT_OWNER_ADDRESS, USER_ADDRESS, @@ -846,7 +834,7 @@ fn test_deposit_with_transfer_data_banned_endpoint() { error_message: "Banned endpoint name", }; - state.propose_setup_contracts(false, false, None, None, None); + state.propose_setup_contracts(false); state.propose_set_max_user_tx_gas_limit(gas_limit); state.propose_set_banned_endpoint(function); state.propose_deposit( @@ -888,8 +876,9 @@ fn test_deposit_with_transfer_data_enough_for_fee() { per_gas: fee_amount_per_gas.clone(), }; - state.propose_setup_contracts(false, true, Some(WEGLD_IDENTIFIER), Some(fee_type), None); + state.propose_setup_contracts(false); state.propose_set_max_user_tx_gas_limit(gas_limit); + state.propose_check_is_fee_enabled(true, Some(WEGLD_IDENTIFIER), Some(fee_type), None); state.propose_deposit( ENSHRINE_ESDT_OWNER_ADDRESS, USER_ADDRESS, @@ -953,8 +942,9 @@ fn test_deposit_with_transfer_data_not_enough_for_fee() { per_gas: fee_amount_per_gas, }; - state.propose_setup_contracts(false, true, Some(WEGLD_IDENTIFIER), Some(fee_type), None); + state.propose_setup_contracts(false); state.propose_set_max_user_tx_gas_limit(gas_limit); + state.propose_check_is_fee_enabled(true, Some(WEGLD_IDENTIFIER), Some(fee_type), None); state.propose_deposit( ENSHRINE_ESDT_OWNER_ADDRESS, USER_ADDRESS, From 301933953a37780a713b77b0b205de5d1aacd9f7 Mon Sep 17 00:00:00 2001 From: Andrei Baltariu Date: Wed, 11 Sep 2024 11:07:11 +0300 Subject: [PATCH 319/523] Renamed fee function Signed-off-by: Andrei Baltariu --- .../tests/enshrine_esdt_safe_blackbox_test.rs | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/enshrine-esdt-safe/tests/enshrine_esdt_safe_blackbox_test.rs b/enshrine-esdt-safe/tests/enshrine_esdt_safe_blackbox_test.rs index 380cbba6..62b470bf 100644 --- a/enshrine-esdt-safe/tests/enshrine_esdt_safe_blackbox_test.rs +++ b/enshrine-esdt-safe/tests/enshrine_esdt_safe_blackbox_test.rs @@ -210,7 +210,7 @@ impl EnshrineTestState { self } - fn propose_check_is_fee_enabled( + fn propose_set_fee( &mut self, is_fee_enabled: bool, fee_token_id: Option, @@ -652,7 +652,7 @@ fn test_deposit_token_not_accepted_as_fee_wtf() { payments.push(crowd_payment); state.propose_setup_contracts(false); - state.propose_check_is_fee_enabled( + state.propose_set_fee( true, Some(WEGLD_IDENTIFIER), Some(fee_type), @@ -690,7 +690,7 @@ fn test_deposit_token_not_accepted_as_fee() { payments.push(wegld_payment); state.propose_setup_contracts(false); - state.propose_check_is_fee_enabled(true, Some(WEGLD_IDENTIFIER), Some(fee_type), None); + state.propose_set_fee(true, Some(WEGLD_IDENTIFIER), Some(fee_type), None); state.propose_deposit( ENSHRINE_ESDT_OWNER_ADDRESS, USER_ADDRESS, @@ -750,7 +750,7 @@ fn test_deposit_no_transfer_data() { state.propose_setup_contracts(false); state.propose_add_token_to_whitelist(tokens_whitelist); - state.propose_check_is_fee_enabled(true, Some(WEGLD_IDENTIFIER), Some(fee_type), None); + state.propose_set_fee(true, Some(WEGLD_IDENTIFIER), Some(fee_type), None); state.propose_deposit( ENSHRINE_ESDT_OWNER_ADDRESS, USER_ADDRESS, @@ -878,7 +878,7 @@ fn test_deposit_with_transfer_data_enough_for_fee() { state.propose_setup_contracts(false); state.propose_set_max_user_tx_gas_limit(gas_limit); - state.propose_check_is_fee_enabled(true, Some(WEGLD_IDENTIFIER), Some(fee_type), None); + state.propose_set_fee(true, Some(WEGLD_IDENTIFIER), Some(fee_type), None); state.propose_deposit( ENSHRINE_ESDT_OWNER_ADDRESS, USER_ADDRESS, @@ -944,7 +944,7 @@ fn test_deposit_with_transfer_data_not_enough_for_fee() { state.propose_setup_contracts(false); state.propose_set_max_user_tx_gas_limit(gas_limit); - state.propose_check_is_fee_enabled(true, Some(WEGLD_IDENTIFIER), Some(fee_type), None); + state.propose_set_fee(true, Some(WEGLD_IDENTIFIER), Some(fee_type), None); state.propose_deposit( ENSHRINE_ESDT_OWNER_ADDRESS, USER_ADDRESS, From 4663b1529238720bd92ff39a6cc5e447db99a7e4 Mon Sep 17 00:00:00 2001 From: Andrei Baltariu Date: Wed, 11 Sep 2024 11:08:01 +0300 Subject: [PATCH 320/523] Renamed test Signed-off-by: Andrei Baltariu --- enshrine-esdt-safe/tests/enshrine_esdt_safe_blackbox_test.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/enshrine-esdt-safe/tests/enshrine_esdt_safe_blackbox_test.rs b/enshrine-esdt-safe/tests/enshrine_esdt_safe_blackbox_test.rs index 62b470bf..fea711b7 100644 --- a/enshrine-esdt-safe/tests/enshrine_esdt_safe_blackbox_test.rs +++ b/enshrine-esdt-safe/tests/enshrine_esdt_safe_blackbox_test.rs @@ -631,7 +631,7 @@ fn test_deposit_nothing_to_transfer() { } #[test] -fn test_deposit_token_not_accepted_as_fee_wtf() { +fn test_deposit_token_not_accepted_as_fee() { let mut state = EnshrineTestState::new(); let amount = BigUint::from(10000u64); let wegld_payment = EsdtTokenPayment::new(WEGLD_IDENTIFIER.into(), 0, amount.clone()); @@ -668,7 +668,7 @@ fn test_deposit_token_not_accepted_as_fee_wtf() { } #[test] -fn test_deposit_token_not_accepted_as_fee() { +fn test_deposit_token_nothing_to_transfer() { let mut state = EnshrineTestState::new(); let amount = BigUint::from(10000u64); let wegld_payment = EsdtTokenPayment::new(WEGLD_IDENTIFIER.into(), 0, amount.clone()); From 858d5ed926fe3fb6e8cf6114a6f9d24404eac541 Mon Sep 17 00:00:00 2001 From: Andrei Baltariu Date: Wed, 11 Sep 2024 11:08:48 +0300 Subject: [PATCH 321/523] Added more specific test name Signed-off-by: Andrei Baltariu --- enshrine-esdt-safe/tests/enshrine_esdt_safe_blackbox_test.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/enshrine-esdt-safe/tests/enshrine_esdt_safe_blackbox_test.rs b/enshrine-esdt-safe/tests/enshrine_esdt_safe_blackbox_test.rs index fea711b7..1821f03c 100644 --- a/enshrine-esdt-safe/tests/enshrine_esdt_safe_blackbox_test.rs +++ b/enshrine-esdt-safe/tests/enshrine_esdt_safe_blackbox_test.rs @@ -668,7 +668,7 @@ fn test_deposit_token_not_accepted_as_fee() { } #[test] -fn test_deposit_token_nothing_to_transfer() { +fn test_deposit_token_nothing_to_transfer_fee_enabled() { let mut state = EnshrineTestState::new(); let amount = BigUint::from(10000u64); let wegld_payment = EsdtTokenPayment::new(WEGLD_IDENTIFIER.into(), 0, amount.clone()); From d2dec7df668fb0fca132d63c39b461378da4cb5b Mon Sep 17 00:00:00 2001 From: Andrei Baltariu Date: Wed, 11 Sep 2024 11:11:00 +0300 Subject: [PATCH 322/523] Moved expected payment amount to avoid cloninng Signed-off-by: Andrei Baltariu --- enshrine-esdt-safe/tests/enshrine_esdt_safe_blackbox_test.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/enshrine-esdt-safe/tests/enshrine_esdt_safe_blackbox_test.rs b/enshrine-esdt-safe/tests/enshrine_esdt_safe_blackbox_test.rs index 1821f03c..c6148b31 100644 --- a/enshrine-esdt-safe/tests/enshrine_esdt_safe_blackbox_test.rs +++ b/enshrine-esdt-safe/tests/enshrine_esdt_safe_blackbox_test.rs @@ -862,7 +862,9 @@ fn test_deposit_with_transfer_data_enough_for_fee() { let transfer_data = state.setup_transfer_data(gas_limit, function, args); + let expected_crowd_amount = BigUint::from(WEGLD_BALANCE) - &wegld_payment.amount; let expected_fungible_amount = BigUint::from(WEGLD_BALANCE) - &fungible_payment.amount; + payments.push(wegld_payment); payments.push(fungible_payment); payments.push(crowd_payment); @@ -890,7 +892,6 @@ fn test_deposit_with_transfer_data_enough_for_fee() { let fee = fee_amount_per_transfer * BigUint::from(2u32) + BigUint::from(gas_limit) * fee_amount_per_gas; let expected_wegld_amount = BigUint::from(WEGLD_BALANCE) - fee; - let expected_crowd_amount = BigUint::from(WEGLD_BALANCE) - amount; state .world From 5ce8bd1287841bf1e788f5dfd05167a4e2e95b62 Mon Sep 17 00:00:00 2001 From: Andrei Baltariu Date: Wed, 11 Sep 2024 11:49:30 +0300 Subject: [PATCH 323/523] Added 2 more tests Signed-off-by: Andrei Baltariu --- .../tests/enshrine_esdt_safe_blackbox_test.rs | 87 +++++++++++++++++++ 1 file changed, 87 insertions(+) diff --git a/enshrine-esdt-safe/tests/enshrine_esdt_safe_blackbox_test.rs b/enshrine-esdt-safe/tests/enshrine_esdt_safe_blackbox_test.rs index c6148b31..8d2126fd 100644 --- a/enshrine-esdt-safe/tests/enshrine_esdt_safe_blackbox_test.rs +++ b/enshrine-esdt-safe/tests/enshrine_esdt_safe_blackbox_test.rs @@ -954,3 +954,90 @@ fn test_deposit_with_transfer_data_not_enough_for_fee() { Some(error_status), ); } + +#[test] +fn test_deposit_refund_non_whitelisted_tokens_fee_disabled() { + let mut state = EnshrineTestState::new(); + let mut payments = PaymentsVec::new(); + let amount = BigUint::from(100000000000000000u128); + let wegld_payment = EsdtTokenPayment::new(WEGLD_IDENTIFIER.into(), 0, amount.clone()); + let fungible_payment = EsdtTokenPayment::new(FUNGIBLE_TOKEN_ID.into(), 0, amount.clone()); + let crowd_payment = EsdtTokenPayment::new(CROWD_TOKEN_ID.into(), 0, amount.clone()); + let mut token_whitelist = MultiValueEncoded::new(); + token_whitelist.push(NFT_TOKEN_ID.into()); + + payments.push(wegld_payment); + payments.push(fungible_payment); + payments.push(crowd_payment); + + state.propose_setup_contracts(false); + state.propose_set_fee(false, None, None, None); + state.propose_add_token_to_whitelist(token_whitelist); + state.propose_deposit( + ENSHRINE_ESDT_OWNER_ADDRESS, + USER_ADDRESS, + payments, + OptionalValue::None, + None, + ); + + let expected_amount = BigUint::from(WEGLD_BALANCE); + + state + .world + .check_account(ENSHRINE_ESDT_OWNER_ADDRESS) + .esdt_balance(FUNGIBLE_TOKEN_ID, &expected_amount); + + state + .world + .check_account(ENSHRINE_ESDT_OWNER_ADDRESS) + .esdt_balance(CROWD_TOKEN_ID, &expected_amount); +} + +#[test] +fn test_deposit_refund_non_whitelisted_tokens_fee_enabled() { + let mut state = EnshrineTestState::new(); + let mut payments = PaymentsVec::new(); + let amount = BigUint::from(100000000000000000u128); + let wegld_payment = EsdtTokenPayment::new(WEGLD_IDENTIFIER.into(), 0, amount.clone()); + let fungible_payment = EsdtTokenPayment::new(FUNGIBLE_TOKEN_ID.into(), 0, amount.clone()); + let crowd_payment = EsdtTokenPayment::new(CROWD_TOKEN_ID.into(), 0, amount.clone()); + let mut token_whitelist = MultiValueEncoded::new(); + token_whitelist.push(NFT_TOKEN_ID.into()); + + payments.push(wegld_payment); + payments.push(fungible_payment); + payments.push(crowd_payment); + + let fee_amount_per_transfer = BigUint::from(100u32); + let fee_amount_per_gas = BigUint::from(100u32); + + let fee_type = FeeType::Fixed { + token: WEGLD_IDENTIFIER.into(), + per_transfer: fee_amount_per_transfer, + per_gas: fee_amount_per_gas, + }; + + state.propose_setup_contracts(false); + state.propose_set_fee(true, Some(WEGLD_IDENTIFIER), Some(fee_type), None); + state.propose_add_token_to_whitelist(token_whitelist); + state.propose_deposit( + ENSHRINE_ESDT_OWNER_ADDRESS, + USER_ADDRESS, + payments, + OptionalValue::None, + None, + ); + + let expected_amount = BigUint::from(WEGLD_BALANCE); + + state + .world + .check_account(ENSHRINE_ESDT_OWNER_ADDRESS) + .esdt_balance(FUNGIBLE_TOKEN_ID, &expected_amount); + + state + .world + .check_account(ENSHRINE_ESDT_OWNER_ADDRESS) + .esdt_balance(CROWD_TOKEN_ID, &expected_amount); +} From be60a1a7dc2ee35a4e2761a6c079b8268ecc55b5 Mon Sep 17 00:00:00 2001 From: Andrei Baltariu Date: Thu, 12 Sep 2024 09:26:22 +0300 Subject: [PATCH 324/523] Added bool to disable fee in setup function Signed-off-by: Andrei Baltariu --- .../tests/enshrine_esdt_safe_blackbox_test.rs | 84 ++++++++++--------- 1 file changed, 45 insertions(+), 39 deletions(-) diff --git a/enshrine-esdt-safe/tests/enshrine_esdt_safe_blackbox_test.rs b/enshrine-esdt-safe/tests/enshrine_esdt_safe_blackbox_test.rs index 8d2126fd..5cb36b59 100644 --- a/enshrine-esdt-safe/tests/enshrine_esdt_safe_blackbox_test.rs +++ b/enshrine-esdt-safe/tests/enshrine_esdt_safe_blackbox_test.rs @@ -194,7 +194,11 @@ impl EnshrineTestState { self } - fn propose_setup_contracts(&mut self, is_sovereign_chain: bool) -> &mut Self { + fn propose_setup_contracts( + &mut self, + is_sovereign_chain: bool, + is_fee_enabled: bool, + ) -> &mut Self { self.deploy_enshrine_esdt_contract( is_sovereign_chain, Some(TokenIdentifier::from(WEGLD_IDENTIFIER)), @@ -207,28 +211,31 @@ impl EnshrineTestState { self.propose_set_header_verifier_address(); self.propose_register_fee_market_address(); + if !is_fee_enabled { + self.propose_disable_fee(); + } + + self + } + + fn propose_disable_fee(&mut self) -> &mut Self { + self.world + .tx() + .from(ENSHRINE_ESDT_OWNER_ADDRESS) + .to(FEE_MARKET_ADDRESS) + .typed(fee_market_proxy::FeeMarketProxy) + .disable_fee() + .run(); + self } fn propose_set_fee( &mut self, - is_fee_enabled: bool, fee_token_id: Option, fee_type: Option>, error_status: Option, ) -> &mut Self { - if !is_fee_enabled { - self.world - .tx() - .from(ENSHRINE_ESDT_OWNER_ADDRESS) - .to(FEE_MARKET_ADDRESS) - .typed(fee_market_proxy::FeeMarketProxy) - .disable_fee() - .run(); - - return self; - } - match (fee_token_id, fee_type) { (Some(token_id), Some(fee_type)) => { self.propose_add_fee_token(token_id, fee_type, error_status) @@ -493,7 +500,7 @@ impl EnshrineTestState { fn test_deploy() { let mut state = EnshrineTestState::new(); - state.propose_setup_contracts(false); + state.propose_setup_contracts(false, false); } #[test] @@ -505,7 +512,7 @@ fn test_sovereign_prefix_no_prefix() { error_message: "Operation is not registered", }); - state.propose_setup_contracts(false); + state.propose_setup_contracts(false, false); state.propose_register_operation(&token_vec); state.propose_execute_operation(error_status, &token_vec); } @@ -519,7 +526,7 @@ fn test_sovereign_prefix_has_prefix() { error_message: "Operation is not registered", }); - state.propose_setup_contracts(false); + state.propose_setup_contracts(false, false); state.propose_register_operation(&token_vec); state.propose_execute_operation(error_status, &token_vec); } @@ -533,7 +540,7 @@ fn test_register_tokens_insufficient_funds() { let payment_amount = BigUint::from(DEFAULT_ISSUE_COST * token_vec.len() as u64); let payment = EsdtTokenPayment::new(WEGLD_IDENTIFIER.into(), 0, payment_amount); - state.propose_setup_contracts(false); + state.propose_setup_contracts(false, false); state.propose_register_tokens( &USER_ADDRESS, payment, @@ -554,7 +561,7 @@ fn test_register_tokens_wrong_token_as_fee() { let payment_amount = BigUint::from(DEFAULT_ISSUE_COST * token_vec.len() as u64); let payment = EsdtTokenPayment::new(CROWD_TOKEN_ID.into(), 0, payment_amount); - state.propose_setup_contracts(false); + state.propose_setup_contracts(false, false); state.propose_register_tokens( &ENSHRINE_ESDT_OWNER_ADDRESS, payment, @@ -573,7 +580,7 @@ fn test_register_tokens() { let payment_amount = BigUint::from(DEFAULT_ISSUE_COST * token_vec.len() as u64); let payment = EsdtTokenPayment::new(WEGLD_IDENTIFIER.into(), 0, payment_amount); - state.propose_setup_contracts(false); + state.propose_setup_contracts(false, false); state.propose_register_tokens(&ENSHRINE_ESDT_OWNER_ADDRESS, payment, token_vec, None); state .world @@ -595,7 +602,7 @@ fn test_register_tokens_insufficient_wegld() { let payment_amount = BigUint::from(DEFAULT_ISSUE_COST + token_vec.len() as u64); let payment = EsdtTokenPayment::new(WEGLD_IDENTIFIER.into(), 0, payment_amount); - state.propose_setup_contracts(false); + state.propose_setup_contracts(false, false); state.propose_register_tokens( &ENSHRINE_ESDT_OWNER_ADDRESS, payment, @@ -620,7 +627,7 @@ fn test_deposit_nothing_to_transfer() { payments.push(wegld_payment); - state.propose_setup_contracts(false); + state.propose_setup_contracts(false, true); state.propose_deposit( ENSHRINE_ESDT_OWNER_ADDRESS, USER_ADDRESS, @@ -651,9 +658,8 @@ fn test_deposit_token_not_accepted_as_fee() { payments.push(wegld_payment); payments.push(crowd_payment); - state.propose_setup_contracts(false); + state.propose_setup_contracts(false, true); state.propose_set_fee( - true, Some(WEGLD_IDENTIFIER), Some(fee_type), Some(fee_market_error_status), @@ -689,8 +695,8 @@ fn test_deposit_token_nothing_to_transfer_fee_enabled() { payments.push(wegld_payment); - state.propose_setup_contracts(false); - state.propose_set_fee(true, Some(WEGLD_IDENTIFIER), Some(fee_type), None); + state.propose_setup_contracts(false, true); + state.propose_set_fee(Some(WEGLD_IDENTIFIER), Some(fee_type), None); state.propose_deposit( ENSHRINE_ESDT_OWNER_ADDRESS, USER_ADDRESS, @@ -713,7 +719,7 @@ fn test_deposit_max_transfers_exceeded() { payments.extend(std::iter::repeat(wegld_payment).take(11)); - state.propose_setup_contracts(false); + state.propose_setup_contracts(false, false); state.propose_deposit( ENSHRINE_ESDT_OWNER_ADDRESS, USER_ADDRESS, @@ -748,9 +754,9 @@ fn test_deposit_no_transfer_data() { per_gas: fee_amount_per_gas, }; - state.propose_setup_contracts(false); + state.propose_setup_contracts(false, true); state.propose_add_token_to_whitelist(tokens_whitelist); - state.propose_set_fee(true, Some(WEGLD_IDENTIFIER), Some(fee_type), None); + state.propose_set_fee(Some(WEGLD_IDENTIFIER), Some(fee_type), None); state.propose_deposit( ENSHRINE_ESDT_OWNER_ADDRESS, USER_ADDRESS, @@ -801,7 +807,7 @@ fn test_deposit_with_transfer_data_gas_limit_too_high() { error_message: "Gas limit too high", }; - state.propose_setup_contracts(false); + state.propose_setup_contracts(false, false); state.propose_deposit( ENSHRINE_ESDT_OWNER_ADDRESS, USER_ADDRESS, @@ -834,7 +840,7 @@ fn test_deposit_with_transfer_data_banned_endpoint() { error_message: "Banned endpoint name", }; - state.propose_setup_contracts(false); + state.propose_setup_contracts(false, false); state.propose_set_max_user_tx_gas_limit(gas_limit); state.propose_set_banned_endpoint(function); state.propose_deposit( @@ -878,9 +884,9 @@ fn test_deposit_with_transfer_data_enough_for_fee() { per_gas: fee_amount_per_gas.clone(), }; - state.propose_setup_contracts(false); + state.propose_setup_contracts(false, true); state.propose_set_max_user_tx_gas_limit(gas_limit); - state.propose_set_fee(true, Some(WEGLD_IDENTIFIER), Some(fee_type), None); + state.propose_set_fee(Some(WEGLD_IDENTIFIER), Some(fee_type), None); state.propose_deposit( ENSHRINE_ESDT_OWNER_ADDRESS, USER_ADDRESS, @@ -943,9 +949,9 @@ fn test_deposit_with_transfer_data_not_enough_for_fee() { per_gas: fee_amount_per_gas, }; - state.propose_setup_contracts(false); + state.propose_setup_contracts(false, true); state.propose_set_max_user_tx_gas_limit(gas_limit); - state.propose_set_fee(true, Some(WEGLD_IDENTIFIER), Some(fee_type), None); + state.propose_set_fee(Some(WEGLD_IDENTIFIER), Some(fee_type), None); state.propose_deposit( ENSHRINE_ESDT_OWNER_ADDRESS, USER_ADDRESS, @@ -970,8 +976,8 @@ fn test_deposit_refund_non_whitelisted_tokens_fee_disabled() { payments.push(fungible_payment); payments.push(crowd_payment); - state.propose_setup_contracts(false); - state.propose_set_fee(false, None, None, None); + state.propose_setup_contracts(false, false); + state.propose_set_fee(None, None, None); state.propose_add_token_to_whitelist(token_whitelist); state.propose_deposit( ENSHRINE_ESDT_OWNER_ADDRESS, @@ -1018,8 +1024,8 @@ fn test_deposit_refund_non_whitelisted_tokens_fee_enabled() { per_gas: fee_amount_per_gas, }; - state.propose_setup_contracts(false); - state.propose_set_fee(true, Some(WEGLD_IDENTIFIER), Some(fee_type), None); + state.propose_setup_contracts(false, true); + state.propose_set_fee(Some(WEGLD_IDENTIFIER), Some(fee_type), None); state.propose_add_token_to_whitelist(token_whitelist); state.propose_deposit( ENSHRINE_ESDT_OWNER_ADDRESS, From f7a1b05ad8a03063ac754e5d61aae1436400da3f Mon Sep 17 00:00:00 2001 From: Andrei Baltariu Date: Thu, 12 Sep 2024 11:29:05 +0300 Subject: [PATCH 325/523] Added enable fee function and switched condition in setup Signed-off-by: Andrei Baltariu --- .../tests/enshrine_esdt_safe_blackbox_test.rs | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/enshrine-esdt-safe/tests/enshrine_esdt_safe_blackbox_test.rs b/enshrine-esdt-safe/tests/enshrine_esdt_safe_blackbox_test.rs index 5cb36b59..28ca7f2b 100644 --- a/enshrine-esdt-safe/tests/enshrine_esdt_safe_blackbox_test.rs +++ b/enshrine-esdt-safe/tests/enshrine_esdt_safe_blackbox_test.rs @@ -210,14 +210,27 @@ impl EnshrineTestState { self.propose_set_header_verifier_address(); self.propose_register_fee_market_address(); + self.propose_disable_fee(); - if !is_fee_enabled { - self.propose_disable_fee(); + if is_fee_enabled { + self.propose_enable_fee(); } self } + fn propose_enable_fee(&mut self) -> &mut Self { + self.world + .tx() + .from(ENSHRINE_ESDT_OWNER_ADDRESS) + .to(FEE_MARKET_ADDRESS) + .typed(fee_market_proxy::FeeMarketProxy) + .enable_fee() + .run(); + + self + } + fn propose_disable_fee(&mut self) -> &mut Self { self.world .tx() From 62a37628ea217b5afa853cf852ca7bc0390b1801 Mon Sep 17 00:00:00 2001 From: Andrei Baltariu Date: Thu, 12 Sep 2024 23:55:39 +0300 Subject: [PATCH 326/523] Removed unnecessary bool argument and added enable_fee on set_fee Signed-off-by: Andrei Baltariu --- .../tests/enshrine_esdt_safe_blackbox_test.rs | 50 ++++++++----------- 1 file changed, 22 insertions(+), 28 deletions(-) diff --git a/enshrine-esdt-safe/tests/enshrine_esdt_safe_blackbox_test.rs b/enshrine-esdt-safe/tests/enshrine_esdt_safe_blackbox_test.rs index 28ca7f2b..8cbbf54c 100644 --- a/enshrine-esdt-safe/tests/enshrine_esdt_safe_blackbox_test.rs +++ b/enshrine-esdt-safe/tests/enshrine_esdt_safe_blackbox_test.rs @@ -194,11 +194,7 @@ impl EnshrineTestState { self } - fn propose_setup_contracts( - &mut self, - is_sovereign_chain: bool, - is_fee_enabled: bool, - ) -> &mut Self { + fn propose_setup_contracts(&mut self, is_sovereign_chain: bool) -> &mut Self { self.deploy_enshrine_esdt_contract( is_sovereign_chain, Some(TokenIdentifier::from(WEGLD_IDENTIFIER)), @@ -212,10 +208,6 @@ impl EnshrineTestState { self.propose_register_fee_market_address(); self.propose_disable_fee(); - if is_fee_enabled { - self.propose_enable_fee(); - } - self } @@ -249,6 +241,8 @@ impl EnshrineTestState { fee_type: Option>, error_status: Option, ) -> &mut Self { + self.propose_enable_fee(); + match (fee_token_id, fee_type) { (Some(token_id), Some(fee_type)) => { self.propose_add_fee_token(token_id, fee_type, error_status) @@ -513,7 +507,7 @@ impl EnshrineTestState { fn test_deploy() { let mut state = EnshrineTestState::new(); - state.propose_setup_contracts(false, false); + state.propose_setup_contracts(false); } #[test] @@ -525,7 +519,7 @@ fn test_sovereign_prefix_no_prefix() { error_message: "Operation is not registered", }); - state.propose_setup_contracts(false, false); + state.propose_setup_contracts(false); state.propose_register_operation(&token_vec); state.propose_execute_operation(error_status, &token_vec); } @@ -539,7 +533,7 @@ fn test_sovereign_prefix_has_prefix() { error_message: "Operation is not registered", }); - state.propose_setup_contracts(false, false); + state.propose_setup_contracts(false); state.propose_register_operation(&token_vec); state.propose_execute_operation(error_status, &token_vec); } @@ -553,7 +547,7 @@ fn test_register_tokens_insufficient_funds() { let payment_amount = BigUint::from(DEFAULT_ISSUE_COST * token_vec.len() as u64); let payment = EsdtTokenPayment::new(WEGLD_IDENTIFIER.into(), 0, payment_amount); - state.propose_setup_contracts(false, false); + state.propose_setup_contracts(false); state.propose_register_tokens( &USER_ADDRESS, payment, @@ -574,7 +568,7 @@ fn test_register_tokens_wrong_token_as_fee() { let payment_amount = BigUint::from(DEFAULT_ISSUE_COST * token_vec.len() as u64); let payment = EsdtTokenPayment::new(CROWD_TOKEN_ID.into(), 0, payment_amount); - state.propose_setup_contracts(false, false); + state.propose_setup_contracts(false); state.propose_register_tokens( &ENSHRINE_ESDT_OWNER_ADDRESS, payment, @@ -593,7 +587,7 @@ fn test_register_tokens() { let payment_amount = BigUint::from(DEFAULT_ISSUE_COST * token_vec.len() as u64); let payment = EsdtTokenPayment::new(WEGLD_IDENTIFIER.into(), 0, payment_amount); - state.propose_setup_contracts(false, false); + state.propose_setup_contracts(false); state.propose_register_tokens(&ENSHRINE_ESDT_OWNER_ADDRESS, payment, token_vec, None); state .world @@ -615,7 +609,7 @@ fn test_register_tokens_insufficient_wegld() { let payment_amount = BigUint::from(DEFAULT_ISSUE_COST + token_vec.len() as u64); let payment = EsdtTokenPayment::new(WEGLD_IDENTIFIER.into(), 0, payment_amount); - state.propose_setup_contracts(false, false); + state.propose_setup_contracts(false); state.propose_register_tokens( &ENSHRINE_ESDT_OWNER_ADDRESS, payment, @@ -640,7 +634,8 @@ fn test_deposit_nothing_to_transfer() { payments.push(wegld_payment); - state.propose_setup_contracts(false, true); + state.propose_setup_contracts(false); + state.propose_set_fee(None, None, None); state.propose_deposit( ENSHRINE_ESDT_OWNER_ADDRESS, USER_ADDRESS, @@ -671,7 +666,7 @@ fn test_deposit_token_not_accepted_as_fee() { payments.push(wegld_payment); payments.push(crowd_payment); - state.propose_setup_contracts(false, true); + state.propose_setup_contracts(false); state.propose_set_fee( Some(WEGLD_IDENTIFIER), Some(fee_type), @@ -708,7 +703,7 @@ fn test_deposit_token_nothing_to_transfer_fee_enabled() { payments.push(wegld_payment); - state.propose_setup_contracts(false, true); + state.propose_setup_contracts(false); state.propose_set_fee(Some(WEGLD_IDENTIFIER), Some(fee_type), None); state.propose_deposit( ENSHRINE_ESDT_OWNER_ADDRESS, @@ -732,7 +727,7 @@ fn test_deposit_max_transfers_exceeded() { payments.extend(std::iter::repeat(wegld_payment).take(11)); - state.propose_setup_contracts(false, false); + state.propose_setup_contracts(false); state.propose_deposit( ENSHRINE_ESDT_OWNER_ADDRESS, USER_ADDRESS, @@ -767,7 +762,7 @@ fn test_deposit_no_transfer_data() { per_gas: fee_amount_per_gas, }; - state.propose_setup_contracts(false, true); + state.propose_setup_contracts(false); state.propose_add_token_to_whitelist(tokens_whitelist); state.propose_set_fee(Some(WEGLD_IDENTIFIER), Some(fee_type), None); state.propose_deposit( @@ -820,7 +815,7 @@ fn test_deposit_with_transfer_data_gas_limit_too_high() { error_message: "Gas limit too high", }; - state.propose_setup_contracts(false, false); + state.propose_setup_contracts(false); state.propose_deposit( ENSHRINE_ESDT_OWNER_ADDRESS, USER_ADDRESS, @@ -853,7 +848,7 @@ fn test_deposit_with_transfer_data_banned_endpoint() { error_message: "Banned endpoint name", }; - state.propose_setup_contracts(false, false); + state.propose_setup_contracts(false); state.propose_set_max_user_tx_gas_limit(gas_limit); state.propose_set_banned_endpoint(function); state.propose_deposit( @@ -897,7 +892,7 @@ fn test_deposit_with_transfer_data_enough_for_fee() { per_gas: fee_amount_per_gas.clone(), }; - state.propose_setup_contracts(false, true); + state.propose_setup_contracts(false); state.propose_set_max_user_tx_gas_limit(gas_limit); state.propose_set_fee(Some(WEGLD_IDENTIFIER), Some(fee_type), None); state.propose_deposit( @@ -962,7 +957,7 @@ fn test_deposit_with_transfer_data_not_enough_for_fee() { per_gas: fee_amount_per_gas, }; - state.propose_setup_contracts(false, true); + state.propose_setup_contracts(false); state.propose_set_max_user_tx_gas_limit(gas_limit); state.propose_set_fee(Some(WEGLD_IDENTIFIER), Some(fee_type), None); state.propose_deposit( @@ -989,8 +984,7 @@ fn test_deposit_refund_non_whitelisted_tokens_fee_disabled() { payments.push(fungible_payment); payments.push(crowd_payment); - state.propose_setup_contracts(false, false); - state.propose_set_fee(None, None, None); + state.propose_setup_contracts(false); state.propose_add_token_to_whitelist(token_whitelist); state.propose_deposit( ENSHRINE_ESDT_OWNER_ADDRESS, @@ -1037,7 +1031,7 @@ fn test_deposit_refund_non_whitelisted_tokens_fee_enabled() { per_gas: fee_amount_per_gas, }; - state.propose_setup_contracts(false, true); + state.propose_setup_contracts(false); state.propose_set_fee(Some(WEGLD_IDENTIFIER), Some(fee_type), None); state.propose_add_token_to_whitelist(token_whitelist); state.propose_deposit( From e8d035159852259c19e9b03e7abb2e05a4506f67 Mon Sep 17 00:00:00 2001 From: Andrei Baltariu Date: Fri, 13 Sep 2024 08:54:45 +0300 Subject: [PATCH 327/523] Moved enable fee logic to add_fee endpoint Signed-off-by: Andrei Baltariu --- fee-market/src/enable_fee.rs | 23 ----------------------- fee-market/src/fee_type.rs | 18 ++++++++++++++++-- fee-market/src/lib.rs | 19 ++++++++++++++----- 3 files changed, 30 insertions(+), 30 deletions(-) delete mode 100644 fee-market/src/enable_fee.rs diff --git a/fee-market/src/enable_fee.rs b/fee-market/src/enable_fee.rs deleted file mode 100644 index 899f2d9c..00000000 --- a/fee-market/src/enable_fee.rs +++ /dev/null @@ -1,23 +0,0 @@ -multiversx_sc::imports!(); - -#[multiversx_sc::module] -pub trait EnableFeeModule { - #[only_owner] - #[endpoint(enableFee)] - fn enable_fee(&self) { - self.fee_enabled().set(true); - } - - #[only_owner] - #[endpoint(disableFee)] - fn disable_fee(&self) { - self.fee_enabled().set(false); - } - - fn is_fee_enabled(&self) -> bool { - self.fee_enabled().get() - } - - #[storage_mapper("feeEnabledFlag")] - fn fee_enabled(&self) -> SingleValueMapper; -} diff --git a/fee-market/src/fee_type.rs b/fee-market/src/fee_type.rs index 77248d12..171ba935 100644 --- a/fee-market/src/fee_type.rs +++ b/fee-market/src/fee_type.rs @@ -1,7 +1,7 @@ multiversx_sc::imports!(); multiversx_sc::derive_imports!(); -#[derive(TypeAbi, TopEncode, TopDecode)] +#[derive(TypeAbi, TopEncode, TopDecode, NestedDecode)] pub enum FeeType { None, Fixed { @@ -16,6 +16,13 @@ pub enum FeeType { }, } +#[type_abi] +#[derive(NestedDecode)] +pub struct FeeStruct { + pub base_token: TokenIdentifier, + pub fee_type: FeeType, +} + #[multiversx_sc::module] pub trait FeeTypeModule: utils::UtilsModule + bls_signature::BlsSignatureModule { #[only_owner] @@ -42,10 +49,14 @@ pub trait FeeTypeModule: utils::UtilsModule + bls_signature::BlsSignatureModule }; self.require_valid_token_id(token); - + self.is_fee_enabled().set(true); self.token_fee(&base_token).set(fee_type); } + fn is_fee_enabled(&self) -> bool { + self.fee_enabled().get() + } + #[only_owner] #[endpoint(removeFee)] fn remove_fee(&self, base_token: TokenIdentifier) { @@ -55,4 +66,7 @@ pub trait FeeTypeModule: utils::UtilsModule + bls_signature::BlsSignatureModule #[view(getTokenFee)] #[storage_mapper("tokenFee")] fn token_fee(&self, token_id: &TokenIdentifier) -> SingleValueMapper>; + + #[storage_mapper("feeEnabledFlag")] + fn fee_enabled(&self) -> SingleValueMapper; } diff --git a/fee-market/src/lib.rs b/fee-market/src/lib.rs index 07ff9129..74b31fbd 100644 --- a/fee-market/src/lib.rs +++ b/fee-market/src/lib.rs @@ -1,8 +1,9 @@ #![no_std] +use fee_type::FeeStruct; + multiversx_sc::imports!(); -pub mod enable_fee; pub mod fee_common; pub mod fee_market_proxy; pub mod fee_type; @@ -11,8 +12,7 @@ pub mod subtract_fee; #[multiversx_sc::contract] pub trait FeeMarket: - enable_fee::EnableFeeModule - + fee_common::CommonFeeModule + fee_common::CommonFeeModule + fee_type::FeeTypeModule + subtract_fee::SubtractFeeModule + price_aggregator::PriceAggregatorModule @@ -20,14 +20,23 @@ pub trait FeeMarket: + bls_signature::BlsSignatureModule { #[init] - fn init(&self, esdt_safe_address: ManagedAddress, price_aggregator_address: ManagedAddress) { + fn init( + &self, + esdt_safe_address: ManagedAddress, + price_aggregator_address: ManagedAddress, + fee: Option>, + ) { self.require_sc_address(&esdt_safe_address); self.require_sc_address(&price_aggregator_address); self.esdt_safe_address().set(esdt_safe_address); self.price_aggregator_address() .set(price_aggregator_address); - self.fee_enabled().set(true); + + match fee { + Option::Some(fee_struct) => self.add_fee(fee_struct.base_token, fee_struct.fee_type), + _ => (), + } } #[upgrade] From 76fed3a511158d1af8fb7a9853cfd4e6e9871403 Mon Sep 17 00:00:00 2001 From: Andrei Baltariu Date: Fri, 13 Sep 2024 08:59:49 +0300 Subject: [PATCH 328/523] Fixed build error + regenerated proxy Signed-off-by: Andrei Baltariu --- fee-market/src/fee_market_proxy.rs | 31 +++++++++------------- fee-market/src/fee_type.rs | 2 +- fee-market/src/subtract_fee.rs | 3 +-- fee-market/wasm-fee-marker-full/src/lib.rs | 6 ++--- fee-market/wasm/src/lib.rs | 6 ++--- 5 files changed, 19 insertions(+), 29 deletions(-) diff --git a/fee-market/src/fee_market_proxy.rs b/fee-market/src/fee_market_proxy.rs index b73472b0..dcbafe2a 100644 --- a/fee-market/src/fee_market_proxy.rs +++ b/fee-market/src/fee_market_proxy.rs @@ -46,16 +46,19 @@ where pub fn init< Arg0: ProxyArg>, Arg1: ProxyArg>, + Arg2: ProxyArg>>, >( self, esdt_safe_address: Arg0, price_aggregator_address: Arg1, + fee: Arg2, ) -> TxTypedDeploy { self.wrapped_tx .payment(NotPayable) .raw_deploy() .argument(&esdt_safe_address) .argument(&price_aggregator_address) + .argument(&fee) .original_result() } } @@ -88,24 +91,6 @@ where To: TxTo, Gas: TxGas, { - pub fn enable_fee( - self, - ) -> TxTypedCall { - self.wrapped_tx - .payment(NotPayable) - .raw_call("enableFee") - .original_result() - } - - pub fn disable_fee( - self, - ) -> TxTypedCall { - self.wrapped_tx - .payment(NotPayable) - .raw_call("disableFee") - .original_result() - } - pub fn add_fee< Arg0: ProxyArg>, Arg1: ProxyArg>, @@ -255,6 +240,16 @@ where } } +#[type_abi] +#[derive(NestedDecode)] +pub struct FeeStruct +where + Api: ManagedTypeApi, +{ + pub base_token: TokenIdentifier, + pub fee_type: FeeType, +} + #[rustfmt::skip] #[type_abi] #[derive(TopEncode, TopDecode)] diff --git a/fee-market/src/fee_type.rs b/fee-market/src/fee_type.rs index 171ba935..d8f797f6 100644 --- a/fee-market/src/fee_type.rs +++ b/fee-market/src/fee_type.rs @@ -49,7 +49,7 @@ pub trait FeeTypeModule: utils::UtilsModule + bls_signature::BlsSignatureModule }; self.require_valid_token_id(token); - self.is_fee_enabled().set(true); + self.fee_enabled().set(true); self.token_fee(&base_token).set(fee_type); } diff --git a/fee-market/src/subtract_fee.rs b/fee-market/src/subtract_fee.rs index 642cfcff..3a4fa2c9 100644 --- a/fee-market/src/subtract_fee.rs +++ b/fee-market/src/subtract_fee.rs @@ -30,8 +30,7 @@ pub struct SubtractPaymentArguments { #[multiversx_sc::module] pub trait SubtractFeeModule: - crate::enable_fee::EnableFeeModule - + crate::fee_type::FeeTypeModule + crate::fee_type::FeeTypeModule + crate::fee_common::CommonFeeModule + crate::price_aggregator::PriceAggregatorModule + utils::UtilsModule diff --git a/fee-market/wasm-fee-marker-full/src/lib.rs b/fee-market/wasm-fee-marker-full/src/lib.rs index 9f2c6a7e..83964e80 100644 --- a/fee-market/wasm-fee-marker-full/src/lib.rs +++ b/fee-market/wasm-fee-marker-full/src/lib.rs @@ -6,9 +6,9 @@ // Init: 1 // Upgrade: 1 -// Endpoints: 13 +// Endpoints: 11 // Async Callback (empty): 1 -// Total number of exported functions: 16 +// Total number of exported functions: 14 #![no_std] @@ -20,8 +20,6 @@ multiversx_sc_wasm_adapter::endpoints! { ( init => init upgrade => upgrade - enableFee => enable_fee - disableFee => disable_fee addFee => add_fee removeFee => remove_fee getTokenFee => token_fee diff --git a/fee-market/wasm/src/lib.rs b/fee-market/wasm/src/lib.rs index 9f2c6a7e..83964e80 100644 --- a/fee-market/wasm/src/lib.rs +++ b/fee-market/wasm/src/lib.rs @@ -6,9 +6,9 @@ // Init: 1 // Upgrade: 1 -// Endpoints: 13 +// Endpoints: 11 // Async Callback (empty): 1 -// Total number of exported functions: 16 +// Total number of exported functions: 14 #![no_std] @@ -20,8 +20,6 @@ multiversx_sc_wasm_adapter::endpoints! { ( init => init upgrade => upgrade - enableFee => enable_fee - disableFee => disable_fee addFee => add_fee removeFee => remove_fee getTokenFee => token_fee From 46b2995b4df082bf3985f3baf954d90e8d2a56e7 Mon Sep 17 00:00:00 2001 From: Andrei Baltariu Date: Fri, 13 Sep 2024 09:09:28 +0300 Subject: [PATCH 329/523] Added by hand NestedDecode to fee market proxy Signed-off-by: Andrei Baltariu --- fee-market/src/fee_market_proxy.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fee-market/src/fee_market_proxy.rs b/fee-market/src/fee_market_proxy.rs index dcbafe2a..17019fcf 100644 --- a/fee-market/src/fee_market_proxy.rs +++ b/fee-market/src/fee_market_proxy.rs @@ -252,7 +252,7 @@ where #[rustfmt::skip] #[type_abi] -#[derive(TopEncode, TopDecode)] +#[derive(TopEncode, TopDecode, NestedDecode)] pub enum FeeType where Api: ManagedTypeApi, From fea1d85f51b1f8af432fc2a17295531c299ad305 Mon Sep 17 00:00:00 2001 From: Andrei Baltariu Date: Fri, 13 Sep 2024 11:10:50 +0300 Subject: [PATCH 330/523] Fee market init logic Signed-off-by: Andrei Baltariu --- fee-market/src/fee_market_proxy.rs | 8 ++++---- fee-market/src/fee_type.rs | 10 ++++++---- fee-market/src/lib.rs | 4 ++-- fee-market/wasm-fee-marker-full/src/lib.rs | 4 ++-- fee-market/wasm/src/lib.rs | 4 ++-- 5 files changed, 16 insertions(+), 14 deletions(-) diff --git a/fee-market/src/fee_market_proxy.rs b/fee-market/src/fee_market_proxy.rs index 17019fcf..edee98f9 100644 --- a/fee-market/src/fee_market_proxy.rs +++ b/fee-market/src/fee_market_proxy.rs @@ -91,7 +91,7 @@ where To: TxTo, Gas: TxGas, { - pub fn add_fee< + pub fn set_fee< Arg0: ProxyArg>, Arg1: ProxyArg>, >( @@ -107,7 +107,7 @@ where .original_result() } - pub fn remove_fee< + pub fn disable_fee< Arg0: ProxyArg>, >( self, @@ -241,7 +241,7 @@ where } #[type_abi] -#[derive(NestedDecode)] +#[derive(NestedEncode, NestedDecode)] pub struct FeeStruct where Api: ManagedTypeApi, @@ -252,7 +252,7 @@ where #[rustfmt::skip] #[type_abi] -#[derive(TopEncode, TopDecode, NestedDecode)] +#[derive(TopEncode, TopDecode, NestedEncode, NestedDecode)] pub enum FeeType where Api: ManagedTypeApi, diff --git a/fee-market/src/fee_type.rs b/fee-market/src/fee_type.rs index d8f797f6..383d87e8 100644 --- a/fee-market/src/fee_type.rs +++ b/fee-market/src/fee_type.rs @@ -1,7 +1,8 @@ multiversx_sc::imports!(); multiversx_sc::derive_imports!(); -#[derive(TypeAbi, TopEncode, TopDecode, NestedDecode)] +#[type_abi] +#[derive(TopEncode, TopDecode, NestedEncode, NestedDecode)] pub enum FeeType { None, Fixed { @@ -17,7 +18,7 @@ pub enum FeeType { } #[type_abi] -#[derive(NestedDecode)] +#[derive(NestedEncode, NestedDecode)] pub struct FeeStruct { pub base_token: TokenIdentifier, pub fee_type: FeeType, @@ -27,7 +28,7 @@ pub struct FeeStruct { pub trait FeeTypeModule: utils::UtilsModule + bls_signature::BlsSignatureModule { #[only_owner] #[endpoint(addFee)] - fn add_fee(&self, base_token: TokenIdentifier, fee_type: FeeType) { + fn set_fee(&self, base_token: TokenIdentifier, fee_type: FeeType) { self.require_valid_token_id(&base_token); let token = match &fee_type { @@ -59,8 +60,9 @@ pub trait FeeTypeModule: utils::UtilsModule + bls_signature::BlsSignatureModule #[only_owner] #[endpoint(removeFee)] - fn remove_fee(&self, base_token: TokenIdentifier) { + fn disable_fee(&self, base_token: TokenIdentifier) { self.token_fee(&base_token).clear(); + self.fee_enabled().set(false); } #[view(getTokenFee)] diff --git a/fee-market/src/lib.rs b/fee-market/src/lib.rs index 74b31fbd..a543e367 100644 --- a/fee-market/src/lib.rs +++ b/fee-market/src/lib.rs @@ -34,8 +34,8 @@ pub trait FeeMarket: .set(price_aggregator_address); match fee { - Option::Some(fee_struct) => self.add_fee(fee_struct.base_token, fee_struct.fee_type), - _ => (), + Option::Some(fee_struct) => self.set_fee(fee_struct.base_token, fee_struct.fee_type), + _ => self.fee_enabled().set(false), } } diff --git a/fee-market/wasm-fee-marker-full/src/lib.rs b/fee-market/wasm-fee-marker-full/src/lib.rs index 83964e80..8c8779dd 100644 --- a/fee-market/wasm-fee-marker-full/src/lib.rs +++ b/fee-market/wasm-fee-marker-full/src/lib.rs @@ -20,8 +20,8 @@ multiversx_sc_wasm_adapter::endpoints! { ( init => init upgrade => upgrade - addFee => add_fee - removeFee => remove_fee + addFee => set_fee + removeFee => disable_fee getTokenFee => token_fee addUsersToWhitelist => add_users_to_whitelist removeUsersFromWhitelist => remove_users_from_whitelist diff --git a/fee-market/wasm/src/lib.rs b/fee-market/wasm/src/lib.rs index 83964e80..8c8779dd 100644 --- a/fee-market/wasm/src/lib.rs +++ b/fee-market/wasm/src/lib.rs @@ -20,8 +20,8 @@ multiversx_sc_wasm_adapter::endpoints! { ( init => init upgrade => upgrade - addFee => add_fee - removeFee => remove_fee + addFee => set_fee + removeFee => disable_fee getTokenFee => token_fee addUsersToWhitelist => add_users_to_whitelist removeUsersFromWhitelist => remove_users_from_whitelist From a4332b71c09808b832d592fb9215d3d0306e37c2 Mon Sep 17 00:00:00 2001 From: Andrei Baltariu Date: Fri, 13 Sep 2024 15:15:18 +0300 Subject: [PATCH 331/523] Modified test and logic to fit new fee market fee setup Signed-off-by: Andrei Baltariu --- .../tests/enshrine_esdt_safe_blackbox_test.rs | 190 +++++++++--------- fee-market/src/fee_market_proxy.rs | 13 +- fee-market/src/fee_type.rs | 15 +- fee-market/src/lib.rs | 2 +- 4 files changed, 108 insertions(+), 112 deletions(-) diff --git a/enshrine-esdt-safe/tests/enshrine_esdt_safe_blackbox_test.rs b/enshrine-esdt-safe/tests/enshrine_esdt_safe_blackbox_test.rs index 8cbbf54c..65e1af57 100644 --- a/enshrine-esdt-safe/tests/enshrine_esdt_safe_blackbox_test.rs +++ b/enshrine-esdt-safe/tests/enshrine_esdt_safe_blackbox_test.rs @@ -1,6 +1,7 @@ use bls_signature::BlsSignature; use enshrine_esdt_safe::enshrine_esdt_safe_proxy; -use fee_market::fee_market_proxy::{self, FeeType}; +use fee_market::fee_market_proxy::{self, FeeStruct, FeeType}; +use fee_market::fee_type; use header_verifier::header_verifier_proxy; use multiversx_sc::codec::TopEncode; use multiversx_sc::imports::{MultiValue3, OptionalValue}; @@ -151,12 +152,15 @@ impl EnshrineTestState { self } - fn deploy_fee_market_contract(&mut self) -> &mut Self { + fn deploy_fee_market_contract( + &mut self, + fee_struct: Option>, + ) -> &mut Self { self.world .tx() .from(ENSHRINE_ESDT_OWNER_ADDRESS) .typed(fee_market_proxy::FeeMarketProxy) - .init(ENSHRINE_ESDT_ADDRESS, ENSHRINE_ESDT_ADDRESS) + .init(ENSHRINE_ESDT_ADDRESS, ENSHRINE_ESDT_ADDRESS, fee_struct) .code(FEE_MARKET_CODE_PATH) .new_address(FEE_MARKET_ADDRESS) .run(); @@ -194,7 +198,11 @@ impl EnshrineTestState { self } - fn propose_setup_contracts(&mut self, is_sovereign_chain: bool) -> &mut Self { + fn propose_setup_contracts( + &mut self, + is_sovereign_chain: bool, + fee_struct: Option<&FeeStruct>, + ) -> &mut Self { self.deploy_enshrine_esdt_contract( is_sovereign_chain, Some(TokenIdentifier::from(WEGLD_IDENTIFIER)), @@ -202,51 +210,21 @@ impl EnshrineTestState { ); self.deploy_header_verifier_contract(); self.deploy_token_handler_contract(); - self.deploy_fee_market_contract(); + self.deploy_fee_market_contract(fee_struct.cloned()); self.propose_set_header_verifier_address(); self.propose_register_fee_market_address(); - self.propose_disable_fee(); - - self - } - - fn propose_enable_fee(&mut self) -> &mut Self { - self.world - .tx() - .from(ENSHRINE_ESDT_OWNER_ADDRESS) - .to(FEE_MARKET_ADDRESS) - .typed(fee_market_proxy::FeeMarketProxy) - .enable_fee() - .run(); - - self - } - - fn propose_disable_fee(&mut self) -> &mut Self { - self.world - .tx() - .from(ENSHRINE_ESDT_OWNER_ADDRESS) - .to(FEE_MARKET_ADDRESS) - .typed(fee_market_proxy::FeeMarketProxy) - .disable_fee() - .run(); self } fn propose_set_fee( &mut self, - fee_token_id: Option, - fee_type: Option>, + fee_struct: Option<&FeeStruct>, error_status: Option, ) -> &mut Self { - self.propose_enable_fee(); - - match (fee_token_id, fee_type) { - (Some(token_id), Some(fee_type)) => { - self.propose_add_fee_token(token_id, fee_type, error_status) - } + match fee_struct { + Some(fee) => self.propose_add_fee_token(fee, error_status), _ => (), } @@ -407,8 +385,7 @@ impl EnshrineTestState { fn propose_add_fee_token( &mut self, - token_id: TestTokenIdentifier, - fee_type: FeeType, + fee_struct: &FeeStruct, error_status: Option, ) { match error_status { @@ -418,7 +395,7 @@ impl EnshrineTestState { .from(ENSHRINE_ESDT_OWNER_ADDRESS) .to(FEE_MARKET_ADDRESS) .typed(fee_market_proxy::FeeMarketProxy) - .add_fee(token_id, fee_type) + .set_fee(fee_struct) .returns(ExpectError(error.code, error.error_message)) .run(), None => self @@ -427,7 +404,7 @@ impl EnshrineTestState { .from(ENSHRINE_ESDT_OWNER_ADDRESS) .to(FEE_MARKET_ADDRESS) .typed(fee_market_proxy::FeeMarketProxy) - .add_fee(token_id, fee_type) + .set_fee(fee_struct) .run(), } } @@ -501,13 +478,32 @@ impl EnshrineTestState { ManagedBuffer::new_from_bytes(&sha256) } + + // TODO: add match for fee type + fn setup_fee_struct( + &mut self, + base_token: TestTokenIdentifier, + per_transfer: &BigUint, + per_gas: &BigUint, + ) -> FeeStruct { + let fee_type = FeeType::Fixed { + token: base_token.into(), + per_transfer: per_transfer.clone(), + per_gas: per_gas.clone(), + }; + + FeeStruct { + base_token: base_token.into(), + fee_type, + } + } } #[test] fn test_deploy() { let mut state = EnshrineTestState::new(); - state.propose_setup_contracts(false); + state.propose_setup_contracts(false, None); } #[test] @@ -519,7 +515,7 @@ fn test_sovereign_prefix_no_prefix() { error_message: "Operation is not registered", }); - state.propose_setup_contracts(false); + state.propose_setup_contracts(false, None); state.propose_register_operation(&token_vec); state.propose_execute_operation(error_status, &token_vec); } @@ -533,7 +529,7 @@ fn test_sovereign_prefix_has_prefix() { error_message: "Operation is not registered", }); - state.propose_setup_contracts(false); + state.propose_setup_contracts(false, None); state.propose_register_operation(&token_vec); state.propose_execute_operation(error_status, &token_vec); } @@ -547,7 +543,7 @@ fn test_register_tokens_insufficient_funds() { let payment_amount = BigUint::from(DEFAULT_ISSUE_COST * token_vec.len() as u64); let payment = EsdtTokenPayment::new(WEGLD_IDENTIFIER.into(), 0, payment_amount); - state.propose_setup_contracts(false); + state.propose_setup_contracts(false, None); state.propose_register_tokens( &USER_ADDRESS, payment, @@ -568,7 +564,7 @@ fn test_register_tokens_wrong_token_as_fee() { let payment_amount = BigUint::from(DEFAULT_ISSUE_COST * token_vec.len() as u64); let payment = EsdtTokenPayment::new(CROWD_TOKEN_ID.into(), 0, payment_amount); - state.propose_setup_contracts(false); + state.propose_setup_contracts(false, None); state.propose_register_tokens( &ENSHRINE_ESDT_OWNER_ADDRESS, payment, @@ -587,7 +583,7 @@ fn test_register_tokens() { let payment_amount = BigUint::from(DEFAULT_ISSUE_COST * token_vec.len() as u64); let payment = EsdtTokenPayment::new(WEGLD_IDENTIFIER.into(), 0, payment_amount); - state.propose_setup_contracts(false); + state.propose_setup_contracts(false, None); state.propose_register_tokens(&ENSHRINE_ESDT_OWNER_ADDRESS, payment, token_vec, None); state .world @@ -609,7 +605,7 @@ fn test_register_tokens_insufficient_wegld() { let payment_amount = BigUint::from(DEFAULT_ISSUE_COST + token_vec.len() as u64); let payment = EsdtTokenPayment::new(WEGLD_IDENTIFIER.into(), 0, payment_amount); - state.propose_setup_contracts(false); + state.propose_setup_contracts(false, None); state.propose_register_tokens( &ENSHRINE_ESDT_OWNER_ADDRESS, payment, @@ -634,8 +630,8 @@ fn test_deposit_nothing_to_transfer() { payments.push(wegld_payment); - state.propose_setup_contracts(false); - state.propose_set_fee(None, None, None); + state.propose_setup_contracts(false, None); + state.propose_set_fee(None, None); state.propose_deposit( ENSHRINE_ESDT_OWNER_ADDRESS, USER_ADDRESS, @@ -666,12 +662,13 @@ fn test_deposit_token_not_accepted_as_fee() { payments.push(wegld_payment); payments.push(crowd_payment); - state.propose_setup_contracts(false); - state.propose_set_fee( - Some(WEGLD_IDENTIFIER), - Some(fee_type), - Some(fee_market_error_status), - ); + let fee_struct = FeeStruct { + base_token: WEGLD_IDENTIFIER.into(), + fee_type, + }; + + state.propose_setup_contracts(false, Some(&fee_struct)); + state.propose_set_fee(Some(&fee_struct), Some(fee_market_error_status)); state.propose_deposit( ENSHRINE_ESDT_OWNER_ADDRESS, USER_ADDRESS, @@ -695,16 +692,16 @@ fn test_deposit_token_nothing_to_transfer_fee_enabled() { let fee_amount_per_transfer = BigUint::from(100u32); let fee_amount_per_gas = BigUint::from(100u32); - let fee_type = FeeType::Fixed { - token: WEGLD_IDENTIFIER.into(), - per_transfer: fee_amount_per_transfer, - per_gas: fee_amount_per_gas, - }; + let fee_struct = state.setup_fee_struct( + WEGLD_IDENTIFIER, + &fee_amount_per_transfer, + &fee_amount_per_gas, + ); payments.push(wegld_payment); - state.propose_setup_contracts(false); - state.propose_set_fee(Some(WEGLD_IDENTIFIER), Some(fee_type), None); + state.propose_setup_contracts(false, Some(&fee_struct)); + state.propose_set_fee(Some(&fee_struct), None); state.propose_deposit( ENSHRINE_ESDT_OWNER_ADDRESS, USER_ADDRESS, @@ -727,7 +724,7 @@ fn test_deposit_max_transfers_exceeded() { payments.extend(std::iter::repeat(wegld_payment).take(11)); - state.propose_setup_contracts(false); + state.propose_setup_contracts(false, None); state.propose_deposit( ENSHRINE_ESDT_OWNER_ADDRESS, USER_ADDRESS, @@ -756,15 +753,15 @@ fn test_deposit_no_transfer_data() { let fee_amount_per_transfer = BigUint::from(100u32); let fee_amount_per_gas = BigUint::from(100u32); - let fee_type = FeeType::Fixed { - token: WEGLD_IDENTIFIER.into(), - per_transfer: fee_amount_per_transfer.clone(), - per_gas: fee_amount_per_gas, - }; + let fee_struct = state.setup_fee_struct( + WEGLD_IDENTIFIER, + &fee_amount_per_transfer, + &fee_amount_per_gas, + ); - state.propose_setup_contracts(false); + state.propose_setup_contracts(false, Some(&fee_struct)); state.propose_add_token_to_whitelist(tokens_whitelist); - state.propose_set_fee(Some(WEGLD_IDENTIFIER), Some(fee_type), None); + state.propose_set_fee(Some(&fee_struct), None); state.propose_deposit( ENSHRINE_ESDT_OWNER_ADDRESS, USER_ADDRESS, @@ -815,7 +812,7 @@ fn test_deposit_with_transfer_data_gas_limit_too_high() { error_message: "Gas limit too high", }; - state.propose_setup_contracts(false); + state.propose_setup_contracts(false, None); state.propose_deposit( ENSHRINE_ESDT_OWNER_ADDRESS, USER_ADDRESS, @@ -848,7 +845,8 @@ fn test_deposit_with_transfer_data_banned_endpoint() { error_message: "Banned endpoint name", }; - state.propose_setup_contracts(false); + // TODO: idk if it supposed to be None + state.propose_setup_contracts(false, None); state.propose_set_max_user_tx_gas_limit(gas_limit); state.propose_set_banned_endpoint(function); state.propose_deposit( @@ -886,15 +884,15 @@ fn test_deposit_with_transfer_data_enough_for_fee() { let fee_amount_per_transfer = BigUint::from(100u32); let fee_amount_per_gas = BigUint::from(100u32); - let fee_type = FeeType::Fixed { - token: WEGLD_IDENTIFIER.into(), - per_transfer: fee_amount_per_transfer.clone(), - per_gas: fee_amount_per_gas.clone(), - }; + let fee_struct = state.setup_fee_struct( + WEGLD_IDENTIFIER, + &fee_amount_per_transfer, + &fee_amount_per_gas, + ); - state.propose_setup_contracts(false); + state.propose_setup_contracts(false, Some(&fee_struct)); state.propose_set_max_user_tx_gas_limit(gas_limit); - state.propose_set_fee(Some(WEGLD_IDENTIFIER), Some(fee_type), None); + state.propose_set_fee(Some(&fee_struct), None); state.propose_deposit( ENSHRINE_ESDT_OWNER_ADDRESS, USER_ADDRESS, @@ -951,15 +949,15 @@ fn test_deposit_with_transfer_data_not_enough_for_fee() { let fee_amount_per_transfer = BigUint::from(100u32); let fee_amount_per_gas = BigUint::from(100u32); - let fee_type = FeeType::Fixed { - token: WEGLD_IDENTIFIER.into(), - per_transfer: fee_amount_per_transfer.clone(), - per_gas: fee_amount_per_gas, - }; + let fee_struct = state.setup_fee_struct( + WEGLD_IDENTIFIER, + &fee_amount_per_transfer, + &fee_amount_per_gas, + ); - state.propose_setup_contracts(false); + state.propose_setup_contracts(false, Some(&fee_struct)); state.propose_set_max_user_tx_gas_limit(gas_limit); - state.propose_set_fee(Some(WEGLD_IDENTIFIER), Some(fee_type), None); + state.propose_set_fee(Some(&fee_struct), None); state.propose_deposit( ENSHRINE_ESDT_OWNER_ADDRESS, USER_ADDRESS, @@ -984,7 +982,7 @@ fn test_deposit_refund_non_whitelisted_tokens_fee_disabled() { payments.push(fungible_payment); payments.push(crowd_payment); - state.propose_setup_contracts(false); + state.propose_setup_contracts(false, None); state.propose_add_token_to_whitelist(token_whitelist); state.propose_deposit( ENSHRINE_ESDT_OWNER_ADDRESS, @@ -1025,15 +1023,15 @@ fn test_deposit_refund_non_whitelisted_tokens_fee_enabled() { let fee_amount_per_transfer = BigUint::from(100u32); let fee_amount_per_gas = BigUint::from(100u32); - let fee_type = FeeType::Fixed { - token: WEGLD_IDENTIFIER.into(), - per_transfer: fee_amount_per_transfer, - per_gas: fee_amount_per_gas, - }; + let fee_struct = state.setup_fee_struct( + WEGLD_IDENTIFIER, + &fee_amount_per_transfer, + &fee_amount_per_gas, + ); - state.propose_setup_contracts(false); - state.propose_set_fee(Some(WEGLD_IDENTIFIER), Some(fee_type), None); + state.propose_setup_contracts(false, Some(&fee_struct)); state.propose_add_token_to_whitelist(token_whitelist); + state.propose_set_fee(Some(&fee_struct), None); state.propose_deposit( ENSHRINE_ESDT_OWNER_ADDRESS, USER_ADDRESS, diff --git a/fee-market/src/fee_market_proxy.rs b/fee-market/src/fee_market_proxy.rs index edee98f9..b595c0f6 100644 --- a/fee-market/src/fee_market_proxy.rs +++ b/fee-market/src/fee_market_proxy.rs @@ -92,18 +92,15 @@ where Gas: TxGas, { pub fn set_fee< - Arg0: ProxyArg>, - Arg1: ProxyArg>, + Arg0: ProxyArg>, >( self, - base_token: Arg0, - fee_type: Arg1, + fee_struct: Arg0, ) -> TxTypedCall { self.wrapped_tx .payment(NotPayable) .raw_call("addFee") - .argument(&base_token) - .argument(&fee_type) + .argument(&fee_struct) .original_result() } @@ -241,7 +238,7 @@ where } #[type_abi] -#[derive(NestedEncode, NestedDecode)] +#[derive(TopDecode, TopEncode, NestedEncode, NestedDecode, Clone)] pub struct FeeStruct where Api: ManagedTypeApi, @@ -252,7 +249,7 @@ where #[rustfmt::skip] #[type_abi] -#[derive(TopEncode, TopDecode, NestedEncode, NestedDecode)] +#[derive(TopEncode, TopDecode, NestedEncode, NestedDecode, Clone)] pub enum FeeType where Api: ManagedTypeApi, diff --git a/fee-market/src/fee_type.rs b/fee-market/src/fee_type.rs index 383d87e8..9621d436 100644 --- a/fee-market/src/fee_type.rs +++ b/fee-market/src/fee_type.rs @@ -2,7 +2,7 @@ multiversx_sc::imports!(); multiversx_sc::derive_imports!(); #[type_abi] -#[derive(TopEncode, TopDecode, NestedEncode, NestedDecode)] +#[derive(TopEncode, TopDecode, NestedEncode, NestedDecode, Clone)] pub enum FeeType { None, Fixed { @@ -18,7 +18,7 @@ pub enum FeeType { } #[type_abi] -#[derive(NestedEncode, NestedDecode)] +#[derive(TopDecode, TopEncode, NestedEncode, NestedDecode, Clone)] pub struct FeeStruct { pub base_token: TokenIdentifier, pub fee_type: FeeType, @@ -28,17 +28,17 @@ pub struct FeeStruct { pub trait FeeTypeModule: utils::UtilsModule + bls_signature::BlsSignatureModule { #[only_owner] #[endpoint(addFee)] - fn set_fee(&self, base_token: TokenIdentifier, fee_type: FeeType) { - self.require_valid_token_id(&base_token); + fn set_fee(&self, fee_struct: FeeStruct) { + self.require_valid_token_id(&fee_struct.base_token); - let token = match &fee_type { + let token = match &fee_struct.fee_type { FeeType::None => sc_panic!("Invalid fee type"), FeeType::Fixed { token, per_transfer: _, per_gas: _, } => { - require!(&base_token == token, "Invalid fee"); + require!(&fee_struct.base_token == token, "Invalid fee"); token } @@ -51,7 +51,8 @@ pub trait FeeTypeModule: utils::UtilsModule + bls_signature::BlsSignatureModule self.require_valid_token_id(token); self.fee_enabled().set(true); - self.token_fee(&base_token).set(fee_type); + self.token_fee(&fee_struct.base_token) + .set(fee_struct.fee_type); } fn is_fee_enabled(&self) -> bool { diff --git a/fee-market/src/lib.rs b/fee-market/src/lib.rs index a543e367..5d958115 100644 --- a/fee-market/src/lib.rs +++ b/fee-market/src/lib.rs @@ -34,7 +34,7 @@ pub trait FeeMarket: .set(price_aggregator_address); match fee { - Option::Some(fee_struct) => self.set_fee(fee_struct.base_token, fee_struct.fee_type), + Some(fee_struct) => self.set_fee(fee_struct), _ => self.fee_enabled().set(false), } } From a11daeabd08b8edd738188b5df5a563f5eedac0c Mon Sep 17 00:00:00 2001 From: Andrei Baltariu Date: Sat, 14 Sep 2024 13:51:43 +0300 Subject: [PATCH 332/523] Fixed tests and setup to fit new fee market logic Signed-off-by: Andrei Baltariu --- .../tests/enshrine_esdt_safe_blackbox_test.rs | 75 +++++++++++++------ 1 file changed, 52 insertions(+), 23 deletions(-) diff --git a/enshrine-esdt-safe/tests/enshrine_esdt_safe_blackbox_test.rs b/enshrine-esdt-safe/tests/enshrine_esdt_safe_blackbox_test.rs index 65e1af57..6ead5cb5 100644 --- a/enshrine-esdt-safe/tests/enshrine_esdt_safe_blackbox_test.rs +++ b/enshrine-esdt-safe/tests/enshrine_esdt_safe_blackbox_test.rs @@ -1,7 +1,6 @@ use bls_signature::BlsSignature; use enshrine_esdt_safe::enshrine_esdt_safe_proxy; use fee_market::fee_market_proxy::{self, FeeStruct, FeeType}; -use fee_market::fee_type; use header_verifier::header_verifier_proxy; use multiversx_sc::codec::TopEncode; use multiversx_sc::imports::{MultiValue3, OptionalValue}; @@ -154,16 +153,30 @@ impl EnshrineTestState { fn deploy_fee_market_contract( &mut self, + fee_market_error_status: Option<&ErrorStatus>, fee_struct: Option>, ) -> &mut Self { - self.world - .tx() - .from(ENSHRINE_ESDT_OWNER_ADDRESS) - .typed(fee_market_proxy::FeeMarketProxy) - .init(ENSHRINE_ESDT_ADDRESS, ENSHRINE_ESDT_ADDRESS, fee_struct) - .code(FEE_MARKET_CODE_PATH) - .new_address(FEE_MARKET_ADDRESS) - .run(); + match fee_market_error_status { + Some(error_status) => self + .world + .tx() + .from(ENSHRINE_ESDT_OWNER_ADDRESS) + .typed(fee_market_proxy::FeeMarketProxy) + .init(ENSHRINE_ESDT_ADDRESS, ENSHRINE_ESDT_ADDRESS, fee_struct) + .code(FEE_MARKET_CODE_PATH) + .new_address(FEE_MARKET_ADDRESS) + .returns(ExpectError(error_status.code, error_status.error_message)) + .run(), + None => self + .world + .tx() + .from(ENSHRINE_ESDT_OWNER_ADDRESS) + .typed(fee_market_proxy::FeeMarketProxy) + .init(ENSHRINE_ESDT_ADDRESS, ENSHRINE_ESDT_ADDRESS, fee_struct) + .code(FEE_MARKET_CODE_PATH) + .new_address(FEE_MARKET_ADDRESS) + .run(), + } self } @@ -210,7 +223,7 @@ impl EnshrineTestState { ); self.deploy_header_verifier_contract(); self.deploy_token_handler_contract(); - self.deploy_fee_market_contract(fee_struct.cloned()); + self.deploy_fee_market_contract(None, fee_struct.cloned()); self.propose_set_header_verifier_address(); self.propose_register_fee_market_address(); @@ -218,6 +231,26 @@ impl EnshrineTestState { self } + fn propose_setup_contracts_with_fee_market_error( + &mut self, + is_sovereign_chain: bool, + fee_market_error_status: &ErrorStatus, + fee_struct: Option<&FeeStruct>, + ) -> &mut Self { + self.deploy_enshrine_esdt_contract( + is_sovereign_chain, + Some(TokenIdentifier::from(WEGLD_IDENTIFIER)), + Some(SOVEREIGN_TOKEN_PREFIX.into()), + ); + self.deploy_header_verifier_contract(); + self.deploy_token_handler_contract(); + self.deploy_fee_market_contract(Some(fee_market_error_status), fee_struct.cloned()); + + self.propose_set_header_verifier_address(); + self.propose_register_fee_market_address(); + + self + } fn propose_set_fee( &mut self, fee_struct: Option<&FeeStruct>, @@ -618,15 +651,11 @@ fn test_register_tokens_insufficient_wegld() { } #[test] -fn test_deposit_nothing_to_transfer() { +fn test_deposit_no_fee() { let mut state = EnshrineTestState::new(); let amount = BigUint::from(10000u64); let wegld_payment = EsdtTokenPayment::new(WEGLD_IDENTIFIER.into(), 0, amount.clone()); let mut payments = PaymentsVec::new(); - let error_status = ErrorStatus { - code: 4, - error_message: "Nothing to transfer", - }; payments.push(wegld_payment); @@ -637,12 +666,12 @@ fn test_deposit_nothing_to_transfer() { USER_ADDRESS, payments, OptionalValue::None, - Some(error_status), + None, ); } #[test] -fn test_deposit_token_not_accepted_as_fee() { +fn test_deposit_invalid_fee_type() { let mut state = EnshrineTestState::new(); let amount = BigUint::from(10000u64); let wegld_payment = EsdtTokenPayment::new(WEGLD_IDENTIFIER.into(), 0, amount.clone()); @@ -652,10 +681,6 @@ fn test_deposit_token_not_accepted_as_fee() { code: 4, error_message: "Invalid fee type", }; - let deposit_error_status = ErrorStatus { - code: 4, - error_message: "Token not accepted as fee", - }; let fee_type = FeeType::None; @@ -667,14 +692,18 @@ fn test_deposit_token_not_accepted_as_fee() { fee_type, }; - state.propose_setup_contracts(false, Some(&fee_struct)); + state.propose_setup_contracts_with_fee_market_error( + false, + &fee_market_error_status, + Some(&fee_struct), + ); state.propose_set_fee(Some(&fee_struct), Some(fee_market_error_status)); state.propose_deposit( ENSHRINE_ESDT_OWNER_ADDRESS, USER_ADDRESS, payments, OptionalValue::None, - Some(deposit_error_status), + None, ); } From e5ef254b30ea1e3d5f4cb40642bbc641bbf237a0 Mon Sep 17 00:00:00 2001 From: Andrei Baltariu Date: Mon, 16 Sep 2024 10:19:09 +0300 Subject: [PATCH 333/523] Added check of zero payments Signed-off-by: Andrei Baltariu --- enshrine-esdt-safe/src/to_sovereign/create_tx.rs | 4 ++++ fee-market/src/subtract_fee.rs | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/enshrine-esdt-safe/src/to_sovereign/create_tx.rs b/enshrine-esdt-safe/src/to_sovereign/create_tx.rs index 94d26721..55c0d8be 100644 --- a/enshrine-esdt-safe/src/to_sovereign/create_tx.rs +++ b/enshrine-esdt-safe/src/to_sovereign/create_tx.rs @@ -130,6 +130,10 @@ pub trait CreateTxModule: refundable_payments: &ManagedVec, ) { for payment in refundable_payments { + require!( + payment.amount > BigUint::from(0u32), + "Refundable payment is zero" + ); self.tx().to(caller).payment(&payment).transfer(); } } diff --git a/fee-market/src/subtract_fee.rs b/fee-market/src/subtract_fee.rs index 3a4fa2c9..112c0393 100644 --- a/fee-market/src/subtract_fee.rs +++ b/fee-market/src/subtract_fee.rs @@ -130,6 +130,10 @@ pub trait SubtractFeeModule: self.accumulated_fees(&final_payment.fee.token_identifier) .update(|amt| *amt += &final_payment.fee.amount); + require!( + final_payment.remaining_tokens.amount > BigUint::from(0u32), + "Refundable payment is zero" + ); self.tx() .to(&original_caller) .payment(&final_payment.remaining_tokens) From 07fb931743fedd0c851ca7a540fd13e64919dcf7 Mon Sep 17 00:00:00 2001 From: Andrei Baltariu Date: Mon, 16 Sep 2024 10:37:34 +0300 Subject: [PATCH 334/523] Added ToSelf instead of ToCaller Signed-off-by: Andrei Baltariu --- enshrine-esdt-safe/src/to_sovereign/create_tx.rs | 2 +- esdt-safe/src/to_sovereign/create_tx.rs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/enshrine-esdt-safe/src/to_sovereign/create_tx.rs b/enshrine-esdt-safe/src/to_sovereign/create_tx.rs index 55c0d8be..4dfa1e1d 100644 --- a/enshrine-esdt-safe/src/to_sovereign/create_tx.rs +++ b/enshrine-esdt-safe/src/to_sovereign/create_tx.rs @@ -64,7 +64,7 @@ pub trait CreateTxModule: if is_sov_chain || self.has_prefix(&payment.token_identifier) { self.tx() - .to(ToCaller) + .to(ToSelf) .typed(ESDTSystemSCProxy) .burn(&payment.token_identifier, &payment.amount) .transfer_execute(); diff --git a/esdt-safe/src/to_sovereign/create_tx.rs b/esdt-safe/src/to_sovereign/create_tx.rs index 9779525d..1cec773c 100644 --- a/esdt-safe/src/to_sovereign/create_tx.rs +++ b/esdt-safe/src/to_sovereign/create_tx.rs @@ -71,7 +71,7 @@ pub trait CreateTxModule: if self.is_sovereign_chain().get() { self.tx() - .to(ToCaller) + .to(ToSelf) .typed(ESDTSystemSCProxy) .burn(&payment.token_identifier, &payment.amount) .transfer_execute(); From 95885cc2f10fff1c9d9561e1a01d4855fd2064d1 Mon Sep 17 00:00:00 2001 From: Andrei Baltariu Date: Mon, 16 Sep 2024 10:51:51 +0300 Subject: [PATCH 335/523] Modified refundable amount check Signed-off-by: Andrei Baltariu --- enshrine-esdt-safe/src/to_sovereign/create_tx.rs | 8 +++----- esdt-safe/src/to_sovereign/create_tx.rs | 4 +++- fee-market/src/subtract_fee.rs | 14 ++++++-------- 3 files changed, 12 insertions(+), 14 deletions(-) diff --git a/enshrine-esdt-safe/src/to_sovereign/create_tx.rs b/enshrine-esdt-safe/src/to_sovereign/create_tx.rs index 4dfa1e1d..80d7916a 100644 --- a/enshrine-esdt-safe/src/to_sovereign/create_tx.rs +++ b/enshrine-esdt-safe/src/to_sovereign/create_tx.rs @@ -130,11 +130,9 @@ pub trait CreateTxModule: refundable_payments: &ManagedVec, ) { for payment in refundable_payments { - require!( - payment.amount > BigUint::from(0u32), - "Refundable payment is zero" - ); - self.tx().to(caller).payment(&payment).transfer(); + if payment.amount > 0 { + self.tx().to(caller).payment(&payment).transfer(); + } } } diff --git a/esdt-safe/src/to_sovereign/create_tx.rs b/esdt-safe/src/to_sovereign/create_tx.rs index 1cec773c..0b1adb80 100644 --- a/esdt-safe/src/to_sovereign/create_tx.rs +++ b/esdt-safe/src/to_sovereign/create_tx.rs @@ -112,7 +112,9 @@ pub trait CreateTxModule: // refund refundable_tokens for payment in &refundable_payments { - self.tx().to(&caller).payment(payment).transfer(); + if payment.amount > 0 { + self.tx().to(&caller).payment(payment).transfer(); + } } let tx_nonce = self.get_and_save_next_tx_id(); diff --git a/fee-market/src/subtract_fee.rs b/fee-market/src/subtract_fee.rs index 112c0393..db5e440f 100644 --- a/fee-market/src/subtract_fee.rs +++ b/fee-market/src/subtract_fee.rs @@ -130,14 +130,12 @@ pub trait SubtractFeeModule: self.accumulated_fees(&final_payment.fee.token_identifier) .update(|amt| *amt += &final_payment.fee.amount); - require!( - final_payment.remaining_tokens.amount > BigUint::from(0u32), - "Refundable payment is zero" - ); - self.tx() - .to(&original_caller) - .payment(&final_payment.remaining_tokens) - .transfer(); + if final_payment.remaining_tokens.amount > 0 { + self.tx() + .to(&original_caller) + .payment(&final_payment.remaining_tokens) + .transfer(); + } final_payment } From 8d5177ce95a7586fd524691611dee20f5ec7723f Mon Sep 17 00:00:00 2001 From: Andrei Baltariu Date: Tue, 17 Sep 2024 13:45:36 +0300 Subject: [PATCH 336/523] Removed fee market specific test Signed-off-by: Andrei Baltariu --- .../tests/enshrine_esdt_safe_blackbox_test.rs | 70 ------------------- 1 file changed, 70 deletions(-) diff --git a/enshrine-esdt-safe/tests/enshrine_esdt_safe_blackbox_test.rs b/enshrine-esdt-safe/tests/enshrine_esdt_safe_blackbox_test.rs index 6ead5cb5..0303e1d2 100644 --- a/enshrine-esdt-safe/tests/enshrine_esdt_safe_blackbox_test.rs +++ b/enshrine-esdt-safe/tests/enshrine_esdt_safe_blackbox_test.rs @@ -231,39 +231,6 @@ impl EnshrineTestState { self } - fn propose_setup_contracts_with_fee_market_error( - &mut self, - is_sovereign_chain: bool, - fee_market_error_status: &ErrorStatus, - fee_struct: Option<&FeeStruct>, - ) -> &mut Self { - self.deploy_enshrine_esdt_contract( - is_sovereign_chain, - Some(TokenIdentifier::from(WEGLD_IDENTIFIER)), - Some(SOVEREIGN_TOKEN_PREFIX.into()), - ); - self.deploy_header_verifier_contract(); - self.deploy_token_handler_contract(); - self.deploy_fee_market_contract(Some(fee_market_error_status), fee_struct.cloned()); - - self.propose_set_header_verifier_address(); - self.propose_register_fee_market_address(); - - self - } - fn propose_set_fee( - &mut self, - fee_struct: Option<&FeeStruct>, - error_status: Option, - ) -> &mut Self { - match fee_struct { - Some(fee) => self.propose_add_fee_token(fee, error_status), - _ => (), - } - - self - } - fn propose_execute_operation( &mut self, error_status: Option, @@ -670,43 +637,6 @@ fn test_deposit_no_fee() { ); } -#[test] -fn test_deposit_invalid_fee_type() { - let mut state = EnshrineTestState::new(); - let amount = BigUint::from(10000u64); - let wegld_payment = EsdtTokenPayment::new(WEGLD_IDENTIFIER.into(), 0, amount.clone()); - let crowd_payment = EsdtTokenPayment::new(CROWD_TOKEN_ID.into(), 0, amount.clone()); - let mut payments = PaymentsVec::new(); - let fee_market_error_status = ErrorStatus { - code: 4, - error_message: "Invalid fee type", - }; - - let fee_type = FeeType::None; - - payments.push(wegld_payment); - payments.push(crowd_payment); - - let fee_struct = FeeStruct { - base_token: WEGLD_IDENTIFIER.into(), - fee_type, - }; - - state.propose_setup_contracts_with_fee_market_error( - false, - &fee_market_error_status, - Some(&fee_struct), - ); - state.propose_set_fee(Some(&fee_struct), Some(fee_market_error_status)); - state.propose_deposit( - ENSHRINE_ESDT_OWNER_ADDRESS, - USER_ADDRESS, - payments, - OptionalValue::None, - None, - ); -} - #[test] fn test_deposit_token_nothing_to_transfer_fee_enabled() { let mut state = EnshrineTestState::new(); From cfbbce16f6f975a057a4a5ca1a52654d46a79487 Mon Sep 17 00:00:00 2001 From: Andrei Baltariu Date: Tue, 17 Sep 2024 13:57:02 +0300 Subject: [PATCH 337/523] Reverted delete Signed-off-by: Andrei Baltariu --- .../tests/enshrine_esdt_safe_blackbox_test.rs | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/enshrine-esdt-safe/tests/enshrine_esdt_safe_blackbox_test.rs b/enshrine-esdt-safe/tests/enshrine_esdt_safe_blackbox_test.rs index 0303e1d2..70fd1e7f 100644 --- a/enshrine-esdt-safe/tests/enshrine_esdt_safe_blackbox_test.rs +++ b/enshrine-esdt-safe/tests/enshrine_esdt_safe_blackbox_test.rs @@ -231,6 +231,19 @@ impl EnshrineTestState { self } + fn propose_set_fee( + &mut self, + fee_struct: Option<&FeeStruct>, + error_status: Option, + ) -> &mut Self { + match fee_struct { + Some(fee) => self.propose_add_fee_token(fee, error_status), + _ => (), + } + + self + } + fn propose_execute_operation( &mut self, error_status: Option, From 908b18a8e3af746c2c472770c472267f578439c8 Mon Sep 17 00:00:00 2001 From: Andrei Baltariu Date: Tue, 17 Sep 2024 14:08:24 +0300 Subject: [PATCH 338/523] Removed error match on fee market deploy Signed-off-by: Andrei Baltariu --- .../tests/enshrine_esdt_safe_blackbox_test.rs | 32 ++++++------------- 1 file changed, 9 insertions(+), 23 deletions(-) diff --git a/enshrine-esdt-safe/tests/enshrine_esdt_safe_blackbox_test.rs b/enshrine-esdt-safe/tests/enshrine_esdt_safe_blackbox_test.rs index 70fd1e7f..5a91bb0d 100644 --- a/enshrine-esdt-safe/tests/enshrine_esdt_safe_blackbox_test.rs +++ b/enshrine-esdt-safe/tests/enshrine_esdt_safe_blackbox_test.rs @@ -153,30 +153,16 @@ impl EnshrineTestState { fn deploy_fee_market_contract( &mut self, - fee_market_error_status: Option<&ErrorStatus>, fee_struct: Option>, ) -> &mut Self { - match fee_market_error_status { - Some(error_status) => self - .world - .tx() - .from(ENSHRINE_ESDT_OWNER_ADDRESS) - .typed(fee_market_proxy::FeeMarketProxy) - .init(ENSHRINE_ESDT_ADDRESS, ENSHRINE_ESDT_ADDRESS, fee_struct) - .code(FEE_MARKET_CODE_PATH) - .new_address(FEE_MARKET_ADDRESS) - .returns(ExpectError(error_status.code, error_status.error_message)) - .run(), - None => self - .world - .tx() - .from(ENSHRINE_ESDT_OWNER_ADDRESS) - .typed(fee_market_proxy::FeeMarketProxy) - .init(ENSHRINE_ESDT_ADDRESS, ENSHRINE_ESDT_ADDRESS, fee_struct) - .code(FEE_MARKET_CODE_PATH) - .new_address(FEE_MARKET_ADDRESS) - .run(), - } + self.world + .tx() + .from(ENSHRINE_ESDT_OWNER_ADDRESS) + .typed(fee_market_proxy::FeeMarketProxy) + .init(ENSHRINE_ESDT_ADDRESS, ENSHRINE_ESDT_ADDRESS, fee_struct) + .code(FEE_MARKET_CODE_PATH) + .new_address(FEE_MARKET_ADDRESS) + .run(); self } @@ -223,7 +209,7 @@ impl EnshrineTestState { ); self.deploy_header_verifier_contract(); self.deploy_token_handler_contract(); - self.deploy_fee_market_contract(None, fee_struct.cloned()); + self.deploy_fee_market_contract(fee_struct.cloned()); self.propose_set_header_verifier_address(); self.propose_register_fee_market_address(); From e2358dc52ecced5b7d48dd2a12dc3c9cca393393 Mon Sep 17 00:00:00 2001 From: Andrei Baltariu Date: Tue, 17 Sep 2024 16:31:18 +0300 Subject: [PATCH 339/523] Fixed failing esdt safe tests Signed-off-by: Andrei Baltariu --- esdt-safe/tests/bridge_blackbox_tests.rs | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/esdt-safe/tests/bridge_blackbox_tests.rs b/esdt-safe/tests/bridge_blackbox_tests.rs index c79b58c6..8070007d 100644 --- a/esdt-safe/tests/bridge_blackbox_tests.rs +++ b/esdt-safe/tests/bridge_blackbox_tests.rs @@ -1,6 +1,6 @@ use bls_signature::BlsSignature; use esdt_safe::esdt_safe_proxy::{self}; -use fee_market::fee_market_proxy::{self, FeeType}; +use fee_market::fee_market_proxy::{self, FeeStruct, FeeType}; use header_verifier::header_verifier_proxy; use multiversx_sc::codec::TopEncode; use multiversx_sc::types::{ @@ -98,11 +98,13 @@ impl BridgeTestState { } fn deploy_fee_market_contract(&mut self) -> &mut Self { + let fee_struct: Option> = None; + self.world .tx() .from(BRIDGE_OWNER_ADDRESS) .typed(fee_market_proxy::FeeMarketProxy) - .init(BRIDGE_ADDRESS, PRICE_AGGREGATOR_ADDRESS) + .init(BRIDGE_ADDRESS, PRICE_AGGREGATOR_ADDRESS, fee_struct) .code(FEE_MARKET_CODE_PATH) .new_address(FEE_MARKET_ADDRESS) .run(); @@ -176,12 +178,17 @@ impl BridgeTestState { let fee_token_identifier: TokenIdentifier = TokenIdentifier::from(token_identifier); + let fee_struct = FeeStruct { + base_token: fee_token_identifier, + fee_type, + }; + self.world .tx() .from(BRIDGE_OWNER_ADDRESS) .to(FEE_MARKET_ADDRESS) .typed(fee_market_proxy::FeeMarketProxy) - .add_fee(fee_token_identifier, fee_type) + .set_fee(fee_struct) .run(); } From 54a0df09b1794f59cbb2cd08af452db58be98388 Mon Sep 17 00:00:00 2001 From: Andrei Baltariu Date: Sun, 29 Sep 2024 16:44:57 +0300 Subject: [PATCH 340/523] Updated test setup for header verifier Signed-off-by: Andrei Baltariu --- .../tests/header_verifier_blackbox_test.rs | 125 ++++++------------ 1 file changed, 37 insertions(+), 88 deletions(-) diff --git a/header-verifier/tests/header_verifier_blackbox_test.rs b/header-verifier/tests/header_verifier_blackbox_test.rs index 7b255b5c..82463c1f 100644 --- a/header-verifier/tests/header_verifier_blackbox_test.rs +++ b/header-verifier/tests/header_verifier_blackbox_test.rs @@ -1,125 +1,74 @@ -#![allow(deprecated)] - use bls_signature::BlsSignature; -use header_verifier::ProxyTrait; -use multiversx_sc::types::{ManagedBuffer, ManagedByteArray, MultiValueEncoded}; +use header_verifier::header_verifier_proxy; +use multiversx_sc::types::{ + BigUint, ManagedBuffer, ManagedByteArray, ManagedVec, MultiValueEncoded, TestAddress, + TestSCAddress, +}; use multiversx_sc_scenario::{ api::StaticApi, - scenario_model::{Account, ScCallStep, ScDeployStep, SetStateStep, TxExpect}, - ContractInfo, ScenarioWorld, + imports::MxscPath, + scenario_model::{ScCallStep, ScDeployStep, TxExpect}, + ContractInfo, ScenarioTxRun, ScenarioWorld, }; -const HEADER_VERIFIER_PATH_EXPR: &str = "file:output/header-verifier.wasm"; -const OWNER_ADDRESS_EXPR: &str = "address:owner"; -const LEADER_ADDRESS_EXPR: &str = "address:proposer"; -const VALIDATOR_ADDRESS_EXPR: &str = "address:board-member"; -const HEADER_VERIFIER_ADDRESS_EXPR: &str = "sc:header_verifier"; +const HEADER_VERIFIER_CODE_PATH: MxscPath = MxscPath::new("ouput/header-verifier.mxsc-json"); +const HEADER_VERIFIER_ADDRESS: TestSCAddress = TestSCAddress::new("header-verifier"); +const OWNER: TestAddress = TestAddress::new("owner"); +const LEADER: TestAddress = TestAddress::new("leader"); +const VALIDATOR: TestAddress = TestAddress::new("validator"); +const WEGLD_BALANCE: u128 = 100_000_000_000_000_000; type HeaderVerifierContract = ContractInfo>; +type BlsKeys = MultiValueEncoded>; fn world() -> ScenarioWorld { let mut blockchain = ScenarioWorld::new(); - blockchain.set_current_dir_from_workspace("header-verifier/src/lib"); - - blockchain.register_contract(HEADER_VERIFIER_PATH_EXPR, header_verifier::ContractBuilder); + blockchain.register_contract(HEADER_VERIFIER_CODE_PATH, header_verifier::ContractBuilder); blockchain } struct HeaderVerifierTestState { world: ScenarioWorld, - header_verifier_contract: HeaderVerifierContract, } impl HeaderVerifierTestState { fn new() -> Self { let mut world = world(); - world.set_state_step( - SetStateStep::new() - .put_account(OWNER_ADDRESS_EXPR, Account::new().nonce(1)) - .new_address(OWNER_ADDRESS_EXPR, 1, HEADER_VERIFIER_ADDRESS_EXPR) - .put_account( - LEADER_ADDRESS_EXPR, - Account::new().nonce(1).balance(LEADER_ADDRESS_EXPR), - ) - .put_account(VALIDATOR_ADDRESS_EXPR, Account::new().nonce(1)), - ); - - let header_verifier_contract = HeaderVerifierContract::new(HEADER_VERIFIER_ADDRESS_EXPR); + world + .account(OWNER) + .balance(BigUint::from(WEGLD_BALANCE)) + .nonce(1); - Self { - world, - header_verifier_contract, - } + Self { world } } - fn deploy_header_verifier_contract(&mut self) -> &mut Self { - let header_verifier_code = self.world.code_expression(HEADER_VERIFIER_PATH_EXPR); - - self.world.sc_deploy( - ScDeployStep::new() - .from(OWNER_ADDRESS_EXPR) - .code(header_verifier_code), - ); + fn deploy_header_verifier_contract(&mut self, bls_keys: BlsKeys) -> &mut Self { + self.world + .tx() + .from(OWNER) + .typed(header_verifier_proxy::HeaderverifierProxy) + .init(bls_keys) + .code(HEADER_VERIFIER_CODE_PATH) + .new_address(HEADER_VERIFIER_ADDRESS) + .run(); self } - fn _propose_register_bridge_ops( - &mut self, - bridge_operations_hash: &ManagedBuffer, - operations_hashes: MultiValueEncoded>, - signature: &BlsSignature, - ) { - self.world - .sc_call_get_result(ScCallStep::new().from(LEADER_ADDRESS_EXPR).call( - self.header_verifier_contract.register_bridge_operations( - signature, - bridge_operations_hash, - operations_hashes, - ), - )) + fn get_bls_keys(&mut self, bls_keys_vec: Vec>) -> BlsKeys { + let bls_keys = bls_keys_vec.iter().map(|key| key.clone().into()).collect(); + + bls_keys } } #[test] fn test_deploy() { let mut state = HeaderVerifierTestState::new(); - state.deploy_header_verifier_contract(); -} - -#[test] -fn test_register_bridge_ops_wrong_hashes() { - let mut state = HeaderVerifierTestState::new(); - state.deploy_header_verifier_contract(); - - let bridge_operations_hash = - ManagedBuffer::from("6ee1e00813a74f8293d2c63172c062d38bf780d8811ff63984813a49cd61ff9e"); - let mock_signature: BlsSignature = ManagedByteArray::new_from_bytes( - b"EIZ2\x05\xf7q\xc7G\x96\x1f\xba0\xe2\xd1\xf5pE\x14\xd7?\xac\xff\x8d\x1a\x0c\x11\x900f5\xfb\xff4\x94\xb8@\xc5^\xc2,exn0\xe3\xf0\n" - ); - - let first_operation: ManagedBuffer = - ManagedBuffer::from("95cdb166d6e12a8c4a783a48d2e4f647e15fac4e5a115d4483f95881630a5433"); - let second_operation = - ManagedBuffer::from("4851cd6e4a4799ad0d8e8ead37c88d930874302ab11edcc60f608654be14b2ed"); - - let mut bridge_operations: MultiValueEncoded> = - MultiValueEncoded::new(); - bridge_operations.push(first_operation); - bridge_operations.push(second_operation); + let bls_key_1 = ManagedBuffer::from("bls_key_1"); + let managed_bls_keys = state.get_bls_keys(vec![bls_key_1]); - state.world.sc_call( - ScCallStep::new() - .from(OWNER_ADDRESS_EXPR) - .call(state.header_verifier_contract.register_bridge_operations( - mock_signature, - bridge_operations_hash, - bridge_operations, - )) - .expect(TxExpect::user_error( - "str:Hash of all operations doesn't match the hash of transfer data", - )), - ); + state.deploy_header_verifier_contract(managed_bls_keys); } From 587c4fd1576f40eba23147066d73d0b2f47601f4 Mon Sep 17 00:00:00 2001 From: Andrei Baltariu Date: Sun, 29 Sep 2024 16:45:50 +0300 Subject: [PATCH 341/523] Removed unused imports Signed-off-by: Andrei Baltariu --- .../tests/header_verifier_blackbox_test.rs | 14 ++------------ 1 file changed, 2 insertions(+), 12 deletions(-) diff --git a/header-verifier/tests/header_verifier_blackbox_test.rs b/header-verifier/tests/header_verifier_blackbox_test.rs index 82463c1f..020031f4 100644 --- a/header-verifier/tests/header_verifier_blackbox_test.rs +++ b/header-verifier/tests/header_verifier_blackbox_test.rs @@ -1,15 +1,6 @@ -use bls_signature::BlsSignature; use header_verifier::header_verifier_proxy; -use multiversx_sc::types::{ - BigUint, ManagedBuffer, ManagedByteArray, ManagedVec, MultiValueEncoded, TestAddress, - TestSCAddress, -}; -use multiversx_sc_scenario::{ - api::StaticApi, - imports::MxscPath, - scenario_model::{ScCallStep, ScDeployStep, TxExpect}, - ContractInfo, ScenarioTxRun, ScenarioWorld, -}; +use multiversx_sc::types::{BigUint, ManagedBuffer, MultiValueEncoded, TestAddress, TestSCAddress}; +use multiversx_sc_scenario::{api::StaticApi, imports::MxscPath, ScenarioTxRun, ScenarioWorld}; const HEADER_VERIFIER_CODE_PATH: MxscPath = MxscPath::new("ouput/header-verifier.mxsc-json"); const HEADER_VERIFIER_ADDRESS: TestSCAddress = TestSCAddress::new("header-verifier"); @@ -18,7 +9,6 @@ const LEADER: TestAddress = TestAddress::new("leader"); const VALIDATOR: TestAddress = TestAddress::new("validator"); const WEGLD_BALANCE: u128 = 100_000_000_000_000_000; -type HeaderVerifierContract = ContractInfo>; type BlsKeys = MultiValueEncoded>; fn world() -> ScenarioWorld { From 56ada5749a0c07ac5256457c400ce49bed058daa Mon Sep 17 00:00:00 2001 From: Andrei Baltariu Date: Mon, 30 Sep 2024 10:33:34 +0300 Subject: [PATCH 342/523] Added register esdt address test Signed-off-by: Andrei Baltariu --- .../tests/header_verifier_blackbox_test.rs | 43 ++++++++++++++++++- 1 file changed, 41 insertions(+), 2 deletions(-) diff --git a/header-verifier/tests/header_verifier_blackbox_test.rs b/header-verifier/tests/header_verifier_blackbox_test.rs index 020031f4..c430ac3d 100644 --- a/header-verifier/tests/header_verifier_blackbox_test.rs +++ b/header-verifier/tests/header_verifier_blackbox_test.rs @@ -1,9 +1,17 @@ -use header_verifier::header_verifier_proxy; +use header_verifier::{header_verifier_proxy, Headerverifier}; use multiversx_sc::types::{BigUint, ManagedBuffer, MultiValueEncoded, TestAddress, TestSCAddress}; -use multiversx_sc_scenario::{api::StaticApi, imports::MxscPath, ScenarioTxRun, ScenarioWorld}; +use multiversx_sc_scenario::{ + api::StaticApi, imports::MxscPath, ScenarioTxRun, ScenarioTxWhitebox, ScenarioWorld, +}; const HEADER_VERIFIER_CODE_PATH: MxscPath = MxscPath::new("ouput/header-verifier.mxsc-json"); const HEADER_VERIFIER_ADDRESS: TestSCAddress = TestSCAddress::new("header-verifier"); + +// NOTE: This is a mock path +const ENSHRINE_CODE_PATH: MxscPath = + MxscPath::new("../chain-factory/output/chain-factory.mxsc-json"); +const ENSHRINE_ADDRESS: TestSCAddress = TestSCAddress::new("enshrine"); + const OWNER: TestAddress = TestAddress::new("owner"); const LEADER: TestAddress = TestAddress::new("leader"); const VALIDATOR: TestAddress = TestAddress::new("validator"); @@ -14,6 +22,7 @@ type BlsKeys = MultiValueEncoded>; fn world() -> ScenarioWorld { let mut blockchain = ScenarioWorld::new(); blockchain.register_contract(HEADER_VERIFIER_CODE_PATH, header_verifier::ContractBuilder); + blockchain.register_contract(ENSHRINE_CODE_PATH, header_verifier::ContractBuilder); blockchain } @@ -47,6 +56,16 @@ impl HeaderVerifierTestState { self } + fn propose_register_esdt_address(&mut self, esdt_address: TestSCAddress) { + self.world + .tx() + .from(OWNER) + .to(HEADER_VERIFIER_ADDRESS) + .typed(header_verifier_proxy::HeaderverifierProxy) + .set_esdt_safe_address(esdt_address) + .run(); + } + fn get_bls_keys(&mut self, bls_keys_vec: Vec>) -> BlsKeys { let bls_keys = bls_keys_vec.iter().map(|key| key.clone().into()).collect(); @@ -62,3 +81,23 @@ fn test_deploy() { state.deploy_header_verifier_contract(managed_bls_keys); } + +#[test] +fn test_register_esdt_address() { + let mut state = HeaderVerifierTestState::new(); + let bls_key_1 = ManagedBuffer::from("bls_key_1"); + let managed_bls_keys = state.get_bls_keys(vec![bls_key_1]); + + state.deploy_header_verifier_contract(managed_bls_keys); + state.propose_register_esdt_address(ENSHRINE_ADDRESS); + + state + .world + .query() + .to(HEADER_VERIFIER_ADDRESS) + .whitebox(header_verifier::contract_obj, |sc| { + let esdt_address = sc.esdt_safe_address().get(); + + assert_eq!(esdt_address, ENSHRINE_ADDRESS); + }) +} From 5662b1d9662a8f5c8a12689d8a494ff1c1bbd2fa Mon Sep 17 00:00:00 2001 From: Andrei Baltariu Date: Mon, 30 Sep 2024 13:44:10 +0300 Subject: [PATCH 343/523] Added test for operation registration Signed-off-by: Andrei Baltariu --- header-verifier/src/lib.rs | 1 + .../tests/header_verifier_blackbox_test.rs | 88 ++++++++++++++++++- 2 files changed, 87 insertions(+), 2 deletions(-) diff --git a/header-verifier/src/lib.rs b/header-verifier/src/lib.rs index 0367fc57..122df6ee 100644 --- a/header-verifier/src/lib.rs +++ b/header-verifier/src/lib.rs @@ -78,6 +78,7 @@ pub trait Headerverifier: bls_signature::BlsSignatureModule { let hash_of_hashes_sha256 = self.crypto().sha256(&transfers_hashes); let hash_of_hashes = hash_of_hashes_sha256.as_managed_buffer(); + require!( transfers_hash.eq(hash_of_hashes), "Hash of all operations doesn't match the hash of transfer data" diff --git a/header-verifier/tests/header_verifier_blackbox_test.rs b/header-verifier/tests/header_verifier_blackbox_test.rs index c430ac3d..33bec521 100644 --- a/header-verifier/tests/header_verifier_blackbox_test.rs +++ b/header-verifier/tests/header_verifier_blackbox_test.rs @@ -1,7 +1,14 @@ +use bls_signature::BlsSignature; use header_verifier::{header_verifier_proxy, Headerverifier}; -use multiversx_sc::types::{BigUint, ManagedBuffer, MultiValueEncoded, TestAddress, TestSCAddress}; +use multiversx_sc::{ + api::ManagedTypeApi, + types::{ + BigUint, ManagedBuffer, ManagedByteArray, MultiValueEncoded, TestAddress, TestSCAddress, + }, +}; use multiversx_sc_scenario::{ - api::StaticApi, imports::MxscPath, ScenarioTxRun, ScenarioTxWhitebox, ScenarioWorld, + api::StaticApi, imports::MxscPath, multiversx_chain_vm::crypto_functions::sha256, + ScenarioTxRun, ScenarioTxWhitebox, ScenarioWorld, }; const HEADER_VERIFIER_CODE_PATH: MxscPath = MxscPath::new("ouput/header-verifier.mxsc-json"); @@ -19,6 +26,12 @@ const WEGLD_BALANCE: u128 = 100_000_000_000_000_000; type BlsKeys = MultiValueEncoded>; +pub struct BridgeOperation { + signature: BlsSignature, + bridge_operation_hash: ManagedBuffer, + operations_hashes: MultiValueEncoded>, +} + fn world() -> ScenarioWorld { let mut blockchain = ScenarioWorld::new(); blockchain.register_contract(HEADER_VERIFIER_CODE_PATH, header_verifier::ContractBuilder); @@ -66,11 +79,62 @@ impl HeaderVerifierTestState { .run(); } + fn propose_register_operations(&mut self, operation: BridgeOperation) { + self.world + .tx() + .from(OWNER) + .to(HEADER_VERIFIER_ADDRESS) + .typed(header_verifier_proxy::HeaderverifierProxy) + .register_bridge_operations( + operation.signature, + operation.bridge_operation_hash, + operation.operations_hashes, + ) + .run(); + } + fn get_bls_keys(&mut self, bls_keys_vec: Vec>) -> BlsKeys { let bls_keys = bls_keys_vec.iter().map(|key| key.clone().into()).collect(); bls_keys } + + fn get_mock_operation(&mut self) -> BridgeOperation { + let mock_signature: BlsSignature = ManagedByteArray::new_from_bytes( + b"EIZ2\x05\xf7q\xc7G\x96\x1f\xba0\xe2\xd1\xf5pE\x14\xd7?\xac\xff\x8d\x1a\x0c\x11\x900f5\xfb\xff4\x94\xb8@\xc5^\xc2,exn0\xe3\xf0\n" + ); + + let first_operation = ManagedBuffer::from("first_operation"); + let first_operation_hash = self.get_operation_hash(first_operation); + let second_operation = ManagedBuffer::from("second_operation"); + let second_operation_hash = self.get_operation_hash(second_operation); + + let mut bridge_operations: MultiValueEncoded> = + MultiValueEncoded::new(); + bridge_operations.push(first_operation_hash.clone()); + bridge_operations.push(second_operation_hash.clone()); + + let mut bridge_operation = first_operation_hash; + bridge_operation.append(&second_operation_hash); + + let bridge_operations_hash = self.get_operation_hash(bridge_operation); + + BridgeOperation { + signature: mock_signature, + bridge_operation_hash: bridge_operations_hash, + operations_hashes: bridge_operations, + } + } + + fn get_operation_hash( + &mut self, + operation: ManagedBuffer, + ) -> ManagedBuffer { + let array: &mut [u8; 64] = &mut [0u8; 64]; + operation.load_to_byte_array(array); + + ManagedBuffer::from(&sha256(array)) + } } #[test] @@ -101,3 +165,23 @@ fn test_register_esdt_address() { assert_eq!(esdt_address, ENSHRINE_ADDRESS); }) } + +#[test] +fn test_register_bridge_operation() { + let mut state = HeaderVerifierTestState::new(); + let bls_key_1 = ManagedBuffer::from("bls_key_1"); + let managed_bls_keys = state.get_bls_keys(vec![bls_key_1]); + + state.deploy_header_verifier_contract(managed_bls_keys); + + let operation = state.get_mock_operation(); + state.propose_register_operations(operation); + + state + .world + .query() + .to(HEADER_VERIFIER_ADDRESS) + .whitebox(header_verifier::contract_obj, |sc| { + assert!(!sc.hash_of_hashes_history().is_empty()); + }) +} From 78b95c9ede12480de8ec31ba50121442019498ca Mon Sep 17 00:00:00 2001 From: Andrei Baltariu Date: Mon, 30 Sep 2024 14:27:41 +0300 Subject: [PATCH 344/523] Added require for esdt address to be registered Signed-off-by: Andrei Baltariu --- header-verifier/src/lib.rs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/header-verifier/src/lib.rs b/header-verifier/src/lib.rs index 122df6ee..bd51ce17 100644 --- a/header-verifier/src/lib.rs +++ b/header-verifier/src/lib.rs @@ -56,6 +56,11 @@ pub trait Headerverifier: bls_signature::BlsSignatureModule { #[endpoint(removeExecutedHash)] fn remove_executed_hash(&self, hash_of_hashes: &ManagedBuffer, operation_hash: &ManagedBuffer) { + require!( + !self.esdt_safe_address().is_empty(), + "There is no registered ESDT address" + ); + let caller = self.blockchain().get_caller(); require!( caller == self.esdt_safe_address().get(), From a2cf9402aebad8942887215ffda8044695966659 Mon Sep 17 00:00:00 2001 From: Andrei Baltariu Date: Mon, 30 Sep 2024 14:27:52 +0300 Subject: [PATCH 345/523] Added test for removing executed hash Signed-off-by: Andrei Baltariu --- .../tests/header_verifier_blackbox_test.rs | 115 +++++++++++++++--- 1 file changed, 101 insertions(+), 14 deletions(-) diff --git a/header-verifier/tests/header_verifier_blackbox_test.rs b/header-verifier/tests/header_verifier_blackbox_test.rs index 33bec521..843e62c1 100644 --- a/header-verifier/tests/header_verifier_blackbox_test.rs +++ b/header-verifier/tests/header_verifier_blackbox_test.rs @@ -7,7 +7,7 @@ use multiversx_sc::{ }, }; use multiversx_sc_scenario::{ - api::StaticApi, imports::MxscPath, multiversx_chain_vm::crypto_functions::sha256, + api::StaticApi, imports::MxscPath, multiversx_chain_vm::crypto_functions::sha256, ExpectError, ScenarioTxRun, ScenarioTxWhitebox, ScenarioWorld, }; @@ -26,6 +26,12 @@ const WEGLD_BALANCE: u128 = 100_000_000_000_000_000; type BlsKeys = MultiValueEncoded>; +pub struct ErrorStatus<'a> { + code: u64, + error_message: &'a str, +} + +#[derive(Clone)] pub struct BridgeOperation { signature: BlsSignature, bridge_operation_hash: ManagedBuffer, @@ -93,31 +99,58 @@ impl HeaderVerifierTestState { .run(); } + fn propose_remove_execute_hash( + &mut self, + hash_of_hashes: ManagedBuffer, + operation_hash: ManagedBuffer, + error_status: Option, + ) { + match error_status { + Some(error) => self + .world + .tx() + .from(OWNER) + .to(HEADER_VERIFIER_ADDRESS) + .typed(header_verifier_proxy::HeaderverifierProxy) + .remove_executed_hash(hash_of_hashes, operation_hash) + .returns(ExpectError(error.code, error.error_message)) + .run(), + None => self + .world + .tx() + .from(OWNER) + .to(HEADER_VERIFIER_ADDRESS) + .typed(header_verifier_proxy::HeaderverifierProxy) + .remove_executed_hash(hash_of_hashes, operation_hash) + .run(), + } + } + fn get_bls_keys(&mut self, bls_keys_vec: Vec>) -> BlsKeys { let bls_keys = bls_keys_vec.iter().map(|key| key.clone().into()).collect(); bls_keys } - fn get_mock_operation(&mut self) -> BridgeOperation { + fn get_mock_operation( + &mut self, + operations: Vec<&ManagedBuffer>, + ) -> BridgeOperation { let mock_signature: BlsSignature = ManagedByteArray::new_from_bytes( b"EIZ2\x05\xf7q\xc7G\x96\x1f\xba0\xe2\xd1\xf5pE\x14\xd7?\xac\xff\x8d\x1a\x0c\x11\x900f5\xfb\xff4\x94\xb8@\xc5^\xc2,exn0\xe3\xf0\n" ); - let first_operation = ManagedBuffer::from("first_operation"); - let first_operation_hash = self.get_operation_hash(first_operation); - let second_operation = ManagedBuffer::from("second_operation"); - let second_operation_hash = self.get_operation_hash(second_operation); - let mut bridge_operations: MultiValueEncoded> = MultiValueEncoded::new(); - bridge_operations.push(first_operation_hash.clone()); - bridge_operations.push(second_operation_hash.clone()); + let mut bridge_operation_appended_hashes = ManagedBuffer::new(); - let mut bridge_operation = first_operation_hash; - bridge_operation.append(&second_operation_hash); + for operation in operations { + let operation_hash = self.get_operation_hash(operation); + bridge_operation_appended_hashes.append(&operation_hash); + bridge_operations.push(operation_hash); + } - let bridge_operations_hash = self.get_operation_hash(bridge_operation); + let bridge_operations_hash = self.get_operation_hash(&bridge_operation_appended_hashes); BridgeOperation { signature: mock_signature, @@ -128,7 +161,7 @@ impl HeaderVerifierTestState { fn get_operation_hash( &mut self, - operation: ManagedBuffer, + operation: &ManagedBuffer, ) -> ManagedBuffer { let array: &mut [u8; 64] = &mut [0u8; 64]; operation.load_to_byte_array(array); @@ -174,7 +207,10 @@ fn test_register_bridge_operation() { state.deploy_header_verifier_contract(managed_bls_keys); - let operation = state.get_mock_operation(); + let operation_1 = ManagedBuffer::from("operation_1"); + let operation_2 = ManagedBuffer::from("operation_2"); + let operation = state.get_mock_operation(vec![&operation_1, &operation_2]); + state.propose_register_operations(operation); state @@ -185,3 +221,54 @@ fn test_register_bridge_operation() { assert!(!sc.hash_of_hashes_history().is_empty()); }) } + +#[test] +fn test_remove_executed_hash_caller_not_esdt_address() { + let mut state = HeaderVerifierTestState::new(); + let bls_key_1 = ManagedBuffer::from("bls_key_1"); + let managed_bls_keys = state.get_bls_keys(vec![bls_key_1]); + + state.deploy_header_verifier_contract(managed_bls_keys); + + let operation_1 = ManagedBuffer::from("operation_1"); + let operation_2 = ManagedBuffer::from("operation_2"); + let operation = state.get_mock_operation(vec![&operation_1, &operation_2]); + + let error_status = ErrorStatus { + code: 4, + error_message: "Only ESDT Safe contract can call this endpoint", + }; + + state.propose_register_operations(operation.clone()); + state.propose_register_esdt_address(ENSHRINE_ADDRESS); + state.propose_remove_execute_hash( + operation.bridge_operation_hash, + operation_1, + Some(error_status), + ); +} + +#[test] +fn test_remove_executed_hash_no_esdt_address_registered() { + let mut state = HeaderVerifierTestState::new(); + let bls_key_1 = ManagedBuffer::from("bls_key_1"); + let managed_bls_keys = state.get_bls_keys(vec![bls_key_1]); + + state.deploy_header_verifier_contract(managed_bls_keys); + + let operation_1 = ManagedBuffer::from("operation_1"); + let operation_2 = ManagedBuffer::from("operation_2"); + let operation = state.get_mock_operation(vec![&operation_1, &operation_2]); + + let error_status = ErrorStatus { + code: 4, + error_message: "There is no registered ESDT address", + }; + + state.propose_register_operations(operation.clone()); + state.propose_remove_execute_hash( + operation.bridge_operation_hash, + operation_1, + Some(error_status), + ); +} From d3af56e8d8e70a58f0b7fe5cf3e3960abc214045 Mon Sep 17 00:00:00 2001 From: Andrei Baltariu Date: Mon, 30 Sep 2024 14:43:22 +0300 Subject: [PATCH 346/523] Added test for removing executed hash Signed-off-by: Andrei Baltariu --- .../tests/header_verifier_blackbox_test.rs | 55 ++++++++++++++++--- 1 file changed, 48 insertions(+), 7 deletions(-) diff --git a/header-verifier/tests/header_verifier_blackbox_test.rs b/header-verifier/tests/header_verifier_blackbox_test.rs index 843e62c1..1058b18c 100644 --- a/header-verifier/tests/header_verifier_blackbox_test.rs +++ b/header-verifier/tests/header_verifier_blackbox_test.rs @@ -7,8 +7,8 @@ use multiversx_sc::{ }, }; use multiversx_sc_scenario::{ - api::StaticApi, imports::MxscPath, multiversx_chain_vm::crypto_functions::sha256, ExpectError, - ScenarioTxRun, ScenarioTxWhitebox, ScenarioWorld, + api::StaticApi, imports::MxscPath, multiversx_chain_vm::crypto_functions::sha256, DebugApi, + ExpectError, ScenarioTxRun, ScenarioTxWhitebox, ScenarioWorld, }; const HEADER_VERIFIER_CODE_PATH: MxscPath = MxscPath::new("ouput/header-verifier.mxsc-json"); @@ -75,6 +75,19 @@ impl HeaderVerifierTestState { self } + fn deploy_enshrine_esdt_contract(&mut self, bls_keys: &BlsKeys) -> &mut Self { + self.world + .tx() + .from(OWNER) + .typed(header_verifier_proxy::HeaderverifierProxy) + .init(bls_keys) + .code(HEADER_VERIFIER_CODE_PATH) + .new_address(ENSHRINE_ADDRESS) + .run(); + + self + } + fn propose_register_esdt_address(&mut self, esdt_address: TestSCAddress) { self.world .tx() @@ -101,7 +114,7 @@ impl HeaderVerifierTestState { fn propose_remove_execute_hash( &mut self, - hash_of_hashes: ManagedBuffer, + hash_of_hashes: &ManagedBuffer, operation_hash: ManagedBuffer, error_status: Option, ) { @@ -118,7 +131,7 @@ impl HeaderVerifierTestState { None => self .world .tx() - .from(OWNER) + .from(ENSHRINE_ADDRESS) .to(HEADER_VERIFIER_ADDRESS) .typed(header_verifier_proxy::HeaderverifierProxy) .remove_executed_hash(hash_of_hashes, operation_hash) @@ -219,7 +232,7 @@ fn test_register_bridge_operation() { .to(HEADER_VERIFIER_ADDRESS) .whitebox(header_verifier::contract_obj, |sc| { assert!(!sc.hash_of_hashes_history().is_empty()); - }) + }); } #[test] @@ -242,7 +255,7 @@ fn test_remove_executed_hash_caller_not_esdt_address() { state.propose_register_operations(operation.clone()); state.propose_register_esdt_address(ENSHRINE_ADDRESS); state.propose_remove_execute_hash( - operation.bridge_operation_hash, + &operation.bridge_operation_hash, operation_1, Some(error_status), ); @@ -267,8 +280,36 @@ fn test_remove_executed_hash_no_esdt_address_registered() { state.propose_register_operations(operation.clone()); state.propose_remove_execute_hash( - operation.bridge_operation_hash, + &operation.bridge_operation_hash, operation_1, Some(error_status), ); } + +#[test] +fn test_remove_executed_hash() { + let mut state = HeaderVerifierTestState::new(); + let bls_key_1 = ManagedBuffer::from("bls_key_1"); + let managed_bls_keys = state.get_bls_keys(vec![bls_key_1]); + + state.deploy_enshrine_esdt_contract(&managed_bls_keys); + state.deploy_header_verifier_contract(managed_bls_keys); + + let operation_1 = ManagedBuffer::from("operation_1"); + let operation_2 = ManagedBuffer::from("operation_2"); + let operation = state.get_mock_operation(vec![&operation_1, &operation_2]); + + state.propose_register_operations(operation.clone()); + state.propose_register_esdt_address(ENSHRINE_ADDRESS); + state.propose_remove_execute_hash(&operation.bridge_operation_hash, operation_1, None); + + state + .world + .query() + .to(HEADER_VERIFIER_ADDRESS) + .whitebox(header_verifier::contract_obj, |sc| { + let hash_of_hashes: ManagedBuffer = + ManagedBuffer::from(operation.bridge_operation_hash.to_vec()); + sc.pending_hashes(&hash_of_hashes).is_empty(); + }); +} From d5d5d8447c938a7552ba812d00e874a9e9594425 Mon Sep 17 00:00:00 2001 From: Andrei Baltariu Date: Mon, 30 Sep 2024 14:43:42 +0300 Subject: [PATCH 347/523] Removed unused constants Signed-off-by: Andrei Baltariu --- header-verifier/tests/header_verifier_blackbox_test.rs | 2 -- 1 file changed, 2 deletions(-) diff --git a/header-verifier/tests/header_verifier_blackbox_test.rs b/header-verifier/tests/header_verifier_blackbox_test.rs index 1058b18c..aea7bcfc 100644 --- a/header-verifier/tests/header_verifier_blackbox_test.rs +++ b/header-verifier/tests/header_verifier_blackbox_test.rs @@ -20,8 +20,6 @@ const ENSHRINE_CODE_PATH: MxscPath = const ENSHRINE_ADDRESS: TestSCAddress = TestSCAddress::new("enshrine"); const OWNER: TestAddress = TestAddress::new("owner"); -const LEADER: TestAddress = TestAddress::new("leader"); -const VALIDATOR: TestAddress = TestAddress::new("validator"); const WEGLD_BALANCE: u128 = 100_000_000_000_000_000; type BlsKeys = MultiValueEncoded>; From a8e04296933efd1f77e5f00be2e207d23734a826 Mon Sep 17 00:00:00 2001 From: Andrei Baltariu Date: Wed, 2 Oct 2024 11:21:33 +0300 Subject: [PATCH 348/523] Clippy fixes Signed-off-by: Andrei Baltariu --- enshrine-esdt-safe/src/lib.rs | 2 +- .../tests/enshrine_esdt_safe_blackbox_test.rs | 13 ++++++------- 2 files changed, 7 insertions(+), 8 deletions(-) diff --git a/enshrine-esdt-safe/src/lib.rs b/enshrine-esdt-safe/src/lib.rs index 31a2ef8f..23451fc1 100644 --- a/enshrine-esdt-safe/src/lib.rs +++ b/enshrine-esdt-safe/src/lib.rs @@ -82,7 +82,7 @@ pub trait EnshrineEsdtSafe: #[only_owner] #[endpoint(setMaxTxGasLimit)] fn set_max_user_tx_gas_limit(&self, max_user_tx_gas_limit: GasLimit) { - self.max_user_tx_gas_limit().set(&max_user_tx_gas_limit); + self.max_user_tx_gas_limit().set(max_user_tx_gas_limit); } #[only_owner] diff --git a/enshrine-esdt-safe/tests/enshrine_esdt_safe_blackbox_test.rs b/enshrine-esdt-safe/tests/enshrine_esdt_safe_blackbox_test.rs index 5a91bb0d..ff1d6eb6 100644 --- a/enshrine-esdt-safe/tests/enshrine_esdt_safe_blackbox_test.rs +++ b/enshrine-esdt-safe/tests/enshrine_esdt_safe_blackbox_test.rs @@ -222,9 +222,8 @@ impl EnshrineTestState { fee_struct: Option<&FeeStruct>, error_status: Option, ) -> &mut Self { - match fee_struct { - Some(fee) => self.propose_add_fee_token(fee, error_status), - _ => (), + if let Some(fee) = fee_struct { + self.propose_add_fee_token(fee, error_status); } self @@ -754,7 +753,7 @@ fn test_deposit_with_transfer_data_gas_limit_too_high() { let wegld_payment = EsdtTokenPayment::new(WEGLD_IDENTIFIER.into(), 0, amount.clone()); let crowd_payment = EsdtTokenPayment::new(CROWD_TOKEN_ID.into(), 0, amount); let mut payments = PaymentsVec::new(); - let gas_limit = 1000000000000000000 as u64; + let gas_limit = 1000000000000000000; let function = ManagedBuffer::from("some_function"); let arg = ManagedBuffer::from("arg"); let mut args = ManagedVec::new(); @@ -787,7 +786,7 @@ fn test_deposit_with_transfer_data_banned_endpoint() { let wegld_payment = EsdtTokenPayment::new(WEGLD_IDENTIFIER.into(), 0, amount.clone()); let crowd_payment = EsdtTokenPayment::new(CROWD_TOKEN_ID.into(), 0, amount); let mut payments = PaymentsVec::new(); - let gas_limit = 1000000000 as u64; + let gas_limit = 1000000000; let function = ManagedBuffer::from("some_function"); let arg = ManagedBuffer::from("arg"); let mut args = ManagedVec::new(); @@ -824,7 +823,7 @@ fn test_deposit_with_transfer_data_enough_for_fee() { let fungible_payment = EsdtTokenPayment::new(FUNGIBLE_TOKEN_ID.into(), 0, amount.clone()); let crowd_payment = EsdtTokenPayment::new(CROWD_TOKEN_ID.into(), 0, amount.clone()); let mut payments = PaymentsVec::new(); - let gas_limit = 1000000000 as u64; + let gas_limit = 1000000000; let function = ManagedBuffer::from("some_function"); let arg = ManagedBuffer::from("arg"); let mut args = ManagedVec::new(); @@ -887,7 +886,7 @@ fn test_deposit_with_transfer_data_not_enough_for_fee() { let fungible_payment = EsdtTokenPayment::new(FUNGIBLE_TOKEN_ID.into(), 0, amount.clone()); let crowd_payment = EsdtTokenPayment::new(CROWD_TOKEN_ID.into(), 0, amount.clone()); let mut payments = PaymentsVec::new(); - let gas_limit = 1000000000000000 as u64; + let gas_limit = 1000000000000000; let function = ManagedBuffer::from("some_function"); let arg = ManagedBuffer::from("arg"); let mut args = ManagedVec::new(); From d0ac0caee837eaa1ca5ab80f5456f9835664b6b2 Mon Sep 17 00:00:00 2001 From: Andrei Baltariu Date: Wed, 2 Oct 2024 12:10:01 +0300 Subject: [PATCH 349/523] Framework upgrade to 0.53.1 Signed-off-by: Andrei Baltariu --- Cargo.lock | 20 +++++++++---------- chain-config/Cargo.toml | 6 +++--- chain-config/meta/Cargo.toml | 2 +- chain-config/wasm/Cargo.lock | 16 +++++++-------- chain-config/wasm/Cargo.toml | 2 +- chain-factory/Cargo.toml | 4 ++-- chain-factory/meta/Cargo.toml | 2 +- .../wasm-chain-factory-full/Cargo.lock | 16 +++++++-------- .../wasm-chain-factory-full/Cargo.toml | 2 +- .../wasm-chain-factory-view/Cargo.lock | 16 +++++++-------- .../wasm-chain-factory-view/Cargo.toml | 2 +- chain-factory/wasm/Cargo.lock | 16 +++++++-------- chain-factory/wasm/Cargo.toml | 2 +- common/bls-signature/Cargo.toml | 4 ++-- common/max-bridged-amount-module/Cargo.toml | 4 ++-- common/setup-phase/Cargo.toml | 4 ++-- common/token-whitelist/Cargo.toml | 4 ++-- common/transaction/Cargo.toml | 2 +- common/tx-batch-module/Cargo.toml | 4 ++-- common/utils/Cargo.toml | 2 +- enshrine-esdt-safe/Cargo.toml | 6 +++--- enshrine-esdt-safe/meta/Cargo.toml | 2 +- .../wasm-enshrine-esdt-safe-full/Cargo.lock | 16 +++++++-------- .../wasm-enshrine-esdt-safe-full/Cargo.toml | 2 +- .../wasm-enshrine-esdt-safe-view/Cargo.lock | 16 +++++++-------- .../wasm-enshrine-esdt-safe-view/Cargo.toml | 2 +- enshrine-esdt-safe/wasm/Cargo.lock | 16 +++++++-------- enshrine-esdt-safe/wasm/Cargo.toml | 2 +- esdt-safe/Cargo.toml | 6 +++--- esdt-safe/meta/Cargo.toml | 2 +- esdt-safe/wasm-esdt-safe-full/Cargo.lock | 16 +++++++-------- esdt-safe/wasm-esdt-safe-full/Cargo.toml | 2 +- esdt-safe/wasm-esdt-safe-view/Cargo.lock | 16 +++++++-------- esdt-safe/wasm-esdt-safe-view/Cargo.toml | 2 +- esdt-safe/wasm/Cargo.lock | 16 +++++++-------- esdt-safe/wasm/Cargo.toml | 2 +- fee-market/Cargo.toml | 4 ++-- fee-market/meta/Cargo.toml | 2 +- fee-market/wasm-fee-marker-full/Cargo.lock | 12 +++++------ fee-market/wasm-fee-marker-full/Cargo.toml | 2 +- fee-market/wasm-multisig-view/Cargo.lock | 12 +++++------ fee-market/wasm-multisig-view/Cargo.toml | 2 +- fee-market/wasm/Cargo.lock | 12 +++++------ fee-market/wasm/Cargo.toml | 2 +- header-verifier/Cargo.toml | 4 ++-- header-verifier/meta/Cargo.toml | 2 +- .../wasm-header-verifier-full/Cargo.lock | 12 +++++------ .../wasm-header-verifier-full/Cargo.toml | 2 +- header-verifier/wasm-multisig-view/Cargo.lock | 12 +++++------ header-verifier/wasm-multisig-view/Cargo.toml | 2 +- header-verifier/wasm/Cargo.lock | 12 +++++------ header-verifier/wasm/Cargo.toml | 2 +- token-handler/Cargo.toml | 4 ++-- token-handler/meta/Cargo.toml | 2 +- .../wasm-token-handler-full/Cargo.lock | 16 +++++++-------- .../wasm-token-handler-full/Cargo.toml | 2 +- .../wasm-token-handler-view/Cargo.lock | 16 +++++++-------- .../wasm-token-handler-view/Cargo.toml | 2 +- token-handler/wasm/Cargo.lock | 16 +++++++-------- token-handler/wasm/Cargo.toml | 2 +- 60 files changed, 205 insertions(+), 205 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index d2578bc4..cf447216 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -609,9 +609,9 @@ checksum = "b59072fa0624b55ae5ae3fa6bfa91515bbeb4ac440214bc4a509e2c8806d6e9f" [[package]] name = "multiversx-sc" -version = "0.53.0" +version = "0.53.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2a86a27b04bb7cca97ad8971ee57e6b978619623dde4ba9acae1d4ecb436f062" +checksum = "e05f8dfb9c2dd26feff1330b1e229f0886f5c0228ed570f19421a458e6e7b0ef" dependencies = [ "bitflags", "hex-literal", @@ -647,9 +647,9 @@ dependencies = [ [[package]] name = "multiversx-sc-derive" -version = "0.53.0" +version = "0.53.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f7a6ee275d6b1c2b86394369df0bc62a3f25018cbab12668a191b89d88fdcf71" +checksum = "f4b5176aa94b5e422e0d3c904492e0de0ae8381f166b563fbcac19a9ca4b28bc" dependencies = [ "hex", "proc-macro2", @@ -660,9 +660,9 @@ dependencies = [ [[package]] name = "multiversx-sc-meta-lib" -version = "0.53.0" +version = "0.53.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5cadbd4a972764b864e7f6b73e6963df85f7010fbd3a993d820873809bce4e93" +checksum = "750e309894ebebad3675feb3d59bb709f826c07cbdf21adf5719b5ab2f23aa13" dependencies = [ "clap", "colored", @@ -681,18 +681,18 @@ dependencies = [ [[package]] name = "multiversx-sc-modules" -version = "0.53.0" +version = "0.53.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fece2308326cc59c53fedd682259625e8ecc306e4c3b35051725ca388677b47b" +checksum = "3cfb6046ec3cc6ef94351b4ca89907b2b74b2e4a7f376adc0af18ddd1c5a4367" dependencies = [ "multiversx-sc", ] [[package]] name = "multiversx-sc-scenario" -version = "0.53.0" +version = "0.53.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fe13bdcc09d9405c5767593359c8193dc05f8271423f76bd991cfabb90056e4c" +checksum = "701ca689a866acb88cf5022ec8bae1ba318065e5800f75dd76e3620d2a782ca0" dependencies = [ "base64", "bech32", diff --git a/chain-config/Cargo.toml b/chain-config/Cargo.toml index cd4744a4..d5d3fcd5 100644 --- a/chain-config/Cargo.toml +++ b/chain-config/Cargo.toml @@ -12,10 +12,10 @@ path = "src/lib.rs" num-bigint = "0.4.2" [dev-dependencies.multiversx-sc-scenario] -version = "=0.53.0" +version = "=0.53.1" [dependencies.multiversx-sc] -version = "=0.53.0" +version = "=0.53.1" [dependencies.multiversx-sc-modules] -version = "=0.53.0" +version = "=0.53.1" diff --git a/chain-config/meta/Cargo.toml b/chain-config/meta/Cargo.toml index ed0c1ef4..d5971030 100644 --- a/chain-config/meta/Cargo.toml +++ b/chain-config/meta/Cargo.toml @@ -11,4 +11,4 @@ authors = ["you"] path = ".." [dependencies.multiversx-sc-meta-lib] -version = "=0.53.0" +version = "=0.53.1" diff --git a/chain-config/wasm/Cargo.lock b/chain-config/wasm/Cargo.lock index 00dfb9ee..61d0dfb8 100644 --- a/chain-config/wasm/Cargo.lock +++ b/chain-config/wasm/Cargo.lock @@ -56,9 +56,9 @@ checksum = "6fe2267d4ed49bc07b63801559be28c718ea06c4738b7a03c94df7386d2cde46" [[package]] name = "multiversx-sc" -version = "0.53.0" +version = "0.53.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2a86a27b04bb7cca97ad8971ee57e6b978619623dde4ba9acae1d4ecb436f062" +checksum = "e05f8dfb9c2dd26feff1330b1e229f0886f5c0228ed570f19421a458e6e7b0ef" dependencies = [ "bitflags", "hex-literal", @@ -93,9 +93,9 @@ dependencies = [ [[package]] name = "multiversx-sc-derive" -version = "0.53.0" +version = "0.53.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f7a6ee275d6b1c2b86394369df0bc62a3f25018cbab12668a191b89d88fdcf71" +checksum = "f4b5176aa94b5e422e0d3c904492e0de0ae8381f166b563fbcac19a9ca4b28bc" dependencies = [ "hex", "proc-macro2", @@ -106,18 +106,18 @@ dependencies = [ [[package]] name = "multiversx-sc-modules" -version = "0.53.0" +version = "0.53.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fece2308326cc59c53fedd682259625e8ecc306e4c3b35051725ca388677b47b" +checksum = "3cfb6046ec3cc6ef94351b4ca89907b2b74b2e4a7f376adc0af18ddd1c5a4367" dependencies = [ "multiversx-sc", ] [[package]] name = "multiversx-sc-wasm-adapter" -version = "0.53.0" +version = "0.53.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0ab5bb42b3ce827227a5e38f3c24fbe0fb23d475425b049043e193186e36c590" +checksum = "9aa0cbd543872f94b9bc98c4ce7c3ed25a7257e1425295af9036eba44893bdaa" dependencies = [ "multiversx-sc", ] diff --git a/chain-config/wasm/Cargo.toml b/chain-config/wasm/Cargo.toml index 5440d67d..6a696293 100644 --- a/chain-config/wasm/Cargo.toml +++ b/chain-config/wasm/Cargo.toml @@ -28,7 +28,7 @@ panic = "abort" path = ".." [dependencies.multiversx-sc-wasm-adapter] -version = "=0.53.0" +version = "=0.53.1" [workspace] members = ["."] diff --git a/chain-factory/Cargo.toml b/chain-factory/Cargo.toml index de7f33a8..337846c5 100644 --- a/chain-factory/Cargo.toml +++ b/chain-factory/Cargo.toml @@ -12,10 +12,10 @@ path = "src/lib.rs" num-bigint = "0.4.2" [dev-dependencies.multiversx-sc-scenario] -version = "=0.53.0" +version = "=0.53.1" [dependencies.multiversx-sc] -version = "=0.53.0" +version = "=0.53.1" [dependencies.utils] path = "../common/utils" diff --git a/chain-factory/meta/Cargo.toml b/chain-factory/meta/Cargo.toml index 8db9cb29..6d3d98bb 100644 --- a/chain-factory/meta/Cargo.toml +++ b/chain-factory/meta/Cargo.toml @@ -11,4 +11,4 @@ authors = ["you"] path = ".." [dependencies.multiversx-sc-meta-lib] -version = "=0.53.0" +version = "=0.53.1" diff --git a/chain-factory/wasm-chain-factory-full/Cargo.lock b/chain-factory/wasm-chain-factory-full/Cargo.lock index 429a7753..ed28057c 100644 --- a/chain-factory/wasm-chain-factory-full/Cargo.lock +++ b/chain-factory/wasm-chain-factory-full/Cargo.lock @@ -74,9 +74,9 @@ checksum = "6fe2267d4ed49bc07b63801559be28c718ea06c4738b7a03c94df7386d2cde46" [[package]] name = "multiversx-sc" -version = "0.53.0" +version = "0.53.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2a86a27b04bb7cca97ad8971ee57e6b978619623dde4ba9acae1d4ecb436f062" +checksum = "e05f8dfb9c2dd26feff1330b1e229f0886f5c0228ed570f19421a458e6e7b0ef" dependencies = [ "bitflags", "hex-literal", @@ -111,9 +111,9 @@ dependencies = [ [[package]] name = "multiversx-sc-derive" -version = "0.53.0" +version = "0.53.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f7a6ee275d6b1c2b86394369df0bc62a3f25018cbab12668a191b89d88fdcf71" +checksum = "f4b5176aa94b5e422e0d3c904492e0de0ae8381f166b563fbcac19a9ca4b28bc" dependencies = [ "hex", "proc-macro2", @@ -124,18 +124,18 @@ dependencies = [ [[package]] name = "multiversx-sc-modules" -version = "0.53.0" +version = "0.53.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fece2308326cc59c53fedd682259625e8ecc306e4c3b35051725ca388677b47b" +checksum = "3cfb6046ec3cc6ef94351b4ca89907b2b74b2e4a7f376adc0af18ddd1c5a4367" dependencies = [ "multiversx-sc", ] [[package]] name = "multiversx-sc-wasm-adapter" -version = "0.53.0" +version = "0.53.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0ab5bb42b3ce827227a5e38f3c24fbe0fb23d475425b049043e193186e36c590" +checksum = "9aa0cbd543872f94b9bc98c4ce7c3ed25a7257e1425295af9036eba44893bdaa" dependencies = [ "multiversx-sc", ] diff --git a/chain-factory/wasm-chain-factory-full/Cargo.toml b/chain-factory/wasm-chain-factory-full/Cargo.toml index a288cafc..1367f79b 100644 --- a/chain-factory/wasm-chain-factory-full/Cargo.toml +++ b/chain-factory/wasm-chain-factory-full/Cargo.toml @@ -28,7 +28,7 @@ panic = "abort" path = ".." [dependencies.multiversx-sc-wasm-adapter] -version = "=0.53.0" +version = "=0.53.1" [workspace] members = ["."] diff --git a/chain-factory/wasm-chain-factory-view/Cargo.lock b/chain-factory/wasm-chain-factory-view/Cargo.lock index fd18866c..cd117300 100644 --- a/chain-factory/wasm-chain-factory-view/Cargo.lock +++ b/chain-factory/wasm-chain-factory-view/Cargo.lock @@ -74,9 +74,9 @@ checksum = "6fe2267d4ed49bc07b63801559be28c718ea06c4738b7a03c94df7386d2cde46" [[package]] name = "multiversx-sc" -version = "0.53.0" +version = "0.53.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2a86a27b04bb7cca97ad8971ee57e6b978619623dde4ba9acae1d4ecb436f062" +checksum = "e05f8dfb9c2dd26feff1330b1e229f0886f5c0228ed570f19421a458e6e7b0ef" dependencies = [ "bitflags", "hex-literal", @@ -111,9 +111,9 @@ dependencies = [ [[package]] name = "multiversx-sc-derive" -version = "0.53.0" +version = "0.53.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f7a6ee275d6b1c2b86394369df0bc62a3f25018cbab12668a191b89d88fdcf71" +checksum = "f4b5176aa94b5e422e0d3c904492e0de0ae8381f166b563fbcac19a9ca4b28bc" dependencies = [ "hex", "proc-macro2", @@ -124,18 +124,18 @@ dependencies = [ [[package]] name = "multiversx-sc-modules" -version = "0.53.0" +version = "0.53.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fece2308326cc59c53fedd682259625e8ecc306e4c3b35051725ca388677b47b" +checksum = "3cfb6046ec3cc6ef94351b4ca89907b2b74b2e4a7f376adc0af18ddd1c5a4367" dependencies = [ "multiversx-sc", ] [[package]] name = "multiversx-sc-wasm-adapter" -version = "0.53.0" +version = "0.53.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0ab5bb42b3ce827227a5e38f3c24fbe0fb23d475425b049043e193186e36c590" +checksum = "9aa0cbd543872f94b9bc98c4ce7c3ed25a7257e1425295af9036eba44893bdaa" dependencies = [ "multiversx-sc", ] diff --git a/chain-factory/wasm-chain-factory-view/Cargo.toml b/chain-factory/wasm-chain-factory-view/Cargo.toml index 4772b569..9af379e8 100644 --- a/chain-factory/wasm-chain-factory-view/Cargo.toml +++ b/chain-factory/wasm-chain-factory-view/Cargo.toml @@ -28,7 +28,7 @@ panic = "abort" path = ".." [dependencies.multiversx-sc-wasm-adapter] -version = "=0.53.0" +version = "=0.53.1" [workspace] members = ["."] diff --git a/chain-factory/wasm/Cargo.lock b/chain-factory/wasm/Cargo.lock index 51ce0e6d..1a1b1683 100644 --- a/chain-factory/wasm/Cargo.lock +++ b/chain-factory/wasm/Cargo.lock @@ -74,9 +74,9 @@ checksum = "6fe2267d4ed49bc07b63801559be28c718ea06c4738b7a03c94df7386d2cde46" [[package]] name = "multiversx-sc" -version = "0.53.0" +version = "0.53.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2a86a27b04bb7cca97ad8971ee57e6b978619623dde4ba9acae1d4ecb436f062" +checksum = "e05f8dfb9c2dd26feff1330b1e229f0886f5c0228ed570f19421a458e6e7b0ef" dependencies = [ "bitflags", "hex-literal", @@ -111,9 +111,9 @@ dependencies = [ [[package]] name = "multiversx-sc-derive" -version = "0.53.0" +version = "0.53.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f7a6ee275d6b1c2b86394369df0bc62a3f25018cbab12668a191b89d88fdcf71" +checksum = "f4b5176aa94b5e422e0d3c904492e0de0ae8381f166b563fbcac19a9ca4b28bc" dependencies = [ "hex", "proc-macro2", @@ -124,18 +124,18 @@ dependencies = [ [[package]] name = "multiversx-sc-modules" -version = "0.53.0" +version = "0.53.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fece2308326cc59c53fedd682259625e8ecc306e4c3b35051725ca388677b47b" +checksum = "3cfb6046ec3cc6ef94351b4ca89907b2b74b2e4a7f376adc0af18ddd1c5a4367" dependencies = [ "multiversx-sc", ] [[package]] name = "multiversx-sc-wasm-adapter" -version = "0.53.0" +version = "0.53.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0ab5bb42b3ce827227a5e38f3c24fbe0fb23d475425b049043e193186e36c590" +checksum = "9aa0cbd543872f94b9bc98c4ce7c3ed25a7257e1425295af9036eba44893bdaa" dependencies = [ "multiversx-sc", ] diff --git a/chain-factory/wasm/Cargo.toml b/chain-factory/wasm/Cargo.toml index acd7dbdf..da4b60be 100644 --- a/chain-factory/wasm/Cargo.toml +++ b/chain-factory/wasm/Cargo.toml @@ -28,7 +28,7 @@ panic = "abort" path = ".." [dependencies.multiversx-sc-wasm-adapter] -version = "=0.53.0" +version = "=0.53.1" [workspace] members = ["."] diff --git a/common/bls-signature/Cargo.toml b/common/bls-signature/Cargo.toml index 2191447e..d82386b8 100644 --- a/common/bls-signature/Cargo.toml +++ b/common/bls-signature/Cargo.toml @@ -5,10 +5,10 @@ authors = ["dorin-iancu "] edition = "2018" [dependencies.multiversx-sc] -version = "=0.53.0" +version = "=0.53.1" [dependencies.transaction] path = "../transaction" [dev-dependencies.multiversx-sc-scenario] -version = "=0.53.0" +version = "=0.53.1" diff --git a/common/max-bridged-amount-module/Cargo.toml b/common/max-bridged-amount-module/Cargo.toml index bf7ff1b8..b3b13d94 100644 --- a/common/max-bridged-amount-module/Cargo.toml +++ b/common/max-bridged-amount-module/Cargo.toml @@ -5,7 +5,7 @@ authors = ["dorin-iancu "] edition = "2018" [dependencies.multiversx-sc] -version = "=0.53.0" +version = "=0.53.1" [dev-dependencies.multiversx-sc-scenario] -version = "=0.53.0" +version = "=0.53.1" diff --git a/common/setup-phase/Cargo.toml b/common/setup-phase/Cargo.toml index 66afa678..7d90b854 100644 --- a/common/setup-phase/Cargo.toml +++ b/common/setup-phase/Cargo.toml @@ -5,7 +5,7 @@ authors = ["dorin-iancu "] edition = "2018" [dependencies.multiversx-sc] -version = "=0.53.0" +version = "=0.53.1" [dev-dependencies.multiversx-sc-scenario] -version = "=0.53.0" +version = "=0.53.1" diff --git a/common/token-whitelist/Cargo.toml b/common/token-whitelist/Cargo.toml index 9f7fb637..47706a54 100644 --- a/common/token-whitelist/Cargo.toml +++ b/common/token-whitelist/Cargo.toml @@ -14,7 +14,7 @@ path = "../setup-phase" path = "../utils" [dependencies.multiversx-sc] -version = "=0.53.0" +version = "=0.53.1" [dev-dependencies.multiversx-sc-scenario] -version = "=0.53.0" +version = "=0.53.1" diff --git a/common/transaction/Cargo.toml b/common/transaction/Cargo.toml index e8a91e96..38641b06 100644 --- a/common/transaction/Cargo.toml +++ b/common/transaction/Cargo.toml @@ -8,4 +8,4 @@ edition = "2018" path = "src/lib.rs" [dependencies.multiversx-sc] -version = "=0.53.0" +version = "=0.53.1" diff --git a/common/tx-batch-module/Cargo.toml b/common/tx-batch-module/Cargo.toml index 1e0a090b..e85dee7f 100644 --- a/common/tx-batch-module/Cargo.toml +++ b/common/tx-batch-module/Cargo.toml @@ -5,10 +5,10 @@ authors = ["dorin-iancu "] edition = "2018" [dependencies.multiversx-sc] -version = "=0.53.0" +version = "=0.53.1" [dependencies.transaction] path = "../transaction" [dev-dependencies.multiversx-sc-scenario] -version = "=0.53.0" +version = "=0.53.1" diff --git a/common/utils/Cargo.toml b/common/utils/Cargo.toml index 76df98fc..3e546289 100644 --- a/common/utils/Cargo.toml +++ b/common/utils/Cargo.toml @@ -11,5 +11,5 @@ path = "src/lib.rs" path = "../bls-signature" [dependencies.multiversx-sc] -version = "=0.53.0" +version = "=0.53.1" features = ["esdt-token-payment-legacy-decode"] diff --git a/enshrine-esdt-safe/Cargo.toml b/enshrine-esdt-safe/Cargo.toml index 4af11bf6..df826198 100644 --- a/enshrine-esdt-safe/Cargo.toml +++ b/enshrine-esdt-safe/Cargo.toml @@ -39,10 +39,10 @@ path = "../header-verifier" path = "../token-handler" [dependencies.multiversx-sc] -version = "=0.53.0" +version = "=0.53.1" [dependencies.multiversx-sc-modules] -version = "=0.53.0" +version = "=0.53.1" [dev-dependencies] num-bigint = "0.4.2" @@ -50,4 +50,4 @@ num-traits = "0.2" hex = "0.4" [dev-dependencies.multiversx-sc-scenario] -version = "=0.53.0" +version = "=0.53.1" diff --git a/enshrine-esdt-safe/meta/Cargo.toml b/enshrine-esdt-safe/meta/Cargo.toml index 5ab95868..e3554570 100644 --- a/enshrine-esdt-safe/meta/Cargo.toml +++ b/enshrine-esdt-safe/meta/Cargo.toml @@ -8,5 +8,5 @@ publish = false path = ".." [dependencies.multiversx-sc-meta-lib] -version = "0.53.0" +version = "0.53.1" default-features = false diff --git a/enshrine-esdt-safe/wasm-enshrine-esdt-safe-full/Cargo.lock b/enshrine-esdt-safe/wasm-enshrine-esdt-safe-full/Cargo.lock index d5734d1d..5f3c36f5 100644 --- a/enshrine-esdt-safe/wasm-enshrine-esdt-safe-full/Cargo.lock +++ b/enshrine-esdt-safe/wasm-enshrine-esdt-safe-full/Cargo.lock @@ -118,9 +118,9 @@ dependencies = [ [[package]] name = "multiversx-sc" -version = "0.53.0" +version = "0.53.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2a86a27b04bb7cca97ad8971ee57e6b978619623dde4ba9acae1d4ecb436f062" +checksum = "e05f8dfb9c2dd26feff1330b1e229f0886f5c0228ed570f19421a458e6e7b0ef" dependencies = [ "bitflags", "hex-literal", @@ -155,9 +155,9 @@ dependencies = [ [[package]] name = "multiversx-sc-derive" -version = "0.53.0" +version = "0.53.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f7a6ee275d6b1c2b86394369df0bc62a3f25018cbab12668a191b89d88fdcf71" +checksum = "f4b5176aa94b5e422e0d3c904492e0de0ae8381f166b563fbcac19a9ca4b28bc" dependencies = [ "hex", "proc-macro2", @@ -168,18 +168,18 @@ dependencies = [ [[package]] name = "multiversx-sc-modules" -version = "0.53.0" +version = "0.53.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fece2308326cc59c53fedd682259625e8ecc306e4c3b35051725ca388677b47b" +checksum = "3cfb6046ec3cc6ef94351b4ca89907b2b74b2e4a7f376adc0af18ddd1c5a4367" dependencies = [ "multiversx-sc", ] [[package]] name = "multiversx-sc-wasm-adapter" -version = "0.53.0" +version = "0.53.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0ab5bb42b3ce827227a5e38f3c24fbe0fb23d475425b049043e193186e36c590" +checksum = "9aa0cbd543872f94b9bc98c4ce7c3ed25a7257e1425295af9036eba44893bdaa" dependencies = [ "multiversx-sc", ] diff --git a/enshrine-esdt-safe/wasm-enshrine-esdt-safe-full/Cargo.toml b/enshrine-esdt-safe/wasm-enshrine-esdt-safe-full/Cargo.toml index 33313e4e..b2c0bb98 100644 --- a/enshrine-esdt-safe/wasm-enshrine-esdt-safe-full/Cargo.toml +++ b/enshrine-esdt-safe/wasm-enshrine-esdt-safe-full/Cargo.toml @@ -28,7 +28,7 @@ panic = "abort" path = ".." [dependencies.multiversx-sc-wasm-adapter] -version = "=0.53.0" +version = "=0.53.1" [workspace] members = ["."] diff --git a/enshrine-esdt-safe/wasm-enshrine-esdt-safe-view/Cargo.lock b/enshrine-esdt-safe/wasm-enshrine-esdt-safe-view/Cargo.lock index 2cde551e..e8624f6e 100644 --- a/enshrine-esdt-safe/wasm-enshrine-esdt-safe-view/Cargo.lock +++ b/enshrine-esdt-safe/wasm-enshrine-esdt-safe-view/Cargo.lock @@ -118,9 +118,9 @@ dependencies = [ [[package]] name = "multiversx-sc" -version = "0.53.0" +version = "0.53.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2a86a27b04bb7cca97ad8971ee57e6b978619623dde4ba9acae1d4ecb436f062" +checksum = "e05f8dfb9c2dd26feff1330b1e229f0886f5c0228ed570f19421a458e6e7b0ef" dependencies = [ "bitflags", "hex-literal", @@ -155,9 +155,9 @@ dependencies = [ [[package]] name = "multiversx-sc-derive" -version = "0.53.0" +version = "0.53.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f7a6ee275d6b1c2b86394369df0bc62a3f25018cbab12668a191b89d88fdcf71" +checksum = "f4b5176aa94b5e422e0d3c904492e0de0ae8381f166b563fbcac19a9ca4b28bc" dependencies = [ "hex", "proc-macro2", @@ -168,18 +168,18 @@ dependencies = [ [[package]] name = "multiversx-sc-modules" -version = "0.53.0" +version = "0.53.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fece2308326cc59c53fedd682259625e8ecc306e4c3b35051725ca388677b47b" +checksum = "3cfb6046ec3cc6ef94351b4ca89907b2b74b2e4a7f376adc0af18ddd1c5a4367" dependencies = [ "multiversx-sc", ] [[package]] name = "multiversx-sc-wasm-adapter" -version = "0.53.0" +version = "0.53.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0ab5bb42b3ce827227a5e38f3c24fbe0fb23d475425b049043e193186e36c590" +checksum = "9aa0cbd543872f94b9bc98c4ce7c3ed25a7257e1425295af9036eba44893bdaa" dependencies = [ "multiversx-sc", ] diff --git a/enshrine-esdt-safe/wasm-enshrine-esdt-safe-view/Cargo.toml b/enshrine-esdt-safe/wasm-enshrine-esdt-safe-view/Cargo.toml index 803a9e8b..20369a4d 100644 --- a/enshrine-esdt-safe/wasm-enshrine-esdt-safe-view/Cargo.toml +++ b/enshrine-esdt-safe/wasm-enshrine-esdt-safe-view/Cargo.toml @@ -28,7 +28,7 @@ panic = "abort" path = ".." [dependencies.multiversx-sc-wasm-adapter] -version = "=0.53.0" +version = "=0.53.1" [workspace] members = ["."] diff --git a/enshrine-esdt-safe/wasm/Cargo.lock b/enshrine-esdt-safe/wasm/Cargo.lock index b360541c..2fa94a69 100644 --- a/enshrine-esdt-safe/wasm/Cargo.lock +++ b/enshrine-esdt-safe/wasm/Cargo.lock @@ -118,9 +118,9 @@ dependencies = [ [[package]] name = "multiversx-sc" -version = "0.53.0" +version = "0.53.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2a86a27b04bb7cca97ad8971ee57e6b978619623dde4ba9acae1d4ecb436f062" +checksum = "e05f8dfb9c2dd26feff1330b1e229f0886f5c0228ed570f19421a458e6e7b0ef" dependencies = [ "bitflags", "hex-literal", @@ -155,9 +155,9 @@ dependencies = [ [[package]] name = "multiversx-sc-derive" -version = "0.53.0" +version = "0.53.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f7a6ee275d6b1c2b86394369df0bc62a3f25018cbab12668a191b89d88fdcf71" +checksum = "f4b5176aa94b5e422e0d3c904492e0de0ae8381f166b563fbcac19a9ca4b28bc" dependencies = [ "hex", "proc-macro2", @@ -168,18 +168,18 @@ dependencies = [ [[package]] name = "multiversx-sc-modules" -version = "0.53.0" +version = "0.53.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fece2308326cc59c53fedd682259625e8ecc306e4c3b35051725ca388677b47b" +checksum = "3cfb6046ec3cc6ef94351b4ca89907b2b74b2e4a7f376adc0af18ddd1c5a4367" dependencies = [ "multiversx-sc", ] [[package]] name = "multiversx-sc-wasm-adapter" -version = "0.53.0" +version = "0.53.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0ab5bb42b3ce827227a5e38f3c24fbe0fb23d475425b049043e193186e36c590" +checksum = "9aa0cbd543872f94b9bc98c4ce7c3ed25a7257e1425295af9036eba44893bdaa" dependencies = [ "multiversx-sc", ] diff --git a/enshrine-esdt-safe/wasm/Cargo.toml b/enshrine-esdt-safe/wasm/Cargo.toml index 83bf78ef..8edc5c62 100644 --- a/enshrine-esdt-safe/wasm/Cargo.toml +++ b/enshrine-esdt-safe/wasm/Cargo.toml @@ -28,7 +28,7 @@ panic = "abort" path = ".." [dependencies.multiversx-sc-wasm-adapter] -version = "=0.53.0" +version = "=0.53.1" [workspace] members = ["."] diff --git a/esdt-safe/Cargo.toml b/esdt-safe/Cargo.toml index c089a976..0446986a 100644 --- a/esdt-safe/Cargo.toml +++ b/esdt-safe/Cargo.toml @@ -36,10 +36,10 @@ path = "../fee-market" path = "../header-verifier" [dependencies.multiversx-sc] -version = "=0.53.0" +version = "=0.53.1" [dependencies.multiversx-sc-modules] -version = "=0.53.0" +version = "=0.53.1" [dev-dependencies] num-bigint = "0.4.2" @@ -47,4 +47,4 @@ num-traits = "0.2" hex = "0.4" [dev-dependencies.multiversx-sc-scenario] -version = "=0.53.0" +version = "=0.53.1" diff --git a/esdt-safe/meta/Cargo.toml b/esdt-safe/meta/Cargo.toml index 66439304..e01c2c40 100644 --- a/esdt-safe/meta/Cargo.toml +++ b/esdt-safe/meta/Cargo.toml @@ -11,4 +11,4 @@ publish = false path = ".." [dependencies.multiversx-sc-meta-lib] -version = "=0.53.0" +version = "=0.53.1" diff --git a/esdt-safe/wasm-esdt-safe-full/Cargo.lock b/esdt-safe/wasm-esdt-safe-full/Cargo.lock index 033da2d0..ef2e581d 100644 --- a/esdt-safe/wasm-esdt-safe-full/Cargo.lock +++ b/esdt-safe/wasm-esdt-safe-full/Cargo.lock @@ -99,9 +99,9 @@ dependencies = [ [[package]] name = "multiversx-sc" -version = "0.53.0" +version = "0.53.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2a86a27b04bb7cca97ad8971ee57e6b978619623dde4ba9acae1d4ecb436f062" +checksum = "e05f8dfb9c2dd26feff1330b1e229f0886f5c0228ed570f19421a458e6e7b0ef" dependencies = [ "bitflags", "hex-literal", @@ -136,9 +136,9 @@ dependencies = [ [[package]] name = "multiversx-sc-derive" -version = "0.53.0" +version = "0.53.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f7a6ee275d6b1c2b86394369df0bc62a3f25018cbab12668a191b89d88fdcf71" +checksum = "f4b5176aa94b5e422e0d3c904492e0de0ae8381f166b563fbcac19a9ca4b28bc" dependencies = [ "hex", "proc-macro2", @@ -149,18 +149,18 @@ dependencies = [ [[package]] name = "multiversx-sc-modules" -version = "0.53.0" +version = "0.53.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fece2308326cc59c53fedd682259625e8ecc306e4c3b35051725ca388677b47b" +checksum = "3cfb6046ec3cc6ef94351b4ca89907b2b74b2e4a7f376adc0af18ddd1c5a4367" dependencies = [ "multiversx-sc", ] [[package]] name = "multiversx-sc-wasm-adapter" -version = "0.53.0" +version = "0.53.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0ab5bb42b3ce827227a5e38f3c24fbe0fb23d475425b049043e193186e36c590" +checksum = "9aa0cbd543872f94b9bc98c4ce7c3ed25a7257e1425295af9036eba44893bdaa" dependencies = [ "multiversx-sc", ] diff --git a/esdt-safe/wasm-esdt-safe-full/Cargo.toml b/esdt-safe/wasm-esdt-safe-full/Cargo.toml index d7a38dde..135d06a4 100644 --- a/esdt-safe/wasm-esdt-safe-full/Cargo.toml +++ b/esdt-safe/wasm-esdt-safe-full/Cargo.toml @@ -28,7 +28,7 @@ panic = "abort" path = ".." [dependencies.multiversx-sc-wasm-adapter] -version = "=0.53.0" +version = "=0.53.1" [workspace] members = ["."] diff --git a/esdt-safe/wasm-esdt-safe-view/Cargo.lock b/esdt-safe/wasm-esdt-safe-view/Cargo.lock index 93bb6f82..4073ba2a 100644 --- a/esdt-safe/wasm-esdt-safe-view/Cargo.lock +++ b/esdt-safe/wasm-esdt-safe-view/Cargo.lock @@ -99,9 +99,9 @@ dependencies = [ [[package]] name = "multiversx-sc" -version = "0.53.0" +version = "0.53.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2a86a27b04bb7cca97ad8971ee57e6b978619623dde4ba9acae1d4ecb436f062" +checksum = "e05f8dfb9c2dd26feff1330b1e229f0886f5c0228ed570f19421a458e6e7b0ef" dependencies = [ "bitflags", "hex-literal", @@ -136,9 +136,9 @@ dependencies = [ [[package]] name = "multiversx-sc-derive" -version = "0.53.0" +version = "0.53.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f7a6ee275d6b1c2b86394369df0bc62a3f25018cbab12668a191b89d88fdcf71" +checksum = "f4b5176aa94b5e422e0d3c904492e0de0ae8381f166b563fbcac19a9ca4b28bc" dependencies = [ "hex", "proc-macro2", @@ -149,18 +149,18 @@ dependencies = [ [[package]] name = "multiversx-sc-modules" -version = "0.53.0" +version = "0.53.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fece2308326cc59c53fedd682259625e8ecc306e4c3b35051725ca388677b47b" +checksum = "3cfb6046ec3cc6ef94351b4ca89907b2b74b2e4a7f376adc0af18ddd1c5a4367" dependencies = [ "multiversx-sc", ] [[package]] name = "multiversx-sc-wasm-adapter" -version = "0.53.0" +version = "0.53.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0ab5bb42b3ce827227a5e38f3c24fbe0fb23d475425b049043e193186e36c590" +checksum = "9aa0cbd543872f94b9bc98c4ce7c3ed25a7257e1425295af9036eba44893bdaa" dependencies = [ "multiversx-sc", ] diff --git a/esdt-safe/wasm-esdt-safe-view/Cargo.toml b/esdt-safe/wasm-esdt-safe-view/Cargo.toml index e5e1aea7..72e8e214 100644 --- a/esdt-safe/wasm-esdt-safe-view/Cargo.toml +++ b/esdt-safe/wasm-esdt-safe-view/Cargo.toml @@ -28,7 +28,7 @@ panic = "abort" path = ".." [dependencies.multiversx-sc-wasm-adapter] -version = "=0.53.0" +version = "=0.53.1" [workspace] members = ["."] diff --git a/esdt-safe/wasm/Cargo.lock b/esdt-safe/wasm/Cargo.lock index 581b427f..0b6a5ce7 100644 --- a/esdt-safe/wasm/Cargo.lock +++ b/esdt-safe/wasm/Cargo.lock @@ -99,9 +99,9 @@ dependencies = [ [[package]] name = "multiversx-sc" -version = "0.53.0" +version = "0.53.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2a86a27b04bb7cca97ad8971ee57e6b978619623dde4ba9acae1d4ecb436f062" +checksum = "e05f8dfb9c2dd26feff1330b1e229f0886f5c0228ed570f19421a458e6e7b0ef" dependencies = [ "bitflags", "hex-literal", @@ -136,9 +136,9 @@ dependencies = [ [[package]] name = "multiversx-sc-derive" -version = "0.53.0" +version = "0.53.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f7a6ee275d6b1c2b86394369df0bc62a3f25018cbab12668a191b89d88fdcf71" +checksum = "f4b5176aa94b5e422e0d3c904492e0de0ae8381f166b563fbcac19a9ca4b28bc" dependencies = [ "hex", "proc-macro2", @@ -149,18 +149,18 @@ dependencies = [ [[package]] name = "multiversx-sc-modules" -version = "0.53.0" +version = "0.53.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fece2308326cc59c53fedd682259625e8ecc306e4c3b35051725ca388677b47b" +checksum = "3cfb6046ec3cc6ef94351b4ca89907b2b74b2e4a7f376adc0af18ddd1c5a4367" dependencies = [ "multiversx-sc", ] [[package]] name = "multiversx-sc-wasm-adapter" -version = "0.53.0" +version = "0.53.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0ab5bb42b3ce827227a5e38f3c24fbe0fb23d475425b049043e193186e36c590" +checksum = "9aa0cbd543872f94b9bc98c4ce7c3ed25a7257e1425295af9036eba44893bdaa" dependencies = [ "multiversx-sc", ] diff --git a/esdt-safe/wasm/Cargo.toml b/esdt-safe/wasm/Cargo.toml index a656a808..6d4995dd 100644 --- a/esdt-safe/wasm/Cargo.toml +++ b/esdt-safe/wasm/Cargo.toml @@ -28,7 +28,7 @@ panic = "abort" path = ".." [dependencies.multiversx-sc-wasm-adapter] -version = "=0.53.0" +version = "=0.53.1" [workspace] members = ["."] diff --git a/fee-market/Cargo.toml b/fee-market/Cargo.toml index 3ddd705f..eca63495 100644 --- a/fee-market/Cargo.toml +++ b/fee-market/Cargo.toml @@ -18,10 +18,10 @@ path = "../common/transaction" path = "../common/bls-signature" [dependencies.multiversx-sc] -version = "=0.53.0" +version = "=0.53.1" [dev-dependencies] num-bigint = "0.4.2" [dev-dependencies.multiversx-sc-scenario] -version = "=0.53.0" +version = "=0.53.1" diff --git a/fee-market/meta/Cargo.toml b/fee-market/meta/Cargo.toml index 605e19b9..28f67f70 100644 --- a/fee-market/meta/Cargo.toml +++ b/fee-market/meta/Cargo.toml @@ -8,5 +8,5 @@ publish = false path = ".." [dependencies.multiversx-sc-meta-lib] -version = "=0.53.0" +version = "=0.53.1" default-features = false diff --git a/fee-market/wasm-fee-marker-full/Cargo.lock b/fee-market/wasm-fee-marker-full/Cargo.lock index 047ada14..d9c9d464 100644 --- a/fee-market/wasm-fee-marker-full/Cargo.lock +++ b/fee-market/wasm-fee-marker-full/Cargo.lock @@ -66,9 +66,9 @@ checksum = "6fe2267d4ed49bc07b63801559be28c718ea06c4738b7a03c94df7386d2cde46" [[package]] name = "multiversx-sc" -version = "0.53.0" +version = "0.53.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2a86a27b04bb7cca97ad8971ee57e6b978619623dde4ba9acae1d4ecb436f062" +checksum = "e05f8dfb9c2dd26feff1330b1e229f0886f5c0228ed570f19421a458e6e7b0ef" dependencies = [ "bitflags", "hex-literal", @@ -103,9 +103,9 @@ dependencies = [ [[package]] name = "multiversx-sc-derive" -version = "0.53.0" +version = "0.53.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f7a6ee275d6b1c2b86394369df0bc62a3f25018cbab12668a191b89d88fdcf71" +checksum = "f4b5176aa94b5e422e0d3c904492e0de0ae8381f166b563fbcac19a9ca4b28bc" dependencies = [ "hex", "proc-macro2", @@ -116,9 +116,9 @@ dependencies = [ [[package]] name = "multiversx-sc-wasm-adapter" -version = "0.53.0" +version = "0.53.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0ab5bb42b3ce827227a5e38f3c24fbe0fb23d475425b049043e193186e36c590" +checksum = "9aa0cbd543872f94b9bc98c4ce7c3ed25a7257e1425295af9036eba44893bdaa" dependencies = [ "multiversx-sc", ] diff --git a/fee-market/wasm-fee-marker-full/Cargo.toml b/fee-market/wasm-fee-marker-full/Cargo.toml index 05f8f890..9bef5fca 100644 --- a/fee-market/wasm-fee-marker-full/Cargo.toml +++ b/fee-market/wasm-fee-marker-full/Cargo.toml @@ -28,7 +28,7 @@ panic = "abort" path = ".." [dependencies.multiversx-sc-wasm-adapter] -version = "=0.53.0" +version = "=0.53.1" [workspace] members = ["."] diff --git a/fee-market/wasm-multisig-view/Cargo.lock b/fee-market/wasm-multisig-view/Cargo.lock index 106db055..c6ba5733 100644 --- a/fee-market/wasm-multisig-view/Cargo.lock +++ b/fee-market/wasm-multisig-view/Cargo.lock @@ -66,9 +66,9 @@ dependencies = [ [[package]] name = "multiversx-sc" -version = "0.53.0" +version = "0.53.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2a86a27b04bb7cca97ad8971ee57e6b978619623dde4ba9acae1d4ecb436f062" +checksum = "e05f8dfb9c2dd26feff1330b1e229f0886f5c0228ed570f19421a458e6e7b0ef" dependencies = [ "bitflags", "hex-literal", @@ -103,9 +103,9 @@ dependencies = [ [[package]] name = "multiversx-sc-derive" -version = "0.53.0" +version = "0.53.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f7a6ee275d6b1c2b86394369df0bc62a3f25018cbab12668a191b89d88fdcf71" +checksum = "f4b5176aa94b5e422e0d3c904492e0de0ae8381f166b563fbcac19a9ca4b28bc" dependencies = [ "hex", "proc-macro2", @@ -116,9 +116,9 @@ dependencies = [ [[package]] name = "multiversx-sc-wasm-adapter" -version = "0.53.0" +version = "0.53.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0ab5bb42b3ce827227a5e38f3c24fbe0fb23d475425b049043e193186e36c590" +checksum = "9aa0cbd543872f94b9bc98c4ce7c3ed25a7257e1425295af9036eba44893bdaa" dependencies = [ "multiversx-sc", ] diff --git a/fee-market/wasm-multisig-view/Cargo.toml b/fee-market/wasm-multisig-view/Cargo.toml index 347109b0..de4d4718 100644 --- a/fee-market/wasm-multisig-view/Cargo.toml +++ b/fee-market/wasm-multisig-view/Cargo.toml @@ -28,7 +28,7 @@ panic = "abort" path = ".." [dependencies.multiversx-sc-wasm-adapter] -version = "=0.53.0" +version = "=0.53.1" [workspace] members = ["."] diff --git a/fee-market/wasm/Cargo.lock b/fee-market/wasm/Cargo.lock index a9194490..9cfc7c0f 100644 --- a/fee-market/wasm/Cargo.lock +++ b/fee-market/wasm/Cargo.lock @@ -66,9 +66,9 @@ checksum = "6fe2267d4ed49bc07b63801559be28c718ea06c4738b7a03c94df7386d2cde46" [[package]] name = "multiversx-sc" -version = "0.53.0" +version = "0.53.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2a86a27b04bb7cca97ad8971ee57e6b978619623dde4ba9acae1d4ecb436f062" +checksum = "e05f8dfb9c2dd26feff1330b1e229f0886f5c0228ed570f19421a458e6e7b0ef" dependencies = [ "bitflags", "hex-literal", @@ -103,9 +103,9 @@ dependencies = [ [[package]] name = "multiversx-sc-derive" -version = "0.53.0" +version = "0.53.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f7a6ee275d6b1c2b86394369df0bc62a3f25018cbab12668a191b89d88fdcf71" +checksum = "f4b5176aa94b5e422e0d3c904492e0de0ae8381f166b563fbcac19a9ca4b28bc" dependencies = [ "hex", "proc-macro2", @@ -116,9 +116,9 @@ dependencies = [ [[package]] name = "multiversx-sc-wasm-adapter" -version = "0.53.0" +version = "0.53.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0ab5bb42b3ce827227a5e38f3c24fbe0fb23d475425b049043e193186e36c590" +checksum = "9aa0cbd543872f94b9bc98c4ce7c3ed25a7257e1425295af9036eba44893bdaa" dependencies = [ "multiversx-sc", ] diff --git a/fee-market/wasm/Cargo.toml b/fee-market/wasm/Cargo.toml index 11cd4d4c..537b7554 100644 --- a/fee-market/wasm/Cargo.toml +++ b/fee-market/wasm/Cargo.toml @@ -28,7 +28,7 @@ panic = "abort" path = ".." [dependencies.multiversx-sc-wasm-adapter] -version = "=0.53.0" +version = "=0.53.1" [workspace] members = ["."] diff --git a/header-verifier/Cargo.toml b/header-verifier/Cargo.toml index 8aa18a42..59ab99ce 100644 --- a/header-verifier/Cargo.toml +++ b/header-verifier/Cargo.toml @@ -9,7 +9,7 @@ publish = false path = "src/lib.rs" [dependencies.multiversx-sc] -version = "0.53.0" +version = "0.53.1" [dependencies.bls-signature] path = "../common/bls-signature" @@ -21,4 +21,4 @@ path = "../common/transaction" num-bigint = "0.4.2" [dev-dependencies.multiversx-sc-scenario] -version = "0.53.0" +version = "0.53.1" diff --git a/header-verifier/meta/Cargo.toml b/header-verifier/meta/Cargo.toml index ed1949b9..28c50118 100644 --- a/header-verifier/meta/Cargo.toml +++ b/header-verifier/meta/Cargo.toml @@ -8,5 +8,5 @@ publish = false path = ".." [dependencies.multiversx-sc-meta-lib] -version = "0.53.0" +version = "0.53.1" default-features = false diff --git a/header-verifier/wasm-header-verifier-full/Cargo.lock b/header-verifier/wasm-header-verifier-full/Cargo.lock index b5f001af..bca57c41 100644 --- a/header-verifier/wasm-header-verifier-full/Cargo.lock +++ b/header-verifier/wasm-header-verifier-full/Cargo.lock @@ -65,9 +65,9 @@ checksum = "6fe2267d4ed49bc07b63801559be28c718ea06c4738b7a03c94df7386d2cde46" [[package]] name = "multiversx-sc" -version = "0.53.0" +version = "0.53.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2a86a27b04bb7cca97ad8971ee57e6b978619623dde4ba9acae1d4ecb436f062" +checksum = "e05f8dfb9c2dd26feff1330b1e229f0886f5c0228ed570f19421a458e6e7b0ef" dependencies = [ "bitflags", "hex-literal", @@ -102,9 +102,9 @@ dependencies = [ [[package]] name = "multiversx-sc-derive" -version = "0.53.0" +version = "0.53.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f7a6ee275d6b1c2b86394369df0bc62a3f25018cbab12668a191b89d88fdcf71" +checksum = "f4b5176aa94b5e422e0d3c904492e0de0ae8381f166b563fbcac19a9ca4b28bc" dependencies = [ "hex", "proc-macro2", @@ -115,9 +115,9 @@ dependencies = [ [[package]] name = "multiversx-sc-wasm-adapter" -version = "0.53.0" +version = "0.53.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0ab5bb42b3ce827227a5e38f3c24fbe0fb23d475425b049043e193186e36c590" +checksum = "9aa0cbd543872f94b9bc98c4ce7c3ed25a7257e1425295af9036eba44893bdaa" dependencies = [ "multiversx-sc", ] diff --git a/header-verifier/wasm-header-verifier-full/Cargo.toml b/header-verifier/wasm-header-verifier-full/Cargo.toml index 844daf89..f4de6c91 100644 --- a/header-verifier/wasm-header-verifier-full/Cargo.toml +++ b/header-verifier/wasm-header-verifier-full/Cargo.toml @@ -28,7 +28,7 @@ panic = "abort" path = ".." [dependencies.multiversx-sc-wasm-adapter] -version = "0.53.0" +version = "0.53.1" [workspace] members = ["."] diff --git a/header-verifier/wasm-multisig-view/Cargo.lock b/header-verifier/wasm-multisig-view/Cargo.lock index 11054e22..06233ac3 100644 --- a/header-verifier/wasm-multisig-view/Cargo.lock +++ b/header-verifier/wasm-multisig-view/Cargo.lock @@ -65,9 +65,9 @@ dependencies = [ [[package]] name = "multiversx-sc" -version = "0.53.0" +version = "0.53.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2a86a27b04bb7cca97ad8971ee57e6b978619623dde4ba9acae1d4ecb436f062" +checksum = "e05f8dfb9c2dd26feff1330b1e229f0886f5c0228ed570f19421a458e6e7b0ef" dependencies = [ "bitflags", "hex-literal", @@ -102,9 +102,9 @@ dependencies = [ [[package]] name = "multiversx-sc-derive" -version = "0.53.0" +version = "0.53.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f7a6ee275d6b1c2b86394369df0bc62a3f25018cbab12668a191b89d88fdcf71" +checksum = "f4b5176aa94b5e422e0d3c904492e0de0ae8381f166b563fbcac19a9ca4b28bc" dependencies = [ "hex", "proc-macro2", @@ -115,9 +115,9 @@ dependencies = [ [[package]] name = "multiversx-sc-wasm-adapter" -version = "0.53.0" +version = "0.53.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0ab5bb42b3ce827227a5e38f3c24fbe0fb23d475425b049043e193186e36c590" +checksum = "9aa0cbd543872f94b9bc98c4ce7c3ed25a7257e1425295af9036eba44893bdaa" dependencies = [ "multiversx-sc", ] diff --git a/header-verifier/wasm-multisig-view/Cargo.toml b/header-verifier/wasm-multisig-view/Cargo.toml index 02396926..e99867bb 100644 --- a/header-verifier/wasm-multisig-view/Cargo.toml +++ b/header-verifier/wasm-multisig-view/Cargo.toml @@ -28,7 +28,7 @@ panic = "abort" path = ".." [dependencies.multiversx-sc-wasm-adapter] -version = "0.53.0" +version = "0.53.1" [workspace] members = ["."] diff --git a/header-verifier/wasm/Cargo.lock b/header-verifier/wasm/Cargo.lock index bd5315a4..361892b4 100644 --- a/header-verifier/wasm/Cargo.lock +++ b/header-verifier/wasm/Cargo.lock @@ -65,9 +65,9 @@ checksum = "6fe2267d4ed49bc07b63801559be28c718ea06c4738b7a03c94df7386d2cde46" [[package]] name = "multiversx-sc" -version = "0.53.0" +version = "0.53.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2a86a27b04bb7cca97ad8971ee57e6b978619623dde4ba9acae1d4ecb436f062" +checksum = "e05f8dfb9c2dd26feff1330b1e229f0886f5c0228ed570f19421a458e6e7b0ef" dependencies = [ "bitflags", "hex-literal", @@ -102,9 +102,9 @@ dependencies = [ [[package]] name = "multiversx-sc-derive" -version = "0.53.0" +version = "0.53.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f7a6ee275d6b1c2b86394369df0bc62a3f25018cbab12668a191b89d88fdcf71" +checksum = "f4b5176aa94b5e422e0d3c904492e0de0ae8381f166b563fbcac19a9ca4b28bc" dependencies = [ "hex", "proc-macro2", @@ -115,9 +115,9 @@ dependencies = [ [[package]] name = "multiversx-sc-wasm-adapter" -version = "0.53.0" +version = "0.53.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0ab5bb42b3ce827227a5e38f3c24fbe0fb23d475425b049043e193186e36c590" +checksum = "9aa0cbd543872f94b9bc98c4ce7c3ed25a7257e1425295af9036eba44893bdaa" dependencies = [ "multiversx-sc", ] diff --git a/header-verifier/wasm/Cargo.toml b/header-verifier/wasm/Cargo.toml index 739674f5..e38bcab7 100644 --- a/header-verifier/wasm/Cargo.toml +++ b/header-verifier/wasm/Cargo.toml @@ -28,7 +28,7 @@ panic = "abort" path = ".." [dependencies.multiversx-sc-wasm-adapter] -version = "0.53.0" +version = "0.53.1" [workspace] members = ["."] diff --git a/token-handler/Cargo.toml b/token-handler/Cargo.toml index 45280b46..f3e916a1 100644 --- a/token-handler/Cargo.toml +++ b/token-handler/Cargo.toml @@ -18,10 +18,10 @@ path = "../header-verifier/" path = "../chain-factory/" [dependencies.multiversx-sc] -version = "0.53.0" +version = "0.53.1" [dev-dependencies] num-bigint = "0.4" [dev-dependencies.multiversx-sc-scenario] -version = "0.53.0" +version = "0.53.1" diff --git a/token-handler/meta/Cargo.toml b/token-handler/meta/Cargo.toml index 641f3bb1..c4478431 100644 --- a/token-handler/meta/Cargo.toml +++ b/token-handler/meta/Cargo.toml @@ -8,5 +8,5 @@ publish = false path = ".." [dependencies.multiversx-sc-meta-lib] -version = "0.53.0" +version = "0.53.1" default-features = false diff --git a/token-handler/wasm-token-handler-full/Cargo.lock b/token-handler/wasm-token-handler-full/Cargo.lock index 8e19af57..64ab9511 100644 --- a/token-handler/wasm-token-handler-full/Cargo.lock +++ b/token-handler/wasm-token-handler-full/Cargo.lock @@ -75,9 +75,9 @@ checksum = "6fe2267d4ed49bc07b63801559be28c718ea06c4738b7a03c94df7386d2cde46" [[package]] name = "multiversx-sc" -version = "0.53.0" +version = "0.53.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2a86a27b04bb7cca97ad8971ee57e6b978619623dde4ba9acae1d4ecb436f062" +checksum = "e05f8dfb9c2dd26feff1330b1e229f0886f5c0228ed570f19421a458e6e7b0ef" dependencies = [ "bitflags", "hex-literal", @@ -112,9 +112,9 @@ dependencies = [ [[package]] name = "multiversx-sc-derive" -version = "0.53.0" +version = "0.53.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f7a6ee275d6b1c2b86394369df0bc62a3f25018cbab12668a191b89d88fdcf71" +checksum = "f4b5176aa94b5e422e0d3c904492e0de0ae8381f166b563fbcac19a9ca4b28bc" dependencies = [ "hex", "proc-macro2", @@ -125,18 +125,18 @@ dependencies = [ [[package]] name = "multiversx-sc-modules" -version = "0.53.0" +version = "0.53.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fece2308326cc59c53fedd682259625e8ecc306e4c3b35051725ca388677b47b" +checksum = "3cfb6046ec3cc6ef94351b4ca89907b2b74b2e4a7f376adc0af18ddd1c5a4367" dependencies = [ "multiversx-sc", ] [[package]] name = "multiversx-sc-wasm-adapter" -version = "0.53.0" +version = "0.53.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0ab5bb42b3ce827227a5e38f3c24fbe0fb23d475425b049043e193186e36c590" +checksum = "9aa0cbd543872f94b9bc98c4ce7c3ed25a7257e1425295af9036eba44893bdaa" dependencies = [ "multiversx-sc", ] diff --git a/token-handler/wasm-token-handler-full/Cargo.toml b/token-handler/wasm-token-handler-full/Cargo.toml index 2c5f1a4d..6c9e8221 100644 --- a/token-handler/wasm-token-handler-full/Cargo.toml +++ b/token-handler/wasm-token-handler-full/Cargo.toml @@ -28,7 +28,7 @@ panic = "abort" path = ".." [dependencies.multiversx-sc-wasm-adapter] -version = "0.53.0" +version = "0.53.1" [workspace] members = ["."] diff --git a/token-handler/wasm-token-handler-view/Cargo.lock b/token-handler/wasm-token-handler-view/Cargo.lock index dc9f11d5..2761a4b9 100644 --- a/token-handler/wasm-token-handler-view/Cargo.lock +++ b/token-handler/wasm-token-handler-view/Cargo.lock @@ -75,9 +75,9 @@ checksum = "6fe2267d4ed49bc07b63801559be28c718ea06c4738b7a03c94df7386d2cde46" [[package]] name = "multiversx-sc" -version = "0.53.0" +version = "0.53.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2a86a27b04bb7cca97ad8971ee57e6b978619623dde4ba9acae1d4ecb436f062" +checksum = "e05f8dfb9c2dd26feff1330b1e229f0886f5c0228ed570f19421a458e6e7b0ef" dependencies = [ "bitflags", "hex-literal", @@ -112,9 +112,9 @@ dependencies = [ [[package]] name = "multiversx-sc-derive" -version = "0.53.0" +version = "0.53.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f7a6ee275d6b1c2b86394369df0bc62a3f25018cbab12668a191b89d88fdcf71" +checksum = "f4b5176aa94b5e422e0d3c904492e0de0ae8381f166b563fbcac19a9ca4b28bc" dependencies = [ "hex", "proc-macro2", @@ -125,18 +125,18 @@ dependencies = [ [[package]] name = "multiversx-sc-modules" -version = "0.53.0" +version = "0.53.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fece2308326cc59c53fedd682259625e8ecc306e4c3b35051725ca388677b47b" +checksum = "3cfb6046ec3cc6ef94351b4ca89907b2b74b2e4a7f376adc0af18ddd1c5a4367" dependencies = [ "multiversx-sc", ] [[package]] name = "multiversx-sc-wasm-adapter" -version = "0.53.0" +version = "0.53.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0ab5bb42b3ce827227a5e38f3c24fbe0fb23d475425b049043e193186e36c590" +checksum = "9aa0cbd543872f94b9bc98c4ce7c3ed25a7257e1425295af9036eba44893bdaa" dependencies = [ "multiversx-sc", ] diff --git a/token-handler/wasm-token-handler-view/Cargo.toml b/token-handler/wasm-token-handler-view/Cargo.toml index 6f76e399..411222a7 100644 --- a/token-handler/wasm-token-handler-view/Cargo.toml +++ b/token-handler/wasm-token-handler-view/Cargo.toml @@ -28,7 +28,7 @@ panic = "abort" path = ".." [dependencies.multiversx-sc-wasm-adapter] -version = "0.53.0" +version = "0.53.1" [workspace] members = ["."] diff --git a/token-handler/wasm/Cargo.lock b/token-handler/wasm/Cargo.lock index c0c7759f..a3e476f5 100644 --- a/token-handler/wasm/Cargo.lock +++ b/token-handler/wasm/Cargo.lock @@ -75,9 +75,9 @@ checksum = "6fe2267d4ed49bc07b63801559be28c718ea06c4738b7a03c94df7386d2cde46" [[package]] name = "multiversx-sc" -version = "0.53.0" +version = "0.53.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2a86a27b04bb7cca97ad8971ee57e6b978619623dde4ba9acae1d4ecb436f062" +checksum = "e05f8dfb9c2dd26feff1330b1e229f0886f5c0228ed570f19421a458e6e7b0ef" dependencies = [ "bitflags", "hex-literal", @@ -112,9 +112,9 @@ dependencies = [ [[package]] name = "multiversx-sc-derive" -version = "0.53.0" +version = "0.53.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f7a6ee275d6b1c2b86394369df0bc62a3f25018cbab12668a191b89d88fdcf71" +checksum = "f4b5176aa94b5e422e0d3c904492e0de0ae8381f166b563fbcac19a9ca4b28bc" dependencies = [ "hex", "proc-macro2", @@ -125,18 +125,18 @@ dependencies = [ [[package]] name = "multiversx-sc-modules" -version = "0.53.0" +version = "0.53.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fece2308326cc59c53fedd682259625e8ecc306e4c3b35051725ca388677b47b" +checksum = "3cfb6046ec3cc6ef94351b4ca89907b2b74b2e4a7f376adc0af18ddd1c5a4367" dependencies = [ "multiversx-sc", ] [[package]] name = "multiversx-sc-wasm-adapter" -version = "0.53.0" +version = "0.53.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0ab5bb42b3ce827227a5e38f3c24fbe0fb23d475425b049043e193186e36c590" +checksum = "9aa0cbd543872f94b9bc98c4ce7c3ed25a7257e1425295af9036eba44893bdaa" dependencies = [ "multiversx-sc", ] diff --git a/token-handler/wasm/Cargo.toml b/token-handler/wasm/Cargo.toml index 03d9ecf9..f2f911f3 100644 --- a/token-handler/wasm/Cargo.toml +++ b/token-handler/wasm/Cargo.toml @@ -28,7 +28,7 @@ panic = "abort" path = ".." [dependencies.multiversx-sc-wasm-adapter] -version = "0.53.0" +version = "0.53.1" [workspace] members = ["."] From da2e7288f170968905677a9bdd10c7fd6f856810 Mon Sep 17 00:00:00 2001 From: Andrei Baltariu Date: Wed, 2 Oct 2024 15:28:33 +0300 Subject: [PATCH 350/523] Added more asserts Signed-off-by: Andrei Baltariu --- header-verifier/tests/header_verifier_blackbox_test.rs | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/header-verifier/tests/header_verifier_blackbox_test.rs b/header-verifier/tests/header_verifier_blackbox_test.rs index aea7bcfc..be5d0086 100644 --- a/header-verifier/tests/header_verifier_blackbox_test.rs +++ b/header-verifier/tests/header_verifier_blackbox_test.rs @@ -222,14 +222,22 @@ fn test_register_bridge_operation() { let operation_2 = ManagedBuffer::from("operation_2"); let operation = state.get_mock_operation(vec![&operation_1, &operation_2]); - state.propose_register_operations(operation); + state.propose_register_operations(operation.clone()); state .world .query() .to(HEADER_VERIFIER_ADDRESS) .whitebox(header_verifier::contract_obj, |sc| { + let hash_of_hashes: ManagedBuffer = + ManagedBuffer::from(operation.bridge_operation_hash.to_vec()); + assert!(!sc.hash_of_hashes_history().is_empty()); + assert!(!sc.pending_hashes(&hash_of_hashes).is_empty()); + + for pending_hash in sc.pending_hashes(&hash_of_hashes).iter() { + assert!(!pending_hash.is_empty()); + } }); } From a60a53195b511aae12ff470a0887af119356c219 Mon Sep 17 00:00:00 2001 From: Andrei Baltariu Date: Wed, 2 Oct 2024 15:39:04 +0300 Subject: [PATCH 351/523] Fixed assertion Signed-off-by: Andrei Baltariu --- .../tests/header_verifier_blackbox_test.rs | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/header-verifier/tests/header_verifier_blackbox_test.rs b/header-verifier/tests/header_verifier_blackbox_test.rs index be5d0086..a6a81c87 100644 --- a/header-verifier/tests/header_verifier_blackbox_test.rs +++ b/header-verifier/tests/header_verifier_blackbox_test.rs @@ -224,6 +224,9 @@ fn test_register_bridge_operation() { state.propose_register_operations(operation.clone()); + let expected_hash_1 = state.get_operation_hash(&operation_1); + let expected_hash_2 = state.get_operation_hash(&operation_2); + state .world .query() @@ -235,9 +238,16 @@ fn test_register_bridge_operation() { assert!(!sc.hash_of_hashes_history().is_empty()); assert!(!sc.pending_hashes(&hash_of_hashes).is_empty()); - for pending_hash in sc.pending_hashes(&hash_of_hashes).iter() { - assert!(!pending_hash.is_empty()); - } + let pending_hash_1 = sc.pending_hashes(&hash_of_hashes).get_by_index(1); + let pending_hash_2 = sc.pending_hashes(&hash_of_hashes).get_by_index(2); + + let expected_hash_1_debug_api: ManagedBuffer = + ManagedBuffer::from(expected_hash_1.to_vec()); + let expected_hash_2_debug_api: ManagedBuffer = + ManagedBuffer::from(expected_hash_2.to_vec()); + + assert_eq!(pending_hash_1, expected_hash_1_debug_api); + assert_eq!(pending_hash_2, expected_hash_2_debug_api); }); } From 8dcf7c871e70cbc9c48802c404dfd186b034fc1e Mon Sep 17 00:00:00 2001 From: Andrei Baltariu Date: Wed, 2 Oct 2024 15:41:32 +0300 Subject: [PATCH 352/523] Removed mocked signature Signed-off-by: Andrei Baltariu --- header-verifier/tests/header_verifier_blackbox_test.rs | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/header-verifier/tests/header_verifier_blackbox_test.rs b/header-verifier/tests/header_verifier_blackbox_test.rs index a6a81c87..27e85829 100644 --- a/header-verifier/tests/header_verifier_blackbox_test.rs +++ b/header-verifier/tests/header_verifier_blackbox_test.rs @@ -147,9 +147,7 @@ impl HeaderVerifierTestState { &mut self, operations: Vec<&ManagedBuffer>, ) -> BridgeOperation { - let mock_signature: BlsSignature = ManagedByteArray::new_from_bytes( - b"EIZ2\x05\xf7q\xc7G\x96\x1f\xba0\xe2\xd1\xf5pE\x14\xd7?\xac\xff\x8d\x1a\x0c\x11\x900f5\xfb\xff4\x94\xb8@\xc5^\xc2,exn0\xe3\xf0\n" - ); + let mock_signature: BlsSignature = ManagedByteArray::new_from_bytes(&[0; 48]); let mut bridge_operations: MultiValueEncoded> = MultiValueEncoded::new(); From 2fc2e2acc654aa37494ebc0774b8e09caf009bde Mon Sep 17 00:00:00 2001 From: Andrei Baltariu Date: Wed, 2 Oct 2024 16:56:45 +0300 Subject: [PATCH 353/523] Test fixes and new tests Signed-off-by: Andrei Baltariu --- header-verifier/src/lib.rs | 8 +- .../tests/header_verifier_blackbox_test.rs | 150 ++++++++++++++---- 2 files changed, 128 insertions(+), 30 deletions(-) diff --git a/header-verifier/src/lib.rs b/header-verifier/src/lib.rs index bd51ce17..d9f25f13 100644 --- a/header-verifier/src/lib.rs +++ b/header-verifier/src/lib.rs @@ -67,8 +67,14 @@ pub trait Headerverifier: bls_signature::BlsSignatureModule { "Only ESDT Safe contract can call this endpoint" ); - self.pending_hashes(hash_of_hashes) + let was_hash_removed = self + .pending_hashes(hash_of_hashes) .swap_remove(operation_hash); + + require!( + was_hash_removed, + "The specified hash was not removed from the storage mapper" + ); } fn calculate_and_check_transfers_hashes( diff --git a/header-verifier/tests/header_verifier_blackbox_test.rs b/header-verifier/tests/header_verifier_blackbox_test.rs index 27e85829..90ea70fa 100644 --- a/header-verifier/tests/header_verifier_blackbox_test.rs +++ b/header-verifier/tests/header_verifier_blackbox_test.rs @@ -110,40 +110,53 @@ impl HeaderVerifierTestState { .run(); } + fn propose_remove_execute_hash_wrong_caller( + &mut self, + hash_of_hashes: &ManagedBuffer, + operation_hash: ManagedBuffer, + ) { + self.world + .tx() + .from(OWNER) + .to(HEADER_VERIFIER_ADDRESS) + .typed(header_verifier_proxy::HeaderverifierProxy) + .remove_executed_hash(hash_of_hashes, operation_hash) + .returns(ExpectError( + 4, + "Only ESDT Safe contract can call this endpoint", + )) + .run() + } + fn propose_remove_execute_hash( &mut self, + caller: TestSCAddress, hash_of_hashes: &ManagedBuffer, operation_hash: ManagedBuffer, error_status: Option, ) { + let transaction = self + .world + .tx() + .from(caller) + .to(HEADER_VERIFIER_ADDRESS) + .typed(header_verifier_proxy::HeaderverifierProxy) + .remove_executed_hash(hash_of_hashes, operation_hash); + match error_status { - Some(error) => self - .world - .tx() - .from(OWNER) - .to(HEADER_VERIFIER_ADDRESS) - .typed(header_verifier_proxy::HeaderverifierProxy) - .remove_executed_hash(hash_of_hashes, operation_hash) + Some(error) => transaction .returns(ExpectError(error.code, error.error_message)) .run(), - None => self - .world - .tx() - .from(ENSHRINE_ADDRESS) - .to(HEADER_VERIFIER_ADDRESS) - .typed(header_verifier_proxy::HeaderverifierProxy) - .remove_executed_hash(hash_of_hashes, operation_hash) - .run(), + None => transaction.run(), } } - fn get_bls_keys(&mut self, bls_keys_vec: Vec>) -> BlsKeys { let bls_keys = bls_keys_vec.iter().map(|key| key.clone().into()).collect(); bls_keys } - fn get_mock_operation( + fn generate_bridge_operation_struct( &mut self, operations: Vec<&ManagedBuffer>, ) -> BridgeOperation { @@ -218,7 +231,7 @@ fn test_register_bridge_operation() { let operation_1 = ManagedBuffer::from("operation_1"); let operation_2 = ManagedBuffer::from("operation_2"); - let operation = state.get_mock_operation(vec![&operation_1, &operation_2]); + let operation = state.generate_bridge_operation_struct(vec![&operation_1, &operation_2]); state.propose_register_operations(operation.clone()); @@ -259,16 +272,34 @@ fn test_remove_executed_hash_caller_not_esdt_address() { let operation_1 = ManagedBuffer::from("operation_1"); let operation_2 = ManagedBuffer::from("operation_2"); - let operation = state.get_mock_operation(vec![&operation_1, &operation_2]); + let operation = state.generate_bridge_operation_struct(vec![&operation_1, &operation_2]); + + state.propose_register_operations(operation.clone()); + state.propose_register_esdt_address(ENSHRINE_ADDRESS); + state.propose_remove_execute_hash_wrong_caller(&operation.bridge_operation_hash, operation_1); +} + +#[test] +fn test_remove_executed_hash_no_esdt_address_registered() { + let mut state = HeaderVerifierTestState::new(); + let bls_key_1 = ManagedBuffer::from("bls_key_1"); + let managed_bls_keys = state.get_bls_keys(vec![bls_key_1]); + + state.deploy_enshrine_esdt_contract(&managed_bls_keys); + state.deploy_header_verifier_contract(managed_bls_keys); + + let operation_1 = ManagedBuffer::from("operation_1"); + let operation_2 = ManagedBuffer::from("operation_2"); + let operation = state.generate_bridge_operation_struct(vec![&operation_1, &operation_2]); let error_status = ErrorStatus { code: 4, - error_message: "Only ESDT Safe contract can call this endpoint", + error_message: "There is no registered ESDT address", }; state.propose_register_operations(operation.clone()); - state.propose_register_esdt_address(ENSHRINE_ADDRESS); state.propose_remove_execute_hash( + ENSHRINE_ADDRESS, &operation.bridge_operation_hash, operation_1, Some(error_status), @@ -276,24 +307,28 @@ fn test_remove_executed_hash_caller_not_esdt_address() { } #[test] -fn test_remove_executed_hash_no_esdt_address_registered() { +fn test_remove_executed_hash_hash_not_removed() { let mut state = HeaderVerifierTestState::new(); let bls_key_1 = ManagedBuffer::from("bls_key_1"); let managed_bls_keys = state.get_bls_keys(vec![bls_key_1]); + state.deploy_enshrine_esdt_contract(&managed_bls_keys); state.deploy_header_verifier_contract(managed_bls_keys); let operation_1 = ManagedBuffer::from("operation_1"); let operation_2 = ManagedBuffer::from("operation_2"); - let operation = state.get_mock_operation(vec![&operation_1, &operation_2]); + let operation = state.generate_bridge_operation_struct(vec![&operation_1, &operation_2]); + + state.propose_register_operations(operation.clone()); + state.propose_register_esdt_address(ENSHRINE_ADDRESS); let error_status = ErrorStatus { code: 4, - error_message: "There is no registered ESDT address", + error_message: "The specified hash was not removed from the storage mapper", }; - state.propose_register_operations(operation.clone()); state.propose_remove_execute_hash( + ENSHRINE_ADDRESS, &operation.bridge_operation_hash, operation_1, Some(error_status), @@ -301,7 +336,7 @@ fn test_remove_executed_hash_no_esdt_address_registered() { } #[test] -fn test_remove_executed_hash() { +fn test_remove_one_executed_hash() { let mut state = HeaderVerifierTestState::new(); let bls_key_1 = ManagedBuffer::from("bls_key_1"); let managed_bls_keys = state.get_bls_keys(vec![bls_key_1]); @@ -311,12 +346,68 @@ fn test_remove_executed_hash() { let operation_1 = ManagedBuffer::from("operation_1"); let operation_2 = ManagedBuffer::from("operation_2"); - let operation = state.get_mock_operation(vec![&operation_1, &operation_2]); + let operation = state.generate_bridge_operation_struct(vec![&operation_1, &operation_2]); state.propose_register_operations(operation.clone()); state.propose_register_esdt_address(ENSHRINE_ADDRESS); - state.propose_remove_execute_hash(&operation.bridge_operation_hash, operation_1, None); + let operation_1_hash = state.get_operation_hash(&operation_1); + state.propose_remove_execute_hash( + ENSHRINE_ADDRESS, + &operation.bridge_operation_hash, + operation_1_hash, + None, + ); + + let expected_hash_2 = state.get_operation_hash(&operation_2); + state + .world + .query() + .to(HEADER_VERIFIER_ADDRESS) + .whitebox(header_verifier::contract_obj, |sc| { + let hash_of_hashes: ManagedBuffer = + ManagedBuffer::from(operation.bridge_operation_hash.to_vec()); + assert!(!sc.pending_hashes(&hash_of_hashes).is_empty()); + + let pending_hash_2 = sc.pending_hashes(&hash_of_hashes).get_by_index(1); + let expected_hash_2_debug_api: ManagedBuffer = + ManagedBuffer::from(expected_hash_2.to_vec()); + + assert_eq!(pending_hash_2, expected_hash_2_debug_api); + }); +} + +#[test] +fn test_remove_all_executed_hashes() { + let mut state = HeaderVerifierTestState::new(); + let bls_key_1 = ManagedBuffer::from("bls_key_1"); + let managed_bls_keys = state.get_bls_keys(vec![bls_key_1]); + + state.deploy_enshrine_esdt_contract(&managed_bls_keys); + state.deploy_header_verifier_contract(managed_bls_keys); + + let operation_1 = ManagedBuffer::from("operation_1"); + let operation_2 = ManagedBuffer::from("operation_2"); + let operation = state.generate_bridge_operation_struct(vec![&operation_1, &operation_2]); + + state.propose_register_operations(operation.clone()); + state.propose_register_esdt_address(ENSHRINE_ADDRESS); + + let operation_1_hash = state.get_operation_hash(&operation_1); + state.propose_remove_execute_hash( + ENSHRINE_ADDRESS, + &operation.bridge_operation_hash, + operation_1_hash, + None, + ); + + let operation_2_hash = state.get_operation_hash(&operation_2); + state.propose_remove_execute_hash( + ENSHRINE_ADDRESS, + &operation.bridge_operation_hash, + operation_2_hash, + None, + ); state .world .query() @@ -324,6 +415,7 @@ fn test_remove_executed_hash() { .whitebox(header_verifier::contract_obj, |sc| { let hash_of_hashes: ManagedBuffer = ManagedBuffer::from(operation.bridge_operation_hash.to_vec()); - sc.pending_hashes(&hash_of_hashes).is_empty(); + assert!(sc.pending_hashes(&hash_of_hashes).is_empty()); + assert!(sc.hash_of_hashes_history().contains(&hash_of_hashes)); }); } From 8cddd271ea8b552b1f1e4793acad5ea539676909 Mon Sep 17 00:00:00 2001 From: Andrei Baltariu Date: Wed, 2 Oct 2024 17:39:56 +0300 Subject: [PATCH 354/523] Removed into Signed-off-by: Andrei Baltariu --- header-verifier/tests/header_verifier_blackbox_test.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/header-verifier/tests/header_verifier_blackbox_test.rs b/header-verifier/tests/header_verifier_blackbox_test.rs index 90ea70fa..b95771ad 100644 --- a/header-verifier/tests/header_verifier_blackbox_test.rs +++ b/header-verifier/tests/header_verifier_blackbox_test.rs @@ -151,7 +151,7 @@ impl HeaderVerifierTestState { } } fn get_bls_keys(&mut self, bls_keys_vec: Vec>) -> BlsKeys { - let bls_keys = bls_keys_vec.iter().map(|key| key.clone().into()).collect(); + let bls_keys = bls_keys_vec.iter().map(|key| key.clone()).collect(); bls_keys } From b810afb34c87df3dd10f939a51bb27f7efdf8518 Mon Sep 17 00:00:00 2001 From: Andrei Baltariu Date: Fri, 4 Oct 2024 08:49:46 +0300 Subject: [PATCH 355/523] Modified endpoint to check for operation hash before removing + test update Signed-off-by: Andrei Baltariu --- header-verifier/src/lib.rs | 11 +++++------ .../tests/header_verifier_blackbox_test.rs | 7 ++++--- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/header-verifier/src/lib.rs b/header-verifier/src/lib.rs index d9f25f13..17bb5161 100644 --- a/header-verifier/src/lib.rs +++ b/header-verifier/src/lib.rs @@ -67,14 +67,13 @@ pub trait Headerverifier: bls_signature::BlsSignatureModule { "Only ESDT Safe contract can call this endpoint" ); - let was_hash_removed = self - .pending_hashes(hash_of_hashes) - .swap_remove(operation_hash); - require!( - was_hash_removed, - "The specified hash was not removed from the storage mapper" + self.pending_hashes(hash_of_hashes).contains(operation_hash), + "The operation hash does not exist in the storage" ); + + self.pending_hashes(hash_of_hashes) + .swap_remove(operation_hash); } fn calculate_and_check_transfers_hashes( diff --git a/header-verifier/tests/header_verifier_blackbox_test.rs b/header-verifier/tests/header_verifier_blackbox_test.rs index b95771ad..a1f2c5e3 100644 --- a/header-verifier/tests/header_verifier_blackbox_test.rs +++ b/header-verifier/tests/header_verifier_blackbox_test.rs @@ -307,7 +307,7 @@ fn test_remove_executed_hash_no_esdt_address_registered() { } #[test] -fn test_remove_executed_hash_hash_not_removed() { +fn test_remove_executed_hash_hash_not_found_in_storage() { let mut state = HeaderVerifierTestState::new(); let bls_key_1 = ManagedBuffer::from("bls_key_1"); let managed_bls_keys = state.get_bls_keys(vec![bls_key_1]); @@ -317,6 +317,7 @@ fn test_remove_executed_hash_hash_not_removed() { let operation_1 = ManagedBuffer::from("operation_1"); let operation_2 = ManagedBuffer::from("operation_2"); + let operation_3 = ManagedBuffer::from("operation_3"); let operation = state.generate_bridge_operation_struct(vec![&operation_1, &operation_2]); state.propose_register_operations(operation.clone()); @@ -324,13 +325,13 @@ fn test_remove_executed_hash_hash_not_removed() { let error_status = ErrorStatus { code: 4, - error_message: "The specified hash was not removed from the storage mapper", + error_message: "The operation hash does not exist in the storage", }; state.propose_remove_execute_hash( ENSHRINE_ADDRESS, &operation.bridge_operation_hash, - operation_1, + operation_3, Some(error_status), ); } From 4075b80173d6a9b7a1b8a0991b8dbf24e61ec3ce Mon Sep 17 00:00:00 2001 From: Andrei Baltariu Date: Fri, 4 Oct 2024 08:52:48 +0300 Subject: [PATCH 356/523] Added more asserts Signed-off-by: Andrei Baltariu --- .../tests/header_verifier_blackbox_test.rs | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/header-verifier/tests/header_verifier_blackbox_test.rs b/header-verifier/tests/header_verifier_blackbox_test.rs index a1f2c5e3..48d637a6 100644 --- a/header-verifier/tests/header_verifier_blackbox_test.rs +++ b/header-verifier/tests/header_verifier_blackbox_test.rs @@ -128,7 +128,7 @@ impl HeaderVerifierTestState { .run() } - fn propose_remove_execute_hash( + fn propose_remove_executed_hash( &mut self, caller: TestSCAddress, hash_of_hashes: &ManagedBuffer, @@ -247,7 +247,9 @@ fn test_register_bridge_operation() { ManagedBuffer::from(operation.bridge_operation_hash.to_vec()); assert!(!sc.hash_of_hashes_history().is_empty()); + assert!(sc.hash_of_hashes_history().contains(&hash_of_hashes)); assert!(!sc.pending_hashes(&hash_of_hashes).is_empty()); + assert!(sc.pending_hashes(&hash_of_hashes).len() == 1); let pending_hash_1 = sc.pending_hashes(&hash_of_hashes).get_by_index(1); let pending_hash_2 = sc.pending_hashes(&hash_of_hashes).get_by_index(2); @@ -298,7 +300,7 @@ fn test_remove_executed_hash_no_esdt_address_registered() { }; state.propose_register_operations(operation.clone()); - state.propose_remove_execute_hash( + state.propose_remove_executed_hash( ENSHRINE_ADDRESS, &operation.bridge_operation_hash, operation_1, @@ -328,7 +330,7 @@ fn test_remove_executed_hash_hash_not_found_in_storage() { error_message: "The operation hash does not exist in the storage", }; - state.propose_remove_execute_hash( + state.propose_remove_executed_hash( ENSHRINE_ADDRESS, &operation.bridge_operation_hash, operation_3, @@ -353,7 +355,7 @@ fn test_remove_one_executed_hash() { state.propose_register_esdt_address(ENSHRINE_ADDRESS); let operation_1_hash = state.get_operation_hash(&operation_1); - state.propose_remove_execute_hash( + state.propose_remove_executed_hash( ENSHRINE_ADDRESS, &operation.bridge_operation_hash, operation_1_hash, @@ -369,6 +371,7 @@ fn test_remove_one_executed_hash() { let hash_of_hashes: ManagedBuffer = ManagedBuffer::from(operation.bridge_operation_hash.to_vec()); assert!(!sc.pending_hashes(&hash_of_hashes).is_empty()); + assert!(sc.pending_hashes(&hash_of_hashes).len() == 1); let pending_hash_2 = sc.pending_hashes(&hash_of_hashes).get_by_index(1); let expected_hash_2_debug_api: ManagedBuffer = @@ -395,7 +398,7 @@ fn test_remove_all_executed_hashes() { state.propose_register_esdt_address(ENSHRINE_ADDRESS); let operation_1_hash = state.get_operation_hash(&operation_1); - state.propose_remove_execute_hash( + state.propose_remove_executed_hash( ENSHRINE_ADDRESS, &operation.bridge_operation_hash, operation_1_hash, @@ -403,7 +406,7 @@ fn test_remove_all_executed_hashes() { ); let operation_2_hash = state.get_operation_hash(&operation_2); - state.propose_remove_execute_hash( + state.propose_remove_executed_hash( ENSHRINE_ADDRESS, &operation.bridge_operation_hash, operation_2_hash, From 3b964829fba8b373ea7062612eb7a21d938fa7ec Mon Sep 17 00:00:00 2001 From: Andrei Baltariu Date: Fri, 4 Oct 2024 08:53:40 +0300 Subject: [PATCH 357/523] Fixed assertion Signed-off-by: Andrei Baltariu --- header-verifier/tests/header_verifier_blackbox_test.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/header-verifier/tests/header_verifier_blackbox_test.rs b/header-verifier/tests/header_verifier_blackbox_test.rs index 48d637a6..a2ab9ee0 100644 --- a/header-verifier/tests/header_verifier_blackbox_test.rs +++ b/header-verifier/tests/header_verifier_blackbox_test.rs @@ -247,9 +247,9 @@ fn test_register_bridge_operation() { ManagedBuffer::from(operation.bridge_operation_hash.to_vec()); assert!(!sc.hash_of_hashes_history().is_empty()); + assert!(sc.hash_of_hashes_history().len() == 1); assert!(sc.hash_of_hashes_history().contains(&hash_of_hashes)); assert!(!sc.pending_hashes(&hash_of_hashes).is_empty()); - assert!(sc.pending_hashes(&hash_of_hashes).len() == 1); let pending_hash_1 = sc.pending_hashes(&hash_of_hashes).get_by_index(1); let pending_hash_2 = sc.pending_hashes(&hash_of_hashes).get_by_index(2); From 94b13ea7295e92a72f2b8836a03d73a0e9802346 Mon Sep 17 00:00:00 2001 From: Andrei Baltariu Date: Fri, 4 Oct 2024 12:11:40 +0300 Subject: [PATCH 358/523] Removed require Signed-off-by: Andrei Baltariu --- header-verifier/src/lib.rs | 5 ----- 1 file changed, 5 deletions(-) diff --git a/header-verifier/src/lib.rs b/header-verifier/src/lib.rs index 17bb5161..bd51ce17 100644 --- a/header-verifier/src/lib.rs +++ b/header-verifier/src/lib.rs @@ -67,11 +67,6 @@ pub trait Headerverifier: bls_signature::BlsSignatureModule { "Only ESDT Safe contract can call this endpoint" ); - require!( - self.pending_hashes(hash_of_hashes).contains(operation_hash), - "The operation hash does not exist in the storage" - ); - self.pending_hashes(hash_of_hashes) .swap_remove(operation_hash); } From eea269e1bd08b4be91f078e1587ddbd505db4a20 Mon Sep 17 00:00:00 2001 From: Andrei Baltariu Date: Fri, 4 Oct 2024 12:51:02 +0300 Subject: [PATCH 359/523] Modified setup for removal of executed hash Signed-off-by: Andrei Baltariu --- .../tests/header_verifier_blackbox_test.rs | 60 +++---------------- 1 file changed, 8 insertions(+), 52 deletions(-) diff --git a/header-verifier/tests/header_verifier_blackbox_test.rs b/header-verifier/tests/header_verifier_blackbox_test.rs index a2ab9ee0..fa8cfd6e 100644 --- a/header-verifier/tests/header_verifier_blackbox_test.rs +++ b/header-verifier/tests/header_verifier_blackbox_test.rs @@ -15,9 +15,7 @@ const HEADER_VERIFIER_CODE_PATH: MxscPath = MxscPath::new("ouput/header-verifier const HEADER_VERIFIER_ADDRESS: TestSCAddress = TestSCAddress::new("header-verifier"); // NOTE: This is a mock path -const ENSHRINE_CODE_PATH: MxscPath = - MxscPath::new("../chain-factory/output/chain-factory.mxsc-json"); -const ENSHRINE_ADDRESS: TestSCAddress = TestSCAddress::new("enshrine"); +const ENSHRINE_ADDRESS: TestAddress = TestAddress::new("enshrine"); const OWNER: TestAddress = TestAddress::new("owner"); const WEGLD_BALANCE: u128 = 100_000_000_000_000_000; @@ -39,7 +37,6 @@ pub struct BridgeOperation { fn world() -> ScenarioWorld { let mut blockchain = ScenarioWorld::new(); blockchain.register_contract(HEADER_VERIFIER_CODE_PATH, header_verifier::ContractBuilder); - blockchain.register_contract(ENSHRINE_CODE_PATH, header_verifier::ContractBuilder); blockchain } @@ -57,6 +54,11 @@ impl HeaderVerifierTestState { .balance(BigUint::from(WEGLD_BALANCE)) .nonce(1); + world + .account(ENSHRINE_ADDRESS) + .balance(BigUint::from(WEGLD_BALANCE)) + .nonce(1); + Self { world } } @@ -73,20 +75,7 @@ impl HeaderVerifierTestState { self } - fn deploy_enshrine_esdt_contract(&mut self, bls_keys: &BlsKeys) -> &mut Self { - self.world - .tx() - .from(OWNER) - .typed(header_verifier_proxy::HeaderverifierProxy) - .init(bls_keys) - .code(HEADER_VERIFIER_CODE_PATH) - .new_address(ENSHRINE_ADDRESS) - .run(); - - self - } - - fn propose_register_esdt_address(&mut self, esdt_address: TestSCAddress) { + fn propose_register_esdt_address(&mut self, esdt_address: TestAddress) { self.world .tx() .from(OWNER) @@ -130,7 +119,7 @@ impl HeaderVerifierTestState { fn propose_remove_executed_hash( &mut self, - caller: TestSCAddress, + caller: TestAddress, hash_of_hashes: &ManagedBuffer, operation_hash: ManagedBuffer, error_status: Option, @@ -287,7 +276,6 @@ fn test_remove_executed_hash_no_esdt_address_registered() { let bls_key_1 = ManagedBuffer::from("bls_key_1"); let managed_bls_keys = state.get_bls_keys(vec![bls_key_1]); - state.deploy_enshrine_esdt_contract(&managed_bls_keys); state.deploy_header_verifier_contract(managed_bls_keys); let operation_1 = ManagedBuffer::from("operation_1"); @@ -308,43 +296,12 @@ fn test_remove_executed_hash_no_esdt_address_registered() { ); } -#[test] -fn test_remove_executed_hash_hash_not_found_in_storage() { - let mut state = HeaderVerifierTestState::new(); - let bls_key_1 = ManagedBuffer::from("bls_key_1"); - let managed_bls_keys = state.get_bls_keys(vec![bls_key_1]); - - state.deploy_enshrine_esdt_contract(&managed_bls_keys); - state.deploy_header_verifier_contract(managed_bls_keys); - - let operation_1 = ManagedBuffer::from("operation_1"); - let operation_2 = ManagedBuffer::from("operation_2"); - let operation_3 = ManagedBuffer::from("operation_3"); - let operation = state.generate_bridge_operation_struct(vec![&operation_1, &operation_2]); - - state.propose_register_operations(operation.clone()); - state.propose_register_esdt_address(ENSHRINE_ADDRESS); - - let error_status = ErrorStatus { - code: 4, - error_message: "The operation hash does not exist in the storage", - }; - - state.propose_remove_executed_hash( - ENSHRINE_ADDRESS, - &operation.bridge_operation_hash, - operation_3, - Some(error_status), - ); -} - #[test] fn test_remove_one_executed_hash() { let mut state = HeaderVerifierTestState::new(); let bls_key_1 = ManagedBuffer::from("bls_key_1"); let managed_bls_keys = state.get_bls_keys(vec![bls_key_1]); - state.deploy_enshrine_esdt_contract(&managed_bls_keys); state.deploy_header_verifier_contract(managed_bls_keys); let operation_1 = ManagedBuffer::from("operation_1"); @@ -387,7 +344,6 @@ fn test_remove_all_executed_hashes() { let bls_key_1 = ManagedBuffer::from("bls_key_1"); let managed_bls_keys = state.get_bls_keys(vec![bls_key_1]); - state.deploy_enshrine_esdt_contract(&managed_bls_keys); state.deploy_header_verifier_contract(managed_bls_keys); let operation_1 = ManagedBuffer::from("operation_1"); From bc2d373fa3afbb897cb00c8f3ecba3ec015d4bb1 Mon Sep 17 00:00:00 2001 From: sergiuosvat Date: Mon, 7 Oct 2024 15:57:01 +0300 Subject: [PATCH 360/523] add fee-market blackbox tests --- fee-market/tests/fee_market_blackbox_test.rs | 334 +++++++++++++++++++ 1 file changed, 334 insertions(+) create mode 100644 fee-market/tests/fee_market_blackbox_test.rs diff --git a/fee-market/tests/fee_market_blackbox_test.rs b/fee-market/tests/fee_market_blackbox_test.rs new file mode 100644 index 00000000..943cebfd --- /dev/null +++ b/fee-market/tests/fee_market_blackbox_test.rs @@ -0,0 +1,334 @@ +use fee_market::fee_market_proxy::{self, FeeStruct, FeeType}; + +use multiversx_sc::{imports::OptionalValue, types::{BigUint, EsdtTokenPayment, ManagedVec, MultiValueEncoded, ReturnsResultUnmanaged, TestAddress, TestSCAddress, TokenIdentifier}}; +use multiversx_sc_scenario::{imports::MxscPath, ExpectError, ScenarioTxRun, ScenarioWorld}; + +const FEE_MARKET_CODE_PATH: MxscPath = MxscPath::new("output/fee-market.mxsc.json"); +const FEE_MARKET_ADDRESS: TestSCAddress = TestSCAddress::new("fee-market"); + +const ESDT_SAFE_ADDRESS: TestSCAddress = TestSCAddress::new("esdt-safe"); +const ESDT_SAFE_CODE_PATH: MxscPath = MxscPath::new("../esdt-safe/output/esdt-safe.mxsc.json"); +const AGGREGATOR_ADDRESS: TestSCAddress = TestSCAddress::new("init"); + +const OWNER_ADDRESS: TestAddress = TestAddress::new("owner"); +const USER_ADDRESS: TestAddress = TestAddress::new("user"); + +const TOKEN_ID: &str = "TDK-123456"; +const DIFFERENT_TOKEN_ID: &str = "WRONG-123456"; +const ANOTHER_TOKEN_ID: &str = "ANOTHER-123456"; +const WRONG_TOKEN_ID: &str = "WRONG-TOKEN"; + + +fn world() -> ScenarioWorld { + let mut blockchain = ScenarioWorld::new(); + + blockchain.register_contract(FEE_MARKET_CODE_PATH, fee_market::ContractBuilder); + + blockchain +} + +struct FeeMarketTestState { + world: ScenarioWorld, +} + +impl FeeMarketTestState { + fn new() -> Self { + let mut world = world(); + + + + world + .account(OWNER_ADDRESS) + .esdt_balance(TokenIdentifier::from_esdt_bytes(TOKEN_ID), 1000) + .nonce(1); + + world + .account(USER_ADDRESS) + .esdt_balance(TokenIdentifier::from_esdt_bytes(TOKEN_ID), 1000) + .nonce(1); + + world + .account(ESDT_SAFE_ADDRESS) + .code(ESDT_SAFE_CODE_PATH) + .esdt_balance(TokenIdentifier::from_esdt_bytes(TOKEN_ID), 1000) + .esdt_balance(TokenIdentifier::from_esdt_bytes(DIFFERENT_TOKEN_ID), 1000) + .esdt_balance(TokenIdentifier::from_esdt_bytes(ANOTHER_TOKEN_ID), 1000) + .nonce(1); + + Self { world } + } + + fn deploy_fee_market(&mut self) -> &mut Self{ + + let fee = FeeStruct { + base_token: TokenIdentifier::from_esdt_bytes(TOKEN_ID), + fee_type: FeeType::Fixed { token: TokenIdentifier::from_esdt_bytes(TOKEN_ID), per_transfer: BigUint::from(100u64), per_gas: BigUint::from(0u64) }, + }; + + self.world + .tx() + .from(OWNER_ADDRESS) + .typed(fee_market_proxy::FeeMarketProxy) + .init(ESDT_SAFE_ADDRESS, AGGREGATOR_ADDRESS, Option::Some(fee)) + .code(FEE_MARKET_CODE_PATH) + .new_address(FEE_MARKET_ADDRESS) + .run(); + + self + } + + fn substract_fee(&mut self, payment_wanted: &str, error_status: Option) { + let payment; + + match payment_wanted { + "Correct" => { + payment = EsdtTokenPayment::new(TokenIdentifier::from_esdt_bytes(TOKEN_ID), 0u64, BigUint::from(200u64)); + } + "InvalidToken" => { + payment = EsdtTokenPayment::new(TokenIdentifier::from_esdt_bytes(DIFFERENT_TOKEN_ID), 0u64, BigUint::from(10u64)); + } + "AnyToken" => { + payment = EsdtTokenPayment::new(TokenIdentifier::from_esdt_bytes(ANOTHER_TOKEN_ID), 0u64, BigUint::from(10u64)); + } + "Less than fee" => { + payment = EsdtTokenPayment::new(TokenIdentifier::from_esdt_bytes(TOKEN_ID), 0u64, BigUint::from(0u64)); + } + _ => { + panic!("Invalid payment wanted"); + } + } + + match error_status { + Some(error) => { + self.world + .tx() + .from(ESDT_SAFE_ADDRESS) + .to(FEE_MARKET_ADDRESS) + .typed(fee_market_proxy::FeeMarketProxy) + .subtract_fee(USER_ADDRESS, 1u8, OptionalValue::Some(30u64)) + .payment(payment) + .returns(error) + .run(); + } + None => { + self.world + .tx() + .from(ESDT_SAFE_ADDRESS) + .to(FEE_MARKET_ADDRESS) + .typed(fee_market_proxy::FeeMarketProxy) + .subtract_fee(USER_ADDRESS, 1u8, OptionalValue::Some(30u64)) + .payment(payment) + .returns(ReturnsResultUnmanaged) + .run(); + } + } + } + + fn disable_fee(&mut self) { + self.world + .tx() + .from(OWNER_ADDRESS) + .to(FEE_MARKET_ADDRESS) + .typed(fee_market_proxy::FeeMarketProxy) + .disable_fee(TokenIdentifier::from_esdt_bytes(TOKEN_ID)) + .run(); + } + + fn add_fee(&mut self, token_id: &str, fee_type: &str, error_status: Option) { + + let fee_struct; + + match fee_type { + "None" => { + let fee_type = FeeType::None; + fee_struct = FeeStruct { + base_token: TokenIdentifier::from_esdt_bytes(token_id), + fee_type, + }; + } + "Fixed" => { + let fee_type = FeeType::Fixed { + token: TokenIdentifier::from_esdt_bytes(TOKEN_ID), + per_transfer: BigUint::from(10u8), + per_gas: BigUint::from(10u8), + }; + fee_struct = FeeStruct { + base_token: TokenIdentifier::from_esdt_bytes(token_id), + fee_type, + }; + } + "AnyToken" => { + let fee_type = FeeType::AnyToken { + base_fee_token: TokenIdentifier::from_esdt_bytes(DIFFERENT_TOKEN_ID), + per_transfer: BigUint::from(10u8), + per_gas: BigUint::from(10u8), + }; + fee_struct = FeeStruct { + base_token: TokenIdentifier::from_esdt_bytes(token_id), + fee_type, + }; + } + "AnyTokenWrong" => { + let fee_type = FeeType::AnyToken { + base_fee_token: TokenIdentifier::from_esdt_bytes(WRONG_TOKEN_ID), + per_transfer: BigUint::from(10u8), + per_gas: BigUint::from(10u8), + }; + fee_struct = FeeStruct { + base_token: TokenIdentifier::from_esdt_bytes(token_id), + fee_type, + }; + } + _ => { + panic!("Invalid fee type"); + } + } + + match error_status { + Some(error) => { + self.world + .tx() + .from(OWNER_ADDRESS) + .to(FEE_MARKET_ADDRESS) + .typed(fee_market_proxy::FeeMarketProxy) + .set_fee(fee_struct) + .returns(error) + .run(); + } + None => { + self.world + .tx() + .from(OWNER_ADDRESS) + .to(FEE_MARKET_ADDRESS) + .typed(fee_market_proxy::FeeMarketProxy) + .set_fee(fee_struct) + .run(); + } + } + } + + fn add_users_to_whitelist(&mut self) { + let mut users_vec = ManagedVec::new(); + users_vec.push(USER_ADDRESS.to_managed_address()); + let users = MultiValueEncoded::from(users_vec); + self.world + .tx() + .from(OWNER_ADDRESS) + .to(FEE_MARKET_ADDRESS) + .typed(fee_market_proxy::FeeMarketProxy) + .add_users_to_whitelist(users) + .run(); + } + + fn check_balance_sc(&mut self, address: TestSCAddress, expected_balance: u64) { + self.world + .check_account(address) + .esdt_balance(TokenIdentifier::from_esdt_bytes(TOKEN_ID), expected_balance); + } + + fn check_account(&mut self, address: TestAddress, expected_balance: u64) { + self.world + .check_account(address) + .esdt_balance(TokenIdentifier::from_esdt_bytes(TOKEN_ID), expected_balance); + } + +} + +#[test] +fn test_deploy_fee_market() { + let mut state = FeeMarketTestState::new(); + + state.deploy_fee_market(); +} + +#[test] +fn test_add_fee_wrong_params() { + let mut state = FeeMarketTestState::new(); + + state.deploy_fee_market(); + + state.add_fee(WRONG_TOKEN_ID, "Fixed", Option::Some(ExpectError(4, "Invalid token ID"))); + + state.add_fee(TOKEN_ID, "None", Option::Some(ExpectError(4, "Invalid fee type"))); + + state.add_fee(DIFFERENT_TOKEN_ID, "Fixed", Option::Some(ExpectError(4, "Invalid fee"))); + + state.add_fee(TOKEN_ID, "AnyTokenWrong", Option::Some(ExpectError(4, "Invalid token ID"))); + +} + +#[test] +fn test_substract_fee_no_fee() { + let mut state = FeeMarketTestState::new(); + + state.deploy_fee_market(); + state.disable_fee(); + + state.substract_fee("Correct", Option::None); + + state.check_balance_sc(ESDT_SAFE_ADDRESS, 1000); + state.check_account(USER_ADDRESS, 1000); + +} + +#[test] +fn test_substract_fee_whitelisted() { + let mut state = FeeMarketTestState::new(); + + state.deploy_fee_market(); + state.add_users_to_whitelist(); + + state.substract_fee("Correct", Option::None); + + state.check_balance_sc(ESDT_SAFE_ADDRESS, 1000); + state.check_account(USER_ADDRESS, 1000); +} + +#[test] +fn test_substract_fee_invalid_payment_token() { + let mut state = FeeMarketTestState::new(); + + state.deploy_fee_market(); + + state.substract_fee("InvalidToken", Option::Some(ExpectError(4, "Token not accepted as fee"))); + + state.check_balance_sc(ESDT_SAFE_ADDRESS, 1000); + state.check_account(USER_ADDRESS, 1000); + +} + +// FAILS => get_safe_price should be mocked here in order to make this test work +#[test] +fn test_substract_fee_any_token() { + let mut state = FeeMarketTestState::new(); + + state.deploy_fee_market(); + state.add_fee(ANOTHER_TOKEN_ID, "AnyToken", Option::None); + + state.substract_fee("AnyToken", Option::Some(ExpectError(4, "Invalid token provided for fee"))); + +} + +#[test] +fn test_substract_fixed_fee_payment_not_covered() { + let mut state = FeeMarketTestState::new(); + + state.deploy_fee_market(); + + state.substract_fee("Less than fee", Option::Some(ExpectError(4, "Payment does not cover fee"))); + + state.check_balance_sc(ESDT_SAFE_ADDRESS, 1000); + state.check_account(USER_ADDRESS, 1000); +} + +#[test] +fn test_substract_fee_fixed_payment_bigger_than_fee() { + let mut state = FeeMarketTestState::new(); + + state.deploy_fee_market(); + + state.substract_fee("Correct", Option::None); + + state.check_balance_sc(ESDT_SAFE_ADDRESS, 800); + state.check_account(USER_ADDRESS, 1100); +} From 876fce9ce8641ebd8c2de5bca24bcd9b91a3f606 Mon Sep 17 00:00:00 2001 From: Andrei Baltariu Date: Mon, 7 Oct 2024 17:03:39 +0300 Subject: [PATCH 361/523] WIP test fixes Signed-off-by: Andrei Baltariu --- .../tests/header_verifier_blackbox_test.rs | 29 ++++++++----------- 1 file changed, 12 insertions(+), 17 deletions(-) diff --git a/header-verifier/tests/header_verifier_blackbox_test.rs b/header-verifier/tests/header_verifier_blackbox_test.rs index fa8cfd6e..e832974c 100644 --- a/header-verifier/tests/header_verifier_blackbox_test.rs +++ b/header-verifier/tests/header_verifier_blackbox_test.rs @@ -139,6 +139,7 @@ impl HeaderVerifierTestState { None => transaction.run(), } } + fn get_bls_keys(&mut self, bls_keys_vec: Vec>) -> BlsKeys { let bls_keys = bls_keys_vec.iter().map(|key| key.clone()).collect(); @@ -147,25 +148,24 @@ impl HeaderVerifierTestState { fn generate_bridge_operation_struct( &mut self, - operations: Vec<&ManagedBuffer>, + operation_hashes: Vec<&ManagedBuffer>, ) -> BridgeOperation { let mock_signature: BlsSignature = ManagedByteArray::new_from_bytes(&[0; 48]); let mut bridge_operations: MultiValueEncoded> = MultiValueEncoded::new(); - let mut bridge_operation_appended_hashes = ManagedBuffer::new(); + let mut appended_hashes = ManagedBuffer::new(); - for operation in operations { - let operation_hash = self.get_operation_hash(operation); - bridge_operation_appended_hashes.append(&operation_hash); - bridge_operations.push(operation_hash); + for operation_hash in operation_hashes { + appended_hashes.append(&operation_hash); + bridge_operations.push(operation_hash.clone()); } - let bridge_operations_hash = self.get_operation_hash(&bridge_operation_appended_hashes); + let hash_of_hashes = self.get_operation_hash(&appended_hashes); BridgeOperation { signature: mock_signature, - bridge_operation_hash: bridge_operations_hash, + bridge_operation_hash: hash_of_hashes, operations_hashes: bridge_operations, } } @@ -224,9 +224,6 @@ fn test_register_bridge_operation() { state.propose_register_operations(operation.clone()); - let expected_hash_1 = state.get_operation_hash(&operation_1); - let expected_hash_2 = state.get_operation_hash(&operation_2); - state .world .query() @@ -244,9 +241,9 @@ fn test_register_bridge_operation() { let pending_hash_2 = sc.pending_hashes(&hash_of_hashes).get_by_index(2); let expected_hash_1_debug_api: ManagedBuffer = - ManagedBuffer::from(expected_hash_1.to_vec()); + ManagedBuffer::from(operation_1.to_vec()); let expected_hash_2_debug_api: ManagedBuffer = - ManagedBuffer::from(expected_hash_2.to_vec()); + ManagedBuffer::from(operation_2.to_vec()); assert_eq!(pending_hash_1, expected_hash_1_debug_api); assert_eq!(pending_hash_2, expected_hash_2_debug_api); @@ -353,19 +350,17 @@ fn test_remove_all_executed_hashes() { state.propose_register_operations(operation.clone()); state.propose_register_esdt_address(ENSHRINE_ADDRESS); - let operation_1_hash = state.get_operation_hash(&operation_1); state.propose_remove_executed_hash( ENSHRINE_ADDRESS, &operation.bridge_operation_hash, - operation_1_hash, + operation_1, None, ); - let operation_2_hash = state.get_operation_hash(&operation_2); state.propose_remove_executed_hash( ENSHRINE_ADDRESS, &operation.bridge_operation_hash, - operation_2_hash, + operation_2, None, ); state From 4d7d9159071b3ceb53e71d52add3740a9e46ccb0 Mon Sep 17 00:00:00 2001 From: sergiuosvat Date: Mon, 7 Oct 2024 17:55:24 +0300 Subject: [PATCH 362/523] fixes after review --- fee-market/tests/fee_market_blackbox_test.rs | 88 ++++++++++---------- 1 file changed, 43 insertions(+), 45 deletions(-) diff --git a/fee-market/tests/fee_market_blackbox_test.rs b/fee-market/tests/fee_market_blackbox_test.rs index 943cebfd..3ce89fd1 100644 --- a/fee-market/tests/fee_market_blackbox_test.rs +++ b/fee-market/tests/fee_market_blackbox_test.rs @@ -1,6 +1,6 @@ use fee_market::fee_market_proxy::{self, FeeStruct, FeeType}; -use multiversx_sc::{imports::OptionalValue, types::{BigUint, EsdtTokenPayment, ManagedVec, MultiValueEncoded, ReturnsResultUnmanaged, TestAddress, TestSCAddress, TokenIdentifier}}; +use multiversx_sc::{imports::OptionalValue, types::{BigUint, EsdtTokenPayment, ManagedVec, MultiValueEncoded, ReturnsResultUnmanaged, TestAddress, TestSCAddress, TestTokenIdentifier, TokenIdentifier}}; use multiversx_sc_scenario::{imports::MxscPath, ExpectError, ScenarioTxRun, ScenarioWorld}; const FEE_MARKET_CODE_PATH: MxscPath = MxscPath::new("output/fee-market.mxsc.json"); @@ -13,10 +13,10 @@ const AGGREGATOR_ADDRESS: TestSCAddress = TestSCAddress::new("init"); const OWNER_ADDRESS: TestAddress = TestAddress::new("owner"); const USER_ADDRESS: TestAddress = TestAddress::new("user"); -const TOKEN_ID: &str = "TDK-123456"; -const DIFFERENT_TOKEN_ID: &str = "WRONG-123456"; -const ANOTHER_TOKEN_ID: &str = "ANOTHER-123456"; -const WRONG_TOKEN_ID: &str = "WRONG-TOKEN"; +const TOKEN_ID: TestTokenIdentifier = TestTokenIdentifier::new("TDK-123456"); +const DIFFERENT_TOKEN_ID: TestTokenIdentifier = TestTokenIdentifier::new("WRONG-123456"); +const ANOTHER_TOKEN_ID: TestTokenIdentifier = TestTokenIdentifier::new("ANOTHER-123456"); +const WRONG_TOKEN_ID: TestTokenIdentifier = TestTokenIdentifier::new("WRONG-TOKEN"); fn world() -> ScenarioWorld { @@ -35,24 +35,22 @@ impl FeeMarketTestState { fn new() -> Self { let mut world = world(); - - world .account(OWNER_ADDRESS) - .esdt_balance(TokenIdentifier::from_esdt_bytes(TOKEN_ID), 1000) + .esdt_balance(TOKEN_ID, 1000) .nonce(1); world .account(USER_ADDRESS) - .esdt_balance(TokenIdentifier::from_esdt_bytes(TOKEN_ID), 1000) + .esdt_balance(TOKEN_ID, 1000) .nonce(1); world .account(ESDT_SAFE_ADDRESS) .code(ESDT_SAFE_CODE_PATH) - .esdt_balance(TokenIdentifier::from_esdt_bytes(TOKEN_ID), 1000) - .esdt_balance(TokenIdentifier::from_esdt_bytes(DIFFERENT_TOKEN_ID), 1000) - .esdt_balance(TokenIdentifier::from_esdt_bytes(ANOTHER_TOKEN_ID), 1000) + .esdt_balance(TOKEN_ID, 1000) + .esdt_balance(DIFFERENT_TOKEN_ID, 1000) + .esdt_balance(ANOTHER_TOKEN_ID, 1000) .nonce(1); Self { world } @@ -61,8 +59,8 @@ impl FeeMarketTestState { fn deploy_fee_market(&mut self) -> &mut Self{ let fee = FeeStruct { - base_token: TokenIdentifier::from_esdt_bytes(TOKEN_ID), - fee_type: FeeType::Fixed { token: TokenIdentifier::from_esdt_bytes(TOKEN_ID), per_transfer: BigUint::from(100u64), per_gas: BigUint::from(0u64) }, + base_token: TOKEN_ID.to_token_identifier(), + fee_type: FeeType::Fixed { token: TOKEN_ID.to_token_identifier(), per_transfer: BigUint::from(100u64), per_gas: BigUint::from(0u64) }, }; self.world @@ -82,16 +80,16 @@ impl FeeMarketTestState { match payment_wanted { "Correct" => { - payment = EsdtTokenPayment::new(TokenIdentifier::from_esdt_bytes(TOKEN_ID), 0u64, BigUint::from(200u64)); + payment = EsdtTokenPayment::new(TOKEN_ID.to_token_identifier(), 0u64, BigUint::from(200u64)); } "InvalidToken" => { - payment = EsdtTokenPayment::new(TokenIdentifier::from_esdt_bytes(DIFFERENT_TOKEN_ID), 0u64, BigUint::from(10u64)); + payment = EsdtTokenPayment::new(DIFFERENT_TOKEN_ID.to_token_identifier(), 0u64, BigUint::from(10u64)); } "AnyToken" => { - payment = EsdtTokenPayment::new(TokenIdentifier::from_esdt_bytes(ANOTHER_TOKEN_ID), 0u64, BigUint::from(10u64)); + payment = EsdtTokenPayment::new(ANOTHER_TOKEN_ID.to_token_identifier(), 0u64, BigUint::from(10u64)); } "Less than fee" => { - payment = EsdtTokenPayment::new(TokenIdentifier::from_esdt_bytes(TOKEN_ID), 0u64, BigUint::from(0u64)); + payment = EsdtTokenPayment::new(TOKEN_ID.to_token_identifier(), 0u64, BigUint::from(0u64)); } _ => { panic!("Invalid payment wanted"); @@ -130,11 +128,11 @@ impl FeeMarketTestState { .from(OWNER_ADDRESS) .to(FEE_MARKET_ADDRESS) .typed(fee_market_proxy::FeeMarketProxy) - .disable_fee(TokenIdentifier::from_esdt_bytes(TOKEN_ID)) + .disable_fee(TOKEN_ID) .run(); } - fn add_fee(&mut self, token_id: &str, fee_type: &str, error_status: Option) { + fn add_fee(&mut self, token_id: TestTokenIdentifier, fee_type: &str, error_status: Option) { let fee_struct; @@ -142,40 +140,40 @@ impl FeeMarketTestState { "None" => { let fee_type = FeeType::None; fee_struct = FeeStruct { - base_token: TokenIdentifier::from_esdt_bytes(token_id), + base_token: token_id.to_token_identifier(), fee_type, }; } "Fixed" => { let fee_type = FeeType::Fixed { - token: TokenIdentifier::from_esdt_bytes(TOKEN_ID), + token: TOKEN_ID.to_token_identifier(), per_transfer: BigUint::from(10u8), per_gas: BigUint::from(10u8), }; fee_struct = FeeStruct { - base_token: TokenIdentifier::from_esdt_bytes(token_id), + base_token: token_id.to_token_identifier(), fee_type, }; } "AnyToken" => { let fee_type = FeeType::AnyToken { - base_fee_token: TokenIdentifier::from_esdt_bytes(DIFFERENT_TOKEN_ID), + base_fee_token: DIFFERENT_TOKEN_ID.to_token_identifier(), per_transfer: BigUint::from(10u8), per_gas: BigUint::from(10u8), }; fee_struct = FeeStruct { - base_token: TokenIdentifier::from_esdt_bytes(token_id), + base_token: token_id.to_token_identifier(), fee_type, }; } "AnyTokenWrong" => { let fee_type = FeeType::AnyToken { - base_fee_token: TokenIdentifier::from_esdt_bytes(WRONG_TOKEN_ID), + base_fee_token: WRONG_TOKEN_ID.to_token_identifier(), per_transfer: BigUint::from(10u8), per_gas: BigUint::from(10u8), }; fee_struct = FeeStruct { - base_token: TokenIdentifier::from_esdt_bytes(token_id), + base_token: token_id.to_token_identifier(), fee_type, }; } @@ -223,13 +221,13 @@ impl FeeMarketTestState { fn check_balance_sc(&mut self, address: TestSCAddress, expected_balance: u64) { self.world .check_account(address) - .esdt_balance(TokenIdentifier::from_esdt_bytes(TOKEN_ID), expected_balance); + .esdt_balance(TOKEN_ID, expected_balance); } fn check_account(&mut self, address: TestAddress, expected_balance: u64) { self.world .check_account(address) - .esdt_balance(TokenIdentifier::from_esdt_bytes(TOKEN_ID), expected_balance); + .esdt_balance(TOKEN_ID, expected_balance); } } @@ -247,13 +245,13 @@ fn test_add_fee_wrong_params() { state.deploy_fee_market(); - state.add_fee(WRONG_TOKEN_ID, "Fixed", Option::Some(ExpectError(4, "Invalid token ID"))); + state.add_fee(WRONG_TOKEN_ID, "Fixed", Some(ExpectError(4, "Invalid token ID"))); - state.add_fee(TOKEN_ID, "None", Option::Some(ExpectError(4, "Invalid fee type"))); + state.add_fee(TOKEN_ID, "None", Some(ExpectError(4, "Invalid fee type"))); - state.add_fee(DIFFERENT_TOKEN_ID, "Fixed", Option::Some(ExpectError(4, "Invalid fee"))); + state.add_fee(DIFFERENT_TOKEN_ID, "Fixed", Some(ExpectError(4, "Invalid fee"))); - state.add_fee(TOKEN_ID, "AnyTokenWrong", Option::Some(ExpectError(4, "Invalid token ID"))); + state.add_fee(TOKEN_ID, "AnyTokenWrong", Some(ExpectError(4, "Invalid token ID"))); } @@ -264,7 +262,7 @@ fn test_substract_fee_no_fee() { state.deploy_fee_market(); state.disable_fee(); - state.substract_fee("Correct", Option::None); + state.substract_fee("Correct", None); state.check_balance_sc(ESDT_SAFE_ADDRESS, 1000); state.check_account(USER_ADDRESS, 1000); @@ -278,7 +276,7 @@ fn test_substract_fee_whitelisted() { state.deploy_fee_market(); state.add_users_to_whitelist(); - state.substract_fee("Correct", Option::None); + state.substract_fee("Correct", None); state.check_balance_sc(ESDT_SAFE_ADDRESS, 1000); state.check_account(USER_ADDRESS, 1000); @@ -290,7 +288,7 @@ fn test_substract_fee_invalid_payment_token() { state.deploy_fee_market(); - state.substract_fee("InvalidToken", Option::Some(ExpectError(4, "Token not accepted as fee"))); + state.substract_fee("InvalidToken", Some(ExpectError(4, "Token not accepted as fee"))); state.check_balance_sc(ESDT_SAFE_ADDRESS, 1000); state.check_account(USER_ADDRESS, 1000); @@ -298,16 +296,16 @@ fn test_substract_fee_invalid_payment_token() { } // FAILS => get_safe_price should be mocked here in order to make this test work -#[test] -fn test_substract_fee_any_token() { - let mut state = FeeMarketTestState::new(); +// #[test] +// fn test_substract_fee_any_token() { +// let mut state = FeeMarketTestState::new(); - state.deploy_fee_market(); - state.add_fee(ANOTHER_TOKEN_ID, "AnyToken", Option::None); +// state.deploy_fee_market(); +// state.add_fee(ANOTHER_TOKEN_ID, "AnyToken", None); - state.substract_fee("AnyToken", Option::Some(ExpectError(4, "Invalid token provided for fee"))); +// state.substract_fee("AnyToken", Some(ExpectError(4, "Invalid token provided for fee"))); -} +// } #[test] fn test_substract_fixed_fee_payment_not_covered() { @@ -315,7 +313,7 @@ fn test_substract_fixed_fee_payment_not_covered() { state.deploy_fee_market(); - state.substract_fee("Less than fee", Option::Some(ExpectError(4, "Payment does not cover fee"))); + state.substract_fee("Less than fee", Some(ExpectError(4, "Payment does not cover fee"))); state.check_balance_sc(ESDT_SAFE_ADDRESS, 1000); state.check_account(USER_ADDRESS, 1000); @@ -327,7 +325,7 @@ fn test_substract_fee_fixed_payment_bigger_than_fee() { state.deploy_fee_market(); - state.substract_fee("Correct", Option::None); + state.substract_fee("Correct", None); state.check_balance_sc(ESDT_SAFE_ADDRESS, 800); state.check_account(USER_ADDRESS, 1100); From d744800b87d2a8bf3d760019166cbcff2ac7dbdd Mon Sep 17 00:00:00 2001 From: Andrei Baltariu Date: Tue, 8 Oct 2024 10:10:06 +0300 Subject: [PATCH 363/523] Final test fixes Signed-off-by: Andrei Baltariu --- .../tests/header_verifier_blackbox_test.rs | 66 ++++++++----------- 1 file changed, 26 insertions(+), 40 deletions(-) diff --git a/header-verifier/tests/header_verifier_blackbox_test.rs b/header-verifier/tests/header_verifier_blackbox_test.rs index e832974c..b80af056 100644 --- a/header-verifier/tests/header_verifier_blackbox_test.rs +++ b/header-verifier/tests/header_verifier_blackbox_test.rs @@ -1,10 +1,9 @@ use bls_signature::BlsSignature; use header_verifier::{header_verifier_proxy, Headerverifier}; +use multiversx_sc::types::ManagedBuffer; use multiversx_sc::{ api::ManagedTypeApi, - types::{ - BigUint, ManagedBuffer, ManagedByteArray, MultiValueEncoded, TestAddress, TestSCAddress, - }, + types::{BigUint, ManagedByteArray, MultiValueEncoded, TestAddress, TestSCAddress}, }; use multiversx_sc_scenario::{ api::StaticApi, imports::MxscPath, multiversx_chain_vm::crypto_functions::sha256, DebugApi, @@ -99,24 +98,6 @@ impl HeaderVerifierTestState { .run(); } - fn propose_remove_execute_hash_wrong_caller( - &mut self, - hash_of_hashes: &ManagedBuffer, - operation_hash: ManagedBuffer, - ) { - self.world - .tx() - .from(OWNER) - .to(HEADER_VERIFIER_ADDRESS) - .typed(header_verifier_proxy::HeaderverifierProxy) - .remove_executed_hash(hash_of_hashes, operation_hash) - .returns(ExpectError( - 4, - "Only ESDT Safe contract can call this endpoint", - )) - .run() - } - fn propose_remove_executed_hash( &mut self, caller: TestAddress, @@ -174,7 +155,7 @@ impl HeaderVerifierTestState { &mut self, operation: &ManagedBuffer, ) -> ManagedBuffer { - let array: &mut [u8; 64] = &mut [0u8; 64]; + let array: &mut [u8; 22] = &mut [0u8; 22]; operation.load_to_byte_array(array); ManagedBuffer::from(&sha256(array)) @@ -237,16 +218,13 @@ fn test_register_bridge_operation() { assert!(sc.hash_of_hashes_history().contains(&hash_of_hashes)); assert!(!sc.pending_hashes(&hash_of_hashes).is_empty()); - let pending_hash_1 = sc.pending_hashes(&hash_of_hashes).get_by_index(1); - let pending_hash_2 = sc.pending_hashes(&hash_of_hashes).get_by_index(2); - - let expected_hash_1_debug_api: ManagedBuffer = - ManagedBuffer::from(operation_1.to_vec()); - let expected_hash_2_debug_api: ManagedBuffer = - ManagedBuffer::from(operation_2.to_vec()); - - assert_eq!(pending_hash_1, expected_hash_1_debug_api); - assert_eq!(pending_hash_2, expected_hash_2_debug_api); + for (mut i, operation_hash) in operation.operations_hashes.into_iter().enumerate() { + i += 1; + let pending_hash = sc.pending_hashes(&hash_of_hashes).get_by_index(i); + let expected_hash_debug_api: ManagedBuffer = + ManagedBuffer::from(operation_hash.to_vec()); + assert_eq!(pending_hash, expected_hash_debug_api); + } }); } @@ -261,10 +239,19 @@ fn test_remove_executed_hash_caller_not_esdt_address() { let operation_1 = ManagedBuffer::from("operation_1"); let operation_2 = ManagedBuffer::from("operation_2"); let operation = state.generate_bridge_operation_struct(vec![&operation_1, &operation_2]); + let error_status = ErrorStatus { + code: 4, + error_message: "Only ESDT Safe contract can call this endpoint", + }; state.propose_register_operations(operation.clone()); state.propose_register_esdt_address(ENSHRINE_ADDRESS); - state.propose_remove_execute_hash_wrong_caller(&operation.bridge_operation_hash, operation_1); + state.propose_remove_executed_hash( + OWNER, + &operation.bridge_operation_hash, + operation_1, + Some(error_status), + ); } #[test] @@ -301,22 +288,21 @@ fn test_remove_one_executed_hash() { state.deploy_header_verifier_contract(managed_bls_keys); - let operation_1 = ManagedBuffer::from("operation_1"); - let operation_2 = ManagedBuffer::from("operation_2"); - let operation = state.generate_bridge_operation_struct(vec![&operation_1, &operation_2]); + let operation_hash_1 = ManagedBuffer::from("operation_1"); + let operation_hash_2 = ManagedBuffer::from("operation_2"); + let operation = + state.generate_bridge_operation_struct(vec![&operation_hash_1, &operation_hash_2]); state.propose_register_operations(operation.clone()); state.propose_register_esdt_address(ENSHRINE_ADDRESS); - let operation_1_hash = state.get_operation_hash(&operation_1); state.propose_remove_executed_hash( ENSHRINE_ADDRESS, &operation.bridge_operation_hash, - operation_1_hash, + operation_hash_1, None, ); - let expected_hash_2 = state.get_operation_hash(&operation_2); state .world .query() @@ -329,7 +315,7 @@ fn test_remove_one_executed_hash() { let pending_hash_2 = sc.pending_hashes(&hash_of_hashes).get_by_index(1); let expected_hash_2_debug_api: ManagedBuffer = - ManagedBuffer::from(expected_hash_2.to_vec()); + ManagedBuffer::from(operation_hash_2.to_vec()); assert_eq!(pending_hash_2, expected_hash_2_debug_api); }); From cdae8466dca5577f68a4227209e133a20ee0ce86 Mon Sep 17 00:00:00 2001 From: sergiuosvat Date: Tue, 8 Oct 2024 11:50:14 +0300 Subject: [PATCH 364/523] init esdt-safe interactor --- Cargo.lock | 1494 ++++++++++++++++++- Cargo.toml | 1 + esdt-safe/interactor/.gitignore | 2 + esdt-safe/interactor/Cargo.toml | 33 + esdt-safe/interactor/src/interactor_main.rs | 682 +++++++++ esdt-safe/interactor/src/proxy.rs | 432 ++++++ esdt-safe/interactor/state.toml | 1 + esdt-safe/sc-config.toml | 4 + 8 files changed, 2570 insertions(+), 79 deletions(-) create mode 100644 esdt-safe/interactor/.gitignore create mode 100644 esdt-safe/interactor/Cargo.toml create mode 100644 esdt-safe/interactor/src/interactor_main.rs create mode 100644 esdt-safe/interactor/src/proxy.rs create mode 100644 esdt-safe/interactor/state.toml diff --git a/Cargo.lock b/Cargo.lock index cf447216..6b74ea97 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2,6 +2,32 @@ # It is not intended for manual editing. version = 3 +[[package]] +name = "addr2line" +version = "0.22.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6e4503c46a5c0c7844e948c9a4d6acd9f50cccb4de1c48eb9e291ea17470c678" +dependencies = [ + "gimli", +] + +[[package]] +name = "adler" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f26201604c87b1e01bd3d98f8d5d9a8fcbb815e8cedb41ffccbeb4bf593a35fe" + +[[package]] +name = "aes" +version = "0.8.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b169f7a6d4742236a0a00c541b845991d0ac43e546831af1249753ab4c3aa3a0" +dependencies = [ + "cfg-if", + "cipher", + "cpufeatures", +] + [[package]] name = "ahash" version = "0.8.11" @@ -14,6 +40,15 @@ dependencies = [ "zerocopy", ] +[[package]] +name = "aho-corasick" +version = "1.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8e60d3430d3a69478ad0993f19238d2df97c507009a52b3c10addcd7f6bcb916" +dependencies = [ + "memchr", +] + [[package]] name = "anstream" version = "0.6.13" @@ -74,12 +109,33 @@ version = "0.7.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7c02d123df017efcdfbd739ef81735b36c5ba83ec3c59c80a9d7ecc718f92e50" +[[package]] +name = "atomic-waker" +version = "1.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1505bd5d3d116872e7271a6d4e16d81d0c8570876c8de68093a09ac269d8aac0" + [[package]] name = "autocfg" version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f1fdabc7756949593fe60f30ec81974b613357de856987752631dea1e3394c80" +[[package]] +name = "backtrace" +version = "0.3.73" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5cc23269a4f8976d0a4d2e7109211a419fe30e8d88d677cd60b6bc79c5732e0a" +dependencies = [ + "addr2line", + "cc", + "cfg-if", + "libc", + "miniz_oxide", + "object", + "rustc-demangle", +] + [[package]] name = "base64" version = "0.22.0" @@ -98,6 +154,41 @@ version = "0.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d965446196e3b7decd44aa7ee49e31d630118f90ef12f97900f262eb915c951d" +[[package]] +name = "bip39" +version = "2.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "33415e24172c1b7d6066f6d999545375ab8e1d95421d6784bdfff9496f292387" +dependencies = [ + "bitcoin_hashes", + "rand", + "rand_core", + "serde", + "unicode-normalization", +] + +[[package]] +name = "bitcoin-internals" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9425c3bf7089c983facbae04de54513cce73b41c7f9ff8c845b54e7bc64ebbfb" + +[[package]] +name = "bitcoin_hashes" +version = "0.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1930a4dabfebb8d7d9992db18ebe3ae2876f0a305fab206fd168df931ede293b" +dependencies = [ + "bitcoin-internals", + "hex-conservative", +] + +[[package]] +name = "bitflags" +version = "1.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" + [[package]] name = "bitflags" version = "2.6.0" @@ -122,6 +213,27 @@ dependencies = [ "transaction", ] +[[package]] +name = "bumpalo" +version = "3.16.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "79296716171880943b8470b5f8d03aa55eb2e645a4874bdbb28adb49162e012c" + +[[package]] +name = "bytes" +version = "1.7.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "428d9aa8fbc0670b7b8d6030a7fadd0f86151cae55e4dbbece15f3780a3dfaf3" + +[[package]] +name = "cc" +version = "1.1.28" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2e80e3b6a3ab07840e1cae9b0666a63970dc28e8ed5ffbcdacbfc760c281bfc1" +dependencies = [ + "shlex", +] + [[package]] name = "cfg-if" version = "1.0.0" @@ -166,6 +278,16 @@ dependencies = [ "multiversx-sc-meta-lib", ] +[[package]] +name = "cipher" +version = "0.4.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "773f3b9af64447d2ce9850330c473515014aa235e6a783b02db81ff39e4a3dad" +dependencies = [ + "crypto-common", + "inout", +] + [[package]] name = "clap" version = "4.5.4" @@ -237,6 +359,22 @@ dependencies = [ "unicode-segmentation", ] +[[package]] +name = "core-foundation" +version = "0.9.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "91e195e091a93c46f7102ec7818a2aa394e1e1771c3ab4825963fa03e45afb8f" +dependencies = [ + "core-foundation-sys", + "libc", +] + +[[package]] +name = "core-foundation-sys" +version = "0.8.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "773648b94d0e5d620f64f280777445740e61fe701025087ec8b57f45c791888b" + [[package]] name = "cpufeatures" version = "0.2.12" @@ -256,6 +394,15 @@ dependencies = [ "typenum", ] +[[package]] +name = "ctr" +version = "0.9.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0369ee1ad671834580515889b80f2ea915f23b8be8d0daa4bbaf2ac5c7590835" +dependencies = [ + "cipher", +] + [[package]] name = "curve25519-dalek" version = "4.1.3" @@ -301,6 +448,7 @@ checksum = "9ed9a281f7bc9b7576e61468ba615a66a5c8cfdff42420a70aa82701a3b1e292" dependencies = [ "block-buffer", "crypto-common", + "subtle", ] [[package]] @@ -333,6 +481,15 @@ version = "1.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "11157ac094ffbdde99aa67b23417ebdd801842852b500e395a45a9c0aac03e4a" +[[package]] +name = "encoding_rs" +version = "0.8.34" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b45de904aa0b010bce2ab45264d0631681847fa7b6f2eaa7dab7619943bc4f59" +dependencies = [ + "cfg-if", +] + [[package]] name = "endian-type" version = "0.1.2" @@ -369,12 +526,45 @@ dependencies = [ "multiversx-sc-meta-lib", ] +[[package]] +name = "env_filter" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4f2c92ceda6ceec50f43169f9ee8424fe2db276791afde7b2cd8bc084cb376ab" +dependencies = [ + "log", + "regex", +] + +[[package]] +name = "env_logger" +version = "0.11.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e13fa619b91fb2381732789fc5de83b45675e882f66623b7d8cb4f643017018d" +dependencies = [ + "anstream", + "anstyle", + "env_filter", + "humantime", + "log", +] + [[package]] name = "equivalent" version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5443807d6dff69373d433ab9ef5378ad8df50ca6298caf15de6e52e24aaf54d5" +[[package]] +name = "errno" +version = "0.3.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "534c5cf6194dfab3db3242765c03bbe257cf92f22b38f6bc0c58d59108a820ba" +dependencies = [ + "libc", + "windows-sys 0.52.0", +] + [[package]] name = "esdt-safe" version = "0.0.0" @@ -404,6 +594,12 @@ dependencies = [ "multiversx-sc-meta-lib", ] +[[package]] +name = "fastrand" +version = "2.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e8c02a5121d4ea3eb16a80748c74f5549a5665e4c21333c6098f283870fbdea6" + [[package]] name = "fee-market" version = "0.0.0" @@ -430,6 +626,125 @@ version = "0.2.9" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "28dea519a9695b9977216879a3ebfddf92f1c08c05d984f8996aecd6ecdc811d" +[[package]] +name = "fnv" +version = "1.0.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" + +[[package]] +name = "foreign-types" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f6f339eb8adc052cd2ca78910fda869aefa38d22d5cb648e6485e4d3fc06f3b1" +dependencies = [ + "foreign-types-shared", +] + +[[package]] +name = "foreign-types-shared" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "00b0228411908ca8685dba7fc2cdd70ec9990a6e753e89b6ac91a84c40fbaf4b" + +[[package]] +name = "form_urlencoded" +version = "1.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e13624c2627564efccf4934284bdd98cbaa14e79b0b5a141218e507b3a823456" +dependencies = [ + "percent-encoding", +] + +[[package]] +name = "futures" +version = "0.3.31" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "65bc07b1a8bc7c85c5f2e110c476c7389b4554ba72af57d8445ea63a576b0876" +dependencies = [ + "futures-channel", + "futures-core", + "futures-executor", + "futures-io", + "futures-sink", + "futures-task", + "futures-util", +] + +[[package]] +name = "futures-channel" +version = "0.3.31" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2dff15bf788c671c1934e366d07e30c1814a8ef514e1af724a602e8a2fbe1b10" +dependencies = [ + "futures-core", + "futures-sink", +] + +[[package]] +name = "futures-core" +version = "0.3.31" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "05f29059c0c2090612e8d742178b0580d2dc940c837851ad723096f87af6663e" + +[[package]] +name = "futures-executor" +version = "0.3.31" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1e28d1d997f585e54aebc3f97d39e72338912123a67330d723fdbb564d646c9f" +dependencies = [ + "futures-core", + "futures-task", + "futures-util", +] + +[[package]] +name = "futures-io" +version = "0.3.31" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9e5c1b78ca4aae1ac06c48a526a655760685149f0d465d21f37abfe57ce075c6" + +[[package]] +name = "futures-macro" +version = "0.3.31" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "162ee34ebcb7c64a8abebc059ce0fee27c2262618d7b60ed8faf72fef13c3650" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "futures-sink" +version = "0.3.31" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e575fab7d1e0dcb8d0c7bcf9a63ee213816ab51902e6d244a95819acacf1d4f7" + +[[package]] +name = "futures-task" +version = "0.3.31" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f90f7dce0722e95104fcb095585910c0977252f286e354b5e3bd38902cd99988" + +[[package]] +name = "futures-util" +version = "0.3.31" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9fa08315bb612088cc391249efdc3bc77536f16c91f6cf495e6fbe85b20a4a81" +dependencies = [ + "futures-channel", + "futures-core", + "futures-io", + "futures-macro", + "futures-sink", + "futures-task", + "memchr", + "pin-project-lite", + "pin-utils", + "slab", +] + [[package]] name = "generic-array" version = "0.14.7" @@ -451,6 +766,31 @@ dependencies = [ "wasi", ] +[[package]] +name = "gimli" +version = "0.29.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "40ecd4077b5ae9fd2e9e169b102c6c330d0605168eb0e8bf79952b256dbefffd" + +[[package]] +name = "h2" +version = "0.4.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "524e8ac6999421f49a846c2d4411f337e53497d8ec55d67753beffa43c5d9205" +dependencies = [ + "atomic-waker", + "bytes", + "fnv", + "futures-core", + "futures-sink", + "http", + "indexmap", + "slab", + "tokio", + "tokio-util", + "tracing", +] + [[package]] name = "hashbrown" version = "0.14.3" @@ -486,12 +826,24 @@ version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2304e00983f87ffb38b55b444b5e3b60a884b5d30c0fca7d82fe33449bbe55ea" +[[package]] +name = "hermit-abi" +version = "0.3.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d231dfb89cfffdbc30e7fc41579ed6066ad03abda9e567ccafae602b97ec5024" + [[package]] name = "hex" version = "0.4.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7f24254aa9a54b5c858eaee2f5bccdb46aaf0e486a595ed5fd8f86ba55232a70" +[[package]] +name = "hex-conservative" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "212ab92002354b4819390025006c897e8140934349e8635c9b077f47b4dcbd20" + [[package]] name = "hex-literal" version = "0.4.1" @@ -499,85 +851,289 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6fe2267d4ed49bc07b63801559be28c718ea06c4738b7a03c94df7386d2cde46" [[package]] -name = "indexmap" -version = "2.2.6" +name = "hmac" +version = "0.12.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "168fb715dda47215e360912c096649d23d58bf392ac62f73919e831745e40f26" +checksum = "6c49c37c09c17a53d937dfbb742eb3a961d65a994e6bcdcf37e7399d0cc8ab5e" dependencies = [ - "equivalent", - "hashbrown", - "serde", + "digest", ] [[package]] -name = "itertools" -version = "0.13.0" +name = "http" +version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "413ee7dfc52ee1a4949ceeb7dbc8a33f2d6c088194d9f922fb8318faf1f01186" +checksum = "21b9ddb458710bc376481b842f5da65cdf31522de232c1ca8146abce2a358258" dependencies = [ - "either", + "bytes", + "fnv", + "itoa", ] [[package]] -name = "itoa" -version = "1.0.11" +name = "http-body" +version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "49f1f14873335454500d59611f1cf4a4b0f786f9ac11f4312a78e4cf2566695b" +checksum = "1efedce1fb8e6913f23e0c92de8e62cd5b772a67e7b3946df930a62566c93184" +dependencies = [ + "bytes", + "http", +] [[package]] -name = "keccak" -version = "0.1.5" +name = "http-body-util" +version = "0.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ecc2af9a1119c51f12a14607e783cb977bde58bc069ff0c3da1095e635d70654" +checksum = "793429d76616a256bcb62c2a2ec2bed781c8307e797e2598c50010f2bee2544f" dependencies = [ - "cpufeatures", + "bytes", + "futures-util", + "http", + "http-body", + "pin-project-lite", ] [[package]] -name = "lazy_static" -version = "1.4.0" +name = "httparse" +version = "1.9.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" +checksum = "7d71d3574edd2771538b901e6549113b4006ece66150fb69c0fb6d9a2adae946" [[package]] -name = "libc" -version = "0.2.153" +name = "humantime" +version = "2.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9c198f91728a82281a64e1f4f9eeb25d82cb32a5de251c6bd1b5154d63a8e7bd" +checksum = "9a3a5bfb195931eeb336b2a7b4d761daec841b97f947d34394601737a7bba5e4" [[package]] -name = "log" -version = "0.4.21" +name = "hyper" +version = "1.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "90ed8c1e510134f979dbc4f070f87d4313098b704861a105fe34231c70a3901c" +checksum = "50dfd22e0e76d0f662d429a5f80fcaf3855009297eab6a0a9f8543834744ba05" +dependencies = [ + "bytes", + "futures-channel", + "futures-util", + "h2", + "http", + "http-body", + "httparse", + "itoa", + "pin-project-lite", + "smallvec", + "tokio", + "want", +] [[package]] -name = "max-bridged-amount-module" -version = "0.0.0" +name = "hyper-rustls" +version = "0.27.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "08afdbb5c31130e3034af566421053ab03787c640246a446327f550d11bcb333" dependencies = [ - "multiversx-sc", - "multiversx-sc-scenario", + "futures-util", + "http", + "hyper", + "hyper-util", + "rustls", + "rustls-pki-types", + "tokio", + "tokio-rustls", + "tower-service", ] [[package]] -name = "memchr" -version = "2.7.2" +name = "hyper-tls" +version = "0.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6c8640c5d730cb13ebd907d8d04b52f55ac9a2eec55b440c8892f40d56c76c1d" +checksum = "70206fc6890eaca9fde8a0bf71caa2ddfc9fe045ac9e5c70df101a7dbde866e0" +dependencies = [ + "bytes", + "http-body-util", + "hyper", + "hyper-util", + "native-tls", + "tokio", + "tokio-native-tls", + "tower-service", +] [[package]] -name = "multiversx-chain-scenario-format" -version = "0.23.0" +name = "hyper-util" +version = "0.1.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dcca77966bf5eb9c9f96d0597f17a4fa7b64681cc7b83e39bdf31f8c6ca04d44" +checksum = "41296eb09f183ac68eec06e03cdbea2e759633d4067b2f6552fc2e009bcad08b" dependencies = [ - "bech32", - "hex", - "num-bigint", - "num-traits", - "serde", - "serde_json", - "sha3", + "bytes", + "futures-channel", + "futures-util", + "http", + "http-body", + "hyper", + "pin-project-lite", + "socket2", + "tokio", + "tower-service", + "tracing", +] + +[[package]] +name = "idna" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "634d9b1461af396cad843f47fdba5597a4f9e6ddd4bfb6ff5d85028c25cb12f6" +dependencies = [ + "unicode-bidi", + "unicode-normalization", +] + +[[package]] +name = "indexmap" +version = "2.2.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "168fb715dda47215e360912c096649d23d58bf392ac62f73919e831745e40f26" +dependencies = [ + "equivalent", + "hashbrown", + "serde", +] + +[[package]] +name = "inout" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a0c10553d664a4d0bcff9f4215d0aac67a639cc68ef660840afe309b807bc9f5" +dependencies = [ + "generic-array", +] + +[[package]] +name = "ipnet" +version = "2.10.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ddc24109865250148c2e0f3d25d4f0f479571723792d3802153c60922a4fb708" + +[[package]] +name = "itertools" +version = "0.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "413ee7dfc52ee1a4949ceeb7dbc8a33f2d6c088194d9f922fb8318faf1f01186" +dependencies = [ + "either", +] + +[[package]] +name = "itoa" +version = "1.0.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "49f1f14873335454500d59611f1cf4a4b0f786f9ac11f4312a78e4cf2566695b" + +[[package]] +name = "js-sys" +version = "0.3.70" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1868808506b929d7b0cfa8f75951347aa71bb21144b7791bae35d9bccfcfe37a" +dependencies = [ + "wasm-bindgen", +] + +[[package]] +name = "keccak" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ecc2af9a1119c51f12a14607e783cb977bde58bc069ff0c3da1095e635d70654" +dependencies = [ + "cpufeatures", +] + +[[package]] +name = "lazy_static" +version = "1.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" + +[[package]] +name = "libc" +version = "0.2.153" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9c198f91728a82281a64e1f4f9eeb25d82cb32a5de251c6bd1b5154d63a8e7bd" + +[[package]] +name = "linux-raw-sys" +version = "0.4.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "78b3ae25bc7c8c38cec158d1f2757ee79e9b3740fbc7ccf0e59e4b08d793fa89" + +[[package]] +name = "lock_api" +version = "0.4.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "07af8b9cdd281b7915f413fa73f29ebd5d55d0d3f0155584dade1ff18cea1b17" +dependencies = [ + "autocfg", + "scopeguard", +] + +[[package]] +name = "log" +version = "0.4.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "90ed8c1e510134f979dbc4f070f87d4313098b704861a105fe34231c70a3901c" + +[[package]] +name = "max-bridged-amount-module" +version = "0.0.0" +dependencies = [ + "multiversx-sc", + "multiversx-sc-scenario", +] + +[[package]] +name = "memchr" +version = "2.7.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6c8640c5d730cb13ebd907d8d04b52f55ac9a2eec55b440c8892f40d56c76c1d" + +[[package]] +name = "mime" +version = "0.3.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6877bb514081ee2a7ff5ef9de3281f14a4dd4bceac4c09388074a6b5df8a139a" + +[[package]] +name = "miniz_oxide" +version = "0.7.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b8a240ddb74feaf34a79a7add65a741f3167852fba007066dcac1ca548d89c08" +dependencies = [ + "adler", +] + +[[package]] +name = "mio" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "80e04d1dcff3aae0704555fe5fee3bcfaf3d1fdf8a7e521d5b9d2b42acb52cec" +dependencies = [ + "hermit-abi", + "libc", + "wasi", + "windows-sys 0.52.0", +] + +[[package]] +name = "multiversx-chain-scenario-format" +version = "0.23.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dcca77966bf5eb9c9f96d0597f17a4fa7b64681cc7b83e39bdf31f8c6ca04d44" +dependencies = [ + "bech32", + "hex", + "num-bigint", + "num-traits", + "serde", + "serde_json", + "sha3", ] [[package]] @@ -586,7 +1142,7 @@ version = "0.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "13c537d27dfc7a8e295d4f7c5f67a967ce66b6c3fc8e31a160e8cf28e14ecb2d" dependencies = [ - "bitflags", + "bitflags 2.6.0", "colored", "ed25519-dalek", "hex", @@ -613,7 +1169,7 @@ version = "0.53.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e05f8dfb9c2dd26feff1330b1e229f0886f5c0228ed570f19421a458e6e7b0ef" dependencies = [ - "bitflags", + "bitflags 2.6.0", "hex-literal", "multiversx-sc-codec", "multiversx-sc-derive", @@ -714,6 +1270,71 @@ dependencies = [ "unwrap-infallible", ] +[[package]] +name = "multiversx-sc-snippets" +version = "0.53.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f4ce1b7a02e9d5a500f05fb746f80a4e455d179b06c5f69218cebcc20afdec7c" +dependencies = [ + "base64", + "env_logger", + "futures", + "hex", + "log", + "multiversx-chain-scenario-format", + "multiversx-sc-scenario", + "multiversx-sdk", + "tokio", +] + +[[package]] +name = "multiversx-sdk" +version = "0.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ccf9bc1c31815db80017c68353b7187bc606b573af26f13331e9507d29f1976f" +dependencies = [ + "aes", + "anyhow", + "base64", + "bech32", + "bip39", + "ctr", + "hex", + "hmac", + "itertools", + "log", + "pbkdf2", + "pem", + "rand", + "reqwest", + "scrypt", + "serde", + "serde_json", + "serde_repr", + "sha2", + "sha3", + "tokio", + "uuid", + "zeroize", +] + +[[package]] +name = "native-tls" +version = "0.2.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a8614eb2c83d59d1c8cc974dd3f920198647674a0a035e1af1fa58707e317466" +dependencies = [ + "libc", + "log", + "openssl", + "openssl-probe", + "openssl-sys", + "schannel", + "security-framework", + "security-framework-sys", + "tempfile", +] + [[package]] name = "nibble_vec" version = "0.1.0" @@ -751,18 +1372,143 @@ dependencies = [ "autocfg", ] +[[package]] +name = "object" +version = "0.36.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "aedf0a2d09c573ed1d8d85b30c119153926a2b36dce0ab28322c09a117a4683e" +dependencies = [ + "memchr", +] + [[package]] name = "once_cell" version = "1.19.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3fdb12b2476b595f9358c5161aa467c2438859caa136dec86c26fdd2efe17b92" +[[package]] +name = "openssl" +version = "0.10.66" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9529f4786b70a3e8c61e11179af17ab6188ad8d0ded78c5529441ed39d4bd9c1" +dependencies = [ + "bitflags 2.6.0", + "cfg-if", + "foreign-types", + "libc", + "once_cell", + "openssl-macros", + "openssl-sys", +] + +[[package]] +name = "openssl-macros" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a948666b637a0f465e8564c73e89d4dde00d72d4d473cc972f390fc3dcee7d9c" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "openssl-probe" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ff011a302c396a5197692431fc1948019154afc178baf7d8e37367442a4601cf" + +[[package]] +name = "openssl-sys" +version = "0.9.103" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7f9e8deee91df40a943c71b917e5874b951d32a802526c85721ce3b776c929d6" +dependencies = [ + "cc", + "libc", + "pkg-config", + "vcpkg", +] + +[[package]] +name = "parking_lot" +version = "0.12.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f1bf18183cf54e8d6059647fc3063646a1801cf30896933ec2311622cc4b9a27" +dependencies = [ + "lock_api", + "parking_lot_core", +] + +[[package]] +name = "parking_lot_core" +version = "0.9.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1e401f977ab385c9e4e3ab30627d6f26d00e2c73eef317493c4ec6d468726cf8" +dependencies = [ + "cfg-if", + "libc", + "redox_syscall", + "smallvec", + "windows-targets 0.52.4", +] + +[[package]] +name = "password-hash" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "346f04948ba92c43e8469c1ee6736c7563d71012b17d40745260fe106aac2166" +dependencies = [ + "base64ct", + "rand_core", + "subtle", +] + [[package]] name = "pathdiff" version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8835116a5c179084a830efb3adc117ab007512b535bc1a21c991d3b32a6b44dd" +[[package]] +name = "pbkdf2" +version = "0.12.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f8ed6a7761f76e3b9f92dfb0a60a6a6477c61024b775147ff0973a02653abaf2" +dependencies = [ + "digest", + "hmac", +] + +[[package]] +name = "pem" +version = "3.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8e459365e590736a54c3fa561947c84837534b8e9af6fc5bf781307e82658fae" +dependencies = [ + "base64", + "serde", +] + +[[package]] +name = "percent-encoding" +version = "2.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e3148f5046208a5d56bcfc03053e3ca6334e51da8dfb19b6cdc8b306fae3283e" + +[[package]] +name = "pin-project-lite" +version = "0.2.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bda66fc9667c18cb2758a2ac84d1167245054bcf85d5d1aaa6923f45801bdd02" + +[[package]] +name = "pin-utils" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184" + [[package]] name = "pkcs8" version = "0.10.2" @@ -773,6 +1519,12 @@ dependencies = [ "spki", ] +[[package]] +name = "pkg-config" +version = "0.3.31" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "953ec861398dccce10c670dfeaf3ec4911ca479e9c02154b3a215178c5f566f2" + [[package]] name = "ppv-lite86" version = "0.2.17" @@ -798,68 +1550,296 @@ dependencies = [ ] [[package]] -name = "radix_trie" -version = "0.2.1" +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 = "rand" +version = "0.8.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "34af8d1a0e25924bc5b7c43c079c942339d8f0a8b57c39049bef581b46327404" +dependencies = [ + "libc", + "rand_chacha", + "rand_core", +] + +[[package]] +name = "rand_chacha" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e6c10a63a0fa32252be49d21e7709d4d4baf8d231c2dbce1eaa8141b9b127d88" +dependencies = [ + "ppv-lite86", + "rand_core", +] + +[[package]] +name = "rand_core" +version = "0.6.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c" +dependencies = [ + "getrandom", +] + +[[package]] +name = "rand_seeder" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4a9febe641d2842ffc76ee962668a17578767c4e01735e4802b21ed9a24b2e4e" +dependencies = [ + "rand_core", +] + +[[package]] +name = "redox_syscall" +version = "0.5.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9b6dfecf2c74bce2466cabf93f6664d6998a69eb21e39f4207930065b27b771f" +dependencies = [ + "bitflags 2.6.0", +] + +[[package]] +name = "regex" +version = "1.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "38200e5ee88914975b69f657f0801b6f6dccafd44fd9326302a4aaeecfacb1d8" +dependencies = [ + "aho-corasick", + "memchr", + "regex-automata", + "regex-syntax", +] + +[[package]] +name = "regex-automata" +version = "0.4.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "368758f23274712b504848e9d5a6f010445cc8b87a7cdb4d7cbee666c1288da3" +dependencies = [ + "aho-corasick", + "memchr", + "regex-syntax", +] + +[[package]] +name = "regex-syntax" +version = "0.8.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2b15c43186be67a4fd63bee50d0303afffcef381492ebe2c5d87f324e1b8815c" + +[[package]] +name = "reqwest" +version = "0.12.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c7d6d2a27d57148378eb5e111173f4276ad26340ecc5c49a4a2152167a2d6a37" +dependencies = [ + "base64", + "bytes", + "encoding_rs", + "futures-channel", + "futures-core", + "futures-util", + "h2", + "http", + "http-body", + "http-body-util", + "hyper", + "hyper-rustls", + "hyper-tls", + "hyper-util", + "ipnet", + "js-sys", + "log", + "mime", + "native-tls", + "once_cell", + "percent-encoding", + "pin-project-lite", + "rustls-pemfile", + "serde", + "serde_json", + "serde_urlencoded", + "sync_wrapper", + "system-configuration", + "tokio", + "tokio-native-tls", + "tower-service", + "url", + "wasm-bindgen", + "wasm-bindgen-futures", + "web-sys", + "winreg", +] + +[[package]] +name = "ring" +version = "0.17.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c17fa4cb658e3583423e915b9f3acc01cceaee1860e33d59ebae66adc3a2dc0d" +dependencies = [ + "cc", + "cfg-if", + "getrandom", + "libc", + "spin", + "untrusted", + "windows-sys 0.52.0", +] + +[[package]] +name = "rust-interact" +version = "0.0.0" +dependencies = [ + "clap", + "esdt-safe", + "multiversx-sc", + "multiversx-sc-snippets", + "serde", + "toml", + "transaction", + "tx-batch-module", +] + +[[package]] +name = "rustc-demangle" +version = "0.1.24" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "719b953e2095829ee67db738b3bfa9fa368c94900df327b3f07fe6e794d2fe1f" + +[[package]] +name = "rustc_version" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bfa0f585226d2e68097d4f95d113b15b83a82e819ab25717ec0590d9584ef366" +dependencies = [ + "semver", +] + +[[package]] +name = "rustix" +version = "0.38.34" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "70dc5ec042f7a43c4a73241207cecc9873a06d45debb38b329f8541d85c2730f" +dependencies = [ + "bitflags 2.6.0", + "errno", + "libc", + "linux-raw-sys", + "windows-sys 0.52.0", +] + +[[package]] +name = "rustls" +version = "0.23.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "415d9944693cb90382053259f89fbb077ea730ad7273047ec63b19bc9b160ba8" +dependencies = [ + "once_cell", + "rustls-pki-types", + "rustls-webpki", + "subtle", + "zeroize", +] + +[[package]] +name = "rustls-pemfile" +version = "2.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dce314e5fee3f39953d46bb63bb8a46d40c2f8fb7cc5a3b6cab2bde9721d6e50" +dependencies = [ + "rustls-pki-types", +] + +[[package]] +name = "rustls-pki-types" +version = "1.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0e696e35370c65c9c541198af4543ccd580cf17fc25d8e05c5a242b202488c55" + +[[package]] +name = "rustls-webpki" +version = "0.102.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c069c179fcdc6a2fe24d8d18305cf085fdbd4f922c041943e203685d6a1c58fd" +checksum = "64ca1bc8749bd4cf37b5ce386cc146580777b4e8572c7b97baf22c83f444bee9" dependencies = [ - "endian-type", - "nibble_vec", + "ring", + "rustls-pki-types", + "untrusted", ] [[package]] -name = "rand" -version = "0.8.5" +name = "ryu" +version = "1.0.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "34af8d1a0e25924bc5b7c43c079c942339d8f0a8b57c39049bef581b46327404" -dependencies = [ - "libc", - "rand_chacha", - "rand_core", -] +checksum = "e86697c916019a8588c99b5fac3cead74ec0b4b819707a682fd4d23fa0ce1ba1" [[package]] -name = "rand_chacha" -version = "0.3.1" +name = "salsa20" +version = "0.10.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e6c10a63a0fa32252be49d21e7709d4d4baf8d231c2dbce1eaa8141b9b127d88" +checksum = "97a22f5af31f73a954c10289c93e8a50cc23d971e80ee446f1f6f7137a088213" dependencies = [ - "ppv-lite86", - "rand_core", + "cipher", ] [[package]] -name = "rand_core" -version = "0.6.4" +name = "schannel" +version = "0.1.23" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c" +checksum = "fbc91545643bcf3a0bbb6569265615222618bdf33ce4ffbbd13c4bbd4c093534" dependencies = [ - "getrandom", + "windows-sys 0.52.0", ] [[package]] -name = "rand_seeder" -version = "0.3.0" +name = "scopeguard" +version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4a9febe641d2842ffc76ee962668a17578767c4e01735e4802b21ed9a24b2e4e" +checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49" + +[[package]] +name = "scrypt" +version = "0.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0516a385866c09368f0b5bcd1caff3366aace790fcd46e2bb032697bb172fd1f" dependencies = [ - "rand_core", + "password-hash", + "pbkdf2", + "salsa20", + "sha2", ] [[package]] -name = "rustc_version" -version = "0.4.0" +name = "security-framework" +version = "2.11.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bfa0f585226d2e68097d4f95d113b15b83a82e819ab25717ec0590d9584ef366" +checksum = "897b2245f0b511c87893af39b033e5ca9cce68824c4d7e7630b5a1d339658d02" dependencies = [ - "semver", + "bitflags 2.6.0", + "core-foundation", + "core-foundation-sys", + "libc", + "security-framework-sys", ] [[package]] -name = "ryu" -version = "1.0.17" +name = "security-framework-sys" +version = "2.12.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e86697c916019a8588c99b5fac3cead74ec0b4b819707a682fd4d23fa0ce1ba1" +checksum = "ea4a292869320c0272d7bc55a5a6aafaff59b4f63404a003887b679a2e05b4b6" +dependencies = [ + "core-foundation-sys", + "libc", +] [[package]] name = "semver" @@ -893,11 +1873,23 @@ version = "1.0.115" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "12dc5c46daa8e9fdf4f5e71b6cf9a53f2487da0e86e55808e2d35539666497dd" dependencies = [ + "indexmap", "itoa", "ryu", "serde", ] +[[package]] +name = "serde_repr" +version = "0.1.19" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6c64451ba24fc7a6a2d60fc75dd9c83c90903b19028d4eff35e88fc1e86564e9" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + [[package]] name = "serde_spanned" version = "0.6.5" @@ -907,6 +1899,18 @@ dependencies = [ "serde", ] +[[package]] +name = "serde_urlencoded" +version = "0.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d3491c14715ca2294c4d6a88f15e84739788c1d030eed8c110436aafdaa2f3fd" +dependencies = [ + "form_urlencoded", + "itoa", + "ryu", + "serde", +] + [[package]] name = "setup-phase" version = "0.0.0" @@ -936,6 +1940,21 @@ dependencies = [ "keccak", ] +[[package]] +name = "shlex" +version = "1.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0fda2ff0d084019ba4d7c6f371c95d8fd75ce3524c3cb8fb653a3023f6323e64" + +[[package]] +name = "signal-hook-registry" +version = "1.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a9e9e0b4211b72e7b8b6e85c807d36c212bdb33ea8587f7569562a84df5465b1" +dependencies = [ + "libc", +] + [[package]] name = "signature" version = "2.2.0" @@ -945,12 +1964,37 @@ dependencies = [ "rand_core", ] +[[package]] +name = "slab" +version = "0.4.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8f92a496fb766b417c996b9c5e57daf2f7ad3b0bebe1ccfca4856390e3d3bb67" +dependencies = [ + "autocfg", +] + [[package]] name = "smallvec" version = "1.13.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3c5e1a9a646d36c3599cd173a41282daf47c44583ad367b8e6837255952e5c67" +[[package]] +name = "socket2" +version = "0.5.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ce305eb0b4296696835b71df73eb912e0f1ffd2556a501fcede6e0c50349191c" +dependencies = [ + "libc", + "windows-sys 0.52.0", +] + +[[package]] +name = "spin" +version = "0.9.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6980e8d7511241f8acf4aebddbb1ff938df5eebe98691418c4468d0b72a96a67" + [[package]] name = "spki" version = "0.7.3" @@ -984,6 +2028,46 @@ dependencies = [ "unicode-ident", ] +[[package]] +name = "sync_wrapper" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a7065abeca94b6a8a577f9bd45aa0867a2238b74e8eb67cf10d492bc39351394" + +[[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.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b8fcd239983515c23a32fb82099f97d0b11b8c72f654ed659363a95c3dad7a53" +dependencies = [ + "cfg-if", + "fastrand", + "once_cell", + "rustix", + "windows-sys 0.52.0", +] + [[package]] name = "termcolor" version = "1.4.1" @@ -993,6 +2077,21 @@ dependencies = [ "winapi-util", ] +[[package]] +name = "tinyvec" +version = "1.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "445e881f4f6d382d5f27c034e25eb92edd7c784ceab92a0937db7f2e9471b938" +dependencies = [ + "tinyvec_macros", +] + +[[package]] +name = "tinyvec_macros" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20" + [[package]] name = "token-handler" version = "0.0.0" @@ -1024,6 +2123,69 @@ dependencies = [ "utils", ] +[[package]] +name = "tokio" +version = "1.40.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e2b070231665d27ad9ec9b8df639893f46727666c6767db40317fbe920a5d998" +dependencies = [ + "backtrace", + "bytes", + "libc", + "mio", + "parking_lot", + "pin-project-lite", + "signal-hook-registry", + "socket2", + "tokio-macros", + "windows-sys 0.52.0", +] + +[[package]] +name = "tokio-macros" +version = "2.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "693d596312e88961bc67d7f1f97af8a70227d9f90c31bba5806eec004978d752" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "tokio-native-tls" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bbae76ab933c85776efabc971569dd6119c580d8f5d448769dec1764bf796ef2" +dependencies = [ + "native-tls", + "tokio", +] + +[[package]] +name = "tokio-rustls" +version = "0.26.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0c7bc40d0e5a97695bb96e27995cd3a08538541b0a846f65bba7a359f36700d4" +dependencies = [ + "rustls", + "rustls-pki-types", + "tokio", +] + +[[package]] +name = "tokio-util" +version = "0.7.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "61e7c3654c13bcd040d4a03abee2c75b1d14a37b423cf5a813ceae1cc903ec6a" +dependencies = [ + "bytes", + "futures-core", + "futures-sink", + "pin-project-lite", + "tokio", +] + [[package]] name = "toml" version = "0.8.12" @@ -1059,6 +2221,31 @@ dependencies = [ "winnow", ] +[[package]] +name = "tower-service" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8df9b6e13f2d32c91b9bd719c00d1958837bc7dec474d94952798cc8e69eeec3" + +[[package]] +name = "tracing" +version = "0.1.40" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c3523ab5a71916ccf420eebdf5521fcef02141234bbc0b8a49f2fdc4544364ef" +dependencies = [ + "pin-project-lite", + "tracing-core", +] + +[[package]] +name = "tracing-core" +version = "0.1.32" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c06d3da6113f116aaee68e4d601191614c9053067f9ab7f6edbcb161237daa54" +dependencies = [ + "once_cell", +] + [[package]] name = "transaction" version = "0.0.0" @@ -1066,6 +2253,12 @@ dependencies = [ "multiversx-sc", ] +[[package]] +name = "try-lock" +version = "0.2.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e421abadd41a4225275504ea4d6566923418b7f05506fbc9c0fe86ba7396114b" + [[package]] name = "tx-batch-module" version = "0.0.0" @@ -1081,24 +2274,56 @@ version = "1.17.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "42ff0bf0c66b8238c6f3b578df37d0b7848e55df8577b3f74f92a69acceeb825" +[[package]] +name = "unicode-bidi" +version = "0.3.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5ab17db44d7388991a428b2ee655ce0c212e862eff1768a455c58f9aad6e7893" + [[package]] name = "unicode-ident" version = "1.0.12" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3354b9ac3fae1ff6755cb6db53683adb661634f67557942dea4facebec0fee4b" +[[package]] +name = "unicode-normalization" +version = "0.1.22" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5c5713f0fc4b5db668a2ac63cdb7bb4469d8c9fed047b1d0292cc7b0ce2ba921" +dependencies = [ + "tinyvec", +] + [[package]] name = "unicode-segmentation" version = "1.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d4c87d22b6e3f4a18d4d40ef354e97c90fcb14dd91d7dc0aa9d8a1172ebf7202" +[[package]] +name = "untrusted" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8ecb6da28b8a351d773b68d5825ac39017e680750f980f3a1a85cd8dd28a47c1" + [[package]] name = "unwrap-infallible" version = "0.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "151ac09978d3c2862c4e39b557f4eceee2cc72150bc4cb4f16abf061b6e381fb" +[[package]] +name = "url" +version = "2.5.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "22784dbdf76fdde8af1aeda5622b546b422b6fc585325248a2bf9f5e41e94d6c" +dependencies = [ + "form_urlencoded", + "idna", + "percent-encoding", +] + [[package]] name = "utf8parse" version = "0.2.1" @@ -1113,18 +2338,109 @@ dependencies = [ "multiversx-sc", ] +[[package]] +name = "uuid" +version = "1.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "81dfa00651efa65069b0b6b651f4aaa31ba9e3c3ce0137aaad053604ee7e0314" +dependencies = [ + "getrandom", +] + +[[package]] +name = "vcpkg" +version = "0.2.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "accd4ea62f7bb7a82fe23066fb0957d48ef677f6eeb8215f372f52e48bb32426" + [[package]] name = "version_check" version = "0.9.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f" +[[package]] +name = "want" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bfa7760aed19e106de2c7c0b581b509f2f25d3dacaf737cb82ac61bc6d760b0e" +dependencies = [ + "try-lock", +] + [[package]] name = "wasi" version = "0.11.0+wasi-snapshot-preview1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" +[[package]] +name = "wasm-bindgen" +version = "0.2.93" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a82edfc16a6c469f5f44dc7b571814045d60404b55a0ee849f9bcfa2e63dd9b5" +dependencies = [ + "cfg-if", + "once_cell", + "wasm-bindgen-macro", +] + +[[package]] +name = "wasm-bindgen-backend" +version = "0.2.93" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9de396da306523044d3302746f1208fa71d7532227f15e347e2d93e4145dd77b" +dependencies = [ + "bumpalo", + "log", + "once_cell", + "proc-macro2", + "quote", + "syn", + "wasm-bindgen-shared", +] + +[[package]] +name = "wasm-bindgen-futures" +version = "0.4.43" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "61e9300f63a621e96ed275155c108eb6f843b6a26d053f122ab69724559dc8ed" +dependencies = [ + "cfg-if", + "js-sys", + "wasm-bindgen", + "web-sys", +] + +[[package]] +name = "wasm-bindgen-macro" +version = "0.2.93" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "585c4c91a46b072c92e908d99cb1dcdf95c5218eeb6f3bf1efa991ee7a68cccf" +dependencies = [ + "quote", + "wasm-bindgen-macro-support", +] + +[[package]] +name = "wasm-bindgen-macro-support" +version = "0.2.93" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "afc340c74d9005395cf9dd098506f7f44e38f2b4a21c6aaacf9a105ea5e1e836" +dependencies = [ + "proc-macro2", + "quote", + "syn", + "wasm-bindgen-backend", + "wasm-bindgen-shared", +] + +[[package]] +name = "wasm-bindgen-shared" +version = "0.2.93" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c62a0a307cb4a311d3a07867860911ca130c3494e8c2719593806c08bc5d0484" + [[package]] name = "wasmparser" version = "0.216.0" @@ -1132,7 +2448,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bcdee6bea3619d311fb4b299721e89a986c3470f804b6d534340e412589028e3" dependencies = [ "ahash", - "bitflags", + "bitflags 2.6.0", "hashbrown", "indexmap", "semver", @@ -1150,6 +2466,16 @@ dependencies = [ "wasmparser", ] +[[package]] +name = "web-sys" +version = "0.3.70" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "26fdeaafd9bd129f65e7c031593c24d62186301e0c72c8978fa1678be7d532c0" +dependencies = [ + "js-sys", + "wasm-bindgen", +] + [[package]] name = "winapi" version = "0.3.9" @@ -1322,6 +2648,16 @@ dependencies = [ "memchr", ] +[[package]] +name = "winreg" +version = "0.52.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a277a57398d4bfa075df44f501a17cfdf8542d224f0d36095a2adc7aee4ef0a5" +dependencies = [ + "cfg-if", + "windows-sys 0.48.0", +] + [[package]] name = "zerocopy" version = "0.7.34" diff --git a/Cargo.toml b/Cargo.toml index 583bf2c9..ea05c21a 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -8,6 +8,7 @@ members = [ "chain-factory/meta", "esdt-safe", "esdt-safe/meta", + "esdt-safe/interactor", "fee-market", "fee-market/meta", "header-verifier", diff --git a/esdt-safe/interactor/.gitignore b/esdt-safe/interactor/.gitignore new file mode 100644 index 00000000..5a64d09a --- /dev/null +++ b/esdt-safe/interactor/.gitignore @@ -0,0 +1,2 @@ +# Pem files are used for interactions, but shouldn't be committed +*.pem diff --git a/esdt-safe/interactor/Cargo.toml b/esdt-safe/interactor/Cargo.toml new file mode 100644 index 00000000..96dfd4f7 --- /dev/null +++ b/esdt-safe/interactor/Cargo.toml @@ -0,0 +1,33 @@ +[package] +name = "rust-interact" +version = "0.0.0" +authors = ["you"] +edition = "2021" +publish = false + +[[bin]] +name = "rust-interact" +path = "src/interactor_main.rs" + +[dependencies.esdt-safe] +path = ".." + +[dependencies.transaction] +path = "../../common/transaction" + +[dependencies.tx-batch-module] +path = "../../common/tx-batch-module" + +[dependencies.multiversx-sc-snippets] +version = "0.53.1" + +[dependencies.multiversx-sc] +version = "0.53.1" + +[dependencies] +clap = { version = "4.4.7", features = ["derive"] } +serde = { version = "1.0", features = ["derive"] } +toml = "0.8.6" + +# [workspace] + diff --git a/esdt-safe/interactor/src/interactor_main.rs b/esdt-safe/interactor/src/interactor_main.rs new file mode 100644 index 00000000..d248a534 --- /dev/null +++ b/esdt-safe/interactor/src/interactor_main.rs @@ -0,0 +1,682 @@ +#![allow(non_snake_case)] + +mod proxy; + +use multiversx_sc_snippets::imports::*; +use multiversx_sc_snippets::sdk; +use serde::{Deserialize, Serialize}; +use transaction::OperationData; +use transaction::PaymentsVec; +use transaction::{GasLimit, Operation}; +use std::{ + io::{Read, Write}, + path::Path, +}; + + +const GATEWAY: &str = sdk::gateway::DEVNET_GATEWAY; +const STATE_FILE: &str = "state.toml"; +const TOKEN_ID: &[u8] = b"SVT-805b28"; + +type OptionalTransferData = + OptionalValue, ManagedVec>>>; + + +#[tokio::main] +async fn main() { + env_logger::init(); + + let mut args = std::env::args(); + let _ = args.next(); + let cmd = args.next().expect("at least one argument required"); + let mut interact = ContractInteract::new().await; + match cmd.as_str() { + "deploy" => interact.deploy(false).await, + "upgrade" => interact.upgrade().await, + "setFeeMarketAddress" => interact.set_fee_market_address().await, + "setHeaderVerifierAddress" => interact.set_header_verifier_address().await, + "deposit" => interact.deposit(OptionalTransferData::None).await, + "setMinValidSigners" => interact.set_min_valid_signers().await, + "addSigners" => interact.add_signers().await, + "removeSigners" => interact.remove_signers().await, + "registerToken" => interact.register_token().await, + "executeBridgeOps" => interact.execute_operations().await, + "setMaxTxBatchSize" => interact.set_max_tx_batch_size().await, + "setMaxTxBatchBlockDuration" => interact.set_max_tx_batch_block_duration().await, + "getCurrentTxBatch" => interact.get_current_tx_batch().await, + "getFirstBatchAnyStatus" => interact.get_first_batch_any_status().await, + "getBatch" => interact.get_batch().await, + "getBatchStatus" => interact.get_batch_status().await, + "getFirstBatchId" => interact.first_batch_id().await, + "getLastBatchId" => interact.last_batch_id().await, + "setMaxBridgedAmount" => interact.set_max_bridged_amount().await, + "getMaxBridgedAmount" => interact.max_bridged_amount().await, + "endSetupPhase" => interact.end_setup_phase().await, + "addTokensToWhitelist" => interact.add_tokens_to_whitelist().await, + "removeTokensFromWhitelist" => interact.remove_tokens_from_whitelist().await, + "addTokensToBlacklist" => interact.add_tokens_to_blacklist().await, + "removeTokensFromBlacklist" => interact.remove_tokens_from_blacklist().await, + "getTokenWhitelist" => interact.token_whitelist().await, + "getTokenBlacklist" => interact.token_blacklist().await, + "pause" => interact.pause_endpoint().await, + "unpause" => interact.unpause_endpoint().await, + "isPaused" => interact.paused_status().await, + _ => panic!("unknown command: {}", &cmd), + } +} + +#[derive(Debug, Default, Serialize, Deserialize)] +struct State { + contract_address: Option +} + +impl State { + // Deserializes state from file + pub fn load_state() -> Self { + if Path::new(STATE_FILE).exists() { + let mut file = std::fs::File::open(STATE_FILE).unwrap(); + let mut content = String::new(); + file.read_to_string(&mut content).unwrap(); + toml::from_str(&content).unwrap() + } else { + Self::default() + } + } + + /// Sets the contract address + pub fn set_address(&mut self, address: Bech32Address) { + self.contract_address = Some(address); + } + + /// Returns the contract address + pub fn current_address(&self) -> &Bech32Address { + self.contract_address + .as_ref() + .expect("no known contract, deploy first") + } + } + + impl Drop for State { + // Serializes state to file + fn drop(&mut self) { + let mut file = std::fs::File::create(STATE_FILE).unwrap(); + file.write_all(toml::to_string(self).unwrap().as_bytes()) + .unwrap(); + } + } + +struct ContractInteract { + interactor: Interactor, + wallet_address: Address, + bob_adress: Address, + contract_code: BytesValue, + state: State +} + +impl ContractInteract { + async fn new() -> Self { + let mut interactor = Interactor::new(GATEWAY).await; + let wallet_address = interactor.register_wallet(test_wallets::frank()); + let bob_adress = interactor.register_wallet(test_wallets::bob()); + + let contract_code = BytesValue::interpret_from( + "mxsc:../output/esdt-safe.mxsc.json", + &InterpreterContext::default(), + ); + + ContractInteract { + interactor, + wallet_address, + bob_adress, + contract_code, + state: State::load_state() + } + } + + async fn deploy(&mut self, is_sov_chain: bool) { + + let new_address = self + .interactor + .tx() + .from(&self.wallet_address) + .gas(110_000_000u64) + .typed(proxy::EsdtSafeProxy) + .init(is_sov_chain) + .code(&self.contract_code) + .returns(ReturnsNewAddress) + .prepare_async() + .run() + .await; + let new_address_bech32 = bech32::encode(&new_address); + self.state + .set_address(Bech32Address::from_bech32_string(new_address_bech32.clone())); + + println!("new address: {new_address_bech32}"); + } + + async fn upgrade(&mut self) { + let response = self + .interactor + .tx() + .to(self.state.current_address()) + .from(&self.wallet_address) + .gas(30_000_000u64) + .typed(proxy::EsdtSafeProxy) + .upgrade() + .code(&self.contract_code) + .code_metadata(CodeMetadata::UPGRADEABLE) + .returns(ReturnsNewAddress) + .prepare_async() + .run() + .await; + + println!("Result: {response:?}"); + } + + async fn set_fee_market_address(&mut self) { + let fee_market_address = bech32::decode(""); + + let response = self + .interactor + .tx() + .from(&self.wallet_address) + .to(self.state.current_address()) + .gas(30_000_000u64) + .typed(proxy::EsdtSafeProxy) + .set_fee_market_address(fee_market_address) + .returns(ReturnsResultUnmanaged) + .prepare_async() + .run() + .await; + + println!("Result: {response:?}"); + } + + async fn set_header_verifier_address(&mut self) { + let header_verifier_address = bech32::decode(""); + + let response = self + .interactor + .tx() + .from(&self.wallet_address) + .to(self.state.current_address()) + .gas(30_000_000u64) + .typed(proxy::EsdtSafeProxy) + .set_header_verifier_address(header_verifier_address) + .returns(ReturnsResultUnmanaged) + .prepare_async() + .run() + .await; + + println!("Result: {response:?}"); + } + + async fn deposit(&mut self, transfer_data: OptionalTransferData) { + let token_id = TOKEN_ID; + let token_nonce = 0u64; + let token_amount = BigUint::::from(20u64); + + let to = &self.bob_adress; + let mut payments = PaymentsVec::new(); + payments.push(EsdtTokenPayment::new(TokenIdentifier::from(token_id), token_nonce, token_amount)); + payments.push(EsdtTokenPayment::new(TokenIdentifier::from(token_id), token_nonce, BigUint::from(30u64))); + + let response = self + .interactor + .tx() + .from(&self.wallet_address) + .to(self.state.current_address()) + .gas(30_000_000u64) + .typed(proxy::EsdtSafeProxy) + .deposit(to, transfer_data) + .payment(payments) + .returns(ReturnsResultUnmanaged) + .prepare_async() + .run() + .await; + + println!("Result: {response:?}"); + } + + async fn set_min_valid_signers(&mut self) { + let new_value = 0u32; + + let response = self + .interactor + .tx() + .from(&self.wallet_address) + .to(self.state.current_address()) + .gas(30_000_000u64) + .typed(proxy::EsdtSafeProxy) + .set_min_valid_signers(new_value) + .returns(ReturnsResultUnmanaged) + .prepare_async() + .run() + .await; + + println!("Result: {response:?}"); + } + + async fn add_signers(&mut self) { + let signers = MultiValueVec::from(vec![bech32::decode("")]); + + let response = self + .interactor + .tx() + .from(&self.wallet_address) + .to(self.state.current_address()) + .gas(30_000_000u64) + .typed(proxy::EsdtSafeProxy) + .add_signers(signers) + .returns(ReturnsResultUnmanaged) + .prepare_async() + .run() + .await; + + println!("Result: {response:?}"); + } + + async fn remove_signers(&mut self) { + let signers = MultiValueVec::from(vec![bech32::decode("")]); + + let response = self + .interactor + .tx() + .from(&self.wallet_address) + .to(self.state.current_address()) + .gas(30_000_000u64) + .typed(proxy::EsdtSafeProxy) + .remove_signers(signers) + .returns(ReturnsResultUnmanaged) + .prepare_async() + .run() + .await; + + println!("Result: {response:?}"); + } + + async fn register_token(&mut self) { + let egld_amount = BigUint::::from(0u128); + + let sov_token_id = TokenIdentifier::from_esdt_bytes(&b""[..]); + let token_type = EsdtTokenType::NonFungible; + let token_display_name = ManagedBuffer::new_from_bytes(&b""[..]); + let token_ticker = ManagedBuffer::new_from_bytes(&b""[..]); + let num_decimals = 0u32; + + let response = self + .interactor + .tx() + .from(&self.wallet_address) + .to(self.state.current_address()) + .gas(30_000_000u64) + .typed(proxy::EsdtSafeProxy) + .register_token(sov_token_id, token_type, token_display_name, token_ticker, num_decimals) + .egld(egld_amount) + .returns(ReturnsResultUnmanaged) + .prepare_async() + .run() + .await; + + println!("Result: {response:?}"); + } + + async fn execute_operations(&mut self) { + let hash_of_hashes = ManagedBuffer::new_from_bytes(&b""[..]); + let operation = Operation::new(ManagedAddress::zero(), ManagedVec::new(), OperationData::new(0 , ManagedAddress::zero(), None)); + + let response = self + .interactor + .tx() + .from(&self.wallet_address) + .to(self.state.current_address()) + .gas(30_000_000u64) + .typed(proxy::EsdtSafeProxy) + .execute_operations(hash_of_hashes, operation) + .returns(ReturnsResultUnmanaged) + .prepare_async() + .run() + .await; + + println!("Result: {response:?}"); + } + + async fn set_max_tx_batch_size(&mut self) { + let new_max_tx_batch_size = 0u32; + + let response = self + .interactor + .tx() + .from(&self.wallet_address) + .to(self.state.current_address()) + .gas(30_000_000u64) + .typed(proxy::EsdtSafeProxy) + .set_max_tx_batch_size(new_max_tx_batch_size) + .returns(ReturnsResultUnmanaged) + .prepare_async() + .run() + .await; + + println!("Result: {response:?}"); + } + + async fn set_max_tx_batch_block_duration(&mut self) { + let new_max_tx_batch_block_duration = 0u64; + + let response = self + .interactor + .tx() + .from(&self.wallet_address) + .to(self.state.current_address()) + .gas(30_000_000u64) + .typed(proxy::EsdtSafeProxy) + .set_max_tx_batch_block_duration(new_max_tx_batch_block_duration) + .returns(ReturnsResultUnmanaged) + .prepare_async() + .run() + .await; + + println!("Result: {response:?}"); + } + + async fn get_current_tx_batch(&mut self) { + let _ = self + .interactor + .query() + .to(self.state.current_address()) + .typed(proxy::EsdtSafeProxy) + .get_current_tx_batch() + .returns(ReturnsResultUnmanaged) + .prepare_async() + .run() + .await; + } + + async fn get_first_batch_any_status(&mut self) { + let _ = self + .interactor + .query() + .to(self.state.current_address()) + .typed(proxy::EsdtSafeProxy) + .get_first_batch_any_status() + .returns(ReturnsResultUnmanaged) + .prepare_async() + .run() + .await; + } + + async fn get_batch(&mut self) { + let batch_id = 0u64; + + let _ = self + .interactor + .query() + .to(self.state.current_address()) + .typed(proxy::EsdtSafeProxy) + .get_batch(batch_id) + .returns(ReturnsResultUnmanaged) + .prepare_async() + .run() + .await; + } + + async fn get_batch_status(&mut self) { + let batch_id = 0u64; + + self + .interactor + .query() + .to(self.state.current_address()) + .typed(proxy::EsdtSafeProxy) + .get_batch_status(batch_id) + .returns(ReturnsResultUnmanaged) + .prepare_async() + .run() + .await; + } + + async fn first_batch_id(&mut self) { + let result_value = self + .interactor + .query() + .to(self.state.current_address()) + .typed(proxy::EsdtSafeProxy) + .first_batch_id() + .returns(ReturnsResultUnmanaged) + .prepare_async() + .run() + .await; + + println!("Result: {result_value:?}"); + } + + async fn last_batch_id(&mut self) { + let result_value = self + .interactor + .query() + .to(self.state.current_address()) + .typed(proxy::EsdtSafeProxy) + .last_batch_id() + .returns(ReturnsResultUnmanaged) + .prepare_async() + .run() + .await; + + println!("Result: {result_value:?}"); + } + + async fn set_max_bridged_amount(&mut self) { + let token_id = TokenIdentifier::from_esdt_bytes(&b""[..]); + let max_amount = BigUint::::from(0u128); + + let response = self + .interactor + .tx() + .from(&self.wallet_address) + .to(self.state.current_address()) + .gas(30_000_000u64) + .typed(proxy::EsdtSafeProxy) + .set_max_bridged_amount(token_id, max_amount) + .returns(ReturnsResultUnmanaged) + .prepare_async() + .run() + .await; + + println!("Result: {response:?}"); + } + + async fn max_bridged_amount(&mut self) { + let token_id = TokenIdentifier::from_esdt_bytes(&b""[..]); + + let result_value = self + .interactor + .query() + .to(self.state.current_address()) + .typed(proxy::EsdtSafeProxy) + .max_bridged_amount(token_id) + .returns(ReturnsResultUnmanaged) + .prepare_async() + .run() + .await; + + println!("Result: {result_value:?}"); + } + + async fn end_setup_phase(&mut self) { + let response = self + .interactor + .tx() + .from(&self.wallet_address) + .to(self.state.current_address()) + .gas(30_000_000u64) + .typed(proxy::EsdtSafeProxy) + .end_setup_phase() + .returns(ReturnsResultUnmanaged) + .prepare_async() + .run() + .await; + + println!("Result: {response:?}"); + } + + async fn add_tokens_to_whitelist(&mut self) { + let tokens = MultiValueVec::from(vec![TokenIdentifier::from_esdt_bytes(&b""[..])]); + + let response = self + .interactor + .tx() + .from(&self.wallet_address) + .to(self.state.current_address()) + .gas(30_000_000u64) + .typed(proxy::EsdtSafeProxy) + .add_tokens_to_whitelist(tokens) + .returns(ReturnsResultUnmanaged) + .prepare_async() + .run() + .await; + + println!("Result: {response:?}"); + } + + async fn remove_tokens_from_whitelist(&mut self) { + let tokens = MultiValueVec::from(vec![TokenIdentifier::from_esdt_bytes(&b""[..])]); + + let response = self + .interactor + .tx() + .from(&self.wallet_address) + .to(self.state.current_address()) + .gas(30_000_000u64) + .typed(proxy::EsdtSafeProxy) + .remove_tokens_from_whitelist(tokens) + .returns(ReturnsResultUnmanaged) + .prepare_async() + .run() + .await; + + println!("Result: {response:?}"); + } + + async fn add_tokens_to_blacklist(&mut self) { + let tokens = MultiValueVec::from(vec![TokenIdentifier::from_esdt_bytes(&b""[..])]); + + let response = self + .interactor + .tx() + .from(&self.wallet_address) + .to(self.state.current_address()) + .gas(30_000_000u64) + .typed(proxy::EsdtSafeProxy) + .add_tokens_to_blacklist(tokens) + .returns(ReturnsResultUnmanaged) + .prepare_async() + .run() + .await; + + println!("Result: {response:?}"); + } + + async fn remove_tokens_from_blacklist(&mut self) { + let tokens = MultiValueVec::from(vec![TokenIdentifier::from_esdt_bytes(&b""[..])]); + + let response = self + .interactor + .tx() + .from(&self.wallet_address) + .to(self.state.current_address()) + .gas(30_000_000u64) + .typed(proxy::EsdtSafeProxy) + .remove_tokens_from_blacklist(tokens) + .returns(ReturnsResultUnmanaged) + .prepare_async() + .run() + .await; + + println!("Result: {response:?}"); + } + + async fn token_whitelist(&mut self) { + let result_value = self + .interactor + .query() + .to(self.state.current_address()) + .typed(proxy::EsdtSafeProxy) + .token_whitelist() + .returns(ReturnsResultUnmanaged) + .prepare_async() + .run() + .await; + + println!("Result: {result_value:?}"); + } + + async fn token_blacklist(&mut self) { + let result_value = self + .interactor + .query() + .to(self.state.current_address()) + .typed(proxy::EsdtSafeProxy) + .token_blacklist() + .returns(ReturnsResultUnmanaged) + .prepare_async() + .run() + .await; + + println!("Result: {result_value:?}"); + } + + async fn pause_endpoint(&mut self) { + let response = self + .interactor + .tx() + .from(&self.wallet_address) + .to(self.state.current_address()) + .gas(30_000_000u64) + .typed(proxy::EsdtSafeProxy) + .pause_endpoint() + .returns(ReturnsResultUnmanaged) + .prepare_async() + .run() + .await; + + println!("Result: {response:?}"); + } + + async fn unpause_endpoint(&mut self) { + let response = self + .interactor + .tx() + .from(&self.wallet_address) + .to(self.state.current_address()) + .gas(30_000_000u64) + .typed(proxy::EsdtSafeProxy) + .unpause_endpoint() + .returns(ReturnsResultUnmanaged) + .prepare_async() + .run() + .await; + + println!("Result: {response:?}"); + } + + async fn paused_status(&mut self) { + let result_value = self + .interactor + .query() + .to(self.state.current_address()) + .typed(proxy::EsdtSafeProxy) + .paused_status() + .returns(ReturnsResultUnmanaged) + .prepare_async() + .run() + .await; + + println!("Result: {result_value:?}"); + } +} + +#[tokio::test] +async fn test_deploy() { + let mut interact = ContractInteract::new().await; + interact.deploy(false).await; +} diff --git a/esdt-safe/interactor/src/proxy.rs b/esdt-safe/interactor/src/proxy.rs new file mode 100644 index 00000000..1c463ded --- /dev/null +++ b/esdt-safe/interactor/src/proxy.rs @@ -0,0 +1,432 @@ +// Code generated by the multiversx-sc proxy generator. DO NOT EDIT. + +//////////////////////////////////////////////////// +////////////////// AUTO-GENERATED ////////////////// +//////////////////////////////////////////////////// + +#![allow(dead_code)] +#![allow(clippy::all)] + +use multiversx_sc::proxy_imports::*; + +pub struct EsdtSafeProxy; + +impl TxProxyTrait for EsdtSafeProxy +where + Env: TxEnv, + From: TxFrom, + To: TxTo, + Gas: TxGas, +{ + type TxProxyMethods = EsdtSafeProxyMethods; + + fn proxy_methods(self, tx: Tx) -> Self::TxProxyMethods { + EsdtSafeProxyMethods { wrapped_tx: tx } + } +} + +pub struct EsdtSafeProxyMethods +where + Env: TxEnv, + From: TxFrom, + To: TxTo, + Gas: TxGas, +{ + wrapped_tx: Tx, +} + +#[rustfmt::skip] +impl EsdtSafeProxyMethods +where + Env: TxEnv, + Env::Api: VMApi, + From: TxFrom, + Gas: TxGas, +{ + pub fn init< + Arg0: ProxyArg, + >( + self, + is_sovereign_chain: Arg0, + ) -> TxTypedDeploy { + self.wrapped_tx + .payment(NotPayable) + .raw_deploy() + .argument(&is_sovereign_chain) + .original_result() + } +} + +#[rustfmt::skip] +impl EsdtSafeProxyMethods +where + Env: TxEnv, + Env::Api: VMApi, + From: TxFrom, + To: TxTo, + Gas: TxGas, +{ + pub fn upgrade( + self, + ) -> TxTypedUpgrade { + self.wrapped_tx + .payment(NotPayable) + .raw_upgrade() + .original_result() + } +} + +#[rustfmt::skip] +impl EsdtSafeProxyMethods +where + Env: TxEnv, + Env::Api: VMApi, + From: TxFrom, + To: TxTo, + Gas: TxGas, +{ + pub fn set_fee_market_address< + Arg0: ProxyArg>, + >( + self, + fee_market_address: Arg0, + ) -> TxTypedCall { + self.wrapped_tx + .payment(NotPayable) + .raw_call("setFeeMarketAddress") + .argument(&fee_market_address) + .original_result() + } + + pub fn set_header_verifier_address< + Arg0: ProxyArg>, + >( + self, + header_verifier_address: Arg0, + ) -> TxTypedCall { + self.wrapped_tx + .payment(NotPayable) + .raw_call("setHeaderVerifierAddress") + .argument(&header_verifier_address) + .original_result() + } + + pub fn deposit< + Arg0: ProxyArg>, + Arg1: ProxyArg, ManagedVec>>>>, + >( + self, + to: Arg0, + opt_transfer_data: Arg1, + ) -> TxTypedCall { + self.wrapped_tx + .raw_call("deposit") + .argument(&to) + .argument(&opt_transfer_data) + .original_result() + } + + pub fn set_min_valid_signers< + Arg0: ProxyArg, + >( + self, + new_value: Arg0, + ) -> TxTypedCall { + self.wrapped_tx + .payment(NotPayable) + .raw_call("setMinValidSigners") + .argument(&new_value) + .original_result() + } + + pub fn add_signers< + Arg0: ProxyArg>>, + >( + self, + signers: Arg0, + ) -> TxTypedCall { + self.wrapped_tx + .payment(NotPayable) + .raw_call("addSigners") + .argument(&signers) + .original_result() + } + + pub fn remove_signers< + Arg0: ProxyArg>>, + >( + self, + signers: Arg0, + ) -> TxTypedCall { + self.wrapped_tx + .payment(NotPayable) + .raw_call("removeSigners") + .argument(&signers) + .original_result() + } + + pub fn register_token< + Arg0: ProxyArg>, + Arg1: ProxyArg, + Arg2: ProxyArg>, + Arg3: ProxyArg>, + Arg4: ProxyArg, + >( + self, + sov_token_id: Arg0, + token_type: Arg1, + token_display_name: Arg2, + token_ticker: Arg3, + num_decimals: Arg4, + ) -> TxTypedCall { + self.wrapped_tx + .raw_call("registerToken") + .argument(&sov_token_id) + .argument(&token_type) + .argument(&token_display_name) + .argument(&token_ticker) + .argument(&num_decimals) + .original_result() + } + + pub fn execute_operations< + Arg0: ProxyArg>, + Arg1: ProxyArg>, + >( + self, + hash_of_hashes: Arg0, + operation: Arg1, + ) -> TxTypedCall { + self.wrapped_tx + .payment(NotPayable) + .raw_call("executeBridgeOps") + .argument(&hash_of_hashes) + .argument(&operation) + .original_result() + } + + pub fn set_max_tx_batch_size< + Arg0: ProxyArg, + >( + self, + new_max_tx_batch_size: Arg0, + ) -> TxTypedCall { + self.wrapped_tx + .payment(NotPayable) + .raw_call("setMaxTxBatchSize") + .argument(&new_max_tx_batch_size) + .original_result() + } + + pub fn set_max_tx_batch_block_duration< + Arg0: ProxyArg, + >( + self, + new_max_tx_batch_block_duration: Arg0, + ) -> TxTypedCall { + self.wrapped_tx + .payment(NotPayable) + .raw_call("setMaxTxBatchBlockDuration") + .argument(&new_max_tx_batch_block_duration) + .original_result() + } + + pub fn get_current_tx_batch( + self, + ) -> TxTypedCall, ManagedAddress, ManagedVec>, ManagedVec>, Option>>>>>> { + self.wrapped_tx + .payment(NotPayable) + .raw_call("getCurrentTxBatch") + .original_result() + } + + pub fn get_first_batch_any_status( + self, + ) -> TxTypedCall, ManagedAddress, ManagedVec>, ManagedVec>, Option>>>>>> { + self.wrapped_tx + .payment(NotPayable) + .raw_call("getFirstBatchAnyStatus") + .original_result() + } + + pub fn get_batch< + Arg0: ProxyArg, + >( + self, + batch_id: Arg0, + ) -> TxTypedCall, ManagedAddress, ManagedVec>, ManagedVec>, Option>>>>>> { + self.wrapped_tx + .payment(NotPayable) + .raw_call("getBatch") + .argument(&batch_id) + .original_result() + } + + pub fn get_batch_status< + Arg0: ProxyArg, + >( + self, + batch_id: Arg0, + ) -> TxTypedCall> { + self.wrapped_tx + .payment(NotPayable) + .raw_call("getBatchStatus") + .argument(&batch_id) + .original_result() + } + + pub fn first_batch_id( + self, + ) -> TxTypedCall { + self.wrapped_tx + .payment(NotPayable) + .raw_call("getFirstBatchId") + .original_result() + } + + pub fn last_batch_id( + self, + ) -> TxTypedCall { + self.wrapped_tx + .payment(NotPayable) + .raw_call("getLastBatchId") + .original_result() + } + + pub fn set_max_bridged_amount< + Arg0: ProxyArg>, + Arg1: ProxyArg>, + >( + self, + token_id: Arg0, + max_amount: Arg1, + ) -> TxTypedCall { + self.wrapped_tx + .payment(NotPayable) + .raw_call("setMaxBridgedAmount") + .argument(&token_id) + .argument(&max_amount) + .original_result() + } + + pub fn max_bridged_amount< + Arg0: ProxyArg>, + >( + self, + token_id: Arg0, + ) -> TxTypedCall> { + self.wrapped_tx + .payment(NotPayable) + .raw_call("getMaxBridgedAmount") + .argument(&token_id) + .original_result() + } + + pub fn end_setup_phase( + self, + ) -> TxTypedCall { + self.wrapped_tx + .payment(NotPayable) + .raw_call("endSetupPhase") + .original_result() + } + + /// Tokens in the whitelist can be transferred without fees + pub fn add_tokens_to_whitelist< + Arg0: ProxyArg>>, + >( + self, + tokens: Arg0, + ) -> TxTypedCall { + self.wrapped_tx + .payment(NotPayable) + .raw_call("addTokensToWhitelist") + .argument(&tokens) + .original_result() + } + + pub fn remove_tokens_from_whitelist< + Arg0: ProxyArg>>, + >( + self, + tokens: Arg0, + ) -> TxTypedCall { + self.wrapped_tx + .payment(NotPayable) + .raw_call("removeTokensFromWhitelist") + .argument(&tokens) + .original_result() + } + + /// Tokens in blacklist cannot be transferred + pub fn add_tokens_to_blacklist< + Arg0: ProxyArg>>, + >( + self, + tokens: Arg0, + ) -> TxTypedCall { + self.wrapped_tx + .payment(NotPayable) + .raw_call("addTokensToBlacklist") + .argument(&tokens) + .original_result() + } + + pub fn remove_tokens_from_blacklist< + Arg0: ProxyArg>>, + >( + self, + tokens: Arg0, + ) -> TxTypedCall { + self.wrapped_tx + .payment(NotPayable) + .raw_call("removeTokensFromBlacklist") + .argument(&tokens) + .original_result() + } + + pub fn token_whitelist( + self, + ) -> TxTypedCall>> { + self.wrapped_tx + .payment(NotPayable) + .raw_call("getTokenWhitelist") + .original_result() + } + + pub fn token_blacklist( + self, + ) -> TxTypedCall>> { + self.wrapped_tx + .payment(NotPayable) + .raw_call("getTokenBlacklist") + .original_result() + } + + pub fn pause_endpoint( + self, + ) -> TxTypedCall { + self.wrapped_tx + .payment(NotPayable) + .raw_call("pause") + .original_result() + } + + pub fn unpause_endpoint( + self, + ) -> TxTypedCall { + self.wrapped_tx + .payment(NotPayable) + .raw_call("unpause") + .original_result() + } + + pub fn paused_status( + self, + ) -> TxTypedCall { + self.wrapped_tx + .payment(NotPayable) + .raw_call("isPaused") + .original_result() + } +} diff --git a/esdt-safe/interactor/state.toml b/esdt-safe/interactor/state.toml new file mode 100644 index 00000000..7d0cb701 --- /dev/null +++ b/esdt-safe/interactor/state.toml @@ -0,0 +1 @@ +contract_address = "erd1qqqqqqqqqqqqqpgqvq86d7xl8p3q74lxh59p3p3ncalrd7kkt7asgf7m7v" diff --git a/esdt-safe/sc-config.toml b/esdt-safe/sc-config.toml index 3e73d304..04faa00b 100644 --- a/esdt-safe/sc-config.toml +++ b/esdt-safe/sc-config.toml @@ -17,3 +17,7 @@ add-labels = ["esdt-safe-external-view"] [[proxy]] path = "src/esdt_safe_proxy.rs" + +[[proxy]] +path = "interactor/src/proxy.rs" + From 7991de798c49d14aa79e6dca1f8a61e21fa24cdb Mon Sep 17 00:00:00 2001 From: Andrei Baltariu Date: Wed, 9 Oct 2024 12:46:28 +0300 Subject: [PATCH 365/523] Added trimming for hashing Signed-off-by: Andrei Baltariu --- .../tests/header_verifier_blackbox_test.rs | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/header-verifier/tests/header_verifier_blackbox_test.rs b/header-verifier/tests/header_verifier_blackbox_test.rs index b80af056..f2a6af87 100644 --- a/header-verifier/tests/header_verifier_blackbox_test.rs +++ b/header-verifier/tests/header_verifier_blackbox_test.rs @@ -155,10 +155,17 @@ impl HeaderVerifierTestState { &mut self, operation: &ManagedBuffer, ) -> ManagedBuffer { - let array: &mut [u8; 22] = &mut [0u8; 22]; - operation.load_to_byte_array(array); + let mut array = [0; 1024]; - ManagedBuffer::from(&sha256(array)) + let len = { + let byte_array = operation.load_to_byte_array(&mut array); + byte_array.len() + }; + + let trimmed_slice = &array[..len]; + let hash = sha256(trimmed_slice); + + ManagedBuffer::from(&hash) } } From 7b52987787e61b2dda4181aa4b1ccd8ba49ab592 Mon Sep 17 00:00:00 2001 From: Andrei Baltariu Date: Wed, 9 Oct 2024 16:04:24 +0300 Subject: [PATCH 366/523] Used the dedicated `cloned()` method Signed-off-by: Andrei Baltariu --- header-verifier/tests/header_verifier_blackbox_test.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/header-verifier/tests/header_verifier_blackbox_test.rs b/header-verifier/tests/header_verifier_blackbox_test.rs index f2a6af87..2ff7c94f 100644 --- a/header-verifier/tests/header_verifier_blackbox_test.rs +++ b/header-verifier/tests/header_verifier_blackbox_test.rs @@ -122,7 +122,7 @@ impl HeaderVerifierTestState { } fn get_bls_keys(&mut self, bls_keys_vec: Vec>) -> BlsKeys { - let bls_keys = bls_keys_vec.iter().map(|key| key.clone()).collect(); + let bls_keys = bls_keys_vec.iter().map(|key| key).cloned().collect(); bls_keys } From b3230ebe279b6d460d75bef8b57b02b1898cdae1 Mon Sep 17 00:00:00 2001 From: Andrei Baltariu Date: Wed, 9 Oct 2024 16:08:57 +0300 Subject: [PATCH 367/523] Clippy fixes Signed-off-by: Andrei Baltariu --- fee-market/tests/fee_market_blackbox_test.rs | 118 +++++++++++------- .../tests/header_verifier_blackbox_test.rs | 2 +- 2 files changed, 74 insertions(+), 46 deletions(-) diff --git a/fee-market/tests/fee_market_blackbox_test.rs b/fee-market/tests/fee_market_blackbox_test.rs index 3ce89fd1..cf6206a5 100644 --- a/fee-market/tests/fee_market_blackbox_test.rs +++ b/fee-market/tests/fee_market_blackbox_test.rs @@ -1,7 +1,15 @@ use fee_market::fee_market_proxy::{self, FeeStruct, FeeType}; -use multiversx_sc::{imports::OptionalValue, types::{BigUint, EsdtTokenPayment, ManagedVec, MultiValueEncoded, ReturnsResultUnmanaged, TestAddress, TestSCAddress, TestTokenIdentifier, TokenIdentifier}}; -use multiversx_sc_scenario::{imports::MxscPath, ExpectError, ScenarioTxRun, ScenarioWorld}; +use multiversx_sc::{ + imports::OptionalValue, + types::{ + BigUint, EsdtTokenPayment, ManagedVec, MultiValueEncoded, ReturnsResultUnmanaged, + TestAddress, TestSCAddress, TestTokenIdentifier, + }, +}; +use multiversx_sc_scenario::{ + api::StaticApi, imports::MxscPath, ExpectError, ScenarioTxRun, ScenarioWorld, +}; const FEE_MARKET_CODE_PATH: MxscPath = MxscPath::new("output/fee-market.mxsc.json"); const FEE_MARKET_ADDRESS: TestSCAddress = TestSCAddress::new("fee-market"); @@ -18,7 +26,6 @@ const DIFFERENT_TOKEN_ID: TestTokenIdentifier = TestTokenIdentifier::new("WRONG- const ANOTHER_TOKEN_ID: TestTokenIdentifier = TestTokenIdentifier::new("ANOTHER-123456"); const WRONG_TOKEN_ID: TestTokenIdentifier = TestTokenIdentifier::new("WRONG-TOKEN"); - fn world() -> ScenarioWorld { let mut blockchain = ScenarioWorld::new(); @@ -56,11 +63,14 @@ impl FeeMarketTestState { Self { world } } - fn deploy_fee_market(&mut self) -> &mut Self{ - + fn deploy_fee_market(&mut self) -> &mut Self { let fee = FeeStruct { base_token: TOKEN_ID.to_token_identifier(), - fee_type: FeeType::Fixed { token: TOKEN_ID.to_token_identifier(), per_transfer: BigUint::from(100u64), per_gas: BigUint::from(0u64) }, + fee_type: FeeType::Fixed { + token: TOKEN_ID.to_token_identifier(), + per_transfer: BigUint::from(100u64), + per_gas: BigUint::from(0u64), + }, }; self.world @@ -71,30 +81,32 @@ impl FeeMarketTestState { .code(FEE_MARKET_CODE_PATH) .new_address(FEE_MARKET_ADDRESS) .run(); - + self } fn substract_fee(&mut self, payment_wanted: &str, error_status: Option) { - let payment; - - match payment_wanted { + let payment: EsdtTokenPayment = match payment_wanted { "Correct" => { - payment = EsdtTokenPayment::new(TOKEN_ID.to_token_identifier(), 0u64, BigUint::from(200u64)); - } - "InvalidToken" => { - payment = EsdtTokenPayment::new(DIFFERENT_TOKEN_ID.to_token_identifier(), 0u64, BigUint::from(10u64)); - } - "AnyToken" => { - payment = EsdtTokenPayment::new(ANOTHER_TOKEN_ID.to_token_identifier(), 0u64, BigUint::from(10u64)); + EsdtTokenPayment::new(TOKEN_ID.to_token_identifier(), 0u64, BigUint::from(200u64)) } + "InvalidToken" => EsdtTokenPayment::new( + DIFFERENT_TOKEN_ID.to_token_identifier::(), + 0u64, + BigUint::from(10u64), + ), + "AnyToken" => EsdtTokenPayment::new( + ANOTHER_TOKEN_ID.to_token_identifier(), + 0u64, + BigUint::from(10u64), + ), "Less than fee" => { - payment = EsdtTokenPayment::new(TOKEN_ID.to_token_identifier(), 0u64, BigUint::from(0u64)); + EsdtTokenPayment::new(TOKEN_ID.to_token_identifier(), 0u64, BigUint::from(0u64)) } _ => { panic!("Invalid payment wanted"); } - } + }; match error_status { Some(error) => { @@ -132,17 +144,19 @@ impl FeeMarketTestState { .run(); } - fn add_fee(&mut self, token_id: TestTokenIdentifier, fee_type: &str, error_status: Option) { - - let fee_struct; - - match fee_type { + fn add_fee( + &mut self, + token_id: TestTokenIdentifier, + fee_type: &str, + error_status: Option, + ) { + let fee_struct: FeeStruct = match fee_type { "None" => { let fee_type = FeeType::None; - fee_struct = FeeStruct { + FeeStruct { base_token: token_id.to_token_identifier(), fee_type, - }; + } } "Fixed" => { let fee_type = FeeType::Fixed { @@ -150,10 +164,10 @@ impl FeeMarketTestState { per_transfer: BigUint::from(10u8), per_gas: BigUint::from(10u8), }; - fee_struct = FeeStruct { + FeeStruct { base_token: token_id.to_token_identifier(), fee_type, - }; + } } "AnyToken" => { let fee_type = FeeType::AnyToken { @@ -161,10 +175,10 @@ impl FeeMarketTestState { per_transfer: BigUint::from(10u8), per_gas: BigUint::from(10u8), }; - fee_struct = FeeStruct { + FeeStruct { base_token: token_id.to_token_identifier(), fee_type, - }; + } } "AnyTokenWrong" => { let fee_type = FeeType::AnyToken { @@ -172,15 +186,15 @@ impl FeeMarketTestState { per_transfer: BigUint::from(10u8), per_gas: BigUint::from(10u8), }; - fee_struct = FeeStruct { + FeeStruct { base_token: token_id.to_token_identifier(), fee_type, - }; + } } _ => { panic!("Invalid fee type"); } - } + }; match error_status { Some(error) => { @@ -229,7 +243,6 @@ impl FeeMarketTestState { .check_account(address) .esdt_balance(TOKEN_ID, expected_balance); } - } #[test] @@ -245,14 +258,25 @@ fn test_add_fee_wrong_params() { state.deploy_fee_market(); - state.add_fee(WRONG_TOKEN_ID, "Fixed", Some(ExpectError(4, "Invalid token ID"))); + state.add_fee( + WRONG_TOKEN_ID, + "Fixed", + Some(ExpectError(4, "Invalid token ID")), + ); state.add_fee(TOKEN_ID, "None", Some(ExpectError(4, "Invalid fee type"))); - state.add_fee(DIFFERENT_TOKEN_ID, "Fixed", Some(ExpectError(4, "Invalid fee"))); - - state.add_fee(TOKEN_ID, "AnyTokenWrong", Some(ExpectError(4, "Invalid token ID"))); - + state.add_fee( + DIFFERENT_TOKEN_ID, + "Fixed", + Some(ExpectError(4, "Invalid fee")), + ); + + state.add_fee( + TOKEN_ID, + "AnyTokenWrong", + Some(ExpectError(4, "Invalid token ID")), + ); } #[test] @@ -266,7 +290,6 @@ fn test_substract_fee_no_fee() { state.check_balance_sc(ESDT_SAFE_ADDRESS, 1000); state.check_account(USER_ADDRESS, 1000); - } #[test] @@ -288,16 +311,18 @@ fn test_substract_fee_invalid_payment_token() { state.deploy_fee_market(); - state.substract_fee("InvalidToken", Some(ExpectError(4, "Token not accepted as fee"))); + state.substract_fee( + "InvalidToken", + Some(ExpectError(4, "Token not accepted as fee")), + ); state.check_balance_sc(ESDT_SAFE_ADDRESS, 1000); state.check_account(USER_ADDRESS, 1000); - } // FAILS => get_safe_price should be mocked here in order to make this test work // #[test] -// fn test_substract_fee_any_token() { +// fn test_substract_fee_any_token() { // let mut state = FeeMarketTestState::new(); // state.deploy_fee_market(); @@ -312,8 +337,11 @@ fn test_substract_fixed_fee_payment_not_covered() { let mut state = FeeMarketTestState::new(); state.deploy_fee_market(); - - state.substract_fee("Less than fee", Some(ExpectError(4, "Payment does not cover fee"))); + + state.substract_fee( + "Less than fee", + Some(ExpectError(4, "Payment does not cover fee")), + ); state.check_balance_sc(ESDT_SAFE_ADDRESS, 1000); state.check_account(USER_ADDRESS, 1000); diff --git a/header-verifier/tests/header_verifier_blackbox_test.rs b/header-verifier/tests/header_verifier_blackbox_test.rs index 2ff7c94f..37ec73a0 100644 --- a/header-verifier/tests/header_verifier_blackbox_test.rs +++ b/header-verifier/tests/header_verifier_blackbox_test.rs @@ -138,7 +138,7 @@ impl HeaderVerifierTestState { let mut appended_hashes = ManagedBuffer::new(); for operation_hash in operation_hashes { - appended_hashes.append(&operation_hash); + appended_hashes.append(operation_hash); bridge_operations.push(operation_hash.clone()); } From 41d2d9d1ff2ccbb067a87b860753162b171959bd Mon Sep 17 00:00:00 2001 From: Andrei Baltariu Date: Wed, 9 Oct 2024 19:04:09 +0300 Subject: [PATCH 368/523] TransferTokens Module updates Signed-off-by: Andrei Baltariu --- common/transaction/src/lib.rs | 2 +- .../src/from_sovereign/transfer_tokens.rs | 2 +- esdt-safe/src/from_sovereign/token_mapping.rs | 4 +--- esdt-safe/src/from_sovereign/transfer_tokens.rs | 13 ++++++------- esdt-safe/src/lib.rs | 1 - esdt-safe/src/to_sovereign/create_tx.rs | 1 - esdt-safe/wasm-esdt-safe-full/src/lib.rs | 6 +++--- esdt-safe/wasm/src/lib.rs | 6 +++--- 8 files changed, 15 insertions(+), 20 deletions(-) diff --git a/common/transaction/src/lib.rs b/common/transaction/src/lib.rs index 27d04c17..34b8ba8d 100644 --- a/common/transaction/src/lib.rs +++ b/common/transaction/src/lib.rs @@ -47,7 +47,7 @@ impl Operation { Operation { to, tokens, data } } - pub fn get_tokens_as_multi_value_encoded( + pub fn map_tokens_to_multi_value_encoded( &self, ) -> MultiValueEncoded, u64, EsdtTokenData>> { let mut tuples = MultiValueEncoded::new(); diff --git a/enshrine-esdt-safe/src/from_sovereign/transfer_tokens.rs b/enshrine-esdt-safe/src/from_sovereign/transfer_tokens.rs index 65ebe30b..d02956fc 100644 --- a/enshrine-esdt-safe/src/from_sovereign/transfer_tokens.rs +++ b/enshrine-esdt-safe/src/from_sovereign/transfer_tokens.rs @@ -154,7 +154,7 @@ pub trait TransferTokensModule: &operation_tuple.operation.data.op_sender, &operation_tuple .operation - .get_tokens_as_multi_value_encoded(), + .map_tokens_to_multi_value_encoded(), OperationData::new(tx_nonce, sc_address.clone(), None), ); } diff --git a/esdt-safe/src/from_sovereign/token_mapping.rs b/esdt-safe/src/from_sovereign/token_mapping.rs index aa7ce360..4cdcf04a 100644 --- a/esdt-safe/src/from_sovereign/token_mapping.rs +++ b/esdt-safe/src/from_sovereign/token_mapping.rs @@ -27,9 +27,7 @@ struct NonFungibleTokenArgs { } #[multiversx_sc::module] -pub trait TokenMappingModule: - multiversx_sc_modules::default_issue_callbacks::DefaultIssueCallbacksModule -{ +pub trait TokenMappingModule { #[payable("EGLD")] #[endpoint(registerToken)] fn register_token( diff --git a/esdt-safe/src/from_sovereign/transfer_tokens.rs b/esdt-safe/src/from_sovereign/transfer_tokens.rs index f5d863b0..5931bdaa 100644 --- a/esdt-safe/src/from_sovereign/transfer_tokens.rs +++ b/esdt-safe/src/from_sovereign/transfer_tokens.rs @@ -22,7 +22,6 @@ pub trait TransferTokensModule: + tx_batch_module::TxBatchModule + max_bridged_amount_module::MaxBridgedAmountModule + multiversx_sc_modules::pause::PauseModule - + multiversx_sc_modules::default_issue_callbacks::DefaultIssueCallbacksModule + utils::UtilsModule + to_sovereign::events::EventsModule { @@ -159,8 +158,8 @@ pub trait TransferTokensModule: .multi_esdt(mapped_tokens.clone()) .gas(transfer_data.gas_limit) .callback( - ::callbacks(self) - .execute(&hash_of_hashes, &operation_tuple), + self.callbacks() + .distribute_payments_callback(&hash_of_hashes, &operation_tuple), ) .gas_for_callback(CALLBACK_GAS) .register_promise(); @@ -176,8 +175,8 @@ pub trait TransferTokensModule: .arguments_raw(args) .gas(TRANSACTION_GAS) .callback( - ::callbacks(self) - .execute(&hash_of_hashes, &operation_tuple), + self.callbacks() + .distribute_payments_callback(&hash_of_hashes, &operation_tuple), ) .register_promise(); } @@ -203,7 +202,7 @@ pub trait TransferTokensModule: } #[promises_callback] - fn execute( + fn distribute_payments_callback( &self, hash_of_hashes: &ManagedBuffer, operation_tuple: &OperationTuple, @@ -281,7 +280,7 @@ pub trait TransferTokensModule: &operation_tuple.operation.data.op_sender, &operation_tuple .operation - .get_tokens_as_multi_value_encoded(), + .map_tokens_to_multi_value_encoded(), OperationData { op_nonce: tx_nonce, op_sender: sc_address.clone(), diff --git a/esdt-safe/src/lib.rs b/esdt-safe/src/lib.rs index 0bdb3f83..87249b05 100644 --- a/esdt-safe/src/lib.rs +++ b/esdt-safe/src/lib.rs @@ -21,7 +21,6 @@ pub trait EsdtSafe: + token_whitelist::TokenWhitelistModule + utils::UtilsModule + multiversx_sc_modules::pause::PauseModule - + multiversx_sc_modules::default_issue_callbacks::DefaultIssueCallbacksModule { #[init] fn init(&self, is_sovereign_chain: bool) { diff --git a/esdt-safe/src/to_sovereign/create_tx.rs b/esdt-safe/src/to_sovereign/create_tx.rs index 0b1adb80..c71b204c 100644 --- a/esdt-safe/src/to_sovereign/create_tx.rs +++ b/esdt-safe/src/to_sovereign/create_tx.rs @@ -20,7 +20,6 @@ pub trait CreateTxModule: + utils::UtilsModule + multiversx_sc_modules::pause::PauseModule + token_mapping::TokenMappingModule - + multiversx_sc_modules::default_issue_callbacks::DefaultIssueCallbacksModule { #[payable("*")] #[endpoint] diff --git a/esdt-safe/wasm-esdt-safe-full/src/lib.rs b/esdt-safe/wasm-esdt-safe-full/src/lib.rs index 893d43e5..e7e5da9f 100644 --- a/esdt-safe/wasm-esdt-safe-full/src/lib.rs +++ b/esdt-safe/wasm-esdt-safe-full/src/lib.rs @@ -7,7 +7,7 @@ // Init: 1 // Upgrade: 1 // Endpoints: 28 -// Async Callback: 1 +// Async Callback (empty): 1 // Promise callbacks: 1 // Total number of exported functions: 32 @@ -49,8 +49,8 @@ multiversx_sc_wasm_adapter::endpoints! { pause => pause_endpoint unpause => unpause_endpoint isPaused => paused_status - execute => execute + distribute_payments_callback => distribute_payments_callback ) } -multiversx_sc_wasm_adapter::async_callback! { esdt_safe } +multiversx_sc_wasm_adapter::async_callback_empty! {} diff --git a/esdt-safe/wasm/src/lib.rs b/esdt-safe/wasm/src/lib.rs index 893d43e5..e7e5da9f 100644 --- a/esdt-safe/wasm/src/lib.rs +++ b/esdt-safe/wasm/src/lib.rs @@ -7,7 +7,7 @@ // Init: 1 // Upgrade: 1 // Endpoints: 28 -// Async Callback: 1 +// Async Callback (empty): 1 // Promise callbacks: 1 // Total number of exported functions: 32 @@ -49,8 +49,8 @@ multiversx_sc_wasm_adapter::endpoints! { pause => pause_endpoint unpause => unpause_endpoint isPaused => paused_status - execute => execute + distribute_payments_callback => distribute_payments_callback ) } -multiversx_sc_wasm_adapter::async_callback! { esdt_safe } +multiversx_sc_wasm_adapter::async_callback_empty! {} From 020b8a35b1d93b4d280f24d6d81a85605e2b79bc Mon Sep 17 00:00:00 2001 From: Andrei Baltariu Date: Wed, 9 Oct 2024 19:06:23 +0300 Subject: [PATCH 369/523] Added custom type for deposit endpoint Signed-off-by: Andrei Baltariu --- esdt-safe/src/to_sovereign/create_tx.rs | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/esdt-safe/src/to_sovereign/create_tx.rs b/esdt-safe/src/to_sovereign/create_tx.rs index c71b204c..08cd78a5 100644 --- a/esdt-safe/src/to_sovereign/create_tx.rs +++ b/esdt-safe/src/to_sovereign/create_tx.rs @@ -1,7 +1,7 @@ use crate::from_sovereign::token_mapping; use fee_market::fee_market_proxy; use multiversx_sc::{hex_literal::hex, storage::StorageKey}; -use transaction::{GasLimit, OperationData, TransferData}; +use transaction::{GasLimit, OperationData, OptionalValueTransferDataTuple, TransferData}; multiversx_sc::imports!(); @@ -26,9 +26,7 @@ pub trait CreateTxModule: fn deposit( &self, to: ManagedAddress, - opt_transfer_data: OptionalValue< - MultiValue3>, - >, + opt_transfer_data: OptionalValueTransferDataTuple, ) { require!(self.not_paused(), "Cannot create transaction while paused"); From 30810b884760e24b5462f9c38f0f86bd9072a53e Mon Sep 17 00:00:00 2001 From: Andrei Baltariu Date: Wed, 9 Oct 2024 19:14:45 +0300 Subject: [PATCH 370/523] Added custom result type Signed-off-by: Andrei Baltariu --- common/transaction/src/lib.rs | 2 ++ esdt-safe/src/to_sovereign/create_tx.rs | 8 ++++---- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/common/transaction/src/lib.rs b/common/transaction/src/lib.rs index 34b8ba8d..8091df7d 100644 --- a/common/transaction/src/lib.rs +++ b/common/transaction/src/lib.rs @@ -27,6 +27,8 @@ pub type TxAsMultiValue = MultiValue7< >; pub type PaymentsVec = ManagedVec>; pub type TxBatchSplitInFields = MultiValue2>>; +pub type ExtractedFeeResult = + MultiValue2>, ManagedVec>>; pub type OptionalValueTransferDataTuple = OptionalValue, ManagedVec>>>; diff --git a/esdt-safe/src/to_sovereign/create_tx.rs b/esdt-safe/src/to_sovereign/create_tx.rs index 08cd78a5..b73350eb 100644 --- a/esdt-safe/src/to_sovereign/create_tx.rs +++ b/esdt-safe/src/to_sovereign/create_tx.rs @@ -1,7 +1,9 @@ use crate::from_sovereign::token_mapping; use fee_market::fee_market_proxy; use multiversx_sc::{hex_literal::hex, storage::StorageKey}; -use transaction::{GasLimit, OperationData, OptionalValueTransferDataTuple, TransferData}; +use transaction::{ + ExtractedFeeResult, GasLimit, OperationData, OptionalValueTransferDataTuple, TransferData, +}; multiversx_sc::imports!(); @@ -127,9 +129,7 @@ pub trait CreateTxModule: ); } - fn check_and_extract_fee( - &self, - ) -> MultiValue2, ManagedVec> { + fn check_and_extract_fee(&self) -> ExtractedFeeResult { let mut payments = self.call_value().all_esdt_transfers().clone_value(); require!(!payments.is_empty(), "Nothing to transfer"); From 34559844f7bc45cdb46554cb88abf740bc77724f Mon Sep 17 00:00:00 2001 From: Andrei Baltariu Date: Wed, 9 Oct 2024 19:19:58 +0300 Subject: [PATCH 371/523] Added more custom types and variable traits Signed-off-by: Andrei Baltariu --- common/transaction/src/lib.rs | 1 + esdt-safe/src/to_sovereign/create_tx.rs | 10 ++++------ 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/common/transaction/src/lib.rs b/common/transaction/src/lib.rs index 8091df7d..73c3bae1 100644 --- a/common/transaction/src/lib.rs +++ b/common/transaction/src/lib.rs @@ -26,6 +26,7 @@ pub type TxAsMultiValue = MultiValue7< Option>, >; pub type PaymentsVec = ManagedVec>; +pub type PaymentTuple = MultiValue3, u64, EsdtTokenData>; pub type TxBatchSplitInFields = MultiValue2>>; pub type ExtractedFeeResult = MultiValue2>, ManagedVec>>; diff --git a/esdt-safe/src/to_sovereign/create_tx.rs b/esdt-safe/src/to_sovereign/create_tx.rs index b73350eb..ed999d73 100644 --- a/esdt-safe/src/to_sovereign/create_tx.rs +++ b/esdt-safe/src/to_sovereign/create_tx.rs @@ -2,7 +2,8 @@ use crate::from_sovereign::token_mapping; use fee_market::fee_market_proxy; use multiversx_sc::{hex_literal::hex, storage::StorageKey}; use transaction::{ - ExtractedFeeResult, GasLimit, OperationData, OptionalValueTransferDataTuple, TransferData, + ExtractedFeeResult, GasLimit, OperationData, OptionalValueTransferDataTuple, PaymentTuple, + TransferData, }; multiversx_sc::imports!(); @@ -40,11 +41,8 @@ pub trait CreateTxModule: let opt_transfer_data = self.process_transfer_data(opt_transfer_data); let own_sc_address = self.blockchain().get_sc_address(); let mut total_tokens_for_fees = 0usize; - let mut event_payments: MultiValueEncoded< - MultiValue3, - > = MultiValueEncoded::new(); - let mut refundable_payments: ManagedVec> = - ManagedVec::new(); + let mut event_payments = MultiValueEncoded::>::new(); + let mut refundable_payments = ManagedVec::>::new(); for payment in &payments { self.require_below_max_amount(&payment.token_identifier, &payment.amount); From fc8dac2b86aabb350ed7373c0cad31d114f5b095 Mon Sep 17 00:00:00 2001 From: Andrei Baltariu Date: Thu, 10 Oct 2024 10:10:49 +0300 Subject: [PATCH 372/523] More cleanup for readibility Signed-off-by: Andrei Baltariu --- esdt-safe/src/to_sovereign/create_tx.rs | 33 ++++++++++++++----------- 1 file changed, 18 insertions(+), 15 deletions(-) diff --git a/esdt-safe/src/to_sovereign/create_tx.rs b/esdt-safe/src/to_sovereign/create_tx.rs index ed999d73..c2001f51 100644 --- a/esdt-safe/src/to_sovereign/create_tx.rs +++ b/esdt-safe/src/to_sovereign/create_tx.rs @@ -66,40 +66,45 @@ pub trait CreateTxModule: current_token_data.amount = payment.amount.clone(); - if self.is_sovereign_chain().get() { + let is_sovereign_chain = self.is_sovereign_chain().get(); + + if is_sovereign_chain { self.tx() .to(ToSelf) .typed(ESDTSystemSCProxy) .burn(&payment.token_identifier, &payment.amount) .transfer_execute(); - event_payments.push(MultiValue3(( + let event_payment: PaymentTuple = MultiValue3(( payment.token_identifier.clone(), payment.token_nonce, current_token_data.clone(), - ))); + )); + + event_payments.push(event_payment); } else { let sov_token_id = self .multiversx_to_sovereign_token_id(&payment.token_identifier) .get(); if !sov_token_id.is_valid_esdt_identifier() { - event_payments.push(MultiValue3(( - payment.token_identifier, + let event_payment: PaymentTuple = MultiValue3(( + payment.token_identifier.clone(), payment.token_nonce, current_token_data.clone(), - ))); + )); + + event_payments.push(event_payment); continue; } let sov_token_nonce = self.remove_sovereign_token(payment, &sov_token_id); - event_payments.push(MultiValue3(( - sov_token_id, - sov_token_nonce, - current_token_data.clone(), - ))); + let event_payment: PaymentTuple = + MultiValue3((sov_token_id, sov_token_nonce, current_token_data.clone())); + + event_payments.push(event_payment); } } @@ -151,9 +156,7 @@ pub trait CreateTxModule: fn process_transfer_data( &self, - opt_transfer_data: OptionalValue< - MultiValue3>, - >, + opt_transfer_data: OptionalValueTransferDataTuple, ) -> Option> { match &opt_transfer_data { OptionalValue::Some(transfer_data) => { @@ -206,7 +209,7 @@ pub trait CreateTxModule: &self, total_tokens_for_fees: usize, fees_payment: &OptionalValue>, - opt_transfer_data: &Option::Api>>, + opt_transfer_data: &Option>, ) { match fees_payment { OptionalValue::Some(fee) => { From 5a2eaa101ce9e8ea756fa4b1f8cac5b2b387dce2 Mon Sep 17 00:00:00 2001 From: Andrei Baltariu Date: Thu, 10 Oct 2024 13:06:23 +0300 Subject: [PATCH 373/523] Esdt-Safe cleanup Signed-off-by: Andrei Baltariu --- common/transaction/src/lib.rs | 2 +- esdt-safe/src/esdt_safe_proxy.rs | 4 +- esdt-safe/src/from_sovereign/events.rs | 4 +- esdt-safe/src/from_sovereign/token_mapping.rs | 3 +- .../src/from_sovereign/transfer_tokens.rs | 68 +++++++++---------- esdt-safe/src/to_sovereign/create_tx.rs | 33 +++------ 6 files changed, 48 insertions(+), 66 deletions(-) diff --git a/common/transaction/src/lib.rs b/common/transaction/src/lib.rs index 73c3bae1..29670c9a 100644 --- a/common/transaction/src/lib.rs +++ b/common/transaction/src/lib.rs @@ -26,7 +26,7 @@ pub type TxAsMultiValue = MultiValue7< Option>, >; pub type PaymentsVec = ManagedVec>; -pub type PaymentTuple = MultiValue3, u64, EsdtTokenData>; +pub type EventPaymentTuple = MultiValue3, u64, EsdtTokenData>; pub type TxBatchSplitInFields = MultiValue2>>; pub type ExtractedFeeResult = MultiValue2>, ManagedVec>>; diff --git a/esdt-safe/src/esdt_safe_proxy.rs b/esdt-safe/src/esdt_safe_proxy.rs index 1c463ded..a04bcc03 100644 --- a/esdt-safe/src/esdt_safe_proxy.rs +++ b/esdt-safe/src/esdt_safe_proxy.rs @@ -117,12 +117,12 @@ where >( self, to: Arg0, - opt_transfer_data: Arg1, + optional_transfer_data: Arg1, ) -> TxTypedCall { self.wrapped_tx .raw_call("deposit") .argument(&to) - .argument(&opt_transfer_data) + .argument(&optional_transfer_data) .original_result() } diff --git a/esdt-safe/src/from_sovereign/events.rs b/esdt-safe/src/from_sovereign/events.rs index ec07f3a7..620d947d 100644 --- a/esdt-safe/src/from_sovereign/events.rs +++ b/esdt-safe/src/from_sovereign/events.rs @@ -5,7 +5,7 @@ pub trait EventsModule { #[event("executedBridgeOp")] fn execute_bridge_operation_event( &self, - #[indexed] hash_of_hashes: ManagedBuffer, - #[indexed] hash_of_bridge_op: ManagedBuffer, + #[indexed] hash_of_hashes: &ManagedBuffer, + #[indexed] hash_of_bridge_op: &ManagedBuffer, ); } diff --git a/esdt-safe/src/from_sovereign/token_mapping.rs b/esdt-safe/src/from_sovereign/token_mapping.rs index 4cdcf04a..f4c0856f 100644 --- a/esdt-safe/src/from_sovereign/token_mapping.rs +++ b/esdt-safe/src/from_sovereign/token_mapping.rs @@ -38,8 +38,9 @@ pub trait TokenMappingModule { token_ticker: ManagedBuffer, num_decimals: usize, ) { + let is_sovereign_chain = self.is_sovereign_chain().get(); require!( - !self.is_sovereign_chain().get(), + !is_sovereign_chain, "Invalid method to call in current chain" ); diff --git a/esdt-safe/src/from_sovereign/transfer_tokens.rs b/esdt-safe/src/from_sovereign/transfer_tokens.rs index 5931bdaa..740a9972 100644 --- a/esdt-safe/src/from_sovereign/transfer_tokens.rs +++ b/esdt-safe/src/from_sovereign/transfer_tokens.rs @@ -27,15 +27,16 @@ pub trait TransferTokensModule: { #[endpoint(executeBridgeOps)] fn execute_operations(&self, hash_of_hashes: ManagedBuffer, operation: Operation) { + let is_sovereign_chain = self.is_sovereign_chain().get(); require!( - !self.is_sovereign_chain().get(), + !is_sovereign_chain, "Invalid method to call in current chain" ); require!(self.not_paused(), "Cannot transfer while paused"); let (operation_hash, is_registered) = - self.calculate_operation_hash(hash_of_hashes.clone(), operation.clone()); + self.calculate_operation_hash(&hash_of_hashes, &operation); if !is_registered { sc_panic!("Operation is not registered"); @@ -47,7 +48,7 @@ pub trait TransferTokensModule: operation, }; - self.distribute_payments(hash_of_hashes, operation_tuple, minted_operation_tokens); + self.distribute_payments(&hash_of_hashes, &operation_tuple, &minted_operation_tokens); } fn mint_tokens( @@ -106,15 +107,21 @@ pub trait TransferTokensModule: operation_token: &OperationEsdtPayment, ) -> u64 { // mint NFT - let nft_nonce = self.send().esdt_nft_create( - mx_token_id, - &operation_token.token_data.amount, - &operation_token.token_data.name, - &operation_token.token_data.royalties, - &operation_token.token_data.hash, - &operation_token.token_data.attributes, - &operation_token.token_data.uris, - ); + let nft_nonce = self + .tx() + .to(ToSelf) + .typed(system_proxy::UserBuiltinProxy) + .esdt_nft_create( + mx_token_id, + &operation_token.token_data.amount, + &operation_token.token_data.name, + &operation_token.token_data.royalties, + &operation_token.token_data.hash, + &operation_token.token_data.attributes, + &operation_token.token_data.uris, + ) + .returns(ReturnsResult) + .sync_call(); // save token id and nonce self.sovereign_esdt_token_info_mapper( @@ -137,29 +144,26 @@ pub trait TransferTokensModule: fn distribute_payments( &self, - hash_of_hashes: ManagedBuffer, - operation_tuple: OperationTuple, - tokens_list: ManagedVec>, + hash_of_hashes: &ManagedBuffer, + operation_tuple: &OperationTuple, + tokens_list: &ManagedVec>, ) { let mapped_tokens: ManagedVec> = tokens_list.iter().map(|token| token.into()).collect(); match &operation_tuple.operation.data.opt_transfer_data { Some(transfer_data) => { - let mut args = ManagedArgBuffer::new(); - for arg in &transfer_data.args { - args.push_arg(arg); - } + let args = ManagedArgBuffer::from(transfer_data.args.clone()); self.tx() .to(&operation_tuple.operation.to) .raw_call(transfer_data.function.clone()) - .arguments_raw(args.clone()) + .arguments_raw(args) .multi_esdt(mapped_tokens.clone()) .gas(transfer_data.gas_limit) .callback( self.callbacks() - .distribute_payments_callback(&hash_of_hashes, &operation_tuple), + .distribute_payments_callback(hash_of_hashes, operation_tuple), ) .gas_for_callback(CALLBACK_GAS) .register_promise(); @@ -176,7 +180,7 @@ pub trait TransferTokensModule: .gas(TRANSACTION_GAS) .callback( self.callbacks() - .distribute_payments_callback(&hash_of_hashes, &operation_tuple), + .distribute_payments_callback(hash_of_hashes, operation_tuple), ) .register_promise(); } @@ -192,11 +196,7 @@ pub trait TransferTokensModule: args.push_arg(to); args.push_arg(mapped_tokens.len()); - for token in &mapped_tokens { - args.push_arg(token.token_identifier); - args.push_arg(token.token_nonce); - args.push_arg(token.amount); - } + args.push_multi_arg(&mapped_tokens); args } @@ -210,10 +210,7 @@ pub trait TransferTokensModule: ) { match result { ManagedAsyncCallResult::Ok(_) => { - self.execute_bridge_operation_event( - hash_of_hashes.clone(), - operation_tuple.op_hash.clone(), - ); + self.execute_bridge_operation_event(hash_of_hashes, &operation_tuple.op_hash); } ManagedAsyncCallResult::Err(_) => { self.emit_transfer_failed_events(hash_of_hashes, operation_tuple); @@ -235,10 +232,7 @@ pub trait TransferTokensModule: operation_tuple: &OperationTuple, ) { // confirmation event - self.execute_bridge_operation_event( - hash_of_hashes.clone(), - operation_tuple.op_hash.clone(), - ); + self.execute_bridge_operation_event(hash_of_hashes, &operation_tuple.op_hash); for operation_token in &operation_tuple.operation.tokens { let mx_token_id_state = self @@ -292,8 +286,8 @@ pub trait TransferTokensModule: // use pending_operations as param fn calculate_operation_hash( &self, - hash_of_hashes: ManagedBuffer, - operation: Operation, + hash_of_hashes: &ManagedBuffer, + operation: &Operation, ) -> (ManagedBuffer, bool) { let mut serialized_data = ManagedBuffer::new(); let mut storage_key = StorageKey::from("pendingHashes"); diff --git a/esdt-safe/src/to_sovereign/create_tx.rs b/esdt-safe/src/to_sovereign/create_tx.rs index c2001f51..6ccd32e0 100644 --- a/esdt-safe/src/to_sovereign/create_tx.rs +++ b/esdt-safe/src/to_sovereign/create_tx.rs @@ -1,15 +1,13 @@ use crate::from_sovereign::token_mapping; use fee_market::fee_market_proxy; -use multiversx_sc::{hex_literal::hex, storage::StorageKey}; +use multiversx_sc::storage::StorageKey; use transaction::{ - ExtractedFeeResult, GasLimit, OperationData, OptionalValueTransferDataTuple, PaymentTuple, + EventPaymentTuple, ExtractedFeeResult, GasLimit, OperationData, OptionalValueTransferDataTuple, TransferData, }; multiversx_sc::imports!(); -pub const ESDT_SYSTEM_SC_ADDRESS: [u8; 32] = - hex!("000000000000000000010000000000000000000000000000000000000002ffff"); const MAX_TRANSFERS_PER_TX: usize = 10; #[multiversx_sc::module] @@ -29,7 +27,7 @@ pub trait CreateTxModule: fn deposit( &self, to: ManagedAddress, - opt_transfer_data: OptionalValueTransferDataTuple, + optional_transfer_data: OptionalValueTransferDataTuple, ) { require!(self.not_paused(), "Cannot create transaction while paused"); @@ -38,10 +36,11 @@ pub trait CreateTxModule: require!(!payments.is_empty(), "Nothing to transfer"); require!(payments.len() <= MAX_TRANSFERS_PER_TX, "Too many tokens"); - let opt_transfer_data = self.process_transfer_data(opt_transfer_data); + let opt_transfer_data = self.process_transfer_data(optional_transfer_data); let own_sc_address = self.blockchain().get_sc_address(); let mut total_tokens_for_fees = 0usize; - let mut event_payments = MultiValueEncoded::>::new(); + let mut event_payments = + MultiValueEncoded::>::new(); let mut refundable_payments = ManagedVec::>::new(); for payment in &payments { @@ -75,7 +74,7 @@ pub trait CreateTxModule: .burn(&payment.token_identifier, &payment.amount) .transfer_execute(); - let event_payment: PaymentTuple = MultiValue3(( + let event_payment: EventPaymentTuple = MultiValue3(( payment.token_identifier.clone(), payment.token_nonce, current_token_data.clone(), @@ -87,21 +86,9 @@ pub trait CreateTxModule: .multiversx_to_sovereign_token_id(&payment.token_identifier) .get(); - if !sov_token_id.is_valid_esdt_identifier() { - let event_payment: PaymentTuple = MultiValue3(( - payment.token_identifier.clone(), - payment.token_nonce, - current_token_data.clone(), - )); - - event_payments.push(event_payment); - - continue; - } - - let sov_token_nonce = self.remove_sovereign_token(payment, &sov_token_id); + let sov_token_nonce = self.burn_mainchain_token(payment, &sov_token_id); - let event_payment: PaymentTuple = + let event_payment: EventPaymentTuple = MultiValue3((sov_token_id, sov_token_nonce, current_token_data.clone())); event_payments.push(event_payment); @@ -180,7 +167,7 @@ pub trait CreateTxModule: } } - fn remove_sovereign_token( + fn burn_mainchain_token( &self, payment: EsdtTokenPayment, sov_token_id: &TokenIdentifier, From f89499da88550b77365bfa28c4fced7291754bca Mon Sep 17 00:00:00 2001 From: Andrei Baltariu Date: Thu, 10 Oct 2024 13:13:47 +0300 Subject: [PATCH 374/523] Removed unused custom type Signed-off-by: Andrei Baltariu --- esdt-safe/src/from_sovereign/transfer_tokens.rs | 2 -- 1 file changed, 2 deletions(-) diff --git a/esdt-safe/src/from_sovereign/transfer_tokens.rs b/esdt-safe/src/from_sovereign/transfer_tokens.rs index 740a9972..d206c0ac 100644 --- a/esdt-safe/src/from_sovereign/transfer_tokens.rs +++ b/esdt-safe/src/from_sovereign/transfer_tokens.rs @@ -12,8 +12,6 @@ multiversx_sc::imports!(); const CALLBACK_GAS: GasLimit = 10_000_000; // Increase if not enough const TRANSACTION_GAS: GasLimit = 30_000_000; -pub type MultiOperationEsdtPayment = ManagedVec>; - #[multiversx_sc::module] pub trait TransferTokensModule: bls_signature::BlsSignatureModule From 9f0031ea903d9cd4ba03f20d9ff0e67c32687386 Mon Sep 17 00:00:00 2001 From: Andrei Baltariu Date: Thu, 10 Oct 2024 14:35:21 +0300 Subject: [PATCH 375/523] Added EsdtSystemProxy calls with callbacks Signed-off-by: Andrei Baltariu --- esdt-safe/src/from_sovereign/token_mapping.rs | 69 +++++++++++++++---- 1 file changed, 56 insertions(+), 13 deletions(-) diff --git a/esdt-safe/src/from_sovereign/token_mapping.rs b/esdt-safe/src/from_sovereign/token_mapping.rs index f4c0856f..4e613701 100644 --- a/esdt-safe/src/from_sovereign/token_mapping.rs +++ b/esdt-safe/src/from_sovereign/token_mapping.rs @@ -81,32 +81,75 @@ pub trait TokenMappingModule { } fn handle_fungible_token_type(&self, args: FungibleTokenArgs) { - self.multiversx_to_sovereign_token_id(&args.sov_token_id) - .set(args.sov_token_id.clone()); - - self.fungible_token(&args.sov_token_id) + self.tx() + .to(ToCaller) + .typed(ESDTSystemSCProxy) .issue_and_set_all_roles( args.issue_cost, args.token_display_name, args.token_ticker, + EsdtTokenType::Fungible, args.num_decimals, - None, - ); + ) + .gas(self.blockchain().get_gas_left()) + .callback( + ::callbacks(self) + .fungible_issue_callback(&args.sov_token_id), + ) + .register_promise(); } - fn handle_nonfungible_token_type(&self, args: NonFungibleTokenArgs) { - self.multiversx_to_sovereign_token_id(&args.sov_token_id) - .set(args.sov_token_id.clone()); + #[promises_callback] + fn fungible_issue_callback( + &self, + sov_token_id: &TokenIdentifier, + #[call_result] result: ManagedAsyncCallResult>, + ) { + match result { + ManagedAsyncCallResult::Ok(mainchain_id) => { + self.sovereign_to_multiversx_token_id(sov_token_id) + .set(TokenMapperState::Token(mainchain_id)); + } + ManagedAsyncCallResult::Err(_) => { + sc_panic!(""); + } + } + } - self.non_fungible_token(&args.sov_token_id) + fn handle_nonfungible_token_type(&self, args: NonFungibleTokenArgs) { + self.tx() + .to(ToCaller) + .typed(ESDTSystemSCProxy) .issue_and_set_all_roles( - args.token_type, args.issue_cost, args.token_display_name, args.token_ticker, + EsdtTokenType::NonFungible, args.num_decimals, - None, - ); + ) + .gas(self.blockchain().get_gas_left()) + .callback( + ::callbacks(self) + .fungible_issue_callback(&args.sov_token_id), + ) + .register_promise(); + } + + #[promises_callback] + fn nonfungible_issue_callback( + &self, + sov_token_id: &TokenIdentifier, + #[call_result] result: ManagedAsyncCallResult>, + ) { + match result { + ManagedAsyncCallResult::Ok(mainchain_id) => { + self.sovereign_to_multiversx_token_id(sov_token_id) + .set(TokenMapperState::Token(mainchain_id)); + } + ManagedAsyncCallResult::Err(_) => { + sc_panic!(""); + } + } } #[storage_mapper("sovToMxTokenId")] From 1699bbbe613dafc8ec7e77d0b35449526446f69d Mon Sep 17 00:00:00 2001 From: Andrei Baltariu Date: Thu, 10 Oct 2024 14:53:51 +0300 Subject: [PATCH 376/523] Added callbacks and mapping corresponding token ids Signed-off-by: Andrei Baltariu --- esdt-safe/src/from_sovereign/token_mapping.rs | 54 +++++++------------ 1 file changed, 18 insertions(+), 36 deletions(-) diff --git a/esdt-safe/src/from_sovereign/token_mapping.rs b/esdt-safe/src/from_sovereign/token_mapping.rs index 4e613701..d90a6720 100644 --- a/esdt-safe/src/from_sovereign/token_mapping.rs +++ b/esdt-safe/src/from_sovereign/token_mapping.rs @@ -68,16 +68,6 @@ pub trait TokenMappingModule { num_decimals, }), } - - // !!! Unreachable code !!! - match self.sovereign_to_multiversx_token_id(&sov_token_id).get() { - TokenMapperState::NotSet => sc_panic!("Token ID not set"), - TokenMapperState::Pending => {} - TokenMapperState::Token(mx_token_id) => { - self.multiversx_to_sovereign_token_id(&mx_token_id) - .set(sov_token_id); - } - } } fn handle_fungible_token_type(&self, args: FungibleTokenArgs) { @@ -93,29 +83,11 @@ pub trait TokenMappingModule { ) .gas(self.blockchain().get_gas_left()) .callback( - ::callbacks(self) - .fungible_issue_callback(&args.sov_token_id), + ::callbacks(self).issue_callback(&args.sov_token_id), ) .register_promise(); } - #[promises_callback] - fn fungible_issue_callback( - &self, - sov_token_id: &TokenIdentifier, - #[call_result] result: ManagedAsyncCallResult>, - ) { - match result { - ManagedAsyncCallResult::Ok(mainchain_id) => { - self.sovereign_to_multiversx_token_id(sov_token_id) - .set(TokenMapperState::Token(mainchain_id)); - } - ManagedAsyncCallResult::Err(_) => { - sc_panic!(""); - } - } - } - fn handle_nonfungible_token_type(&self, args: NonFungibleTokenArgs) { self.tx() .to(ToCaller) @@ -129,29 +101,39 @@ pub trait TokenMappingModule { ) .gas(self.blockchain().get_gas_left()) .callback( - ::callbacks(self) - .fungible_issue_callback(&args.sov_token_id), + ::callbacks(self).issue_callback(&args.sov_token_id), ) .register_promise(); } #[promises_callback] - fn nonfungible_issue_callback( + fn issue_callback( &self, sov_token_id: &TokenIdentifier, #[call_result] result: ManagedAsyncCallResult>, ) { match result { - ManagedAsyncCallResult::Ok(mainchain_id) => { - self.sovereign_to_multiversx_token_id(sov_token_id) - .set(TokenMapperState::Token(mainchain_id)); + ManagedAsyncCallResult::Ok(mvx_token_id) => { + self.set_corresponding_token_ids(sov_token_id, &mvx_token_id); } ManagedAsyncCallResult::Err(_) => { - sc_panic!(""); + sc_panic!("There was an error at issuing nonfungible tokens"); } } } + fn set_corresponding_token_ids( + &self, + sov_token_id: &TokenIdentifier, + mvx_token_id: &TokenIdentifier, + ) { + self.sovereign_to_multiversx_token_id(sov_token_id) + .set(TokenMapperState::Token(mvx_token_id.clone())); + + self.multiversx_to_sovereign_token_id(mvx_token_id) + .set(sov_token_id); + } + #[storage_mapper("sovToMxTokenId")] fn sovereign_to_multiversx_token_id( &self, From 455ef5204fb0a77f4272639be71156f7f63899b1 Mon Sep 17 00:00:00 2001 From: Andrei Baltariu Date: Thu, 10 Oct 2024 14:55:18 +0300 Subject: [PATCH 377/523] Reverted general callback trait name Signed-off-by: Andrei Baltariu --- esdt-safe/src/from_sovereign/transfer_tokens.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/esdt-safe/src/from_sovereign/transfer_tokens.rs b/esdt-safe/src/from_sovereign/transfer_tokens.rs index d206c0ac..2f0506cb 100644 --- a/esdt-safe/src/from_sovereign/transfer_tokens.rs +++ b/esdt-safe/src/from_sovereign/transfer_tokens.rs @@ -160,7 +160,7 @@ pub trait TransferTokensModule: .multi_esdt(mapped_tokens.clone()) .gas(transfer_data.gas_limit) .callback( - self.callbacks() + ::callbacks(self) .distribute_payments_callback(hash_of_hashes, operation_tuple), ) .gas_for_callback(CALLBACK_GAS) @@ -177,7 +177,7 @@ pub trait TransferTokensModule: .arguments_raw(args) .gas(TRANSACTION_GAS) .callback( - self.callbacks() + ::callbacks(self) .distribute_payments_callback(hash_of_hashes, operation_tuple), ) .register_promise(); From fd0fd4ebcd2fcc23707e0c4e64df59bb87f8dac5 Mon Sep 17 00:00:00 2001 From: Andrei Baltariu Date: Thu, 10 Oct 2024 14:55:35 +0300 Subject: [PATCH 378/523] Added TODO Signed-off-by: Andrei Baltariu --- esdt-safe/src/from_sovereign/transfer_tokens.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/esdt-safe/src/from_sovereign/transfer_tokens.rs b/esdt-safe/src/from_sovereign/transfer_tokens.rs index 2f0506cb..80b11ad8 100644 --- a/esdt-safe/src/from_sovereign/transfer_tokens.rs +++ b/esdt-safe/src/from_sovereign/transfer_tokens.rs @@ -140,6 +140,7 @@ pub trait TransferTokensModule: nft_nonce } + // TODO: create a callback module fn distribute_payments( &self, hash_of_hashes: &ManagedBuffer, From 24595a849621a7b6df5c46473b9043d859c4799c Mon Sep 17 00:00:00 2001 From: Andrei Baltariu Date: Thu, 10 Oct 2024 15:51:09 +0300 Subject: [PATCH 379/523] Added use or args field Signed-off-by: Andrei Baltariu --- esdt-safe/src/from_sovereign/token_mapping.rs | 21 +++++++++++-------- esdt-safe/wasm-esdt-safe-full/src/lib.rs | 5 +++-- esdt-safe/wasm/src/lib.rs | 5 +++-- 3 files changed, 18 insertions(+), 13 deletions(-) diff --git a/esdt-safe/src/from_sovereign/token_mapping.rs b/esdt-safe/src/from_sovereign/token_mapping.rs index d90a6720..f8a67356 100644 --- a/esdt-safe/src/from_sovereign/token_mapping.rs +++ b/esdt-safe/src/from_sovereign/token_mapping.rs @@ -59,14 +59,17 @@ pub trait TokenMappingModule { token_ticker, num_decimals, }), - _ => self.handle_nonfungible_token_type(NonFungibleTokenArgs { - sov_token_id: sov_token_id.clone(), - token_type, - issue_cost, - token_display_name, - token_ticker, - num_decimals, - }), + EsdtTokenType::NonFungible => { + self.handle_nonfungible_token_type(NonFungibleTokenArgs { + sov_token_id: sov_token_id.clone(), + token_type, + issue_cost, + token_display_name, + token_ticker, + num_decimals, + }) + } + _ => {} } } @@ -96,7 +99,7 @@ pub trait TokenMappingModule { args.issue_cost, args.token_display_name, args.token_ticker, - EsdtTokenType::NonFungible, + args.token_type, args.num_decimals, ) .gas(self.blockchain().get_gas_left()) diff --git a/esdt-safe/wasm-esdt-safe-full/src/lib.rs b/esdt-safe/wasm-esdt-safe-full/src/lib.rs index e7e5da9f..533765a4 100644 --- a/esdt-safe/wasm-esdt-safe-full/src/lib.rs +++ b/esdt-safe/wasm-esdt-safe-full/src/lib.rs @@ -8,8 +8,8 @@ // Upgrade: 1 // Endpoints: 28 // Async Callback (empty): 1 -// Promise callbacks: 1 -// Total number of exported functions: 32 +// Promise callbacks: 2 +// Total number of exported functions: 33 #![no_std] @@ -49,6 +49,7 @@ multiversx_sc_wasm_adapter::endpoints! { pause => pause_endpoint unpause => unpause_endpoint isPaused => paused_status + issue_callback => issue_callback distribute_payments_callback => distribute_payments_callback ) } diff --git a/esdt-safe/wasm/src/lib.rs b/esdt-safe/wasm/src/lib.rs index e7e5da9f..533765a4 100644 --- a/esdt-safe/wasm/src/lib.rs +++ b/esdt-safe/wasm/src/lib.rs @@ -8,8 +8,8 @@ // Upgrade: 1 // Endpoints: 28 // Async Callback (empty): 1 -// Promise callbacks: 1 -// Total number of exported functions: 32 +// Promise callbacks: 2 +// Total number of exported functions: 33 #![no_std] @@ -49,6 +49,7 @@ multiversx_sc_wasm_adapter::endpoints! { pause => pause_endpoint unpause => unpause_endpoint isPaused => paused_status + issue_callback => issue_callback distribute_payments_callback => distribute_payments_callback ) } From 64696f88fab22ca28a03a3047d28bc0fd86952ef Mon Sep 17 00:00:00 2001 From: Andrei Baltariu Date: Thu, 10 Oct 2024 15:53:02 +0300 Subject: [PATCH 380/523] Removed clone Signed-off-by: Andrei Baltariu --- esdt-safe/src/from_sovereign/token_mapping.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/esdt-safe/src/from_sovereign/token_mapping.rs b/esdt-safe/src/from_sovereign/token_mapping.rs index f8a67356..6e8e592f 100644 --- a/esdt-safe/src/from_sovereign/token_mapping.rs +++ b/esdt-safe/src/from_sovereign/token_mapping.rs @@ -61,7 +61,7 @@ pub trait TokenMappingModule { }), EsdtTokenType::NonFungible => { self.handle_nonfungible_token_type(NonFungibleTokenArgs { - sov_token_id: sov_token_id.clone(), + sov_token_id, token_type, issue_cost, token_display_name, From 2728b88f876a29c6321ba53f1226edf4ea81b182 Mon Sep 17 00:00:00 2001 From: Andrei Baltariu Date: Thu, 10 Oct 2024 16:13:37 +0300 Subject: [PATCH 381/523] Added back if statement Signed-off-by: Andrei Baltariu --- esdt-safe/src/to_sovereign/create_tx.rs | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/esdt-safe/src/to_sovereign/create_tx.rs b/esdt-safe/src/to_sovereign/create_tx.rs index 6ccd32e0..87ecdb1d 100644 --- a/esdt-safe/src/to_sovereign/create_tx.rs +++ b/esdt-safe/src/to_sovereign/create_tx.rs @@ -86,6 +86,18 @@ pub trait CreateTxModule: .multiversx_to_sovereign_token_id(&payment.token_identifier) .get(); + if !sov_token_id.is_valid_esdt_identifier() { + let event_payment: EventPaymentTuple = MultiValue3(( + payment.token_identifier.clone(), + payment.token_nonce, + current_token_data.clone(), + )); + + event_payments.push(event_payment); + + continue; + } + let sov_token_nonce = self.burn_mainchain_token(payment, &sov_token_id); let event_payment: EventPaymentTuple = From 5b06b15447bb147a59fd09d842d6ecfeb7c5fd25 Mon Sep 17 00:00:00 2001 From: Andrei Baltariu Date: Thu, 10 Oct 2024 17:41:34 +0300 Subject: [PATCH 382/523] Fix after review Signed-off-by: Andrei Baltariu --- esdt-safe/src/from_sovereign/transfer_tokens.rs | 6 +++--- esdt-safe/src/to_sovereign/create_tx.rs | 3 --- 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/esdt-safe/src/from_sovereign/transfer_tokens.rs b/esdt-safe/src/from_sovereign/transfer_tokens.rs index 80b11ad8..9b63105b 100644 --- a/esdt-safe/src/from_sovereign/transfer_tokens.rs +++ b/esdt-safe/src/from_sovereign/transfer_tokens.rs @@ -162,7 +162,7 @@ pub trait TransferTokensModule: .gas(transfer_data.gas_limit) .callback( ::callbacks(self) - .distribute_payments_callback(hash_of_hashes, operation_tuple), + .execute(hash_of_hashes, operation_tuple), ) .gas_for_callback(CALLBACK_GAS) .register_promise(); @@ -179,7 +179,7 @@ pub trait TransferTokensModule: .gas(TRANSACTION_GAS) .callback( ::callbacks(self) - .distribute_payments_callback(hash_of_hashes, operation_tuple), + .execute(hash_of_hashes, operation_tuple), ) .register_promise(); } @@ -201,7 +201,7 @@ pub trait TransferTokensModule: } #[promises_callback] - fn distribute_payments_callback( + fn execute( &self, hash_of_hashes: &ManagedBuffer, operation_tuple: &OperationTuple, diff --git a/esdt-safe/src/to_sovereign/create_tx.rs b/esdt-safe/src/to_sovereign/create_tx.rs index 87ecdb1d..a8653006 100644 --- a/esdt-safe/src/to_sovereign/create_tx.rs +++ b/esdt-safe/src/to_sovereign/create_tx.rs @@ -66,7 +66,6 @@ pub trait CreateTxModule: current_token_data.amount = payment.amount.clone(); let is_sovereign_chain = self.is_sovereign_chain().get(); - if is_sovereign_chain { self.tx() .to(ToSelf) @@ -79,7 +78,6 @@ pub trait CreateTxModule: payment.token_nonce, current_token_data.clone(), )); - event_payments.push(event_payment); } else { let sov_token_id = self @@ -92,7 +90,6 @@ pub trait CreateTxModule: payment.token_nonce, current_token_data.clone(), )); - event_payments.push(event_payment); continue; From daf49c099a975e4318fd23591111fe932e94b8ff Mon Sep 17 00:00:00 2001 From: Andrei Baltariu Date: Thu, 10 Oct 2024 17:44:23 +0300 Subject: [PATCH 383/523] Fix after review Signed-off-by: Andrei Baltariu --- esdt-safe/src/from_sovereign/transfer_tokens.rs | 6 +++--- esdt-safe/src/to_sovereign/create_tx.rs | 3 --- 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/esdt-safe/src/from_sovereign/transfer_tokens.rs b/esdt-safe/src/from_sovereign/transfer_tokens.rs index 80b11ad8..9b63105b 100644 --- a/esdt-safe/src/from_sovereign/transfer_tokens.rs +++ b/esdt-safe/src/from_sovereign/transfer_tokens.rs @@ -162,7 +162,7 @@ pub trait TransferTokensModule: .gas(transfer_data.gas_limit) .callback( ::callbacks(self) - .distribute_payments_callback(hash_of_hashes, operation_tuple), + .execute(hash_of_hashes, operation_tuple), ) .gas_for_callback(CALLBACK_GAS) .register_promise(); @@ -179,7 +179,7 @@ pub trait TransferTokensModule: .gas(TRANSACTION_GAS) .callback( ::callbacks(self) - .distribute_payments_callback(hash_of_hashes, operation_tuple), + .execute(hash_of_hashes, operation_tuple), ) .register_promise(); } @@ -201,7 +201,7 @@ pub trait TransferTokensModule: } #[promises_callback] - fn distribute_payments_callback( + fn execute( &self, hash_of_hashes: &ManagedBuffer, operation_tuple: &OperationTuple, diff --git a/esdt-safe/src/to_sovereign/create_tx.rs b/esdt-safe/src/to_sovereign/create_tx.rs index 6ccd32e0..849616c6 100644 --- a/esdt-safe/src/to_sovereign/create_tx.rs +++ b/esdt-safe/src/to_sovereign/create_tx.rs @@ -66,7 +66,6 @@ pub trait CreateTxModule: current_token_data.amount = payment.amount.clone(); let is_sovereign_chain = self.is_sovereign_chain().get(); - if is_sovereign_chain { self.tx() .to(ToSelf) @@ -79,7 +78,6 @@ pub trait CreateTxModule: payment.token_nonce, current_token_data.clone(), )); - event_payments.push(event_payment); } else { let sov_token_id = self @@ -90,7 +88,6 @@ pub trait CreateTxModule: let event_payment: EventPaymentTuple = MultiValue3((sov_token_id, sov_token_nonce, current_token_data.clone())); - event_payments.push(event_payment); } } From 64ad0754af1e612387c4b5770f294a9b002fe587 Mon Sep 17 00:00:00 2001 From: Andrei Baltariu Date: Thu, 10 Oct 2024 17:47:28 +0300 Subject: [PATCH 384/523] Build contracts Signed-off-by: Andrei Baltariu --- esdt-safe/wasm-esdt-safe-full/src/lib.rs | 2 +- esdt-safe/wasm/src/lib.rs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/esdt-safe/wasm-esdt-safe-full/src/lib.rs b/esdt-safe/wasm-esdt-safe-full/src/lib.rs index e7e5da9f..b1f50331 100644 --- a/esdt-safe/wasm-esdt-safe-full/src/lib.rs +++ b/esdt-safe/wasm-esdt-safe-full/src/lib.rs @@ -49,7 +49,7 @@ multiversx_sc_wasm_adapter::endpoints! { pause => pause_endpoint unpause => unpause_endpoint isPaused => paused_status - distribute_payments_callback => distribute_payments_callback + execute => execute ) } diff --git a/esdt-safe/wasm/src/lib.rs b/esdt-safe/wasm/src/lib.rs index e7e5da9f..b1f50331 100644 --- a/esdt-safe/wasm/src/lib.rs +++ b/esdt-safe/wasm/src/lib.rs @@ -49,7 +49,7 @@ multiversx_sc_wasm_adapter::endpoints! { pause => pause_endpoint unpause => unpause_endpoint isPaused => paused_status - distribute_payments_callback => distribute_payments_callback + execute => execute ) } From 2ea60b2b058341917fea02fc06991b5dbacf1353 Mon Sep 17 00:00:00 2001 From: Andrei Baltariu Date: Fri, 11 Oct 2024 10:56:41 +0300 Subject: [PATCH 385/523] Added require for token prefix Signed-off-by: Andrei Baltariu --- common/utils/src/lib.rs | 4 ++++ esdt-safe/src/from_sovereign/token_mapping.rs | 5 ++++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/common/utils/src/lib.rs b/common/utils/src/lib.rs index 41808895..6d5081e7 100644 --- a/common/utils/src/lib.rs +++ b/common/utils/src/lib.rs @@ -80,6 +80,10 @@ pub trait UtilsModule { false } + fn require_token_has_prefix(&self, token_id: &TokenIdentifier) { + require!(self.has_prefix(token_id), "Token Id does not have prefix"); + } + fn has_sov_prefix(&self, token_id: &TokenIdentifier, chain_prefix: &ManagedBuffer) -> bool { if !self.has_prefix(token_id) { return false; diff --git a/esdt-safe/src/from_sovereign/token_mapping.rs b/esdt-safe/src/from_sovereign/token_mapping.rs index 6e8e592f..64e8e9a5 100644 --- a/esdt-safe/src/from_sovereign/token_mapping.rs +++ b/esdt-safe/src/from_sovereign/token_mapping.rs @@ -1,3 +1,5 @@ +use utils::UtilsModule; + multiversx_sc::imports!(); multiversx_sc::derive_imports!(); @@ -27,7 +29,7 @@ struct NonFungibleTokenArgs { } #[multiversx_sc::module] -pub trait TokenMappingModule { +pub trait TokenMappingModule: utils::UtilsModule { #[payable("EGLD")] #[endpoint(registerToken)] fn register_token( @@ -38,6 +40,7 @@ pub trait TokenMappingModule { token_ticker: ManagedBuffer, num_decimals: usize, ) { + self.require_token_has_prefix(&sov_token_id); let is_sovereign_chain = self.is_sovereign_chain().get(); require!( !is_sovereign_chain, From 9c8143cc75b9093d7fe0f3181891e67fc2721965 Mon Sep 17 00:00:00 2001 From: Andrei Baltariu Date: Fri, 11 Oct 2024 11:01:19 +0300 Subject: [PATCH 386/523] Standardized struct and issue handle function Signed-off-by: Andrei Baltariu --- esdt-safe/src/from_sovereign/token_mapping.rs | 52 ++----------------- 1 file changed, 4 insertions(+), 48 deletions(-) diff --git a/esdt-safe/src/from_sovereign/token_mapping.rs b/esdt-safe/src/from_sovereign/token_mapping.rs index 64e8e9a5..faa856d9 100644 --- a/esdt-safe/src/from_sovereign/token_mapping.rs +++ b/esdt-safe/src/from_sovereign/token_mapping.rs @@ -1,5 +1,3 @@ -use utils::UtilsModule; - multiversx_sc::imports!(); multiversx_sc::derive_imports!(); @@ -11,15 +9,7 @@ pub struct EsdtTokenInfo { pub token_nonce: u64, } -struct FungibleTokenArgs { - sov_token_id: TokenIdentifier, - issue_cost: BigUint, - token_display_name: ManagedBuffer, - token_ticker: ManagedBuffer, - num_decimals: usize, -} - -struct NonFungibleTokenArgs { +struct IssueEsdtArgs { sov_token_id: TokenIdentifier, token_type: EsdtTokenType, issue_cost: BigUint, @@ -55,46 +45,18 @@ pub trait TokenMappingModule: utils::UtilsModule { match token_type { EsdtTokenType::Invalid => sc_panic!("Invalid type"), - EsdtTokenType::Fungible => self.handle_fungible_token_type(FungibleTokenArgs { + _ => self.handle_token_issue(IssueEsdtArgs { sov_token_id: sov_token_id.clone(), issue_cost, token_display_name, token_ticker, + token_type, num_decimals, }), - EsdtTokenType::NonFungible => { - self.handle_nonfungible_token_type(NonFungibleTokenArgs { - sov_token_id, - token_type, - issue_cost, - token_display_name, - token_ticker, - num_decimals, - }) - } - _ => {} } } - fn handle_fungible_token_type(&self, args: FungibleTokenArgs) { - self.tx() - .to(ToCaller) - .typed(ESDTSystemSCProxy) - .issue_and_set_all_roles( - args.issue_cost, - args.token_display_name, - args.token_ticker, - EsdtTokenType::Fungible, - args.num_decimals, - ) - .gas(self.blockchain().get_gas_left()) - .callback( - ::callbacks(self).issue_callback(&args.sov_token_id), - ) - .register_promise(); - } - - fn handle_nonfungible_token_type(&self, args: NonFungibleTokenArgs) { + fn handle_token_issue(&self, args: IssueEsdtArgs) { self.tx() .to(ToCaller) .typed(ESDTSystemSCProxy) @@ -152,12 +114,6 @@ pub trait TokenMappingModule: utils::UtilsModule { mx_token_id: &TokenIdentifier, ) -> SingleValueMapper; - #[storage_mapper("sovToMxTokenId")] - fn fungible_token(&self, sov_token_id: &TokenIdentifier) -> FungibleTokenMapper; - - #[storage_mapper("sovToMxTokenId")] - fn non_fungible_token(&self, sov_token_id: &TokenIdentifier) -> NonFungibleTokenMapper; - #[storage_mapper("sovEsdtTokenInfoMapper")] fn sovereign_esdt_token_info_mapper( &self, From 11b951bd6de9c29b5e973f5ca4fe90c70a8cb21d Mon Sep 17 00:00:00 2001 From: Andrei Baltariu Date: Fri, 11 Oct 2024 11:19:38 +0300 Subject: [PATCH 387/523] Modified mapper logic Signed-off-by: Andrei Baltariu --- esdt-safe/src/from_sovereign/token_mapping.rs | 22 +++---- .../src/from_sovereign/transfer_tokens.rs | 58 +++++++++---------- esdt-safe/src/to_sovereign/create_tx.rs | 6 +- esdt-safe/wasm-esdt-safe-full/src/lib.rs | 2 +- esdt-safe/wasm/src/lib.rs | 2 +- 5 files changed, 44 insertions(+), 46 deletions(-) diff --git a/esdt-safe/src/from_sovereign/token_mapping.rs b/esdt-safe/src/from_sovereign/token_mapping.rs index faa856d9..e9ae4aaa 100644 --- a/esdt-safe/src/from_sovereign/token_mapping.rs +++ b/esdt-safe/src/from_sovereign/token_mapping.rs @@ -4,7 +4,7 @@ multiversx_sc::derive_imports!(); const DEFAULT_ISSUE_COST: u64 = 50_000_000_000_000_000; // 0.05 EGLD #[derive(TopEncode, TopDecode, NestedEncode, NestedDecode, TypeAbi, ManagedVecItem, Clone)] -pub struct EsdtTokenInfo { +pub struct EsdtInfo { pub token_identifier: TokenIdentifier, pub token_nonce: u64, } @@ -95,38 +95,38 @@ pub trait TokenMappingModule: utils::UtilsModule { sov_token_id: &TokenIdentifier, mvx_token_id: &TokenIdentifier, ) { - self.sovereign_to_multiversx_token_id(sov_token_id) - .set(TokenMapperState::Token(mvx_token_id.clone())); + self.sovereign_to_multiversx_token_id_mapper(sov_token_id) + .set(mvx_token_id); - self.multiversx_to_sovereign_token_id(mvx_token_id) + self.multiversx_to_sovereign_token_id_mapper(mvx_token_id) .set(sov_token_id); } #[storage_mapper("sovToMxTokenId")] - fn sovereign_to_multiversx_token_id( + fn sovereign_to_multiversx_token_id_mapper( &self, sov_token_id: &TokenIdentifier, - ) -> SingleValueMapper>; + ) -> SingleValueMapper; #[storage_mapper("mxToSovTokenId")] - fn multiversx_to_sovereign_token_id( + fn multiversx_to_sovereign_token_id_mapper( &self, mx_token_id: &TokenIdentifier, ) -> SingleValueMapper; #[storage_mapper("sovEsdtTokenInfoMapper")] - fn sovereign_esdt_token_info_mapper( + fn sovereign_esdt_token_esdt_mapper( &self, token_identifier: &TokenIdentifier, nonce: &u64, - ) -> SingleValueMapper>; + ) -> SingleValueMapper>; #[storage_mapper("mxEsdtTokenInfoMapper")] - fn multiversx_esdt_token_info_mapper( + fn multiversx_esdt_token_esdt_mapper( &self, token_identifier: &TokenIdentifier, nonce: &u64, - ) -> SingleValueMapper>; + ) -> SingleValueMapper>; #[storage_mapper("isSovereignChain")] fn is_sovereign_chain(&self) -> SingleValueMapper; diff --git a/esdt-safe/src/from_sovereign/transfer_tokens.rs b/esdt-safe/src/from_sovereign/transfer_tokens.rs index 9b63105b..d2e2c58b 100644 --- a/esdt-safe/src/from_sovereign/transfer_tokens.rs +++ b/esdt-safe/src/from_sovereign/transfer_tokens.rs @@ -5,7 +5,7 @@ use transaction::{GasLimit, Operation, OperationData, OperationEsdtPayment, Oper use crate::to_sovereign; -use super::token_mapping::EsdtTokenInfo; +use super::token_mapping::EsdtInfo; multiversx_sc::imports!(); @@ -56,30 +56,28 @@ pub trait TransferTokensModule: let mut output_payments = ManagedVec::new(); for operation_token in operation_tokens.iter() { - let mx_token_id_state = self - .sovereign_to_multiversx_token_id(&operation_token.token_identifier) - .get(); - - let mx_token_id = match mx_token_id_state { - // token is from sovereign -> continue and mint - TokenMapperState::Token(token_id) => token_id, - // token is from mainchain -> push token - _ => { - output_payments.push(operation_token.clone()); - - continue; - } - }; + let sov_to_mvx_token_id_mapper = + self.sovereign_to_multiversx_token_id_mapper(&operation_token.token_identifier); + + // token is from mainchain -> push token + if sov_to_mvx_token_id_mapper.is_empty() { + output_payments.push(operation_token.clone()); + + continue; + } + + // token is from sovereign -> continue and mint + let mvx_token_id = sov_to_mvx_token_id_mapper.get(); if operation_token.token_nonce == 0 { self.tx() .to(ToSelf) .typed(system_proxy::UserBuiltinProxy) - .esdt_local_mint(&mx_token_id, 0, &operation_token.token_data.amount) + .esdt_local_mint(&mvx_token_id, 0, &operation_token.token_data.amount) .transfer_execute(); output_payments.push(OperationEsdtPayment { - token_identifier: mx_token_id, + token_identifier: mvx_token_id, token_nonce: 0, token_data: operation_token.token_data, }); @@ -87,10 +85,10 @@ pub trait TransferTokensModule: continue; } - let nft_nonce = self.mint_and_save_token(&mx_token_id, &operation_token); + let nft_nonce = self.mint_and_save_token(&mvx_token_id, &operation_token); output_payments.push(OperationEsdtPayment { - token_identifier: mx_token_id, + token_identifier: mvx_token_id, token_nonce: nft_nonce, token_data: operation_token.token_data, }); @@ -122,17 +120,17 @@ pub trait TransferTokensModule: .sync_call(); // save token id and nonce - self.sovereign_esdt_token_info_mapper( + self.sovereign_esdt_token_esdt_mapper( &operation_token.token_identifier, &operation_token.token_nonce, ) - .set(EsdtTokenInfo { + .set(EsdtInfo { token_identifier: mx_token_id.clone(), token_nonce: nft_nonce, }); - self.multiversx_esdt_token_info_mapper(mx_token_id, &nft_nonce) - .set(EsdtTokenInfo { + self.multiversx_esdt_token_esdt_mapper(mx_token_id, &nft_nonce) + .set(EsdtInfo { token_identifier: operation_token.token_identifier.clone(), token_nonce: operation_token.token_nonce, }); @@ -234,30 +232,30 @@ pub trait TransferTokensModule: self.execute_bridge_operation_event(hash_of_hashes, &operation_tuple.op_hash); for operation_token in &operation_tuple.operation.tokens { - let mx_token_id_state = self - .sovereign_to_multiversx_token_id(&operation_token.token_identifier) - .get(); + let sov_to_mvx_token_id_mapper = + self.sovereign_to_multiversx_token_id_mapper(&operation_token.token_identifier); - if let TokenMapperState::Token(mx_token_id) = mx_token_id_state { + if !sov_to_mvx_token_id_mapper.is_empty() { + let mvx_token_id = sov_to_mvx_token_id_mapper.get(); let mut mx_token_nonce = 0; if operation_token.token_nonce > 0 { mx_token_nonce = self - .sovereign_esdt_token_info_mapper( + .sovereign_esdt_token_esdt_mapper( &operation_token.token_identifier, &operation_token.token_nonce, ) .take() .token_nonce; - self.multiversx_esdt_token_info_mapper(&mx_token_id, &mx_token_nonce); + self.multiversx_esdt_token_esdt_mapper(&mvx_token_id, &mx_token_nonce); } self.tx() .to(ToSelf) .typed(system_proxy::UserBuiltinProxy) .esdt_local_burn( - &mx_token_id, + &mvx_token_id, mx_token_nonce, &operation_token.token_data.amount, ) diff --git a/esdt-safe/src/to_sovereign/create_tx.rs b/esdt-safe/src/to_sovereign/create_tx.rs index a8653006..e2d0a726 100644 --- a/esdt-safe/src/to_sovereign/create_tx.rs +++ b/esdt-safe/src/to_sovereign/create_tx.rs @@ -81,7 +81,7 @@ pub trait CreateTxModule: event_payments.push(event_payment); } else { let sov_token_id = self - .multiversx_to_sovereign_token_id(&payment.token_identifier) + .multiversx_to_sovereign_token_id_mapper(&payment.token_identifier) .get(); if !sov_token_id.is_valid_esdt_identifier() { @@ -190,11 +190,11 @@ pub trait CreateTxModule: if payment.token_nonce > 0 { sov_token_nonce = self - .multiversx_esdt_token_info_mapper(&payment.token_identifier, &payment.token_nonce) + .multiversx_esdt_token_esdt_mapper(&payment.token_identifier, &payment.token_nonce) .take() .token_nonce; - self.sovereign_esdt_token_info_mapper(sov_token_id, &sov_token_nonce) + self.sovereign_esdt_token_esdt_mapper(sov_token_id, &sov_token_nonce) .take(); } diff --git a/esdt-safe/wasm-esdt-safe-full/src/lib.rs b/esdt-safe/wasm-esdt-safe-full/src/lib.rs index 533765a4..1ddc881c 100644 --- a/esdt-safe/wasm-esdt-safe-full/src/lib.rs +++ b/esdt-safe/wasm-esdt-safe-full/src/lib.rs @@ -50,7 +50,7 @@ multiversx_sc_wasm_adapter::endpoints! { unpause => unpause_endpoint isPaused => paused_status issue_callback => issue_callback - distribute_payments_callback => distribute_payments_callback + execute => execute ) } diff --git a/esdt-safe/wasm/src/lib.rs b/esdt-safe/wasm/src/lib.rs index 533765a4..1ddc881c 100644 --- a/esdt-safe/wasm/src/lib.rs +++ b/esdt-safe/wasm/src/lib.rs @@ -50,7 +50,7 @@ multiversx_sc_wasm_adapter::endpoints! { unpause => unpause_endpoint isPaused => paused_status issue_callback => issue_callback - distribute_payments_callback => distribute_payments_callback + execute => execute ) } From c1116c05f437e68a96b1f0076e819158836ac970 Mon Sep 17 00:00:00 2001 From: Andrei Baltariu Date: Fri, 11 Oct 2024 11:21:33 +0300 Subject: [PATCH 388/523] Added if mapper is empty instead of identifier validity check Signed-off-by: Andrei Baltariu --- esdt-safe/src/to_sovereign/create_tx.rs | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/esdt-safe/src/to_sovereign/create_tx.rs b/esdt-safe/src/to_sovereign/create_tx.rs index e2d0a726..c8482e4b 100644 --- a/esdt-safe/src/to_sovereign/create_tx.rs +++ b/esdt-safe/src/to_sovereign/create_tx.rs @@ -80,11 +80,10 @@ pub trait CreateTxModule: )); event_payments.push(event_payment); } else { - let sov_token_id = self - .multiversx_to_sovereign_token_id_mapper(&payment.token_identifier) - .get(); + let mvx_to_sov_token_id_mapper = + self.multiversx_to_sovereign_token_id_mapper(&payment.token_identifier); - if !sov_token_id.is_valid_esdt_identifier() { + if mvx_to_sov_token_id_mapper.is_empty() { let event_payment: EventPaymentTuple = MultiValue3(( payment.token_identifier.clone(), payment.token_nonce, @@ -95,6 +94,8 @@ pub trait CreateTxModule: continue; } + let sov_token_id = mvx_to_sov_token_id_mapper.get(); + let sov_token_nonce = self.burn_mainchain_token(payment, &sov_token_id); let event_payment: EventPaymentTuple = From 9738418a62683136d037bbeaf818cb87170d8449 Mon Sep 17 00:00:00 2001 From: Andrei Baltariu Date: Fri, 11 Oct 2024 11:25:02 +0300 Subject: [PATCH 389/523] Added EsdtSystemSCAddress Signed-off-by: Andrei Baltariu --- esdt-safe/src/from_sovereign/token_mapping.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/esdt-safe/src/from_sovereign/token_mapping.rs b/esdt-safe/src/from_sovereign/token_mapping.rs index e9ae4aaa..428ef9c7 100644 --- a/esdt-safe/src/from_sovereign/token_mapping.rs +++ b/esdt-safe/src/from_sovereign/token_mapping.rs @@ -58,7 +58,7 @@ pub trait TokenMappingModule: utils::UtilsModule { fn handle_token_issue(&self, args: IssueEsdtArgs) { self.tx() - .to(ToCaller) + .to(ESDTSystemSCAddress) .typed(ESDTSystemSCProxy) .issue_and_set_all_roles( args.issue_cost, From e7c2af05be3354095edab20dd34e3ea271908eea Mon Sep 17 00:00:00 2001 From: Andrei Baltariu Date: Fri, 11 Oct 2024 11:29:47 +0300 Subject: [PATCH 390/523] Copied deposit logic from enshrine Signed-off-by: Andrei Baltariu --- .../src/to_sovereign/create_tx.rs | 8 +- esdt-safe/src/to_sovereign/create_tx.rs | 107 +++++++++--------- 2 files changed, 54 insertions(+), 61 deletions(-) diff --git a/enshrine-esdt-safe/src/to_sovereign/create_tx.rs b/enshrine-esdt-safe/src/to_sovereign/create_tx.rs index 80d7916a..ee41a008 100644 --- a/enshrine-esdt-safe/src/to_sovereign/create_tx.rs +++ b/enshrine-esdt-safe/src/to_sovereign/create_tx.rs @@ -1,6 +1,6 @@ use crate::common; use fee_market::fee_market_proxy; -use transaction::{GasLimit, OperationData, TransferData}; +use transaction::{GasLimit, OperationData, OptionalValueTransferDataTuple, TransferData}; use multiversx_sc::imports::*; @@ -24,9 +24,7 @@ pub trait CreateTxModule: fn deposit( &self, to: ManagedAddress, - opt_transfer_data: OptionalValue< - MultiValue3>, - >, + optional_transfer_data: OptionalValueTransferDataTuple, ) { require!(self.not_paused(), "Cannot create transaction while paused"); @@ -80,7 +78,7 @@ pub trait CreateTxModule: ); } - let option_transfer_data = TransferData::from_optional_value(opt_transfer_data); + let option_transfer_data = TransferData::from_optional_value(optional_transfer_data); if let Some(transfer_data) = option_transfer_data.as_ref() { self.require_gas_limit_under_limit(transfer_data.gas_limit); diff --git a/esdt-safe/src/to_sovereign/create_tx.rs b/esdt-safe/src/to_sovereign/create_tx.rs index c8482e4b..84ecbf65 100644 --- a/esdt-safe/src/to_sovereign/create_tx.rs +++ b/esdt-safe/src/to_sovereign/create_tx.rs @@ -2,8 +2,7 @@ use crate::from_sovereign::token_mapping; use fee_market::fee_market_proxy; use multiversx_sc::storage::StorageKey; use transaction::{ - EventPaymentTuple, ExtractedFeeResult, GasLimit, OperationData, OptionalValueTransferDataTuple, - TransferData, + ExtractedFeeResult, GasLimit, OperationData, OptionalValueTransferDataTuple, TransferData, }; multiversx_sc::imports!(); @@ -32,24 +31,23 @@ pub trait CreateTxModule: require!(self.not_paused(), "Cannot create transaction while paused"); let (fees_payment, payments) = self.check_and_extract_fee().into_tuple(); - require!(!payments.is_empty(), "Nothing to transfer"); require!(payments.len() <= MAX_TRANSFERS_PER_TX, "Too many tokens"); - let opt_transfer_data = self.process_transfer_data(optional_transfer_data); - let own_sc_address = self.blockchain().get_sc_address(); let mut total_tokens_for_fees = 0usize; - let mut event_payments = - MultiValueEncoded::>::new(); - let mut refundable_payments = ManagedVec::>::new(); + let mut event_payments = MultiValueEncoded::new(); + let mut refundable_payments = ManagedVec::::new(); + + let own_sc_address = self.blockchain().get_sc_address(); + let is_sov_chain = self.is_sovereign_chain().get(); for payment in &payments { self.require_below_max_amount(&payment.token_identifier, &payment.amount); self.require_token_not_blacklisted(&payment.token_identifier); + let is_token_whitelist_empty = self.token_whitelist().is_empty(); + let is_token_whitelisted = self.token_whitelist().contains(&payment.token_identifier); - if !self.token_whitelist().is_empty() - && !self.token_whitelist().contains(&payment.token_identifier) - { + if !is_token_whitelist_empty && !is_token_whitelisted { refundable_payments.push(payment.clone()); continue; @@ -62,70 +60,43 @@ pub trait CreateTxModule: &payment.token_identifier, payment.token_nonce, ); - current_token_data.amount = payment.amount.clone(); - let is_sovereign_chain = self.is_sovereign_chain().get(); - if is_sovereign_chain { + if is_sov_chain || self.has_prefix(&payment.token_identifier) { self.tx() .to(ToSelf) .typed(ESDTSystemSCProxy) .burn(&payment.token_identifier, &payment.amount) .transfer_execute(); + } - let event_payment: EventPaymentTuple = MultiValue3(( - payment.token_identifier.clone(), + event_payments.push( + ( + payment.token_identifier, payment.token_nonce, - current_token_data.clone(), - )); - event_payments.push(event_payment); - } else { - let mvx_to_sov_token_id_mapper = - self.multiversx_to_sovereign_token_id_mapper(&payment.token_identifier); - - if mvx_to_sov_token_id_mapper.is_empty() { - let event_payment: EventPaymentTuple = MultiValue3(( - payment.token_identifier.clone(), - payment.token_nonce, - current_token_data.clone(), - )); - event_payments.push(event_payment); - - continue; - } - - let sov_token_id = mvx_to_sov_token_id_mapper.get(); - - let sov_token_nonce = self.burn_mainchain_token(payment, &sov_token_id); - - let event_payment: EventPaymentTuple = - MultiValue3((sov_token_id, sov_token_nonce, current_token_data.clone())); - - event_payments.push(event_payment); - } + current_token_data, + ) + .into(), + ); } - let caller = self.blockchain().get_caller(); + let option_transfer_data = TransferData::from_optional_value(optional_transfer_data); - self.match_fee_payment(total_tokens_for_fees, &fees_payment, &opt_transfer_data); + if let Some(transfer_data) = option_transfer_data.as_ref() { + self.require_gas_limit_under_limit(transfer_data.gas_limit); + self.require_endpoint_not_banned(&transfer_data.function); + } + self.match_fee_payment(total_tokens_for_fees, &fees_payment, &option_transfer_data); // refund refundable_tokens - for payment in &refundable_payments { - if payment.amount > 0 { - self.tx().to(&caller).payment(payment).transfer(); - } - } + let caller = self.blockchain().get_caller(); + self.refund_tokens(&caller, &refundable_payments); let tx_nonce = self.get_and_save_next_tx_id(); - self.deposit_event( &to, &event_payments, - OperationData { - op_nonce: tx_nonce, - op_sender: caller, - opt_transfer_data, - }, + OperationData::new(tx_nonce, caller, option_transfer_data), ); } @@ -151,6 +122,18 @@ pub trait CreateTxModule: MultiValue2::from((opt_transfer_data, payments)) } + fn refund_tokens( + &self, + caller: &ManagedAddress, + refundable_payments: &ManagedVec, + ) { + for payment in refundable_payments { + if payment.amount > 0 { + self.tx().to(caller).payment(&payment).transfer(); + } + } + } + fn process_transfer_data( &self, opt_transfer_data: OptionalValueTransferDataTuple, @@ -230,6 +213,18 @@ pub trait CreateTxModule: }; } + fn require_gas_limit_under_limit(&self, gas_limit: GasLimit) { + let max_gas_limit = self.max_user_tx_gas_limit().get(); + require!(gas_limit <= max_gas_limit, "Gas limit too high"); + } + + fn require_endpoint_not_banned(&self, function: &ManagedBuffer) { + require!( + !self.banned_endpoint_names().contains(function), + "Banned endpoint name" + ); + } + #[storage_mapper("feeMarketAddress")] fn fee_market_address(&self) -> SingleValueMapper; From 74a079bbf70a84cd92a2195f8b826e7a6191de67 Mon Sep 17 00:00:00 2001 From: Andrei Baltariu Date: Fri, 11 Oct 2024 11:31:20 +0300 Subject: [PATCH 391/523] Added external storage mapper Signed-off-by: Andrei Baltariu --- esdt-safe/src/from_sovereign/transfer_tokens.rs | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/esdt-safe/src/from_sovereign/transfer_tokens.rs b/esdt-safe/src/from_sovereign/transfer_tokens.rs index d2e2c58b..1bad64bc 100644 --- a/esdt-safe/src/from_sovereign/transfer_tokens.rs +++ b/esdt-safe/src/from_sovereign/transfer_tokens.rs @@ -287,11 +287,9 @@ pub trait TransferTokensModule: operation: &Operation, ) -> (ManagedBuffer, bool) { let mut serialized_data = ManagedBuffer::new(); - let mut storage_key = StorageKey::from("pendingHashes"); - storage_key.append_item(&hash_of_hashes); - + let header_verifier_address = self.header_verifier_address().get(); let pending_operations_mapper = - UnorderedSetMapper::new_from_address(self.header_verifier_address().get(), storage_key); + self.external_pending_hashes(header_verifier_address, hash_of_hashes); if let core::result::Result::Err(err) = operation.top_encode(&mut serialized_data) { sc_panic!("Transfer data encode error: {}", err.message_bytes()); @@ -299,7 +297,6 @@ pub trait TransferTokensModule: let sha256 = self.crypto().sha256(&serialized_data); let hash = sha256.as_managed_buffer().clone(); - if pending_operations_mapper.contains(&hash) { (hash, true) } else { @@ -312,4 +309,11 @@ pub trait TransferTokensModule: #[storage_mapper("headerVerifierAddress")] fn header_verifier_address(&self) -> SingleValueMapper; + + #[storage_mapper_from_address("pending_hashes")] + fn external_pending_hashes( + &self, + sc_address: ManagedAddress, + hash_of_hashes: &ManagedBuffer, + ) -> UnorderedSetMapper; } From 80a0a8bc7c6b075490e7cd0d1d3469d6bf10a823 Mon Sep 17 00:00:00 2001 From: Andrei Baltariu Date: Fri, 11 Oct 2024 11:31:56 +0300 Subject: [PATCH 392/523] Removed unused import Signed-off-by: Andrei Baltariu --- esdt-safe/src/from_sovereign/transfer_tokens.rs | 1 - 1 file changed, 1 deletion(-) diff --git a/esdt-safe/src/from_sovereign/transfer_tokens.rs b/esdt-safe/src/from_sovereign/transfer_tokens.rs index 1bad64bc..aca52345 100644 --- a/esdt-safe/src/from_sovereign/transfer_tokens.rs +++ b/esdt-safe/src/from_sovereign/transfer_tokens.rs @@ -1,6 +1,5 @@ use builtin_func_names::ESDT_MULTI_TRANSFER_FUNC_NAME; use header_verifier::header_verifier_proxy; -use multiversx_sc::storage::StorageKey; use transaction::{GasLimit, Operation, OperationData, OperationEsdtPayment, OperationTuple}; use crate::to_sovereign; From 2960ce4ff3953a4b370a40eb4e0de350560b98bb Mon Sep 17 00:00:00 2001 From: Andrei Baltariu Date: Fri, 11 Oct 2024 11:32:13 +0300 Subject: [PATCH 393/523] Regenerated proxy Signed-off-by: Andrei Baltariu --- enshrine-esdt-safe/src/enshrine_esdt_safe_proxy.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/enshrine-esdt-safe/src/enshrine_esdt_safe_proxy.rs b/enshrine-esdt-safe/src/enshrine_esdt_safe_proxy.rs index 3f984122..39250e47 100644 --- a/enshrine-esdt-safe/src/enshrine_esdt_safe_proxy.rs +++ b/enshrine-esdt-safe/src/enshrine_esdt_safe_proxy.rs @@ -152,12 +152,12 @@ where >( self, to: Arg0, - opt_transfer_data: Arg1, + optional_transfer_data: Arg1, ) -> TxTypedCall { self.wrapped_tx .raw_call("deposit") .argument(&to) - .argument(&opt_transfer_data) + .argument(&optional_transfer_data) .original_result() } From 585557051e9f036645a507bf78edc3b8e8f84314 Mon Sep 17 00:00:00 2001 From: Andrei Baltariu Date: Fri, 11 Oct 2024 13:52:31 +0300 Subject: [PATCH 394/523] Renamed mappers Signed-off-by: Andrei Baltariu --- common/utils/src/lib.rs | 20 +------------------ esdt-safe/src/from_sovereign/token_mapping.rs | 9 +++++---- .../src/from_sovereign/transfer_tokens.rs | 8 ++++---- esdt-safe/src/to_sovereign/create_tx.rs | 7 +++++-- 4 files changed, 15 insertions(+), 29 deletions(-) diff --git a/common/utils/src/lib.rs b/common/utils/src/lib.rs index 6d5081e7..6700e77e 100644 --- a/common/utils/src/lib.rs +++ b/common/utils/src/lib.rs @@ -47,25 +47,6 @@ pub trait UtilsModule { first_payment } - // fn verify_items_signature( - // &self, - // opt_signature: Option>, - // items: MultiValueEncoded, - // ) -> ManagedVec { - // require!(opt_signature.is_some(), "Must provide signature"); - // - // let list = items.to_vec(); - // let signature = unsafe { opt_signature.unwrap_unchecked() }; - // let mut signature_data = ManagedBuffer::new(); - // for token in &list { - // let _ = token.dep_encode(&mut signature_data); - // } - // - // self.multi_verify_signature(&signature_data, &signature); - // - // list - // } - fn has_prefix(&self, token_id: &TokenIdentifier) -> bool { let buffer = token_id.as_managed_buffer(); let mut array_buffer = [0u8; MAX_TOKEN_ID_LEN]; @@ -80,6 +61,7 @@ pub trait UtilsModule { false } + #[inline] fn require_token_has_prefix(&self, token_id: &TokenIdentifier) { require!(self.has_prefix(token_id), "Token Id does not have prefix"); } diff --git a/esdt-safe/src/from_sovereign/token_mapping.rs b/esdt-safe/src/from_sovereign/token_mapping.rs index 428ef9c7..215bc935 100644 --- a/esdt-safe/src/from_sovereign/token_mapping.rs +++ b/esdt-safe/src/from_sovereign/token_mapping.rs @@ -2,6 +2,7 @@ multiversx_sc::imports!(); multiversx_sc::derive_imports!(); const DEFAULT_ISSUE_COST: u64 = 50_000_000_000_000_000; // 0.05 EGLD +const REGISTER_GAS: u64 = 60_000_000; #[derive(TopEncode, TopDecode, NestedEncode, NestedDecode, TypeAbi, ManagedVecItem, Clone)] pub struct EsdtInfo { @@ -30,12 +31,12 @@ pub trait TokenMappingModule: utils::UtilsModule { token_ticker: ManagedBuffer, num_decimals: usize, ) { - self.require_token_has_prefix(&sov_token_id); let is_sovereign_chain = self.is_sovereign_chain().get(); require!( !is_sovereign_chain, "Invalid method to call in current chain" ); + self.require_token_has_prefix(&sov_token_id); let issue_cost = self.call_value().egld_value().clone_value(); require!( @@ -67,7 +68,7 @@ pub trait TokenMappingModule: utils::UtilsModule { args.token_type, args.num_decimals, ) - .gas(self.blockchain().get_gas_left()) + .gas(REGISTER_GAS) .callback( ::callbacks(self).issue_callback(&args.sov_token_id), ) @@ -115,14 +116,14 @@ pub trait TokenMappingModule: utils::UtilsModule { ) -> SingleValueMapper; #[storage_mapper("sovEsdtTokenInfoMapper")] - fn sovereign_esdt_token_esdt_mapper( + fn sovereign_to_multiversx_esdt_info_mapper( &self, token_identifier: &TokenIdentifier, nonce: &u64, ) -> SingleValueMapper>; #[storage_mapper("mxEsdtTokenInfoMapper")] - fn multiversx_esdt_token_esdt_mapper( + fn multiversx_to_sovereign_esdt_info_mapper( &self, token_identifier: &TokenIdentifier, nonce: &u64, diff --git a/esdt-safe/src/from_sovereign/transfer_tokens.rs b/esdt-safe/src/from_sovereign/transfer_tokens.rs index aca52345..f50fe1d7 100644 --- a/esdt-safe/src/from_sovereign/transfer_tokens.rs +++ b/esdt-safe/src/from_sovereign/transfer_tokens.rs @@ -119,7 +119,7 @@ pub trait TransferTokensModule: .sync_call(); // save token id and nonce - self.sovereign_esdt_token_esdt_mapper( + self.sovereign_to_multiversx_esdt_info_mapper( &operation_token.token_identifier, &operation_token.token_nonce, ) @@ -128,7 +128,7 @@ pub trait TransferTokensModule: token_nonce: nft_nonce, }); - self.multiversx_esdt_token_esdt_mapper(mx_token_id, &nft_nonce) + self.multiversx_to_sovereign_esdt_info_mapper(mx_token_id, &nft_nonce) .set(EsdtInfo { token_identifier: operation_token.token_identifier.clone(), token_nonce: operation_token.token_nonce, @@ -240,14 +240,14 @@ pub trait TransferTokensModule: if operation_token.token_nonce > 0 { mx_token_nonce = self - .sovereign_esdt_token_esdt_mapper( + .sovereign_to_multiversx_esdt_info_mapper( &operation_token.token_identifier, &operation_token.token_nonce, ) .take() .token_nonce; - self.multiversx_esdt_token_esdt_mapper(&mvx_token_id, &mx_token_nonce); + self.multiversx_to_sovereign_esdt_info_mapper(&mvx_token_id, &mx_token_nonce); } self.tx() diff --git a/esdt-safe/src/to_sovereign/create_tx.rs b/esdt-safe/src/to_sovereign/create_tx.rs index 84ecbf65..b6f02720 100644 --- a/esdt-safe/src/to_sovereign/create_tx.rs +++ b/esdt-safe/src/to_sovereign/create_tx.rs @@ -174,11 +174,14 @@ pub trait CreateTxModule: if payment.token_nonce > 0 { sov_token_nonce = self - .multiversx_esdt_token_esdt_mapper(&payment.token_identifier, &payment.token_nonce) + .multiversx_to_sovereign_esdt_info_mapper( + &payment.token_identifier, + &payment.token_nonce, + ) .take() .token_nonce; - self.sovereign_esdt_token_esdt_mapper(sov_token_id, &sov_token_nonce) + self.sovereign_to_multiversx_esdt_info_mapper(sov_token_id, &sov_token_nonce) .take(); } From b8d6bb4ce52d5b23d25612a767bffdf8daa865c5 Mon Sep 17 00:00:00 2001 From: Andrei Baltariu Date: Fri, 11 Oct 2024 13:57:48 +0300 Subject: [PATCH 395/523] Modified burn logic in esdt safe Signed-off-by: Andrei Baltariu --- esdt-safe/src/to_sovereign/create_tx.rs | 27 ++++++++++++++++--------- 1 file changed, 17 insertions(+), 10 deletions(-) diff --git a/esdt-safe/src/to_sovereign/create_tx.rs b/esdt-safe/src/to_sovereign/create_tx.rs index b6f02720..023adefe 100644 --- a/esdt-safe/src/to_sovereign/create_tx.rs +++ b/esdt-safe/src/to_sovereign/create_tx.rs @@ -61,23 +61,30 @@ pub trait CreateTxModule: payment.token_nonce, ); current_token_data.amount = payment.amount.clone(); + let mvx_to_sov_token_id_mapper = + self.multiversx_to_sovereign_token_id_mapper(&payment.token_identifier); - if is_sov_chain || self.has_prefix(&payment.token_identifier) { + if is_sov_chain || mvx_to_sov_token_id_mapper.is_empty() { self.tx() .to(ToSelf) .typed(ESDTSystemSCProxy) .burn(&payment.token_identifier, &payment.amount) .transfer_execute(); - } - event_payments.push( - ( - payment.token_identifier, - payment.token_nonce, - current_token_data, - ) - .into(), - ); + event_payments.push( + ( + payment.token_identifier, + payment.token_nonce, + current_token_data, + ) + .into(), + ); + } else { + let sov_token_id = mvx_to_sov_token_id_mapper.get(); + let sov_token_nonce = self.burn_mainchain_token(payment, &sov_token_id); + + event_payments.push((sov_token_id, sov_token_nonce, current_token_data).into()); + } } let option_transfer_data = TransferData::from_optional_value(optional_transfer_data); From 2bc113076541f705e2b54bc46039be52a0d7c057 Mon Sep 17 00:00:00 2001 From: Andrei Baltariu Date: Fri, 11 Oct 2024 13:58:19 +0300 Subject: [PATCH 396/523] Removed unused function Signed-off-by: Andrei Baltariu --- esdt-safe/src/to_sovereign/create_tx.rs | 27 +------------------------ 1 file changed, 1 insertion(+), 26 deletions(-) diff --git a/esdt-safe/src/to_sovereign/create_tx.rs b/esdt-safe/src/to_sovereign/create_tx.rs index 023adefe..e9f88e42 100644 --- a/esdt-safe/src/to_sovereign/create_tx.rs +++ b/esdt-safe/src/to_sovereign/create_tx.rs @@ -61,6 +61,7 @@ pub trait CreateTxModule: payment.token_nonce, ); current_token_data.amount = payment.amount.clone(); + let mvx_to_sov_token_id_mapper = self.multiversx_to_sovereign_token_id_mapper(&payment.token_identifier); @@ -141,32 +142,6 @@ pub trait CreateTxModule: } } - fn process_transfer_data( - &self, - opt_transfer_data: OptionalValueTransferDataTuple, - ) -> Option> { - match &opt_transfer_data { - OptionalValue::Some(transfer_data) => { - let (gas_limit, function, args) = transfer_data.clone().into_tuple(); - let max_gas_limit = self.max_user_tx_gas_limit().get(); - - require!(gas_limit <= max_gas_limit, "Gas limit too high"); - - require!( - !self.banned_endpoint_names().contains(&function), - "Banned endpoint name" - ); - - Some(TransferData { - gas_limit, - function, - args, - }) - } - OptionalValue::None => None, - } - } - fn burn_mainchain_token( &self, payment: EsdtTokenPayment, From 8b5fd46134dcd24b1ffacf6b94397a36b2b46aed Mon Sep 17 00:00:00 2001 From: Andrei Baltariu Date: Fri, 11 Oct 2024 13:58:50 +0300 Subject: [PATCH 397/523] Added `take()` Signed-off-by: Andrei Baltariu --- esdt-safe/src/from_sovereign/transfer_tokens.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/esdt-safe/src/from_sovereign/transfer_tokens.rs b/esdt-safe/src/from_sovereign/transfer_tokens.rs index f50fe1d7..2bc07525 100644 --- a/esdt-safe/src/from_sovereign/transfer_tokens.rs +++ b/esdt-safe/src/from_sovereign/transfer_tokens.rs @@ -247,7 +247,8 @@ pub trait TransferTokensModule: .take() .token_nonce; - self.multiversx_to_sovereign_esdt_info_mapper(&mvx_token_id, &mx_token_nonce); + self.multiversx_to_sovereign_esdt_info_mapper(&mvx_token_id, &mx_token_nonce) + .take(); } self.tx() From 4dd7485572ff7e2920cb5a7198a216b0569c1322 Mon Sep 17 00:00:00 2001 From: Andrei Baltariu Date: Fri, 11 Oct 2024 14:00:10 +0300 Subject: [PATCH 398/523] Used camel case for storage mapper alias Signed-off-by: Andrei Baltariu --- enshrine-esdt-safe/src/from_sovereign/transfer_tokens.rs | 2 +- esdt-safe/src/from_sovereign/transfer_tokens.rs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/enshrine-esdt-safe/src/from_sovereign/transfer_tokens.rs b/enshrine-esdt-safe/src/from_sovereign/transfer_tokens.rs index d02956fc..f75ee5f7 100644 --- a/enshrine-esdt-safe/src/from_sovereign/transfer_tokens.rs +++ b/enshrine-esdt-safe/src/from_sovereign/transfer_tokens.rs @@ -207,7 +207,7 @@ pub trait TransferTokensModule: #[storage_mapper("paidIssuedTokens")] fn paid_issued_tokens(&self) -> UnorderedSetMapper>; - #[storage_mapper_from_address("pending_hashes")] + #[storage_mapper_from_address("pendingHashes")] fn external_pending_hashes( &self, sc_address: ManagedAddress, diff --git a/esdt-safe/src/from_sovereign/transfer_tokens.rs b/esdt-safe/src/from_sovereign/transfer_tokens.rs index 2bc07525..03543331 100644 --- a/esdt-safe/src/from_sovereign/transfer_tokens.rs +++ b/esdt-safe/src/from_sovereign/transfer_tokens.rs @@ -310,7 +310,7 @@ pub trait TransferTokensModule: #[storage_mapper("headerVerifierAddress")] fn header_verifier_address(&self) -> SingleValueMapper; - #[storage_mapper_from_address("pending_hashes")] + #[storage_mapper_from_address("pendingHashes")] fn external_pending_hashes( &self, sc_address: ManagedAddress, From b6c8c9d79d733c14bf695a178885754b0cc8108b Mon Sep 17 00:00:00 2001 From: Andrei Baltariu Date: Fri, 11 Oct 2024 14:08:19 +0300 Subject: [PATCH 399/523] Added function to update esdt_info_mappers Signed-off-by: Andrei Baltariu --- esdt-safe/src/from_sovereign/token_mapping.rs | 4 +- .../src/from_sovereign/transfer_tokens.rs | 48 ++++++++++++------- 2 files changed, 32 insertions(+), 20 deletions(-) diff --git a/esdt-safe/src/from_sovereign/token_mapping.rs b/esdt-safe/src/from_sovereign/token_mapping.rs index 215bc935..87b59634 100644 --- a/esdt-safe/src/from_sovereign/token_mapping.rs +++ b/esdt-safe/src/from_sovereign/token_mapping.rs @@ -119,14 +119,14 @@ pub trait TokenMappingModule: utils::UtilsModule { fn sovereign_to_multiversx_esdt_info_mapper( &self, token_identifier: &TokenIdentifier, - nonce: &u64, + nonce: u64, ) -> SingleValueMapper>; #[storage_mapper("mxEsdtTokenInfoMapper")] fn multiversx_to_sovereign_esdt_info_mapper( &self, token_identifier: &TokenIdentifier, - nonce: &u64, + nonce: u64, ) -> SingleValueMapper>; #[storage_mapper("isSovereignChain")] diff --git a/esdt-safe/src/from_sovereign/transfer_tokens.rs b/esdt-safe/src/from_sovereign/transfer_tokens.rs index 03543331..238c4513 100644 --- a/esdt-safe/src/from_sovereign/transfer_tokens.rs +++ b/esdt-safe/src/from_sovereign/transfer_tokens.rs @@ -84,7 +84,7 @@ pub trait TransferTokensModule: continue; } - let nft_nonce = self.mint_and_save_token(&mvx_token_id, &operation_token); + let nft_nonce = self.esdt_create_and_update_mapper(&mvx_token_id, &operation_token); output_payments.push(OperationEsdtPayment { token_identifier: mvx_token_id, @@ -96,9 +96,9 @@ pub trait TransferTokensModule: output_payments } - fn mint_and_save_token( + fn esdt_create_and_update_mapper( self, - mx_token_id: &TokenIdentifier, + mvx_token_id: &TokenIdentifier, operation_token: &OperationEsdtPayment, ) -> u64 { // mint NFT @@ -107,7 +107,7 @@ pub trait TransferTokensModule: .to(ToSelf) .typed(system_proxy::UserBuiltinProxy) .esdt_nft_create( - mx_token_id, + mvx_token_id, &operation_token.token_data.amount, &operation_token.token_data.name, &operation_token.token_data.royalties, @@ -119,22 +119,34 @@ pub trait TransferTokensModule: .sync_call(); // save token id and nonce - self.sovereign_to_multiversx_esdt_info_mapper( + self.update_esdt_info_mappers( &operation_token.token_identifier, - &operation_token.token_nonce, - ) - .set(EsdtInfo { - token_identifier: mx_token_id.clone(), - token_nonce: nft_nonce, - }); - - self.multiversx_to_sovereign_esdt_info_mapper(mx_token_id, &nft_nonce) + operation_token.token_nonce, + mvx_token_id, + nft_nonce, + ); + + nft_nonce + } + + fn update_esdt_info_mappers( + &self, + sov_id: &TokenIdentifier, + sov_nonce: u64, + mvx_id: &TokenIdentifier, + new_nft_nonce: u64, + ) { + self.sovereign_to_multiversx_esdt_info_mapper(sov_id, sov_nonce) .set(EsdtInfo { - token_identifier: operation_token.token_identifier.clone(), - token_nonce: operation_token.token_nonce, + token_identifier: mvx_id.clone(), + token_nonce: new_nft_nonce, }); - nft_nonce + self.multiversx_to_sovereign_esdt_info_mapper(mvx_id, new_nft_nonce) + .set(EsdtInfo { + token_identifier: sov_id.clone(), + token_nonce: sov_nonce, + }); } // TODO: create a callback module @@ -242,12 +254,12 @@ pub trait TransferTokensModule: mx_token_nonce = self .sovereign_to_multiversx_esdt_info_mapper( &operation_token.token_identifier, - &operation_token.token_nonce, + operation_token.token_nonce, ) .take() .token_nonce; - self.multiversx_to_sovereign_esdt_info_mapper(&mvx_token_id, &mx_token_nonce) + self.multiversx_to_sovereign_esdt_info_mapper(&mvx_token_id, mx_token_nonce) .take(); } From e03393b30dcea88002241872e971858cc8305b90 Mon Sep 17 00:00:00 2001 From: Andrei Baltariu Date: Fri, 11 Oct 2024 14:09:11 +0300 Subject: [PATCH 400/523] Fixed build error Signed-off-by: Andrei Baltariu --- esdt-safe/src/to_sovereign/create_tx.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/esdt-safe/src/to_sovereign/create_tx.rs b/esdt-safe/src/to_sovereign/create_tx.rs index e9f88e42..3b2746ad 100644 --- a/esdt-safe/src/to_sovereign/create_tx.rs +++ b/esdt-safe/src/to_sovereign/create_tx.rs @@ -158,12 +158,12 @@ pub trait CreateTxModule: sov_token_nonce = self .multiversx_to_sovereign_esdt_info_mapper( &payment.token_identifier, - &payment.token_nonce, + payment.token_nonce, ) .take() .token_nonce; - self.sovereign_to_multiversx_esdt_info_mapper(sov_token_id, &sov_token_nonce) + self.sovereign_to_multiversx_esdt_info_mapper(sov_token_id, sov_token_nonce) .take(); } From 77115bb37400816035e3a55169d67b650e432b9b Mon Sep 17 00:00:00 2001 From: Andrei Baltariu Date: Fri, 11 Oct 2024 14:14:38 +0300 Subject: [PATCH 401/523] Moved update mapper function to token_mappings module Signed-off-by: Andrei Baltariu --- esdt-safe/src/from_sovereign/token_mapping.rs | 20 +++++++++++++++++++ .../src/from_sovereign/transfer_tokens.rs | 20 ------------------- 2 files changed, 20 insertions(+), 20 deletions(-) diff --git a/esdt-safe/src/from_sovereign/token_mapping.rs b/esdt-safe/src/from_sovereign/token_mapping.rs index 87b59634..f27234f3 100644 --- a/esdt-safe/src/from_sovereign/token_mapping.rs +++ b/esdt-safe/src/from_sovereign/token_mapping.rs @@ -103,6 +103,26 @@ pub trait TokenMappingModule: utils::UtilsModule { .set(sov_token_id); } + fn update_esdt_info_mappers( + &self, + sov_id: &TokenIdentifier, + sov_nonce: u64, + mvx_id: &TokenIdentifier, + new_nft_nonce: u64, + ) { + self.sovereign_to_multiversx_esdt_info_mapper(sov_id, sov_nonce) + .set(EsdtInfo { + token_identifier: mvx_id.clone(), + token_nonce: new_nft_nonce, + }); + + self.multiversx_to_sovereign_esdt_info_mapper(mvx_id, new_nft_nonce) + .set(EsdtInfo { + token_identifier: sov_id.clone(), + token_nonce: sov_nonce, + }); + } + #[storage_mapper("sovToMxTokenId")] fn sovereign_to_multiversx_token_id_mapper( &self, diff --git a/esdt-safe/src/from_sovereign/transfer_tokens.rs b/esdt-safe/src/from_sovereign/transfer_tokens.rs index 238c4513..4428a08f 100644 --- a/esdt-safe/src/from_sovereign/transfer_tokens.rs +++ b/esdt-safe/src/from_sovereign/transfer_tokens.rs @@ -129,26 +129,6 @@ pub trait TransferTokensModule: nft_nonce } - fn update_esdt_info_mappers( - &self, - sov_id: &TokenIdentifier, - sov_nonce: u64, - mvx_id: &TokenIdentifier, - new_nft_nonce: u64, - ) { - self.sovereign_to_multiversx_esdt_info_mapper(sov_id, sov_nonce) - .set(EsdtInfo { - token_identifier: mvx_id.clone(), - token_nonce: new_nft_nonce, - }); - - self.multiversx_to_sovereign_esdt_info_mapper(mvx_id, new_nft_nonce) - .set(EsdtInfo { - token_identifier: sov_id.clone(), - token_nonce: sov_nonce, - }); - } - // TODO: create a callback module fn distribute_payments( &self, From 91bd7304b79dcd48074c6df7b70e36fae09c49b1 Mon Sep 17 00:00:00 2001 From: Andrei Baltariu Date: Fri, 11 Oct 2024 14:16:07 +0300 Subject: [PATCH 402/523] Removed unused import Signed-off-by: Andrei Baltariu --- esdt-safe/src/from_sovereign/transfer_tokens.rs | 2 -- esdt-safe/wasm-esdt-safe-full/src/lib.rs | 1 + esdt-safe/wasm/src/lib.rs | 1 + 3 files changed, 2 insertions(+), 2 deletions(-) diff --git a/esdt-safe/src/from_sovereign/transfer_tokens.rs b/esdt-safe/src/from_sovereign/transfer_tokens.rs index 4428a08f..43db0c91 100644 --- a/esdt-safe/src/from_sovereign/transfer_tokens.rs +++ b/esdt-safe/src/from_sovereign/transfer_tokens.rs @@ -4,8 +4,6 @@ use transaction::{GasLimit, Operation, OperationData, OperationEsdtPayment, Oper use crate::to_sovereign; -use super::token_mapping::EsdtInfo; - multiversx_sc::imports!(); const CALLBACK_GAS: GasLimit = 10_000_000; // Increase if not enough diff --git a/esdt-safe/wasm-esdt-safe-full/src/lib.rs b/esdt-safe/wasm-esdt-safe-full/src/lib.rs index 9e18554b..1ddc881c 100644 --- a/esdt-safe/wasm-esdt-safe-full/src/lib.rs +++ b/esdt-safe/wasm-esdt-safe-full/src/lib.rs @@ -49,6 +49,7 @@ multiversx_sc_wasm_adapter::endpoints! { pause => pause_endpoint unpause => unpause_endpoint isPaused => paused_status + issue_callback => issue_callback execute => execute ) } diff --git a/esdt-safe/wasm/src/lib.rs b/esdt-safe/wasm/src/lib.rs index 9e18554b..1ddc881c 100644 --- a/esdt-safe/wasm/src/lib.rs +++ b/esdt-safe/wasm/src/lib.rs @@ -49,6 +49,7 @@ multiversx_sc_wasm_adapter::endpoints! { pause => pause_endpoint unpause => unpause_endpoint isPaused => paused_status + issue_callback => issue_callback execute => execute ) } From 56768c9268e054fe014d05146799f16e4504447c Mon Sep 17 00:00:00 2001 From: Andrei Baltariu Date: Fri, 11 Oct 2024 15:08:16 +0300 Subject: [PATCH 403/523] Added EventPayment traits + implementation Signed-off-by: Andrei Baltariu --- common/transaction/src/lib.rs | 37 +++++++++++++++++++ .../src/to_sovereign/create_tx.rs | 19 +++++----- esdt-safe/src/to_sovereign/create_tx.rs | 22 ++++++----- 3 files changed, 59 insertions(+), 19 deletions(-) diff --git a/common/transaction/src/lib.rs b/common/transaction/src/lib.rs index 29670c9a..93d5ceba 100644 --- a/common/transaction/src/lib.rs +++ b/common/transaction/src/lib.rs @@ -130,6 +130,43 @@ impl } } +#[derive(TopEncode, TopDecode, NestedEncode, NestedDecode, TypeAbi, ManagedVecItem, Clone)] +pub struct EventPayment { + pub identifier: TokenIdentifier, + pub nonce: u64, + pub data: EsdtTokenData, +} + +impl From> for EventPayment { + fn from(value: EventPaymentTuple) -> Self { + let (identifier, nonce, data) = value.into_tuple(); + + EventPayment::new(identifier, nonce, data) + } +} + +impl From> for EventPaymentTuple { + fn from(value: EventPayment) -> EventPaymentTuple { + MultiValue3((value.identifier, value.nonce, value.data)) + } +} + +impl EventPayment { + pub fn new(identifier: TokenIdentifier, nonce: u64, data: EsdtTokenData) -> Self { + EventPayment { + identifier, + nonce, + data, + } + } + + pub fn map_to_tuple_multi_value( + array: MultiValueEncoded, + ) -> MultiValueEncoded> { + array.into_iter().map(|payment| payment.into()).collect() + } +} + #[derive(TopEncode, TopDecode, NestedEncode, NestedDecode, TypeAbi, ManagedVecItem, Clone)] pub struct OperationTuple { pub op_hash: ManagedBuffer, diff --git a/enshrine-esdt-safe/src/to_sovereign/create_tx.rs b/enshrine-esdt-safe/src/to_sovereign/create_tx.rs index ee41a008..5ca85cdb 100644 --- a/enshrine-esdt-safe/src/to_sovereign/create_tx.rs +++ b/enshrine-esdt-safe/src/to_sovereign/create_tx.rs @@ -1,6 +1,8 @@ use crate::common; use fee_market::fee_market_proxy; -use transaction::{GasLimit, OperationData, OptionalValueTransferDataTuple, TransferData}; +use transaction::{ + EventPayment, GasLimit, OperationData, OptionalValueTransferDataTuple, TransferData, +}; use multiversx_sc::imports::*; @@ -68,14 +70,13 @@ pub trait CreateTxModule: .transfer_execute(); } - event_payments.push( - ( - payment.token_identifier, - payment.token_nonce, - current_token_data, - ) - .into(), + let event_payment = EventPayment::new( + payment.token_identifier, + payment.token_nonce, + current_token_data, ); + + event_payments.push(event_payment); } let option_transfer_data = TransferData::from_optional_value(optional_transfer_data); @@ -93,7 +94,7 @@ pub trait CreateTxModule: let tx_nonce = self.get_and_save_next_tx_id(); self.deposit_event( &to, - &event_payments, + &EventPayment::map_to_tuple_multi_value(event_payments), OperationData::new(tx_nonce, caller, option_transfer_data), ); } diff --git a/esdt-safe/src/to_sovereign/create_tx.rs b/esdt-safe/src/to_sovereign/create_tx.rs index 3b2746ad..038e06aa 100644 --- a/esdt-safe/src/to_sovereign/create_tx.rs +++ b/esdt-safe/src/to_sovereign/create_tx.rs @@ -2,7 +2,8 @@ use crate::from_sovereign::token_mapping; use fee_market::fee_market_proxy; use multiversx_sc::storage::StorageKey; use transaction::{ - ExtractedFeeResult, GasLimit, OperationData, OptionalValueTransferDataTuple, TransferData, + EventPayment, ExtractedFeeResult, GasLimit, OperationData, OptionalValueTransferDataTuple, + TransferData, }; multiversx_sc::imports!(); @@ -72,19 +73,20 @@ pub trait CreateTxModule: .burn(&payment.token_identifier, &payment.amount) .transfer_execute(); - event_payments.push( - ( - payment.token_identifier, - payment.token_nonce, - current_token_data, - ) - .into(), + let event_payment = EventPayment::new( + payment.token_identifier, + payment.token_nonce, + current_token_data, ); + + event_payments.push(event_payment); } else { let sov_token_id = mvx_to_sov_token_id_mapper.get(); let sov_token_nonce = self.burn_mainchain_token(payment, &sov_token_id); - event_payments.push((sov_token_id, sov_token_nonce, current_token_data).into()); + let event_payment = + EventPayment::new(sov_token_id, sov_token_nonce, current_token_data); + event_payments.push(event_payment); } } @@ -103,7 +105,7 @@ pub trait CreateTxModule: let tx_nonce = self.get_and_save_next_tx_id(); self.deposit_event( &to, - &event_payments, + &EventPayment::map_to_tuple_multi_value(event_payments), OperationData::new(tx_nonce, caller, option_transfer_data), ); } From ed2f9eb6482ff2f2a343bdcc28fe178b6a3b0f4c Mon Sep 17 00:00:00 2001 From: Andrei Baltariu Date: Fri, 11 Oct 2024 15:46:52 +0300 Subject: [PATCH 404/523] Added newline Signed-off-by: Andrei Baltariu --- esdt-safe/src/from_sovereign/token_mapping.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/esdt-safe/src/from_sovereign/token_mapping.rs b/esdt-safe/src/from_sovereign/token_mapping.rs index f27234f3..1f139899 100644 --- a/esdt-safe/src/from_sovereign/token_mapping.rs +++ b/esdt-safe/src/from_sovereign/token_mapping.rs @@ -36,6 +36,7 @@ pub trait TokenMappingModule: utils::UtilsModule { !is_sovereign_chain, "Invalid method to call in current chain" ); + self.require_token_has_prefix(&sov_token_id); let issue_cost = self.call_value().egld_value().clone_value(); From ba530dc31116d257b8256f1770b7e5bc9f6dd43a Mon Sep 17 00:00:00 2001 From: Andrei Baltariu Date: Fri, 11 Oct 2024 15:51:11 +0300 Subject: [PATCH 405/523] Removed old tests Signed-off-by: Andrei Baltariu --- esdt-safe/tests/bridge_setup/mod.rs | 107 ------- esdt-safe/tests/bridge_test.rs | 415 ---------------------------- 2 files changed, 522 deletions(-) delete mode 100644 esdt-safe/tests/bridge_setup/mod.rs delete mode 100644 esdt-safe/tests/bridge_test.rs diff --git a/esdt-safe/tests/bridge_setup/mod.rs b/esdt-safe/tests/bridge_setup/mod.rs deleted file mode 100644 index 413267e8..00000000 --- a/esdt-safe/tests/bridge_setup/mod.rs +++ /dev/null @@ -1,107 +0,0 @@ -// use bls_signature::BLS_SIGNATURE_LEN; -// use esdt_safe::EsdtSafe; -// use fee_market::{ -// fee_type::{FeeType, FeeTypeModule}, -// FeeMarket, -// }; -// use multiversx_sc::types::{Address, MultiValueEncoded}; -// use multiversx_sc_modules::pause::PauseModule; -// use multiversx_sc_scenario::{ -// managed_address, managed_biguint, managed_token_id, rust_biguint, -// testing_framework::{BlockchainStateWrapper, ContractObjWrapper}, -// DebugApi, -// }; -// use tx_batch_module::TxBatchModule; -// -// multiversx_sc::derive_imports!(); -// -// pub static FUNGIBLE_TOKEN_ID: &[u8] = b"FUNGTOKEN-123456"; -// pub static WEGLD_TOKEN_ID: &[u8] = b"WEGLD-123456"; -// pub static USDC_TOKEN_ID: &[u8] = b"USDC-123456"; -// pub static NFT_TOKEN_ID: &[u8] = b"NFT-123456"; -// pub const TOKEN_BALANCE: u64 = 1_000_000_000_000_000_000; -// pub static _DUMMY_SIG: [u8; BLS_SIGNATURE_LEN] = [0; BLS_SIGNATURE_LEN]; -// pub static FEE_TOKEN_ID: &[u8] = b"FEE-123456"; -// -// #[derive(TopEncode, TopDecode, PartialEq, Debug)] -// pub struct DummyAttributes { -// pub dummy: u8, -// } -// -// pub struct BridgeSetup -// where -// BridgeBuilder: 'static + Copy + Fn() -> esdt_safe::ContractObj, -// FeeMarketBuilder: 'static + Copy + Fn() -> fee_market::ContractObj, -// { -// pub b_mock: BlockchainStateWrapper, -// pub owner: Address, -// pub user: Address, -// pub sov_dest_addr: Address, -// pub bridge_wrapper: ContractObjWrapper, BridgeBuilder>, -// pub fee_market_wrapper: ContractObjWrapper, FeeMarketBuilder>, -// } -// -// impl BridgeSetup -// where -// BridgeBuilder: 'static + Copy + Fn() -> esdt_safe::ContractObj, -// FeeMarketBuilder: 'static + Copy + Fn() -> fee_market::ContractObj, -// { -// pub fn new(bridge_builder: BridgeBuilder, fee_market_builder: FeeMarketBuilder, is_sovereign_chain: bool) -> Self { -// let rust_zero = rust_biguint!(0); -// let mut b_mock = BlockchainStateWrapper::new(); -// let owner = b_mock.create_user_account(&rust_zero); -// let user = b_mock.create_user_account(&rust_zero); -// let sov_dest_addr = b_mock.create_user_account(&rust_zero); -// let bridge_wrapper = -// b_mock.create_sc_account(&rust_zero, Some(&owner), bridge_builder, "bridge"); -// let fee_market_wrapper = -// b_mock.create_sc_account(&rust_zero, Some(&owner), fee_market_builder, "fee_market"); -// -// b_mock.set_esdt_balance(&user, FUNGIBLE_TOKEN_ID, &rust_biguint!(TOKEN_BALANCE)); -// b_mock.set_esdt_balance(&user, FEE_TOKEN_ID, &rust_biguint!(TOKEN_BALANCE)); -// b_mock.set_nft_balance( -// &user, -// NFT_TOKEN_ID, -// 1, -// &rust_biguint!(TOKEN_BALANCE), -// &DummyAttributes { dummy: 42 }, -// ); -// -// b_mock -// .execute_tx(&owner, &bridge_wrapper, &rust_zero, |sc| { -// sc.init(is_sovereign_chain, 0, managed_address!(&owner), MultiValueEncoded::new()); -// sc.set_fee_market_address(managed_address!(fee_market_wrapper.address_ref())); -// sc.set_max_tx_batch_size(1); -// sc.set_paused(false); -// }) -// .assert_ok(); -// -// b_mock -// .execute_tx(&owner, &fee_market_wrapper, &rust_zero, |sc| { -// sc.init( -// managed_address!(bridge_wrapper.address_ref()), -// managed_address!(bridge_wrapper.address_ref()), // unused -// WEGLD_TOKEN_ID.into(), -// USDC_TOKEN_ID.into() -// ); -// sc.add_fee( -// managed_token_id!(FEE_TOKEN_ID), -// FeeType::Fixed { -// token: managed_token_id!(FEE_TOKEN_ID), -// per_transfer: managed_biguint!(100), -// per_gas: managed_biguint!(1), -// }, -// ) -// }) -// .assert_ok(); -// -// BridgeSetup { -// b_mock, -// owner, -// user, -// sov_dest_addr, -// bridge_wrapper, -// fee_market_wrapper, -// } -// } -// } diff --git a/esdt-safe/tests/bridge_test.rs b/esdt-safe/tests/bridge_test.rs deleted file mode 100644 index c4507ff5..00000000 --- a/esdt-safe/tests/bridge_test.rs +++ /dev/null @@ -1,415 +0,0 @@ -// #![allow(deprecated)] -// -// use bls_signature::BlsSignature; -// use bridge_setup::{ -// BridgeSetup, DummyAttributes, DUMMY_SIG, FEE_TOKEN_ID, FUNGIBLE_TOKEN_ID, NFT_TOKEN_ID, -// TOKEN_BALANCE, -// }; -// use esdt_safe::{ -// from_sovereign::transfer_tokens::TransferTokensModule, -// to_sovereign::{ -// create_tx::CreateTxModule, refund::RefundModule, set_tx_status::SetTxStatusModule, -// }, -// }; -// use multiversx_sc::{ -// codec::multi_types::OptionalValue, -// types::{EsdtTokenPayment, ManagedVec, MultiValueEncoded}, -// }; -// use multiversx_sc_scenario::{ -// managed_address, managed_biguint, managed_token_id, rust_biguint, -// testing_framework::TxTokenTransfer, -// }; -// use transaction::{ -// transaction_status::TransactionStatus, StolenFromFrameworkEsdtTokenData, Transaction, -// }; -// use tx_batch_module::TxBatchModule; -// -// mod bridge_setup; -// -// #[test] -// fn init_test() { -// let _ = BridgeSetup::new(esdt_safe::contract_obj, fee_market::contract_obj); -// } -// -// #[test] -// fn transfer_two_tokens_to_sov_ok() { -// let mut bridge_setup = BridgeSetup::new(esdt_safe::contract_obj, fee_market::contract_obj); -// -// let transfers = [ -// TxTokenTransfer { -// token_identifier: FEE_TOKEN_ID.to_vec(), -// nonce: 0, -// value: rust_biguint!(TOKEN_BALANCE), -// }, -// TxTokenTransfer { -// token_identifier: FUNGIBLE_TOKEN_ID.to_vec(), -// nonce: 0, -// value: rust_biguint!(1_000), -// }, -// TxTokenTransfer { -// token_identifier: NFT_TOKEN_ID.to_vec(), -// nonce: 1, -// value: rust_biguint!(2_000), -// }, -// ]; -// -// let dest = bridge_setup.sov_dest_addr.clone(); -// -// bridge_setup -// .b_mock -// .execute_esdt_multi_transfer( -// &bridge_setup.user, -// &bridge_setup.bridge_wrapper, -// &transfers, -// |sc| { -// sc.deposit(managed_address!(&dest), OptionalValue::None); -// }, -// ) -// .assert_ok(); -// -// bridge_setup -// .b_mock -// .execute_tx( -// &bridge_setup.owner, -// &bridge_setup.bridge_wrapper, -// &rust_biguint!(0), -// |sc| { -// let mut statuses = MultiValueEncoded::new(); -// statuses.push(TransactionStatus::Executed); -// -// sc.set_transaction_batch_status( -// 1, -// BlsSignature::new_from_bytes(&DUMMY_SIG), -// statuses, -// ); -// }, -// ) -// .assert_ok(); -// -// // fee is 100 per token -// bridge_setup.b_mock.check_esdt_balance( -// &bridge_setup.user, -// FEE_TOKEN_ID, -// &(rust_biguint!(TOKEN_BALANCE) - rust_biguint!(200)), -// ); -// bridge_setup.b_mock.check_esdt_balance( -// bridge_setup.fee_market_wrapper.address_ref(), -// FEE_TOKEN_ID, -// &rust_biguint!(200), -// ); -// } -// -// #[test] -// fn refund_failed_tx_to_sov() { -// let mut bridge_setup = BridgeSetup::new(esdt_safe::contract_obj, fee_market::contract_obj); -// -// let transfers = [ -// TxTokenTransfer { -// token_identifier: FEE_TOKEN_ID.to_vec(), -// nonce: 0, -// value: rust_biguint!(TOKEN_BALANCE), -// }, -// TxTokenTransfer { -// token_identifier: FUNGIBLE_TOKEN_ID.to_vec(), -// nonce: 0, -// value: rust_biguint!(1_000), -// }, -// TxTokenTransfer { -// token_identifier: NFT_TOKEN_ID.to_vec(), -// nonce: 1, -// value: rust_biguint!(2_000), -// }, -// ]; -// -// let dest = bridge_setup.sov_dest_addr.clone(); -// -// bridge_setup -// .b_mock -// .execute_esdt_multi_transfer( -// &bridge_setup.user, -// &bridge_setup.bridge_wrapper, -// &transfers, -// |sc| { -// sc.deposit(managed_address!(&dest), OptionalValue::None); -// }, -// ) -// .assert_ok(); -// -// bridge_setup -// .b_mock -// .execute_tx( -// &bridge_setup.owner, -// &bridge_setup.bridge_wrapper, -// &rust_biguint!(0), -// |sc| { -// let mut statuses = MultiValueEncoded::new(); -// statuses.push(TransactionStatus::Rejected); -// -// sc.set_transaction_batch_status( -// 1, -// BlsSignature::new_from_bytes(&DUMMY_SIG), -// statuses, -// ); -// }, -// ) -// .assert_ok(); -// -// bridge_setup -// .b_mock -// .execute_tx( -// &bridge_setup.user, -// &bridge_setup.bridge_wrapper, -// &rust_biguint!(0), -// |sc| { -// sc.claim_refund(managed_token_id!(FUNGIBLE_TOKEN_ID)); -// sc.claim_refund(managed_token_id!(NFT_TOKEN_ID)); -// }, -// ) -// .assert_ok(); -// -// bridge_setup.b_mock.check_esdt_balance( -// &bridge_setup.user, -// FUNGIBLE_TOKEN_ID, -// &rust_biguint!(TOKEN_BALANCE), -// ); -// bridge_setup.b_mock.check_nft_balance( -// &bridge_setup.user, -// NFT_TOKEN_ID, -// 1, -// &rust_biguint!(TOKEN_BALANCE), -// Some(&DummyAttributes { dummy: 42 }), -// ); -// } -// -// #[test] -// fn transfer_token_to_and_from_sov_ok() { -// let mut bridge_setup = BridgeSetup::new(esdt_safe::contract_obj, fee_market::contract_obj); -// -// let transfers = [ -// TxTokenTransfer { -// token_identifier: FEE_TOKEN_ID.to_vec(), -// nonce: 0, -// value: rust_biguint!(TOKEN_BALANCE), -// }, -// TxTokenTransfer { -// token_identifier: FUNGIBLE_TOKEN_ID.to_vec(), -// nonce: 0, -// value: rust_biguint!(1_000), -// }, -// TxTokenTransfer { -// token_identifier: NFT_TOKEN_ID.to_vec(), -// nonce: 1, -// value: rust_biguint!(2_000), -// }, -// ]; -// -// let user_addr = bridge_setup.user.clone(); -// let dest = bridge_setup.sov_dest_addr.clone(); -// -// bridge_setup -// .b_mock -// .execute_esdt_multi_transfer( -// &bridge_setup.user, -// &bridge_setup.bridge_wrapper, -// &transfers, -// |sc| { -// sc.deposit(managed_address!(&dest), OptionalValue::None); -// }, -// ) -// .assert_ok(); -// -// bridge_setup -// .b_mock -// .execute_tx( -// &bridge_setup.owner, -// &bridge_setup.bridge_wrapper, -// &rust_biguint!(0), -// |sc| { -// let mut statuses = MultiValueEncoded::new(); -// statuses.push(TransactionStatus::Executed); -// -// sc.set_transaction_batch_status( -// 1, -// BlsSignature::new_from_bytes(&DUMMY_SIG), -// statuses, -// ); -// }, -// ) -// .assert_ok(); -// -// bridge_setup -// .b_mock -// .execute_tx( -// &bridge_setup.owner, -// &bridge_setup.bridge_wrapper, -// &rust_biguint!(0), -// |sc| { -// let mut tokens = ManagedVec::new(); -// tokens.push(EsdtTokenPayment::new( -// managed_token_id!(FUNGIBLE_TOKEN_ID), -// 0, -// managed_biguint!(500), -// )); -// tokens.push(EsdtTokenPayment::new( -// managed_token_id!(NFT_TOKEN_ID), -// 1, -// managed_biguint!(500), -// )); -// -// let mut token_data = ManagedVec::new(); -// token_data.push(StolenFromFrameworkEsdtTokenData::default()); -// token_data.push(StolenFromFrameworkEsdtTokenData::default()); -// -// let mut transfers = MultiValueEncoded::new(); -// transfers.push(Transaction { -// block_nonce: 1, -// nonce: 1, -// from: managed_address!(&dest), -// to: managed_address!(&user_addr), -// tokens, -// token_data, -// opt_transfer_data: None, -// is_refund_tx: false, -// }); -// -// sc.batch_transfer_esdt_token( -// 1, -// BlsSignature::new_from_bytes(&DUMMY_SIG), -// transfers, -// ); -// }, -// ) -// .assert_ok(); -// -// bridge_setup.b_mock.check_esdt_balance( -// &bridge_setup.user, -// FUNGIBLE_TOKEN_ID, -// &rust_biguint!(TOKEN_BALANCE - 1_000 + 500), -// ); -// bridge_setup.b_mock.check_nft_balance( -// &bridge_setup.user, -// NFT_TOKEN_ID, -// 1, -// &rust_biguint!(TOKEN_BALANCE - 2_000 + 500), -// Some(&DummyAttributes { dummy: 42 }), -// ); -// } -// -// #[test] -// fn transfer_token_from_sov_no_roles_refund() { -// let mut bridge_setup = BridgeSetup::new(esdt_safe::contract_obj, fee_market::contract_obj); -// let user_addr = bridge_setup.user.clone(); -// let dest = bridge_setup.sov_dest_addr.clone(); -// -// bridge_setup -// .b_mock -// .execute_tx( -// &bridge_setup.owner, -// &bridge_setup.bridge_wrapper, -// &rust_biguint!(0), -// |sc| { -// let mut tokens = ManagedVec::new(); -// tokens.push(EsdtTokenPayment::new( -// managed_token_id!(FUNGIBLE_TOKEN_ID), -// 0, -// managed_biguint!(500), -// )); -// tokens.push(EsdtTokenPayment::new( -// managed_token_id!(NFT_TOKEN_ID), -// 1, -// managed_biguint!(500), -// )); -// -// let mut token_data = ManagedVec::new(); -// token_data.push(StolenFromFrameworkEsdtTokenData::default()); -// token_data.push(StolenFromFrameworkEsdtTokenData::default()); -// -// let mut transfers = MultiValueEncoded::new(); -// transfers.push(Transaction { -// block_nonce: 1, -// nonce: 1, -// from: managed_address!(&dest), -// to: managed_address!(&user_addr), -// tokens, -// token_data, -// opt_transfer_data: None, -// is_refund_tx: false, -// }); -// -// sc.batch_transfer_esdt_token( -// 1, -// BlsSignature::new_from_bytes(&DUMMY_SIG), -// transfers, -// ); -// }, -// ) -// .assert_ok(); -// -// // user received no tokens -// bridge_setup.b_mock.check_esdt_balance( -// &bridge_setup.user, -// FUNGIBLE_TOKEN_ID, -// &rust_biguint!(TOKEN_BALANCE), -// ); -// bridge_setup.b_mock.check_nft_balance( -// &bridge_setup.user, -// NFT_TOKEN_ID, -// 1, -// &rust_biguint!(TOKEN_BALANCE), -// Some(&DummyAttributes { dummy: 42 }), -// ); -// -// // set block nonce in the future so batch is "final" -// bridge_setup.b_mock.set_block_nonce(20); -// -// bridge_setup -// .b_mock -// .execute_tx( -// &bridge_setup.owner, -// &bridge_setup.bridge_wrapper, -// &rust_biguint!(0), -// |sc| { -// // transactions were converted into Elrond -> Sov for refunding -// let opt_val = sc.get_current_tx_batch(); -// assert!(opt_val.is_some()); -// }, -// ) -// .assert_ok(); -// } -// -// #[test] -// fn not_enough_fee_test() { -// let mut bridge_setup = BridgeSetup::new(esdt_safe::contract_obj, fee_market::contract_obj); -// -// let transfers = [ -// TxTokenTransfer { -// token_identifier: FEE_TOKEN_ID.to_vec(), -// nonce: 0, -// value: rust_biguint!(10), -// }, -// TxTokenTransfer { -// token_identifier: FUNGIBLE_TOKEN_ID.to_vec(), -// nonce: 0, -// value: rust_biguint!(1_000), -// }, -// TxTokenTransfer { -// token_identifier: NFT_TOKEN_ID.to_vec(), -// nonce: 1, -// value: rust_biguint!(2_000), -// }, -// ]; -// -// let dest = bridge_setup.sov_dest_addr.clone(); -// -// bridge_setup -// .b_mock -// .execute_esdt_multi_transfer( -// &bridge_setup.user, -// &bridge_setup.bridge_wrapper, -// &transfers, -// |sc| { -// sc.deposit(managed_address!(&dest), OptionalValue::None); -// }, -// ) -// .assert_user_error("Payment does not cover fee"); -// } From 8ddd30fed065c5f3fc514b3289da1cd1af03f702 Mon Sep 17 00:00:00 2001 From: Andrei Baltariu Date: Fri, 11 Oct 2024 22:22:01 +0300 Subject: [PATCH 406/523] Modified deposit logic Signed-off-by: Andrei Baltariu --- esdt-safe/src/to_sovereign/create_tx.rs | 29 +++++++++++++++---------- 1 file changed, 18 insertions(+), 11 deletions(-) diff --git a/esdt-safe/src/to_sovereign/create_tx.rs b/esdt-safe/src/to_sovereign/create_tx.rs index 038e06aa..a070b32d 100644 --- a/esdt-safe/src/to_sovereign/create_tx.rs +++ b/esdt-safe/src/to_sovereign/create_tx.rs @@ -63,10 +63,7 @@ pub trait CreateTxModule: ); current_token_data.amount = payment.amount.clone(); - let mvx_to_sov_token_id_mapper = - self.multiversx_to_sovereign_token_id_mapper(&payment.token_identifier); - - if is_sov_chain || mvx_to_sov_token_id_mapper.is_empty() { + if is_sov_chain { self.tx() .to(ToSelf) .typed(ESDTSystemSCProxy) @@ -78,15 +75,25 @@ pub trait CreateTxModule: payment.token_nonce, current_token_data, ); - event_payments.push(event_payment); } else { - let sov_token_id = mvx_to_sov_token_id_mapper.get(); - let sov_token_nonce = self.burn_mainchain_token(payment, &sov_token_id); - - let event_payment = - EventPayment::new(sov_token_id, sov_token_nonce, current_token_data); - event_payments.push(event_payment); + let mvx_to_sov_token_id_mapper = + self.multiversx_to_sovereign_token_id_mapper(&payment.token_identifier); + if !mvx_to_sov_token_id_mapper.is_empty() { + let sov_token_id = mvx_to_sov_token_id_mapper.get(); + let sov_token_nonce = self.burn_mainchain_token(payment, &sov_token_id); + + let event_payment = + EventPayment::new(sov_token_id, sov_token_nonce, current_token_data); + event_payments.push(event_payment); + } else { + let event_payment = EventPayment::new( + payment.token_identifier, + payment.token_nonce, + current_token_data, + ); + event_payments.push(event_payment); + } } } From 47e64ca55828342f9b8e0fdc3c3efe2d1a8995a8 Mon Sep 17 00:00:00 2001 From: Andrei Baltariu Date: Mon, 14 Oct 2024 09:26:29 +0300 Subject: [PATCH 407/523] 0.53.2 upgrade Signed-off-by: Andrei Baltariu --- Cargo.lock | 20 ++++++++-------- chain-config/Cargo.toml | 6 ++--- chain-config/meta/Cargo.toml | 2 +- chain-config/wasm/Cargo.lock | 24 +++++++++---------- chain-config/wasm/Cargo.toml | 2 +- chain-factory/Cargo.toml | 4 ++-- chain-factory/meta/Cargo.toml | 2 +- .../wasm-chain-factory-full/Cargo.lock | 24 +++++++++---------- .../wasm-chain-factory-full/Cargo.toml | 2 +- .../wasm-chain-factory-view/Cargo.lock | 24 +++++++++---------- .../wasm-chain-factory-view/Cargo.toml | 2 +- chain-factory/wasm/Cargo.lock | 24 +++++++++---------- chain-factory/wasm/Cargo.toml | 2 +- common/bls-signature/Cargo.toml | 4 ++-- common/max-bridged-amount-module/Cargo.toml | 4 ++-- common/setup-phase/Cargo.toml | 4 ++-- common/token-whitelist/Cargo.toml | 4 ++-- common/transaction/Cargo.toml | 2 +- common/tx-batch-module/Cargo.toml | 4 ++-- common/utils/Cargo.toml | 2 +- enshrine-esdt-safe/Cargo.toml | 6 ++--- enshrine-esdt-safe/meta/Cargo.toml | 2 +- .../wasm-enshrine-esdt-safe-full/Cargo.lock | 24 +++++++++---------- .../wasm-enshrine-esdt-safe-full/Cargo.toml | 2 +- .../wasm-enshrine-esdt-safe-view/Cargo.lock | 24 +++++++++---------- .../wasm-enshrine-esdt-safe-view/Cargo.toml | 2 +- enshrine-esdt-safe/wasm/Cargo.lock | 24 +++++++++---------- enshrine-esdt-safe/wasm/Cargo.toml | 2 +- esdt-safe/Cargo.toml | 6 ++--- esdt-safe/meta/Cargo.toml | 2 +- esdt-safe/wasm-esdt-safe-full/Cargo.lock | 24 +++++++++---------- esdt-safe/wasm-esdt-safe-full/Cargo.toml | 2 +- esdt-safe/wasm-esdt-safe-view/Cargo.lock | 24 +++++++++---------- esdt-safe/wasm-esdt-safe-view/Cargo.toml | 2 +- esdt-safe/wasm/Cargo.lock | 24 +++++++++---------- esdt-safe/wasm/Cargo.toml | 2 +- fee-market/Cargo.toml | 4 ++-- fee-market/meta/Cargo.toml | 2 +- fee-market/wasm-fee-marker-full/Cargo.lock | 20 ++++++++-------- fee-market/wasm-fee-marker-full/Cargo.toml | 2 +- fee-market/wasm-multisig-view/Cargo.lock | 20 ++++++++-------- fee-market/wasm-multisig-view/Cargo.toml | 2 +- fee-market/wasm/Cargo.lock | 20 ++++++++-------- fee-market/wasm/Cargo.toml | 2 +- header-verifier/Cargo.toml | 4 ++-- header-verifier/meta/Cargo.toml | 2 +- .../wasm-header-verifier-full/Cargo.lock | 20 ++++++++-------- .../wasm-header-verifier-full/Cargo.toml | 2 +- header-verifier/wasm-multisig-view/Cargo.lock | 20 ++++++++-------- header-verifier/wasm-multisig-view/Cargo.toml | 2 +- header-verifier/wasm/Cargo.lock | 20 ++++++++-------- header-verifier/wasm/Cargo.toml | 2 +- token-handler/Cargo.toml | 4 ++-- token-handler/meta/Cargo.toml | 2 +- .../wasm-token-handler-full/Cargo.lock | 24 +++++++++---------- .../wasm-token-handler-full/Cargo.toml | 2 +- .../wasm-token-handler-view/Cargo.lock | 24 +++++++++---------- .../wasm-token-handler-view/Cargo.toml | 2 +- token-handler/wasm/Cargo.lock | 24 +++++++++---------- token-handler/wasm/Cargo.toml | 2 +- 60 files changed, 281 insertions(+), 281 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index cf447216..62112140 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -609,9 +609,9 @@ checksum = "b59072fa0624b55ae5ae3fa6bfa91515bbeb4ac440214bc4a509e2c8806d6e9f" [[package]] name = "multiversx-sc" -version = "0.53.1" +version = "0.53.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e05f8dfb9c2dd26feff1330b1e229f0886f5c0228ed570f19421a458e6e7b0ef" +checksum = "75ea89a26f0aacda21437a8ae5ccfbefab99d8191942b3d2eddbcbf84f9866d7" dependencies = [ "bitflags", "hex-literal", @@ -647,9 +647,9 @@ dependencies = [ [[package]] name = "multiversx-sc-derive" -version = "0.53.1" +version = "0.53.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f4b5176aa94b5e422e0d3c904492e0de0ae8381f166b563fbcac19a9ca4b28bc" +checksum = "4c17fdf90fafca2f19085ae67b0502d9f71bf8ab1be3c83808eb88e02a8c18b9" dependencies = [ "hex", "proc-macro2", @@ -660,9 +660,9 @@ dependencies = [ [[package]] name = "multiversx-sc-meta-lib" -version = "0.53.1" +version = "0.53.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "750e309894ebebad3675feb3d59bb709f826c07cbdf21adf5719b5ab2f23aa13" +checksum = "ef023806e14a8a6245408c4a7dfdf17d4a1eb39425cedfe50cd2c48f96708ab6" dependencies = [ "clap", "colored", @@ -681,18 +681,18 @@ dependencies = [ [[package]] name = "multiversx-sc-modules" -version = "0.53.1" +version = "0.53.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3cfb6046ec3cc6ef94351b4ca89907b2b74b2e4a7f376adc0af18ddd1c5a4367" +checksum = "daeb48acbd39255868a3241798df2f85050f0ae8d82d6417bd2cd0e30a241855" dependencies = [ "multiversx-sc", ] [[package]] name = "multiversx-sc-scenario" -version = "0.53.1" +version = "0.53.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "701ca689a866acb88cf5022ec8bae1ba318065e5800f75dd76e3620d2a782ca0" +checksum = "cd16e3bf1f6696d0add36b7b905b1ffdd13b836e584da000f5e265c11e2bfc8d" dependencies = [ "base64", "bech32", diff --git a/chain-config/Cargo.toml b/chain-config/Cargo.toml index d5d3fcd5..2c50fa75 100644 --- a/chain-config/Cargo.toml +++ b/chain-config/Cargo.toml @@ -12,10 +12,10 @@ path = "src/lib.rs" num-bigint = "0.4.2" [dev-dependencies.multiversx-sc-scenario] -version = "=0.53.1" +version = "=0.53.2" [dependencies.multiversx-sc] -version = "=0.53.1" +version = "=0.53.2" [dependencies.multiversx-sc-modules] -version = "=0.53.1" +version = "=0.53.2" diff --git a/chain-config/meta/Cargo.toml b/chain-config/meta/Cargo.toml index d5971030..6b3ac65f 100644 --- a/chain-config/meta/Cargo.toml +++ b/chain-config/meta/Cargo.toml @@ -11,4 +11,4 @@ authors = ["you"] path = ".." [dependencies.multiversx-sc-meta-lib] -version = "=0.53.1" +version = "=0.53.2" diff --git a/chain-config/wasm/Cargo.lock b/chain-config/wasm/Cargo.lock index 61d0dfb8..ae53e5bc 100644 --- a/chain-config/wasm/Cargo.lock +++ b/chain-config/wasm/Cargo.lock @@ -10,9 +10,9 @@ checksum = "7c02d123df017efcdfbd739ef81735b36c5ba83ec3c59c80a9d7ecc718f92e50" [[package]] name = "autocfg" -version = "1.3.0" +version = "1.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0c4b4d0bd25bd0b74681c0ad21497610ce1b7c91b1022cd21c80c6fbdd9476b0" +checksum = "ace50bade8e6234aa140d9a2f552bbee1db4d353f69b8217bc503490fc1a9f26" [[package]] name = "bitflags" @@ -56,9 +56,9 @@ checksum = "6fe2267d4ed49bc07b63801559be28c718ea06c4738b7a03c94df7386d2cde46" [[package]] name = "multiversx-sc" -version = "0.53.1" +version = "0.53.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e05f8dfb9c2dd26feff1330b1e229f0886f5c0228ed570f19421a458e6e7b0ef" +checksum = "75ea89a26f0aacda21437a8ae5ccfbefab99d8191942b3d2eddbcbf84f9866d7" dependencies = [ "bitflags", "hex-literal", @@ -93,9 +93,9 @@ dependencies = [ [[package]] name = "multiversx-sc-derive" -version = "0.53.1" +version = "0.53.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f4b5176aa94b5e422e0d3c904492e0de0ae8381f166b563fbcac19a9ca4b28bc" +checksum = "4c17fdf90fafca2f19085ae67b0502d9f71bf8ab1be3c83808eb88e02a8c18b9" dependencies = [ "hex", "proc-macro2", @@ -106,18 +106,18 @@ dependencies = [ [[package]] name = "multiversx-sc-modules" -version = "0.53.1" +version = "0.53.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3cfb6046ec3cc6ef94351b4ca89907b2b74b2e4a7f376adc0af18ddd1c5a4367" +checksum = "daeb48acbd39255868a3241798df2f85050f0ae8d82d6417bd2cd0e30a241855" dependencies = [ "multiversx-sc", ] [[package]] name = "multiversx-sc-wasm-adapter" -version = "0.53.1" +version = "0.53.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9aa0cbd543872f94b9bc98c4ce7c3ed25a7257e1425295af9036eba44893bdaa" +checksum = "20659915a4377d375c46d7f237e810053a03f7e084fad6362dd5748a7233defb" dependencies = [ "multiversx-sc", ] @@ -187,9 +187,9 @@ dependencies = [ [[package]] name = "unicode-ident" -version = "1.0.12" +version = "1.0.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3354b9ac3fae1ff6755cb6db53683adb661634f67557942dea4facebec0fee4b" +checksum = "e91b56cd4cadaeb79bbf1a5645f6b4f8dc5bde8834ad5894a8db35fda9efa1fe" [[package]] name = "unwrap-infallible" diff --git a/chain-config/wasm/Cargo.toml b/chain-config/wasm/Cargo.toml index 6a696293..338d37b3 100644 --- a/chain-config/wasm/Cargo.toml +++ b/chain-config/wasm/Cargo.toml @@ -28,7 +28,7 @@ panic = "abort" path = ".." [dependencies.multiversx-sc-wasm-adapter] -version = "=0.53.1" +version = "=0.53.2" [workspace] members = ["."] diff --git a/chain-factory/Cargo.toml b/chain-factory/Cargo.toml index 337846c5..23f2b3b3 100644 --- a/chain-factory/Cargo.toml +++ b/chain-factory/Cargo.toml @@ -12,10 +12,10 @@ path = "src/lib.rs" num-bigint = "0.4.2" [dev-dependencies.multiversx-sc-scenario] -version = "=0.53.1" +version = "=0.53.2" [dependencies.multiversx-sc] -version = "=0.53.1" +version = "=0.53.2" [dependencies.utils] path = "../common/utils" diff --git a/chain-factory/meta/Cargo.toml b/chain-factory/meta/Cargo.toml index 6d3d98bb..cb29aa4c 100644 --- a/chain-factory/meta/Cargo.toml +++ b/chain-factory/meta/Cargo.toml @@ -11,4 +11,4 @@ authors = ["you"] path = ".." [dependencies.multiversx-sc-meta-lib] -version = "=0.53.1" +version = "=0.53.2" diff --git a/chain-factory/wasm-chain-factory-full/Cargo.lock b/chain-factory/wasm-chain-factory-full/Cargo.lock index ed28057c..7678c881 100644 --- a/chain-factory/wasm-chain-factory-full/Cargo.lock +++ b/chain-factory/wasm-chain-factory-full/Cargo.lock @@ -10,9 +10,9 @@ checksum = "7c02d123df017efcdfbd739ef81735b36c5ba83ec3c59c80a9d7ecc718f92e50" [[package]] name = "autocfg" -version = "1.3.0" +version = "1.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0c4b4d0bd25bd0b74681c0ad21497610ce1b7c91b1022cd21c80c6fbdd9476b0" +checksum = "ace50bade8e6234aa140d9a2f552bbee1db4d353f69b8217bc503490fc1a9f26" [[package]] name = "bitflags" @@ -74,9 +74,9 @@ checksum = "6fe2267d4ed49bc07b63801559be28c718ea06c4738b7a03c94df7386d2cde46" [[package]] name = "multiversx-sc" -version = "0.53.1" +version = "0.53.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e05f8dfb9c2dd26feff1330b1e229f0886f5c0228ed570f19421a458e6e7b0ef" +checksum = "75ea89a26f0aacda21437a8ae5ccfbefab99d8191942b3d2eddbcbf84f9866d7" dependencies = [ "bitflags", "hex-literal", @@ -111,9 +111,9 @@ dependencies = [ [[package]] name = "multiversx-sc-derive" -version = "0.53.1" +version = "0.53.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f4b5176aa94b5e422e0d3c904492e0de0ae8381f166b563fbcac19a9ca4b28bc" +checksum = "4c17fdf90fafca2f19085ae67b0502d9f71bf8ab1be3c83808eb88e02a8c18b9" dependencies = [ "hex", "proc-macro2", @@ -124,18 +124,18 @@ dependencies = [ [[package]] name = "multiversx-sc-modules" -version = "0.53.1" +version = "0.53.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3cfb6046ec3cc6ef94351b4ca89907b2b74b2e4a7f376adc0af18ddd1c5a4367" +checksum = "daeb48acbd39255868a3241798df2f85050f0ae8d82d6417bd2cd0e30a241855" dependencies = [ "multiversx-sc", ] [[package]] name = "multiversx-sc-wasm-adapter" -version = "0.53.1" +version = "0.53.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9aa0cbd543872f94b9bc98c4ce7c3ed25a7257e1425295af9036eba44893bdaa" +checksum = "20659915a4377d375c46d7f237e810053a03f7e084fad6362dd5748a7233defb" dependencies = [ "multiversx-sc", ] @@ -212,9 +212,9 @@ dependencies = [ [[package]] name = "unicode-ident" -version = "1.0.12" +version = "1.0.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3354b9ac3fae1ff6755cb6db53683adb661634f67557942dea4facebec0fee4b" +checksum = "e91b56cd4cadaeb79bbf1a5645f6b4f8dc5bde8834ad5894a8db35fda9efa1fe" [[package]] name = "unwrap-infallible" diff --git a/chain-factory/wasm-chain-factory-full/Cargo.toml b/chain-factory/wasm-chain-factory-full/Cargo.toml index 1367f79b..967fcfcf 100644 --- a/chain-factory/wasm-chain-factory-full/Cargo.toml +++ b/chain-factory/wasm-chain-factory-full/Cargo.toml @@ -28,7 +28,7 @@ panic = "abort" path = ".." [dependencies.multiversx-sc-wasm-adapter] -version = "=0.53.1" +version = "=0.53.2" [workspace] members = ["."] diff --git a/chain-factory/wasm-chain-factory-view/Cargo.lock b/chain-factory/wasm-chain-factory-view/Cargo.lock index cd117300..c9ee4371 100644 --- a/chain-factory/wasm-chain-factory-view/Cargo.lock +++ b/chain-factory/wasm-chain-factory-view/Cargo.lock @@ -10,9 +10,9 @@ checksum = "7c02d123df017efcdfbd739ef81735b36c5ba83ec3c59c80a9d7ecc718f92e50" [[package]] name = "autocfg" -version = "1.3.0" +version = "1.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0c4b4d0bd25bd0b74681c0ad21497610ce1b7c91b1022cd21c80c6fbdd9476b0" +checksum = "ace50bade8e6234aa140d9a2f552bbee1db4d353f69b8217bc503490fc1a9f26" [[package]] name = "bitflags" @@ -74,9 +74,9 @@ checksum = "6fe2267d4ed49bc07b63801559be28c718ea06c4738b7a03c94df7386d2cde46" [[package]] name = "multiversx-sc" -version = "0.53.1" +version = "0.53.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e05f8dfb9c2dd26feff1330b1e229f0886f5c0228ed570f19421a458e6e7b0ef" +checksum = "75ea89a26f0aacda21437a8ae5ccfbefab99d8191942b3d2eddbcbf84f9866d7" dependencies = [ "bitflags", "hex-literal", @@ -111,9 +111,9 @@ dependencies = [ [[package]] name = "multiversx-sc-derive" -version = "0.53.1" +version = "0.53.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f4b5176aa94b5e422e0d3c904492e0de0ae8381f166b563fbcac19a9ca4b28bc" +checksum = "4c17fdf90fafca2f19085ae67b0502d9f71bf8ab1be3c83808eb88e02a8c18b9" dependencies = [ "hex", "proc-macro2", @@ -124,18 +124,18 @@ dependencies = [ [[package]] name = "multiversx-sc-modules" -version = "0.53.1" +version = "0.53.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3cfb6046ec3cc6ef94351b4ca89907b2b74b2e4a7f376adc0af18ddd1c5a4367" +checksum = "daeb48acbd39255868a3241798df2f85050f0ae8d82d6417bd2cd0e30a241855" dependencies = [ "multiversx-sc", ] [[package]] name = "multiversx-sc-wasm-adapter" -version = "0.53.1" +version = "0.53.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9aa0cbd543872f94b9bc98c4ce7c3ed25a7257e1425295af9036eba44893bdaa" +checksum = "20659915a4377d375c46d7f237e810053a03f7e084fad6362dd5748a7233defb" dependencies = [ "multiversx-sc", ] @@ -212,9 +212,9 @@ dependencies = [ [[package]] name = "unicode-ident" -version = "1.0.12" +version = "1.0.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3354b9ac3fae1ff6755cb6db53683adb661634f67557942dea4facebec0fee4b" +checksum = "e91b56cd4cadaeb79bbf1a5645f6b4f8dc5bde8834ad5894a8db35fda9efa1fe" [[package]] name = "unwrap-infallible" diff --git a/chain-factory/wasm-chain-factory-view/Cargo.toml b/chain-factory/wasm-chain-factory-view/Cargo.toml index 9af379e8..982df969 100644 --- a/chain-factory/wasm-chain-factory-view/Cargo.toml +++ b/chain-factory/wasm-chain-factory-view/Cargo.toml @@ -28,7 +28,7 @@ panic = "abort" path = ".." [dependencies.multiversx-sc-wasm-adapter] -version = "=0.53.1" +version = "=0.53.2" [workspace] members = ["."] diff --git a/chain-factory/wasm/Cargo.lock b/chain-factory/wasm/Cargo.lock index 1a1b1683..9ecb087f 100644 --- a/chain-factory/wasm/Cargo.lock +++ b/chain-factory/wasm/Cargo.lock @@ -10,9 +10,9 @@ checksum = "7c02d123df017efcdfbd739ef81735b36c5ba83ec3c59c80a9d7ecc718f92e50" [[package]] name = "autocfg" -version = "1.3.0" +version = "1.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0c4b4d0bd25bd0b74681c0ad21497610ce1b7c91b1022cd21c80c6fbdd9476b0" +checksum = "ace50bade8e6234aa140d9a2f552bbee1db4d353f69b8217bc503490fc1a9f26" [[package]] name = "bitflags" @@ -74,9 +74,9 @@ checksum = "6fe2267d4ed49bc07b63801559be28c718ea06c4738b7a03c94df7386d2cde46" [[package]] name = "multiversx-sc" -version = "0.53.1" +version = "0.53.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e05f8dfb9c2dd26feff1330b1e229f0886f5c0228ed570f19421a458e6e7b0ef" +checksum = "75ea89a26f0aacda21437a8ae5ccfbefab99d8191942b3d2eddbcbf84f9866d7" dependencies = [ "bitflags", "hex-literal", @@ -111,9 +111,9 @@ dependencies = [ [[package]] name = "multiversx-sc-derive" -version = "0.53.1" +version = "0.53.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f4b5176aa94b5e422e0d3c904492e0de0ae8381f166b563fbcac19a9ca4b28bc" +checksum = "4c17fdf90fafca2f19085ae67b0502d9f71bf8ab1be3c83808eb88e02a8c18b9" dependencies = [ "hex", "proc-macro2", @@ -124,18 +124,18 @@ dependencies = [ [[package]] name = "multiversx-sc-modules" -version = "0.53.1" +version = "0.53.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3cfb6046ec3cc6ef94351b4ca89907b2b74b2e4a7f376adc0af18ddd1c5a4367" +checksum = "daeb48acbd39255868a3241798df2f85050f0ae8d82d6417bd2cd0e30a241855" dependencies = [ "multiversx-sc", ] [[package]] name = "multiversx-sc-wasm-adapter" -version = "0.53.1" +version = "0.53.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9aa0cbd543872f94b9bc98c4ce7c3ed25a7257e1425295af9036eba44893bdaa" +checksum = "20659915a4377d375c46d7f237e810053a03f7e084fad6362dd5748a7233defb" dependencies = [ "multiversx-sc", ] @@ -212,9 +212,9 @@ dependencies = [ [[package]] name = "unicode-ident" -version = "1.0.12" +version = "1.0.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3354b9ac3fae1ff6755cb6db53683adb661634f67557942dea4facebec0fee4b" +checksum = "e91b56cd4cadaeb79bbf1a5645f6b4f8dc5bde8834ad5894a8db35fda9efa1fe" [[package]] name = "unwrap-infallible" diff --git a/chain-factory/wasm/Cargo.toml b/chain-factory/wasm/Cargo.toml index da4b60be..29f5c1b8 100644 --- a/chain-factory/wasm/Cargo.toml +++ b/chain-factory/wasm/Cargo.toml @@ -28,7 +28,7 @@ panic = "abort" path = ".." [dependencies.multiversx-sc-wasm-adapter] -version = "=0.53.1" +version = "=0.53.2" [workspace] members = ["."] diff --git a/common/bls-signature/Cargo.toml b/common/bls-signature/Cargo.toml index d82386b8..969c2b38 100644 --- a/common/bls-signature/Cargo.toml +++ b/common/bls-signature/Cargo.toml @@ -5,10 +5,10 @@ authors = ["dorin-iancu "] edition = "2018" [dependencies.multiversx-sc] -version = "=0.53.1" +version = "=0.53.2" [dependencies.transaction] path = "../transaction" [dev-dependencies.multiversx-sc-scenario] -version = "=0.53.1" +version = "=0.53.2" diff --git a/common/max-bridged-amount-module/Cargo.toml b/common/max-bridged-amount-module/Cargo.toml index b3b13d94..02409a83 100644 --- a/common/max-bridged-amount-module/Cargo.toml +++ b/common/max-bridged-amount-module/Cargo.toml @@ -5,7 +5,7 @@ authors = ["dorin-iancu "] edition = "2018" [dependencies.multiversx-sc] -version = "=0.53.1" +version = "=0.53.2" [dev-dependencies.multiversx-sc-scenario] -version = "=0.53.1" +version = "=0.53.2" diff --git a/common/setup-phase/Cargo.toml b/common/setup-phase/Cargo.toml index 7d90b854..83128ab1 100644 --- a/common/setup-phase/Cargo.toml +++ b/common/setup-phase/Cargo.toml @@ -5,7 +5,7 @@ authors = ["dorin-iancu "] edition = "2018" [dependencies.multiversx-sc] -version = "=0.53.1" +version = "=0.53.2" [dev-dependencies.multiversx-sc-scenario] -version = "=0.53.1" +version = "=0.53.2" diff --git a/common/token-whitelist/Cargo.toml b/common/token-whitelist/Cargo.toml index 47706a54..9c2320a7 100644 --- a/common/token-whitelist/Cargo.toml +++ b/common/token-whitelist/Cargo.toml @@ -14,7 +14,7 @@ path = "../setup-phase" path = "../utils" [dependencies.multiversx-sc] -version = "=0.53.1" +version = "=0.53.2" [dev-dependencies.multiversx-sc-scenario] -version = "=0.53.1" +version = "=0.53.2" diff --git a/common/transaction/Cargo.toml b/common/transaction/Cargo.toml index 38641b06..1e7a9472 100644 --- a/common/transaction/Cargo.toml +++ b/common/transaction/Cargo.toml @@ -8,4 +8,4 @@ edition = "2018" path = "src/lib.rs" [dependencies.multiversx-sc] -version = "=0.53.1" +version = "=0.53.2" diff --git a/common/tx-batch-module/Cargo.toml b/common/tx-batch-module/Cargo.toml index e85dee7f..190c9082 100644 --- a/common/tx-batch-module/Cargo.toml +++ b/common/tx-batch-module/Cargo.toml @@ -5,10 +5,10 @@ authors = ["dorin-iancu "] edition = "2018" [dependencies.multiversx-sc] -version = "=0.53.1" +version = "=0.53.2" [dependencies.transaction] path = "../transaction" [dev-dependencies.multiversx-sc-scenario] -version = "=0.53.1" +version = "=0.53.2" diff --git a/common/utils/Cargo.toml b/common/utils/Cargo.toml index 3e546289..b09521e5 100644 --- a/common/utils/Cargo.toml +++ b/common/utils/Cargo.toml @@ -11,5 +11,5 @@ path = "src/lib.rs" path = "../bls-signature" [dependencies.multiversx-sc] -version = "=0.53.1" +version = "=0.53.2" features = ["esdt-token-payment-legacy-decode"] diff --git a/enshrine-esdt-safe/Cargo.toml b/enshrine-esdt-safe/Cargo.toml index df826198..af342497 100644 --- a/enshrine-esdt-safe/Cargo.toml +++ b/enshrine-esdt-safe/Cargo.toml @@ -39,10 +39,10 @@ path = "../header-verifier" path = "../token-handler" [dependencies.multiversx-sc] -version = "=0.53.1" +version = "=0.53.2" [dependencies.multiversx-sc-modules] -version = "=0.53.1" +version = "=0.53.2" [dev-dependencies] num-bigint = "0.4.2" @@ -50,4 +50,4 @@ num-traits = "0.2" hex = "0.4" [dev-dependencies.multiversx-sc-scenario] -version = "=0.53.1" +version = "=0.53.2" diff --git a/enshrine-esdt-safe/meta/Cargo.toml b/enshrine-esdt-safe/meta/Cargo.toml index e3554570..84eac8d4 100644 --- a/enshrine-esdt-safe/meta/Cargo.toml +++ b/enshrine-esdt-safe/meta/Cargo.toml @@ -8,5 +8,5 @@ publish = false path = ".." [dependencies.multiversx-sc-meta-lib] -version = "0.53.1" +version = "0.53.2" default-features = false diff --git a/enshrine-esdt-safe/wasm-enshrine-esdt-safe-full/Cargo.lock b/enshrine-esdt-safe/wasm-enshrine-esdt-safe-full/Cargo.lock index 5f3c36f5..fe32f8dc 100644 --- a/enshrine-esdt-safe/wasm-enshrine-esdt-safe-full/Cargo.lock +++ b/enshrine-esdt-safe/wasm-enshrine-esdt-safe-full/Cargo.lock @@ -10,9 +10,9 @@ checksum = "7c02d123df017efcdfbd739ef81735b36c5ba83ec3c59c80a9d7ecc718f92e50" [[package]] name = "autocfg" -version = "1.3.0" +version = "1.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0c4b4d0bd25bd0b74681c0ad21497610ce1b7c91b1022cd21c80c6fbdd9476b0" +checksum = "ace50bade8e6234aa140d9a2f552bbee1db4d353f69b8217bc503490fc1a9f26" [[package]] name = "bitflags" @@ -118,9 +118,9 @@ dependencies = [ [[package]] name = "multiversx-sc" -version = "0.53.1" +version = "0.53.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e05f8dfb9c2dd26feff1330b1e229f0886f5c0228ed570f19421a458e6e7b0ef" +checksum = "75ea89a26f0aacda21437a8ae5ccfbefab99d8191942b3d2eddbcbf84f9866d7" dependencies = [ "bitflags", "hex-literal", @@ -155,9 +155,9 @@ dependencies = [ [[package]] name = "multiversx-sc-derive" -version = "0.53.1" +version = "0.53.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f4b5176aa94b5e422e0d3c904492e0de0ae8381f166b563fbcac19a9ca4b28bc" +checksum = "4c17fdf90fafca2f19085ae67b0502d9f71bf8ab1be3c83808eb88e02a8c18b9" dependencies = [ "hex", "proc-macro2", @@ -168,18 +168,18 @@ dependencies = [ [[package]] name = "multiversx-sc-modules" -version = "0.53.1" +version = "0.53.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3cfb6046ec3cc6ef94351b4ca89907b2b74b2e4a7f376adc0af18ddd1c5a4367" +checksum = "daeb48acbd39255868a3241798df2f85050f0ae8d82d6417bd2cd0e30a241855" dependencies = [ "multiversx-sc", ] [[package]] name = "multiversx-sc-wasm-adapter" -version = "0.53.1" +version = "0.53.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9aa0cbd543872f94b9bc98c4ce7c3ed25a7257e1425295af9036eba44893bdaa" +checksum = "20659915a4377d375c46d7f237e810053a03f7e084fad6362dd5748a7233defb" dependencies = [ "multiversx-sc", ] @@ -291,9 +291,9 @@ dependencies = [ [[package]] name = "unicode-ident" -version = "1.0.12" +version = "1.0.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3354b9ac3fae1ff6755cb6db53683adb661634f67557942dea4facebec0fee4b" +checksum = "e91b56cd4cadaeb79bbf1a5645f6b4f8dc5bde8834ad5894a8db35fda9efa1fe" [[package]] name = "unwrap-infallible" diff --git a/enshrine-esdt-safe/wasm-enshrine-esdt-safe-full/Cargo.toml b/enshrine-esdt-safe/wasm-enshrine-esdt-safe-full/Cargo.toml index b2c0bb98..1dbf47f8 100644 --- a/enshrine-esdt-safe/wasm-enshrine-esdt-safe-full/Cargo.toml +++ b/enshrine-esdt-safe/wasm-enshrine-esdt-safe-full/Cargo.toml @@ -28,7 +28,7 @@ panic = "abort" path = ".." [dependencies.multiversx-sc-wasm-adapter] -version = "=0.53.1" +version = "=0.53.2" [workspace] members = ["."] diff --git a/enshrine-esdt-safe/wasm-enshrine-esdt-safe-view/Cargo.lock b/enshrine-esdt-safe/wasm-enshrine-esdt-safe-view/Cargo.lock index e8624f6e..f59bd879 100644 --- a/enshrine-esdt-safe/wasm-enshrine-esdt-safe-view/Cargo.lock +++ b/enshrine-esdt-safe/wasm-enshrine-esdt-safe-view/Cargo.lock @@ -10,9 +10,9 @@ checksum = "7c02d123df017efcdfbd739ef81735b36c5ba83ec3c59c80a9d7ecc718f92e50" [[package]] name = "autocfg" -version = "1.3.0" +version = "1.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0c4b4d0bd25bd0b74681c0ad21497610ce1b7c91b1022cd21c80c6fbdd9476b0" +checksum = "ace50bade8e6234aa140d9a2f552bbee1db4d353f69b8217bc503490fc1a9f26" [[package]] name = "bitflags" @@ -118,9 +118,9 @@ dependencies = [ [[package]] name = "multiversx-sc" -version = "0.53.1" +version = "0.53.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e05f8dfb9c2dd26feff1330b1e229f0886f5c0228ed570f19421a458e6e7b0ef" +checksum = "75ea89a26f0aacda21437a8ae5ccfbefab99d8191942b3d2eddbcbf84f9866d7" dependencies = [ "bitflags", "hex-literal", @@ -155,9 +155,9 @@ dependencies = [ [[package]] name = "multiversx-sc-derive" -version = "0.53.1" +version = "0.53.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f4b5176aa94b5e422e0d3c904492e0de0ae8381f166b563fbcac19a9ca4b28bc" +checksum = "4c17fdf90fafca2f19085ae67b0502d9f71bf8ab1be3c83808eb88e02a8c18b9" dependencies = [ "hex", "proc-macro2", @@ -168,18 +168,18 @@ dependencies = [ [[package]] name = "multiversx-sc-modules" -version = "0.53.1" +version = "0.53.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3cfb6046ec3cc6ef94351b4ca89907b2b74b2e4a7f376adc0af18ddd1c5a4367" +checksum = "daeb48acbd39255868a3241798df2f85050f0ae8d82d6417bd2cd0e30a241855" dependencies = [ "multiversx-sc", ] [[package]] name = "multiversx-sc-wasm-adapter" -version = "0.53.1" +version = "0.53.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9aa0cbd543872f94b9bc98c4ce7c3ed25a7257e1425295af9036eba44893bdaa" +checksum = "20659915a4377d375c46d7f237e810053a03f7e084fad6362dd5748a7233defb" dependencies = [ "multiversx-sc", ] @@ -291,9 +291,9 @@ dependencies = [ [[package]] name = "unicode-ident" -version = "1.0.12" +version = "1.0.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3354b9ac3fae1ff6755cb6db53683adb661634f67557942dea4facebec0fee4b" +checksum = "e91b56cd4cadaeb79bbf1a5645f6b4f8dc5bde8834ad5894a8db35fda9efa1fe" [[package]] name = "unwrap-infallible" diff --git a/enshrine-esdt-safe/wasm-enshrine-esdt-safe-view/Cargo.toml b/enshrine-esdt-safe/wasm-enshrine-esdt-safe-view/Cargo.toml index 20369a4d..73c5d920 100644 --- a/enshrine-esdt-safe/wasm-enshrine-esdt-safe-view/Cargo.toml +++ b/enshrine-esdt-safe/wasm-enshrine-esdt-safe-view/Cargo.toml @@ -28,7 +28,7 @@ panic = "abort" path = ".." [dependencies.multiversx-sc-wasm-adapter] -version = "=0.53.1" +version = "=0.53.2" [workspace] members = ["."] diff --git a/enshrine-esdt-safe/wasm/Cargo.lock b/enshrine-esdt-safe/wasm/Cargo.lock index 2fa94a69..f640e893 100644 --- a/enshrine-esdt-safe/wasm/Cargo.lock +++ b/enshrine-esdt-safe/wasm/Cargo.lock @@ -10,9 +10,9 @@ checksum = "7c02d123df017efcdfbd739ef81735b36c5ba83ec3c59c80a9d7ecc718f92e50" [[package]] name = "autocfg" -version = "1.3.0" +version = "1.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0c4b4d0bd25bd0b74681c0ad21497610ce1b7c91b1022cd21c80c6fbdd9476b0" +checksum = "ace50bade8e6234aa140d9a2f552bbee1db4d353f69b8217bc503490fc1a9f26" [[package]] name = "bitflags" @@ -118,9 +118,9 @@ dependencies = [ [[package]] name = "multiversx-sc" -version = "0.53.1" +version = "0.53.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e05f8dfb9c2dd26feff1330b1e229f0886f5c0228ed570f19421a458e6e7b0ef" +checksum = "75ea89a26f0aacda21437a8ae5ccfbefab99d8191942b3d2eddbcbf84f9866d7" dependencies = [ "bitflags", "hex-literal", @@ -155,9 +155,9 @@ dependencies = [ [[package]] name = "multiversx-sc-derive" -version = "0.53.1" +version = "0.53.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f4b5176aa94b5e422e0d3c904492e0de0ae8381f166b563fbcac19a9ca4b28bc" +checksum = "4c17fdf90fafca2f19085ae67b0502d9f71bf8ab1be3c83808eb88e02a8c18b9" dependencies = [ "hex", "proc-macro2", @@ -168,18 +168,18 @@ dependencies = [ [[package]] name = "multiversx-sc-modules" -version = "0.53.1" +version = "0.53.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3cfb6046ec3cc6ef94351b4ca89907b2b74b2e4a7f376adc0af18ddd1c5a4367" +checksum = "daeb48acbd39255868a3241798df2f85050f0ae8d82d6417bd2cd0e30a241855" dependencies = [ "multiversx-sc", ] [[package]] name = "multiversx-sc-wasm-adapter" -version = "0.53.1" +version = "0.53.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9aa0cbd543872f94b9bc98c4ce7c3ed25a7257e1425295af9036eba44893bdaa" +checksum = "20659915a4377d375c46d7f237e810053a03f7e084fad6362dd5748a7233defb" dependencies = [ "multiversx-sc", ] @@ -291,9 +291,9 @@ dependencies = [ [[package]] name = "unicode-ident" -version = "1.0.12" +version = "1.0.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3354b9ac3fae1ff6755cb6db53683adb661634f67557942dea4facebec0fee4b" +checksum = "e91b56cd4cadaeb79bbf1a5645f6b4f8dc5bde8834ad5894a8db35fda9efa1fe" [[package]] name = "unwrap-infallible" diff --git a/enshrine-esdt-safe/wasm/Cargo.toml b/enshrine-esdt-safe/wasm/Cargo.toml index 8edc5c62..fab206cf 100644 --- a/enshrine-esdt-safe/wasm/Cargo.toml +++ b/enshrine-esdt-safe/wasm/Cargo.toml @@ -28,7 +28,7 @@ panic = "abort" path = ".." [dependencies.multiversx-sc-wasm-adapter] -version = "=0.53.1" +version = "=0.53.2" [workspace] members = ["."] diff --git a/esdt-safe/Cargo.toml b/esdt-safe/Cargo.toml index 0446986a..7550e0f2 100644 --- a/esdt-safe/Cargo.toml +++ b/esdt-safe/Cargo.toml @@ -36,10 +36,10 @@ path = "../fee-market" path = "../header-verifier" [dependencies.multiversx-sc] -version = "=0.53.1" +version = "=0.53.2" [dependencies.multiversx-sc-modules] -version = "=0.53.1" +version = "=0.53.2" [dev-dependencies] num-bigint = "0.4.2" @@ -47,4 +47,4 @@ num-traits = "0.2" hex = "0.4" [dev-dependencies.multiversx-sc-scenario] -version = "=0.53.1" +version = "=0.53.2" diff --git a/esdt-safe/meta/Cargo.toml b/esdt-safe/meta/Cargo.toml index e01c2c40..b242d4ee 100644 --- a/esdt-safe/meta/Cargo.toml +++ b/esdt-safe/meta/Cargo.toml @@ -11,4 +11,4 @@ publish = false path = ".." [dependencies.multiversx-sc-meta-lib] -version = "=0.53.1" +version = "=0.53.2" diff --git a/esdt-safe/wasm-esdt-safe-full/Cargo.lock b/esdt-safe/wasm-esdt-safe-full/Cargo.lock index ef2e581d..a5162c4b 100644 --- a/esdt-safe/wasm-esdt-safe-full/Cargo.lock +++ b/esdt-safe/wasm-esdt-safe-full/Cargo.lock @@ -10,9 +10,9 @@ checksum = "7c02d123df017efcdfbd739ef81735b36c5ba83ec3c59c80a9d7ecc718f92e50" [[package]] name = "autocfg" -version = "1.3.0" +version = "1.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0c4b4d0bd25bd0b74681c0ad21497610ce1b7c91b1022cd21c80c6fbdd9476b0" +checksum = "ace50bade8e6234aa140d9a2f552bbee1db4d353f69b8217bc503490fc1a9f26" [[package]] name = "bitflags" @@ -99,9 +99,9 @@ dependencies = [ [[package]] name = "multiversx-sc" -version = "0.53.1" +version = "0.53.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e05f8dfb9c2dd26feff1330b1e229f0886f5c0228ed570f19421a458e6e7b0ef" +checksum = "75ea89a26f0aacda21437a8ae5ccfbefab99d8191942b3d2eddbcbf84f9866d7" dependencies = [ "bitflags", "hex-literal", @@ -136,9 +136,9 @@ dependencies = [ [[package]] name = "multiversx-sc-derive" -version = "0.53.1" +version = "0.53.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f4b5176aa94b5e422e0d3c904492e0de0ae8381f166b563fbcac19a9ca4b28bc" +checksum = "4c17fdf90fafca2f19085ae67b0502d9f71bf8ab1be3c83808eb88e02a8c18b9" dependencies = [ "hex", "proc-macro2", @@ -149,18 +149,18 @@ dependencies = [ [[package]] name = "multiversx-sc-modules" -version = "0.53.1" +version = "0.53.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3cfb6046ec3cc6ef94351b4ca89907b2b74b2e4a7f376adc0af18ddd1c5a4367" +checksum = "daeb48acbd39255868a3241798df2f85050f0ae8d82d6417bd2cd0e30a241855" dependencies = [ "multiversx-sc", ] [[package]] name = "multiversx-sc-wasm-adapter" -version = "0.53.1" +version = "0.53.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9aa0cbd543872f94b9bc98c4ce7c3ed25a7257e1425295af9036eba44893bdaa" +checksum = "20659915a4377d375c46d7f237e810053a03f7e084fad6362dd5748a7233defb" dependencies = [ "multiversx-sc", ] @@ -262,9 +262,9 @@ dependencies = [ [[package]] name = "unicode-ident" -version = "1.0.12" +version = "1.0.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3354b9ac3fae1ff6755cb6db53683adb661634f67557942dea4facebec0fee4b" +checksum = "e91b56cd4cadaeb79bbf1a5645f6b4f8dc5bde8834ad5894a8db35fda9efa1fe" [[package]] name = "unwrap-infallible" diff --git a/esdt-safe/wasm-esdt-safe-full/Cargo.toml b/esdt-safe/wasm-esdt-safe-full/Cargo.toml index 135d06a4..167d5173 100644 --- a/esdt-safe/wasm-esdt-safe-full/Cargo.toml +++ b/esdt-safe/wasm-esdt-safe-full/Cargo.toml @@ -28,7 +28,7 @@ panic = "abort" path = ".." [dependencies.multiversx-sc-wasm-adapter] -version = "=0.53.1" +version = "=0.53.2" [workspace] members = ["."] diff --git a/esdt-safe/wasm-esdt-safe-view/Cargo.lock b/esdt-safe/wasm-esdt-safe-view/Cargo.lock index 4073ba2a..b94ceaa7 100644 --- a/esdt-safe/wasm-esdt-safe-view/Cargo.lock +++ b/esdt-safe/wasm-esdt-safe-view/Cargo.lock @@ -10,9 +10,9 @@ checksum = "7c02d123df017efcdfbd739ef81735b36c5ba83ec3c59c80a9d7ecc718f92e50" [[package]] name = "autocfg" -version = "1.3.0" +version = "1.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0c4b4d0bd25bd0b74681c0ad21497610ce1b7c91b1022cd21c80c6fbdd9476b0" +checksum = "ace50bade8e6234aa140d9a2f552bbee1db4d353f69b8217bc503490fc1a9f26" [[package]] name = "bitflags" @@ -99,9 +99,9 @@ dependencies = [ [[package]] name = "multiversx-sc" -version = "0.53.1" +version = "0.53.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e05f8dfb9c2dd26feff1330b1e229f0886f5c0228ed570f19421a458e6e7b0ef" +checksum = "75ea89a26f0aacda21437a8ae5ccfbefab99d8191942b3d2eddbcbf84f9866d7" dependencies = [ "bitflags", "hex-literal", @@ -136,9 +136,9 @@ dependencies = [ [[package]] name = "multiversx-sc-derive" -version = "0.53.1" +version = "0.53.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f4b5176aa94b5e422e0d3c904492e0de0ae8381f166b563fbcac19a9ca4b28bc" +checksum = "4c17fdf90fafca2f19085ae67b0502d9f71bf8ab1be3c83808eb88e02a8c18b9" dependencies = [ "hex", "proc-macro2", @@ -149,18 +149,18 @@ dependencies = [ [[package]] name = "multiversx-sc-modules" -version = "0.53.1" +version = "0.53.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3cfb6046ec3cc6ef94351b4ca89907b2b74b2e4a7f376adc0af18ddd1c5a4367" +checksum = "daeb48acbd39255868a3241798df2f85050f0ae8d82d6417bd2cd0e30a241855" dependencies = [ "multiversx-sc", ] [[package]] name = "multiversx-sc-wasm-adapter" -version = "0.53.1" +version = "0.53.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9aa0cbd543872f94b9bc98c4ce7c3ed25a7257e1425295af9036eba44893bdaa" +checksum = "20659915a4377d375c46d7f237e810053a03f7e084fad6362dd5748a7233defb" dependencies = [ "multiversx-sc", ] @@ -262,9 +262,9 @@ dependencies = [ [[package]] name = "unicode-ident" -version = "1.0.12" +version = "1.0.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3354b9ac3fae1ff6755cb6db53683adb661634f67557942dea4facebec0fee4b" +checksum = "e91b56cd4cadaeb79bbf1a5645f6b4f8dc5bde8834ad5894a8db35fda9efa1fe" [[package]] name = "unwrap-infallible" diff --git a/esdt-safe/wasm-esdt-safe-view/Cargo.toml b/esdt-safe/wasm-esdt-safe-view/Cargo.toml index 72e8e214..4753497c 100644 --- a/esdt-safe/wasm-esdt-safe-view/Cargo.toml +++ b/esdt-safe/wasm-esdt-safe-view/Cargo.toml @@ -28,7 +28,7 @@ panic = "abort" path = ".." [dependencies.multiversx-sc-wasm-adapter] -version = "=0.53.1" +version = "=0.53.2" [workspace] members = ["."] diff --git a/esdt-safe/wasm/Cargo.lock b/esdt-safe/wasm/Cargo.lock index 0b6a5ce7..f19ccf47 100644 --- a/esdt-safe/wasm/Cargo.lock +++ b/esdt-safe/wasm/Cargo.lock @@ -10,9 +10,9 @@ checksum = "7c02d123df017efcdfbd739ef81735b36c5ba83ec3c59c80a9d7ecc718f92e50" [[package]] name = "autocfg" -version = "1.3.0" +version = "1.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0c4b4d0bd25bd0b74681c0ad21497610ce1b7c91b1022cd21c80c6fbdd9476b0" +checksum = "ace50bade8e6234aa140d9a2f552bbee1db4d353f69b8217bc503490fc1a9f26" [[package]] name = "bitflags" @@ -99,9 +99,9 @@ dependencies = [ [[package]] name = "multiversx-sc" -version = "0.53.1" +version = "0.53.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e05f8dfb9c2dd26feff1330b1e229f0886f5c0228ed570f19421a458e6e7b0ef" +checksum = "75ea89a26f0aacda21437a8ae5ccfbefab99d8191942b3d2eddbcbf84f9866d7" dependencies = [ "bitflags", "hex-literal", @@ -136,9 +136,9 @@ dependencies = [ [[package]] name = "multiversx-sc-derive" -version = "0.53.1" +version = "0.53.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f4b5176aa94b5e422e0d3c904492e0de0ae8381f166b563fbcac19a9ca4b28bc" +checksum = "4c17fdf90fafca2f19085ae67b0502d9f71bf8ab1be3c83808eb88e02a8c18b9" dependencies = [ "hex", "proc-macro2", @@ -149,18 +149,18 @@ dependencies = [ [[package]] name = "multiversx-sc-modules" -version = "0.53.1" +version = "0.53.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3cfb6046ec3cc6ef94351b4ca89907b2b74b2e4a7f376adc0af18ddd1c5a4367" +checksum = "daeb48acbd39255868a3241798df2f85050f0ae8d82d6417bd2cd0e30a241855" dependencies = [ "multiversx-sc", ] [[package]] name = "multiversx-sc-wasm-adapter" -version = "0.53.1" +version = "0.53.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9aa0cbd543872f94b9bc98c4ce7c3ed25a7257e1425295af9036eba44893bdaa" +checksum = "20659915a4377d375c46d7f237e810053a03f7e084fad6362dd5748a7233defb" dependencies = [ "multiversx-sc", ] @@ -262,9 +262,9 @@ dependencies = [ [[package]] name = "unicode-ident" -version = "1.0.12" +version = "1.0.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3354b9ac3fae1ff6755cb6db53683adb661634f67557942dea4facebec0fee4b" +checksum = "e91b56cd4cadaeb79bbf1a5645f6b4f8dc5bde8834ad5894a8db35fda9efa1fe" [[package]] name = "unwrap-infallible" diff --git a/esdt-safe/wasm/Cargo.toml b/esdt-safe/wasm/Cargo.toml index 6d4995dd..f2ef2089 100644 --- a/esdt-safe/wasm/Cargo.toml +++ b/esdt-safe/wasm/Cargo.toml @@ -28,7 +28,7 @@ panic = "abort" path = ".." [dependencies.multiversx-sc-wasm-adapter] -version = "=0.53.1" +version = "=0.53.2" [workspace] members = ["."] diff --git a/fee-market/Cargo.toml b/fee-market/Cargo.toml index eca63495..f4b3423a 100644 --- a/fee-market/Cargo.toml +++ b/fee-market/Cargo.toml @@ -18,10 +18,10 @@ path = "../common/transaction" path = "../common/bls-signature" [dependencies.multiversx-sc] -version = "=0.53.1" +version = "=0.53.2" [dev-dependencies] num-bigint = "0.4.2" [dev-dependencies.multiversx-sc-scenario] -version = "=0.53.1" +version = "=0.53.2" diff --git a/fee-market/meta/Cargo.toml b/fee-market/meta/Cargo.toml index 28f67f70..41b8b31a 100644 --- a/fee-market/meta/Cargo.toml +++ b/fee-market/meta/Cargo.toml @@ -8,5 +8,5 @@ publish = false path = ".." [dependencies.multiversx-sc-meta-lib] -version = "=0.53.1" +version = "=0.53.2" default-features = false diff --git a/fee-market/wasm-fee-marker-full/Cargo.lock b/fee-market/wasm-fee-marker-full/Cargo.lock index d9c9d464..6d42739d 100644 --- a/fee-market/wasm-fee-marker-full/Cargo.lock +++ b/fee-market/wasm-fee-marker-full/Cargo.lock @@ -10,9 +10,9 @@ checksum = "7c02d123df017efcdfbd739ef81735b36c5ba83ec3c59c80a9d7ecc718f92e50" [[package]] name = "autocfg" -version = "1.3.0" +version = "1.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0c4b4d0bd25bd0b74681c0ad21497610ce1b7c91b1022cd21c80c6fbdd9476b0" +checksum = "ace50bade8e6234aa140d9a2f552bbee1db4d353f69b8217bc503490fc1a9f26" [[package]] name = "bitflags" @@ -66,9 +66,9 @@ checksum = "6fe2267d4ed49bc07b63801559be28c718ea06c4738b7a03c94df7386d2cde46" [[package]] name = "multiversx-sc" -version = "0.53.1" +version = "0.53.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e05f8dfb9c2dd26feff1330b1e229f0886f5c0228ed570f19421a458e6e7b0ef" +checksum = "75ea89a26f0aacda21437a8ae5ccfbefab99d8191942b3d2eddbcbf84f9866d7" dependencies = [ "bitflags", "hex-literal", @@ -103,9 +103,9 @@ dependencies = [ [[package]] name = "multiversx-sc-derive" -version = "0.53.1" +version = "0.53.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f4b5176aa94b5e422e0d3c904492e0de0ae8381f166b563fbcac19a9ca4b28bc" +checksum = "4c17fdf90fafca2f19085ae67b0502d9f71bf8ab1be3c83808eb88e02a8c18b9" dependencies = [ "hex", "proc-macro2", @@ -116,9 +116,9 @@ dependencies = [ [[package]] name = "multiversx-sc-wasm-adapter" -version = "0.53.1" +version = "0.53.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9aa0cbd543872f94b9bc98c4ce7c3ed25a7257e1425295af9036eba44893bdaa" +checksum = "20659915a4377d375c46d7f237e810053a03f7e084fad6362dd5748a7233defb" dependencies = [ "multiversx-sc", ] @@ -195,9 +195,9 @@ dependencies = [ [[package]] name = "unicode-ident" -version = "1.0.12" +version = "1.0.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3354b9ac3fae1ff6755cb6db53683adb661634f67557942dea4facebec0fee4b" +checksum = "e91b56cd4cadaeb79bbf1a5645f6b4f8dc5bde8834ad5894a8db35fda9efa1fe" [[package]] name = "unwrap-infallible" diff --git a/fee-market/wasm-fee-marker-full/Cargo.toml b/fee-market/wasm-fee-marker-full/Cargo.toml index 9bef5fca..d2522cb0 100644 --- a/fee-market/wasm-fee-marker-full/Cargo.toml +++ b/fee-market/wasm-fee-marker-full/Cargo.toml @@ -28,7 +28,7 @@ panic = "abort" path = ".." [dependencies.multiversx-sc-wasm-adapter] -version = "=0.53.1" +version = "=0.53.2" [workspace] members = ["."] diff --git a/fee-market/wasm-multisig-view/Cargo.lock b/fee-market/wasm-multisig-view/Cargo.lock index c6ba5733..e72e7c7f 100644 --- a/fee-market/wasm-multisig-view/Cargo.lock +++ b/fee-market/wasm-multisig-view/Cargo.lock @@ -10,9 +10,9 @@ checksum = "7c02d123df017efcdfbd739ef81735b36c5ba83ec3c59c80a9d7ecc718f92e50" [[package]] name = "autocfg" -version = "1.3.0" +version = "1.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0c4b4d0bd25bd0b74681c0ad21497610ce1b7c91b1022cd21c80c6fbdd9476b0" +checksum = "ace50bade8e6234aa140d9a2f552bbee1db4d353f69b8217bc503490fc1a9f26" [[package]] name = "bitflags" @@ -66,9 +66,9 @@ dependencies = [ [[package]] name = "multiversx-sc" -version = "0.53.1" +version = "0.53.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e05f8dfb9c2dd26feff1330b1e229f0886f5c0228ed570f19421a458e6e7b0ef" +checksum = "75ea89a26f0aacda21437a8ae5ccfbefab99d8191942b3d2eddbcbf84f9866d7" dependencies = [ "bitflags", "hex-literal", @@ -103,9 +103,9 @@ dependencies = [ [[package]] name = "multiversx-sc-derive" -version = "0.53.1" +version = "0.53.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f4b5176aa94b5e422e0d3c904492e0de0ae8381f166b563fbcac19a9ca4b28bc" +checksum = "4c17fdf90fafca2f19085ae67b0502d9f71bf8ab1be3c83808eb88e02a8c18b9" dependencies = [ "hex", "proc-macro2", @@ -116,9 +116,9 @@ dependencies = [ [[package]] name = "multiversx-sc-wasm-adapter" -version = "0.53.1" +version = "0.53.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9aa0cbd543872f94b9bc98c4ce7c3ed25a7257e1425295af9036eba44893bdaa" +checksum = "20659915a4377d375c46d7f237e810053a03f7e084fad6362dd5748a7233defb" dependencies = [ "multiversx-sc", ] @@ -195,9 +195,9 @@ dependencies = [ [[package]] name = "unicode-ident" -version = "1.0.12" +version = "1.0.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3354b9ac3fae1ff6755cb6db53683adb661634f67557942dea4facebec0fee4b" +checksum = "e91b56cd4cadaeb79bbf1a5645f6b4f8dc5bde8834ad5894a8db35fda9efa1fe" [[package]] name = "unwrap-infallible" diff --git a/fee-market/wasm-multisig-view/Cargo.toml b/fee-market/wasm-multisig-view/Cargo.toml index de4d4718..5ede84bd 100644 --- a/fee-market/wasm-multisig-view/Cargo.toml +++ b/fee-market/wasm-multisig-view/Cargo.toml @@ -28,7 +28,7 @@ panic = "abort" path = ".." [dependencies.multiversx-sc-wasm-adapter] -version = "=0.53.1" +version = "=0.53.2" [workspace] members = ["."] diff --git a/fee-market/wasm/Cargo.lock b/fee-market/wasm/Cargo.lock index 9cfc7c0f..4381e40d 100644 --- a/fee-market/wasm/Cargo.lock +++ b/fee-market/wasm/Cargo.lock @@ -10,9 +10,9 @@ checksum = "7c02d123df017efcdfbd739ef81735b36c5ba83ec3c59c80a9d7ecc718f92e50" [[package]] name = "autocfg" -version = "1.3.0" +version = "1.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0c4b4d0bd25bd0b74681c0ad21497610ce1b7c91b1022cd21c80c6fbdd9476b0" +checksum = "ace50bade8e6234aa140d9a2f552bbee1db4d353f69b8217bc503490fc1a9f26" [[package]] name = "bitflags" @@ -66,9 +66,9 @@ checksum = "6fe2267d4ed49bc07b63801559be28c718ea06c4738b7a03c94df7386d2cde46" [[package]] name = "multiversx-sc" -version = "0.53.1" +version = "0.53.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e05f8dfb9c2dd26feff1330b1e229f0886f5c0228ed570f19421a458e6e7b0ef" +checksum = "75ea89a26f0aacda21437a8ae5ccfbefab99d8191942b3d2eddbcbf84f9866d7" dependencies = [ "bitflags", "hex-literal", @@ -103,9 +103,9 @@ dependencies = [ [[package]] name = "multiversx-sc-derive" -version = "0.53.1" +version = "0.53.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f4b5176aa94b5e422e0d3c904492e0de0ae8381f166b563fbcac19a9ca4b28bc" +checksum = "4c17fdf90fafca2f19085ae67b0502d9f71bf8ab1be3c83808eb88e02a8c18b9" dependencies = [ "hex", "proc-macro2", @@ -116,9 +116,9 @@ dependencies = [ [[package]] name = "multiversx-sc-wasm-adapter" -version = "0.53.1" +version = "0.53.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9aa0cbd543872f94b9bc98c4ce7c3ed25a7257e1425295af9036eba44893bdaa" +checksum = "20659915a4377d375c46d7f237e810053a03f7e084fad6362dd5748a7233defb" dependencies = [ "multiversx-sc", ] @@ -195,9 +195,9 @@ dependencies = [ [[package]] name = "unicode-ident" -version = "1.0.12" +version = "1.0.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3354b9ac3fae1ff6755cb6db53683adb661634f67557942dea4facebec0fee4b" +checksum = "e91b56cd4cadaeb79bbf1a5645f6b4f8dc5bde8834ad5894a8db35fda9efa1fe" [[package]] name = "unwrap-infallible" diff --git a/fee-market/wasm/Cargo.toml b/fee-market/wasm/Cargo.toml index 537b7554..370fa907 100644 --- a/fee-market/wasm/Cargo.toml +++ b/fee-market/wasm/Cargo.toml @@ -28,7 +28,7 @@ panic = "abort" path = ".." [dependencies.multiversx-sc-wasm-adapter] -version = "=0.53.1" +version = "=0.53.2" [workspace] members = ["."] diff --git a/header-verifier/Cargo.toml b/header-verifier/Cargo.toml index 59ab99ce..4e5a6c94 100644 --- a/header-verifier/Cargo.toml +++ b/header-verifier/Cargo.toml @@ -9,7 +9,7 @@ publish = false path = "src/lib.rs" [dependencies.multiversx-sc] -version = "0.53.1" +version = "0.53.2" [dependencies.bls-signature] path = "../common/bls-signature" @@ -21,4 +21,4 @@ path = "../common/transaction" num-bigint = "0.4.2" [dev-dependencies.multiversx-sc-scenario] -version = "0.53.1" +version = "0.53.2" diff --git a/header-verifier/meta/Cargo.toml b/header-verifier/meta/Cargo.toml index 28c50118..bb33e707 100644 --- a/header-verifier/meta/Cargo.toml +++ b/header-verifier/meta/Cargo.toml @@ -8,5 +8,5 @@ publish = false path = ".." [dependencies.multiversx-sc-meta-lib] -version = "0.53.1" +version = "0.53.2" default-features = false diff --git a/header-verifier/wasm-header-verifier-full/Cargo.lock b/header-verifier/wasm-header-verifier-full/Cargo.lock index bca57c41..f719a19c 100644 --- a/header-verifier/wasm-header-verifier-full/Cargo.lock +++ b/header-verifier/wasm-header-verifier-full/Cargo.lock @@ -10,9 +10,9 @@ checksum = "7c02d123df017efcdfbd739ef81735b36c5ba83ec3c59c80a9d7ecc718f92e50" [[package]] name = "autocfg" -version = "1.3.0" +version = "1.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0c4b4d0bd25bd0b74681c0ad21497610ce1b7c91b1022cd21c80c6fbdd9476b0" +checksum = "ace50bade8e6234aa140d9a2f552bbee1db4d353f69b8217bc503490fc1a9f26" [[package]] name = "bitflags" @@ -65,9 +65,9 @@ checksum = "6fe2267d4ed49bc07b63801559be28c718ea06c4738b7a03c94df7386d2cde46" [[package]] name = "multiversx-sc" -version = "0.53.1" +version = "0.53.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e05f8dfb9c2dd26feff1330b1e229f0886f5c0228ed570f19421a458e6e7b0ef" +checksum = "75ea89a26f0aacda21437a8ae5ccfbefab99d8191942b3d2eddbcbf84f9866d7" dependencies = [ "bitflags", "hex-literal", @@ -102,9 +102,9 @@ dependencies = [ [[package]] name = "multiversx-sc-derive" -version = "0.53.1" +version = "0.53.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f4b5176aa94b5e422e0d3c904492e0de0ae8381f166b563fbcac19a9ca4b28bc" +checksum = "4c17fdf90fafca2f19085ae67b0502d9f71bf8ab1be3c83808eb88e02a8c18b9" dependencies = [ "hex", "proc-macro2", @@ -115,9 +115,9 @@ dependencies = [ [[package]] name = "multiversx-sc-wasm-adapter" -version = "0.53.1" +version = "0.53.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9aa0cbd543872f94b9bc98c4ce7c3ed25a7257e1425295af9036eba44893bdaa" +checksum = "20659915a4377d375c46d7f237e810053a03f7e084fad6362dd5748a7233defb" dependencies = [ "multiversx-sc", ] @@ -194,9 +194,9 @@ dependencies = [ [[package]] name = "unicode-ident" -version = "1.0.12" +version = "1.0.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3354b9ac3fae1ff6755cb6db53683adb661634f67557942dea4facebec0fee4b" +checksum = "e91b56cd4cadaeb79bbf1a5645f6b4f8dc5bde8834ad5894a8db35fda9efa1fe" [[package]] name = "unwrap-infallible" diff --git a/header-verifier/wasm-header-verifier-full/Cargo.toml b/header-verifier/wasm-header-verifier-full/Cargo.toml index f4de6c91..bc788ca8 100644 --- a/header-verifier/wasm-header-verifier-full/Cargo.toml +++ b/header-verifier/wasm-header-verifier-full/Cargo.toml @@ -28,7 +28,7 @@ panic = "abort" path = ".." [dependencies.multiversx-sc-wasm-adapter] -version = "0.53.1" +version = "0.53.2" [workspace] members = ["."] diff --git a/header-verifier/wasm-multisig-view/Cargo.lock b/header-verifier/wasm-multisig-view/Cargo.lock index 06233ac3..93d97a39 100644 --- a/header-verifier/wasm-multisig-view/Cargo.lock +++ b/header-verifier/wasm-multisig-view/Cargo.lock @@ -10,9 +10,9 @@ checksum = "7c02d123df017efcdfbd739ef81735b36c5ba83ec3c59c80a9d7ecc718f92e50" [[package]] name = "autocfg" -version = "1.3.0" +version = "1.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0c4b4d0bd25bd0b74681c0ad21497610ce1b7c91b1022cd21c80c6fbdd9476b0" +checksum = "ace50bade8e6234aa140d9a2f552bbee1db4d353f69b8217bc503490fc1a9f26" [[package]] name = "bitflags" @@ -65,9 +65,9 @@ dependencies = [ [[package]] name = "multiversx-sc" -version = "0.53.1" +version = "0.53.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e05f8dfb9c2dd26feff1330b1e229f0886f5c0228ed570f19421a458e6e7b0ef" +checksum = "75ea89a26f0aacda21437a8ae5ccfbefab99d8191942b3d2eddbcbf84f9866d7" dependencies = [ "bitflags", "hex-literal", @@ -102,9 +102,9 @@ dependencies = [ [[package]] name = "multiversx-sc-derive" -version = "0.53.1" +version = "0.53.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f4b5176aa94b5e422e0d3c904492e0de0ae8381f166b563fbcac19a9ca4b28bc" +checksum = "4c17fdf90fafca2f19085ae67b0502d9f71bf8ab1be3c83808eb88e02a8c18b9" dependencies = [ "hex", "proc-macro2", @@ -115,9 +115,9 @@ dependencies = [ [[package]] name = "multiversx-sc-wasm-adapter" -version = "0.53.1" +version = "0.53.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9aa0cbd543872f94b9bc98c4ce7c3ed25a7257e1425295af9036eba44893bdaa" +checksum = "20659915a4377d375c46d7f237e810053a03f7e084fad6362dd5748a7233defb" dependencies = [ "multiversx-sc", ] @@ -194,9 +194,9 @@ dependencies = [ [[package]] name = "unicode-ident" -version = "1.0.12" +version = "1.0.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3354b9ac3fae1ff6755cb6db53683adb661634f67557942dea4facebec0fee4b" +checksum = "e91b56cd4cadaeb79bbf1a5645f6b4f8dc5bde8834ad5894a8db35fda9efa1fe" [[package]] name = "unwrap-infallible" diff --git a/header-verifier/wasm-multisig-view/Cargo.toml b/header-verifier/wasm-multisig-view/Cargo.toml index e99867bb..640694e4 100644 --- a/header-verifier/wasm-multisig-view/Cargo.toml +++ b/header-verifier/wasm-multisig-view/Cargo.toml @@ -28,7 +28,7 @@ panic = "abort" path = ".." [dependencies.multiversx-sc-wasm-adapter] -version = "0.53.1" +version = "0.53.2" [workspace] members = ["."] diff --git a/header-verifier/wasm/Cargo.lock b/header-verifier/wasm/Cargo.lock index 361892b4..6dd608cb 100644 --- a/header-verifier/wasm/Cargo.lock +++ b/header-verifier/wasm/Cargo.lock @@ -10,9 +10,9 @@ checksum = "7c02d123df017efcdfbd739ef81735b36c5ba83ec3c59c80a9d7ecc718f92e50" [[package]] name = "autocfg" -version = "1.3.0" +version = "1.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0c4b4d0bd25bd0b74681c0ad21497610ce1b7c91b1022cd21c80c6fbdd9476b0" +checksum = "ace50bade8e6234aa140d9a2f552bbee1db4d353f69b8217bc503490fc1a9f26" [[package]] name = "bitflags" @@ -65,9 +65,9 @@ checksum = "6fe2267d4ed49bc07b63801559be28c718ea06c4738b7a03c94df7386d2cde46" [[package]] name = "multiversx-sc" -version = "0.53.1" +version = "0.53.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e05f8dfb9c2dd26feff1330b1e229f0886f5c0228ed570f19421a458e6e7b0ef" +checksum = "75ea89a26f0aacda21437a8ae5ccfbefab99d8191942b3d2eddbcbf84f9866d7" dependencies = [ "bitflags", "hex-literal", @@ -102,9 +102,9 @@ dependencies = [ [[package]] name = "multiversx-sc-derive" -version = "0.53.1" +version = "0.53.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f4b5176aa94b5e422e0d3c904492e0de0ae8381f166b563fbcac19a9ca4b28bc" +checksum = "4c17fdf90fafca2f19085ae67b0502d9f71bf8ab1be3c83808eb88e02a8c18b9" dependencies = [ "hex", "proc-macro2", @@ -115,9 +115,9 @@ dependencies = [ [[package]] name = "multiversx-sc-wasm-adapter" -version = "0.53.1" +version = "0.53.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9aa0cbd543872f94b9bc98c4ce7c3ed25a7257e1425295af9036eba44893bdaa" +checksum = "20659915a4377d375c46d7f237e810053a03f7e084fad6362dd5748a7233defb" dependencies = [ "multiversx-sc", ] @@ -194,9 +194,9 @@ dependencies = [ [[package]] name = "unicode-ident" -version = "1.0.12" +version = "1.0.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3354b9ac3fae1ff6755cb6db53683adb661634f67557942dea4facebec0fee4b" +checksum = "e91b56cd4cadaeb79bbf1a5645f6b4f8dc5bde8834ad5894a8db35fda9efa1fe" [[package]] name = "unwrap-infallible" diff --git a/header-verifier/wasm/Cargo.toml b/header-verifier/wasm/Cargo.toml index e38bcab7..0ea44624 100644 --- a/header-verifier/wasm/Cargo.toml +++ b/header-verifier/wasm/Cargo.toml @@ -28,7 +28,7 @@ panic = "abort" path = ".." [dependencies.multiversx-sc-wasm-adapter] -version = "0.53.1" +version = "0.53.2" [workspace] members = ["."] diff --git a/token-handler/Cargo.toml b/token-handler/Cargo.toml index f3e916a1..32c0ce09 100644 --- a/token-handler/Cargo.toml +++ b/token-handler/Cargo.toml @@ -18,10 +18,10 @@ path = "../header-verifier/" path = "../chain-factory/" [dependencies.multiversx-sc] -version = "0.53.1" +version = "0.53.2" [dev-dependencies] num-bigint = "0.4" [dev-dependencies.multiversx-sc-scenario] -version = "0.53.1" +version = "0.53.2" diff --git a/token-handler/meta/Cargo.toml b/token-handler/meta/Cargo.toml index c4478431..760fb5d4 100644 --- a/token-handler/meta/Cargo.toml +++ b/token-handler/meta/Cargo.toml @@ -8,5 +8,5 @@ publish = false path = ".." [dependencies.multiversx-sc-meta-lib] -version = "0.53.1" +version = "0.53.2" default-features = false diff --git a/token-handler/wasm-token-handler-full/Cargo.lock b/token-handler/wasm-token-handler-full/Cargo.lock index 64ab9511..5b20cc34 100644 --- a/token-handler/wasm-token-handler-full/Cargo.lock +++ b/token-handler/wasm-token-handler-full/Cargo.lock @@ -10,9 +10,9 @@ checksum = "7c02d123df017efcdfbd739ef81735b36c5ba83ec3c59c80a9d7ecc718f92e50" [[package]] name = "autocfg" -version = "1.3.0" +version = "1.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0c4b4d0bd25bd0b74681c0ad21497610ce1b7c91b1022cd21c80c6fbdd9476b0" +checksum = "ace50bade8e6234aa140d9a2f552bbee1db4d353f69b8217bc503490fc1a9f26" [[package]] name = "bitflags" @@ -75,9 +75,9 @@ checksum = "6fe2267d4ed49bc07b63801559be28c718ea06c4738b7a03c94df7386d2cde46" [[package]] name = "multiversx-sc" -version = "0.53.1" +version = "0.53.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e05f8dfb9c2dd26feff1330b1e229f0886f5c0228ed570f19421a458e6e7b0ef" +checksum = "75ea89a26f0aacda21437a8ae5ccfbefab99d8191942b3d2eddbcbf84f9866d7" dependencies = [ "bitflags", "hex-literal", @@ -112,9 +112,9 @@ dependencies = [ [[package]] name = "multiversx-sc-derive" -version = "0.53.1" +version = "0.53.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f4b5176aa94b5e422e0d3c904492e0de0ae8381f166b563fbcac19a9ca4b28bc" +checksum = "4c17fdf90fafca2f19085ae67b0502d9f71bf8ab1be3c83808eb88e02a8c18b9" dependencies = [ "hex", "proc-macro2", @@ -125,18 +125,18 @@ dependencies = [ [[package]] name = "multiversx-sc-modules" -version = "0.53.1" +version = "0.53.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3cfb6046ec3cc6ef94351b4ca89907b2b74b2e4a7f376adc0af18ddd1c5a4367" +checksum = "daeb48acbd39255868a3241798df2f85050f0ae8d82d6417bd2cd0e30a241855" dependencies = [ "multiversx-sc", ] [[package]] name = "multiversx-sc-wasm-adapter" -version = "0.53.1" +version = "0.53.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9aa0cbd543872f94b9bc98c4ce7c3ed25a7257e1425295af9036eba44893bdaa" +checksum = "20659915a4377d375c46d7f237e810053a03f7e084fad6362dd5748a7233defb" dependencies = [ "multiversx-sc", ] @@ -231,9 +231,9 @@ dependencies = [ [[package]] name = "unicode-ident" -version = "1.0.12" +version = "1.0.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3354b9ac3fae1ff6755cb6db53683adb661634f67557942dea4facebec0fee4b" +checksum = "e91b56cd4cadaeb79bbf1a5645f6b4f8dc5bde8834ad5894a8db35fda9efa1fe" [[package]] name = "unwrap-infallible" diff --git a/token-handler/wasm-token-handler-full/Cargo.toml b/token-handler/wasm-token-handler-full/Cargo.toml index 6c9e8221..fa693534 100644 --- a/token-handler/wasm-token-handler-full/Cargo.toml +++ b/token-handler/wasm-token-handler-full/Cargo.toml @@ -28,7 +28,7 @@ panic = "abort" path = ".." [dependencies.multiversx-sc-wasm-adapter] -version = "0.53.1" +version = "0.53.2" [workspace] members = ["."] diff --git a/token-handler/wasm-token-handler-view/Cargo.lock b/token-handler/wasm-token-handler-view/Cargo.lock index 2761a4b9..9a277cac 100644 --- a/token-handler/wasm-token-handler-view/Cargo.lock +++ b/token-handler/wasm-token-handler-view/Cargo.lock @@ -10,9 +10,9 @@ checksum = "7c02d123df017efcdfbd739ef81735b36c5ba83ec3c59c80a9d7ecc718f92e50" [[package]] name = "autocfg" -version = "1.3.0" +version = "1.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0c4b4d0bd25bd0b74681c0ad21497610ce1b7c91b1022cd21c80c6fbdd9476b0" +checksum = "ace50bade8e6234aa140d9a2f552bbee1db4d353f69b8217bc503490fc1a9f26" [[package]] name = "bitflags" @@ -75,9 +75,9 @@ checksum = "6fe2267d4ed49bc07b63801559be28c718ea06c4738b7a03c94df7386d2cde46" [[package]] name = "multiversx-sc" -version = "0.53.1" +version = "0.53.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e05f8dfb9c2dd26feff1330b1e229f0886f5c0228ed570f19421a458e6e7b0ef" +checksum = "75ea89a26f0aacda21437a8ae5ccfbefab99d8191942b3d2eddbcbf84f9866d7" dependencies = [ "bitflags", "hex-literal", @@ -112,9 +112,9 @@ dependencies = [ [[package]] name = "multiversx-sc-derive" -version = "0.53.1" +version = "0.53.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f4b5176aa94b5e422e0d3c904492e0de0ae8381f166b563fbcac19a9ca4b28bc" +checksum = "4c17fdf90fafca2f19085ae67b0502d9f71bf8ab1be3c83808eb88e02a8c18b9" dependencies = [ "hex", "proc-macro2", @@ -125,18 +125,18 @@ dependencies = [ [[package]] name = "multiversx-sc-modules" -version = "0.53.1" +version = "0.53.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3cfb6046ec3cc6ef94351b4ca89907b2b74b2e4a7f376adc0af18ddd1c5a4367" +checksum = "daeb48acbd39255868a3241798df2f85050f0ae8d82d6417bd2cd0e30a241855" dependencies = [ "multiversx-sc", ] [[package]] name = "multiversx-sc-wasm-adapter" -version = "0.53.1" +version = "0.53.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9aa0cbd543872f94b9bc98c4ce7c3ed25a7257e1425295af9036eba44893bdaa" +checksum = "20659915a4377d375c46d7f237e810053a03f7e084fad6362dd5748a7233defb" dependencies = [ "multiversx-sc", ] @@ -231,9 +231,9 @@ dependencies = [ [[package]] name = "unicode-ident" -version = "1.0.12" +version = "1.0.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3354b9ac3fae1ff6755cb6db53683adb661634f67557942dea4facebec0fee4b" +checksum = "e91b56cd4cadaeb79bbf1a5645f6b4f8dc5bde8834ad5894a8db35fda9efa1fe" [[package]] name = "unwrap-infallible" diff --git a/token-handler/wasm-token-handler-view/Cargo.toml b/token-handler/wasm-token-handler-view/Cargo.toml index 411222a7..6b216bf5 100644 --- a/token-handler/wasm-token-handler-view/Cargo.toml +++ b/token-handler/wasm-token-handler-view/Cargo.toml @@ -28,7 +28,7 @@ panic = "abort" path = ".." [dependencies.multiversx-sc-wasm-adapter] -version = "0.53.1" +version = "0.53.2" [workspace] members = ["."] diff --git a/token-handler/wasm/Cargo.lock b/token-handler/wasm/Cargo.lock index a3e476f5..0b097205 100644 --- a/token-handler/wasm/Cargo.lock +++ b/token-handler/wasm/Cargo.lock @@ -10,9 +10,9 @@ checksum = "7c02d123df017efcdfbd739ef81735b36c5ba83ec3c59c80a9d7ecc718f92e50" [[package]] name = "autocfg" -version = "1.3.0" +version = "1.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0c4b4d0bd25bd0b74681c0ad21497610ce1b7c91b1022cd21c80c6fbdd9476b0" +checksum = "ace50bade8e6234aa140d9a2f552bbee1db4d353f69b8217bc503490fc1a9f26" [[package]] name = "bitflags" @@ -75,9 +75,9 @@ checksum = "6fe2267d4ed49bc07b63801559be28c718ea06c4738b7a03c94df7386d2cde46" [[package]] name = "multiversx-sc" -version = "0.53.1" +version = "0.53.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e05f8dfb9c2dd26feff1330b1e229f0886f5c0228ed570f19421a458e6e7b0ef" +checksum = "75ea89a26f0aacda21437a8ae5ccfbefab99d8191942b3d2eddbcbf84f9866d7" dependencies = [ "bitflags", "hex-literal", @@ -112,9 +112,9 @@ dependencies = [ [[package]] name = "multiversx-sc-derive" -version = "0.53.1" +version = "0.53.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f4b5176aa94b5e422e0d3c904492e0de0ae8381f166b563fbcac19a9ca4b28bc" +checksum = "4c17fdf90fafca2f19085ae67b0502d9f71bf8ab1be3c83808eb88e02a8c18b9" dependencies = [ "hex", "proc-macro2", @@ -125,18 +125,18 @@ dependencies = [ [[package]] name = "multiversx-sc-modules" -version = "0.53.1" +version = "0.53.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3cfb6046ec3cc6ef94351b4ca89907b2b74b2e4a7f376adc0af18ddd1c5a4367" +checksum = "daeb48acbd39255868a3241798df2f85050f0ae8d82d6417bd2cd0e30a241855" dependencies = [ "multiversx-sc", ] [[package]] name = "multiversx-sc-wasm-adapter" -version = "0.53.1" +version = "0.53.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9aa0cbd543872f94b9bc98c4ce7c3ed25a7257e1425295af9036eba44893bdaa" +checksum = "20659915a4377d375c46d7f237e810053a03f7e084fad6362dd5748a7233defb" dependencies = [ "multiversx-sc", ] @@ -231,9 +231,9 @@ dependencies = [ [[package]] name = "unicode-ident" -version = "1.0.12" +version = "1.0.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3354b9ac3fae1ff6755cb6db53683adb661634f67557942dea4facebec0fee4b" +checksum = "e91b56cd4cadaeb79bbf1a5645f6b4f8dc5bde8834ad5894a8db35fda9efa1fe" [[package]] name = "unwrap-infallible" diff --git a/token-handler/wasm/Cargo.toml b/token-handler/wasm/Cargo.toml index f2f911f3..f322c589 100644 --- a/token-handler/wasm/Cargo.toml +++ b/token-handler/wasm/Cargo.toml @@ -28,7 +28,7 @@ panic = "abort" path = ".." [dependencies.multiversx-sc-wasm-adapter] -version = "0.53.1" +version = "0.53.2" [workspace] members = ["."] From 1ad1aec7e97f0dd18da18c9208ec0fe4fb264fd5 Mon Sep 17 00:00:00 2001 From: sergiuosvat Date: Mon, 14 Oct 2024 10:21:32 +0300 Subject: [PATCH 408/523] init and few interactor tests for esdt --- esdt-safe/interactor/Cargo.toml | 3 + .../contract-codes/fee-market.mxsc.json | 347 ++++++++++ .../multiversx-price-aggregator-sc.mxsc.json | 593 ++++++++++++++++++ esdt-safe/interactor/src/fee_market_proxy.rs | 278 ++++++++ esdt-safe/interactor/src/interactor_main.rs | 382 ++++++++--- .../interactor/src/price_aggregator_proxy.rs | 416 ++++++++++++ esdt-safe/interactor/state.toml | 4 +- 7 files changed, 1935 insertions(+), 88 deletions(-) create mode 100644 esdt-safe/interactor/contract-codes/fee-market.mxsc.json create mode 100644 esdt-safe/interactor/contract-codes/multiversx-price-aggregator-sc.mxsc.json create mode 100644 esdt-safe/interactor/src/fee_market_proxy.rs create mode 100644 esdt-safe/interactor/src/price_aggregator_proxy.rs diff --git a/esdt-safe/interactor/Cargo.toml b/esdt-safe/interactor/Cargo.toml index 96dfd4f7..1ffd3c12 100644 --- a/esdt-safe/interactor/Cargo.toml +++ b/esdt-safe/interactor/Cargo.toml @@ -18,6 +18,9 @@ path = "../../common/transaction" [dependencies.tx-batch-module] path = "../../common/tx-batch-module" +[dependencies.fee-market] +path = "../../fee-market" + [dependencies.multiversx-sc-snippets] version = "0.53.1" diff --git a/esdt-safe/interactor/contract-codes/fee-market.mxsc.json b/esdt-safe/interactor/contract-codes/fee-market.mxsc.json new file mode 100644 index 00000000..a6fce293 --- /dev/null +++ b/esdt-safe/interactor/contract-codes/fee-market.mxsc.json @@ -0,0 +1,347 @@ +{ + "buildInfo": { + "rustc": { + "version": "1.79.0", + "commitHash": "129f3b9964af4d4a709d1383930ade12dfe7c081", + "commitDate": "2024-06-10", + "channel": "Stable", + "short": "rustc 1.79.0 (129f3b996 2024-06-10)" + }, + "contractCrate": { + "name": "fee-market", + "version": "0.0.0" + }, + "framework": { + "name": "multiversx-sc", + "version": "0.53.0" + } + }, + "abi": { + "name": "FeeMarket", + "constructor": { + "inputs": [ + { + "name": "esdt_safe_address", + "type": "Address" + }, + { + "name": "price_aggregator_address", + "type": "Address" + }, + { + "name": "fee", + "type": "Option" + } + ], + "outputs": [] + }, + "upgradeConstructor": { + "inputs": [], + "outputs": [] + }, + "endpoints": [ + { + "name": "addFee", + "onlyOwner": true, + "mutability": "mutable", + "inputs": [ + { + "name": "fee_struct", + "type": "FeeStruct" + } + ], + "outputs": [] + }, + { + "name": "removeFee", + "onlyOwner": true, + "mutability": "mutable", + "inputs": [ + { + "name": "base_token", + "type": "TokenIdentifier" + } + ], + "outputs": [] + }, + { + "name": "getTokenFee", + "mutability": "readonly", + "inputs": [ + { + "name": "token_id", + "type": "TokenIdentifier" + } + ], + "outputs": [ + { + "type": "FeeType" + } + ] + }, + { + "name": "addUsersToWhitelist", + "onlyOwner": true, + "mutability": "mutable", + "inputs": [ + { + "name": "users", + "type": "variadic
", + "multi_arg": true + } + ], + "outputs": [] + }, + { + "name": "removeUsersFromWhitelist", + "onlyOwner": true, + "mutability": "mutable", + "inputs": [ + { + "name": "users", + "type": "variadic
", + "multi_arg": true + } + ], + "outputs": [] + }, + { + "docs": [ + "Percentages have to be between 0 and 10_000, and must all add up to 100% (i.e. 10_000)" + ], + "name": "distributeFees", + "onlyOwner": true, + "mutability": "mutable", + "inputs": [ + { + "name": "address_percentage_pairs", + "type": "variadic>", + "multi_arg": true + } + ], + "outputs": [] + }, + { + "name": "subtractFee", + "mutability": "mutable", + "payableInTokens": [ + "*" + ], + "inputs": [ + { + "name": "original_caller", + "type": "Address" + }, + { + "name": "total_transfers", + "type": "u32" + }, + { + "name": "opt_gas_limit", + "type": "optional", + "multi_arg": true + } + ], + "outputs": [ + { + "type": "FinalPayment" + } + ] + }, + { + "name": "getUsersWhitelist", + "mutability": "readonly", + "inputs": [], + "outputs": [ + { + "type": "variadic
", + "multi_result": true + } + ] + }, + { + "name": "setMinValidSigners", + "onlyOwner": true, + "mutability": "mutable", + "inputs": [ + { + "name": "new_value", + "type": "u32" + } + ], + "outputs": [] + }, + { + "name": "addSigners", + "onlyOwner": true, + "mutability": "mutable", + "inputs": [ + { + "name": "signers", + "type": "variadic
", + "multi_arg": true + } + ], + "outputs": [] + }, + { + "name": "removeSigners", + "onlyOwner": true, + "mutability": "mutable", + "inputs": [ + { + "name": "signers", + "type": "variadic
", + "multi_arg": true + } + ], + "outputs": [] + } + ], + "esdtAttributes": [], + "hasCallback": false, + "types": { + "EsdtTokenPayment": { + "type": "struct", + "fields": [ + { + "name": "token_identifier", + "type": "TokenIdentifier" + }, + { + "name": "token_nonce", + "type": "u64" + }, + { + "name": "amount", + "type": "BigUint" + } + ] + }, + "FeeStruct": { + "type": "struct", + "fields": [ + { + "name": "base_token", + "type": "TokenIdentifier" + }, + { + "name": "fee_type", + "type": "FeeType" + } + ] + }, + "FeeType": { + "type": "enum", + "variants": [ + { + "name": "None", + "discriminant": 0 + }, + { + "name": "Fixed", + "discriminant": 1, + "fields": [ + { + "name": "token", + "type": "TokenIdentifier" + }, + { + "name": "per_transfer", + "type": "BigUint" + }, + { + "name": "per_gas", + "type": "BigUint" + } + ] + }, + { + "name": "AnyToken", + "discriminant": 2, + "fields": [ + { + "name": "base_fee_token", + "type": "TokenIdentifier" + }, + { + "name": "per_transfer", + "type": "BigUint" + }, + { + "name": "per_gas", + "type": "BigUint" + } + ] + } + ] + }, + "FinalPayment": { + "type": "struct", + "fields": [ + { + "name": "fee", + "type": "EsdtTokenPayment" + }, + { + "name": "remaining_tokens", + "type": "EsdtTokenPayment" + } + ] + } + } + }, + "code": "0061736d0100000001791460027f7f0060017f017f60027f7f017f60000060017f0060037f7f7f006000017f60037f7f7f017f60047f7f7f7f017f60047f7f7f7f0060027f7e0060017f017e60057f7f7e7f7f017f60017e006000017e60067e7f7f7f7f7f017f60057f7f7f7f7f0060047f7e7f7f0060027f7f017e60037f7f7f017e02e8062503656e760e626967496e74536574496e743634000a03656e7609626967496e74416464000503656e760b7369676e616c4572726f72000003656e7609626967496e744d756c000503656e760a6d4275666665724e6577000603656e760d6d427566666572417070656e64000203656e76096d4275666665724571000203656e760d6d42756666657246696e697368000103656e76106d4275666665724765744c656e677468000103656e760d6d616e6167656443616c6c6572000403656e76136d616e616765644f776e657241646472657373000403656e76126d427566666572476574417267756d656e74000203656e76126d427566666572417070656e644279746573000703656e76126d616e616765645369676e616c4572726f72000403656e761b736d616c6c496e74476574556e7369676e6564417267756d656e74000b03656e760f6765744e756d417267756d656e7473000603656e7609626967496e74537562000503656e76226d616e616765644d756c74695472616e73666572455344544e465445786563757465000c03656e76146d427566666572436f707942797465536c696365000803656e760f6d4275666665725365744279746573000703656e761776616c6964617465546f6b656e4964656e746966696572000103656e76196d42756666657246726f6d426967496e74556e7369676e6564000203656e76176d427566666572546f426967496e74556e7369676e6564000203656e76126d42756666657253746f726167654c6f6164000203656e76136d42756666657253746f7261676553746f7265000203656e7609626967496e74436d70000203656e760f6d4275666665724765744279746573000203656e760f6973536d617274436f6e7472616374000103656e760e636865636b4e6f5061796d656e74000303656e7616736d616c6c496e7446696e697368556e7369676e6564000d03656e760a626967496e7454446976000503656e761c6d616e616765644765744d756c74694553445443616c6c56616c7565000403656e760a6765744761734c656674000e03656e761b6d616e61676564457865637574654f6e44657374436f6e74657874000f03656e760f636c65616e52657475726e44617461000303656e760a626967496e745369676e000103656e76136d42756666657247657442797465536c69636500080379780106000200010001010904040600010a060000000009070907070100000202040001020201010603070706000704040403050109050004090510000101080800020801000004000201010011050001020205020002020012050007000100130104040604040106040303030303030303030303030303030305030100030616037f01418080080b7f0041a5d6080b7f0041b0d6080b07880211066d656d6f7279020004696e6974008d010775706772616465008e0106616464466565008f010972656d6f76654665650090010b676574546f6b656e466565009101136164645573657273546f57686974656c6973740092011872656d6f7665557365727346726f6d57686974656c6973740093010e64697374726962757465466565730094010b737562747261637446656500950111676574557365727357686974656c697374009701127365744d696e56616c69645369676e6572730098010a6164645369676e6572730099010d72656d6f76655369676e657273009a010863616c6c4261636b009b010a5f5f646174615f656e6403010b5f5f686561705f6261736503020ae94a781601017f1026220142001000200120012000100120010b1901017f41e4870841e4870828020041016b220036020020000bdf0102047f017e0240024020012802182204200128022010280440200128022421024172200135022c100020022002417210032001290300500440200129030822064200530d0220012802282103417220061000200320034172100320022002200310010b417f2002200128021c22031019220541004720054100481b41ff01714101460d022003200210292004102a21032000200236020c2000200336020820004200370300200041186a200141186a290300370300200020012903103703100f0b41b18108411e102b000b41ba840841111002000b41cf8108411a102b000b0b0020002001100641004a0b0a0020002000200110560b0f01017f10042201200010051a20010b0900200020011002000b3c01017f230041106b220124002000102d450440419582084117102b000b200141086a200041002000100841076b102e200128020c200141106a24000b0900200010144100470b1f0020012002200310042201101221022000200136020420002002453602000bbe0101047f2000280210220210300240024002400240024002402000280200220141016b0e020201000b41c382084110102b000b200028020421030c010b2002200028020422031028450d010b20031030103141011032200041106a10332104200028020c210220002802082100024002400240200141016b0e020102000b2004420010340f0b41011035220110360c020b41021035220110360c010b41d38208410b102b000b2003200110372000200110382002200110382004200110390b13002000102d45044041c786084110102b000b0b0a0041898608410e10430b3701017f230041106b220224002002420037030820022001ad4101200241086a10702000200228020020022802041071200241106a24000b1901017f4197860841081043210120002802002001107b20010b3601017f230041106b2202240020024200370308200220014100200241086a10702000200228020020022802041071200241106a24000b08004101410010430b2601017f230041106b22022400200220003a000f20012002410f6a4101107d200241106a24000b4f01027f230041106b22022400200220001008220341187420034180fe03714108747220034108764180fe03712003411876727236020c20012002410c6a4104107d200120001064200241106a24000b0a002000104a200110370b09002000200110181a0ba40101027f0240024002400240200120022003103b41ff01710e03010203000b2002200341808008410d103c000b200041003602000f0b200120022003103d2104200120022003103e21052000200120022003103e36020c2000200536020820002004360204200041013602000f0b200120022003103d2104200120022003103e21052000200120022003103e36020c2000200536020820002004360204200041023602000b2f01017f230041106b22032400200341003a000f20002003410f6a410120012002105e20032d000f200341106a24000b2e01017f419a830841171043220420002001100c1a200441b183084103100c1a200420022003100c1a2004100d000b890101037f230041106b220324002003410036020c20002003410c6a410420012002105e2003200028020820002802002205200328020c220441187420044180fe03714108747220044108764180fe0371200441187672722204102e200328020041014704402001200241ab8408410f103c000b20032802042000200420056a360200200341106a24000b0c00200020012002103d10490b0f01017f102622012000ad100020010b3002017f017e2001280208102a2102200129030021032000200128020c102536020c20002003370300200020023602080b4301017f2001280204220220012802084b047f4100052001200241016a3602042001280200280200200210421067210141010b210220002001360204200020023602000b5401017f230041106b220224002000102a220041eb84084105100c1a2002200141187420014180fe03714108747220014108764180fe03712001411876727236020c20002002410c6a105f200241106a240020000b1101017f102622022000200110131a20020b0700200010071a0b3101017f20011046220210082101200041003a00102000200136020c2000200236020820002001360204200041003602000b0d00200010262200100b1a20000b0a0020002001104810490b850101037f230041106b220224002002410036020c20002002410c6a41042001105c2002200028020820002802002204200228020c220341187420034180fe03714108747220034108764180fe0371200341187672722203102e20022802004101470440200141ab8408410f105d000b20022802042000200320046a360200200241106a24000b0d0020001026220010161a20000b0f01017f10262201200010151a20010b0c01017f10262200100920000b1d01017f10262200100a2000104b102804400f0b419e870841241002000b2f01017f200028020022034180d6082802004e04402001200241b483084111103c000b2000200341016a36020020030b2e01017f104f2103034020002802004180d6082802004e4504402003200020012002104d104610500c010b0b20030b1101017f102622004101410010131a20000b4601017f230041106b220224002002200141187420014180fe03714108747220014108764180fe03712001411876727236020c20002002410c6a4104100c1a200241106a24000b1f00200010462200100841204704402001200241ae85084110103c000b20000b190020004180d6082802004e04400f0b41c5830841121002000b1400100f20004604400f0b41d7830841191002000b190020004180d6082802004c04400f0b41b4830841111002000b0b004180d608100f3602000b1f0020002001200210102000105741ff017104400f0b41f0830841301002000b1500410241012000102322001b4100200041004e1b0bf30102017e037f230041106b2206240020002903002104200028020c2000280208104f2107280200102a2100280200102521052006200442388620044280fe0383422886842004428080fc0783421886200442808080f80f834208868484200442088842808080f80f832004421888428080fc07838420044228884280fe038320044238888484843702042006200041187420004180fe03714108747220004108764180fe0371200041187672723602002006200541187420054180fe03714108747220054108764180fe03712005411876727236020c200720064110100c1a2001200742002002200310111a200641106a24000b2c01017f2001280204104f1a2002102a1050200041086a200141086a280200360200200020012902003702000b5401037f230041206b22022400200241086a105b200228020c2103200228020821042002200141086a36021820022001410c6a36021c20022001290300370310200241106a2000200420031058200241206a24000b1601017f104f21012000104f360204200020013602000b2d00200041086a20002802002001200210660440200341ab8408410f105d000b2000200028020020026a3602000b2c01017f41f68408411b10432203200010051a200341b183084103100c1a200320012002100c1a2003100d000b2f00200041086a200028020020012002106604402003200441ab8408410f103c000b2000200028020020026a3602000b0b00200020014104100c1a0b0b002000106141ff0171450b09002000105741016b0b0c00200020012002200310630b0f00200020012003200210244100470b09002000200110051a0b1001017f1026220220002001100320020bc70301067f02400240027f024020002d000845044020002802002204100822054190ce004b0d0141fcd5082d00000d0141f8d508200536020041fcd50841013a00002004410041e88708200510621a200041013a00080b4101200120036a220041f8d5082802004b0d011a20002001490d0220004190ce004b0d03200141e887086a2100200341104f04402002410020026b41037122046a210520040440200021010340200220012d00003a0000200141016a2101200241016a22022005490d000b0b2005200320046b2203417c7122066a21020240200020046a22044103710440200641004c0d012004410374220141187121072004417c71220841046a2100410020016b4118712109200828020021010340200520012007762000280200220120097472360200200041046a2100200541046a22052002490d000b0c010b200641004c0d0020042100034020052000280200360200200041046a2100200541046a22052002490d000b0b20034103712103200420066a21000b20030440200220036a21010340200220002d00003a0000200041016a2100200241016a22022001490d000b0b41000f0b200041003a0008200420012002200310620b0f0b109c01000b109601000b0d0020001026220010171a20000b08002000200110390b0b0020002001104a10181a0b1200416c4101410010131a2000416c10181a0b090020002001ad10340b0a00200020011042106d0b1f01017f20001067220110084120470440200041ae85084110105d000b20010b2401017e20002000107c22014280808080105a04402000418d8008410e105d000b2001a70b08002000200110680b900101037f200320013c00072003410036000020032001420888a722063a000620032001421088a722053a000520032001421888a722043a000420004108200420057241ff017145220541044105200441ff01711b6a41002005200641ff01711b22046a200441002001501b6a2204200320044107716a2c00004100482002716b22026b3602042000200220036a3602000b0d00200020012002104310181a0b860201057f230041206b220224002001416710171a02400240416710084504400c010b20011067220510082103200241003a001820022003360214200220053602102002200336020c20024100360208200241003a001f200241086a2002411f6a41012001105c024002400240024020022d001f22040e03030201000b200141808008410d105d000b410221040b200241086a22032001104821052003200110472103200241086a2001104721060b200228020c2002280208470d0120022d0018450d0041f8d508410036020041fcd50841003a00000b2000200636020c200020033602082000200536020420002004360200200241206a24000f0b2001418d8008410e105d000b08002000106710490ba30101067f02402000280208220520011075220204400240200220002802042204106e22034d044020022003460d012004106e2003490d03200028020022072003106c21062004106e2002490d03200720021042200610680c010b0c020b2004106e2003490d01200028020020031042106a2004200341016b106b2002200347044020052006200210760b200520011077106a0b20024100470f0b41c2870841121002000b0a00200020011077106e0b0d002000200110772002ad10340b19002000102a220041f084084106100c1a20002001106420000b4001037f200028020822032001107945044020002802042202106e21042000280200200441016a220010422001106820022000106b200320012002106e10760b0b0b002000200110754100470b19002000102a220041f084084106100c1a20012000107b20000b4d01027f230041106b22022400200220001008220341187420034180fe03714108747220034108764180fe03712003411876727236020c20012002410c6a105f200120001064200241106a24000ba30102017e027f230041106b22032400200342003703082000106722041008220041094f04402001418d8008410e105d000b20044100200320006b41106a200010631a20032903082102200341106a2400200242388620024280fe0383422886842002428080fc0783421886200242808080f80f834208868484200242088842808080f80f832002421888428080fc07838420024228884280fe038320024238888484840b0b00200020012002100c1a0b900102017e017f230041106b2203240020002802082001103720032000290300220242388620024280fe0383422886842002428080fc0783421886200242808080f80f834208868484200242088842808080f80f832002421888428080fc07838420024228884280fe038320024238888484843703082001200341086a4108107d200028020c20011038200341106a24000b7b01027f230041106b22032400200028020821042003410036020c200028020020044102742003410c6a41041062450440200328020c21012000200441016a360208200141187420014180fe03714108747220014108764180fe037120014118767272102a200341106a24000f0b2001200241b483084111103c000b2e01017f200128020820012802044f047f4100052001108101210141010b210220002001360204200020023602000b2900200041be85084108107f102a22001008412047044041be8508410841ae85084110103c000b20000b2e01027f2001102a21022001102a220341aa85084104100c1a2000200336020420002001360200200020023602080ba10102017e027f230041106b220424002004420037030820001008220541094f044020012002418d8008410e103c000b20004100200420056b41106a200510631a20042903082103200441106a2400200342388620034280fe0383422886842003428080fc0783421886200342808080f80f834208868484200342088842808080f80f832003421888428080fc07838420034228884280fe038320034238888484840b0d002000106141ff01714101460b0f00200041f08508410a10431082010bbc0101077f230041206b2201240002400240200010084120460440200141186a4200370300200141106a4200370300200141086a420037030020014200370300200041002001412010631a200121024120210541cb840821030240034020022d0000220620032d00002207460440200241016a2102200341016a2103200541016b22050d010c020b0b200620076b21040b2004450d010b20004185d608101a1a4185d608101b41004a0d010b41b586084112102b000b200141206a24000b0a0041d78608410f10430b3601037f41e68608410d10432201102a21022001102a220341aa85084104100c1a2000200336020420002001360200200020023602080b0f00200041f38608410e10431082010b1901017f4181870841071043210120002802002001107b20010b0a0041888708411610430b0f00200041a08408410b107f102a1a0bc10301077f230041306b22012400101c41031053410041848208411110512105410141ec81084118105121062001411c6a2104230041406a22002400200041046a220341021045410321020240024020002802082000280204470440024002400240200341e981084103103b41ff01710e020201000b41e98108410341808008410d103c000b200041046a220241e981084103103d2103200041286a200241e981084103103a20002003360238200041206a200041346a2902003703002000200029022c370318200028022821020b20002802082000280204470d01200041306a200041206a290300370300200020002903183703280b20002d0014044041f8d508410036020041fcd50841003a00000b20042002360200200420002903283702042004410c6a200041306a290300370200200041406b24000c010b41e981084103418d8008410e103c000b200141106a2202200141286a220329020037030020012001290220370308200128021c2100200510860120061086011087012005106f108b012006106f024020004103470440200320022903003702002001200036021c200120012903083702202004102f0c010b1031410010320b200141306a24000b0800101c410010530bd30101057f230041206b22032400101c104c410110532003410c6a2101230041406a220024002000411c6a220241001045200241de8208410a103d2104200041306a200241de8208410a103a02402000280220200028021c460440200041106a2202200041386a2902003703002000200029023037030820002d002c044041f8d508410036020041fcd50841003a00000b2001200029030837020020012004360210200141086a2002290300370200200041406b24000c010b41de8208410a418d8008410e103c000b2001102f200341206a24000b3401017f230041106b22002400101c104c4101105320004100104636020c2000410c6a1033106a103141001032200041106a24000ba00101027f230041206b22002400101c4101105320004100104636020c200041106a2000410c6a103310720240024002400240200028021041016b0e020102000b4200101d0c020b4101103522011036200028021420011037200028021820011038200028021c20011038200110440c010b4102103522011036200028021420011037200028021820011038200028021c20011038200110440b200041206a24000b840101037f230041206b22002400101c104c10554100105420004100360214200041146a41fd80084105104e210120002802141052200041086a1089012001100821022000410036021c200020024102763602182000200136021403402000200041146a10800120002802000440200041086a200028020410780c010b0b200041206a24000b900101037f230041206b22002400101c104c10554100105420004100360214200041146a41fd80084105104e210120002802141052200041086a1089012001100821022000410036021c2000200241027636021820002001360214024003402000200041146a1080012000280200450d01200041086a200028020410740d000b419f86084116102b000b200041206a24000bc506020e7f027e230041e0006b22002400101c104c10554100105420004100360250200041d0006a41e580084118104e2102200028025010524190ce00103f2108104f210520021008210320004100360258200020034102762203360254200020023602500240034020012003490440200041d0006a22021081012101200241be85084108107f41be85084108108301220f4280808080105a0d022000200141187420014180fe03714108747220014108764180fe0371200141187672723602402000200fa7220141187420014180fe03714108747220014108764180fe0371200141187672723602442005200041406b4108100c1a200e200f7c210e20002802542103200028025821010c010b0b200e4290ce00510440200041246a220110880120002000280228106e3602382000410136023420002001360230200041cc006a2109200041c8006a210a03400240200041186a200041306a10412000280218450440200041406b220110880120002000280244106e36025820004101360254200020013602500340200041086a200041d0006a1041200028020804402000280248200028020c107a106a0c0105410021032000280244106e21024101210103402003200120024b720d04200028024020011042106a200120024f2103200120012002496a21010c000b000b000b000b2000200028021c220b36023c2000413c6a108a011073220610600d014100210120061025210720051008210c0340200c200141086a22024904402000413c6a108a01200710690c030b2000420037035020052001200041d0006a220d410810631a2000280250210320062000280254220141187420014180fe03714108747220014108764180fe037120014118767272103f106521011026220420012008101e200221012004108401450d00200720041029200b102a21022000200436024c2000200236024820004200370340200041106a105b20002802142102200028021021042000200a3602582000200936025c20002000290340370350200d200341187420034180fe03714108747220034108764180fe0371200341187672722004200210580c000b000b0b200028024442001034200041e0006a24000f0b418281084116102b000b41be85084108418d8008410e103c000bbb0d020c7f037e230041d0016b22002400105541021054410041d68008410f105121074101100e220d4280808080105a044041c78008410f418d8008410e103c000b200da7210820004102360260200041e0006a22012802004180d6082802004e047e420105200141ba8008410d104d100e210e42000b210d2000200e3703082000200d3703002000290308210e2000290300210d200028026010520240024002400240104b108701106d10280440104b210b416b210602404184d6082d000022010440416b41ffffffff0720011b21060c010b4184d60841013a0000416b101f0b0240200610084170714110460440200610082105200041e8006a2103410121090340200241106a220120054b0d02200342003703002000420037036020062002200041e0006a411010631a200904402000290264220c423886200c4280fe038342288684200c428080fc0783421886200c42808080f80f834208868484200c42088842808080f80f83200c421888428080fc078384200c4228884280fe0383200c423888848484210c2000280260220241187420024180fe03714108747220024108764180fe037120024118767272210a200028026c220241187420024180fe03714108747220024108764180fe037120024118767272210441002109200121020c010b0b109601000b41f8820841221002000b2000200436021c2000200a3602182000200c3703100240103122012001107c220c4201580440200ca741016b0d040c010b200141c685084112105d000b200041e0006a1089012000280268200710790d02200041c8006a2201200041186a29030037030020002000290310370340200041d0006a2001103310720240024002400240200028025041016b0e020102000b419881084119102b000b200041f8006a2001290300370300200020002903403703702000200836028c012000200028025c3602880120002000290254370380012000200e3703682000200d370360200041206a200041e0006a10270c010b2000290258210c20002802542202102a2105200041f0006a2201200041406b10402000200836028c012000200c3702840120002005360280012000200e3703682000200d37036020022000280248102845044020004190016a20011040108b01106d21032000280278102c21042005102c2102200341feffffff07460d0341ac82084117104321012000104f3602a401200020013602a001200020033602a801200041206a2201200041a0016a220320041059200041c4016a2001200210591020210c20002802c801210420002802c401210220002802cc012101417642001000200c42a08d067d200c200c42a08d06561b20014176200220041026220210211a1022200210082101200041003602a801200020023602a001200020014102763602a4010240200141044f0440200341a08408410b107f41a08408410b1083014280808080105a0d082003108c012003108c01200341a08408410b107f41a08408410b1083011a200041a0016a41a08408410b107f10492102200041a0016a41a08408410b107f41a08408410b108301428002540d010c080b41d8850841181002000b2005102a210120002002102536027c2000200136027820004200370370200041a0016a200041e0006a102720002802bc01106045044020002802ac01200028029c0122041065220120012002101e2004200420011056200041286a200041a8016a2903003703002000200436023c20004200370330200020002903a00137032020002000280298013602380c020b200041386a200041b8016a290300370300200041306a200041b0016a290300370300200041286a200041a8016a290300370300200020002903a0013703200c010b200041206a200041e0006a10270b200041e0006a1088012000280228102a2103200028026822022003107a106e45044020002802642204106e21012000280260200141016a22011042200310181a20042001106b2004106e210120022003107a2001ad10340b200041286a108a012201107322022002200028022c1001200120021069200028023c10840104402007200041306a105a0b200041f8006a200041386a290300370300200041f0006a200041306a290300370300200041e8006a200041286a290300370300200020002903203703600c030b419b8008411f102b000b4191850841191002000b200b200041106a105a200a102a21021026220142001000200041f8006a200041186a2903003703002000200136026c2000200236026820004200370360200020002903103703700b200041e0006a10352201107e200041f0006a2001107e20011044200041d0016a24000f0b41a08408410b418d8008410e103c000b0600109c01000b5401047f230041106b22002400101c41001053200041046a1089012000280208106e210220002802042103410121010340200120024b45044020032001106c10071a200141016a21010c010b0b200041106a24000b3f02017e017f101c104c410110534100100e22004280808080105a044041ef82084109418d8008410e103c000b2000a7210141fa8508410f10432001ad10340b870101037f230041206b22002400101c104c10554100105420004100360214200041146a41e882084107104e210120002802141052200110082102200041003602102000200241027636020c2000200136020803402000200041086a1080012000280200044020002802042101200041146a22021085012002200110780c010b0b200041206a24000b880101037f230041206b22002400101c104c10554100105420004100360214200041146a41e882084107104e210120002802141052200110082102200041003602102000200241027636020c2000200136020803402000200041086a1080012000280200044020002802042101200041146a22021085012002200110741a0c010b0b200041206a24000b02000b0b0041d48708410e1002000b0bde070300418080080bcb04696e76616c69642076616c7565696e70757420746f6f206c6f6e674f6e6c7920455344542053616665206d61792063616c6c20746869732053436f70745f6761735f6c696d6974746f74616c5f7472616e73666572736f726967696e616c5f63616c6c6572616464726573735f70657263656e746167655f70616972737573657273496e76616c69642070657263656e746167652073756d546f6b656e206e6f7420616363657074656420617320666565496e76616c696420746f6b656e2070726f766964656420666f72206665655061796d656e7420646f6573206e6f7420636f7665722066656566656570726963655f61676772656761746f725f61646472657373657364745f736166655f61646472657373496e76616c69642045534454206964656e7469666965726c61746573745072696365466565644f7074696f6e616c496e76616c6964206665652074797065496e76616c6964206665656665655f7374727563747369676e6572736e65775f76616c7565696e636f7272656374206e756d626572206f662045534454207472616e7366657273617267756d656e74206465636f6465206572726f722028293a20746f6f2066657720617267756d656e7473746f6f206d616e7920617267756d656e747377726f6e67206e756d626572206f6620617267756d656e747363616e6e6f74207375627472616374206265636175736520726573756c7420776f756c64206265206e6567617469766573796e6320726573756c74696e70757420746f6f2073686f72746361737420746f20693634206572726f720041eb84080bf7022e6974656d2e696e64657873746f72616765206465636f6465206572726f7220286b65793a20726563697069656e742061646472657373206e6f74207365742e6c656e626164206172726179206c656e6774687661722061726773696e707574206f7574206f662072616e6765496e76616c69642061676772656761746f722076616c7565616c6c5369676e6572736d696e56616c69645369676e657273666565456e61626c6564466c6167746f6b656e4665654974656d206e6f7420666f756e6420696e206c697374496e76616c69642053432061646472657373496e76616c696420746f6b656e204944657364745361666541646472657373746f6b656e73466f7246656573757365727357686974656c69737461636346656573707269636541676772656761746f7241646472657373456e64706f696e742063616e206f6e6c792062652063616c6c6564206279206f776e6572696e646578206f7574206f662072616e676570616e6963206f636375727265640041e487080b0438ffffff", + "report": { + "imports": [ + "bigIntAdd", + "bigIntCmp", + "bigIntMul", + "bigIntSetInt64", + "bigIntSign", + "bigIntSub", + "bigIntTDiv", + "checkNoPayment", + "cleanReturnData", + "getGasLeft", + "getNumArguments", + "isSmartContract", + "mBufferAppend", + "mBufferAppendBytes", + "mBufferCopyByteSlice", + "mBufferEq", + "mBufferFinish", + "mBufferFromBigIntUnsigned", + "mBufferGetArgument", + "mBufferGetByteSlice", + "mBufferGetBytes", + "mBufferGetLength", + "mBufferNew", + "mBufferSetBytes", + "mBufferStorageLoad", + "mBufferStorageStore", + "mBufferToBigIntUnsigned", + "managedCaller", + "managedExecuteOnDestContext", + "managedGetMultiESDTCallValue", + "managedMultiTransferESDTNFTExecute", + "managedOwnerAddress", + "managedSignalError", + "signalError", + "smallIntFinishUnsigned", + "smallIntGetUnsignedArgument", + "validateTokenIdentifier" + ], + "isMemGrow": false, + "eiCheck": { + "eiVersion": "1.3", + "ok": true + }, + "codeReport": { + "path": "../output/fee-market.wasm", + "size": 11998, + "hasAllocator": false, + "hasPanic": "without message" + } + } +} diff --git a/esdt-safe/interactor/contract-codes/multiversx-price-aggregator-sc.mxsc.json b/esdt-safe/interactor/contract-codes/multiversx-price-aggregator-sc.mxsc.json new file mode 100644 index 00000000..563ffeee --- /dev/null +++ b/esdt-safe/interactor/contract-codes/multiversx-price-aggregator-sc.mxsc.json @@ -0,0 +1,593 @@ +{ + "buildInfo": { + "rustc": { + "version": "1.79.0", + "commitHash": "129f3b9964af4d4a709d1383930ade12dfe7c081", + "commitDate": "2024-06-10", + "channel": "Stable", + "short": "rustc 1.79.0 (129f3b996 2024-06-10)" + }, + "contractCrate": { + "name": "multiversx-price-aggregator-sc", + "version": "0.53.2" + }, + "framework": { + "name": "multiversx-sc", + "version": "0.53.2" + } + }, + "abi": { + "name": "PriceAggregator", + "constructor": { + "inputs": [ + { + "name": "staking_token", + "type": "EgldOrEsdtTokenIdentifier" + }, + { + "name": "staking_amount", + "type": "BigUint" + }, + { + "name": "slash_amount", + "type": "BigUint" + }, + { + "name": "slash_quorum", + "type": "u32" + }, + { + "name": "submission_count", + "type": "u32" + }, + { + "name": "oracles", + "type": "variadic
", + "multi_arg": true + } + ], + "outputs": [] + }, + "upgradeConstructor": { + "inputs": [], + "outputs": [] + }, + "endpoints": [ + { + "name": "changeAmounts", + "onlyOwner": true, + "mutability": "mutable", + "inputs": [ + { + "name": "staking_amount", + "type": "BigUint" + }, + { + "name": "slash_amount", + "type": "BigUint" + } + ], + "outputs": [] + }, + { + "name": "addOracles", + "onlyOwner": true, + "mutability": "mutable", + "inputs": [ + { + "name": "oracles", + "type": "variadic
", + "multi_arg": true + } + ], + "outputs": [] + }, + { + "docs": [ + "Also receives submission count,", + "so the owner does not have to update it manually with setSubmissionCount before this call" + ], + "name": "removeOracles", + "onlyOwner": true, + "mutability": "mutable", + "inputs": [ + { + "name": "submission_count", + "type": "u32" + }, + { + "name": "oracles", + "type": "variadic
", + "multi_arg": true + } + ], + "outputs": [] + }, + { + "name": "submit", + "mutability": "mutable", + "inputs": [ + { + "name": "from", + "type": "bytes" + }, + { + "name": "to", + "type": "bytes" + }, + { + "name": "submission_timestamp", + "type": "u64" + }, + { + "name": "price", + "type": "BigUint" + }, + { + "name": "decimals", + "type": "u8" + } + ], + "outputs": [] + }, + { + "name": "submitBatch", + "mutability": "mutable", + "inputs": [ + { + "name": "submissions", + "type": "variadic>", + "multi_arg": true + } + ], + "outputs": [] + }, + { + "name": "latestRoundData", + "mutability": "readonly", + "inputs": [], + "outputs": [ + { + "type": "variadic", + "multi_result": true + } + ] + }, + { + "name": "latestPriceFeed", + "mutability": "readonly", + "inputs": [ + { + "name": "from", + "type": "bytes" + }, + { + "name": "to", + "type": "bytes" + } + ], + "outputs": [ + { + "type": "u32" + }, + { + "type": "bytes" + }, + { + "type": "bytes" + }, + { + "type": "u64" + }, + { + "type": "BigUint" + }, + { + "type": "u8" + } + ] + }, + { + "name": "latestPriceFeedOptional", + "mutability": "readonly", + "inputs": [ + { + "name": "from", + "type": "bytes" + }, + { + "name": "to", + "type": "bytes" + } + ], + "outputs": [ + { + "type": "optional>", + "multi_result": true + } + ] + }, + { + "name": "setSubmissionCount", + "onlyOwner": true, + "mutability": "mutable", + "inputs": [ + { + "name": "submission_count", + "type": "u32" + } + ], + "outputs": [] + }, + { + "name": "getOracles", + "mutability": "readonly", + "inputs": [], + "outputs": [ + { + "type": "variadic
", + "multi_result": true + } + ] + }, + { + "name": "setPairDecimals", + "onlyOwner": true, + "mutability": "mutable", + "inputs": [ + { + "name": "from", + "type": "bytes" + }, + { + "name": "to", + "type": "bytes" + }, + { + "name": "decimals", + "type": "u8" + } + ], + "outputs": [] + }, + { + "name": "getPairDecimals", + "mutability": "readonly", + "inputs": [ + { + "name": "from", + "type": "bytes" + }, + { + "name": "to", + "type": "bytes" + } + ], + "outputs": [ + { + "type": "u8" + } + ] + }, + { + "name": "submission_count", + "mutability": "readonly", + "inputs": [], + "outputs": [ + { + "type": "u32" + } + ] + }, + { + "name": "pause", + "onlyOwner": true, + "mutability": "mutable", + "inputs": [], + "outputs": [] + }, + { + "name": "unpause", + "onlyOwner": true, + "mutability": "mutable", + "inputs": [], + "outputs": [] + }, + { + "name": "isPaused", + "mutability": "readonly", + "inputs": [], + "outputs": [ + { + "type": "bool" + } + ] + }, + { + "name": "stake", + "mutability": "mutable", + "payableInTokens": [ + "*" + ], + "inputs": [], + "outputs": [] + }, + { + "name": "unstake", + "mutability": "mutable", + "inputs": [ + { + "name": "unstake_amount", + "type": "BigUint" + } + ], + "outputs": [] + }, + { + "name": "voteSlashMember", + "mutability": "mutable", + "inputs": [ + { + "name": "member_to_slash", + "type": "Address" + } + ], + "outputs": [] + }, + { + "name": "cancelVoteSlashMember", + "mutability": "mutable", + "inputs": [ + { + "name": "member_to_slash", + "type": "Address" + } + ], + "outputs": [] + }, + { + "name": "slashMember", + "mutability": "mutable", + "inputs": [ + { + "name": "member_to_slash", + "type": "Address" + } + ], + "outputs": [] + } + ], + "events": [ + { + "identifier": "pauseContract", + "inputs": [] + }, + { + "identifier": "unpauseContract", + "inputs": [] + }, + { + "identifier": "new_round", + "inputs": [ + { + "name": "from", + "type": "bytes", + "indexed": true + }, + { + "name": "to", + "type": "bytes", + "indexed": true + }, + { + "name": "round", + "type": "u32", + "indexed": true + }, + { + "name": "new_round_event", + "type": "NewRoundEvent" + } + ] + }, + { + "identifier": "discard_submission", + "inputs": [ + { + "name": "from", + "type": "bytes", + "indexed": true + }, + { + "name": "to", + "type": "bytes", + "indexed": true + }, + { + "name": "round", + "type": "u32", + "indexed": true + }, + { + "name": "discard_submission_event", + "type": "DiscardSubmissionEvent" + } + ] + }, + { + "identifier": "discard_round", + "inputs": [ + { + "name": "from", + "type": "bytes", + "indexed": true + }, + { + "name": "to", + "type": "bytes", + "indexed": true + }, + { + "name": "round", + "type": "u32", + "indexed": true + } + ] + }, + { + "identifier": "add_submission", + "inputs": [ + { + "name": "from", + "type": "bytes", + "indexed": true + }, + { + "name": "to", + "type": "bytes", + "indexed": true + }, + { + "name": "round", + "type": "u32", + "indexed": true + }, + { + "name": "price", + "type": "BigUint" + } + ] + } + ], + "esdtAttributes": [], + "hasCallback": false, + "types": { + "DiscardSubmissionEvent": { + "type": "struct", + "fields": [ + { + "name": "submission_timestamp", + "type": "u64" + }, + { + "name": "first_submission_timestamp", + "type": "u64" + }, + { + "name": "has_caller_already_submitted", + "type": "bool" + } + ] + }, + "NewRoundEvent": { + "type": "struct", + "fields": [ + { + "name": "price", + "type": "BigUint" + }, + { + "name": "timestamp", + "type": "u64" + }, + { + "name": "decimals", + "type": "u8" + }, + { + "name": "block", + "type": "u64" + }, + { + "name": "epoch", + "type": "u64" + } + ] + }, + "PriceFeed": { + "type": "struct", + "fields": [ + { + "name": "round_id", + "type": "u32" + }, + { + "name": "from", + "type": "bytes" + }, + { + "name": "to", + "type": "bytes" + }, + { + "name": "timestamp", + "type": "u64" + }, + { + "name": "price", + "type": "BigUint" + }, + { + "name": "decimals", + "type": "u8" + } + ] + } + } + }, + "code": "0061736d0100000001751460027f7f0060000060027f7f017f60017f017f60017f0060037f7f7f006000017f60047f7f7f7f0060037f7f7f017f60047f7f7f7f017f60057f7f7f7f7f0060017e006000017e60027f7e0060017f017e60057f7f7e7f7f017f60027f7f017e60057f7f7f7e7e0060027e7f0060047f7e7f7f0002ac072703656e760e626967496e74536574496e743634000d03656e7609626967496e74416464000503656e760b7369676e616c4572726f72000003656e760a6d4275666665724e6577000603656e760d6d427566666572417070656e64000203656e76096d4275666665724571000203656e76136d42756666657253746f7261676553746f7265000203656e76106d4275666665724765744c656e677468000303656e760d6d616e6167656443616c6c6572000403656e76136d616e616765644f776e657241646472657373000403656e76126d427566666572476574417267756d656e74000203656e76126d427566666572417070656e644279746573000803656e76126d616e616765645369676e616c4572726f72000403656e7619626967496e74476574556e7369676e6564417267756d656e74000003656e761b736d616c6c496e74476574556e7369676e6564417267756d656e74000e03656e760f6765744e756d417267756d656e7473000603656e7609626967496e74537562000503656e76146d427566666572436f707942797465536c696365000903656e760f6d4275666665725365744279746573000803656e7609626967496e74436d70000203656e76196d42756666657246726f6d426967496e74556e7369676e6564000203656e76176d427566666572546f426967496e74556e7369676e6564000203656e76126d42756666657253746f726167654c6f6164000203656e7616736d616c6c496e7446696e697368556e7369676e6564000b03656e760d6d42756666657246696e697368000303656e7614626967496e7446696e697368556e7369676e6564000403656e7611676574426c6f636b54696d657374616d70000c03656e760f6d616e6167656457726974654c6f67000003656e760a626967496e7454446976000503656e760d676574426c6f636b45706f6368000c03656e760d676574426c6f636b4e6f6e6365000c03656e760e636865636b4e6f5061796d656e74000103656e7614736d616c6c496e7446696e6973685369676e6564000b03656e761c6d616e616765644765744d756c74694553445443616c6c56616c7565000403656e7612626967496e7447657443616c6c56616c7565000403656e761b6d616e616765645472616e7366657256616c756545786563757465000f03656e76226d616e616765644d756c74695472616e73666572455344544e465445786563757465000f03656e760a626967496e745369676e000303656e76136d42756666657247657442797465536c696365000903ba01b80103060a010503020002000502000300030000000601030702030600030308060304040401050302020505090900020003030405000000060004110702120505100702030002070800070903080d00020305030002030000000a000a0003031000020202050002001300020400030400000407000e0200060406010306030402040405020a0704030304060a020501040b0302020701050705050106060600030101010101010101010101010101010101010101010101010505030100030616037f01418080080b7f0041a5dd080b7f0041b0dd080b079b031b066d656d6f7279020004696e697400c601077570677261646500c7010d6368616e6765416d6f756e747300c8010a6164644f7261636c657300c9010d72656d6f76654f7261636c657300ca01067375626d697400cb010b7375626d6974426174636800cc010f6c6174657374526f756e644461746100cd010f6c617465737450726963654665656400ce01176c61746573745072696365466565644f7074696f6e616c00cf01127365745375626d697373696f6e436f756e7400d0010a6765744f7261636c657300d1010f73657450616972446563696d616c7300d2010f67657450616972446563696d616c7300d301107375626d697373696f6e5f636f756e7400d40105706175736500d50107756e706175736500d60108697350617573656400d701057374616b6500d80107756e7374616b6500d9010f766f7465536c6173684d656d62657200da011563616e63656c566f7465536c6173684d656d62657200db010b736c6173684d656d62657200dc010863616c6c4261636b00dd010a5f5f646174615f656e6403010b5f5f686561705f6261736503020af97cb8011601017f1028220142001000200120012000100120010b1901017f41808f0841808f0828020041016b220036020020000b31000240200120024d0440200220044d0d01102a000b102a000b2000200220016b3602042000200320014102746a3602000b060010bb01000b18002001102c210120002002102c360204200020013602000b0f01017f10032201200010041a20010b0b0020002001100541004a0b4101017f2001280204220220012802084b047f4100052001200241016a36020420012802002802002002102f210141010b210220002001360204200020023602000b0a0020002001107a107b0b5b01037f230041106b2203240020012802042202047f200341086a20012802002204280200200210312001200328020c360204200428020020021032210241010541000b21012000200236020420002001360200200341106a24000b800101027f230041206b220324002003410c6a22042001419e8208410b200210702201103520042001104e21022003410c6a2001104e21042003280210200328020c46044020032d001c04404194dd0841003602004198dd0841003a00000b2000200436020420002002360200200341206a24000f0b200141808008410e104f000b1000200041a98208410620011070107b0b0b0020012000103410061a0b0f01017f10282201200010141a20010b3101017f20011036220210072101200041003a00102000200136020c2000200236020820002001360204200041003602000b0d0020001028220010161a20000b0a0020001034200110380b4f01027f230041106b22022400200220001007220341187420034180fe03714108747220034108764180fe03712003411876727236020c20012002410c6a41041050200120001053200241106a24000b0900200020011002000b0c01017f10282200100820000b1d01017f1028220010092000103a102d04400f0b41a98e0841241002000b0d00200010282200100a1a20000b2e01017f41d480084117103e220420002001100b1a200441eb80084103100b1a200420022003100b1a2004100c000b1101017f102822022000200110121a20020b3b01037f10402102200028020021010340419cdd0828020020014a04402000200141016a220336020020022001103c1041200321010c010b0b20020b1101017f102822004101410010121a20000b4601017f230041106b220224002002200141187420014180fe03714108747220014108764180fe03712001411876727236020c20002002410c6a4104100b1a200241106a24000b0c00200010282200100d20000b2301017e2000100e22014280025a044041898908410841808008410e103d000b2001a70b2401017e2000100e22034280808080105a04402001200241808008410e103d000b2003a70b2301017f4100103c22001007412047044041d18608410f41e182084110103d000b20000b4c01017f230041106b220124002000100741044604402001410036020c200041002001410c6a410410521a41feffffff072000200128020c41c58eb1a204461b21000b200141106a240020000b19002000419cdd082802004e04400f0b41ff800841121002000b1400100f20004604400f0b4191810841191002000b19002000419cdd082802004c04400f0b41ee800841111002000b0b00419cdd08100f3602000b1f0020002001200210102000104c41ff017104400f0b41aa810841301002000b1500410241012000102522001b4100200041004e1b0b3e01037f20002001104e21022000280200210310032104200028020820032002200410110440200141da8108410f104f000b2000200220036a36020020040b5101017f230041106b220224002002410036020c20002002410c6a41042001109801200228020c2100200241106a2400200041187420004180fe03714108747220004108764180fe0371200041187672720b2c01017f41c28208411b103e2203200010041a200341eb80084103100b1a200320012002100b1a2003100c000b0b00200020012002100b1a0b0c00200020012002200310520b0f00200020012003200210264100470b09002000200110041a0b1500417f200020011013220041004720004100481b0b0a0020002000200110010b0d0020001028220010151a20000b0d002000416710161a416710070b0a0020004101410010590b0d00200020012002103e10061a0b080020002001105b0b09002000200110061a0b4001017f2001280200220204402002105d2202105e20012802042002105e20012802082002105e200128020c2002105e20002002105b0f0b20004101410010590b080041014100103e0b4501017f230041106b220224002002200041187420004180fe03714108747220004108764180fe03712000411876727236020c20012002410c6a41041050200241106a24000b1200416c4101410010121a2000416c10061a0b3b01027f20002001280200220520012802082200200210612000200210622003105d220010632004200010632000105b20052001280204200210640b4902017f017e230041106b220424002000200120031068047e200420022003106520042903002105200020042903083703102000200537030842010542000b370300200441106a24000b19002000102c2200418a82084107100b1a20002001105320000b7701017f230041106b220224002002200042388620004280fe0383422886842000428080fc0783421886200042808080f80f834208868484200042088842808080f80f832000421888428080fc07838420004228884280fe038320004238888484843703082001200241086a41081050200241106a24000ba90101047f230041206b22032400200020021068450440200341106a2001106e2003200328021c41016a220436021c024020032802102206450440200320043602140c010b200341086a20012003280218220510312001200520032802082004106f0b2001200420054100106f20032004360218200141a982084106200410702002105a2003200641016a3602102001200341106a107420002002106b2004ad10730b200341206a24000b7c02027f027e230041206b220324002003410c6a22042001200210622201103520042001106621052003410c6a2001106621062003280210200328020c46044020032d001c04404194dd0841003602004198dd0841003a00000b2000200637030820002005370300200341206a24000f0b200141808008410e104f000b850102017e017f230041106b22032400200342003703082000200341086a4108200110980120032903082102200341106a2400200242388620024280fe0383422886842002428080fc0783421886200242808080f80f834208868484200242088842808080f80f832002421888428080fc07838420024228884280fe038320024238888484840b2a00200120031068047f2002200310621069210341010541000b210120002003360204200020013602000b0b002000200110754100470b08002000103610560b0a0020002001106b10580b19002000102c2200419182084108100b1a20002001105320000bbd0101057f230041206b22042400200020022003106d450440200441106a2001106e2004200428021c41016a220536021c024020042802102207450440200420053602140c010b200441086a20012004280218220610312001200620042802082005106f0b2001200520064100106f20042005360218200141a982084106200510702002105d220610382003200610382006105b2004200741016a36021020011071200441106a105c20002002200310722005ad10730b200441206a24000b0f00200020012002107210764100470bab0101057f230041206b220224000240024020011071220110574504400c010b2002410c6a22032001103520032001104e21062002410c6a2001104e21032002410c6a2001104e21042002410c6a2001104e21052002280210200228020c470d0120022d001c450d004194dd0841003602004198dd0841003a00000b2000200536020c200020043602082000200336020420002006360200200241206a24000f0b200141808008410e104f000b20002000419e8208410b200110702002105d2200105e20032000105e2000105b0b17002000102c220020012002100b1a20032000105e20000b13002000102c220041af82084105100b1a20000b1b002000102c2200419182084108100b1a200120022000107720000b3701017f230041106b2202240020024200370308200220014100200241086a108e012000200228020020022802041059200241106a24000b0a00200010712001105c0b0a0020002001106b10760b2501017e2000200010850122014280808080105a0440200041808008410e104f000b2001a70b0e002000200210382001200210380b1f01017f230041106b2201240020012000106e2001280200200141106a24000b090020002001ad10730b19002000102c2200419982084105100b1a20012000105e20000b1f01017f20001036220110074120470440200041e182084110104f000b20010b10002000419e8208410b2001107010580b1000200041a9820841062001107010580b2e01017f230041106b2202240020022001280200106e2000200228020436020420002001360200200241106a24000b6702027f017e230041106b220524002000200120032004106d047f2002102c220141b482084108100b1a20032004200110772001102c2102200541086a2001108001200529030821072000200236020c2000200737020441010541000b360200200541106a24000b1801017f2001102c210220002001360204200020023602000b4d01017f2000200120032004106d047f2002102c220141b482084108100b1a20032004200110772001102c220241dd82084104100b1a200020023602082000200136020441010541000b3602000b08002001200010330b08002000103610460b3301017e027f0240200020001085012201420158044041002001a741016b0d021a0c010b2000418683084112104f000b41010b0ba30102017e027f230041106b22032400200342003703082000103622041007220041094f0440200141808008410e104f000b20044100200320006b41106a200010521a20032903082102200341106a2400200242388620024280fe0383422886842002428080fc0783421886200242808080f80f834208868484200242088842808080f80f832002421888428080fc07838420024228884280fe038320024238888484840b0b0020002001108701105f0b19002000102c220041bc82084106100b1a20002001105320000ba40101067f0240200028020822052001108901220204400240200220002802042204107622034d044020022003460d01200410762003490d03200028020022072003102f2106200410762002490d0320072002107a2006105a0c010b0c020b200410762003490d0120002802002003107a105f2004200341016b107920022003470440200520062002108a010b200520011086010b20024100470f0b41cd8e0841121002000b0b002000200110870110760b0e00200020011087012002ad10730b4201037f200028020822032001108c0145044020002802042202107621042000280200200441016a2200107a2001105a2002200010792003200120021076108a010b0b0c00200020011089014100470b4301027f230041106b22022400104021032002420037030820022001ad4100200241086a108e0120032002280200200228020410121a200020031041200241106a24000baa0202047f027e2003200142388620014280fe0383422886842001428080fc0783421886200142808080f80f834208868484200142088842808080f80f832001421888428080fc07838420014238882208200142288822094280fe0383848484370000200041084100200142005322072002716b41ff017122042008a746220520042001423088a741ff01714671220620056a2006410020042009a741ff0171461b22056a2005410020042001422088a741ff0171461b22056a2005410020042001a72205411876461b22066a200641002004200541107641ff0171461b22066a200641002004200541087641ff0171461b22046a200441002001501b6a22042007200320044107716a2c0000410048732004410047712002716b22026b3602042000200220036a3602000b0d0010401a20002001102c10410b1201017f1040220220002001103e104120020bf60101037f230041d0006b22012400200141286a200041046a2202107e200120012903283702400340200141206a200141406b103020012802200440200028020820012802241062105f0c0105200141186a2002107e2001200129031837024003400240200141106a200141406b10302001280210044020002802002001280214106a0c0205200141306a2002280200106e2001280234210003402000450d02200141086a200228020020001031200128020c20022802002000107c20022802002000107d21000c000b000b000b0b200141c8006a4200370300200142003703402002280200200141406b1074200141d0006a24000b0b0b8a0101047f230041106b220324002001280204220241046a220420012802084b047f41000520012802002003410036020c28020020022003410c6a410410511a200328020c210220012004360204200241187420024180fe03714108747220024108764180fe037120024118767272210241010b21012000200236020420002001360200200341106a24000b7d01037f230041106b22012400200028020821032001410036020c200028020020034102742001410c6a41041051450440200128020c21022000200341016a360208200241187420024180fe03714108747220024108764180fe037120024118767272102c200141106a24000f0b41f18208410841ee80084111103d000b980101047f230041206b2201240020012000280204107636021c20014101360218200120003602140340200141086a200141146a102e200128020804402000280208200128020c1086010c01052000280204107621034101210203402004200220034b7245044020002802002002107a105f200220034f2104200220022003496a21020c010b0b200028020441001079200141206a24000b0b0b4801017f0240200128020820012802044f04400c010b410121022001109301102c220110074120460d0041f18208410841e182084110103d000b20002001360204200020023602000b2e01027f2001102c21022001102c220341dd82084104100b1a2000200336020420002001360200200020023602080b2e0020003502081017200028020c10181a200028021010181a2000290300101720002802141019200031001810170bef0301077f2000280200210702400240024002400240024020002d001045044020002802082204100722054190ce004b0d014198dd082d00000d014194dd0820053602004198dd0841013a00002004410041848f08200510511a200041013a00100b200220076a22084194dd082802004d0d010c050b200041003a0010200420072001200210510d04200220076a21080c010b200720084b0d0120084190ce004b0d02200741848f086a210320012104200241104f04402004410020046b41037122016a210620010440200321050340200420052d00003a0000200541016a2105200441016a22042006490d000b0b2006200220016b220a417c7122096a21040240200120036a22014103710440200941004c0d012001410374220241187121072001417c71220541046a2103410020026b4118712102200528020021050340200620052007762003280200220520027472360200200341046a2103200641046a22062004490d000b0c010b200941004c0d0020012103034020062003280200360200200341046a2103200641046a22062004490d000b0b200120096a2103200a41037121020b20020440200220046a21010340200420032d00003a0000200341016a2103200441016a22042001490d000b0b0b200020083602000f0b102a000b102a000b200341da8108410f104f000b2601017f230041106b22022400200220003a000f20012002410f6a41011050200241106a24000ba30102017e027f230041106b220224002002420037030820001007220341094f044041f18208410841808008410e103d000b20004100200220036b41106a200310521a20022903082101200241106a2400200142388620014280fe0383422886842001428080fc0783421886200142808080f80f834208868484200142088842808080f80f832001421888428080fc07838420014228884280fe038320014238888484840b2e01017f230041106b22022400200241003a000f20002002410f6a4101200110980120022d000f200241106a24000b2601017f230041106b22022400200220013a000f20002002410f6a41011050200241106a24000b0b00109f011084014101730b3901027f230041106b22012400109f012001420037030820012000ad4101200141086a108e01200128020020012802041059200141106a24000b0a0041c98a084113103e0b1200109d0145044041ae830841121039000b0b4401047f230041106b2201240010a20110692103200010a30110692104200141046a10a401200128020c2000108c0104402004200310a50121020b200141106a240020020b0a0041928c084122103e0b1401017f419f8b08411b103e22012000105320010b0f00200041d58b08411c103e1096010b0f0020002001105441ff01714102490ba60101037f230041406a22012400200141106a10a70120001007210220014100360224200120024102763602202001200036021c2001280210210202400340200141086a2001411c6a1095012001280208450d012002200128020c220010680d00200141286a2203200141106a2000102c420042001060200310a40120032000108b01200310a401200128022c107641e500490d000b41d2830841161039000b200141406b24000b0d002000410d41d98c0810de010b20002000200110a90141ff0171200241ff0171470440419f870841181039000b0bbf0101027f230041206b220224002002410c6a2000200110b201220310350240024002402002280210200228020c460440410021010c010b410021010240024002402002410c6a2003109b0141ff01710e020201000b200341f98208410d104f000b410121012002410c6a2003109b0121000b2002280210200228020c470d010b20022d001c04404194dd0841003602004198dd0841003a00000b2001450d01200241206a240020000f0b200341808008410e104f000b41e68708411c1039000bc00102037f017e230041206b2205240002400240200410762207450d00200410762007490d002005410c6a220620032007107a2203103520062003104d10562104200620031066210820062003109b0121062005280210200528020c470d0120052d001c04404194dd0841003602004198dd0841003a00000b200020023602102000200136020c20002007360208200020063a00182000200436021420002008370300200541206a24000f0b41cd8e0841121002000b200341808008410e104f000bcd0b02097f037e230041f0026b220424002004200136024c20042000360248200441e4026a10ac01200441406b20002001102b20042802e40222052004280240220920042802442206106d450440200441386a20092006102b200520042802e8022004280238200428023c106c0b20044180016a2207200520042802ec0220092006107f0240200428028001450d00200441d8006a2004418c016a2802003602002004200429028401370350200441c8006a220910ad012105200910ae012106200710af01200441dc006a20042802800120042802880120002001108101200428025c047f2004280264107641016a0541000b2109101a210d20044180016a2004280254106e027f027e20042802800122070440200520051085010c010b2005200d1073200d0b220e42880e7c200d5a04402007450c010b200441d0006a1091012005200d10732006200d10732000102c21072001102c210a41b58d08410d10900122052007108f012005200a108f0120052009108d0120051040101b200d210e41010b2107103a2105027e200428025020051068220a200745200d200e54717204402000102c21022001102c210141d08d08411210900122002002108f0120002001108f0120002009108d01200d1040102c22011063200e20011063200a200110990120002001101b42000c010b2005102c210520021027200441306a2004280250200441d8006a220828020020051067200828020020051062103320042802502004280254200510642006200d1073200441286a20002001102b20042802282107200428022c210a200441f0006a2008280200360200200420042903503703682004200a36027c200420073602780240200428026c1078220510b0011076490d000240024020054133490440410021052004410036028001200441206a200441e8006a2206410472107e200420042903203702e402200420063602ec0220044184016a220621080340200441186a200441e4026a1030024020042802184101460440200420042802ec02220b280200200b41086a280200200428021c106720042802000d010c080b027f20054504404100210541040c010b20062005200441e4026a410041202005676b10b10120054101762108024020054101714504402005200841016b220b4b04402006200b4102746a280200102722052005200620084102746a28020010271001417242021000200520054172101c0c020b41bf890841151039000b200620084102746a280200102721050b200441013602d00241080b200441cc026a6a200536020020042802d002450d0320042802d4022106101a210d200441e8006a109101200441f8006a220510ad01105f200510ae01105f200441d8026a10af01200441106a2007200a102b20042802d8022205200428021022082004280214220b106d450440200441086a2008200b102b200520042802dc022004280208200428020c106c0b200441e4026a200520042802e0022008200b10810120042802e402450d0720042802e80220042802ec022208107641016a220b107a105d21052006103420051038200d2005106320052003109c012005105b2008200bad1073101d2007102c2105200a102c210720061027101e210f41ac8d08410910900122062005108f0120062007108f0120062009108d011040102c22051037200d2005106320032005109901200f200510632005106320062005101b0c050b20054132460d03200820042802043602002004200541016a220536028001200841046a21080c000b000b41b7870841211039000b41d88708410e1039000b10c001000b2000102c21032001102c210141c28d08410e10900122002003108f0120002001108f0120002009108d0110401a200020021034101b42010b210d200441e4026a220110a701103a210020042802e402220220001068044020044180016a2203200220042802ec0220001061200429038001500d01200429039001210e200429038801210f200320012000102c200d200f7c200e42017c10600b200441f0026a24000f0b10bb01000b0d002000410b4198890810de010b1e01017f418c8d08411a103e2101200028020020002802042001107720010b1e01017f41f38c084119103e2101200028020020002802042001107720010b0d002000410641a68d0810de010b0a0041a389084110103e0bfa1201127f230041d0026b22072400410121144101210f02400340200121082000210b024003400240200841154f044020040d01200841017641016b210503402005417f46044020082105034020054102490d08200b20084100200541016b220510ba01200741086a41002005200b200810292007280208200728020c410010bf010c000b0005200b2008200510bf01200541016b21050c010b000b000b200841014d0d04200b2008410110be010c040b200f450440200841017641feffffff0771210c417f2105417f200841016b6776210920082106034020054102470440200b20082005200c6a2006410d74200673220641117620067322064105742006732206200971220a200841002008200a4d1b6b10ba01200541016a21050c010b0b200441016b21040b20072008410276220636023c2007200641017422053602402007200641036c220c36024420074100360248200720083602d8012007200b3602d401200720023602d0012007200741c8006a3602dc01200841314b04402007200641016b36024c2007200641016a360250200741d0016a2206200741cc006a22092007413c6a200741d0006a220a10bd012007200541016b36024c2007200541017236025020062009200741406b200a10bd012007200c41016b36024c2007200c41016a36025020062009200741c4006a200a10bd010b200741d0016a2007413c6a200741406b200741c4006a10bd0102400240200f027f20072802482206410c4f0440200741306a410020084101762205200b200510292007280234210920072802302106200741286a41002005200b20084102746a2005410274220c6b20051029200541016b21052007280228200c6a41046b210a200728022c210c024003402005417f460d012009450d042005200c4904402006280200210d2006200a280200360200200a200d360200200941016b2109200641046a2106200a41046b210a200541016b21050c010b0b10bb01000b20082007280240417f736a210c41010c010b2007280240210c2006450b20147171450d01200b41046b2112410121054100210d200841324921130340200d4105460d0220052008200520084b1b210a200d41016a210d201220054102746a21060340024002402005200a460440200a21050c010b200641046a2209280200200628020010b901450d010b2013200520084672450440200b2008200541016b2206200510ba0120054102490d03200741206a41002005200b2008102920072802202007280224200610be01200741186a41002005200b2008102920072802182109200728021c2106230041106b220a24000240200641014b0440200a41086a41002006200920061029200a28020c210e200a2802082209280204200928020010b901450d01200941046a21062009280200211020092009280204360200200e41026b21112009200e4102746a41046b210e034002402011047f200641046a2209280200201010b9010d01200605200e0b20103602000c030b20062009280200360200201141016b2111200921060c000b000b10bb01000b200a41106a24000c030b20052008460d080c040b200541016a2105200921060c000b000b000b10bb01000b2003450440200121080c020b2008200c4d044010bb01000b2003280200200b200c4102746a28020010b9010440200b21000c020b41002105200b20084100200c10ba01200b41046a210d200841016b210a200b280200210c0340200a20052005200a491b2109200d20054102746a21060240034020052009460d01200c200628020010b901450440200641046a2106200541016a21050c010b0b200521090b200b200a4102746a2105024003402009200a41016b220a4f0d0120052802002106200541046b2105200c200610b9010d000b200d20094102746a220628020021112006200541046a220628020036020020062011360200200941016a21050c010b0b200b200c360200200941016a220620084d0440200820066b2108200b20064102746a210b0c010b0b102a000b4100210f200020084100200c10ba01200841016b210120002802002110200041046a220c210503400240024002402001200f4604402001210f0c010b2005280200201010b9010d010b200020084102746a41046b2105200121060340200f2006220b4f2214450440200641016b21062005280200200541046b2105201010b901450d010b0b200741106a200f200b200c200110292007280210221120072802144102746a210b41800121014100210e41002105410021094100210d41800121122011210c03400240200b200c6b220a418408492215450d00200a41027621062009200d4b22132005200e49722216044020064180016b220a200120131b21012012200a200620161b20131b21120c010b2006200a41037622126b21010b02402009200d470d0041002106200c210a200741d0006a220d2109034020062012460d01200920063a0000200641016a21062009200a280200201010b9014101736a2109200a41046a210a0c000b000b02402005200e470d00200b41046b210a41002106200741d0016a2205210e034020012006460d01200e20063a0000200641016a2106200a280200201010b901200e6a210e200a41046b210a0c000b000b2009200d6b2206200e20056b220a2006200a491b220a0440200d41016a2106200a41016b210a200c200d2d00004102746a220d2802002113037f200d200b20052d0000417f734102746a220d280200360200200a047f200d200c20062d00004102746a220d280200360200200641016a2106200a41016b210a200541016a21050c0105200d20133602002006210d200541016a0b0b21050b200b410020016b41002005200e461b4102746a210b200c201241002009200d461b4102746a210c2015450d000b02402009200d4d04402005200e4f0d0103402005200e4f0d02200c2802002101200c200b200e41016b220e2d0000417f734102746a220628020036020020062001360200200c41046a210c0c000b000b03402009200d4b0440200c200941016b22092d00004102746a220128020021062001200b41046b220b280200360200200b20063602000c010b0b200b210c0b20002010360200200020084100200c20116b410276200f6a220110ba012001200846200120084b720d0120084103762001200820016b220520012005491b4d210f200020014102746a220641046a2108200541016b220520014d04402008200520022006200410b1010c040b2000200120022003200410b1012006210320052101200821000c030b200541046a2105200f41016a210f0c010b0b0b10c001000b200741d0026a24000b2201017f41e68c08410d103e210220002802002002103820012802002002103820020b930101027f230041306b220324000240109d010440200341106a220410af01200341046a20032802102003280218200120021081012003280204450d012004200120022003280208200328020c10aa01200020032d00283a0018200020032903203703102000200329031837030820002003290310370300200341306a24000f0b41ae830841121039000b4182880841141039000b3f01027f230041106b22002400103a2101200041046a10a70102402000280204200110680440200110a1010d010b41a9880841141039000b200041106a24000b4201017f230041106b220124000240200041024d0d00200141046a10a70120012802081078200049200041324b720d00200141106a24000f0b41bd880841181039000b2e01017e02402000101a2201580440200120007d421f5a0d010f0b41d58808411c1039000b41f1880841181039000b0d002000104c41ff017141014b0b0f0020002001105441ff01714101470b100020002001105441ff017141ff01460b44000240200120024b0440200120034b0d0110bb01000b10bb01000b200020024102746a220128020021022001200020034102746a2200280200360200200020023602000b060010c001000b4f01037f20002802042203200228020022044102746a2802002003200128020022054102746a28020010b90104402002200536020020012004360200200028020c2200200028020041016a3602000b0b1d0020002001200210bc0120002002200310bc0120002001200210bc010bd40101077f230041106b2205240002402001200241016b4b0440034020012002460d02200541086a4100200241016a220220002001102920052802082207200528020c22084102746a220341046b2204280200200341086b220928020010b901450d002004280200210620042009280200360200200841026b21042003410c6b2103034002402004047f2006200328020010b9010d01200341046a0520070b20063602000c020b200341046a2003280200360200200441016b2104200341046b21030c000b000b000b10bb01000b200541106a24000b900101027f024002400340024020024101742204410172220320014f0d002001200441026a22044b0440200020034102746a280200200020044102746a28020010b90120036a21030b200120024d0d02200120034d0d03200020024102746a280200200020034102746a28020010b901450d00200020012002200310ba01200321020c010b0b0f0b10bb01000b10bb01000b0b0041ef8e08410e1002000b0a0041eb8a08411a103e0b0a0041858b08411a103e0b0a0041ba8b08411b103e0b1901017f41b48c084125103e220220011053200020021096010b09002000109301102c0bc904010b7f230041206b22012400101f104a410510494100103c10462106410110422102410210422103410341b38908410c10442104410441a3890841101044210720014105360214200141146a103f2100200128021410472001200036020c1040210520012000100736021c2001410036021820012001410c6a3602140240034002402001200141146a1092012001280200450d002001280204102c102c220010074120470d022001200041187420004180fe03714108747220004108764180fe0371200041187672723602102005200141106a4104100b1a0c010b0b200510072109410021000240024002400240024003402009200041046a220a4904400240200141146a10a401200128021810762200450d00200041e5004f0d03200020044d0d04200441014d0d05200210b701450d06200310b701450d062003200210b801450d0710c30121000240200641feffffff074704402000200610061a0c010b200041868208410410590b200210a2011033200310c101103310c20120041079200128020c10a601200710b50110b001200710794101109e01200141206a24000f0b052001410036021420052000200141146a2208410410521a20012802142100200810a4012008200041187420004180fe03714108747220004108764180fe037120004118767272108b01200a21000c010b0b418f840841101039000b41d2830841161039000b419f8408412f1039000b41ce840841301039000b41fe840841241039000b41a2850841311039000b419980084119103e220041e182084110100b1a2000100c000b0d00101f410010484101109e010bda0101057f230041206b22002400101f103b4102104841001042210241011042210302400240200210b701450d00200310b701450d002003200210b8010440200041086a220110a40110c201107621042000200028020c107636021c20004101360218200020013602144100210103402000200041146a102e2000280200450d032002200028020410a301106910b90120016a220120044d0d000b0c020b41a2850841311039000b41fe840841241039000b200120044b044010a201200210820110c1012003108201200041206a24000f0b41e08608413f1039000b3601027f230041106b22002400101f103b104a410010492000410036020c2000410c6a103f200028020c104710a601200041106a24000b880401097f23004180016b22002400101f103b104a41011049410041a3890841101044210620004101360258200041d8006a103f210120002802581047200041406b10a70120011007210320004100360254200020034102763602502000200136024c200028024821072000280244210120002802402108024003400240200041386a200041cc006a1095012000280238450d002008200028023c2203107522040440200041306a2001200410312000280234210220002802302105200041d8006a2001106e024020050440200041286a2001200510312001200520002802282002106f0c010b2000200236025c0b024020020440200041206a2001200210312001200220052000280224106f0c010b200020053602600b20012004107c2001200410321a20012004107d2000200028025841016b3602582001200041d8006a107420082003106a200041106a200720031065200720031062105f0b200041e8006a220410a40110c2011076210220042003108801200028026c107620024d0d02450d012000200028026c107636027c20004101360278200020043602740340200041086a200041f4006a102e20002802080440200041d8006a2202200028020c10c401200220031088011a0c0105200041d8006a2202200310c40120021094010c030b000b000b0b200610b50110b0012006107920004180016a24000f0b41d3850841c7001039000b6902057f017e230041106b22002400101f410510484100103c21014101103c21024102100e4103104221044104104321032000200236020c2000200136020810a00110b40110b601200041086a2000410c6a200310a801200120022004200310ab01200041106a24000bf40102057f027e230041206b22002400101f104a410010492000410036020c2000410c6a103f2103200028020c104710a00110b401200310072101200041003602142000200141027622013602102000200336020c02400340200120024b04402000410c6a220110c50121022000410c6a10c50121032001109301109a012000410c6a109301105621012000410c6a109301109a0122064280025a0d02200020023602182000200336021c10b601200041186a2000411c6a2006a7220410a801200220032001200410ab0120002802102101200028021421020c010b0b200041206a24000f0b41f18208410841808008410e103d000ba70301097f230041406a22002400101f4100104810a001200041146a220110af01200041206a22032000280218106e024002402000280220044010402104200110af01200320002802182205106e20002802242101200028021c210720002802142108034020010440200041086a200520011031200028020c200041206a2202200541a982084106200110702201103520022001104d2102200041206a2001104d210620002802242000280220470d0320002d003004404194dd0841003602004198dd0841003a00000b200041206a220120082007200220061081012000280220450d042001200220062000280224200028022810aa011040102c210120002802282001105e200028022c2001103820002802302001103820002903202001106320002802342001103720002d0038200110990120042001104121010c010b0b20002004360210200020041007360228200041003602242000200041106a36022003402000200041206a10920120002802000440200028020410181a0c010b0b200041406b24000f0b4196880841131039000b200141808008410e104f000b418e8008410b1039000b2c01017f230041206b22002400101f4102104820004100103c4101103c10b3012000109701200041206a24000b3801027f230041306b22002400101f41021048200041106a22014100103c4101103c10b301200042003703082001109701200041306a24000b2201017f101f103b41011048410041a3890841101044220010b50110b001200010790ba70101037f230041306b22002400101f4100104810402101200041246a10a701200041106a200041286a107e2000200029031037021c0340200041086a2000411c6a103020002802080440200028020c210210401a20012002102c10410c010b0b2000200136021820002001100736022c200041003602282000200041186a36022403402000200041246a10920120002802000440200028020410181a0c010b0b200041306a24000be40101067f230041406a22002400101f103b410310484100103c21014101103c210241021043210420002002360208200020013602040240200041046a200041086a10b201220510570440109f01108401450d010b105d22034101109c0120032004109c0120052003105b200020023602102000200136020c200041246a10ac01200041146a2000280224200028022c20012002107f20002802140440200041386a200041206a28020036020020002000290218370330200041306a1091010b2000410c6a220110ad01105f200110ae01105f200041406b24000f0b4198830841161039000b4801037f230041106b22002400101f410210484100103c21014101103c2102200020013602082000200236020c200041086a2000410c6a10a901ad42ff01831017200041106a24000b1000101f4100104810b0011076ad10170b1c00101f103b410010484101109e0141bc8a08410d1090011040101b0b1c00101f103b410010484100109e0141dc8a08410f1090011040101b0b1100101f41001048109f01108401ad10200ba20301047f230041106b2202240041001048416b2100024041a4dd082d000022010440416b41ffffffff0720011b21000c010b41a4dd0841013a0000416b10210b0240024002400240027f024002400240200010074104760e020102000b41b2800841221002000b41752101024041a0dd082d000022000440417541ffffffff0720001b21010c010b41a0dd0841013a0000417510220b20011027210141feffffff070c010b200241086a420037030020024200370300200041002002411010520d01200229020450450d02200228020c220141187420014180fe03714108747220014108764180fe03712001411876727221012002280200220041187420004180fe03714108747220004108764180fe0371200041187672720b220010c3011083012203470440200041feffffff0746200341feffffff0746720d0320002003102d450d030b103a2100200210a40120022802082000108c01450d03200010a3012200106922032001105520002003108201200241106a24000f0b41e98108411d1002000b418d8e08411c1002000b419a860841151039000b41af860841221039000ba50201077f230041106b22022400101f41011048410010422201103a220510a30122041069220310b80104401028220020032001104b10a20110692103200210a40102400240024020022802082005108c0104402000200310a501450d010b20002004103310c30110830121001040210410402103200041feffffff07470d012005200142002004200310231a0c020b41df8e0841101039000b104021062000102c2100200110272101200242003702042002200041187420004180fe03714108747220004108764180fe0371200041187672723602002002200141187420014180fe03714108747220014108764180fe03712001411876727236020c200620024110100b1a2005200642002004200310241a0b200241106a24000f0b41df8e0841101039000b5701047f230041106b22002400101f4101104802401045220110a1010440103a220210a101450d01200041046a2203200110c40120032002108b01200041106a24000f0b41e8830841271039000b41df8e0841101039000b3601047f230041106b22002400101f4101104810452101103a2102200041046a2203200110c401200320021088011a200041106a24000b850101047f230041106b22012400101f410110481045210010c20110762102200141046a200010c40120012802081076200249044041c0830841121039000b10c10110692102200010a30122031069220020002002104b2003200010820141f18b084121103e2200106922032002105520002003108201200141046a109401200141106a24000b02000b3b01037f230041106b2203240020022001103e2204102c2105200341086a20041080012000200329030837020020002005360208200341106a24000b0b910f0200418080080bfd0e696e70757420746f6f206c6f6e676d697373696e67206b657973657269616c697a6572206465636f6465206572726f723a20696e636f7272656374206e756d626572206f662045534454207472616e7366657273617267756d656e74206465636f6465206572726f722028293a20746f6f2066657720617267756d656e7473746f6f206d616e7920617267756d656e747377726f6e67206e756d626572206f6620617267756d656e747363616e6e6f74207375627472616374206265636175736520726573756c7420776f756c64206265206e65676174697665696e70757420746f6f2073686f72744d616e6167656456656320696e646578206f7574206f662072616e676545474c442e6d61707065642e6e6f64655f69642e6974656d2e6e6f64655f6c696e6b732e76616c75652e696e666f2e73746f726167652e696e64657873746f72616765206465636f6465206572726f7220286b65793a202e6c656e626164206172726179206c656e6774687661722061726773696e76616c69642076616c7565696e707574206f7574206f662072616e6765436f6e7472616374206973206e6f7420706175736564436f6e74726163742069732070617573656451756f72756d206e6f742072656163686564546f6f206d616e7920626f617264206d656d62657273566f7465642075736572206973206e6f742061207374616b656420626f617264206d656d6265724e6f20626f617264206d656d6265727351756f72756d20686967686572207468616e20746f74616c20706f737369626c6520626f617264206d656d6265727351756f72756d206d696e696d756d20626f617264206d656d6265727320726571756972656d656e74206e6f74206d65745374616b696e6720616e6420736c61736820616d6f756e742063616e6e6f742062652030536c61736820616d6f756e742063616e6e6f7420626520686967686572207468616e207265717569726564207374616b6572656d61696e696e67206e756d626572206f6620626f617264206d656d62657273206d7573742062652067726561746572207468616e2074686520736c6173682071756f72756d496e76616c6964207061796d656e7420746f6b656e4f6e6c792077686974656c6973746564206d656d626572732063616e207374616b656d656d6265725f746f5f736c6173684e6577207374616b696e6720616d6f756e7420697320746f6f2062696720636f6d706172656420746f206d656d62657273207374616b656420616d6f756e7477726f6e67206e756d626572206f6620646563696d616c737375626d697373696f6e206c6973742063617061636974792065786365656465646e6f207375626d697373696f6e737061697220646563696d616c73206e6f7420636f6e66696775726564746f6b656e2070616972206e6f7420666f756e646e6f20636f6d706c6574656420726f756e64736f6e6c79206f7261636c657320616c6c6f776564496e76616c6964207375626d697373696f6e20636f756e7454696d657374616d702069732066726f6d20746865206675747572654669727374207375626d697373696f6e20746f6f206f6c64646563696d616c736f7261636c65737375626d697373696f6e737375626d697373696f6e5f636f756e74736c6173685f71756f72756d6d656469616e3120696e76616c696420696e646578617373657274696f6e206661696c65643a206f666673657420213d2030202626206f6666736574203c3d206c656e617373657274696f6e206661696c65643a206f666673657420213d2030202626206f6666736574203c3d206c656e202626206c656e203e3d20327061757365436f6e747261637470617573655f6d6f64756c653a706175736564756e7061757365436f6e74726163747374616b696e675f6d6f64756c653a736c617368416d6f756e747374616b696e675f6d6f64756c653a736c61736851756f72756d7374616b696e675f6d6f64756c653a7374616b6564416d6f756e747374616b696e675f6d6f64756c653a7374616b696e67546f6b656e7374616b696e675f6d6f64756c653a7573657257686974656c6973747374616b696e675f6d6f64756c653a746f74616c536c6173686564416d6f756e747374616b696e675f6d6f64756c653a72657175697265645374616b65416d6f756e747374616b696e675f6d6f64756c653a736c617368696e6750726f706f73616c566f746572736f7261636c655f737461747573706169725f646563696d616c736c6173745f7375626d697373696f6e5f74696d657374616d7066697273745f7375626d697373696f6e5f74696d657374616d70726f756e64736e65775f726f756e64646973636172645f726f756e646164645f7375626d697373696f6e646973636172645f7375626d697373696f6e63616c6c656420604f7074696f6e3a3a756e77726170282960206f6e206120604e6f6e65602076616c756566756e6769626c65204553445420746f6b656e206578706563746564456e64706f696e742063616e206f6e6c792062652063616c6c6564206279206f776e6572696e646578206f7574206f662072616e67654e6f7420656e6f756768207374616b6570616e6963206f636375727265640041808f080b0438ffffff", + "report": { + "imports": [ + "bigIntAdd", + "bigIntCmp", + "bigIntFinishUnsigned", + "bigIntGetCallValue", + "bigIntGetUnsignedArgument", + "bigIntSetInt64", + "bigIntSign", + "bigIntSub", + "bigIntTDiv", + "checkNoPayment", + "getBlockEpoch", + "getBlockNonce", + "getBlockTimestamp", + "getNumArguments", + "mBufferAppend", + "mBufferAppendBytes", + "mBufferCopyByteSlice", + "mBufferEq", + "mBufferFinish", + "mBufferFromBigIntUnsigned", + "mBufferGetArgument", + "mBufferGetByteSlice", + "mBufferGetLength", + "mBufferNew", + "mBufferSetBytes", + "mBufferStorageLoad", + "mBufferStorageStore", + "mBufferToBigIntUnsigned", + "managedCaller", + "managedGetMultiESDTCallValue", + "managedMultiTransferESDTNFTExecute", + "managedOwnerAddress", + "managedSignalError", + "managedTransferValueExecute", + "managedWriteLog", + "signalError", + "smallIntFinishSigned", + "smallIntFinishUnsigned", + "smallIntGetUnsignedArgument" + ], + "isMemGrow": false, + "eiCheck": { + "eiVersion": "1.3", + "ok": true + }, + "codeReport": { + "path": "../output/multiversx-price-aggregator-sc.wasm", + "size": 19638, + "hasAllocator": false, + "hasPanic": "without message" + } + } +} diff --git a/esdt-safe/interactor/src/fee_market_proxy.rs b/esdt-safe/interactor/src/fee_market_proxy.rs new file mode 100644 index 00000000..b595c0f6 --- /dev/null +++ b/esdt-safe/interactor/src/fee_market_proxy.rs @@ -0,0 +1,278 @@ +// Code generated by the multiversx-sc proxy generator. DO NOT EDIT. + +//////////////////////////////////////////////////// +////////////////// AUTO-GENERATED ////////////////// +//////////////////////////////////////////////////// + +#![allow(dead_code)] +#![allow(clippy::all)] + +use multiversx_sc::proxy_imports::*; + +pub struct FeeMarketProxy; + +impl TxProxyTrait for FeeMarketProxy +where + Env: TxEnv, + From: TxFrom, + To: TxTo, + Gas: TxGas, +{ + type TxProxyMethods = FeeMarketProxyMethods; + + fn proxy_methods(self, tx: Tx) -> Self::TxProxyMethods { + FeeMarketProxyMethods { wrapped_tx: tx } + } +} + +pub struct FeeMarketProxyMethods +where + Env: TxEnv, + From: TxFrom, + To: TxTo, + Gas: TxGas, +{ + wrapped_tx: Tx, +} + +#[rustfmt::skip] +impl FeeMarketProxyMethods +where + Env: TxEnv, + Env::Api: VMApi, + From: TxFrom, + Gas: TxGas, +{ + pub fn init< + Arg0: ProxyArg>, + Arg1: ProxyArg>, + Arg2: ProxyArg>>, + >( + self, + esdt_safe_address: Arg0, + price_aggregator_address: Arg1, + fee: Arg2, + ) -> TxTypedDeploy { + self.wrapped_tx + .payment(NotPayable) + .raw_deploy() + .argument(&esdt_safe_address) + .argument(&price_aggregator_address) + .argument(&fee) + .original_result() + } +} + +#[rustfmt::skip] +impl FeeMarketProxyMethods +where + Env: TxEnv, + Env::Api: VMApi, + From: TxFrom, + To: TxTo, + Gas: TxGas, +{ + pub fn upgrade( + self, + ) -> TxTypedUpgrade { + self.wrapped_tx + .payment(NotPayable) + .raw_upgrade() + .original_result() + } +} + +#[rustfmt::skip] +impl FeeMarketProxyMethods +where + Env: TxEnv, + Env::Api: VMApi, + From: TxFrom, + To: TxTo, + Gas: TxGas, +{ + pub fn set_fee< + Arg0: ProxyArg>, + >( + self, + fee_struct: Arg0, + ) -> TxTypedCall { + self.wrapped_tx + .payment(NotPayable) + .raw_call("addFee") + .argument(&fee_struct) + .original_result() + } + + pub fn disable_fee< + Arg0: ProxyArg>, + >( + self, + base_token: Arg0, + ) -> TxTypedCall { + self.wrapped_tx + .payment(NotPayable) + .raw_call("removeFee") + .argument(&base_token) + .original_result() + } + + pub fn token_fee< + Arg0: ProxyArg>, + >( + self, + token_id: Arg0, + ) -> TxTypedCall> { + self.wrapped_tx + .payment(NotPayable) + .raw_call("getTokenFee") + .argument(&token_id) + .original_result() + } + + pub fn add_users_to_whitelist< + Arg0: ProxyArg>>, + >( + self, + users: Arg0, + ) -> TxTypedCall { + self.wrapped_tx + .payment(NotPayable) + .raw_call("addUsersToWhitelist") + .argument(&users) + .original_result() + } + + pub fn remove_users_from_whitelist< + Arg0: ProxyArg>>, + >( + self, + users: Arg0, + ) -> TxTypedCall { + self.wrapped_tx + .payment(NotPayable) + .raw_call("removeUsersFromWhitelist") + .argument(&users) + .original_result() + } + + /// Percentages have to be between 0 and 10_000, and must all add up to 100% (i.e. 10_000) + pub fn distribute_fees< + Arg0: ProxyArg, usize>>>, + >( + self, + address_percentage_pairs: Arg0, + ) -> TxTypedCall { + self.wrapped_tx + .payment(NotPayable) + .raw_call("distributeFees") + .argument(&address_percentage_pairs) + .original_result() + } + + pub fn subtract_fee< + Arg0: ProxyArg>, + Arg1: ProxyArg, + Arg2: ProxyArg>, + >( + self, + original_caller: Arg0, + total_transfers: Arg1, + opt_gas_limit: Arg2, + ) -> TxTypedCall> { + self.wrapped_tx + .raw_call("subtractFee") + .argument(&original_caller) + .argument(&total_transfers) + .argument(&opt_gas_limit) + .original_result() + } + + pub fn users_whitelist( + self, + ) -> TxTypedCall>> { + self.wrapped_tx + .payment(NotPayable) + .raw_call("getUsersWhitelist") + .original_result() + } + + pub fn set_min_valid_signers< + Arg0: ProxyArg, + >( + self, + new_value: Arg0, + ) -> TxTypedCall { + self.wrapped_tx + .payment(NotPayable) + .raw_call("setMinValidSigners") + .argument(&new_value) + .original_result() + } + + pub fn add_signers< + Arg0: ProxyArg>>, + >( + self, + signers: Arg0, + ) -> TxTypedCall { + self.wrapped_tx + .payment(NotPayable) + .raw_call("addSigners") + .argument(&signers) + .original_result() + } + + pub fn remove_signers< + Arg0: ProxyArg>>, + >( + self, + signers: Arg0, + ) -> TxTypedCall { + self.wrapped_tx + .payment(NotPayable) + .raw_call("removeSigners") + .argument(&signers) + .original_result() + } +} + +#[type_abi] +#[derive(TopDecode, TopEncode, NestedEncode, NestedDecode, Clone)] +pub struct FeeStruct +where + Api: ManagedTypeApi, +{ + pub base_token: TokenIdentifier, + pub fee_type: FeeType, +} + +#[rustfmt::skip] +#[type_abi] +#[derive(TopEncode, TopDecode, NestedEncode, NestedDecode, Clone)] +pub enum FeeType +where + Api: ManagedTypeApi, +{ + None, + Fixed { + token: TokenIdentifier, + per_transfer: BigUint, + per_gas: BigUint, + }, + AnyToken { + base_fee_token: TokenIdentifier, + per_transfer: BigUint, + per_gas: BigUint, + }, +} + +#[type_abi] +#[derive(TopEncode, TopDecode)] +pub struct FinalPayment +where + Api: ManagedTypeApi, +{ + pub fee: EsdtTokenPayment, + pub remaining_tokens: EsdtTokenPayment, +} diff --git a/esdt-safe/interactor/src/interactor_main.rs b/esdt-safe/interactor/src/interactor_main.rs index d248a534..3261dfcb 100644 --- a/esdt-safe/interactor/src/interactor_main.rs +++ b/esdt-safe/interactor/src/interactor_main.rs @@ -1,27 +1,27 @@ #![allow(non_snake_case)] +mod price_aggregator_proxy; mod proxy; +use fee_market::fee_market_proxy::FeeMarketProxy; +use fee_market::fee_market_proxy::{self, FeeStruct, FeeType}; use multiversx_sc_snippets::imports::*; use multiversx_sc_snippets::sdk; use serde::{Deserialize, Serialize}; -use transaction::OperationData; -use transaction::PaymentsVec; -use transaction::{GasLimit, Operation}; use std::{ io::{Read, Write}, path::Path, }; - +use transaction::{GasLimit, Operation, OperationData, PaymentsVec}; const GATEWAY: &str = sdk::gateway::DEVNET_GATEWAY; const STATE_FILE: &str = "state.toml"; const TOKEN_ID: &[u8] = b"SVT-805b28"; +const WHITELISTED_TOKEN_ID: &[u8] = b"CHOCOLATE-daf625"; type OptionalTransferData = OptionalValue, ManagedVec>>>; - #[tokio::main] async fn main() { env_logger::init(); @@ -35,7 +35,7 @@ async fn main() { "upgrade" => interact.upgrade().await, "setFeeMarketAddress" => interact.set_fee_market_address().await, "setHeaderVerifierAddress" => interact.set_header_verifier_address().await, - "deposit" => interact.deposit(OptionalTransferData::None).await, + "deposit" => interact.deposit(OptionalTransferData::None, None).await, "setMinValidSigners" => interact.set_min_valid_signers().await, "addSigners" => interact.add_signers().await, "removeSigners" => interact.remove_signers().await, @@ -52,9 +52,9 @@ async fn main() { "setMaxBridgedAmount" => interact.set_max_bridged_amount().await, "getMaxBridgedAmount" => interact.max_bridged_amount().await, "endSetupPhase" => interact.end_setup_phase().await, - "addTokensToWhitelist" => interact.add_tokens_to_whitelist().await, + "addTokensToWhitelist" => interact.add_tokens_to_whitelist(b"").await, "removeTokensFromWhitelist" => interact.remove_tokens_from_whitelist().await, - "addTokensToBlacklist" => interact.add_tokens_to_blacklist().await, + "addTokensToBlacklist" => interact.add_tokens_to_blacklist(b"").await, "removeTokensFromBlacklist" => interact.remove_tokens_from_blacklist().await, "getTokenWhitelist" => interact.token_whitelist().await, "getTokenBlacklist" => interact.token_blacklist().await, @@ -67,74 +67,106 @@ async fn main() { #[derive(Debug, Default, Serialize, Deserialize)] struct State { - contract_address: Option + contract_address: Option, + fee_market_address: Option, + price_aggregator_address: Option, } impl State { - // Deserializes state from file - pub fn load_state() -> Self { - if Path::new(STATE_FILE).exists() { - let mut file = std::fs::File::open(STATE_FILE).unwrap(); - let mut content = String::new(); - file.read_to_string(&mut content).unwrap(); - toml::from_str(&content).unwrap() - } else { - Self::default() - } - } - - /// Sets the contract address - pub fn set_address(&mut self, address: Bech32Address) { - self.contract_address = Some(address); - } - - /// Returns the contract address - pub fn current_address(&self) -> &Bech32Address { - self.contract_address - .as_ref() - .expect("no known contract, deploy first") + // Deserializes state from file + pub fn load_state() -> Self { + if Path::new(STATE_FILE).exists() { + let mut file = std::fs::File::open(STATE_FILE).unwrap(); + let mut content = String::new(); + file.read_to_string(&mut content).unwrap(); + toml::from_str(&content).unwrap() + } else { + Self::default() } } - - impl Drop for State { - // Serializes state to file - fn drop(&mut self) { - let mut file = std::fs::File::create(STATE_FILE).unwrap(); - file.write_all(toml::to_string(self).unwrap().as_bytes()) - .unwrap(); - } + + /// Sets the contract address + pub fn set_address(&mut self, address: Bech32Address) { + self.contract_address = Some(address); + } + + pub fn set_fee_market_address(&mut self, address: Bech32Address) { + self.fee_market_address = Some(address); + } + + pub fn set_price_aggregator_address(&mut self, address: Bech32Address) { + self.price_aggregator_address = Some(address); + } + + /// Returns the contract address + pub fn current_address(&self) -> &Bech32Address { + self.contract_address + .as_ref() + .expect("no known contract, deploy first") + } +} + +impl Drop for State { + // Serializes state to file + fn drop(&mut self) { + let mut file = std::fs::File::create(STATE_FILE).unwrap(); + file.write_all(toml::to_string(self).unwrap().as_bytes()) + .unwrap(); } +} struct ContractInteract { interactor: Interactor, wallet_address: Address, - bob_adress: Address, + bob_address: Address, + alice_address: Address, + mike_address: Address, + judy_address: Address, contract_code: BytesValue, - state: State + fee_market_code: BytesValue, + price_aggregator_code: BytesValue, + state: State, } impl ContractInteract { async fn new() -> Self { let mut interactor = Interactor::new(GATEWAY).await; let wallet_address = interactor.register_wallet(test_wallets::frank()); - let bob_adress = interactor.register_wallet(test_wallets::bob()); - + let bob_address = interactor.register_wallet(test_wallets::bob()); + let alice_address = interactor.register_wallet(test_wallets::alice()); + let mike_address = interactor.register_wallet(test_wallets::mike()); + let judy_address = interactor.register_wallet(test_wallets::judy()); + let contract_code = BytesValue::interpret_from( "mxsc:../output/esdt-safe.mxsc.json", &InterpreterContext::default(), ); + let fee_market_code = BytesValue::interpret_from( + "mxsc:contract-codes/fee-market.mxsc.json", + &InterpreterContext::default(), + ); + + let price_aggregator_code = BytesValue::interpret_from( + "mxsc:contract-codes/multiversx-price-aggregator-sc.mxsc.json", + &InterpreterContext::default(), + ); + ContractInteract { interactor, wallet_address, - bob_adress, + bob_address, + alice_address, + mike_address, + judy_address, contract_code, - state: State::load_state() + fee_market_code, + price_aggregator_code, + state: State::load_state(), } } async fn deploy(&mut self, is_sov_chain: bool) { - let new_address = self .interactor .tx() @@ -148,12 +180,92 @@ impl ContractInteract { .run() .await; let new_address_bech32 = bech32::encode(&new_address); - self.state - .set_address(Bech32Address::from_bech32_string(new_address_bech32.clone())); + self.state.set_address(Bech32Address::from_bech32_string( + new_address_bech32.clone(), + )); println!("new address: {new_address_bech32}"); } + async fn deploy_fee_market(&mut self) { + let fee = FeeStruct { + base_token: TokenIdentifier::from_esdt_bytes(TOKEN_ID), + fee_type: FeeType::Fixed { + token: TokenIdentifier::from_esdt_bytes(TOKEN_ID), + per_transfer: BigUint::from(10u64), + per_gas: BigUint::from(0u64), + }, + }; + + let price_aggregator_address = managed_address!(self + .state + .price_aggregator_address + .clone() + .unwrap() + .as_address()); + + let new_address = self + .interactor + .tx() + .from(&self.wallet_address) + .gas(100_000_000u64) + .typed(fee_market_proxy::FeeMarketProxy) + .init( + self.state.current_address(), + price_aggregator_address, + Option::Some(fee), + ) + .code(&self.fee_market_code) + .returns(ReturnsNewAddress) + .prepare_async() + .run() + .await; + let new_address_bech32 = bech32::encode(&new_address); + self.state + .set_fee_market_address(Bech32Address::from_bech32_string( + new_address_bech32.clone(), + )); + println!("new fee_market_address: {new_address_bech32}"); + } + + async fn deploy_price_aggregator(&mut self) { + let mut oracles = MultiValueEncoded::new(); + let first_oracle_adress = managed_address!(&self.bob_address.clone()); + let second_oracle_adress = managed_address!(&self.alice_address.clone()); + let third_oracle_adress = managed_address!(&self.mike_address.clone()); + let forth_oracle_address = managed_address!(&self.judy_address.clone()); + oracles.push(first_oracle_adress); + oracles.push(second_oracle_adress); + oracles.push(third_oracle_adress); + oracles.push(forth_oracle_address); + + let new_address = self + .interactor + .tx() + .from(&self.wallet_address) + .gas(100_000_000u64) + .typed(price_aggregator_proxy::PriceAggregatorProxy) + .init( + TokenIdentifier::from_esdt_bytes(TOKEN_ID), + BigUint::from(1u64), + BigUint::from(1u64), + 3u8, + 3u8, + oracles, + ) + .code(&self.price_aggregator_code) + .returns(ReturnsNewAddress) + .prepare_async() + .run() + .await; + let new_address_bech32 = bech32::encode(&new_address); + self.state + .set_price_aggregator_address(Bech32Address::from_bech32_string( + new_address_bech32.clone(), + )); + println!("new token_handler_address: {new_address_bech32}"); + } + async fn upgrade(&mut self) { let response = self .interactor @@ -174,8 +286,7 @@ impl ContractInteract { } async fn set_fee_market_address(&mut self) { - let fee_market_address = bech32::decode(""); - + let fee_market_address = self.state.fee_market_address.clone().unwrap(); let response = self .interactor .tx() @@ -211,31 +322,53 @@ impl ContractInteract { println!("Result: {response:?}"); } - async fn deposit(&mut self, transfer_data: OptionalTransferData) { + async fn deposit( + &mut self, + transfer_data: OptionalTransferData, + expect_error: Option>, + ) { let token_id = TOKEN_ID; let token_nonce = 0u64; let token_amount = BigUint::::from(20u64); - let to = &self.bob_adress; + let to = &self.bob_address; let mut payments = PaymentsVec::new(); - payments.push(EsdtTokenPayment::new(TokenIdentifier::from(token_id), token_nonce, token_amount)); - payments.push(EsdtTokenPayment::new(TokenIdentifier::from(token_id), token_nonce, BigUint::from(30u64))); - - let response = self - .interactor - .tx() - .from(&self.wallet_address) - .to(self.state.current_address()) - .gas(30_000_000u64) - .typed(proxy::EsdtSafeProxy) - .deposit(to, transfer_data) - .payment(payments) - .returns(ReturnsResultUnmanaged) - .prepare_async() - .run() - .await; - - println!("Result: {response:?}"); + payments.push(EsdtTokenPayment::new( + TokenIdentifier::from(token_id), + token_nonce, + token_amount, + )); + + match expect_error { + Some(error) => { + self.interactor + .tx() + .from(&self.wallet_address) + .to(self.state.current_address()) + .gas(90_000_000u64) + .typed(proxy::EsdtSafeProxy) + .deposit(to, transfer_data) + .payment(payments) + .returns(error) + .prepare_async() + .run() + .await; + } + None => { + self.interactor + .tx() + .from(&self.wallet_address) + .to(self.state.current_address()) + .gas(90_000_000u64) + .typed(proxy::EsdtSafeProxy) + .deposit(to, transfer_data) + .payment(payments) + .returns(ReturnsResultUnmanaged) + .prepare_async() + .run() + .await; + } + } } async fn set_min_valid_signers(&mut self) { @@ -296,22 +429,28 @@ impl ContractInteract { } async fn register_token(&mut self) { - let egld_amount = BigUint::::from(0u128); + let egld_amount = BigUint::::from(50_000_000_000_000_000u64); - let sov_token_id = TokenIdentifier::from_esdt_bytes(&b""[..]); - let token_type = EsdtTokenType::NonFungible; - let token_display_name = ManagedBuffer::new_from_bytes(&b""[..]); - let token_ticker = ManagedBuffer::new_from_bytes(&b""[..]); - let num_decimals = 0u32; + let sov_token_id = TokenIdentifier::from_esdt_bytes(&b"SOV"[..]); + let token_type = EsdtTokenType::Fungible; + let token_display_name = ManagedBuffer::new_from_bytes(&b"SOVEREIGN"[..]); + let token_ticker = ManagedBuffer::new_from_bytes(&b"SVCT"[..]); + let num_decimals = 18u32; let response = self .interactor .tx() .from(&self.wallet_address) .to(self.state.current_address()) - .gas(30_000_000u64) + .gas(90_000_000u64) .typed(proxy::EsdtSafeProxy) - .register_token(sov_token_id, token_type, token_display_name, token_ticker, num_decimals) + .register_token( + sov_token_id, + token_type, + token_display_name, + token_ticker, + num_decimals, + ) .egld(egld_amount) .returns(ReturnsResultUnmanaged) .prepare_async() @@ -323,7 +462,11 @@ impl ContractInteract { async fn execute_operations(&mut self) { let hash_of_hashes = ManagedBuffer::new_from_bytes(&b""[..]); - let operation = Operation::new(ManagedAddress::zero(), ManagedVec::new(), OperationData::new(0 , ManagedAddress::zero(), None)); + let operation = Operation::new( + ManagedAddress::zero(), + ManagedVec::new(), + OperationData::new(0, ManagedAddress::zero(), None), + ); let response = self .interactor @@ -380,7 +523,7 @@ impl ContractInteract { } async fn get_current_tx_batch(&mut self) { - let _ = self + let _ = self .interactor .query() .to(self.state.current_address()) @@ -393,7 +536,7 @@ impl ContractInteract { } async fn get_first_batch_any_status(&mut self) { - let _ = self + let _ = self .interactor .query() .to(self.state.current_address()) @@ -423,8 +566,7 @@ impl ContractInteract { async fn get_batch_status(&mut self) { let batch_id = 0u64; - self - .interactor + self.interactor .query() .to(self.state.current_address()) .typed(proxy::EsdtSafeProxy) @@ -519,8 +661,8 @@ impl ContractInteract { println!("Result: {response:?}"); } - async fn add_tokens_to_whitelist(&mut self) { - let tokens = MultiValueVec::from(vec![TokenIdentifier::from_esdt_bytes(&b""[..])]); + async fn add_tokens_to_whitelist(&mut self, token_id: &[u8]) { + let tokens = MultiValueVec::from(vec![TokenIdentifier::from_esdt_bytes(token_id)]); let response = self .interactor @@ -557,8 +699,8 @@ impl ContractInteract { println!("Result: {response:?}"); } - async fn add_tokens_to_blacklist(&mut self) { - let tokens = MultiValueVec::from(vec![TokenIdentifier::from_esdt_bytes(&b""[..])]); + async fn add_tokens_to_blacklist(&mut self, token_id: &[u8]) { + let tokens = MultiValueVec::from(vec![TokenIdentifier::from_esdt_bytes(token_id)]); let response = self .interactor @@ -673,10 +815,76 @@ impl ContractInteract { println!("Result: {result_value:?}"); } + + async fn disable_fee(&mut self) { + let response = self + .interactor + .tx() + .from(&self.wallet_address) + .to(self.state.current_address()) + .gas(30_000_000u64) + .typed(FeeMarketProxy) + .disable_fee(TOKEN_ID) + .returns(ReturnsResultUnmanaged) + .prepare_async() + .run() + .await; + + println!("Result: {response:?}"); + } } #[tokio::test] async fn test_deploy() { let mut interact = ContractInteract::new().await; interact.deploy(false).await; + interact.deploy_price_aggregator().await; + interact.deploy_fee_market().await; + interact.set_fee_market_address().await; + interact.unpause_endpoint().await; + interact.disable_fee().await; +} + +#[tokio::test] +async fn test_deploy_sov() { + let mut interact = ContractInteract::new().await; + interact.deploy(true).await; + interact.deploy_price_aggregator().await; + interact.deploy_fee_market().await; + interact.set_fee_market_address().await; + interact.unpause_endpoint().await; +} + +/* Waiting for fix on initiator_address +#[tokio::test] +async fn test_deposit_and_refund() { + let mut interact = ContractInteract::new().await; + interact.unpause_endpoint().await; + interact.add_tokens_to_whitelist(WHITELISTED_TOKEN_ID).await; + interact.deposit(OptionalTransferData::None, None).await; +} + +#[tokio::test] +async fn test_whitelist_then_blacklist() { + let mut interact = ContractInteract::new().await; + interact.unpause_endpoint().await; + interact.add_tokens_to_whitelist(TOKEN_ID).await; + interact.deposit(OptionalTransferData::None, None).await; + interact.add_tokens_to_blacklist(TOKEN_ID).await; + interact.deposit(OptionalTransferData::None, Some(ExpectError(4, "Token blacklisted"))).await; +} + +// Waiting for gas fix & requires deploy with is_sov_chain on true +#[tokio::test] +async fn test_burn_token_on_sov_chain() { + let mut interact = ContractInteract::new().await; + interact.deposit(OptionalTransferData::None, None).await; +} +*/ + +#[tokio::test] +async fn test_register_token_and_deposit() { + let mut interact = ContractInteract::new().await; + //interact.register_token().await; + interact.deposit(OptionalTransferData::None, None).await; } diff --git a/esdt-safe/interactor/src/price_aggregator_proxy.rs b/esdt-safe/interactor/src/price_aggregator_proxy.rs new file mode 100644 index 00000000..7a7e2aaa --- /dev/null +++ b/esdt-safe/interactor/src/price_aggregator_proxy.rs @@ -0,0 +1,416 @@ +// Code generated by the multiversx-sc proxy generator. DO NOT EDIT. + +//////////////////////////////////////////////////// +////////////////// AUTO-GENERATED ////////////////// +//////////////////////////////////////////////////// + +#![allow(dead_code)] +#![allow(clippy::all)] + +use multiversx_sc::proxy_imports::*; + +pub struct PriceAggregatorProxy; + +impl TxProxyTrait for PriceAggregatorProxy +where + Env: TxEnv, + From: TxFrom, + To: TxTo, + Gas: TxGas, +{ + type TxProxyMethods = PriceAggregatorProxyMethods; + + fn proxy_methods(self, tx: Tx) -> Self::TxProxyMethods { + PriceAggregatorProxyMethods { wrapped_tx: tx } + } +} + +pub struct PriceAggregatorProxyMethods +where + Env: TxEnv, + From: TxFrom, + To: TxTo, + Gas: TxGas, +{ + wrapped_tx: Tx, +} + +#[rustfmt::skip] +impl PriceAggregatorProxyMethods +where + Env: TxEnv, + Env::Api: VMApi, + From: TxFrom, + Gas: TxGas, +{ + pub fn init< + Arg0: ProxyArg>, + Arg1: ProxyArg>, + Arg2: ProxyArg>, + Arg3: ProxyArg, + Arg4: ProxyArg, + Arg5: ProxyArg>>, + >( + self, + staking_token: Arg0, + staking_amount: Arg1, + slash_amount: Arg2, + slash_quorum: Arg3, + submission_count: Arg4, + oracles: Arg5, + ) -> TxTypedDeploy { + self.wrapped_tx + .payment(NotPayable) + .raw_deploy() + .argument(&staking_token) + .argument(&staking_amount) + .argument(&slash_amount) + .argument(&slash_quorum) + .argument(&submission_count) + .argument(&oracles) + .original_result() + } +} + +#[rustfmt::skip] +impl PriceAggregatorProxyMethods +where + Env: TxEnv, + Env::Api: VMApi, + From: TxFrom, + To: TxTo, + Gas: TxGas, +{ + pub fn upgrade( + self, + ) -> TxTypedUpgrade { + self.wrapped_tx + .payment(NotPayable) + .raw_upgrade() + .original_result() + } +} + +#[rustfmt::skip] +impl PriceAggregatorProxyMethods +where + Env: TxEnv, + Env::Api: VMApi, + From: TxFrom, + To: TxTo, + Gas: TxGas, +{ + pub fn change_amounts< + Arg0: ProxyArg>, + Arg1: ProxyArg>, + >( + self, + staking_amount: Arg0, + slash_amount: Arg1, + ) -> TxTypedCall { + self.wrapped_tx + .payment(NotPayable) + .raw_call("changeAmounts") + .argument(&staking_amount) + .argument(&slash_amount) + .original_result() + } + + pub fn add_oracles< + Arg0: ProxyArg>>, + >( + self, + oracles: Arg0, + ) -> TxTypedCall { + self.wrapped_tx + .payment(NotPayable) + .raw_call("addOracles") + .argument(&oracles) + .original_result() + } + + /// Also receives submission count, + /// so the owner does not have to update it manually with setSubmissionCount before this call + pub fn remove_oracles< + Arg0: ProxyArg, + Arg1: ProxyArg>>, + >( + self, + submission_count: Arg0, + oracles: Arg1, + ) -> TxTypedCall { + self.wrapped_tx + .payment(NotPayable) + .raw_call("removeOracles") + .argument(&submission_count) + .argument(&oracles) + .original_result() + } + + pub fn submit< + Arg0: ProxyArg>, + Arg1: ProxyArg>, + Arg2: ProxyArg, + Arg3: ProxyArg>, + Arg4: ProxyArg, + >( + self, + from: Arg0, + to: Arg1, + submission_timestamp: Arg2, + price: Arg3, + decimals: Arg4, + ) -> TxTypedCall { + self.wrapped_tx + .payment(NotPayable) + .raw_call("submit") + .argument(&from) + .argument(&to) + .argument(&submission_timestamp) + .argument(&price) + .argument(&decimals) + .original_result() + } + + pub fn submit_batch< + Arg0: ProxyArg, ManagedBuffer, u64, BigUint, u8>>>, + >( + self, + submissions: Arg0, + ) -> TxTypedCall { + self.wrapped_tx + .payment(NotPayable) + .raw_call("submitBatch") + .argument(&submissions) + .original_result() + } + + pub fn latest_round_data( + self, + ) -> TxTypedCall>> { + self.wrapped_tx + .payment(NotPayable) + .raw_call("latestRoundData") + .original_result() + } + + pub fn latest_price_feed< + Arg0: ProxyArg>, + Arg1: ProxyArg>, + >( + self, + from: Arg0, + to: Arg1, + ) -> TxTypedCall, ManagedBuffer, u64, BigUint, u8>> { + self.wrapped_tx + .payment(NotPayable) + .raw_call("latestPriceFeed") + .argument(&from) + .argument(&to) + .original_result() + } + + pub fn latest_price_feed_optional< + Arg0: ProxyArg>, + Arg1: ProxyArg>, + >( + self, + from: Arg0, + to: Arg1, + ) -> TxTypedCall, ManagedBuffer, u64, BigUint, u8>>> { + self.wrapped_tx + .payment(NotPayable) + .raw_call("latestPriceFeedOptional") + .argument(&from) + .argument(&to) + .original_result() + } + + pub fn set_submission_count< + Arg0: ProxyArg, + >( + self, + submission_count: Arg0, + ) -> TxTypedCall { + self.wrapped_tx + .payment(NotPayable) + .raw_call("setSubmissionCount") + .argument(&submission_count) + .original_result() + } + + pub fn get_oracles( + self, + ) -> TxTypedCall>> { + self.wrapped_tx + .payment(NotPayable) + .raw_call("getOracles") + .original_result() + } + + pub fn set_pair_decimals< + Arg0: ProxyArg>, + Arg1: ProxyArg>, + Arg2: ProxyArg, + >( + self, + from: Arg0, + to: Arg1, + decimals: Arg2, + ) -> TxTypedCall { + self.wrapped_tx + .payment(NotPayable) + .raw_call("setPairDecimals") + .argument(&from) + .argument(&to) + .argument(&decimals) + .original_result() + } + + pub fn get_pair_decimals< + Arg0: ProxyArg>, + Arg1: ProxyArg>, + >( + self, + from: Arg0, + to: Arg1, + ) -> TxTypedCall { + self.wrapped_tx + .payment(NotPayable) + .raw_call("getPairDecimals") + .argument(&from) + .argument(&to) + .original_result() + } + + pub fn submission_count( + self, + ) -> TxTypedCall { + self.wrapped_tx + .payment(NotPayable) + .raw_call("submission_count") + .original_result() + } + + pub fn pause_endpoint( + self, + ) -> TxTypedCall { + self.wrapped_tx + .payment(NotPayable) + .raw_call("pause") + .original_result() + } + + pub fn unpause_endpoint( + self, + ) -> TxTypedCall { + self.wrapped_tx + .payment(NotPayable) + .raw_call("unpause") + .original_result() + } + + pub fn paused_status( + self, + ) -> TxTypedCall { + self.wrapped_tx + .payment(NotPayable) + .raw_call("isPaused") + .original_result() + } + + pub fn stake( + self, + ) -> TxTypedCall { + self.wrapped_tx + .raw_call("stake") + .original_result() + } + + pub fn unstake< + Arg0: ProxyArg>, + >( + self, + unstake_amount: Arg0, + ) -> TxTypedCall { + self.wrapped_tx + .payment(NotPayable) + .raw_call("unstake") + .argument(&unstake_amount) + .original_result() + } + + pub fn vote_slash_member< + Arg0: ProxyArg>, + >( + self, + member_to_slash: Arg0, + ) -> TxTypedCall { + self.wrapped_tx + .payment(NotPayable) + .raw_call("voteSlashMember") + .argument(&member_to_slash) + .original_result() + } + + pub fn cancel_vote_slash_member< + Arg0: ProxyArg>, + >( + self, + member_to_slash: Arg0, + ) -> TxTypedCall { + self.wrapped_tx + .payment(NotPayable) + .raw_call("cancelVoteSlashMember") + .argument(&member_to_slash) + .original_result() + } + + pub fn slash_member< + Arg0: ProxyArg>, + >( + self, + member_to_slash: Arg0, + ) -> TxTypedCall { + self.wrapped_tx + .payment(NotPayable) + .raw_call("slashMember") + .argument(&member_to_slash) + .original_result() + } +} + +#[type_abi] +#[derive(NestedEncode, NestedDecode, TopEncode, TopDecode)] +pub struct PriceFeed +where + Api: ManagedTypeApi, +{ + pub round_id: u32, + pub from: ManagedBuffer, + pub to: ManagedBuffer, + pub timestamp: u64, + pub price: BigUint, + pub decimals: u8, +} + +#[type_abi] +#[derive(TopEncode)] +pub struct NewRoundEvent +where + Api: ManagedTypeApi, +{ + pub price: BigUint, + pub timestamp: u64, + pub decimals: u8, + pub block: u64, + pub epoch: u64, +} + +#[type_abi] +#[derive(TopEncode)] +pub struct DiscardSubmissionEvent { + pub submission_timestamp: u64, + pub first_submission_timestamp: u64, + pub has_caller_already_submitted: bool, +} diff --git a/esdt-safe/interactor/state.toml b/esdt-safe/interactor/state.toml index 7d0cb701..8b4cda2a 100644 --- a/esdt-safe/interactor/state.toml +++ b/esdt-safe/interactor/state.toml @@ -1 +1,3 @@ -contract_address = "erd1qqqqqqqqqqqqqpgqvq86d7xl8p3q74lxh59p3p3ncalrd7kkt7asgf7m7v" +contract_address = "erd1qqqqqqqqqqqqqpgqr6m9gnreldnk7efzeanchpa5s84rl7cqt7ascj2q4m" +fee_market_address = "erd1qqqqqqqqqqqqqpgqzh0vtrpuc47dk05ytd7akms950utmljxt7as2k94hu" +price_aggregator_address = "erd1qqqqqqqqqqqqqpgq4zhxptkn7qmjvq6c2m03wg7wam4vp0ewt7as50a74x" From 001182f88a921cd52f99a44145593766bb2b8e87 Mon Sep 17 00:00:00 2001 From: sergiuosvat Date: Mon, 14 Oct 2024 10:38:22 +0300 Subject: [PATCH 409/523] fix versions for interactor --- esdt-safe/interactor/Cargo.toml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/esdt-safe/interactor/Cargo.toml b/esdt-safe/interactor/Cargo.toml index 1ffd3c12..9bbac37c 100644 --- a/esdt-safe/interactor/Cargo.toml +++ b/esdt-safe/interactor/Cargo.toml @@ -22,10 +22,10 @@ path = "../../common/tx-batch-module" path = "../../fee-market" [dependencies.multiversx-sc-snippets] -version = "0.53.1" +version = "0.53.2" [dependencies.multiversx-sc] -version = "0.53.1" +version = "0.53.2" [dependencies] clap = { version = "4.4.7", features = ["derive"] } From 1be73aa613fac7ac0506263232a3011c76f44645 Mon Sep 17 00:00:00 2001 From: sergiuosvat Date: Mon, 14 Oct 2024 10:42:37 +0300 Subject: [PATCH 410/523] update proxy --- esdt-safe/interactor/src/proxy.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/esdt-safe/interactor/src/proxy.rs b/esdt-safe/interactor/src/proxy.rs index 1c463ded..a04bcc03 100644 --- a/esdt-safe/interactor/src/proxy.rs +++ b/esdt-safe/interactor/src/proxy.rs @@ -117,12 +117,12 @@ where >( self, to: Arg0, - opt_transfer_data: Arg1, + optional_transfer_data: Arg1, ) -> TxTypedCall { self.wrapped_tx .raw_call("deposit") .argument(&to) - .argument(&opt_transfer_data) + .argument(&optional_transfer_data) .original_result() } From c162eb3ea585c846b5a9fd96f545c2441bfcd334 Mon Sep 17 00:00:00 2001 From: Andrei Baltariu Date: Mon, 14 Oct 2024 10:47:06 +0300 Subject: [PATCH 411/523] Reverted use of PaymentEvent struct Signed-off-by: Andrei Baltariu --- esdt-safe/src/to_sovereign/create_tx.rs | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/esdt-safe/src/to_sovereign/create_tx.rs b/esdt-safe/src/to_sovereign/create_tx.rs index a070b32d..86898070 100644 --- a/esdt-safe/src/to_sovereign/create_tx.rs +++ b/esdt-safe/src/to_sovereign/create_tx.rs @@ -2,7 +2,7 @@ use crate::from_sovereign::token_mapping; use fee_market::fee_market_proxy; use multiversx_sc::storage::StorageKey; use transaction::{ - EventPayment, ExtractedFeeResult, GasLimit, OperationData, OptionalValueTransferDataTuple, + EventPaymentTuple, ExtractedFeeResult, GasLimit, OperationData, OptionalValueTransferDataTuple, TransferData, }; @@ -36,7 +36,8 @@ pub trait CreateTxModule: require!(payments.len() <= MAX_TRANSFERS_PER_TX, "Too many tokens"); let mut total_tokens_for_fees = 0usize; - let mut event_payments = MultiValueEncoded::new(); + let mut event_payments = + MultiValueEncoded::>::new(); let mut refundable_payments = ManagedVec::::new(); let own_sc_address = self.blockchain().get_sc_address(); @@ -70,12 +71,11 @@ pub trait CreateTxModule: .burn(&payment.token_identifier, &payment.amount) .transfer_execute(); - let event_payment = EventPayment::new( + event_payments.push(MultiValue3::from(( payment.token_identifier, payment.token_nonce, current_token_data, - ); - event_payments.push(event_payment); + ))); } else { let mvx_to_sov_token_id_mapper = self.multiversx_to_sovereign_token_id_mapper(&payment.token_identifier); @@ -83,16 +83,17 @@ pub trait CreateTxModule: let sov_token_id = mvx_to_sov_token_id_mapper.get(); let sov_token_nonce = self.burn_mainchain_token(payment, &sov_token_id); - let event_payment = - EventPayment::new(sov_token_id, sov_token_nonce, current_token_data); - event_payments.push(event_payment); + event_payments.push(MultiValue3::from(( + sov_token_id, + sov_token_nonce, + current_token_data, + ))); } else { - let event_payment = EventPayment::new( + event_payments.push(MultiValue3::from(( payment.token_identifier, payment.token_nonce, current_token_data, - ); - event_payments.push(event_payment); + ))); } } } @@ -112,7 +113,7 @@ pub trait CreateTxModule: let tx_nonce = self.get_and_save_next_tx_id(); self.deposit_event( &to, - &EventPayment::map_to_tuple_multi_value(event_payments), + &event_payments, OperationData::new(tx_nonce, caller, option_transfer_data), ); } From 54356ecdb778adb07f78beeaadf40763ce9b0639 Mon Sep 17 00:00:00 2001 From: Andrei Baltariu Date: Mon, 14 Oct 2024 11:26:12 +0300 Subject: [PATCH 412/523] Modified mint logic Signed-off-by: Andrei Baltariu --- .../src/from_sovereign/transfer_tokens.rs | 85 ++++++++++++++----- 1 file changed, 65 insertions(+), 20 deletions(-) diff --git a/esdt-safe/src/from_sovereign/transfer_tokens.rs b/esdt-safe/src/from_sovereign/transfer_tokens.rs index 43db0c91..f06c080d 100644 --- a/esdt-safe/src/from_sovereign/transfer_tokens.rs +++ b/esdt-safe/src/from_sovereign/transfer_tokens.rs @@ -65,8 +65,9 @@ pub trait TransferTokensModule: // token is from sovereign -> continue and mint let mvx_token_id = sov_to_mvx_token_id_mapper.get(); + let current_token_type_ref = &operation_token.token_data.token_type; - if operation_token.token_nonce == 0 { + if self.is_fungible(current_token_type_ref) { self.tx() .to(ToSelf) .typed(system_proxy::UserBuiltinProxy) @@ -99,32 +100,59 @@ pub trait TransferTokensModule: mvx_token_id: &TokenIdentifier, operation_token: &OperationEsdtPayment, ) -> u64 { + let mut nonce = 0; + + let current_token_type_ref = &operation_token.token_data.token_type; + + // if doesn't exist in mapper nonce will be 0 and we need to create the SFT/MetaESDT, otherwise mint + if self.is_sft_or_meta(current_token_type_ref) { + nonce = self.get_mvx_nonce_from_mapper(mvx_token_id, operation_token.token_nonce) + } + // mint NFT - let nft_nonce = self - .tx() + if nonce == 0 { + // if NFT/DyNFT => esdt_nft_create + nonce = self.mint_nft_tx(mvx_token_id, &operation_token.token_data); + + // save token id and nonce + self.update_esdt_info_mappers( + &operation_token.token_identifier, + operation_token.token_nonce, + mvx_token_id, + nonce, + ); + } else { + // if SFT/DySFT/Meta/DyMeta => esdt_local_mint (add quantity) + self.tx() + .to(ToSelf) + .typed(system_proxy::UserBuiltinProxy) + .esdt_local_mint(mvx_token_id, nonce, &operation_token.token_data.amount) + .sync_call(); + } + + nonce + } + + #[inline] + fn mint_nft_tx( + &self, + mvx_token_id: &TokenIdentifier, + token_data: &EsdtTokenData, + ) -> u64 { + self.tx() .to(ToSelf) .typed(system_proxy::UserBuiltinProxy) .esdt_nft_create( mvx_token_id, - &operation_token.token_data.amount, - &operation_token.token_data.name, - &operation_token.token_data.royalties, - &operation_token.token_data.hash, - &operation_token.token_data.attributes, - &operation_token.token_data.uris, + &token_data.amount, + &token_data.name, + &token_data.royalties, + &token_data.hash, + &token_data.attributes, + &token_data.uris, ) .returns(ReturnsResult) - .sync_call(); - - // save token id and nonce - self.update_esdt_info_mappers( - &operation_token.token_identifier, - operation_token.token_nonce, - mvx_token_id, - nft_nonce, - ); - - nft_nonce + .sync_call() } // TODO: create a callback module @@ -294,6 +322,23 @@ pub trait TransferTokensModule: } } + #[inline] + fn is_fungible(self, token_type: &EsdtTokenType) -> bool { + *token_type == EsdtTokenType::Fungible + } + + #[inline] + fn is_sft_or_meta(self, token_type: &EsdtTokenType) -> bool { + *token_type == EsdtTokenType::SemiFungible || *token_type == EsdtTokenType::Meta + } + + #[inline] + fn get_mvx_nonce_from_mapper(self, token_id: &TokenIdentifier, nonce: u64) -> u64 { + self.sovereign_to_multiversx_esdt_info_mapper(token_id, nonce) + .get() + .token_nonce + } + #[storage_mapper("pendingHashes")] fn pending_hashes(&self, hash_of_hashes: &ManagedBuffer) -> UnorderedSetMapper; From 3bc8617116da2e9d9bb7364d8fb2455069656663 Mon Sep 17 00:00:00 2001 From: sergiuosvat Date: Mon, 14 Oct 2024 14:46:44 +0300 Subject: [PATCH 413/523] update interactor setup --- esdt-safe/interactor/Cargo.toml | 3 + .../contract-codes/header-verifier.mxsc.json | 160 ++++++++++++++++ .../interactor/src/header_verifier_proxy.rs | 174 ++++++++++++++++++ esdt-safe/interactor/src/interactor_main.rs | 119 +++++++++++- esdt-safe/interactor/state.toml | 7 +- 5 files changed, 450 insertions(+), 13 deletions(-) create mode 100644 esdt-safe/interactor/contract-codes/header-verifier.mxsc.json create mode 100644 esdt-safe/interactor/src/header_verifier_proxy.rs diff --git a/esdt-safe/interactor/Cargo.toml b/esdt-safe/interactor/Cargo.toml index 9bbac37c..b6256c44 100644 --- a/esdt-safe/interactor/Cargo.toml +++ b/esdt-safe/interactor/Cargo.toml @@ -27,6 +27,9 @@ version = "0.53.2" [dependencies.multiversx-sc] version = "0.53.2" +[dependencies.multiversx-sc-scenario] +version = "=0.53.2" + [dependencies] clap = { version = "4.4.7", features = ["derive"] } serde = { version = "1.0", features = ["derive"] } diff --git a/esdt-safe/interactor/contract-codes/header-verifier.mxsc.json b/esdt-safe/interactor/contract-codes/header-verifier.mxsc.json new file mode 100644 index 00000000..d6e87f36 --- /dev/null +++ b/esdt-safe/interactor/contract-codes/header-verifier.mxsc.json @@ -0,0 +1,160 @@ +{ + "buildInfo": { + "rustc": { + "version": "1.79.0", + "commitHash": "129f3b9964af4d4a709d1383930ade12dfe7c081", + "commitDate": "2024-06-10", + "channel": "Stable", + "short": "rustc 1.79.0 (129f3b996 2024-06-10)" + }, + "contractCrate": { + "name": "header-verifier", + "version": "0.0.0" + }, + "framework": { + "name": "multiversx-sc", + "version": "0.53.0" + } + }, + "abi": { + "name": "Headerverifier", + "constructor": { + "inputs": [ + { + "name": "bls_pub_keys", + "type": "variadic", + "multi_arg": true + } + ], + "outputs": [] + }, + "upgradeConstructor": { + "inputs": [], + "outputs": [] + }, + "endpoints": [ + { + "name": "registerBridgeOps", + "mutability": "mutable", + "inputs": [ + { + "name": "signature", + "type": "array48" + }, + { + "name": "bridge_operations_hash", + "type": "bytes" + }, + { + "name": "operations_hashes", + "type": "variadic", + "multi_arg": true + } + ], + "outputs": [] + }, + { + "name": "setEsdtSafeAddress", + "onlyOwner": true, + "mutability": "mutable", + "inputs": [ + { + "name": "esdt_safe_address", + "type": "Address" + } + ], + "outputs": [] + }, + { + "name": "removeExecutedHash", + "mutability": "mutable", + "inputs": [ + { + "name": "hash_of_hashes", + "type": "bytes" + }, + { + "name": "operation_hash", + "type": "bytes" + } + ], + "outputs": [] + }, + { + "name": "setMinValidSigners", + "onlyOwner": true, + "mutability": "mutable", + "inputs": [ + { + "name": "new_value", + "type": "u32" + } + ], + "outputs": [] + }, + { + "name": "addSigners", + "onlyOwner": true, + "mutability": "mutable", + "inputs": [ + { + "name": "signers", + "type": "variadic
", + "multi_arg": true + } + ], + "outputs": [] + }, + { + "name": "removeSigners", + "onlyOwner": true, + "mutability": "mutable", + "inputs": [ + { + "name": "signers", + "type": "variadic
", + "multi_arg": true + } + ], + "outputs": [] + } + ], + "esdtAttributes": [], + "hasCallback": false, + "types": {} + }, + "code": "0061736d0100000001480d60027f7f0060027f7f017f60000060017f017f60017f006000017f60037f7f7f0060047f7f7f7f017f60037f7f7f017f60047f7f7f7f0060017f017e60027f7e0060027f7f017e029c031203656e760b7369676e616c4572726f72000003656e760a6d4275666665724e6577000503656e760d6d427566666572417070656e64000103656e76096d4275666665724571000103656e76106d4275666665724765744c656e677468000303656e760d6d616e6167656443616c6c6572000403656e76136d616e616765644f776e657241646472657373000403656e76126d427566666572417070656e644279746573000803656e76126d616e616765645369676e616c4572726f72000403656e761b736d616c6c496e74476574556e7369676e6564417267756d656e74000a03656e760f6765744e756d417267756d656e7473000503656e76136d42756666657247657442797465536c696365000703656e760f6d4275666665725365744279746573000803656e76126d42756666657253746f726167654c6f6164000103656e76136d42756666657253746f7261676553746f7265000103656e76126d427566666572476574417267756d656e74000103656e760e636865636b4e6f5061796d656e74000203656e760d6d616e6167656453686132353600010344430301000300050502090103050300040404020007000000040100000b030100090705000300010606010101010606030c0300000001000504040202020202020202020205030100030616037f01418080080b7f0041ecd2080b7f0041f0d2080b07b1010c066d656d6f7279020004696e6974004b0775706772616465004c1172656769737465724272696467654f7073004d12736574457364745361666541646472657373004e1272656d6f7665457865637574656448617368004f127365744d696e56616c69645369676e65727300500a6164645369676e65727300510d72656d6f76655369676e65727300520863616c6c4261636b00530a5f5f646174615f656e6403010b5f5f686561705f6261736503020a8e1f430f01017f10012201200010021a20010b0b0020002001100341004a0b3101017f20011015220210042101200041003a00102000200136020c2000200236020820002001360204200041003602000b0d00200010182200100d1a20000b0900200020011000000b0c01017f10182200100520000b1901017f41cc840841cc840828020041016b220036020020000b1d01017f10182200100620001017101304400f0b4187840841241000000b2e01017f419e80084117101b22042000200110071a200441b58008410310071a20042002200310071a20041008000b1101017f1018220220002001100c1a20020b3b01037f101d210220002802002101034041e8d20828020020014a04402000200141016a220336020020022001101e101f200321010c010b0b20020b1101017f1018220041014100100c1a20000b0d00200010182200100f1a20000b4601017f230041106b220224002002200141187420014180fe03714108747220014108764180fe03712001411876727236020c20002002410c6a410410071a200241106a24000b1900200041e8d2082802004e04400f0b41c9800841121000000b1400100a20004604400f0b41db800841191000000b1900200041e8d2082802004c04400f0b41b8800841111000000b0b0041e8d208100a3602000b0b0020002001410410071a0b0f002000200120032002100b4100470b09002000200110021a0b08002000200110280b090020002001100e1a0b1200416c41014100100c1a2000416c100e1a0b190020001012220041f48008410810071a20012000102b20000b4d01027f230041106b22022400200220001004220341187420034180fe03714108747220034108764180fe03712003411876727236020c20012002410c6a1024200120001026200241106a24000b090020002001ad102d0b890101047f230041106b22022400200220013c000f20022001421888a722033a000c20022001421088a722043a000d20022001420888a722053a000e200241003602082000200320047241ff017145220041044105200341ff01711b6a41002000200541ff01711b22006a200041002001501b6a2200200241086a6a410820006b103e200241106a24000b2401017e20002000104122014280808080105a0440200041808008410e103f000b2001a70b190020001012220041fc8008410510071a20012000103020000b4301017f230041106b220224002002200041187420004180fe03714108747220004108764180fe03712000411876727236020c20012002410c6a1024200241106a24000b2000200041868108410b200110322002103322001034200320001034200010280b17002000101222002001200210071a20032000103020000b080041014100101b0b4601017f230041106b220224002002200041187420004180fe03714108747220004108764180fe03712000411876727236020c20012002410c6a410410071a200241106a24000b130020001012220041818108410510071a20000b4001037f200028020822032001103745044020002802042202102e21042000280200200441016a2200102f2001102720022000102c200320012002102e10380b0b0b0020002001103c4100470b0d0020002001103b2002ad102d0b0d0020002001103a2002ad102d0b190020001012220041978108410610071a20002001102620000b190020001012220041978108410610071a20012000102b20000b0a0020002001103b102e0b0a0020002001103a102e0b0d00200020012002101b100e1a0b2c01017f419d8108411b101b2203200010021a200341b58008410310071a20032001200210071a20031008000b1f01017f20001015220110044120470440200041bc81084110103f000b20010ba30102017e027f230041106b22032400200342003703082000101522041004220041094f0440200141808008410e103f000b20044100200320006b41106a200010251a20032903082102200341106a2400200242388620024280fe0383422886842002428080fc0783421886200242808080f80f834208868484200242088842808080f80f832002421888428080fc07838420024228884280fe038320024238888484840b7d01037f230041106b22012400200028020821032001410036020c200028020020034102742001410c6a41041025450440200128020c21022000200341016a360208200241187420024180fe03714108747220024108764180fe0371200241187672721012200141106a24000f0b419e8308410841b880084111101a000b4701017f0240200128020820012802044f04400c010b41012102200110421012220110044120460d00419e8308410841bc81084110101a000b20002001360204200020023602000b2f01017f200128020820012802044f047f410005200110421012210141010b210220002001360204200020023602000b2e01027f20011012210220011012220341b88108410410071a2000200336020420002001360200200020023602080b8a0201047f230041106b220524002005410036020c20002802002103024002400240027f0240024020002d001045044020002802082202100422044190ce004b0d0141e4d2082d00000d0141e0d208200436020041e4d20841013a00002002410041d08408200410251a200041013a00100b200341046a220241e0d2082802004d0d010c050b200041003a0010200220032005410c6a2204410410250d04200341046a210220040c010b2003417b4b0d0120024190ce004b0d02200341d084086a0b200020023602002800002100200541106a2400200041187420004180fe03714108747220004108764180fe0371200041187672720f0b1054000b1054000b200141a68308410f103f000b1600200141bf8308410d101b2201102b2000200110450b0a0041cc8308410f101b0b0e00200041db83084113101b10450b3601037f41ee8308410a101b22011012210220011012220341b88108410410071a2000200336020420002001360200200020023602080ba304020a7f017e230041306b2200240010101023410010222000410036021c2000411c6a101c2101200028021c102020011004210520004100360218200020054102763602142000200136021002400240024003400240200041086a200041106a10442000280208450d00200028020c210741b58308410a101b2202101222092007102a220120011041220a4280808080105a0d02200a4200520d012002103522014167100d1a024041671004450440410121014101210341012105410021040c010b2000411c6a22052001101420052001104621082000411c6a2001104621052000411c6a2001104621042000411c6a200110462000280220200028021c470d0420002d002c044041e0d208410036020041e4d20841003a00000b4101210341016a2101200845044020012105410021040c010b2000411c6a2206200241868108410b200410322203101420062003104621062000411c6a200310461a2000280220200028021c470d0520002d002c044041e0d208410036020041e4d20841003a00000b20022004200620011031200841016a21030b200220012004410010312002419181084106200110322007102720021035210402402003044020031033220210342005200210342001200210342001200210342004200210280c010b200441014100103e0b20092007102a2001ad102d0c010b0b200041306a24000f0b200141808008410e103f000b200141808008410e103f000b200341808008410e103f000b08001010410010210b990301077f230041306b2200240010101023410210224100101e1004413047044041898308410941bc81084110101a000b4101101e210320004102360224200041246a2201101c21042000280224102020011049200028022c20031037450440101d21052004100421064100210103402006200141046a22024f04402000410036022420042001200041246a410410251a20052000280224220141187420014180fe03714108747220014108764180fe0371200141187672721012101f200221010c010b0b101d21012005100421022000410036022c200020024102763602282000200536022403400240200041106a200041246a1044200028021004402001200028021410021a0c020520011018220110111a200320011013450d01200410042101200041003602202000200141027636021c200020043602180340200041086a200041186a104420002802080440200028020c2101200041246a2202200310472002200110360c010b0b200041246a22011049200120031036200041306a24000f0b000b0b41a98208413e1016000b41fa8108412f1016000b2f01017f10101019410110214100101e22001004412047044041e78208411141bc81084110101a000b1048200010270bdf0101087f230041106b220124001010410210214100101e21004101101e210402400240024010171048104010130440200141046a20001047200128020c22052004103c2202450d0220012802082203102e22002002490d0320002002460d012003102e2000490d03200128020422072000102f101521062003102e2002490d0320072002102f200610270c010b41cc8108412e1016000b2003102e2000490d0120012802042000102f10292003200041016b102c2000200247044020052006200210380b20052004103b10290b200141106a24000f0b41ab840841121000000b3f02017e017f10101019410110214100100922004280808080105a044041958008410941808008410e101a000b2000a7210141f88308410f101b2001ad102d0bb40101057f230041206b220024001010101910234100102220004100360214200041146a101c210120002802141020200110042102200041003602102000200241027636020c20002001360208034002402000200041086a10432000280200450d0020002802042101200041146a104a200028021c22042001103d0d0120002802182202102e21032000280214200341016a2203102f2001102720022003102c200420012002102e10390c010b0b200041206a24000b930201087f230041206b220024001010101910234100102220004100360214200041146a101c210120002802141020200110042102200041003602102000200241027636020c20002001360208034002402000200041086a104302402000280200044020002802042104200041146a104a200028021c22052004103d2202450d0320002802182203102e22012002490d0220012002460d012003102e2001490d02200028021422072001102f104021062003102e2002490d0220072002102f200610270c010b200041206a24000f0b2003102e20014904400c010b20002802142001102f10292003200141016b102c2001200247044020052006200210390b20052004103a10290c010b0b41ab840841121000000b02000b0b0041bd8408410e1000000b0bdf040200418080080bcb04696e70757420746f6f206c6f6e677369676e6572736e65775f76616c7565617267756d656e74206465636f6465206572726f722028293a20746f6f2066657720617267756d656e7473746f6f206d616e7920617267756d656e747377726f6e67206e756d626572206f6620617267756d656e74732e6e6f64655f69642e6974656d2e696e666f2e6e6f64655f6c696e6b732e76616c75652e696e64657873746f72616765206465636f6465206572726f7220286b65793a202e6c656e626164206172726179206c656e6774684f6e6c792045534454205361666520636f6e74726163742063616e2063616c6c207468697320656e64706f696e74546865204f7574476f696e67547873486173682068617320616c7265616479206265656e207265676973746572656448617368206f6620616c6c206f7065726174696f6e7320646f65736e2774206d61746368207468652068617368206f66207472616e736665722064617461657364745f736166655f616464726573736f7065726174696f6e735f6861736865737369676e6174757265626c735f7075625f6b6579737661722061726773696e70757420746f6f2073686f7274626c735075624b65797370656e64696e67486173686573657364745361666541646472657373686173684f66486173686573486973746f7279616c6c5369676e6572736d696e56616c69645369676e657273456e64706f696e742063616e206f6e6c792062652063616c6c6564206279206f776e6572696e646578206f7574206f662072616e676570616e6963206f636375727265640041cc84080b0438ffffff", + "report": { + "imports": [ + "checkNoPayment", + "getNumArguments", + "mBufferAppend", + "mBufferAppendBytes", + "mBufferEq", + "mBufferGetArgument", + "mBufferGetByteSlice", + "mBufferGetLength", + "mBufferNew", + "mBufferSetBytes", + "mBufferStorageLoad", + "mBufferStorageStore", + "managedCaller", + "managedOwnerAddress", + "managedSha256", + "managedSignalError", + "signalError", + "smallIntGetUnsignedArgument" + ], + "isMemGrow": false, + "eiCheck": { + "eiVersion": "1.3", + "ok": true + }, + "codeReport": { + "path": "../output/header-verifier.wasm", + "size": 5371, + "hasAllocator": false, + "hasPanic": "without message" + } + } +} diff --git a/esdt-safe/interactor/src/header_verifier_proxy.rs b/esdt-safe/interactor/src/header_verifier_proxy.rs new file mode 100644 index 00000000..4f57c709 --- /dev/null +++ b/esdt-safe/interactor/src/header_verifier_proxy.rs @@ -0,0 +1,174 @@ +// Code generated by the multiversx-sc proxy generator. DO NOT EDIT. + +//////////////////////////////////////////////////// +////////////////// AUTO-GENERATED ////////////////// +//////////////////////////////////////////////////// + +#![allow(dead_code)] +#![allow(clippy::all)] + +use multiversx_sc::proxy_imports::*; + +pub struct HeaderverifierProxy; + +impl TxProxyTrait for HeaderverifierProxy +where + Env: TxEnv, + From: TxFrom, + To: TxTo, + Gas: TxGas, +{ + type TxProxyMethods = HeaderverifierProxyMethods; + + fn proxy_methods(self, tx: Tx) -> Self::TxProxyMethods { + HeaderverifierProxyMethods { wrapped_tx: tx } + } +} + +pub struct HeaderverifierProxyMethods +where + Env: TxEnv, + From: TxFrom, + To: TxTo, + Gas: TxGas, +{ + wrapped_tx: Tx, +} + +#[rustfmt::skip] +impl HeaderverifierProxyMethods +where + Env: TxEnv, + Env::Api: VMApi, + From: TxFrom, + Gas: TxGas, +{ + pub fn init< + Arg0: ProxyArg>>, + >( + self, + bls_pub_keys: Arg0, + ) -> TxTypedDeploy { + self.wrapped_tx + .payment(NotPayable) + .raw_deploy() + .argument(&bls_pub_keys) + .original_result() + } +} + +#[rustfmt::skip] +impl HeaderverifierProxyMethods +where + Env: TxEnv, + Env::Api: VMApi, + From: TxFrom, + To: TxTo, + Gas: TxGas, +{ + pub fn upgrade( + self, + ) -> TxTypedUpgrade { + self.wrapped_tx + .payment(NotPayable) + .raw_upgrade() + .original_result() + } +} + +#[rustfmt::skip] +impl HeaderverifierProxyMethods +where + Env: TxEnv, + Env::Api: VMApi, + From: TxFrom, + To: TxTo, + Gas: TxGas, +{ + pub fn register_bridge_operations< + Arg0: ProxyArg>, + Arg1: ProxyArg>, + Arg2: ProxyArg>>, + >( + self, + signature: Arg0, + bridge_operations_hash: Arg1, + operations_hashes: Arg2, + ) -> TxTypedCall { + self.wrapped_tx + .payment(NotPayable) + .raw_call("registerBridgeOps") + .argument(&signature) + .argument(&bridge_operations_hash) + .argument(&operations_hashes) + .original_result() + } + + pub fn set_esdt_safe_address< + Arg0: ProxyArg>, + >( + self, + esdt_safe_address: Arg0, + ) -> TxTypedCall { + self.wrapped_tx + .payment(NotPayable) + .raw_call("setEsdtSafeAddress") + .argument(&esdt_safe_address) + .original_result() + } + + pub fn remove_executed_hash< + Arg0: ProxyArg>, + Arg1: ProxyArg>, + >( + self, + hash_of_hashes: Arg0, + operation_hash: Arg1, + ) -> TxTypedCall { + self.wrapped_tx + .payment(NotPayable) + .raw_call("removeExecutedHash") + .argument(&hash_of_hashes) + .argument(&operation_hash) + .original_result() + } + + pub fn set_min_valid_signers< + Arg0: ProxyArg, + >( + self, + new_value: Arg0, + ) -> TxTypedCall { + self.wrapped_tx + .payment(NotPayable) + .raw_call("setMinValidSigners") + .argument(&new_value) + .original_result() + } + + pub fn add_signers< + Arg0: ProxyArg>>, + >( + self, + signers: Arg0, + ) -> TxTypedCall { + self.wrapped_tx + .payment(NotPayable) + .raw_call("addSigners") + .argument(&signers) + .original_result() + } + + pub fn remove_signers< + Arg0: ProxyArg>>, + >( + self, + signers: Arg0, + ) -> TxTypedCall { + self.wrapped_tx + .payment(NotPayable) + .raw_call("removeSigners") + .argument(&signers) + .original_result() + } +} diff --git a/esdt-safe/interactor/src/interactor_main.rs b/esdt-safe/interactor/src/interactor_main.rs index 3261dfcb..a30f657f 100644 --- a/esdt-safe/interactor/src/interactor_main.rs +++ b/esdt-safe/interactor/src/interactor_main.rs @@ -5,6 +5,7 @@ mod proxy; use fee_market::fee_market_proxy::FeeMarketProxy; use fee_market::fee_market_proxy::{self, FeeStruct, FeeType}; +use multiversx_sc_scenario::multiversx_chain_vm::crypto_functions::sha256; use multiversx_sc_snippets::imports::*; use multiversx_sc_snippets::sdk; use serde::{Deserialize, Serialize}; @@ -12,6 +13,7 @@ use std::{ io::{Read, Write}, path::Path, }; +use transaction::OperationEsdtPayment; use transaction::{GasLimit, Operation, OperationData, PaymentsVec}; const GATEWAY: &str = sdk::gateway::DEVNET_GATEWAY; @@ -70,6 +72,7 @@ struct State { contract_address: Option, fee_market_address: Option, price_aggregator_address: Option, + header_verifier_address: Option, } impl State { @@ -98,6 +101,10 @@ impl State { self.price_aggregator_address = Some(address); } + pub fn set_header_verifier_address(&mut self, address: Bech32Address) { + self.header_verifier_address = Some(address); + } + /// Returns the contract address pub fn current_address(&self) -> &Bech32Address { self.contract_address @@ -125,6 +132,7 @@ struct ContractInteract { contract_code: BytesValue, fee_market_code: BytesValue, price_aggregator_code: BytesValue, + header_verifier_code: BytesValue, state: State, } @@ -152,6 +160,11 @@ impl ContractInteract { &InterpreterContext::default(), ); + let header_verifier_code = BytesValue::interpret_from( + "mxsc:contract-codes/header-verifier.mxsc.json", + &InterpreterContext::default(), + ); + ContractInteract { interactor, wallet_address, @@ -162,6 +175,7 @@ impl ContractInteract { contract_code, fee_market_code, price_aggregator_code, + header_verifier_code, state: State::load_state(), } } @@ -266,6 +280,28 @@ impl ContractInteract { println!("new token_handler_address: {new_address_bech32}"); } + async fn deploy_header_verifier_contract(&mut self) { + let new_address = self + .interactor + .tx() + .from(&self.wallet_address) + .gas(100_000_000u64) + .typed(proxy::EsdtSafeProxy) + .init(false) + .code(&self.header_verifier_code) + .returns(ReturnsNewAddress) + .prepare_async() + .run() + .await; + let new_address_bech32 = bech32::encode(&new_address); + self.state + .set_header_verifier_address(Bech32Address::from_bech32_string( + new_address_bech32.clone(), + )); + + println!("new header_verifier_address: {new_address_bech32}"); + } + async fn upgrade(&mut self) { let response = self .interactor @@ -304,7 +340,7 @@ impl ContractInteract { } async fn set_header_verifier_address(&mut self) { - let header_verifier_address = bech32::decode(""); + let header_verifier_address = self.state.header_verifier_address.clone().unwrap(); let response = self .interactor @@ -461,12 +497,10 @@ impl ContractInteract { } async fn execute_operations(&mut self) { - let hash_of_hashes = ManagedBuffer::new_from_bytes(&b""[..]); - let operation = Operation::new( - ManagedAddress::zero(), - ManagedVec::new(), - OperationData::new(0, ManagedAddress::zero(), None), - ); + let (tokens, data) = self.setup_payments().await; + let to = managed_address!(&self.bob_address); + let operation = Operation::new(to, tokens, data); + let operation_hash = self.get_operation_hash(&operation).await; let response = self .interactor @@ -475,7 +509,7 @@ impl ContractInteract { .to(self.state.current_address()) .gas(30_000_000u64) .typed(proxy::EsdtSafeProxy) - .execute_operations(hash_of_hashes, operation) + .execute_operations(operation_hash, operation) .returns(ReturnsResultUnmanaged) .prepare_async() .run() @@ -484,6 +518,28 @@ impl ContractInteract { println!("Result: {response:?}"); } + async fn execute_operations_with_error(&mut self, error_msg: ExpectError<'_>) { + let (tokens, data) = self.setup_payments().await; + let to = managed_address!(&self.bob_address); + let operation = Operation::new(to, tokens, data); + let operation_hash = self.get_operation_hash(&operation).await; + + let response = self + .interactor + .tx() + .from(&self.wallet_address) + .to(self.state.current_address()) + .gas(30_000_000u64) + .typed(proxy::EsdtSafeProxy) + .execute_operations(operation_hash, operation) + .returns(error_msg) + .prepare_async() + .run() + .await; + + println!("Result: {response:?}"); + } + async fn set_max_tx_batch_size(&mut self) { let new_max_tx_batch_size = 0u32; @@ -821,7 +877,7 @@ impl ContractInteract { .interactor .tx() .from(&self.wallet_address) - .to(self.state.current_address()) + .to(self.state.fee_market_address.clone().unwrap().as_address()) .gas(30_000_000u64) .typed(FeeMarketProxy) .disable_fee(TOKEN_ID) @@ -832,6 +888,46 @@ impl ContractInteract { println!("Result: {response:?}"); } + + async fn setup_payments( + &mut self, + ) -> ( + ManagedVec>, + OperationData, + ) { + let mut tokens: ManagedVec> = ManagedVec::new(); + let token_ids = vec![TOKEN_ID]; + + for token_id in token_ids { + let payment: OperationEsdtPayment = OperationEsdtPayment { + token_identifier: token_id.into(), + token_nonce: 1, + token_data: EsdtTokenData::default(), + }; + + tokens.push(payment); + } + + let op_sender = managed_address!(&self.wallet_address); + let data: OperationData = OperationData { + op_nonce: 1, + op_sender, + opt_transfer_data: Option::None, + }; + + (tokens, data) + } + + async fn get_operation_hash( + &mut self, + operation: &Operation, + ) -> ManagedBuffer { + let mut serialized_operation: ManagedBuffer = ManagedBuffer::new(); + let _ = operation.top_encode(&mut serialized_operation); + let sha256 = sha256(&serialized_operation.to_vec()); + + ManagedBuffer::new_from_bytes(&sha256) + } } #[tokio::test] @@ -841,8 +937,11 @@ async fn test_deploy() { interact.deploy_price_aggregator().await; interact.deploy_fee_market().await; interact.set_fee_market_address().await; - interact.unpause_endpoint().await; interact.disable_fee().await; + interact.deploy_header_verifier_contract().await; + interact.set_header_verifier_address().await; + interact.unpause_endpoint().await; + } #[tokio::test] diff --git a/esdt-safe/interactor/state.toml b/esdt-safe/interactor/state.toml index 8b4cda2a..76c22a65 100644 --- a/esdt-safe/interactor/state.toml +++ b/esdt-safe/interactor/state.toml @@ -1,3 +1,4 @@ -contract_address = "erd1qqqqqqqqqqqqqpgqr6m9gnreldnk7efzeanchpa5s84rl7cqt7ascj2q4m" -fee_market_address = "erd1qqqqqqqqqqqqqpgqzh0vtrpuc47dk05ytd7akms950utmljxt7as2k94hu" -price_aggregator_address = "erd1qqqqqqqqqqqqqpgq4zhxptkn7qmjvq6c2m03wg7wam4vp0ewt7as50a74x" +contract_address = "erd1qqqqqqqqqqqqqpgqyczw89pfr8aj54j4crvr7z700duqge4xt7asyhkfsm" +fee_market_address = "erd1qqqqqqqqqqqqqpgq0r6lzfdz4uhqar7kmspxhg0kr8ezmw64t7aswthejh" +price_aggregator_address = "erd1qqqqqqqqqqqqqpgqxutn5wwtjesh73fl3pz0ua9p9tqsys8vt7as36y3vf" +header_verifier_address = "erd1qqqqqqqqqqqqqpgqzt6lf09qhz8fdq4k67mz3e8h8yjmmlcvt7asftyk47" From df30d7543ac8c3b6e58657a067cec841f61a9702 Mon Sep 17 00:00:00 2001 From: axenteoctavian Date: Mon, 14 Oct 2024 22:08:04 +0300 Subject: [PATCH 414/523] fixes after testing --- esdt-safe/src/from_sovereign/token_mapping.rs | 3 ++ .../src/from_sovereign/transfer_tokens.rs | 33 ++++--------------- esdt-safe/src/lib.rs | 21 ++++++++++-- esdt-safe/src/to_sovereign/create_tx.rs | 23 +++++++++---- esdt-safe/wasm-esdt-safe-full/src/lib.rs | 6 ++-- esdt-safe/wasm/src/lib.rs | 6 ++-- 6 files changed, 52 insertions(+), 40 deletions(-) diff --git a/esdt-safe/src/from_sovereign/token_mapping.rs b/esdt-safe/src/from_sovereign/token_mapping.rs index 1f139899..25972eef 100644 --- a/esdt-safe/src/from_sovereign/token_mapping.rs +++ b/esdt-safe/src/from_sovereign/token_mapping.rs @@ -45,6 +45,9 @@ pub trait TokenMappingModule: utils::UtilsModule { "eGLD value should be 0.05" ); + // TODO + // require sov_token_is should not be already registered + match token_type { EsdtTokenType::Invalid => sc_panic!("Invalid type"), _ => self.handle_token_issue(IssueEsdtArgs { diff --git a/esdt-safe/src/from_sovereign/transfer_tokens.rs b/esdt-safe/src/from_sovereign/transfer_tokens.rs index f06c080d..45933938 100644 --- a/esdt-safe/src/from_sovereign/transfer_tokens.rs +++ b/esdt-safe/src/from_sovereign/transfer_tokens.rs @@ -72,7 +72,7 @@ pub trait TransferTokensModule: .to(ToSelf) .typed(system_proxy::UserBuiltinProxy) .esdt_local_mint(&mvx_token_id, 0, &operation_token.token_data.amount) - .transfer_execute(); + .sync_call(); output_payments.push(OperationEsdtPayment { token_identifier: mvx_token_id, @@ -169,6 +169,8 @@ pub trait TransferTokensModule: Some(transfer_data) => { let args = ManagedArgBuffer::from(transfer_data.args.clone()); + // TODO - this callback is not working for failed operation, is callback not sent if it's failed? + // https://testnet-explorer.multiversx.com/transactions/ec547913aab0d499f2af0b4510dc124c95fd52ec547c9e9a5e4138280fe9daf4/logs self.tx() .to(&operation_tuple.operation.to) .raw_call(transfer_data.function.clone()) @@ -183,14 +185,10 @@ pub trait TransferTokensModule: .register_promise(); } None => { - let own_address = self.blockchain().get_sc_address(); - let args = - self.get_contract_call_args(&operation_tuple.operation.to, mapped_tokens); - self.tx() - .to(own_address) + .to(&operation_tuple.operation.to) .raw_call(ESDT_MULTI_TRANSFER_FUNC_NAME) - .arguments_raw(args) + .multi_esdt(mapped_tokens) .gas(TRANSACTION_GAS) .callback( ::callbacks(self) @@ -201,20 +199,6 @@ pub trait TransferTokensModule: } } - fn get_contract_call_args( - self, - to: &ManagedAddress, - mapped_tokens: ManagedVec>, - ) -> ManagedArgBuffer { - let mut args = ManagedArgBuffer::new(); - args.push_arg(to); - args.push_arg(mapped_tokens.len()); - - args.push_multi_arg(&mapped_tokens); - - args - } - #[promises_callback] fn execute( &self, @@ -232,7 +216,6 @@ pub trait TransferTokensModule: } let header_verifier_address = self.header_verifier_address().get(); - self.tx() .to(header_verifier_address) .typed(header_verifier_proxy::HeaderverifierProxy) @@ -290,11 +273,7 @@ pub trait TransferTokensModule: &operation_tuple .operation .map_tokens_to_multi_value_encoded(), - OperationData { - op_nonce: tx_nonce, - op_sender: sc_address.clone(), - opt_transfer_data: None, - }, + OperationData::new(tx_nonce, sc_address.clone(), None), ); } diff --git a/esdt-safe/src/lib.rs b/esdt-safe/src/lib.rs index 87249b05..249fd5b2 100644 --- a/esdt-safe/src/lib.rs +++ b/esdt-safe/src/lib.rs @@ -1,5 +1,7 @@ #![no_std] +use transaction::GasLimit; + multiversx_sc::imports!(); multiversx_sc::derive_imports!(); @@ -7,6 +9,8 @@ pub mod esdt_safe_proxy; pub mod from_sovereign; pub mod to_sovereign; +const MAX_USER_TX_GAS_LIMIT: GasLimit = 60_000_000; + #[multiversx_sc::contract] pub trait EsdtSafe: to_sovereign::create_tx::CreateTxModule @@ -25,9 +29,13 @@ pub trait EsdtSafe: #[init] fn init(&self, is_sovereign_chain: bool) { self.is_sovereign_chain().set(is_sovereign_chain); + self.max_user_tx_gas_limit().set(MAX_USER_TX_GAS_LIMIT); self.set_paused(true); } + #[upgrade] + fn upgrade(&self) {} + #[only_owner] #[endpoint(setFeeMarketAddress)] fn set_fee_market_address(&self, fee_market_address: ManagedAddress) { @@ -44,6 +52,15 @@ pub trait EsdtSafe: self.header_verifier_address().set(&header_verifier_address); } - #[upgrade] - fn upgrade(&self) {} + #[only_owner] + #[endpoint(setMaxTxGasLimit)] + fn set_max_user_tx_gas_limit(&self, max_user_tx_gas_limit: GasLimit) { + self.max_user_tx_gas_limit().set(max_user_tx_gas_limit); + } + + #[only_owner] + #[endpoint(setBannedEndpoint)] + fn set_banned_endpoint(&self, endpoint_name: ManagedBuffer) { + self.banned_endpoint_names().insert(endpoint_name); + } } diff --git a/esdt-safe/src/to_sovereign/create_tx.rs b/esdt-safe/src/to_sovereign/create_tx.rs index 86898070..27cbf69b 100644 --- a/esdt-safe/src/to_sovereign/create_tx.rs +++ b/esdt-safe/src/to_sovereign/create_tx.rs @@ -67,9 +67,13 @@ pub trait CreateTxModule: if is_sov_chain { self.tx() .to(ToSelf) - .typed(ESDTSystemSCProxy) - .burn(&payment.token_identifier, &payment.amount) - .transfer_execute(); + .typed(system_proxy::UserBuiltinProxy) + .esdt_local_burn( + &payment.token_identifier, + payment.token_nonce, + &payment.amount, + ) + .sync_call(); event_payments.push(MultiValue3::from(( payment.token_identifier, @@ -157,10 +161,15 @@ pub trait CreateTxModule: payment: EsdtTokenPayment, sov_token_id: &TokenIdentifier, ) -> u64 { - let _ = self - .send() - .esdt_system_sc_proxy() - .burn(&payment.token_identifier, &payment.amount); + self.tx() + .to(ToSelf) + .typed(system_proxy::UserBuiltinProxy) + .esdt_local_burn( + &payment.token_identifier, + payment.token_nonce, + &payment.amount, + ) + .sync_call(); let mut sov_token_nonce = 0; diff --git a/esdt-safe/wasm-esdt-safe-full/src/lib.rs b/esdt-safe/wasm-esdt-safe-full/src/lib.rs index 1ddc881c..83bd0032 100644 --- a/esdt-safe/wasm-esdt-safe-full/src/lib.rs +++ b/esdt-safe/wasm-esdt-safe-full/src/lib.rs @@ -6,10 +6,10 @@ // Init: 1 // Upgrade: 1 -// Endpoints: 28 +// Endpoints: 30 // Async Callback (empty): 1 // Promise callbacks: 2 -// Total number of exported functions: 33 +// Total number of exported functions: 35 #![no_std] @@ -23,6 +23,8 @@ multiversx_sc_wasm_adapter::endpoints! { upgrade => upgrade setFeeMarketAddress => set_fee_market_address setHeaderVerifierAddress => set_header_verifier_address + setMaxTxGasLimit => set_max_user_tx_gas_limit + setBannedEndpoint => set_banned_endpoint deposit => deposit setMinValidSigners => set_min_valid_signers addSigners => add_signers diff --git a/esdt-safe/wasm/src/lib.rs b/esdt-safe/wasm/src/lib.rs index 1ddc881c..83bd0032 100644 --- a/esdt-safe/wasm/src/lib.rs +++ b/esdt-safe/wasm/src/lib.rs @@ -6,10 +6,10 @@ // Init: 1 // Upgrade: 1 -// Endpoints: 28 +// Endpoints: 30 // Async Callback (empty): 1 // Promise callbacks: 2 -// Total number of exported functions: 33 +// Total number of exported functions: 35 #![no_std] @@ -23,6 +23,8 @@ multiversx_sc_wasm_adapter::endpoints! { upgrade => upgrade setFeeMarketAddress => set_fee_market_address setHeaderVerifierAddress => set_header_verifier_address + setMaxTxGasLimit => set_max_user_tx_gas_limit + setBannedEndpoint => set_banned_endpoint deposit => deposit setMinValidSigners => set_min_valid_signers addSigners => add_signers From 98fe36a75bfb85f5c5bc430dcd761e80c43193d0 Mon Sep 17 00:00:00 2001 From: Sergiu Osvat Date: Tue, 15 Oct 2024 10:44:33 +0300 Subject: [PATCH 415/523] esdt-safe interactor cleanup --- esdt-safe/interactor/src/interactor_main.rs | 41 ++------------------- 1 file changed, 4 insertions(+), 37 deletions(-) diff --git a/esdt-safe/interactor/src/interactor_main.rs b/esdt-safe/interactor/src/interactor_main.rs index a30f657f..90a3c437 100644 --- a/esdt-safe/interactor/src/interactor_main.rs +++ b/esdt-safe/interactor/src/interactor_main.rs @@ -938,8 +938,6 @@ async fn test_deploy() { interact.deploy_fee_market().await; interact.set_fee_market_address().await; interact.disable_fee().await; - interact.deploy_header_verifier_contract().await; - interact.set_header_verifier_address().await; interact.unpause_endpoint().await; } @@ -951,39 +949,8 @@ async fn test_deploy_sov() { interact.deploy_price_aggregator().await; interact.deploy_fee_market().await; interact.set_fee_market_address().await; + interact.disable_fee().await; + interact.deploy_header_verifier_contract().await; + interact.set_header_verifier_address().await; interact.unpause_endpoint().await; -} - -/* Waiting for fix on initiator_address -#[tokio::test] -async fn test_deposit_and_refund() { - let mut interact = ContractInteract::new().await; - interact.unpause_endpoint().await; - interact.add_tokens_to_whitelist(WHITELISTED_TOKEN_ID).await; - interact.deposit(OptionalTransferData::None, None).await; -} - -#[tokio::test] -async fn test_whitelist_then_blacklist() { - let mut interact = ContractInteract::new().await; - interact.unpause_endpoint().await; - interact.add_tokens_to_whitelist(TOKEN_ID).await; - interact.deposit(OptionalTransferData::None, None).await; - interact.add_tokens_to_blacklist(TOKEN_ID).await; - interact.deposit(OptionalTransferData::None, Some(ExpectError(4, "Token blacklisted"))).await; -} - -// Waiting for gas fix & requires deploy with is_sov_chain on true -#[tokio::test] -async fn test_burn_token_on_sov_chain() { - let mut interact = ContractInteract::new().await; - interact.deposit(OptionalTransferData::None, None).await; -} -*/ - -#[tokio::test] -async fn test_register_token_and_deposit() { - let mut interact = ContractInteract::new().await; - //interact.register_token().await; - interact.deposit(OptionalTransferData::None, None).await; -} +} \ No newline at end of file From d3efa85bf419d218093535d21a761cca75f076e8 Mon Sep 17 00:00:00 2001 From: Sergiu Osvat Date: Tue, 15 Oct 2024 11:04:53 +0300 Subject: [PATCH 416/523] build all contracts --- Cargo.lock | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index f48cb4c9..76877f93 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1272,9 +1272,9 @@ dependencies = [ [[package]] name = "multiversx-sc-snippets" -version = "0.53.1" +version = "0.53.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f4ce1b7a02e9d5a500f05fb746f80a4e455d179b06c5f69218cebcc20afdec7c" +checksum = "ad7edebc3a84f3f08b40e928e44bb0042f13058c33c040510a218746d4bf5476" dependencies = [ "base64", "env_logger", @@ -1701,7 +1701,9 @@ version = "0.0.0" dependencies = [ "clap", "esdt-safe", + "fee-market", "multiversx-sc", + "multiversx-sc-scenario", "multiversx-sc-snippets", "serde", "toml", From 3f4c644e2bf36d06eafadd6eb8c4582b782f8002 Mon Sep 17 00:00:00 2001 From: Andrei Baltariu Date: Tue, 15 Oct 2024 11:30:38 +0300 Subject: [PATCH 417/523] Modified Nft Create call and used `payment` instead of `multi_esdt` Signed-off-by: Andrei Baltariu --- esdt-safe/src/from_sovereign/transfer_tokens.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/esdt-safe/src/from_sovereign/transfer_tokens.rs b/esdt-safe/src/from_sovereign/transfer_tokens.rs index 45933938..75eac4f6 100644 --- a/esdt-safe/src/from_sovereign/transfer_tokens.rs +++ b/esdt-safe/src/from_sovereign/transfer_tokens.rs @@ -140,7 +140,7 @@ pub trait TransferTokensModule: token_data: &EsdtTokenData, ) -> u64 { self.tx() - .to(ToSelf) + .to(ESDTSystemSCAddress) .typed(system_proxy::UserBuiltinProxy) .esdt_nft_create( mvx_token_id, @@ -175,7 +175,7 @@ pub trait TransferTokensModule: .to(&operation_tuple.operation.to) .raw_call(transfer_data.function.clone()) .arguments_raw(args) - .multi_esdt(mapped_tokens.clone()) + .payment(&mapped_tokens) .gas(transfer_data.gas_limit) .callback( ::callbacks(self) @@ -188,7 +188,7 @@ pub trait TransferTokensModule: self.tx() .to(&operation_tuple.operation.to) .raw_call(ESDT_MULTI_TRANSFER_FUNC_NAME) - .multi_esdt(mapped_tokens) + .payment(&mapped_tokens) .gas(TRANSACTION_GAS) .callback( ::callbacks(self) @@ -253,7 +253,7 @@ pub trait TransferTokensModule: } self.tx() - .to(ToSelf) + .to(ESDTSystemSCAddress) .typed(system_proxy::UserBuiltinProxy) .esdt_local_burn( &mvx_token_id, From 8b120165618f50a3fe2cb686e90d62e46b87de6b Mon Sep 17 00:00:00 2001 From: Andrei Baltariu Date: Tue, 15 Oct 2024 11:32:54 +0300 Subject: [PATCH 418/523] Updated proxy Signed-off-by: Andrei Baltariu --- esdt-safe/src/esdt_safe_proxy.rs | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/esdt-safe/src/esdt_safe_proxy.rs b/esdt-safe/src/esdt_safe_proxy.rs index a04bcc03..81e2e31d 100644 --- a/esdt-safe/src/esdt_safe_proxy.rs +++ b/esdt-safe/src/esdt_safe_proxy.rs @@ -111,6 +111,32 @@ where .original_result() } + pub fn set_max_user_tx_gas_limit< + Arg0: ProxyArg, + >( + self, + max_user_tx_gas_limit: Arg0, + ) -> TxTypedCall { + self.wrapped_tx + .payment(NotPayable) + .raw_call("setMaxTxGasLimit") + .argument(&max_user_tx_gas_limit) + .original_result() + } + + pub fn set_banned_endpoint< + Arg0: ProxyArg>, + >( + self, + endpoint_name: Arg0, + ) -> TxTypedCall { + self.wrapped_tx + .payment(NotPayable) + .raw_call("setBannedEndpoint") + .argument(&endpoint_name) + .original_result() + } + pub fn deposit< Arg0: ProxyArg>, Arg1: ProxyArg, ManagedVec>>>>, From fc30225a7c82415c6c4cbe6370627d4d751a472f Mon Sep 17 00:00:00 2001 From: Andrei Baltariu Date: Tue, 15 Oct 2024 11:37:25 +0300 Subject: [PATCH 419/523] Updated interactor proxy Signed-off-by: Andrei Baltariu --- esdt-safe/interactor/src/proxy.rs | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/esdt-safe/interactor/src/proxy.rs b/esdt-safe/interactor/src/proxy.rs index a04bcc03..81e2e31d 100644 --- a/esdt-safe/interactor/src/proxy.rs +++ b/esdt-safe/interactor/src/proxy.rs @@ -111,6 +111,32 @@ where .original_result() } + pub fn set_max_user_tx_gas_limit< + Arg0: ProxyArg, + >( + self, + max_user_tx_gas_limit: Arg0, + ) -> TxTypedCall { + self.wrapped_tx + .payment(NotPayable) + .raw_call("setMaxTxGasLimit") + .argument(&max_user_tx_gas_limit) + .original_result() + } + + pub fn set_banned_endpoint< + Arg0: ProxyArg>, + >( + self, + endpoint_name: Arg0, + ) -> TxTypedCall { + self.wrapped_tx + .payment(NotPayable) + .raw_call("setBannedEndpoint") + .argument(&endpoint_name) + .original_result() + } + pub fn deposit< Arg0: ProxyArg>, Arg1: ProxyArg, ManagedVec>>>>, From 694b17c1f70d0975d156a3d2a3920a58f7cdb673 Mon Sep 17 00:00:00 2001 From: Andrei Baltariu Date: Tue, 15 Oct 2024 11:57:43 +0300 Subject: [PATCH 420/523] Added amount addition in case of SFT or Meta token Signed-off-by: Andrei Baltariu --- esdt-safe/src/from_sovereign/transfer_tokens.rs | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/esdt-safe/src/from_sovereign/transfer_tokens.rs b/esdt-safe/src/from_sovereign/transfer_tokens.rs index 75eac4f6..1b2e170f 100644 --- a/esdt-safe/src/from_sovereign/transfer_tokens.rs +++ b/esdt-safe/src/from_sovereign/transfer_tokens.rs @@ -133,18 +133,22 @@ pub trait TransferTokensModule: nonce } - #[inline] fn mint_nft_tx( &self, mvx_token_id: &TokenIdentifier, token_data: &EsdtTokenData, ) -> u64 { + let mut amount = token_data.amount.clone(); + if self.is_sft_or_meta(&token_data.token_type) { + amount += BigUint::from(1u32); + } + self.tx() .to(ESDTSystemSCAddress) .typed(system_proxy::UserBuiltinProxy) .esdt_nft_create( mvx_token_id, - &token_data.amount, + &amount, &token_data.name, &token_data.royalties, &token_data.hash, From 010fc370b396bc3808ed205d056fb8eaf5ddc91f Mon Sep 17 00:00:00 2001 From: Andrei Baltariu Date: Tue, 15 Oct 2024 12:06:09 +0300 Subject: [PATCH 421/523] Added logic to only remove from mapper if token NFT Signed-off-by: Andrei Baltariu --- esdt-safe/src/from_sovereign/token_mapping.rs | 14 ++++++++++- .../src/from_sovereign/transfer_tokens.rs | 25 ++++++++++++++----- 2 files changed, 32 insertions(+), 7 deletions(-) diff --git a/esdt-safe/src/from_sovereign/token_mapping.rs b/esdt-safe/src/from_sovereign/token_mapping.rs index 25972eef..03454719 100644 --- a/esdt-safe/src/from_sovereign/token_mapping.rs +++ b/esdt-safe/src/from_sovereign/token_mapping.rs @@ -45,7 +45,7 @@ pub trait TokenMappingModule: utils::UtilsModule { "eGLD value should be 0.05" ); - // TODO + // TODO // require sov_token_is should not be already registered match token_type { @@ -127,6 +127,18 @@ pub trait TokenMappingModule: utils::UtilsModule { }); } + #[inline] + fn clear_sov_to_mvx_esdt_info_mapper(&self, id: &TokenIdentifier, nonce: u64) { + self.sovereign_to_multiversx_esdt_info_mapper(id, nonce) + .take(); + } + + #[inline] + fn clear_mvx_to_sov_esdt_info_mapper(&self, id: &TokenIdentifier, nonce: u64) { + self.multiversx_to_sovereign_esdt_info_mapper(id, nonce) + .take(); + } + #[storage_mapper("sovToMxTokenId")] fn sovereign_to_multiversx_token_id_mapper( &self, diff --git a/esdt-safe/src/from_sovereign/transfer_tokens.rs b/esdt-safe/src/from_sovereign/transfer_tokens.rs index 1b2e170f..ab4fec5a 100644 --- a/esdt-safe/src/from_sovereign/transfer_tokens.rs +++ b/esdt-safe/src/from_sovereign/transfer_tokens.rs @@ -241,19 +241,27 @@ pub trait TransferTokensModule: if !sov_to_mvx_token_id_mapper.is_empty() { let mvx_token_id = sov_to_mvx_token_id_mapper.get(); - let mut mx_token_nonce = 0; + let mut mvx_token_nonce = 0; if operation_token.token_nonce > 0 { - mx_token_nonce = self + mvx_token_nonce = self .sovereign_to_multiversx_esdt_info_mapper( &operation_token.token_identifier, operation_token.token_nonce, ) - .take() + .get() .token_nonce; - self.multiversx_to_sovereign_esdt_info_mapper(&mvx_token_id, mx_token_nonce) - .take(); + let is_token_nft = self.is_nft(&operation_token.token_data.token_type); + + if is_token_nft { + self.clear_sov_to_mvx_esdt_info_mapper( + &operation_token.token_identifier, + operation_token.token_nonce, + ); + + self.clear_mvx_to_sov_esdt_info_mapper(&mvx_token_id, mvx_token_nonce); + } } self.tx() @@ -261,7 +269,7 @@ pub trait TransferTokensModule: .typed(system_proxy::UserBuiltinProxy) .esdt_local_burn( &mvx_token_id, - mx_token_nonce, + mvx_token_nonce, &operation_token.token_data.amount, ) .transfer_execute(); @@ -315,6 +323,11 @@ pub trait TransferTokensModule: *token_type == EsdtTokenType::SemiFungible || *token_type == EsdtTokenType::Meta } + #[inline] + fn is_nft(self, token_type: &EsdtTokenType) -> bool { + *token_type == EsdtTokenType::NonFungible + } + #[inline] fn get_mvx_nonce_from_mapper(self, token_id: &TokenIdentifier, nonce: u64) -> u64 { self.sovereign_to_multiversx_esdt_info_mapper(token_id, nonce) From 9ee671e4e7bd8f475f5cad391d300269a0c9d1ad Mon Sep 17 00:00:00 2001 From: Andrei Baltariu Date: Tue, 15 Oct 2024 12:14:40 +0300 Subject: [PATCH 422/523] Moved `inline` function to `TokenMappingModule` Signed-off-by: Andrei Baltariu --- esdt-safe/src/from_sovereign/token_mapping.rs | 15 +++++++++++++++ esdt-safe/src/from_sovereign/transfer_tokens.rs | 15 --------------- 2 files changed, 15 insertions(+), 15 deletions(-) diff --git a/esdt-safe/src/from_sovereign/token_mapping.rs b/esdt-safe/src/from_sovereign/token_mapping.rs index 03454719..04a217a6 100644 --- a/esdt-safe/src/from_sovereign/token_mapping.rs +++ b/esdt-safe/src/from_sovereign/token_mapping.rs @@ -139,6 +139,21 @@ pub trait TokenMappingModule: utils::UtilsModule { .take(); } + #[inline] + fn is_fungible(self, token_type: &EsdtTokenType) -> bool { + *token_type == EsdtTokenType::Fungible + } + + #[inline] + fn is_sft_or_meta(self, token_type: &EsdtTokenType) -> bool { + *token_type == EsdtTokenType::SemiFungible || *token_type == EsdtTokenType::Meta + } + + #[inline] + fn is_nft(self, token_type: &EsdtTokenType) -> bool { + *token_type == EsdtTokenType::NonFungible + } + #[storage_mapper("sovToMxTokenId")] fn sovereign_to_multiversx_token_id_mapper( &self, diff --git a/esdt-safe/src/from_sovereign/transfer_tokens.rs b/esdt-safe/src/from_sovereign/transfer_tokens.rs index ab4fec5a..6cf0d251 100644 --- a/esdt-safe/src/from_sovereign/transfer_tokens.rs +++ b/esdt-safe/src/from_sovereign/transfer_tokens.rs @@ -313,21 +313,6 @@ pub trait TransferTokensModule: } } - #[inline] - fn is_fungible(self, token_type: &EsdtTokenType) -> bool { - *token_type == EsdtTokenType::Fungible - } - - #[inline] - fn is_sft_or_meta(self, token_type: &EsdtTokenType) -> bool { - *token_type == EsdtTokenType::SemiFungible || *token_type == EsdtTokenType::Meta - } - - #[inline] - fn is_nft(self, token_type: &EsdtTokenType) -> bool { - *token_type == EsdtTokenType::NonFungible - } - #[inline] fn get_mvx_nonce_from_mapper(self, token_id: &TokenIdentifier, nonce: u64) -> u64 { self.sovereign_to_multiversx_esdt_info_mapper(token_id, nonce) From 0ce7495d80fa5afe0c60ff6ef0fa1b17e3cb05ec Mon Sep 17 00:00:00 2001 From: Andrei Baltariu Date: Tue, 15 Oct 2024 12:15:00 +0300 Subject: [PATCH 423/523] Updated `burn_mainchain_token` mapper clearing logic Signed-off-by: Andrei Baltariu --- esdt-safe/src/to_sovereign/create_tx.rs | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/esdt-safe/src/to_sovereign/create_tx.rs b/esdt-safe/src/to_sovereign/create_tx.rs index 27cbf69b..ae063b59 100644 --- a/esdt-safe/src/to_sovereign/create_tx.rs +++ b/esdt-safe/src/to_sovereign/create_tx.rs @@ -175,15 +175,23 @@ pub trait CreateTxModule: if payment.token_nonce > 0 { sov_token_nonce = self - .multiversx_to_sovereign_esdt_info_mapper( + .sovereign_to_multiversx_esdt_info_mapper( &payment.token_identifier, payment.token_nonce, ) - .take() + .get() .token_nonce; - self.sovereign_to_multiversx_esdt_info_mapper(sov_token_id, sov_token_nonce) - .take(); + let is_token_nft = self.is_nft(&payment.token_type()); + + if is_token_nft { + self.clear_sov_to_mvx_esdt_info_mapper( + &payment.token_identifier, + payment.token_nonce, + ); + + self.clear_mvx_to_sov_esdt_info_mapper(sov_token_id, sov_token_nonce); + } } sov_token_nonce From 48b75eed62fd056a027a7ab106e7b609f8f70da2 Mon Sep 17 00:00:00 2001 From: Andrei Baltariu Date: Tue, 15 Oct 2024 13:05:42 +0300 Subject: [PATCH 424/523] More fixes after review Signed-off-by: Andrei Baltariu --- esdt-safe/src/from_sovereign/token_mapping.rs | 8 ++++++++ esdt-safe/src/from_sovereign/transfer_tokens.rs | 6 ++---- esdt-safe/src/to_sovereign/create_tx.rs | 4 +--- 3 files changed, 11 insertions(+), 7 deletions(-) diff --git a/esdt-safe/src/from_sovereign/token_mapping.rs b/esdt-safe/src/from_sovereign/token_mapping.rs index 04a217a6..d58a86fb 100644 --- a/esdt-safe/src/from_sovereign/token_mapping.rs +++ b/esdt-safe/src/from_sovereign/token_mapping.rs @@ -154,6 +154,14 @@ pub trait TokenMappingModule: utils::UtilsModule { *token_type == EsdtTokenType::NonFungible } + #[inline] + fn require_sov_token_id_not_registered(&self, id: &TokenIdentifier) { + require!( + self.sovereign_to_multiversx_token_id_mapper(id).is_empty(), + "This token was already registered" + ); + } + #[storage_mapper("sovToMxTokenId")] fn sovereign_to_multiversx_token_id_mapper( &self, diff --git a/esdt-safe/src/from_sovereign/transfer_tokens.rs b/esdt-safe/src/from_sovereign/transfer_tokens.rs index 6cf0d251..e38a4278 100644 --- a/esdt-safe/src/from_sovereign/transfer_tokens.rs +++ b/esdt-safe/src/from_sovereign/transfer_tokens.rs @@ -252,9 +252,7 @@ pub trait TransferTokensModule: .get() .token_nonce; - let is_token_nft = self.is_nft(&operation_token.token_data.token_type); - - if is_token_nft { + if self.is_nft(&operation_token.token_data.token_type) { self.clear_sov_to_mvx_esdt_info_mapper( &operation_token.token_identifier, operation_token.token_nonce, @@ -265,7 +263,7 @@ pub trait TransferTokensModule: } self.tx() - .to(ESDTSystemSCAddress) + .to(ToSelf) .typed(system_proxy::UserBuiltinProxy) .esdt_local_burn( &mvx_token_id, diff --git a/esdt-safe/src/to_sovereign/create_tx.rs b/esdt-safe/src/to_sovereign/create_tx.rs index ae063b59..baea84c0 100644 --- a/esdt-safe/src/to_sovereign/create_tx.rs +++ b/esdt-safe/src/to_sovereign/create_tx.rs @@ -182,9 +182,7 @@ pub trait CreateTxModule: .get() .token_nonce; - let is_token_nft = self.is_nft(&payment.token_type()); - - if is_token_nft { + if self.is_nft(&payment.token_type()) { self.clear_sov_to_mvx_esdt_info_mapper( &payment.token_identifier, payment.token_nonce, From 26107a7c211f395f2088a51f79e958ee04756772 Mon Sep 17 00:00:00 2001 From: Andrei Baltariu Date: Tue, 15 Oct 2024 13:08:35 +0300 Subject: [PATCH 425/523] Added function call Signed-off-by: Andrei Baltariu --- esdt-safe/src/from_sovereign/token_mapping.rs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/esdt-safe/src/from_sovereign/token_mapping.rs b/esdt-safe/src/from_sovereign/token_mapping.rs index d58a86fb..db5ea78e 100644 --- a/esdt-safe/src/from_sovereign/token_mapping.rs +++ b/esdt-safe/src/from_sovereign/token_mapping.rs @@ -45,8 +45,7 @@ pub trait TokenMappingModule: utils::UtilsModule { "eGLD value should be 0.05" ); - // TODO - // require sov_token_is should not be already registered + self.require_sov_token_id_not_registered(&sov_token_id); match token_type { EsdtTokenType::Invalid => sc_panic!("Invalid type"), From d9a14ddeab49eaa53cc759ac530e1b009e89f37d Mon Sep 17 00:00:00 2001 From: Andrei Baltariu Date: Tue, 15 Oct 2024 13:46:09 +0300 Subject: [PATCH 426/523] Removed TODO Signed-off-by: Andrei Baltariu --- esdt-safe/src/from_sovereign/transfer_tokens.rs | 2 -- 1 file changed, 2 deletions(-) diff --git a/esdt-safe/src/from_sovereign/transfer_tokens.rs b/esdt-safe/src/from_sovereign/transfer_tokens.rs index e38a4278..51c2590e 100644 --- a/esdt-safe/src/from_sovereign/transfer_tokens.rs +++ b/esdt-safe/src/from_sovereign/transfer_tokens.rs @@ -173,8 +173,6 @@ pub trait TransferTokensModule: Some(transfer_data) => { let args = ManagedArgBuffer::from(transfer_data.args.clone()); - // TODO - this callback is not working for failed operation, is callback not sent if it's failed? - // https://testnet-explorer.multiversx.com/transactions/ec547913aab0d499f2af0b4510dc124c95fd52ec547c9e9a5e4138280fe9daf4/logs self.tx() .to(&operation_tuple.operation.to) .raw_call(transfer_data.function.clone()) From cc0c9912a5de1032062fa42ad951d7ea85caec6b Mon Sep 17 00:00:00 2001 From: Andrei Baltariu Date: Tue, 15 Oct 2024 14:59:46 +0300 Subject: [PATCH 427/523] Added new folder for proxies Signed-off-by: Andrei Baltariu --- esdt-safe/interactor/src/interactor_main.rs | 9 ++++----- .../interactor/src/{ => proxies}/fee_market_proxy.rs | 0 .../src/{ => proxies}/header_verifier_proxy.rs | 0 esdt-safe/interactor/src/proxies/mod.rs | 4 ++++ .../src/{ => proxies}/price_aggregator_proxy.rs | 0 esdt-safe/interactor/src/{ => proxies}/proxy.rs | 0 6 files changed, 8 insertions(+), 5 deletions(-) rename esdt-safe/interactor/src/{ => proxies}/fee_market_proxy.rs (100%) rename esdt-safe/interactor/src/{ => proxies}/header_verifier_proxy.rs (100%) create mode 100644 esdt-safe/interactor/src/proxies/mod.rs rename esdt-safe/interactor/src/{ => proxies}/price_aggregator_proxy.rs (100%) rename esdt-safe/interactor/src/{ => proxies}/proxy.rs (100%) diff --git a/esdt-safe/interactor/src/interactor_main.rs b/esdt-safe/interactor/src/interactor_main.rs index 90a3c437..046e9515 100644 --- a/esdt-safe/interactor/src/interactor_main.rs +++ b/esdt-safe/interactor/src/interactor_main.rs @@ -1,13 +1,13 @@ #![allow(non_snake_case)] -mod price_aggregator_proxy; -mod proxy; +mod proxies; use fee_market::fee_market_proxy::FeeMarketProxy; use fee_market::fee_market_proxy::{self, FeeStruct, FeeType}; use multiversx_sc_scenario::multiversx_chain_vm::crypto_functions::sha256; use multiversx_sc_snippets::imports::*; use multiversx_sc_snippets::sdk; +use proxies::*; use serde::{Deserialize, Serialize}; use std::{ io::{Read, Write}, @@ -15,7 +15,6 @@ use std::{ }; use transaction::OperationEsdtPayment; use transaction::{GasLimit, Operation, OperationData, PaymentsVec}; - const GATEWAY: &str = sdk::gateway::DEVNET_GATEWAY; const STATE_FILE: &str = "state.toml"; const TOKEN_ID: &[u8] = b"SVT-805b28"; @@ -939,7 +938,6 @@ async fn test_deploy() { interact.set_fee_market_address().await; interact.disable_fee().await; interact.unpause_endpoint().await; - } #[tokio::test] @@ -953,4 +951,5 @@ async fn test_deploy_sov() { interact.deploy_header_verifier_contract().await; interact.set_header_verifier_address().await; interact.unpause_endpoint().await; -} \ No newline at end of file +} + diff --git a/esdt-safe/interactor/src/fee_market_proxy.rs b/esdt-safe/interactor/src/proxies/fee_market_proxy.rs similarity index 100% rename from esdt-safe/interactor/src/fee_market_proxy.rs rename to esdt-safe/interactor/src/proxies/fee_market_proxy.rs diff --git a/esdt-safe/interactor/src/header_verifier_proxy.rs b/esdt-safe/interactor/src/proxies/header_verifier_proxy.rs similarity index 100% rename from esdt-safe/interactor/src/header_verifier_proxy.rs rename to esdt-safe/interactor/src/proxies/header_verifier_proxy.rs diff --git a/esdt-safe/interactor/src/proxies/mod.rs b/esdt-safe/interactor/src/proxies/mod.rs new file mode 100644 index 00000000..540750df --- /dev/null +++ b/esdt-safe/interactor/src/proxies/mod.rs @@ -0,0 +1,4 @@ +pub mod fee_market_proxy; +pub mod header_verifier_proxy; +pub mod price_aggregator_proxy; +pub mod proxy; diff --git a/esdt-safe/interactor/src/price_aggregator_proxy.rs b/esdt-safe/interactor/src/proxies/price_aggregator_proxy.rs similarity index 100% rename from esdt-safe/interactor/src/price_aggregator_proxy.rs rename to esdt-safe/interactor/src/proxies/price_aggregator_proxy.rs diff --git a/esdt-safe/interactor/src/proxy.rs b/esdt-safe/interactor/src/proxies/proxy.rs similarity index 100% rename from esdt-safe/interactor/src/proxy.rs rename to esdt-safe/interactor/src/proxies/proxy.rs From 25b12d6aafa132b9f3d3326aad03224741b101fd Mon Sep 17 00:00:00 2001 From: Andrei Baltariu Date: Tue, 15 Oct 2024 15:56:56 +0300 Subject: [PATCH 428/523] Added WIP interact register operation function Signed-off-by: Andrei Baltariu --- esdt-safe/interactor/src/interactor_main.rs | 64 +++++++++++++++------ 1 file changed, 48 insertions(+), 16 deletions(-) diff --git a/esdt-safe/interactor/src/interactor_main.rs b/esdt-safe/interactor/src/interactor_main.rs index 046e9515..97953119 100644 --- a/esdt-safe/interactor/src/interactor_main.rs +++ b/esdt-safe/interactor/src/interactor_main.rs @@ -4,9 +4,9 @@ mod proxies; use fee_market::fee_market_proxy::FeeMarketProxy; use fee_market::fee_market_proxy::{self, FeeStruct, FeeType}; -use multiversx_sc_scenario::multiversx_chain_vm::crypto_functions::sha256; +use multiversx_sc_scenario::multiversx_chain_vm::crypto_functions::{self, sha256}; use multiversx_sc_snippets::imports::*; -use multiversx_sc_snippets::sdk; +use multiversx_sc_snippets::sdk::{self, crypto}; use proxies::*; use serde::{Deserialize, Serialize}; use std::{ @@ -888,6 +888,34 @@ impl ContractInteract { println!("Result: {response:?}"); } + async fn register_operations(&mut self, operation: &Operation) { + let header_address = self + .state + .header_verifier_address + .clone() + .unwrap() + .as_address(); + let bls_signature = ManagedByteArray::default(); + let operation_hash = self.get_operation_hash(operation); + let hash_of_hashes = self.get_hash(&operation_hash); + + let mut operation_hashes = MultiValueEncoded::new(); + + operation_hashes.push(operation_hash); + + let response = self + .interactor + .tx() + .from(&self.wallet_address) + .to(header_address) + .typed(header_verifier_proxy::HeaderverifierProxy) + .register_bridge_operations(bls_signature, hash_of_hashes, operation_hash) + .returns(ReturnsResult) + .prepare_async() + .run() + .await; + } + async fn setup_payments( &mut self, ) -> ( @@ -917,27 +945,27 @@ impl ContractInteract { (tokens, data) } - async fn get_operation_hash( - &mut self, - operation: &Operation, - ) -> ManagedBuffer { + fn get_operation_hash(&mut self, operation: &Operation) -> ManagedBuffer { let mut serialized_operation: ManagedBuffer = ManagedBuffer::new(); let _ = operation.top_encode(&mut serialized_operation); let sha256 = sha256(&serialized_operation.to_vec()); ManagedBuffer::new_from_bytes(&sha256) } -} -#[tokio::test] -async fn test_deploy() { - let mut interact = ContractInteract::new().await; - interact.deploy(false).await; - interact.deploy_price_aggregator().await; - interact.deploy_fee_market().await; - interact.set_fee_market_address().await; - interact.disable_fee().await; - interact.unpause_endpoint().await; + fn get_hash(&mut self, operation: &ManagedBuffer) -> ManagedBuffer { + let mut array = [0; 1024]; + + let len = { + let byte_array = operation.load_to_byte_array(&mut array); + byte_array.len() + }; + + let trimmed_slice = &array[..len]; + let hash = sha256(trimmed_slice); + + ManagedBuffer::from(&hash) + } } #[tokio::test] @@ -953,3 +981,7 @@ async fn test_deploy_sov() { interact.unpause_endpoint().await; } +#[tokio::test] +async fn test_register_operation() { + let mut interact = ContractInteract::new().await; +} From 409940adc952358ca1d84ee48262dea630df7b7d Mon Sep 17 00:00:00 2001 From: Andrei Baltariu Date: Tue, 15 Oct 2024 16:01:20 +0300 Subject: [PATCH 429/523] Moved `price_aggregator_address` from init to endpoint Signed-off-by: Andrei Baltariu --- fee-market/src/fee_market_proxy.rs | 20 +++++++++++++++----- fee-market/src/lib.rs | 18 ++++++++---------- fee-market/wasm-fee-marker-full/src/lib.rs | 5 +++-- fee-market/wasm/src/lib.rs | 5 +++-- 4 files changed, 29 insertions(+), 19 deletions(-) diff --git a/fee-market/src/fee_market_proxy.rs b/fee-market/src/fee_market_proxy.rs index b595c0f6..36ed1bc8 100644 --- a/fee-market/src/fee_market_proxy.rs +++ b/fee-market/src/fee_market_proxy.rs @@ -45,19 +45,16 @@ where { pub fn init< Arg0: ProxyArg>, - Arg1: ProxyArg>, - Arg2: ProxyArg>>, + Arg1: ProxyArg>>, >( self, esdt_safe_address: Arg0, - price_aggregator_address: Arg1, - fee: Arg2, + fee: Arg1, ) -> TxTypedDeploy { self.wrapped_tx .payment(NotPayable) .raw_deploy() .argument(&esdt_safe_address) - .argument(&price_aggregator_address) .argument(&fee) .original_result() } @@ -91,6 +88,19 @@ where To: TxTo, Gas: TxGas, { + pub fn set_price_aggregator_address< + Arg0: ProxyArg>, + >( + self, + price_aggregator_address: Arg0, + ) -> TxTypedCall { + self.wrapped_tx + .payment(NotPayable) + .raw_call("setPriceAggregatorAddress") + .argument(&price_aggregator_address) + .original_result() + } + pub fn set_fee< Arg0: ProxyArg>, >( diff --git a/fee-market/src/lib.rs b/fee-market/src/lib.rs index 5d958115..cafdf84c 100644 --- a/fee-market/src/lib.rs +++ b/fee-market/src/lib.rs @@ -20,18 +20,9 @@ pub trait FeeMarket: + bls_signature::BlsSignatureModule { #[init] - fn init( - &self, - esdt_safe_address: ManagedAddress, - price_aggregator_address: ManagedAddress, - fee: Option>, - ) { + fn init(&self, esdt_safe_address: ManagedAddress, fee: Option>) { self.require_sc_address(&esdt_safe_address); - self.require_sc_address(&price_aggregator_address); - self.esdt_safe_address().set(esdt_safe_address); - self.price_aggregator_address() - .set(price_aggregator_address); match fee { Some(fee_struct) => self.set_fee(fee_struct), @@ -39,6 +30,13 @@ pub trait FeeMarket: } } + #[endpoint(setPriceAggregatorAddress)] + fn set_price_aggregator_address(&self, price_aggregator_address: ManagedAddress) { + self.require_sc_address(&price_aggregator_address); + self.price_aggregator_address() + .set(price_aggregator_address); + } + #[upgrade] fn upgrade(&self) {} } diff --git a/fee-market/wasm-fee-marker-full/src/lib.rs b/fee-market/wasm-fee-marker-full/src/lib.rs index 8c8779dd..a07b92d6 100644 --- a/fee-market/wasm-fee-marker-full/src/lib.rs +++ b/fee-market/wasm-fee-marker-full/src/lib.rs @@ -6,9 +6,9 @@ // Init: 1 // Upgrade: 1 -// Endpoints: 11 +// Endpoints: 12 // Async Callback (empty): 1 -// Total number of exported functions: 14 +// Total number of exported functions: 15 #![no_std] @@ -20,6 +20,7 @@ multiversx_sc_wasm_adapter::endpoints! { ( init => init upgrade => upgrade + setPriceAggregatorAddress => set_price_aggregator_address addFee => set_fee removeFee => disable_fee getTokenFee => token_fee diff --git a/fee-market/wasm/src/lib.rs b/fee-market/wasm/src/lib.rs index 8c8779dd..a07b92d6 100644 --- a/fee-market/wasm/src/lib.rs +++ b/fee-market/wasm/src/lib.rs @@ -6,9 +6,9 @@ // Init: 1 // Upgrade: 1 -// Endpoints: 11 +// Endpoints: 12 // Async Callback (empty): 1 -// Total number of exported functions: 14 +// Total number of exported functions: 15 #![no_std] @@ -20,6 +20,7 @@ multiversx_sc_wasm_adapter::endpoints! { ( init => init upgrade => upgrade + setPriceAggregatorAddress => set_price_aggregator_address addFee => set_fee removeFee => disable_fee getTokenFee => token_fee From 404cd059d92f3aa0cef9283d99fe67f295fb63c3 Mon Sep 17 00:00:00 2001 From: Andrei Baltariu Date: Tue, 15 Oct 2024 16:04:39 +0300 Subject: [PATCH 430/523] Test fixes Signed-off-by: Andrei Baltariu --- .../tests/enshrine_esdt_safe_blackbox_test.rs | 2 +- esdt-safe/interactor/src/interactor_main.rs | 17 +++-------------- esdt-safe/tests/bridge_blackbox_tests.rs | 4 +--- fee-market/tests/fee_market_blackbox_test.rs | 3 +-- 4 files changed, 6 insertions(+), 20 deletions(-) diff --git a/enshrine-esdt-safe/tests/enshrine_esdt_safe_blackbox_test.rs b/enshrine-esdt-safe/tests/enshrine_esdt_safe_blackbox_test.rs index ff1d6eb6..1bb78e9e 100644 --- a/enshrine-esdt-safe/tests/enshrine_esdt_safe_blackbox_test.rs +++ b/enshrine-esdt-safe/tests/enshrine_esdt_safe_blackbox_test.rs @@ -159,7 +159,7 @@ impl EnshrineTestState { .tx() .from(ENSHRINE_ESDT_OWNER_ADDRESS) .typed(fee_market_proxy::FeeMarketProxy) - .init(ENSHRINE_ESDT_ADDRESS, ENSHRINE_ESDT_ADDRESS, fee_struct) + .init(ENSHRINE_ESDT_ADDRESS, fee_struct) .code(FEE_MARKET_CODE_PATH) .new_address(FEE_MARKET_ADDRESS) .run(); diff --git a/esdt-safe/interactor/src/interactor_main.rs b/esdt-safe/interactor/src/interactor_main.rs index 90a3c437..ef09d0e8 100644 --- a/esdt-safe/interactor/src/interactor_main.rs +++ b/esdt-safe/interactor/src/interactor_main.rs @@ -211,24 +211,13 @@ impl ContractInteract { }, }; - let price_aggregator_address = managed_address!(self - .state - .price_aggregator_address - .clone() - .unwrap() - .as_address()); - let new_address = self .interactor .tx() .from(&self.wallet_address) .gas(100_000_000u64) .typed(fee_market_proxy::FeeMarketProxy) - .init( - self.state.current_address(), - price_aggregator_address, - Option::Some(fee), - ) + .init(self.state.current_address(), Option::Some(fee)) .code(&self.fee_market_code) .returns(ReturnsNewAddress) .prepare_async() @@ -939,7 +928,6 @@ async fn test_deploy() { interact.set_fee_market_address().await; interact.disable_fee().await; interact.unpause_endpoint().await; - } #[tokio::test] @@ -953,4 +941,5 @@ async fn test_deploy_sov() { interact.deploy_header_verifier_contract().await; interact.set_header_verifier_address().await; interact.unpause_endpoint().await; -} \ No newline at end of file +} + diff --git a/esdt-safe/tests/bridge_blackbox_tests.rs b/esdt-safe/tests/bridge_blackbox_tests.rs index 8070007d..a2313502 100644 --- a/esdt-safe/tests/bridge_blackbox_tests.rs +++ b/esdt-safe/tests/bridge_blackbox_tests.rs @@ -32,8 +32,6 @@ const HEADER_VERIFIER_ADDRESS: TestSCAddress = TestSCAddress::new("header_verifi const HEADER_VERIFIER_CODE_PATH: MxscPath = MxscPath::new("../header-verifier/output/header-verifier.mxsc.json"); -const PRICE_AGGREGATOR_ADDRESS: TestSCAddress = TestSCAddress::new("price_aggregator"); - const USER_ADDRESS: TestAddress = TestAddress::new("user"); const RECEIVER_ADDRESS: TestAddress = TestAddress::new("receiver"); @@ -104,7 +102,7 @@ impl BridgeTestState { .tx() .from(BRIDGE_OWNER_ADDRESS) .typed(fee_market_proxy::FeeMarketProxy) - .init(BRIDGE_ADDRESS, PRICE_AGGREGATOR_ADDRESS, fee_struct) + .init(BRIDGE_ADDRESS, fee_struct) .code(FEE_MARKET_CODE_PATH) .new_address(FEE_MARKET_ADDRESS) .run(); diff --git a/fee-market/tests/fee_market_blackbox_test.rs b/fee-market/tests/fee_market_blackbox_test.rs index cf6206a5..f7d43b25 100644 --- a/fee-market/tests/fee_market_blackbox_test.rs +++ b/fee-market/tests/fee_market_blackbox_test.rs @@ -16,7 +16,6 @@ const FEE_MARKET_ADDRESS: TestSCAddress = TestSCAddress::new("fee-market"); const ESDT_SAFE_ADDRESS: TestSCAddress = TestSCAddress::new("esdt-safe"); const ESDT_SAFE_CODE_PATH: MxscPath = MxscPath::new("../esdt-safe/output/esdt-safe.mxsc.json"); -const AGGREGATOR_ADDRESS: TestSCAddress = TestSCAddress::new("init"); const OWNER_ADDRESS: TestAddress = TestAddress::new("owner"); const USER_ADDRESS: TestAddress = TestAddress::new("user"); @@ -77,7 +76,7 @@ impl FeeMarketTestState { .tx() .from(OWNER_ADDRESS) .typed(fee_market_proxy::FeeMarketProxy) - .init(ESDT_SAFE_ADDRESS, AGGREGATOR_ADDRESS, Option::Some(fee)) + .init(ESDT_SAFE_ADDRESS, Option::Some(fee)) .code(FEE_MARKET_CODE_PATH) .new_address(FEE_MARKET_ADDRESS) .run(); From e0c1c8968e3c0a83548e01752838603277a9a8d9 Mon Sep 17 00:00:00 2001 From: Andrei Baltariu Date: Tue, 15 Oct 2024 16:10:15 +0300 Subject: [PATCH 431/523] Moved endpoint under `upgrade` Signed-off-by: Andrei Baltariu --- fee-market/src/lib.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/fee-market/src/lib.rs b/fee-market/src/lib.rs index cafdf84c..64cf2562 100644 --- a/fee-market/src/lib.rs +++ b/fee-market/src/lib.rs @@ -30,13 +30,13 @@ pub trait FeeMarket: } } + #[upgrade] + fn upgrade(&self) {} + #[endpoint(setPriceAggregatorAddress)] fn set_price_aggregator_address(&self, price_aggregator_address: ManagedAddress) { self.require_sc_address(&price_aggregator_address); self.price_aggregator_address() .set(price_aggregator_address); } - - #[upgrade] - fn upgrade(&self) {} } From 01cc3a444bfe910da2330e3e273c76b9964eef7b Mon Sep 17 00:00:00 2001 From: Andrei Baltariu Date: Wed, 16 Oct 2024 11:19:57 +0300 Subject: [PATCH 432/523] Added `register_operation` setup Signed-off-by: Andrei Baltariu --- esdt-safe/interactor/src/interactor_main.rs | 59 +++++++++++---------- 1 file changed, 31 insertions(+), 28 deletions(-) diff --git a/esdt-safe/interactor/src/interactor_main.rs b/esdt-safe/interactor/src/interactor_main.rs index 97953119..6857e8e5 100644 --- a/esdt-safe/interactor/src/interactor_main.rs +++ b/esdt-safe/interactor/src/interactor_main.rs @@ -4,7 +4,9 @@ mod proxies; use fee_market::fee_market_proxy::FeeMarketProxy; use fee_market::fee_market_proxy::{self, FeeStruct, FeeType}; -use multiversx_sc_scenario::multiversx_chain_vm::crypto_functions::{self, sha256}; +use multiversx_sc_scenario::multiversx_chain_vm::crypto_functions::{ + self, sha256, SHA256_RESULT_LEN, +}; use multiversx_sc_snippets::imports::*; use multiversx_sc_snippets::sdk::{self, crypto}; use proxies::*; @@ -889,31 +891,34 @@ impl ContractInteract { } async fn register_operations(&mut self, operation: &Operation) { - let header_address = self - .state - .header_verifier_address - .clone() - .unwrap() - .as_address(); let bls_signature = ManagedByteArray::default(); let operation_hash = self.get_operation_hash(operation); - let hash_of_hashes = self.get_hash(&operation_hash); - - let mut operation_hashes = MultiValueEncoded::new(); - - operation_hashes.push(operation_hash); - - let response = self - .interactor - .tx() - .from(&self.wallet_address) - .to(header_address) - .typed(header_verifier_proxy::HeaderverifierProxy) - .register_bridge_operations(bls_signature, hash_of_hashes, operation_hash) - .returns(ReturnsResult) - .prepare_async() - .run() - .await; + let hash_of_hashes = sha256(&operation_hash); + + let mut managed_operation_hashes = + MultiValueEncoded::>::new(); + + let managed_operation_hash = ManagedBuffer::::from(&operation_hash); + let managed_hash_of_hashes = ManagedBuffer::::from(&hash_of_hashes); + + managed_operation_hashes.push(managed_operation_hash); + + if let Some(header_verifier_address) = self.state.header_verifier_address.clone() { + self.interactor + .tx() + .from(&self.wallet_address) + .to(header_verifier_address) + .typed(header_verifier_proxy::HeaderverifierProxy) + .register_bridge_operations( + bls_signature, + managed_hash_of_hashes, + managed_operation_hashes, + ) + .returns(ReturnsResult) + .prepare_async() + .run() + .await; + } } async fn setup_payments( @@ -945,12 +950,10 @@ impl ContractInteract { (tokens, data) } - fn get_operation_hash(&mut self, operation: &Operation) -> ManagedBuffer { + fn get_operation_hash(&mut self, operation: &Operation) -> [u8; SHA256_RESULT_LEN] { let mut serialized_operation: ManagedBuffer = ManagedBuffer::new(); let _ = operation.top_encode(&mut serialized_operation); - let sha256 = sha256(&serialized_operation.to_vec()); - - ManagedBuffer::new_from_bytes(&sha256) + sha256(&serialized_operation.to_vec()) } fn get_hash(&mut self, operation: &ManagedBuffer) -> ManagedBuffer { From 801758c65d29c27c6672aed6ca64867d98dd2ec6 Mon Sep 17 00:00:00 2001 From: Andrei Baltariu Date: Wed, 16 Oct 2024 13:47:42 +0300 Subject: [PATCH 433/523] More fixes Signed-off-by: Andrei Baltariu --- esdt-safe/interactor/src/interactor_main.rs | 35 +++++++++++++++------ esdt-safe/interactor/state.toml | 8 ++--- 2 files changed, 29 insertions(+), 14 deletions(-) diff --git a/esdt-safe/interactor/src/interactor_main.rs b/esdt-safe/interactor/src/interactor_main.rs index 6857e8e5..539c4bb2 100644 --- a/esdt-safe/interactor/src/interactor_main.rs +++ b/esdt-safe/interactor/src/interactor_main.rs @@ -498,10 +498,8 @@ impl ContractInteract { } async fn execute_operations(&mut self) { - let (tokens, data) = self.setup_payments().await; - let to = managed_address!(&self.bob_address); - let operation = Operation::new(to, tokens, data); - let operation_hash = self.get_operation_hash(&operation).await; + let operation = self.setup_operation().await; + let operation_hash = self.get_operation_hash(&operation); let response = self .interactor @@ -510,7 +508,7 @@ impl ContractInteract { .to(self.state.current_address()) .gas(30_000_000u64) .typed(proxy::EsdtSafeProxy) - .execute_operations(operation_hash, operation) + .execute_operations(&operation_hash, operation) .returns(ReturnsResultUnmanaged) .prepare_async() .run() @@ -523,7 +521,7 @@ impl ContractInteract { let (tokens, data) = self.setup_payments().await; let to = managed_address!(&self.bob_address); let operation = Operation::new(to, tokens, data); - let operation_hash = self.get_operation_hash(&operation).await; + let operation_hash = self.get_operation_hash(&operation); let response = self .interactor @@ -532,7 +530,7 @@ impl ContractInteract { .to(self.state.current_address()) .gas(30_000_000u64) .typed(proxy::EsdtSafeProxy) - .execute_operations(operation_hash, operation) + .execute_operations(&operation_hash, operation) .returns(error_msg) .prepare_async() .run() @@ -890,9 +888,23 @@ impl ContractInteract { println!("Result: {response:?}"); } - async fn register_operations(&mut self, operation: &Operation) { + async fn setup_operation(&mut self) -> Operation { + let to = managed_address!(&self + .state + .price_aggregator_address + .clone() + .unwrap() + .to_address()); + let payments_tuple = self.setup_payments().await; + let (tokens, data) = payments_tuple; + + Operation::new(to, tokens, data) + } + + async fn register_operations(&mut self) { + let operation = self.setup_operation().await; let bls_signature = ManagedByteArray::default(); - let operation_hash = self.get_operation_hash(operation); + let operation_hash = self.get_operation_hash(&operation); let hash_of_hashes = sha256(&operation_hash); let mut managed_operation_hashes = @@ -974,7 +986,7 @@ impl ContractInteract { #[tokio::test] async fn test_deploy_sov() { let mut interact = ContractInteract::new().await; - interact.deploy(true).await; + interact.deploy(false).await; interact.deploy_price_aggregator().await; interact.deploy_fee_market().await; interact.set_fee_market_address().await; @@ -982,6 +994,9 @@ async fn test_deploy_sov() { interact.deploy_header_verifier_contract().await; interact.set_header_verifier_address().await; interact.unpause_endpoint().await; + + interact.register_operations().await; + interact.execute_operations().await; } #[tokio::test] diff --git a/esdt-safe/interactor/state.toml b/esdt-safe/interactor/state.toml index 76c22a65..122a0fa3 100644 --- a/esdt-safe/interactor/state.toml +++ b/esdt-safe/interactor/state.toml @@ -1,4 +1,4 @@ -contract_address = "erd1qqqqqqqqqqqqqpgqyczw89pfr8aj54j4crvr7z700duqge4xt7asyhkfsm" -fee_market_address = "erd1qqqqqqqqqqqqqpgq0r6lzfdz4uhqar7kmspxhg0kr8ezmw64t7aswthejh" -price_aggregator_address = "erd1qqqqqqqqqqqqqpgqxutn5wwtjesh73fl3pz0ua9p9tqsys8vt7as36y3vf" -header_verifier_address = "erd1qqqqqqqqqqqqqpgqzt6lf09qhz8fdq4k67mz3e8h8yjmmlcvt7asftyk47" +contract_address = "erd1qqqqqqqqqqqqqpgqtq8807c3nvpfsmvhaxfa92fgfw5zmg4qt7as97n7kg" +fee_market_address = "erd1qqqqqqqqqqqqqpgqcfne2fs7xs9lf2wshyr3cc78mv6wrpwgt7asw3gaew" +price_aggregator_address = "erd1qqqqqqqqqqqqqpgqaxq8dtgynumu824wnerjymrpfh4maquat7asqysu0t" +header_verifier_address = "erd1qqqqqqqqqqqqqpgqg4wen7hg6yypu77ach6dm0g2hvs3pey8t7asc0a02t" From a98461565edc508e198eff49beb2c39ce41d6f80 Mon Sep 17 00:00:00 2001 From: Andrei Baltariu Date: Wed, 16 Oct 2024 13:54:03 +0300 Subject: [PATCH 434/523] Modified logic for `TokenMappingModule` Signed-off-by: Andrei Baltariu --- .../src/from_sovereign/transfer_tokens.rs | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/esdt-safe/src/from_sovereign/transfer_tokens.rs b/esdt-safe/src/from_sovereign/transfer_tokens.rs index 51c2590e..3632e299 100644 --- a/esdt-safe/src/from_sovereign/transfer_tokens.rs +++ b/esdt-safe/src/from_sovereign/transfer_tokens.rs @@ -106,7 +106,10 @@ pub trait TransferTokensModule: // if doesn't exist in mapper nonce will be 0 and we need to create the SFT/MetaESDT, otherwise mint if self.is_sft_or_meta(current_token_type_ref) { - nonce = self.get_mvx_nonce_from_mapper(mvx_token_id, operation_token.token_nonce) + nonce = self.get_mvx_nonce_from_mapper( + &operation_token.token_identifier, + operation_token.token_nonce, + ) } // mint NFT @@ -144,7 +147,7 @@ pub trait TransferTokensModule: } self.tx() - .to(ESDTSystemSCAddress) + .to(ToSelf) .typed(system_proxy::UserBuiltinProxy) .esdt_nft_create( mvx_token_id, @@ -309,11 +312,14 @@ pub trait TransferTokensModule: } } - #[inline] fn get_mvx_nonce_from_mapper(self, token_id: &TokenIdentifier, nonce: u64) -> u64 { - self.sovereign_to_multiversx_esdt_info_mapper(token_id, nonce) - .get() - .token_nonce + let esdt_info_mapper = self.sovereign_to_multiversx_esdt_info_mapper(token_id, nonce); + + if esdt_info_mapper.is_empty() { + return 0; + } + + esdt_info_mapper.get().token_nonce } #[storage_mapper("pendingHashes")] From 56f75d84e429fbfc646408ac1df47fa15201d747 Mon Sep 17 00:00:00 2001 From: Andrei Baltariu Date: Wed, 16 Oct 2024 13:56:10 +0300 Subject: [PATCH 435/523] Modified `from_sovereign` mappers logic Signed-off-by: Andrei Baltariu --- esdt-safe/src/to_sovereign/create_tx.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/esdt-safe/src/to_sovereign/create_tx.rs b/esdt-safe/src/to_sovereign/create_tx.rs index baea84c0..7a96699a 100644 --- a/esdt-safe/src/to_sovereign/create_tx.rs +++ b/esdt-safe/src/to_sovereign/create_tx.rs @@ -175,7 +175,7 @@ pub trait CreateTxModule: if payment.token_nonce > 0 { sov_token_nonce = self - .sovereign_to_multiversx_esdt_info_mapper( + .multiversx_to_sovereign_esdt_info_mapper( &payment.token_identifier, payment.token_nonce, ) @@ -183,12 +183,12 @@ pub trait CreateTxModule: .token_nonce; if self.is_nft(&payment.token_type()) { - self.clear_sov_to_mvx_esdt_info_mapper( + self.clear_mvx_to_sov_esdt_info_mapper( &payment.token_identifier, payment.token_nonce, ); - self.clear_mvx_to_sov_esdt_info_mapper(sov_token_id, sov_token_nonce); + self.clear_sov_to_mvx_esdt_info_mapper(sov_token_id, sov_token_nonce); } } From 0bcd4aaa4205dcd32f434b55f22ef6c34136b89c Mon Sep 17 00:00:00 2001 From: Andrei Baltariu Date: Wed, 16 Oct 2024 14:25:58 +0300 Subject: [PATCH 436/523] Added fixes for 1 failing test Signed-off-by: Andrei Baltariu --- .../tests/enshrine_esdt_safe_blackbox_test.rs | 23 ++++++++++----- token-handler/src/transfer_tokens.rs | 29 ++++++++++++------- 2 files changed, 33 insertions(+), 19 deletions(-) diff --git a/enshrine-esdt-safe/tests/enshrine_esdt_safe_blackbox_test.rs b/enshrine-esdt-safe/tests/enshrine_esdt_safe_blackbox_test.rs index 1bb78e9e..bb238016 100644 --- a/enshrine-esdt-safe/tests/enshrine_esdt_safe_blackbox_test.rs +++ b/enshrine-esdt-safe/tests/enshrine_esdt_safe_blackbox_test.rs @@ -1,5 +1,5 @@ use bls_signature::BlsSignature; -use enshrine_esdt_safe::enshrine_esdt_safe_proxy; +use enshrine_esdt_safe::{enshrine_esdt_safe_proxy, token_handler_proxy}; use fee_market::fee_market_proxy::{self, FeeStruct, FeeType}; use header_verifier::header_verifier_proxy; use multiversx_sc::codec::TopEncode; @@ -12,7 +12,6 @@ use multiversx_sc_scenario::api::StaticApi; use multiversx_sc_scenario::multiversx_chain_vm::crypto_functions::sha256; use multiversx_sc_scenario::{imports::MxscPath, ScenarioWorld}; use multiversx_sc_scenario::{managed_address, ExpectError, ScenarioTxRun}; -use token_handler::token_handler_proxy; use transaction::{GasLimit, Operation, OperationData, OperationEsdtPayment}; use utils::PaymentsVec; @@ -427,6 +426,16 @@ impl EnshrineTestState { .run(); } + fn propose_whitelist_enshrine_esdt(&mut self) { + self.world + .tx() + .from(ENSHRINE_ESDT_OWNER_ADDRESS) + .to(TOKEN_HANDLER_ADDRESS) + .typed(token_handler_proxy::TokenHandlerProxy) + .whitelist_enshrine_esdt(ENSHRINE_ESDT_ADDRESS) + .run(); + } + fn mock_bls_signature( &mut self, operation_hash: &ManagedBuffer, @@ -508,13 +517,14 @@ fn test_deploy() { fn test_sovereign_prefix_no_prefix() { let mut state = EnshrineTestState::new(); let token_vec = Vec::from([NFT_TOKEN_ID, CROWD_TOKEN_ID]); - let error_status = Option::Some(ErrorStatus { + let error_status = Some(ErrorStatus { code: 4, error_message: "Operation is not registered", }); state.propose_setup_contracts(false, None); state.propose_register_operation(&token_vec); + state.propose_whitelist_enshrine_esdt(); state.propose_execute_operation(error_status, &token_vec); } @@ -522,14 +532,11 @@ fn test_sovereign_prefix_no_prefix() { fn test_sovereign_prefix_has_prefix() { let mut state = EnshrineTestState::new(); let token_vec = Vec::from([PREFIX_NFT_TOKEN_ID, CROWD_TOKEN_ID]); - let error_status = Option::Some(ErrorStatus { - code: 4, - error_message: "Operation is not registered", - }); state.propose_setup_contracts(false, None); state.propose_register_operation(&token_vec); - state.propose_execute_operation(error_status, &token_vec); + state.propose_whitelist_enshrine_esdt(); + state.propose_execute_operation(None, &token_vec); } #[test] diff --git a/token-handler/src/transfer_tokens.rs b/token-handler/src/transfer_tokens.rs index be527c31..6cb6b4d8 100644 --- a/token-handler/src/transfer_tokens.rs +++ b/token-handler/src/transfer_tokens.rs @@ -85,17 +85,24 @@ pub trait TransferTokensModule: common_storage::CommonStorage { ) .sync_call(); } else { - let arg_buffer = self.get_nft_create_args( - &operation_token.token_identifier, - &operation_token.token_nonce, - &operation_token.token_data, - ); - - self.send_raw().call_local_esdt_built_in_function( - self.blockchain().get_gas_left(), - &ManagedBuffer::from(ESDT_NFT_CREATE_FUNC_NAME), - &arg_buffer, - ); + self.tx() + .to(ToSelf) + .typed(system_proxy::UserBuiltinProxy) + .esdt_nft_create( + &operation_token.token_identifier, + &operation_token.token_data.amount, + &operation_token.token_data.name, + &operation_token.token_data.royalties, + &operation_token.token_data.hash, + &operation_token.token_data.attributes, + &operation_token.token_data.uris, + ) + .sync_call(); + // self.send_raw().call_local_esdt_built_in_function( + // self.blockchain().get_gas_left(), + // &ManagedBuffer::from(ESDT_NFT_CREATE_FUNC_NAME), + // &arg_buffer, + // ); } output_payments.push(operation_token.into()); From 35ab88ad110626233c9ed0a72213445ab3817bf1 Mon Sep 17 00:00:00 2001 From: Andrei Baltariu Date: Wed, 16 Oct 2024 14:32:13 +0300 Subject: [PATCH 437/523] Reverted `arg_buffer` logic Signed-off-by: Andrei Baltariu --- token-handler/src/transfer_tokens.rs | 29 +++++++++++----------------- 1 file changed, 11 insertions(+), 18 deletions(-) diff --git a/token-handler/src/transfer_tokens.rs b/token-handler/src/transfer_tokens.rs index 6cb6b4d8..be527c31 100644 --- a/token-handler/src/transfer_tokens.rs +++ b/token-handler/src/transfer_tokens.rs @@ -85,24 +85,17 @@ pub trait TransferTokensModule: common_storage::CommonStorage { ) .sync_call(); } else { - self.tx() - .to(ToSelf) - .typed(system_proxy::UserBuiltinProxy) - .esdt_nft_create( - &operation_token.token_identifier, - &operation_token.token_data.amount, - &operation_token.token_data.name, - &operation_token.token_data.royalties, - &operation_token.token_data.hash, - &operation_token.token_data.attributes, - &operation_token.token_data.uris, - ) - .sync_call(); - // self.send_raw().call_local_esdt_built_in_function( - // self.blockchain().get_gas_left(), - // &ManagedBuffer::from(ESDT_NFT_CREATE_FUNC_NAME), - // &arg_buffer, - // ); + let arg_buffer = self.get_nft_create_args( + &operation_token.token_identifier, + &operation_token.token_nonce, + &operation_token.token_data, + ); + + self.send_raw().call_local_esdt_built_in_function( + self.blockchain().get_gas_left(), + &ManagedBuffer::from(ESDT_NFT_CREATE_FUNC_NAME), + &arg_buffer, + ); } output_payments.push(operation_token.into()); From ac407bc862d1f639ffaab743bf859cbcb397e971 Mon Sep 17 00:00:00 2001 From: Andrei Baltariu Date: Wed, 16 Oct 2024 14:35:42 +0300 Subject: [PATCH 438/523] Modified expected error message Signed-off-by: Andrei Baltariu --- enshrine-esdt-safe/tests/enshrine_esdt_safe_blackbox_test.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/enshrine-esdt-safe/tests/enshrine_esdt_safe_blackbox_test.rs b/enshrine-esdt-safe/tests/enshrine_esdt_safe_blackbox_test.rs index bb238016..9ca2e453 100644 --- a/enshrine-esdt-safe/tests/enshrine_esdt_safe_blackbox_test.rs +++ b/enshrine-esdt-safe/tests/enshrine_esdt_safe_blackbox_test.rs @@ -518,8 +518,8 @@ fn test_sovereign_prefix_no_prefix() { let mut state = EnshrineTestState::new(); let token_vec = Vec::from([NFT_TOKEN_ID, CROWD_TOKEN_ID]); let error_status = Some(ErrorStatus { - code: 4, - error_message: "Operation is not registered", + code: 10, + error_message: "action is not allowed", }); state.propose_setup_contracts(false, None); From 6132b49a6b85640c9a875fd7da37af4f5ffc353a Mon Sep 17 00:00:00 2001 From: Andrei Baltariu Date: Wed, 16 Oct 2024 14:36:23 +0300 Subject: [PATCH 439/523] Added note Signed-off-by: Andrei Baltariu --- token-handler/src/transfer_tokens.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/token-handler/src/transfer_tokens.rs b/token-handler/src/transfer_tokens.rs index be527c31..49070932 100644 --- a/token-handler/src/transfer_tokens.rs +++ b/token-handler/src/transfer_tokens.rs @@ -91,6 +91,7 @@ pub trait TransferTokensModule: common_storage::CommonStorage { &operation_token.token_data, ); + // NOTE: Will use this until the new NFT creation update self.send_raw().call_local_esdt_built_in_function( self.blockchain().get_gas_left(), &ManagedBuffer::from(ESDT_NFT_CREATE_FUNC_NAME), From 21ea4a7a746fe445a5474eb7fc3eadd25a1ff522 Mon Sep 17 00:00:00 2001 From: Andrei Baltariu Date: Wed, 16 Oct 2024 14:56:20 +0300 Subject: [PATCH 440/523] Added test ignore and dead code warning for interactor setup Signed-off-by: Andrei Baltariu --- esdt-safe/interactor/src/interactor_main.rs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/esdt-safe/interactor/src/interactor_main.rs b/esdt-safe/interactor/src/interactor_main.rs index ef09d0e8..764b64ff 100644 --- a/esdt-safe/interactor/src/interactor_main.rs +++ b/esdt-safe/interactor/src/interactor_main.rs @@ -1,4 +1,6 @@ #![allow(non_snake_case)] +// TODO: Remove this when interactor setup is complete +#![allow(dead_code)] mod price_aggregator_proxy; mod proxy; @@ -920,6 +922,7 @@ impl ContractInteract { } #[tokio::test] +#[ignore] async fn test_deploy() { let mut interact = ContractInteract::new().await; interact.deploy(false).await; @@ -931,6 +934,7 @@ async fn test_deploy() { } #[tokio::test] +#[ignore] async fn test_deploy_sov() { let mut interact = ContractInteract::new().await; interact.deploy(true).await; @@ -942,4 +946,3 @@ async fn test_deploy_sov() { interact.set_header_verifier_address().await; interact.unpause_endpoint().await; } - From 4895da60a987ca15ba23635d86d73b76ac85c624 Mon Sep 17 00:00:00 2001 From: Andrei Baltariu Date: Wed, 16 Oct 2024 16:09:02 +0300 Subject: [PATCH 441/523] Added `token_type` to `burn_mainchain_token` function Signed-off-by: Andrei Baltariu --- esdt-safe/src/to_sovereign/create_tx.rs | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/esdt-safe/src/to_sovereign/create_tx.rs b/esdt-safe/src/to_sovereign/create_tx.rs index 7a96699a..f0122c45 100644 --- a/esdt-safe/src/to_sovereign/create_tx.rs +++ b/esdt-safe/src/to_sovereign/create_tx.rs @@ -85,7 +85,11 @@ pub trait CreateTxModule: self.multiversx_to_sovereign_token_id_mapper(&payment.token_identifier); if !mvx_to_sov_token_id_mapper.is_empty() { let sov_token_id = mvx_to_sov_token_id_mapper.get(); - let sov_token_nonce = self.burn_mainchain_token(payment, &sov_token_id); + let sov_token_nonce = self.burn_mainchain_token( + payment, + &sov_token_id, + ¤t_token_data.token_type, + ); event_payments.push(MultiValue3::from(( sov_token_id, @@ -160,6 +164,7 @@ pub trait CreateTxModule: &self, payment: EsdtTokenPayment, sov_token_id: &TokenIdentifier, + payment_token_type: &EsdtTokenType, ) -> u64 { self.tx() .to(ToSelf) @@ -182,7 +187,7 @@ pub trait CreateTxModule: .get() .token_nonce; - if self.is_nft(&payment.token_type()) { + if self.is_nft(payment_token_type) { self.clear_mvx_to_sov_esdt_info_mapper( &payment.token_identifier, payment.token_nonce, From b10b24f50db07873b2cd238e2fdccf05caf2291a Mon Sep 17 00:00:00 2001 From: Andrei Baltariu Date: Wed, 16 Oct 2024 16:12:25 +0300 Subject: [PATCH 442/523] Small fixes Signed-off-by: Andrei Baltariu --- esdt-safe/src/from_sovereign/transfer_tokens.rs | 2 -- esdt-safe/src/to_sovereign/create_tx.rs | 4 ++-- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/esdt-safe/src/from_sovereign/transfer_tokens.rs b/esdt-safe/src/from_sovereign/transfer_tokens.rs index 3632e299..dc7ab4d9 100644 --- a/esdt-safe/src/from_sovereign/transfer_tokens.rs +++ b/esdt-safe/src/from_sovereign/transfer_tokens.rs @@ -314,11 +314,9 @@ pub trait TransferTokensModule: fn get_mvx_nonce_from_mapper(self, token_id: &TokenIdentifier, nonce: u64) -> u64 { let esdt_info_mapper = self.sovereign_to_multiversx_esdt_info_mapper(token_id, nonce); - if esdt_info_mapper.is_empty() { return 0; } - esdt_info_mapper.get().token_nonce } diff --git a/esdt-safe/src/to_sovereign/create_tx.rs b/esdt-safe/src/to_sovereign/create_tx.rs index f0122c45..ef9dac88 100644 --- a/esdt-safe/src/to_sovereign/create_tx.rs +++ b/esdt-safe/src/to_sovereign/create_tx.rs @@ -87,8 +87,8 @@ pub trait CreateTxModule: let sov_token_id = mvx_to_sov_token_id_mapper.get(); let sov_token_nonce = self.burn_mainchain_token( payment, - &sov_token_id, ¤t_token_data.token_type, + &sov_token_id, ); event_payments.push(MultiValue3::from(( @@ -163,8 +163,8 @@ pub trait CreateTxModule: fn burn_mainchain_token( &self, payment: EsdtTokenPayment, - sov_token_id: &TokenIdentifier, payment_token_type: &EsdtTokenType, + sov_token_id: &TokenIdentifier, ) -> u64 { self.tx() .to(ToSelf) From c0e00e2c134caec65c52475dd83a0e9460999715 Mon Sep 17 00:00:00 2001 From: Andrei Baltariu Date: Wed, 16 Oct 2024 18:27:04 +0300 Subject: [PATCH 443/523] Removed use of ExpectError struct in `deposit` tests Signed-off-by: Andrei Baltariu --- .../tests/enshrine_esdt_safe_blackbox_test.rs | 65 +++++-------------- 1 file changed, 18 insertions(+), 47 deletions(-) diff --git a/enshrine-esdt-safe/tests/enshrine_esdt_safe_blackbox_test.rs b/enshrine-esdt-safe/tests/enshrine_esdt_safe_blackbox_test.rs index 9ca2e453..d343ce91 100644 --- a/enshrine-esdt-safe/tests/enshrine_esdt_safe_blackbox_test.rs +++ b/enshrine-esdt-safe/tests/enshrine_esdt_safe_blackbox_test.rs @@ -355,28 +355,20 @@ impl EnshrineTestState { to: TestAddress, payment: PaymentsVec, deposit_args: OptionalTransferData, - error_status: Option, + expected_result: Option>, ) { - match error_status { - Some(status) => self - .world - .tx() - .from(from) - .to(ENSHRINE_ESDT_ADDRESS) - .typed(enshrine_esdt_safe_proxy::EnshrineEsdtSafeProxy) - .deposit(to, deposit_args) - .payment(payment) - .returns(ExpectError(status.code, status.error_message)) - .run(), - None => self - .world - .tx() - .from(from) - .to(ENSHRINE_ESDT_ADDRESS) - .typed(enshrine_esdt_safe_proxy::EnshrineEsdtSafeProxy) - .deposit(to, deposit_args) - .payment(payment) - .run(), + let transaction = self + .world + .tx() + .from(from) + .to(ENSHRINE_ESDT_ADDRESS) + .typed(enshrine_esdt_safe_proxy::EnshrineEsdtSafeProxy) + .deposit(to, deposit_args) + .payment(payment); + + match expected_result { + Some(error) => transaction.returns(error).run(), + None => transaction.run(), } } @@ -671,7 +663,7 @@ fn test_deposit_token_nothing_to_transfer_fee_enabled() { USER_ADDRESS, payments, OptionalValue::None, - Some(error_status), + Some(ExpectError(4, "Nothing to transfer")), ); } @@ -681,11 +673,6 @@ fn test_deposit_max_transfers_exceeded() { let amount = BigUint::from(10000u64); let wegld_payment = EsdtTokenPayment::new(WEGLD_IDENTIFIER.into(), 0, amount.clone()); let mut payments = PaymentsVec::new(); - let error_status = ErrorStatus { - code: 4, - error_message: "Too many tokens", - }; - payments.extend(std::iter::repeat(wegld_payment).take(11)); state.propose_setup_contracts(false, None); @@ -694,7 +681,7 @@ fn test_deposit_max_transfers_exceeded() { USER_ADDRESS, payments, OptionalValue::None, - Some(error_status), + Some(ExpectError(4, "Too many tokens")), ); } @@ -771,18 +758,13 @@ fn test_deposit_with_transfer_data_gas_limit_too_high() { payments.push(wegld_payment); payments.push(crowd_payment); - let error_status = ErrorStatus { - code: 4, - error_message: "Gas limit too high", - }; - state.propose_setup_contracts(false, None); state.propose_deposit( ENSHRINE_ESDT_OWNER_ADDRESS, USER_ADDRESS, payments, transfer_data, - Some(error_status), + Some(ExpectError(4, "Gas limit too high")), ); } @@ -804,12 +786,6 @@ fn test_deposit_with_transfer_data_banned_endpoint() { payments.push(wegld_payment); payments.push(crowd_payment); - let error_status = ErrorStatus { - code: 4, - error_message: "Banned endpoint name", - }; - - // TODO: idk if it supposed to be None state.propose_setup_contracts(false, None); state.propose_set_max_user_tx_gas_limit(gas_limit); state.propose_set_banned_endpoint(function); @@ -818,7 +794,7 @@ fn test_deposit_with_transfer_data_banned_endpoint() { USER_ADDRESS, payments, transfer_data, - Some(error_status), + Some(ExpectError(4, "Banned endpoint name")), ); } @@ -899,11 +875,6 @@ fn test_deposit_with_transfer_data_not_enough_for_fee() { let mut args = ManagedVec::new(); args.push(arg); - let error_status = ErrorStatus { - code: 4, - error_message: "Payment does not cover fee", - }; - let transfer_data = state.setup_transfer_data(gas_limit, function, args); payments.push(wegld_payment); @@ -927,7 +898,7 @@ fn test_deposit_with_transfer_data_not_enough_for_fee() { USER_ADDRESS, payments, transfer_data, - Some(error_status), + Some(ExpectError(4, "Payment does not cover fee")), ); } From 1b96d1da1aeea9df19eb94d0f562a74450e1b95a Mon Sep 17 00:00:00 2001 From: Andrei Baltariu Date: Wed, 16 Oct 2024 18:38:38 +0300 Subject: [PATCH 444/523] Removed used of ExpectError for `register_tokens` Signed-off-by: Andrei Baltariu --- .../tests/enshrine_esdt_safe_blackbox_test.rs | 103 ++++++------------ 1 file changed, 32 insertions(+), 71 deletions(-) diff --git a/enshrine-esdt-safe/tests/enshrine_esdt_safe_blackbox_test.rs b/enshrine-esdt-safe/tests/enshrine_esdt_safe_blackbox_test.rs index d343ce91..964e8278 100644 --- a/enshrine-esdt-safe/tests/enshrine_esdt_safe_blackbox_test.rs +++ b/enshrine-esdt-safe/tests/enshrine_esdt_safe_blackbox_test.rs @@ -230,7 +230,7 @@ impl EnshrineTestState { fn propose_execute_operation( &mut self, - error_status: Option, + expected_result: Option>, tokens: &Vec, ) { let (tokens, data) = self.setup_payments(tokens); @@ -240,27 +240,17 @@ impl EnshrineTestState { let hash_of_hashes: ManagedBuffer = ManagedBuffer::from(&sha256(&operation_hash.to_vec())); - match error_status { - Some(status) => { - self.world - .tx() - .from(USER_ADDRESS) - .to(ENSHRINE_ESDT_ADDRESS) - .typed(enshrine_esdt_safe_proxy::EnshrineEsdtSafeProxy) - .execute_operations(hash_of_hashes, operation) - .returns(ExpectError(status.code, status.error_message)) - .run(); - } - - None => { - self.world - .tx() - .from(USER_ADDRESS) - .to(ENSHRINE_ESDT_ADDRESS) - .typed(enshrine_esdt_safe_proxy::EnshrineEsdtSafeProxy) - .execute_operations(hash_of_hashes, operation) - .run(); - } + let transaction = self + .world + .tx() + .from(USER_ADDRESS) + .to(ENSHRINE_ESDT_ADDRESS) + .typed(enshrine_esdt_safe_proxy::EnshrineEsdtSafeProxy) + .execute_operations(hash_of_hashes, operation); + + match expected_result { + Some(error) => transaction.returns(error).run(), + None => transaction.run(), } } @@ -317,7 +307,7 @@ impl EnshrineTestState { sender: &TestAddress, fee_payment: EsdtTokenPayment, tokens_to_register: Vec, - error_status: Option, + expected_result: Option>, ) { let mut managed_token_ids: MultiValueEncoded> = MultiValueEncoded::new(); @@ -326,26 +316,18 @@ impl EnshrineTestState { managed_token_ids.push(TokenIdentifier::from(token_id)) } - match error_status { - Some(status) => self - .world - .tx() - .from(*sender) - .to(ENSHRINE_ESDT_ADDRESS) - .typed(enshrine_esdt_safe_proxy::EnshrineEsdtSafeProxy) - .register_new_token_id(managed_token_ids) - .returns(ExpectError(status.code, status.error_message)) - .esdt(fee_payment) - .run(), - None => self - .world - .tx() - .from(*sender) - .to(ENSHRINE_ESDT_ADDRESS) - .typed(enshrine_esdt_safe_proxy::EnshrineEsdtSafeProxy) - .register_new_token_id(managed_token_ids) - .esdt(fee_payment) - .run(), + let transaction = self + .world + .tx() + .from(*sender) + .to(ENSHRINE_ESDT_ADDRESS) + .typed(enshrine_esdt_safe_proxy::EnshrineEsdtSafeProxy) + .register_new_token_id(managed_token_ids) + .esdt(fee_payment); + + match expected_result { + Some(error) => transaction.returns(error).run(), + None => transaction.run(), } } @@ -509,15 +491,11 @@ fn test_deploy() { fn test_sovereign_prefix_no_prefix() { let mut state = EnshrineTestState::new(); let token_vec = Vec::from([NFT_TOKEN_ID, CROWD_TOKEN_ID]); - let error_status = Some(ErrorStatus { - code: 10, - error_message: "action is not allowed", - }); state.propose_setup_contracts(false, None); state.propose_register_operation(&token_vec); state.propose_whitelist_enshrine_esdt(); - state.propose_execute_operation(error_status, &token_vec); + state.propose_execute_operation(Some(ExpectError(10, "action is not allowed")), &token_vec); } #[test] @@ -535,8 +513,6 @@ fn test_sovereign_prefix_has_prefix() { fn test_register_tokens_insufficient_funds() { let mut state = EnshrineTestState::new(); let token_vec = Vec::from([PREFIX_NFT_TOKEN_ID, CROWD_TOKEN_ID]); - let code = 10u64; - let error_message = "insufficient funds"; let payment_amount = BigUint::from(DEFAULT_ISSUE_COST * token_vec.len() as u64); let payment = EsdtTokenPayment::new(WEGLD_IDENTIFIER.into(), 0, payment_amount); @@ -545,10 +521,7 @@ fn test_register_tokens_insufficient_funds() { &USER_ADDRESS, payment, token_vec, - Some(ErrorStatus { - code, - error_message, - }), + Some(ExpectError(10, "insufficient funds")), ); } @@ -556,8 +529,6 @@ fn test_register_tokens_insufficient_funds() { fn test_register_tokens_wrong_token_as_fee() { let mut state = EnshrineTestState::new(); let token_vec = Vec::from([PREFIX_NFT_TOKEN_ID, CROWD_TOKEN_ID]); - let code = 4u64; - let error_message = "WEGLD is the only token accepted as register fee"; let payment_amount = BigUint::from(DEFAULT_ISSUE_COST * token_vec.len() as u64); let payment = EsdtTokenPayment::new(CROWD_TOKEN_ID.into(), 0, payment_amount); @@ -566,10 +537,10 @@ fn test_register_tokens_wrong_token_as_fee() { &ENSHRINE_ESDT_OWNER_ADDRESS, payment, token_vec, - Some(ErrorStatus { - code, - error_message, - }), + Some(ExpectError( + 4, + "WEGLD is the only token accepted as register fee", + )), ); } @@ -597,8 +568,6 @@ fn test_register_tokens_insufficient_wegld() { FUNGIBLE_TOKEN_ID, CROWD_TOKEN_ID, ]); - let code = 4u64; - let error_message = "WEGLD fee amount is not met"; let payment_amount = BigUint::from(DEFAULT_ISSUE_COST + token_vec.len() as u64); let payment = EsdtTokenPayment::new(WEGLD_IDENTIFIER.into(), 0, payment_amount); @@ -607,10 +576,7 @@ fn test_register_tokens_insufficient_wegld() { &ENSHRINE_ESDT_OWNER_ADDRESS, payment, token_vec, - Some(ErrorStatus { - code, - error_message, - }), + Some(ExpectError(4, "WEGLD fee amount is not met")), ); } @@ -640,11 +606,6 @@ fn test_deposit_token_nothing_to_transfer_fee_enabled() { let amount = BigUint::from(10000u64); let wegld_payment = EsdtTokenPayment::new(WEGLD_IDENTIFIER.into(), 0, amount.clone()); let mut payments = PaymentsVec::new(); - let error_status = ErrorStatus { - code: 4, - error_message: "Nothing to transfer", - }; - let fee_amount_per_transfer = BigUint::from(100u32); let fee_amount_per_gas = BigUint::from(100u32); From 04bc5ba8a50a11e6f14c666bde39d87a7dadba89 Mon Sep 17 00:00:00 2001 From: Andrei Baltariu Date: Wed, 16 Oct 2024 18:43:41 +0300 Subject: [PATCH 445/523] Removed all references for `ErrorStatus` struct Signed-off-by: Andrei Baltariu --- .../tests/enshrine_esdt_safe_blackbox_test.rs | 40 +++++++------------ 1 file changed, 14 insertions(+), 26 deletions(-) diff --git a/enshrine-esdt-safe/tests/enshrine_esdt_safe_blackbox_test.rs b/enshrine-esdt-safe/tests/enshrine_esdt_safe_blackbox_test.rs index 964e8278..789254d2 100644 --- a/enshrine-esdt-safe/tests/enshrine_esdt_safe_blackbox_test.rs +++ b/enshrine-esdt-safe/tests/enshrine_esdt_safe_blackbox_test.rs @@ -47,11 +47,6 @@ const WEGLD_IDENTIFIER: TestTokenIdentifier = TestTokenIdentifier::new("WEGLD-12 const WEGLD_BALANCE: u128 = 100_000_000_000_000_000; const SOVEREIGN_TOKEN_PREFIX: &str = "sov"; -pub struct ErrorStatus<'a> { - code: u64, - error_message: &'a str, -} - type OptionalTransferData = OptionalValue, ManagedVec>>>; @@ -219,10 +214,10 @@ impl EnshrineTestState { fn propose_set_fee( &mut self, fee_struct: Option<&FeeStruct>, - error_status: Option, + expected_result: Option>, ) -> &mut Self { if let Some(fee) = fee_struct { - self.propose_add_fee_token(fee, error_status); + self.propose_add_fee_token(fee, expected_result); } self @@ -357,26 +352,19 @@ impl EnshrineTestState { fn propose_add_fee_token( &mut self, fee_struct: &FeeStruct, - error_status: Option, + expected_result: Option>, ) { - match error_status { - Some(error) => self - .world - .tx() - .from(ENSHRINE_ESDT_OWNER_ADDRESS) - .to(FEE_MARKET_ADDRESS) - .typed(fee_market_proxy::FeeMarketProxy) - .set_fee(fee_struct) - .returns(ExpectError(error.code, error.error_message)) - .run(), - None => self - .world - .tx() - .from(ENSHRINE_ESDT_OWNER_ADDRESS) - .to(FEE_MARKET_ADDRESS) - .typed(fee_market_proxy::FeeMarketProxy) - .set_fee(fee_struct) - .run(), + let transaction = self + .world + .tx() + .from(ENSHRINE_ESDT_OWNER_ADDRESS) + .to(FEE_MARKET_ADDRESS) + .typed(fee_market_proxy::FeeMarketProxy) + .set_fee(fee_struct); + + match expected_result { + Some(error) => transaction.returns(error).run(), + None => transaction.run(), } } From f6bfe3dd7b1e442b1e758ad09d23cbe9a47de5d7 Mon Sep 17 00:00:00 2001 From: Andrei Baltariu Date: Wed, 16 Oct 2024 18:49:09 +0300 Subject: [PATCH 446/523] Removed use of `ErrorStatus` struct Signed-off-by: Andrei Baltariu --- .../tests/header_verifier_blackbox_test.rs | 29 +++++-------------- 1 file changed, 8 insertions(+), 21 deletions(-) diff --git a/header-verifier/tests/header_verifier_blackbox_test.rs b/header-verifier/tests/header_verifier_blackbox_test.rs index 37ec73a0..50a62073 100644 --- a/header-verifier/tests/header_verifier_blackbox_test.rs +++ b/header-verifier/tests/header_verifier_blackbox_test.rs @@ -21,11 +21,6 @@ const WEGLD_BALANCE: u128 = 100_000_000_000_000_000; type BlsKeys = MultiValueEncoded>; -pub struct ErrorStatus<'a> { - code: u64, - error_message: &'a str, -} - #[derive(Clone)] pub struct BridgeOperation { signature: BlsSignature, @@ -103,7 +98,7 @@ impl HeaderVerifierTestState { caller: TestAddress, hash_of_hashes: &ManagedBuffer, operation_hash: ManagedBuffer, - error_status: Option, + expected_result: Option>, ) { let transaction = self .world @@ -113,10 +108,8 @@ impl HeaderVerifierTestState { .typed(header_verifier_proxy::HeaderverifierProxy) .remove_executed_hash(hash_of_hashes, operation_hash); - match error_status { - Some(error) => transaction - .returns(ExpectError(error.code, error.error_message)) - .run(), + match expected_result { + Some(error) => transaction.returns(error).run(), None => transaction.run(), } } @@ -246,10 +239,6 @@ fn test_remove_executed_hash_caller_not_esdt_address() { let operation_1 = ManagedBuffer::from("operation_1"); let operation_2 = ManagedBuffer::from("operation_2"); let operation = state.generate_bridge_operation_struct(vec![&operation_1, &operation_2]); - let error_status = ErrorStatus { - code: 4, - error_message: "Only ESDT Safe contract can call this endpoint", - }; state.propose_register_operations(operation.clone()); state.propose_register_esdt_address(ENSHRINE_ADDRESS); @@ -257,7 +246,10 @@ fn test_remove_executed_hash_caller_not_esdt_address() { OWNER, &operation.bridge_operation_hash, operation_1, - Some(error_status), + Some(ExpectError( + 4, + "Only ESDT Safe contract can call this endpoint", + )), ); } @@ -273,17 +265,12 @@ fn test_remove_executed_hash_no_esdt_address_registered() { let operation_2 = ManagedBuffer::from("operation_2"); let operation = state.generate_bridge_operation_struct(vec![&operation_1, &operation_2]); - let error_status = ErrorStatus { - code: 4, - error_message: "There is no registered ESDT address", - }; - state.propose_register_operations(operation.clone()); state.propose_remove_executed_hash( ENSHRINE_ADDRESS, &operation.bridge_operation_hash, operation_1, - Some(error_status), + Some(ExpectError(4, "There is no registered ESDT address")), ); } From 10f3a635e22d94e2ec36066d942d4504a15fd154 Mon Sep 17 00:00:00 2001 From: Andrei Baltariu Date: Thu, 17 Oct 2024 15:17:36 +0300 Subject: [PATCH 447/523] WIP test fixes Signed-off-by: Andrei Baltariu --- esdt-safe/interactor/src/interactor_main.rs | 15 ++++----------- esdt-safe/interactor/state.toml | 4 ++-- 2 files changed, 6 insertions(+), 13 deletions(-) diff --git a/esdt-safe/interactor/src/interactor_main.rs b/esdt-safe/interactor/src/interactor_main.rs index d77c8034..e95d6934 100644 --- a/esdt-safe/interactor/src/interactor_main.rs +++ b/esdt-safe/interactor/src/interactor_main.rs @@ -154,7 +154,7 @@ impl ContractInteract { ); let fee_market_code = BytesValue::interpret_from( - "mxsc:contract-codes/fee-market.mxsc.json", + "mxsc:../../fee-market/output/fee-market.mxsc.json", &InterpreterContext::default(), ); @@ -164,7 +164,7 @@ impl ContractInteract { ); let header_verifier_code = BytesValue::interpret_from( - "mxsc:contract-codes/header-verifier.mxsc.json", + "mxsc:../../header-verifier/output/header-verifier.mxsc.json", &InterpreterContext::default(), ); @@ -278,8 +278,8 @@ impl ContractInteract { .tx() .from(&self.wallet_address) .gas(100_000_000u64) - .typed(proxy::EsdtSafeProxy) - .init(false) + .typed(header_verifier_proxy::HeaderverifierProxy) + .init(MultiValueEncoded::new()) .code(&self.header_verifier_code) .returns(ReturnsNewAddress) .prepare_async() @@ -975,11 +975,9 @@ impl ContractInteract { } #[tokio::test] -#[ignore] async fn test_deploy_sov() { let mut interact = ContractInteract::new().await; interact.deploy(false).await; - interact.deploy_price_aggregator().await; interact.deploy_fee_market().await; interact.set_fee_market_address().await; interact.disable_fee().await; @@ -990,8 +988,3 @@ async fn test_deploy_sov() { interact.register_operations().await; interact.execute_operations().await; } - -#[tokio::test] -async fn test_register_operation() { - let mut interact = ContractInteract::new().await; -} diff --git a/esdt-safe/interactor/state.toml b/esdt-safe/interactor/state.toml index 122a0fa3..bd765ca2 100644 --- a/esdt-safe/interactor/state.toml +++ b/esdt-safe/interactor/state.toml @@ -1,4 +1,4 @@ -contract_address = "erd1qqqqqqqqqqqqqpgqtq8807c3nvpfsmvhaxfa92fgfw5zmg4qt7as97n7kg" +contract_address = "erd1qqqqqqqqqqqqqpgqcnv2tuqkmllgltxmuv52mdvcuws83wsut7asdpagcv" fee_market_address = "erd1qqqqqqqqqqqqqpgqcfne2fs7xs9lf2wshyr3cc78mv6wrpwgt7asw3gaew" -price_aggregator_address = "erd1qqqqqqqqqqqqqpgqaxq8dtgynumu824wnerjymrpfh4maquat7asqysu0t" +price_aggregator_address = "erd1qqqqqqqqqqqqqpgq4sshr5wx4ch5gd8847dsavahytt732kut7as6z3mv6" header_verifier_address = "erd1qqqqqqqqqqqqqpgqg4wen7hg6yypu77ach6dm0g2hvs3pey8t7asc0a02t" From c1c492895cf8f22bdff70b0b6631f08f762aba6b Mon Sep 17 00:00:00 2001 From: Andrei Baltariu Date: Thu, 17 Oct 2024 15:57:55 +0300 Subject: [PATCH 448/523] Removed unused imports Signed-off-by: Andrei Baltariu --- esdt-safe/interactor/src/interactor_main.rs | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/esdt-safe/interactor/src/interactor_main.rs b/esdt-safe/interactor/src/interactor_main.rs index e95d6934..b174087b 100644 --- a/esdt-safe/interactor/src/interactor_main.rs +++ b/esdt-safe/interactor/src/interactor_main.rs @@ -6,11 +6,9 @@ mod proxies; use fee_market::fee_market_proxy::FeeMarketProxy; use fee_market::fee_market_proxy::{self, FeeStruct, FeeType}; -use multiversx_sc_scenario::multiversx_chain_vm::crypto_functions::{ - self, sha256, SHA256_RESULT_LEN, -}; +use multiversx_sc_scenario::multiversx_chain_vm::crypto_functions::{sha256, SHA256_RESULT_LEN}; use multiversx_sc_snippets::imports::*; -use multiversx_sc_snippets::sdk::{self, crypto}; +use multiversx_sc_snippets::sdk::{self}; use proxies::*; use serde::{Deserialize, Serialize}; use std::{ From 9a46e127470919a44b9533db207e0419f438fb64 Mon Sep 17 00:00:00 2001 From: Andrei Baltariu Date: Fri, 18 Oct 2024 10:09:09 +0300 Subject: [PATCH 449/523] Fixed build file name error Signed-off-by: Andrei Baltariu --- fee-market/sc-config.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fee-market/sc-config.toml b/fee-market/sc-config.toml index 78a84c24..a50d7307 100644 --- a/fee-market/sc-config.toml +++ b/fee-market/sc-config.toml @@ -5,7 +5,7 @@ main = "main" name = "fee-market" [contracts.full] -name = "fee-marker-full" +name = "fee-market" add-unlabelled = true add-labels = ["fee-market-external-view"] From 399d3c1556896b0931244db0b84920c00cc15040 Mon Sep 17 00:00:00 2001 From: Andrei Baltariu Date: Fri, 18 Oct 2024 10:09:49 +0300 Subject: [PATCH 450/523] Built files Signed-off-by: Andrei Baltariu --- .../Cargo.lock | 16 ++++++++-------- .../Cargo.toml | 2 +- .../src/lib.rs | 0 3 files changed, 9 insertions(+), 9 deletions(-) rename fee-market/{wasm-fee-marker-full => wasm-fee-market}/Cargo.lock (99%) rename fee-market/{wasm-fee-marker-full => wasm-fee-market}/Cargo.toml (95%) rename fee-market/{wasm-fee-marker-full => wasm-fee-market}/src/lib.rs (100%) diff --git a/fee-market/wasm-fee-marker-full/Cargo.lock b/fee-market/wasm-fee-market/Cargo.lock similarity index 99% rename from fee-market/wasm-fee-marker-full/Cargo.lock rename to fee-market/wasm-fee-market/Cargo.lock index 6d42739d..4381e40d 100644 --- a/fee-market/wasm-fee-marker-full/Cargo.lock +++ b/fee-market/wasm-fee-market/Cargo.lock @@ -34,14 +34,6 @@ version = "0.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c34f04666d835ff5d62e058c3995147c06f42fe86ff053337632bca83e42702d" -[[package]] -name = "fee-marker-full-wasm" -version = "0.0.0" -dependencies = [ - "fee-market", - "multiversx-sc-wasm-adapter", -] - [[package]] name = "fee-market" version = "0.0.0" @@ -52,6 +44,14 @@ dependencies = [ "utils", ] +[[package]] +name = "fee-market-wasm" +version = "0.0.0" +dependencies = [ + "fee-market", + "multiversx-sc-wasm-adapter", +] + [[package]] name = "hex" version = "0.4.3" diff --git a/fee-market/wasm-fee-marker-full/Cargo.toml b/fee-market/wasm-fee-market/Cargo.toml similarity index 95% rename from fee-market/wasm-fee-marker-full/Cargo.toml rename to fee-market/wasm-fee-market/Cargo.toml index d2522cb0..370fa907 100644 --- a/fee-market/wasm-fee-marker-full/Cargo.toml +++ b/fee-market/wasm-fee-market/Cargo.toml @@ -5,7 +5,7 @@ # ########################################## [package] -name = "fee-marker-full-wasm" +name = "fee-market-wasm" version = "0.0.0" edition = "2021" publish = false diff --git a/fee-market/wasm-fee-marker-full/src/lib.rs b/fee-market/wasm-fee-market/src/lib.rs similarity index 100% rename from fee-market/wasm-fee-marker-full/src/lib.rs rename to fee-market/wasm-fee-market/src/lib.rs From 7a7a620f8faa432eabd60f9d29542851377e5048 Mon Sep 17 00:00:00 2001 From: Andrei Baltariu Date: Fri, 18 Oct 2024 10:10:33 +0300 Subject: [PATCH 451/523] Interactor new code files Signed-off-by: Andrei Baltariu --- .../contract-codes/fee-market.mxsc.json | 31 ++++++++++++------- .../contract-codes/header-verifier.mxsc.json | 14 ++++----- 2 files changed, 26 insertions(+), 19 deletions(-) diff --git a/esdt-safe/interactor/contract-codes/fee-market.mxsc.json b/esdt-safe/interactor/contract-codes/fee-market.mxsc.json index a6fce293..80a31224 100644 --- a/esdt-safe/interactor/contract-codes/fee-market.mxsc.json +++ b/esdt-safe/interactor/contract-codes/fee-market.mxsc.json @@ -1,11 +1,11 @@ { "buildInfo": { "rustc": { - "version": "1.79.0", - "commitHash": "129f3b9964af4d4a709d1383930ade12dfe7c081", - "commitDate": "2024-06-10", + "version": "1.81.0", + "commitHash": "eeb90cda1969383f56a2637cbd3037bdf598841c", + "commitDate": "2024-09-04", "channel": "Stable", - "short": "rustc 1.79.0 (129f3b996 2024-06-10)" + "short": "rustc 1.81.0 (eeb90cda1 2024-09-04)" }, "contractCrate": { "name": "fee-market", @@ -13,7 +13,7 @@ }, "framework": { "name": "multiversx-sc", - "version": "0.53.0" + "version": "0.53.2" } }, "abi": { @@ -24,10 +24,6 @@ "name": "esdt_safe_address", "type": "Address" }, - { - "name": "price_aggregator_address", - "type": "Address" - }, { "name": "fee", "type": "Option" @@ -40,6 +36,17 @@ "outputs": [] }, "endpoints": [ + { + "name": "setPriceAggregatorAddress", + "mutability": "mutable", + "inputs": [ + { + "name": "price_aggregator_address", + "type": "Address" + } + ], + "outputs": [] + }, { "name": "addFee", "onlyOwner": true, @@ -291,7 +298,7 @@ } } }, - "code": "0061736d0100000001791460027f7f0060017f017f60027f7f017f60000060017f0060037f7f7f006000017f60037f7f7f017f60047f7f7f7f017f60047f7f7f7f0060027f7e0060017f017e60057f7f7e7f7f017f60017e006000017e60067e7f7f7f7f7f017f60057f7f7f7f7f0060047f7e7f7f0060027f7f017e60037f7f7f017e02e8062503656e760e626967496e74536574496e743634000a03656e7609626967496e74416464000503656e760b7369676e616c4572726f72000003656e7609626967496e744d756c000503656e760a6d4275666665724e6577000603656e760d6d427566666572417070656e64000203656e76096d4275666665724571000203656e760d6d42756666657246696e697368000103656e76106d4275666665724765744c656e677468000103656e760d6d616e6167656443616c6c6572000403656e76136d616e616765644f776e657241646472657373000403656e76126d427566666572476574417267756d656e74000203656e76126d427566666572417070656e644279746573000703656e76126d616e616765645369676e616c4572726f72000403656e761b736d616c6c496e74476574556e7369676e6564417267756d656e74000b03656e760f6765744e756d417267756d656e7473000603656e7609626967496e74537562000503656e76226d616e616765644d756c74695472616e73666572455344544e465445786563757465000c03656e76146d427566666572436f707942797465536c696365000803656e760f6d4275666665725365744279746573000703656e761776616c6964617465546f6b656e4964656e746966696572000103656e76196d42756666657246726f6d426967496e74556e7369676e6564000203656e76176d427566666572546f426967496e74556e7369676e6564000203656e76126d42756666657253746f726167654c6f6164000203656e76136d42756666657253746f7261676553746f7265000203656e7609626967496e74436d70000203656e760f6d4275666665724765744279746573000203656e760f6973536d617274436f6e7472616374000103656e760e636865636b4e6f5061796d656e74000303656e7616736d616c6c496e7446696e697368556e7369676e6564000d03656e760a626967496e7454446976000503656e761c6d616e616765644765744d756c74694553445443616c6c56616c7565000403656e760a6765744761734c656674000e03656e761b6d616e61676564457865637574654f6e44657374436f6e74657874000f03656e760f636c65616e52657475726e44617461000303656e760a626967496e745369676e000103656e76136d42756666657247657442797465536c69636500080379780106000200010001010904040600010a060000000009070907070100000202040001020201010603070706000704040403050109050004090510000101080800020801000004000201010011050001020205020002020012050007000100130104040604040106040303030303030303030303030303030305030100030616037f01418080080b7f0041a5d6080b7f0041b0d6080b07880211066d656d6f7279020004696e6974008d010775706772616465008e0106616464466565008f010972656d6f76654665650090010b676574546f6b656e466565009101136164645573657273546f57686974656c6973740092011872656d6f7665557365727346726f6d57686974656c6973740093010e64697374726962757465466565730094010b737562747261637446656500950111676574557365727357686974656c697374009701127365744d696e56616c69645369676e6572730098010a6164645369676e6572730099010d72656d6f76655369676e657273009a010863616c6c4261636b009b010a5f5f646174615f656e6403010b5f5f686561705f6261736503020ae94a781601017f1026220142001000200120012000100120010b1901017f41e4870841e4870828020041016b220036020020000bdf0102047f017e0240024020012802182204200128022010280440200128022421024172200135022c100020022002417210032001290300500440200129030822064200530d0220012802282103417220061000200320034172100320022002200310010b417f2002200128021c22031019220541004720054100481b41ff01714101460d022003200210292004102a21032000200236020c2000200336020820004200370300200041186a200141186a290300370300200020012903103703100f0b41b18108411e102b000b41ba840841111002000b41cf8108411a102b000b0b0020002001100641004a0b0a0020002000200110560b0f01017f10042201200010051a20010b0900200020011002000b3c01017f230041106b220124002000102d450440419582084117102b000b200141086a200041002000100841076b102e200128020c200141106a24000b0900200010144100470b1f0020012002200310042201101221022000200136020420002002453602000bbe0101047f2000280210220210300240024002400240024002402000280200220141016b0e020201000b41c382084110102b000b200028020421030c010b2002200028020422031028450d010b20031030103141011032200041106a10332104200028020c210220002802082100024002400240200141016b0e020102000b2004420010340f0b41011035220110360c020b41021035220110360c010b41d38208410b102b000b2003200110372000200110382002200110382004200110390b13002000102d45044041c786084110102b000b0b0a0041898608410e10430b3701017f230041106b220224002002420037030820022001ad4101200241086a10702000200228020020022802041071200241106a24000b1901017f4197860841081043210120002802002001107b20010b3601017f230041106b2202240020024200370308200220014100200241086a10702000200228020020022802041071200241106a24000b08004101410010430b2601017f230041106b22022400200220003a000f20012002410f6a4101107d200241106a24000b4f01027f230041106b22022400200220001008220341187420034180fe03714108747220034108764180fe03712003411876727236020c20012002410c6a4104107d200120001064200241106a24000b0a002000104a200110370b09002000200110181a0ba40101027f0240024002400240200120022003103b41ff01710e03010203000b2002200341808008410d103c000b200041003602000f0b200120022003103d2104200120022003103e21052000200120022003103e36020c2000200536020820002004360204200041013602000f0b200120022003103d2104200120022003103e21052000200120022003103e36020c2000200536020820002004360204200041023602000b2f01017f230041106b22032400200341003a000f20002003410f6a410120012002105e20032d000f200341106a24000b2e01017f419a830841171043220420002001100c1a200441b183084103100c1a200420022003100c1a2004100d000b890101037f230041106b220324002003410036020c20002003410c6a410420012002105e2003200028020820002802002205200328020c220441187420044180fe03714108747220044108764180fe0371200441187672722204102e200328020041014704402001200241ab8408410f103c000b20032802042000200420056a360200200341106a24000b0c00200020012002103d10490b0f01017f102622012000ad100020010b3002017f017e2001280208102a2102200129030021032000200128020c102536020c20002003370300200020023602080b4301017f2001280204220220012802084b047f4100052001200241016a3602042001280200280200200210421067210141010b210220002001360204200020023602000b5401017f230041106b220224002000102a220041eb84084105100c1a2002200141187420014180fe03714108747220014108764180fe03712001411876727236020c20002002410c6a105f200241106a240020000b1101017f102622022000200110131a20020b0700200010071a0b3101017f20011046220210082101200041003a00102000200136020c2000200236020820002001360204200041003602000b0d00200010262200100b1a20000b0a0020002001104810490b850101037f230041106b220224002002410036020c20002002410c6a41042001105c2002200028020820002802002204200228020c220341187420034180fe03714108747220034108764180fe0371200341187672722203102e20022802004101470440200141ab8408410f105d000b20022802042000200320046a360200200241106a24000b0d0020001026220010161a20000b0f01017f10262201200010151a20010b0c01017f10262200100920000b1d01017f10262200100a2000104b102804400f0b419e870841241002000b2f01017f200028020022034180d6082802004e04402001200241b483084111103c000b2000200341016a36020020030b2e01017f104f2103034020002802004180d6082802004e4504402003200020012002104d104610500c010b0b20030b1101017f102622004101410010131a20000b4601017f230041106b220224002002200141187420014180fe03714108747220014108764180fe03712001411876727236020c20002002410c6a4104100c1a200241106a24000b1f00200010462200100841204704402001200241ae85084110103c000b20000b190020004180d6082802004e04400f0b41c5830841121002000b1400100f20004604400f0b41d7830841191002000b190020004180d6082802004c04400f0b41b4830841111002000b0b004180d608100f3602000b1f0020002001200210102000105741ff017104400f0b41f0830841301002000b1500410241012000102322001b4100200041004e1b0bf30102017e037f230041106b2206240020002903002104200028020c2000280208104f2107280200102a2100280200102521052006200442388620044280fe0383422886842004428080fc0783421886200442808080f80f834208868484200442088842808080f80f832004421888428080fc07838420044228884280fe038320044238888484843702042006200041187420004180fe03714108747220004108764180fe0371200041187672723602002006200541187420054180fe03714108747220054108764180fe03712005411876727236020c200720064110100c1a2001200742002002200310111a200641106a24000b2c01017f2001280204104f1a2002102a1050200041086a200141086a280200360200200020012902003702000b5401037f230041206b22022400200241086a105b200228020c2103200228020821042002200141086a36021820022001410c6a36021c20022001290300370310200241106a2000200420031058200241206a24000b1601017f104f21012000104f360204200020013602000b2d00200041086a20002802002001200210660440200341ab8408410f105d000b2000200028020020026a3602000b2c01017f41f68408411b10432203200010051a200341b183084103100c1a200320012002100c1a2003100d000b2f00200041086a200028020020012002106604402003200441ab8408410f103c000b2000200028020020026a3602000b0b00200020014104100c1a0b0b002000106141ff0171450b09002000105741016b0b0c00200020012002200310630b0f00200020012003200210244100470b09002000200110051a0b1001017f1026220220002001100320020bc70301067f02400240027f024020002d000845044020002802002204100822054190ce004b0d0141fcd5082d00000d0141f8d508200536020041fcd50841013a00002004410041e88708200510621a200041013a00080b4101200120036a220041f8d5082802004b0d011a20002001490d0220004190ce004b0d03200141e887086a2100200341104f04402002410020026b41037122046a210520040440200021010340200220012d00003a0000200141016a2101200241016a22022005490d000b0b2005200320046b2203417c7122066a21020240200020046a22044103710440200641004c0d012004410374220141187121072004417c71220841046a2100410020016b4118712109200828020021010340200520012007762000280200220120097472360200200041046a2100200541046a22052002490d000b0c010b200641004c0d0020042100034020052000280200360200200041046a2100200541046a22052002490d000b0b20034103712103200420066a21000b20030440200220036a21010340200220002d00003a0000200041016a2100200241016a22022001490d000b0b41000f0b200041003a0008200420012002200310620b0f0b109c01000b109601000b0d0020001026220010171a20000b08002000200110390b0b0020002001104a10181a0b1200416c4101410010131a2000416c10181a0b090020002001ad10340b0a00200020011042106d0b1f01017f20001067220110084120470440200041ae85084110105d000b20010b2401017e20002000107c22014280808080105a04402000418d8008410e105d000b2001a70b08002000200110680b900101037f200320013c00072003410036000020032001420888a722063a000620032001421088a722053a000520032001421888a722043a000420004108200420057241ff017145220541044105200441ff01711b6a41002005200641ff01711b22046a200441002001501b6a2204200320044107716a2c00004100482002716b22026b3602042000200220036a3602000b0d00200020012002104310181a0b860201057f230041206b220224002001416710171a02400240416710084504400c010b20011067220510082103200241003a001820022003360214200220053602102002200336020c20024100360208200241003a001f200241086a2002411f6a41012001105c024002400240024020022d001f22040e03030201000b200141808008410d105d000b410221040b200241086a22032001104821052003200110472103200241086a2001104721060b200228020c2002280208470d0120022d0018450d0041f8d508410036020041fcd50841003a00000b2000200636020c200020033602082000200536020420002004360200200241206a24000f0b2001418d8008410e105d000b08002000106710490ba30101067f02402000280208220520011075220204400240200220002802042204106e22034d044020022003460d012004106e2003490d03200028020022072003106c21062004106e2002490d03200720021042200610680c010b0c020b2004106e2003490d01200028020020031042106a2004200341016b106b2002200347044020052006200210760b200520011077106a0b20024100470f0b41c2870841121002000b0a00200020011077106e0b0d002000200110772002ad10340b19002000102a220041f084084106100c1a20002001106420000b4001037f200028020822032001107945044020002802042202106e21042000280200200441016a220010422001106820022000106b200320012002106e10760b0b0b002000200110754100470b19002000102a220041f084084106100c1a20012000107b20000b4d01027f230041106b22022400200220001008220341187420034180fe03714108747220034108764180fe03712003411876727236020c20012002410c6a105f200120001064200241106a24000ba30102017e027f230041106b22032400200342003703082000106722041008220041094f04402001418d8008410e105d000b20044100200320006b41106a200010631a20032903082102200341106a2400200242388620024280fe0383422886842002428080fc0783421886200242808080f80f834208868484200242088842808080f80f832002421888428080fc07838420024228884280fe038320024238888484840b0b00200020012002100c1a0b900102017e017f230041106b2203240020002802082001103720032000290300220242388620024280fe0383422886842002428080fc0783421886200242808080f80f834208868484200242088842808080f80f832002421888428080fc07838420024228884280fe038320024238888484843703082001200341086a4108107d200028020c20011038200341106a24000b7b01027f230041106b22032400200028020821042003410036020c200028020020044102742003410c6a41041062450440200328020c21012000200441016a360208200141187420014180fe03714108747220014108764180fe037120014118767272102a200341106a24000f0b2001200241b483084111103c000b2e01017f200128020820012802044f047f4100052001108101210141010b210220002001360204200020023602000b2900200041be85084108107f102a22001008412047044041be8508410841ae85084110103c000b20000b2e01027f2001102a21022001102a220341aa85084104100c1a2000200336020420002001360200200020023602080ba10102017e027f230041106b220424002004420037030820001008220541094f044020012002418d8008410e103c000b20004100200420056b41106a200510631a20042903082103200441106a2400200342388620034280fe0383422886842003428080fc0783421886200342808080f80f834208868484200342088842808080f80f832003421888428080fc07838420034228884280fe038320034238888484840b0d002000106141ff01714101460b0f00200041f08508410a10431082010bbc0101077f230041206b2201240002400240200010084120460440200141186a4200370300200141106a4200370300200141086a420037030020014200370300200041002001412010631a200121024120210541cb840821030240034020022d0000220620032d00002207460440200241016a2102200341016a2103200541016b22050d010c020b0b200620076b21040b2004450d010b20004185d608101a1a4185d608101b41004a0d010b41b586084112102b000b200141206a24000b0a0041d78608410f10430b3601037f41e68608410d10432201102a21022001102a220341aa85084104100c1a2000200336020420002001360200200020023602080b0f00200041f38608410e10431082010b1901017f4181870841071043210120002802002001107b20010b0a0041888708411610430b0f00200041a08408410b107f102a1a0bc10301077f230041306b22012400101c41031053410041848208411110512105410141ec81084118105121062001411c6a2104230041406a22002400200041046a220341021045410321020240024020002802082000280204470440024002400240200341e981084103103b41ff01710e020201000b41e98108410341808008410d103c000b200041046a220241e981084103103d2103200041286a200241e981084103103a20002003360238200041206a200041346a2902003703002000200029022c370318200028022821020b20002802082000280204470d01200041306a200041206a290300370300200020002903183703280b20002d0014044041f8d508410036020041fcd50841003a00000b20042002360200200420002903283702042004410c6a200041306a290300370200200041406b24000c010b41e981084103418d8008410e103c000b200141106a2202200141286a220329020037030020012001290220370308200128021c2100200510860120061086011087012005106f108b012006106f024020004103470440200320022903003702002001200036021c200120012903083702202004102f0c010b1031410010320b200141306a24000b0800101c410010530bd30101057f230041206b22032400101c104c410110532003410c6a2101230041406a220024002000411c6a220241001045200241de8208410a103d2104200041306a200241de8208410a103a02402000280220200028021c460440200041106a2202200041386a2902003703002000200029023037030820002d002c044041f8d508410036020041fcd50841003a00000b2001200029030837020020012004360210200141086a2002290300370200200041406b24000c010b41de8208410a418d8008410e103c000b2001102f200341206a24000b3401017f230041106b22002400101c104c4101105320004100104636020c2000410c6a1033106a103141001032200041106a24000ba00101027f230041206b22002400101c4101105320004100104636020c200041106a2000410c6a103310720240024002400240200028021041016b0e020102000b4200101d0c020b4101103522011036200028021420011037200028021820011038200028021c20011038200110440c010b4102103522011036200028021420011037200028021820011038200028021c20011038200110440b200041206a24000b840101037f230041206b22002400101c104c10554100105420004100360214200041146a41fd80084105104e210120002802141052200041086a1089012001100821022000410036021c200020024102763602182000200136021403402000200041146a10800120002802000440200041086a200028020410780c010b0b200041206a24000b900101037f230041206b22002400101c104c10554100105420004100360214200041146a41fd80084105104e210120002802141052200041086a1089012001100821022000410036021c2000200241027636021820002001360214024003402000200041146a1080012000280200450d01200041086a200028020410740d000b419f86084116102b000b200041206a24000bc506020e7f027e230041e0006b22002400101c104c10554100105420004100360250200041d0006a41e580084118104e2102200028025010524190ce00103f2108104f210520021008210320004100360258200020034102762203360254200020023602500240034020012003490440200041d0006a22021081012101200241be85084108107f41be85084108108301220f4280808080105a0d022000200141187420014180fe03714108747220014108764180fe0371200141187672723602402000200fa7220141187420014180fe03714108747220014108764180fe0371200141187672723602442005200041406b4108100c1a200e200f7c210e20002802542103200028025821010c010b0b200e4290ce00510440200041246a220110880120002000280228106e3602382000410136023420002001360230200041cc006a2109200041c8006a210a03400240200041186a200041306a10412000280218450440200041406b220110880120002000280244106e36025820004101360254200020013602500340200041086a200041d0006a1041200028020804402000280248200028020c107a106a0c0105410021032000280244106e21024101210103402003200120024b720d04200028024020011042106a200120024f2103200120012002496a21010c000b000b000b000b2000200028021c220b36023c2000413c6a108a011073220610600d014100210120061025210720051008210c0340200c200141086a22024904402000413c6a108a01200710690c030b2000420037035020052001200041d0006a220d410810631a2000280250210320062000280254220141187420014180fe03714108747220014108764180fe037120014118767272103f106521011026220420012008101e200221012004108401450d00200720041029200b102a21022000200436024c2000200236024820004200370340200041106a105b20002802142102200028021021042000200a3602582000200936025c20002000290340370350200d200341187420034180fe03714108747220034108764180fe0371200341187672722004200210580c000b000b0b200028024442001034200041e0006a24000f0b418281084116102b000b41be85084108418d8008410e103c000bbb0d020c7f037e230041d0016b22002400105541021054410041d68008410f105121074101100e220d4280808080105a044041c78008410f418d8008410e103c000b200da7210820004102360260200041e0006a22012802004180d6082802004e047e420105200141ba8008410d104d100e210e42000b210d2000200e3703082000200d3703002000290308210e2000290300210d200028026010520240024002400240104b108701106d10280440104b210b416b210602404184d6082d000022010440416b41ffffffff0720011b21060c010b4184d60841013a0000416b101f0b0240200610084170714110460440200610082105200041e8006a2103410121090340200241106a220120054b0d02200342003703002000420037036020062002200041e0006a411010631a200904402000290264220c423886200c4280fe038342288684200c428080fc0783421886200c42808080f80f834208868484200c42088842808080f80f83200c421888428080fc078384200c4228884280fe0383200c423888848484210c2000280260220241187420024180fe03714108747220024108764180fe037120024118767272210a200028026c220241187420024180fe03714108747220024108764180fe037120024118767272210441002109200121020c010b0b109601000b41f8820841221002000b2000200436021c2000200a3602182000200c3703100240103122012001107c220c4201580440200ca741016b0d040c010b200141c685084112105d000b200041e0006a1089012000280268200710790d02200041c8006a2201200041186a29030037030020002000290310370340200041d0006a2001103310720240024002400240200028025041016b0e020102000b419881084119102b000b200041f8006a2001290300370300200020002903403703702000200836028c012000200028025c3602880120002000290254370380012000200e3703682000200d370360200041206a200041e0006a10270c010b2000290258210c20002802542202102a2105200041f0006a2201200041406b10402000200836028c012000200c3702840120002005360280012000200e3703682000200d37036020022000280248102845044020004190016a20011040108b01106d21032000280278102c21042005102c2102200341feffffff07460d0341ac82084117104321012000104f3602a401200020013602a001200020033602a801200041206a2201200041a0016a220320041059200041c4016a2001200210591020210c20002802c801210420002802c401210220002802cc012101417642001000200c42a08d067d200c200c42a08d06561b20014176200220041026220210211a1022200210082101200041003602a801200020023602a001200020014102763602a4010240200141044f0440200341a08408410b107f41a08408410b1083014280808080105a0d082003108c012003108c01200341a08408410b107f41a08408410b1083011a200041a0016a41a08408410b107f10492102200041a0016a41a08408410b107f41a08408410b108301428002540d010c080b41d8850841181002000b2005102a210120002002102536027c2000200136027820004200370370200041a0016a200041e0006a102720002802bc01106045044020002802ac01200028029c0122041065220120012002101e2004200420011056200041286a200041a8016a2903003703002000200436023c20004200370330200020002903a00137032020002000280298013602380c020b200041386a200041b8016a290300370300200041306a200041b0016a290300370300200041286a200041a8016a290300370300200020002903a0013703200c010b200041206a200041e0006a10270b200041e0006a1088012000280228102a2103200028026822022003107a106e45044020002802642204106e21012000280260200141016a22011042200310181a20042001106b2004106e210120022003107a2001ad10340b200041286a108a012201107322022002200028022c1001200120021069200028023c10840104402007200041306a105a0b200041f8006a200041386a290300370300200041f0006a200041306a290300370300200041e8006a200041286a290300370300200020002903203703600c030b419b8008411f102b000b4191850841191002000b200b200041106a105a200a102a21021026220142001000200041f8006a200041186a2903003703002000200136026c2000200236026820004200370360200020002903103703700b200041e0006a10352201107e200041f0006a2001107e20011044200041d0016a24000f0b41a08408410b418d8008410e103c000b0600109c01000b5401047f230041106b22002400101c41001053200041046a1089012000280208106e210220002802042103410121010340200120024b45044020032001106c10071a200141016a21010c010b0b200041106a24000b3f02017e017f101c104c410110534100100e22004280808080105a044041ef82084109418d8008410e103c000b2000a7210141fa8508410f10432001ad10340b870101037f230041206b22002400101c104c10554100105420004100360214200041146a41e882084107104e210120002802141052200110082102200041003602102000200241027636020c2000200136020803402000200041086a1080012000280200044020002802042101200041146a22021085012002200110780c010b0b200041206a24000b880101037f230041206b22002400101c104c10554100105420004100360214200041146a41e882084107104e210120002802141052200110082102200041003602102000200241027636020c2000200136020803402000200041086a1080012000280200044020002802042101200041146a22021085012002200110741a0c010b0b200041206a24000b02000b0b0041d48708410e1002000b0bde070300418080080bcb04696e76616c69642076616c7565696e70757420746f6f206c6f6e674f6e6c7920455344542053616665206d61792063616c6c20746869732053436f70745f6761735f6c696d6974746f74616c5f7472616e73666572736f726967696e616c5f63616c6c6572616464726573735f70657263656e746167655f70616972737573657273496e76616c69642070657263656e746167652073756d546f6b656e206e6f7420616363657074656420617320666565496e76616c696420746f6b656e2070726f766964656420666f72206665655061796d656e7420646f6573206e6f7420636f7665722066656566656570726963655f61676772656761746f725f61646472657373657364745f736166655f61646472657373496e76616c69642045534454206964656e7469666965726c61746573745072696365466565644f7074696f6e616c496e76616c6964206665652074797065496e76616c6964206665656665655f7374727563747369676e6572736e65775f76616c7565696e636f7272656374206e756d626572206f662045534454207472616e7366657273617267756d656e74206465636f6465206572726f722028293a20746f6f2066657720617267756d656e7473746f6f206d616e7920617267756d656e747377726f6e67206e756d626572206f6620617267756d656e747363616e6e6f74207375627472616374206265636175736520726573756c7420776f756c64206265206e6567617469766573796e6320726573756c74696e70757420746f6f2073686f72746361737420746f20693634206572726f720041eb84080bf7022e6974656d2e696e64657873746f72616765206465636f6465206572726f7220286b65793a20726563697069656e742061646472657373206e6f74207365742e6c656e626164206172726179206c656e6774687661722061726773696e707574206f7574206f662072616e6765496e76616c69642061676772656761746f722076616c7565616c6c5369676e6572736d696e56616c69645369676e657273666565456e61626c6564466c6167746f6b656e4665654974656d206e6f7420666f756e6420696e206c697374496e76616c69642053432061646472657373496e76616c696420746f6b656e204944657364745361666541646472657373746f6b656e73466f7246656573757365727357686974656c69737461636346656573707269636541676772656761746f7241646472657373456e64706f696e742063616e206f6e6c792062652063616c6c6564206279206f776e6572696e646578206f7574206f662072616e676570616e6963206f636375727265640041e487080b0438ffffff", + "code": "0061736d0100000001791460027f7f0060017f017f60027f7f017f60000060017f0060037f7f7f006000017f60037f7f7f017f60047f7f7f7f017f60047f7f7f7f0060027f7e0060017f017e60057f7f7e7f7f017f60017e006000017e60067e7f7f7f7f7f017f60057f7f7f7f7f0060047f7e7f7f0060027f7f017e60037f7f7f017e02e8062503656e760e626967496e74536574496e743634000a03656e7609626967496e74416464000503656e760b7369676e616c4572726f72000003656e7609626967496e744d756c000503656e760a6d4275666665724e6577000603656e760d6d427566666572417070656e64000203656e76096d4275666665724571000203656e760d6d42756666657246696e697368000103656e76106d4275666665724765744c656e677468000103656e760d6d616e6167656443616c6c6572000403656e76136d616e616765644f776e657241646472657373000403656e76126d427566666572476574417267756d656e74000203656e76126d427566666572417070656e644279746573000703656e76126d616e616765645369676e616c4572726f72000403656e761b736d616c6c496e74476574556e7369676e6564417267756d656e74000b03656e760f6765744e756d417267756d656e7473000603656e7609626967496e74537562000503656e76226d616e616765644d756c74695472616e73666572455344544e465445786563757465000c03656e76146d427566666572436f707942797465536c696365000803656e760f6d4275666665725365744279746573000703656e761776616c6964617465546f6b656e4964656e746966696572000103656e76196d42756666657246726f6d426967496e74556e7369676e6564000203656e76176d427566666572546f426967496e74556e7369676e6564000203656e76126d42756666657253746f726167654c6f6164000203656e76136d42756666657253746f7261676553746f7265000203656e7609626967496e74436d70000203656e760f6d4275666665724765744279746573000203656e760f6973536d617274436f6e7472616374000103656e760e636865636b4e6f5061796d656e74000303656e7616736d616c6c496e7446696e697368556e7369676e6564000d03656e760a626967496e7454446976000503656e761c6d616e616765644765744d756c74694553445443616c6c56616c7565000403656e760a6765744761734c656674000e03656e761b6d616e61676564457865637574654f6e44657374436f6e74657874000f03656e760f636c65616e52657475726e44617461000303656e760a626967496e745369676e000103656e76136d42756666657247657442797465536c6963650008037a790106000200010001010904040600010a06000000000907090707010000020204000102020101060307070600020404040305010905000409051000010108080002080301000004000201010011050001020205020002020012050007000100130104040604040106040303030303030303030303030303030305030100030616037f01418080080b7f0041a5d6080b7f0041b0d6080b07a50212066d656d6f7279020004696e6974008e010775706772616465008f0119736574507269636541676772656761746f7241646472657373009001066164644665650091010972656d6f76654665650092010b676574546f6b656e466565009301136164645573657273546f57686974656c6973740094011872656d6f7665557365727346726f6d57686974656c6973740095010e64697374726962757465466565730096010b737562747261637446656500970111676574557365727357686974656c697374009801127365744d696e56616c69645369676e6572730099010a6164645369676e657273009a010d72656d6f76655369676e657273009b010863616c6c4261636b009c010a5f5f646174615f656e6403010b5f5f686561705f6261736503020afe4a791601017f1026220142001000200120012000100120010b1901017f41e4870841e4870828020041016b220036020020000bdf0102047f017e0240024020012802182204200128022010280440200128022421024172200135022c100020022002417210032001290300500440200129030822064200530d0220012802282103417220061000200320034172100320022002200310010b417f2002200128021c22031019220541004720054100481b41ff01714101460d022003200210292004102a21032000200236020c2000200336020820004200370300200041186a200141186a290300370300200020012903103703100f0b41b18108411e102b000b41ba840841111002000b41cf8108411a102b000b0b0020002001100641004a0b0a0020002000200110560b0f01017f10042201200010051a20010b0900200020011002000b3c01017f230041106b220124002000102d450440419582084117102b000b200141086a200041002000100841076b102e200128020c200141106a24000b0900200010144100470b1f0020012002200310042201101221022000200136020420002002453602000bbe0101047f2000280210220210300240024002400240024002402000280200220141016b0e020201000b41c382084110102b000b200028020421030c010b2002200028020422031028450d010b20031030103141011032200041106a10332104200028020c210220002802082100024002400240200141016b0e020102000b2004420010340f0b41011035220110360c020b41021035220110360c010b41d38208410b102b000b2003200110372000200110382002200110382004200110390b13002000102d45044041c786084110102b000b0b0a0041898608410e10430b3701017f230041106b220224002002420037030820022001ad4101200241086a10712000200228020020022802041072200241106a24000b1901017f4197860841081043210120002802002001107c20010b3601017f230041106b2202240020024200370308200220014100200241086a10712000200228020020022802041072200241106a24000b08004101410010430b2601017f230041106b22022400200220003a000f20012002410f6a4101107e200241106a24000b4f01027f230041106b22022400200220001008220341187420034180fe03714108747220034108764180fe03712003411876727236020c20012002410c6a4104107e200120001064200241106a24000b0a002000104a200110370b09002000200110181a0ba40101027f0240024002400240200120022003103b41ff01710e03010203000b2002200341808008410d103c000b200041003602000f0b200120022003103d2104200120022003103e21052000200120022003103e36020c2000200536020820002004360204200041013602000f0b200120022003103d2104200120022003103e21052000200120022003103e36020c2000200536020820002004360204200041023602000b2f01017f230041106b22032400200341003a000f20002003410f6a410120012002105e20032d000f200341106a24000b2e01017f419a830841171043220420002001100c1a200441b183084103100c1a200420022003100c1a2004100d000b890101037f230041106b220324002003410036020c20002003410c6a410420012002105e2003200028020820002802002205200328020c220441187420044180fe03714108747220044108764180fe0371200441187672722204102e200328020041014704402001200241ab8408410f103c000b20032802042000200420056a360200200341106a24000b0c00200020012002103d10490b0f01017f102622012000ad100020010b3002017f017e2001280208102a2102200129030021032000200128020c102536020c20002003370300200020023602080b4301017f2001280204220220012802084b047f4100052001200241016a3602042001280200280200200210421068210141010b210220002001360204200020023602000b5401017f230041106b220224002000102a220041eb84084105100c1a2002200141187420014180fe03714108747220014108764180fe03712001411876727236020c20002002410c6a105f200241106a240020000b1101017f102622022000200110131a20020b0700200010071a0b3101017f20011046220210082101200041003a00102000200136020c2000200236020820002001360204200041003602000b0d00200010262200100b1a20000b0a0020002001104810490b850101037f230041106b220224002002410036020c20002002410c6a41042001105c2002200028020820002802002204200228020c220341187420034180fe03714108747220034108764180fe0371200341187672722203102e20022802004101470440200141ab8408410f105d000b20022802042000200320046a360200200241106a24000b0d0020001026220010161a20000b0f01017f10262201200010151a20010b0c01017f10262200100920000b1d01017f10262200100a2000104b102804400f0b419e870841241002000b2f01017f200028020022034180d6082802004e04402001200241b483084111103c000b2000200341016a36020020030b2e01017f104f2103034020002802004180d6082802004e4504402003200020012002104d104610500c010b0b20030b1101017f102622004101410010131a20000b4601017f230041106b220224002002200141187420014180fe03714108747220014108764180fe03712001411876727236020c20002002410c6a4104100c1a200241106a24000b2101017f410010462202100841204704402000200141ae85084110103c000b20020b190020004180d6082802004e04400f0b41c5830841121002000b1400100f20004604400f0b41d7830841191002000b190020004180d6082802004c04400f0b41b4830841111002000b0b004180d608100f3602000b1f0020002001200210102000105741ff017104400f0b41f0830841301002000b1500410241012000102322001b4100200041004e1b0bf30102017e037f230041106b2206240020002903002104200028020c2000280208104f2107280200102a2100280200102521052006200442388620044280fe0383422886842004428080fc0783421886200442808080f80f834208868484200442088842808080f80f832004421888428080fc07838420044228884280fe038320044238888484843702042006200041187420004180fe03714108747220004108764180fe0371200041187672723602002006200541187420054180fe03714108747220054108764180fe03712005411876727236020c200720064110100c1a2001200742002002200310111a200641106a24000b2c01017f2001280204104f1a2002102a1050200041086a200141086a280200360200200020012902003702000b5401037f230041206b22022400200241086a105b200228020c2103200228020821042002200141086a36021820022001410c6a36021c20022001290300370310200241106a2000200420031058200241206a24000b1601017f104f21012000104f360204200020013602000b2d00200041086a20002802002001200210660440200341ab8408410f105d000b2000200028020020026a3602000b2c01017f41f68408411b10432203200010051a200341b183084103100c1a200320012002100c1a2003100d000b2f00200041086a200028020020012002106604402003200441ab8408410f103c000b2000200028020020026a3602000b0b00200020014104100c1a0b0b002000106141ff0171450b09002000105741016b0b0c00200020012002200310630b0f00200020012003200210244100470b09002000200110051a0b1001017f1026220220002001100320020bc60301067f02400240027f024020002d000845044020002802002204100822054190ce004b0d0141fcd5082d00000d0141f8d508200536020041fcd50841013a00002004410041e88708200510621a200041013a00080b4101200120036a220041f8d5082802004b0d011a20002001490d0220004190ce004b0d03200141e887086a2100200341104f04402002410020026b41037122046a210520040440200021010340200220012d00003a0000200141016a2101200241016a22022005490d000b0b2005200320046b2203417c7122066a21020240200020046a22044103710440200641004c0d012004410374220141187121072004417c71220841046a2100410020016b4118712109200828020021010340200520012007762000280200220120097472360200200041046a2100200541046a22052002490d000b0c010b200641004c0d0020042100034020052000280200360200200041046a2100200541046a22052002490d000b0b20034103712103200420066a21000b20030440200220036a21010340200220002d00003a0000200041016a2100200241016a22022001490d000b0b41000f0b200041003a0008200420012002200310620b0f0b109d01000b1067000b0600109d01000b0d0020001026220010171a20000b08002000200110390b0b0020002001104a10181a0b1200416c4101410010131a2000416c10181a0b090020002001ad10340b0a00200020011042106e0b1f01017f20001068220110084120470440200041ae85084110105d000b20010b2401017e20002000107d22014280808080105a04402000418d8008410e105d000b2001a70b08002000200110690b900101037f200320013c00072003410036000020032001420888a722063a000620032001421088a722053a000520032001421888a722043a000420004108200420057241ff017145220541044105200441ff01711b6a41002005200641ff01711b22046a200441002001501b6a2204200320044107716a2c00004100482002716b22026b3602042000200220036a3602000b0d00200020012002104310181a0b860201057f230041206b220224002001416710171a02400240416710084504400c010b20011068220510082103200241003a001820022003360214200220053602102002200336020c20024100360208200241003a001f200241086a2002411f6a41012001105c024002400240024020022d001f22040e03030201000b200141808008410d105d000b410221040b200241086a22032001104821052003200110472103200241086a2001104721060b200228020c2002280208470d0120022d0018450d0041f8d508410036020041fcd50841003a00000b2000200636020c200020033602082000200536020420002004360200200241206a24000f0b2001418d8008410e105d000b08002000106810490ba30101067f02402000280208220520011076220204400240200220002802042204106f22034d044020022003460d012004106f2003490d03200028020022072003106d21062004106f2002490d03200720021042200610690c010b0c020b2004106f2003490d01200028020020031042106b2004200341016b106c2002200347044020052006200210770b200520011078106b0b20024100470f0b41c2870841121002000b0a00200020011078106f0b0d002000200110782002ad10340b19002000102a220041f084084106100c1a20002001106420000b4001037f200028020822032001107a45044020002802042202106f21042000280200200441016a220010422001106920022000106c200320012002106f10770b0b0b002000200110764100470b19002000102a220041f084084106100c1a20012000107c20000b4d01027f230041106b22022400200220001008220341187420034180fe03714108747220034108764180fe03712003411876727236020c20012002410c6a105f200120001064200241106a24000ba30102017e027f230041106b22032400200342003703082000106822041008220041094f04402001418d8008410e105d000b20044100200320006b41106a200010631a20032903082102200341106a2400200242388620024280fe0383422886842002428080fc0783421886200242808080f80f834208868484200242088842808080f80f832002421888428080fc07838420024228884280fe038320024238888484840b0b00200020012002100c1a0b900102017e017f230041106b2203240020002802082001103720032000290300220242388620024280fe0383422886842002428080fc0783421886200242808080f80f834208868484200242088842808080f80f832002421888428080fc07838420024228884280fe038320024238888484843703082001200341086a4108107e200028020c20011038200341106a24000b7b01027f230041106b22032400200028020821042003410036020c200028020020044102742003410c6a41041062450440200328020c21012000200441016a360208200141187420014180fe03714108747220014108764180fe037120014118767272102a200341106a24000f0b2001200241b483084111103c000b2e01017f200128020820012802044f047f4100052001108201210141010b210220002001360204200020023602000b2a00200041be85084108108001102a22001008412047044041be8508410841ae85084110103c000b20000b2e01027f2001102a21022001102a220341aa85084104100c1a2000200336020420002001360200200020023602080ba10102017e027f230041106b220424002004420037030820001008220541094f044020012002418d8008410e103c000b20004100200420056b41106a200510631a20042903082103200441106a2400200342388620034280fe0383422886842003428080fc0783421886200342808080f80f834208868484200342088842808080f80f832003421888428080fc07838420034228884280fe038320034238888484840b0d002000106141ff01714101460b0f00200041f08508410a10431083010bbc0101077f230041206b2201240002400240200010084120460440200141186a4200370300200141106a4200370300200141086a420037030020014200370300200041002001412010631a200121024120210541cb840821030240034020022d0000220620032d00002207460440200241016a2102200341016a2103200541016b22050d010c020b0b200620076b21040b2004450d010b20004185d608101a1a4185d608101b41004a0d010b41b586084112102b000b200141206a24000b0a0041d78608410f10430b3601037f41e68608410d10432201102a21022001102a220341aa85084104100c1a2000200336020420002001360200200020023602080b0f00200041f38608410e10431083010b1901017f4181870841071043210120002802002001107c20010b0a0041888708411610430b1000200041a08408410b108001102a1a0bab0301067f230041306b22012400101c41021053418482084111105121042001411c6a2103230041406a22002400200041046a41011045410321020240024020002802082000280204470440024002400240200041046a418182084103103b41ff01710e020201000b41818208410341808008410d103c000b200041046a2202418182084103103d2105200041286a2002418182084103103a20002005360238200041206a200041346a2902003703002000200029022c370318200028022821020b20002802082000280204470d01200041306a200041206a290300370300200020002903183703280b20002d0014044041f8d508410036020041fcd50841003a00000b20032002360200200320002903283702042003410c6a200041306a290300370200200041406b24000c010b418182084103418d8008410e103c000b200141106a2203200141286a220229020037030020012001290220370308200128021c2100200410870110880120041070024020004103470440200220032903003702002001200036021c200120012903083702202001411c6a102f0c010b1031410010320b200141306a24000b0800101c410010530b1e01017f101c4101105341e98108411810512200108701108c01200010700bd30101057f230041206b22032400101c104c410110532003410c6a2101230041406a220024002000411c6a220241001045200241de8208410a103d2104200041306a200241de8208410a103a02402000280220200028021c460440200041106a2202200041386a2902003703002000200029023037030820002d002c044041f8d508410036020041fcd50841003a00000b2001200029030837020020012004360210200141086a2002290300370200200041406b24000c010b41de8208410a418d8008410e103c000b2001102f200341206a24000b3401017f230041106b22002400101c104c4101105320004100104636020c2000410c6a1033106b103141001032200041106a24000ba00101027f230041206b22002400101c4101105320004100104636020c200041106a2000410c6a103310730240024002400240200028021041016b0e020102000b4200101d0c020b4101103522011036200028021420011037200028021820011038200028021c20011038200110440c010b4102103522011036200028021420011037200028021820011038200028021c20011038200110440b200041206a24000b840101037f230041206b22002400101c104c10554100105420004100360214200041146a41fd80084105104e210120002802141052200041086a108a012001100821022000410036021c200020024102763602182000200136021403402000200041146a10810120002802000440200041086a200028020410790c010b0b200041206a24000b900101037f230041206b22002400101c104c10554100105420004100360214200041146a41fd80084105104e210120002802141052200041086a108a012001100821022000410036021c2000200241027636021820002001360214024003402000200041146a1081012000280200450d01200041086a200028020410750d000b419f86084116102b000b200041206a24000bc806020d7f027e230041e0006b22002400101c104c10554100105420004100360250200041d0006a41e580084118104e2102200028025010524190ce00103f2108104f210520021008210320004100360258200020034102762203360254200020023602500240034020012003490440200041d0006a22021082012101200241be8508410810800141be85084108108401220e4280808080105a0d022000200141187420014180fe03714108747220014108764180fe0371200141187672723602402000200ea7220141187420014180fe03714108747220014108764180fe0371200141187672723602442005200041406b4108100c1a200d200e7c210d20002802542103200028025821010c010b0b200d4290ce00510440200041246a220110890120002000280228106f3602382000410136023420002001360230200041cc006a2109200041c8006a210a03400240200041186a200041306a10412000280218450440200041406b220110890120002000280244106f36025820004101360254200020013602500340200041086a200041d0006a1041200028020804402000280248200028020c107b106b0c0105410021032000280244106f21024101210103402003200120024b720d04200028024020011042106b200120024f2103200120012002496a21010c000b000b000b000b2000200028021c220b36023c2000413c6a108b011074220610600d014100210120061025210720051008210c0340200c200141086a22024904402000413c6a108b012007106a0c030b2000420037035020052001200041d0006a410810631a2000280250210320062000280254220141187420014180fe03714108747220014108764180fe037120014118767272103f106521011026220420012008101e200221012004108501450d00200720041029200b102a21022000200436024c2000200236024820004200370340200041106a105b20002802142102200028021021042000200a3602582000200936025c20002000290340370350200041d0006a200341187420034180fe03714108747220034108764180fe0371200341187672722004200210580c000b000b0b200028024442001034200041e0006a24000f0b418281084116102b000b41be85084108418d8008410e103c000bc00d020c7f037e230041d0016b2200240010554102105441d68008410f105121074101100e220d4280808080105a044041c78008410f418d8008410e103c000b200da7210820004102360260200041e0006a22012802004180d6082802004e047e420105200141ba8008410d104d100e210e42000b210d2000200e3703082000200d3703002000290308210e2000290300210d200028026010520240024002400240104b108801106e10280440104b210b416b210602404184d6082d000022010440416b41ffffffff0720011b21060c010b4184d60841013a0000416b101f0b0240200610084170714110460440200610082105200041e8006a2104410121090340200241106a220120054b0d02200442003703002000420037036020062002200041e0006a411010631a200904402000290264220c423886200c4280fe038342288684200c428080fc0783421886200c42808080f80f834208868484200c42088842808080f80f83200c421888428080fc078384200c4228884280fe0383200c423888848484210c2000280260220241187420024180fe03714108747220024108764180fe037120024118767272210a200028026c220241187420024180fe03714108747220024108764180fe037120024118767272210341002109200121020c010b0b1067000b41f8820841221002000b2000200336021c2000200a3602182000200c3703100240103122012001107d220c4201580440200ca741016b0d040c010b200141c685084112105d000b200041e0006a108a0120002802682007107a0d02200041c8006a2201200041186a29030037030020002000290310370340200041d0006a2001103310730240024002400240200028025041016b0e020102000b419881084119102b000b200041f8006a2001290300370300200020002903403703702000200836028c012000200028025c3602880120002000290254370380012000200e3703682000200d370360200041206a200041e0006a10270c010b2000290258210c20002802542202102a2105200041f0006a2201200041406b10402000200836028c012000200c3702840120002005360280012000200e3703682000200d37036020022000280248102845044020004190016a20011040108c01106e21042000280278102c21032005102c2102200441feffffff07460d0341ac82084117104321012000104f3602a401200020013602a001200020043602a801200041206a2201200041a0016a20031059200041c4016a2001200210591020210c20002802c801210320002802c401210220002802cc012101417642001000200c42a08d067d200c200c42a08d06561b20014176200220031026220210211a1022200210082101200041003602a801200020023602a001200020014102763602a4010240200141044f0440200041a0016a41a08408410b10800141a08408410b1084014280808080105a0d08200041a0016a2201108d012001108d01200141a08408410b10800141a08408410b1084011a200141a08408410b10800110492102200041a0016a41a08408410b10800141a08408410b108401428002540d010c080b41d8850841181002000b2005102a210120002002102536027c2000200136027820004200370370200041a0016a200041e0006a102720002802bc01106045044020002802ac01200028029c0122031065220120012002101e2003200320011056200041286a200041a8016a2903003703002000200336023c20004200370330200020002903a00137032020002000280298013602380c020b200041386a200041b8016a290300370300200041306a200041b0016a290300370300200041286a200041a8016a290300370300200020002903a0013703200c010b200041206a200041e0006a10270b200041e0006a1089012000280228102a2104200028026822022004107b106f45044020002802642203106f21012000280260200141016a22011042200410181a20032001106c2003106f210120022004107b2001ad10340b200041286a108b012201107422022002200028022c100120012002106a200028023c10850104402007200041306a105a0b200041f8006a200041386a290300370300200041f0006a200041306a290300370300200041e8006a200041286a290300370300200020002903203703600c030b419b8008411f102b000b4191850841191002000b200b200041106a105a200a102a21021026220142001000200041f8006a200041186a2903003703002000200136026c2000200236026820004200370360200020002903103703700b200041e0006a10352201107f200041f0006a2001107f20011044200041d0016a24000f0b41a08408410b418d8008410e103c000b5401047f230041106b22002400101c41001053200041046a108a012000280208106f210220002802042103410121010340200120024b45044020032001106d10071a200141016a21010c010b0b200041106a24000b3f02017e017f101c104c410110534100100e22004280808080105a044041ef82084109418d8008410e103c000b2000a7210141fa8508410f10432001ad10340b870101037f230041206b22002400101c104c10554100105420004100360214200041146a41e882084107104e210120002802141052200110082102200041003602102000200241027636020c2000200136020803402000200041086a1081012000280200044020002802042101200041146a22021086012002200110790c010b0b200041206a24000b880101037f230041206b22002400101c104c10554100105420004100360214200041146a41e882084107104e210120002802141052200110082102200041003602102000200241027636020c2000200136020803402000200041086a1081012000280200044020002802042101200041146a22021086012002200110751a0c010b0b200041206a24000b0300010b0b0041d48708410e1002000b0bde070300418080080bcb04696e76616c69642076616c7565696e70757420746f6f206c6f6e674f6e6c7920455344542053616665206d61792063616c6c20746869732053436f70745f6761735f6c696d6974746f74616c5f7472616e73666572736f726967696e616c5f63616c6c6572616464726573735f70657263656e746167655f70616972737573657273496e76616c69642070657263656e746167652073756d546f6b656e206e6f7420616363657074656420617320666565496e76616c696420746f6b656e2070726f766964656420666f72206665655061796d656e7420646f6573206e6f7420636f7665722066656570726963655f61676772656761746f725f61646472657373666565657364745f736166655f61646472657373496e76616c69642045534454206964656e7469666965726c61746573745072696365466565644f7074696f6e616c496e76616c6964206665652074797065496e76616c6964206665656665655f7374727563747369676e6572736e65775f76616c7565696e636f7272656374206e756d626572206f662045534454207472616e7366657273617267756d656e74206465636f6465206572726f722028293a20746f6f2066657720617267756d656e7473746f6f206d616e7920617267756d656e747377726f6e67206e756d626572206f6620617267756d656e747363616e6e6f74207375627472616374206265636175736520726573756c7420776f756c64206265206e6567617469766573796e6320726573756c74696e70757420746f6f2073686f72746361737420746f20693634206572726f720041eb84080bf7022e6974656d2e696e64657873746f72616765206465636f6465206572726f7220286b65793a20726563697069656e742061646472657373206e6f74207365742e6c656e626164206172726179206c656e6774687661722061726773696e707574206f7574206f662072616e6765496e76616c69642061676772656761746f722076616c7565616c6c5369676e6572736d696e56616c69645369676e657273666565456e61626c6564466c6167746f6b656e4665654974656d206e6f7420666f756e6420696e206c697374496e76616c69642053432061646472657373496e76616c696420746f6b656e204944657364745361666541646472657373746f6b656e73466f7246656573757365727357686974656c69737461636346656573707269636541676772656761746f7241646472657373456e64706f696e742063616e206f6e6c792062652063616c6c6564206279206f776e6572696e646578206f7574206f662072616e676570616e6963206f636375727265640041e487080b0438ffffff", "report": { "imports": [ "bigIntAdd", @@ -338,8 +345,8 @@ "ok": true }, "codeReport": { - "path": "../output/fee-market.wasm", - "size": 11998, + "path": "../output/fee-marker-full.wasm", + "size": 12049, "hasAllocator": false, "hasPanic": "without message" } diff --git a/esdt-safe/interactor/contract-codes/header-verifier.mxsc.json b/esdt-safe/interactor/contract-codes/header-verifier.mxsc.json index d6e87f36..f2d17ad4 100644 --- a/esdt-safe/interactor/contract-codes/header-verifier.mxsc.json +++ b/esdt-safe/interactor/contract-codes/header-verifier.mxsc.json @@ -1,11 +1,11 @@ { "buildInfo": { "rustc": { - "version": "1.79.0", - "commitHash": "129f3b9964af4d4a709d1383930ade12dfe7c081", - "commitDate": "2024-06-10", + "version": "1.81.0", + "commitHash": "eeb90cda1969383f56a2637cbd3037bdf598841c", + "commitDate": "2024-09-04", "channel": "Stable", - "short": "rustc 1.79.0 (129f3b996 2024-06-10)" + "short": "rustc 1.81.0 (eeb90cda1 2024-09-04)" }, "contractCrate": { "name": "header-verifier", @@ -13,7 +13,7 @@ }, "framework": { "name": "multiversx-sc", - "version": "0.53.0" + "version": "0.53.2" } }, "abi": { @@ -123,7 +123,7 @@ "hasCallback": false, "types": {} }, - "code": "0061736d0100000001480d60027f7f0060027f7f017f60000060017f017f60017f006000017f60037f7f7f0060047f7f7f7f017f60037f7f7f017f60047f7f7f7f0060017f017e60027f7e0060027f7f017e029c031203656e760b7369676e616c4572726f72000003656e760a6d4275666665724e6577000503656e760d6d427566666572417070656e64000103656e76096d4275666665724571000103656e76106d4275666665724765744c656e677468000303656e760d6d616e6167656443616c6c6572000403656e76136d616e616765644f776e657241646472657373000403656e76126d427566666572417070656e644279746573000803656e76126d616e616765645369676e616c4572726f72000403656e761b736d616c6c496e74476574556e7369676e6564417267756d656e74000a03656e760f6765744e756d417267756d656e7473000503656e76136d42756666657247657442797465536c696365000703656e760f6d4275666665725365744279746573000803656e76126d42756666657253746f726167654c6f6164000103656e76136d42756666657253746f7261676553746f7265000103656e76126d427566666572476574417267756d656e74000103656e760e636865636b4e6f5061796d656e74000203656e760d6d616e6167656453686132353600010344430301000300050502090103050300040404020007000000040100000b030100090705000300010606010101010606030c0300000001000504040202020202020202020205030100030616037f01418080080b7f0041ecd2080b7f0041f0d2080b07b1010c066d656d6f7279020004696e6974004b0775706772616465004c1172656769737465724272696467654f7073004d12736574457364745361666541646472657373004e1272656d6f7665457865637574656448617368004f127365744d696e56616c69645369676e65727300500a6164645369676e65727300510d72656d6f76655369676e65727300520863616c6c4261636b00530a5f5f646174615f656e6403010b5f5f686561705f6261736503020a8e1f430f01017f10012201200010021a20010b0b0020002001100341004a0b3101017f20011015220210042101200041003a00102000200136020c2000200236020820002001360204200041003602000b0d00200010182200100d1a20000b0900200020011000000b0c01017f10182200100520000b1901017f41cc840841cc840828020041016b220036020020000b1d01017f10182200100620001017101304400f0b4187840841241000000b2e01017f419e80084117101b22042000200110071a200441b58008410310071a20042002200310071a20041008000b1101017f1018220220002001100c1a20020b3b01037f101d210220002802002101034041e8d20828020020014a04402000200141016a220336020020022001101e101f200321010c010b0b20020b1101017f1018220041014100100c1a20000b0d00200010182200100f1a20000b4601017f230041106b220224002002200141187420014180fe03714108747220014108764180fe03712001411876727236020c20002002410c6a410410071a200241106a24000b1900200041e8d2082802004e04400f0b41c9800841121000000b1400100a20004604400f0b41db800841191000000b1900200041e8d2082802004c04400f0b41b8800841111000000b0b0041e8d208100a3602000b0b0020002001410410071a0b0f002000200120032002100b4100470b09002000200110021a0b08002000200110280b090020002001100e1a0b1200416c41014100100c1a2000416c100e1a0b190020001012220041f48008410810071a20012000102b20000b4d01027f230041106b22022400200220001004220341187420034180fe03714108747220034108764180fe03712003411876727236020c20012002410c6a1024200120001026200241106a24000b090020002001ad102d0b890101047f230041106b22022400200220013c000f20022001421888a722033a000c20022001421088a722043a000d20022001420888a722053a000e200241003602082000200320047241ff017145220041044105200341ff01711b6a41002000200541ff01711b22006a200041002001501b6a2200200241086a6a410820006b103e200241106a24000b2401017e20002000104122014280808080105a0440200041808008410e103f000b2001a70b190020001012220041fc8008410510071a20012000103020000b4301017f230041106b220224002002200041187420004180fe03714108747220004108764180fe03712000411876727236020c20012002410c6a1024200241106a24000b2000200041868108410b200110322002103322001034200320001034200010280b17002000101222002001200210071a20032000103020000b080041014100101b0b4601017f230041106b220224002002200041187420004180fe03714108747220004108764180fe03712000411876727236020c20012002410c6a410410071a200241106a24000b130020001012220041818108410510071a20000b4001037f200028020822032001103745044020002802042202102e21042000280200200441016a2200102f2001102720022000102c200320012002102e10380b0b0b0020002001103c4100470b0d0020002001103b2002ad102d0b0d0020002001103a2002ad102d0b190020001012220041978108410610071a20002001102620000b190020001012220041978108410610071a20012000102b20000b0a0020002001103b102e0b0a0020002001103a102e0b0d00200020012002101b100e1a0b2c01017f419d8108411b101b2203200010021a200341b58008410310071a20032001200210071a20031008000b1f01017f20001015220110044120470440200041bc81084110103f000b20010ba30102017e027f230041106b22032400200342003703082000101522041004220041094f0440200141808008410e103f000b20044100200320006b41106a200010251a20032903082102200341106a2400200242388620024280fe0383422886842002428080fc0783421886200242808080f80f834208868484200242088842808080f80f832002421888428080fc07838420024228884280fe038320024238888484840b7d01037f230041106b22012400200028020821032001410036020c200028020020034102742001410c6a41041025450440200128020c21022000200341016a360208200241187420024180fe03714108747220024108764180fe0371200241187672721012200141106a24000f0b419e8308410841b880084111101a000b4701017f0240200128020820012802044f04400c010b41012102200110421012220110044120460d00419e8308410841bc81084110101a000b20002001360204200020023602000b2f01017f200128020820012802044f047f410005200110421012210141010b210220002001360204200020023602000b2e01027f20011012210220011012220341b88108410410071a2000200336020420002001360200200020023602080b8a0201047f230041106b220524002005410036020c20002802002103024002400240027f0240024020002d001045044020002802082202100422044190ce004b0d0141e4d2082d00000d0141e0d208200436020041e4d20841013a00002002410041d08408200410251a200041013a00100b200341046a220241e0d2082802004d0d010c050b200041003a0010200220032005410c6a2204410410250d04200341046a210220040c010b2003417b4b0d0120024190ce004b0d02200341d084086a0b200020023602002800002100200541106a2400200041187420004180fe03714108747220004108764180fe0371200041187672720f0b1054000b1054000b200141a68308410f103f000b1600200141bf8308410d101b2201102b2000200110450b0a0041cc8308410f101b0b0e00200041db83084113101b10450b3601037f41ee8308410a101b22011012210220011012220341b88108410410071a2000200336020420002001360200200020023602080ba304020a7f017e230041306b2200240010101023410010222000410036021c2000411c6a101c2101200028021c102020011004210520004100360218200020054102763602142000200136021002400240024003400240200041086a200041106a10442000280208450d00200028020c210741b58308410a101b2202101222092007102a220120011041220a4280808080105a0d02200a4200520d012002103522014167100d1a024041671004450440410121014101210341012105410021040c010b2000411c6a22052001101420052001104621082000411c6a2001104621052000411c6a2001104621042000411c6a200110462000280220200028021c470d0420002d002c044041e0d208410036020041e4d20841003a00000b4101210341016a2101200845044020012105410021040c010b2000411c6a2206200241868108410b200410322203101420062003104621062000411c6a200310461a2000280220200028021c470d0520002d002c044041e0d208410036020041e4d20841003a00000b20022004200620011031200841016a21030b200220012004410010312002419181084106200110322007102720021035210402402003044020031033220210342005200210342001200210342001200210342004200210280c010b200441014100103e0b20092007102a2001ad102d0c010b0b200041306a24000f0b200141808008410e103f000b200141808008410e103f000b200341808008410e103f000b08001010410010210b990301077f230041306b2200240010101023410210224100101e1004413047044041898308410941bc81084110101a000b4101101e210320004102360224200041246a2201101c21042000280224102020011049200028022c20031037450440101d21052004100421064100210103402006200141046a22024f04402000410036022420042001200041246a410410251a20052000280224220141187420014180fe03714108747220014108764180fe0371200141187672721012101f200221010c010b0b101d21012005100421022000410036022c200020024102763602282000200536022403400240200041106a200041246a1044200028021004402001200028021410021a0c020520011018220110111a200320011013450d01200410042101200041003602202000200141027636021c200020043602180340200041086a200041186a104420002802080440200028020c2101200041246a2202200310472002200110360c010b0b200041246a22011049200120031036200041306a24000f0b000b0b41a98208413e1016000b41fa8108412f1016000b2f01017f10101019410110214100101e22001004412047044041e78208411141bc81084110101a000b1048200010270bdf0101087f230041106b220124001010410210214100101e21004101101e210402400240024010171048104010130440200141046a20001047200128020c22052004103c2202450d0220012802082203102e22002002490d0320002002460d012003102e2000490d03200128020422072000102f101521062003102e2002490d0320072002102f200610270c010b41cc8108412e1016000b2003102e2000490d0120012802042000102f10292003200041016b102c2000200247044020052006200210380b20052004103b10290b200141106a24000f0b41ab840841121000000b3f02017e017f10101019410110214100100922004280808080105a044041958008410941808008410e101a000b2000a7210141f88308410f101b2001ad102d0bb40101057f230041206b220024001010101910234100102220004100360214200041146a101c210120002802141020200110042102200041003602102000200241027636020c20002001360208034002402000200041086a10432000280200450d0020002802042101200041146a104a200028021c22042001103d0d0120002802182202102e21032000280214200341016a2203102f2001102720022003102c200420012002102e10390c010b0b200041206a24000b930201087f230041206b220024001010101910234100102220004100360214200041146a101c210120002802141020200110042102200041003602102000200241027636020c20002001360208034002402000200041086a104302402000280200044020002802042104200041146a104a200028021c22052004103d2202450d0320002802182203102e22012002490d0220012002460d012003102e2001490d02200028021422072001102f104021062003102e2002490d0220072002102f200610270c010b200041206a24000f0b2003102e20014904400c010b20002802142001102f10292003200141016b102c2001200247044020052006200210390b20052004103a10290c010b0b41ab840841121000000b02000b0b0041bd8408410e1000000b0bdf040200418080080bcb04696e70757420746f6f206c6f6e677369676e6572736e65775f76616c7565617267756d656e74206465636f6465206572726f722028293a20746f6f2066657720617267756d656e7473746f6f206d616e7920617267756d656e747377726f6e67206e756d626572206f6620617267756d656e74732e6e6f64655f69642e6974656d2e696e666f2e6e6f64655f6c696e6b732e76616c75652e696e64657873746f72616765206465636f6465206572726f7220286b65793a202e6c656e626164206172726179206c656e6774684f6e6c792045534454205361666520636f6e74726163742063616e2063616c6c207468697320656e64706f696e74546865204f7574476f696e67547873486173682068617320616c7265616479206265656e207265676973746572656448617368206f6620616c6c206f7065726174696f6e7320646f65736e2774206d61746368207468652068617368206f66207472616e736665722064617461657364745f736166655f616464726573736f7065726174696f6e735f6861736865737369676e6174757265626c735f7075625f6b6579737661722061726773696e70757420746f6f2073686f7274626c735075624b65797370656e64696e67486173686573657364745361666541646472657373686173684f66486173686573486973746f7279616c6c5369676e6572736d696e56616c69645369676e657273456e64706f696e742063616e206f6e6c792062652063616c6c6564206279206f776e6572696e646578206f7574206f662072616e676570616e6963206f636375727265640041cc84080b0438ffffff", + "code": "0061736d0100000001480d60027f7f0060027f7f017f60000060017f017f60017f006000017f60037f7f7f0060047f7f7f7f017f60037f7f7f017f60047f7f7f7f0060017f017e60027f7e0060027f7f017e029c031203656e760b7369676e616c4572726f72000003656e760a6d4275666665724e6577000503656e760d6d427566666572417070656e64000103656e76096d4275666665724571000103656e76106d4275666665724765744c656e677468000303656e760d6d616e6167656443616c6c6572000403656e76136d616e616765644f776e657241646472657373000403656e76126d427566666572417070656e644279746573000803656e76126d616e616765645369676e616c4572726f72000403656e761b736d616c6c496e74476574556e7369676e6564417267756d656e74000a03656e760f6765744e756d417267756d656e7473000503656e76136d42756666657247657442797465536c696365000703656e760f6d4275666665725365744279746573000803656e76126d42756666657253746f726167654c6f6164000103656e76136d42756666657253746f7261676553746f7265000103656e76126d427566666572476574417267756d656e74000103656e760e636865636b4e6f5061796d656e74000203656e760d6d616e616765645368613235360001034544030100030005050209010305030004040402000700030000040100000b0301000907050003000106010601010106060c030300000001000504040202020202020202020205030100030616037f01418080080b7f004190d3080b7f004190d3080b07b1010c066d656d6f7279020004696e6974004c0775706772616465004d1172656769737465724272696467654f7073004e12736574457364745361666541646472657373004f1272656d6f76654578656375746564486173680050127365744d696e56616c69645369676e65727300510a6164645369676e65727300520d72656d6f76655369676e65727300530863616c6c4261636b00540a5f5f646174615f656e6403010b5f5f686561705f6261736503020aaa1f440f01017f10012201200010021a20010b0b0020002001100341004a0b3101017f20011015220210042101200041003a00102000200136020c2000200236020820002001360204200041003602000b0d00200010182200100d1a20000b0900200020011000000b0c01017f10182200100520000b1901017f41f0840841f0840828020041016b220036020020000b1d01017f10182200100620001017101304400f0b41aa840841241000000b2e01017f419e80084117101b22042000200110071a200441b58008410310071a20042002200310071a20041008000b1101017f1018220220002001100c1a20020b3b01037f101d2102200028020021010340418cd30828020020014a04402000200141016a220336020020022001101e101f200321010c010b0b20020b1101017f1018220041014100100c1a20000b0d00200010182200100f1a20000b4601017f230041106b220224002002200141187420014180fe03714108747220014108764180fe03712001411876727236020c20002002410c6a410410071a200241106a24000b19002000418cd3082802004e04400f0b41c9800841121000000b1400100a20004604400f0b41db800841191000000b19002000418cd3082802004c04400f0b41b8800841111000000b0b00418cd308100a3602000b0b0020002001410410071a0b0f002000200120032002100b4100470b09002000200110021a0b0d0020004167100d1a416710040b08002000200110290b090020002001100e1a0b1200416c41014100100c1a2000416c100e1a0b190020001012220041f48008410810071a20012000102c20000b4d01027f230041106b22022400200220001004220341187420034180fe03714108747220034108764180fe03712003411876727236020c20012002410c6a1024200120001026200241106a24000b090020002001ad102e0b890101047f230041106b22022400200220013c000f20022001421888a722033a000c20022001421088a722043a000d20022001420888a722053a000e200241003602082000200320047241ff017145220041044105200341ff01711b6a41002000200541ff01711b22006a200041002001501b6a2200200241086a6a410820006b103f200241106a24000b2401017e20002000104122014280808080105a0440200041808008410e1040000b2001a70b190020001012220041fc8008410510071a20012000103120000b4301017f230041106b220224002002200041187420004180fe03714108747220004108764180fe03712000411876727236020c20012002410c6a1024200241106a24000b2000200041868108410b200110332002103422001035200320001035200010290b17002000101222002001200210071a20032000103120000b080041014100101b0b4601017f230041106b220224002002200041187420004180fe03714108747220004108764180fe03712000411876727236020c20012002410c6a410410071a200241106a24000b130020001012220041818108410510071a20000b4001037f200028020822032001103845044020002802042202102f21042000280200200441016a220010302001102820022000102d200320012002102f10390b0b0b0020002001103d4100470b0d0020002001103a2002ad102e0b190020001012220041978108410610071a20012000102c20000b0d0020002001103c2002ad102e0b190020001012220041978108410610071a20002001102620000b0a0020002001103a102f0b0a0020002001103c102f0b0d00200020012002101b100e1a0b2c01017f419d8108411b101b2203200010021a200341b58008410310071a20032001200210071a20031008000ba30102017e027f230041106b22032400200342003703082000101522041004220041094f0440200141808008410e1040000b20044100200320006b41106a200010251a20032903082102200341106a2400200242388620024280fe0383422886842002428080fc0783421886200242808080f80f834208868484200242088842808080f80f832002421888428080fc07838420024228884280fe038320024238888484840b1f01017f20001015220110044120470440200041bc810841101040000b20010b7d01037f230041106b22012400200028020821032001410036020c200028020020034102742001410c6a41041025450440200128020c21022000200341016a360208200241187420024180fe03714108747220024108764180fe0371200241187672721012200141106a24000f0b41c18308410841b880084111101a000b4701017f0240200128020820012802044f04400c010b41012102200110431012220110044120460d0041c18308410841bc81084110101a000b20002001360204200020023602000b2f01017f200128020820012802044f047f410005200110431012210141010b210220002001360204200020023602000b2e01027f20011012210220011012220341b88108410410071a2000200336020420002001360200200020023602080b8b0201047f230041106b220424002004410036020c20002802002103024002400240027f0240024020002d001045044020002802082202100422054190ce004b0d014188d3082d00000d014184d30820053602004188d30841013a00002002410041f48408200510251a200041013a00100b200341046a22024184d3082802004d0d010c050b200041003a0010200220032004410c6a410410250d04200341046a21022004410c6a0c010b2003417b4b0d0120024190ce004b0d02200341f484086a0b200020023602002800002100200441106a2400200041187420004180fe03714108747220004108764180fe0371200041187672720f0b1055000b1055000b200141c98308410f1040000b1600200141e28308410d101b2201102c2000200110460b0a0041ef8308410f101b0b0e00200041fe83084113101b10460b3601037f41918408410a101b22011012210220011012220341b88108410410071a2000200336020420002001360200200020023602080b9c04020a7f017e230041306b2200240010101023410010222000410036021c2000411c6a101c2101200028021c102020011004210520004100360218200020054102763602142000200136021002400240024003400240200041086a200041106a10452000280208450d00200028020c210741d88308410a101b2202101222092007102b220120011041220a4280808080105a0d02200a4200520d0102402002103622011027450440410121014101210341012105410021040c010b2000411c6a22052001101420052001104721082000411c6a2001104721052000411c6a2001104721042000411c6a200110472000280220200028021c470d0420002d002c04404184d30841003602004188d30841003a00000b4101210341016a2101200845044020012105410021040c010b2000411c6a2206200241868108410b200410332203101420062003104721062000411c6a200310471a2000280220200028021c470d0520002d002c04404184d30841003602004188d30841003a00000b20022004200620011032200841016a21030b200220012004410010322002419181084106200110332007102820021036210402402003044020031034220210352005200210352001200210352001200210352004200210290c010b200441014100103f0b20092007102b2001ad102e0c010b0b200041306a24000f0b200141808008410e1040000b200141808008410e1040000b200341808008410e1040000b08001010410010210b990301077f230041306b2200240010101023410210224100101e1004413047044041ac8308410941bc81084110101a000b4101101e210320004102360224200041246a2201101c2104200028022410202001104a200028022c20031038450440101d21052004100421064100210103402006200141046a22024f04402000410036022420042001200041246a410410251a20052000280224220141187420014180fe03714108747220014108764180fe0371200141187672721012101f200221010c010b0b101d21012005100421022000410036022c200020024102763602282000200536022403400240200041106a200041246a1045200028021004402001200028021410021a0c020520011018220110111a200320011013450d01200410042101200041003602202000200141027636021c200020043602180340200041086a200041186a104520002802080440200028020c2101200041246a2202200310482002200110370c010b0b200041246a2201104a200120031037200041306a24000f0b000b0b41cc8208413e1016000b419d8208412f1016000b2f01017f10101019410110214100101e220010044120470440418a8308411141bc81084110101a000b1049200010280bf20101087f230041106b220124001010410210214100101e21004101101e210402400240024002401049102704401017104910421013450d01200141046a20001048200128020c22052004103d2202450d0320012802082203102f22002002490d0420002002460d022003102f2000490d042001280204220720001030101521062003102f2002490d04200720021030200610280c020b41fa810841231016000b41cc8108412e1016000b2003102f2000490d01200128020420001030102a2003200041016b102d2000200247044020052006200210390b20052004103a102a0b200141106a24000f0b41ce840841121000000b3f02017e017f10101019410110214100100922004280808080105a044041958008410941808008410e101a000b2000a72101419b8408410f101b2001ad102e0bb40101057f230041206b220024001010101910234100102220004100360214200041146a101c210120002802141020200110042102200041003602102000200241027636020c20002001360208034002402000200041086a10442000280200450d0020002802042101200041146a104b200028021c22042001103e0d0120002802182202102f21032000280214200341016a220310302001102820022003102d200420012002102f103b0c010b0b200041206a24000b930201087f230041206b220024001010101910234100102220004100360214200041146a101c210120002802141020200110042102200041003602102000200241027636020c20002001360208034002402000200041086a104402402000280200044020002802042104200041146a104b200028021c22052004103e2202450d0320002802182203102f22012002490d0220012002460d012003102f2001490d022000280214220720011030104221062003102f2002490d02200720021030200610280c010b200041206a24000f0b2003102f20014904400c010b200028021420011030102a2003200141016b102d20012002470440200520062002103b0b20052004103c102a0c010b0b41ce840841121000000b0300010b0b0041e08408410e1000000b0b82050200418080080bee04696e70757420746f6f206c6f6e677369676e6572736e65775f76616c7565617267756d656e74206465636f6465206572726f722028293a20746f6f2066657720617267756d656e7473746f6f206d616e7920617267756d656e747377726f6e67206e756d626572206f6620617267756d656e74732e6e6f64655f69642e6974656d2e696e666f2e6e6f64655f6c696e6b732e76616c75652e696e64657873746f72616765206465636f6465206572726f7220286b65793a202e6c656e626164206172726179206c656e6774684f6e6c792045534454205361666520636f6e74726163742063616e2063616c6c207468697320656e64706f696e745468657265206973206e6f207265676973746572656420455344542061646472657373546865204f7574476f696e67547873486173682068617320616c7265616479206265656e207265676973746572656448617368206f6620616c6c206f7065726174696f6e7320646f65736e2774206d61746368207468652068617368206f66207472616e736665722064617461657364745f736166655f616464726573736f7065726174696f6e735f6861736865737369676e6174757265626c735f7075625f6b6579737661722061726773696e70757420746f6f2073686f7274626c735075624b65797370656e64696e67486173686573657364745361666541646472657373686173684f66486173686573486973746f7279616c6c5369676e6572736d696e56616c69645369676e657273456e64706f696e742063616e206f6e6c792062652063616c6c6564206279206f776e6572696e646578206f7574206f662072616e676570616e6963206f636375727265640041f084080b0438ffffff", "report": { "imports": [ "checkNoPayment", @@ -152,7 +152,7 @@ }, "codeReport": { "path": "../output/header-verifier.wasm", - "size": 5371, + "size": 5435, "hasAllocator": false, "hasPanic": "without message" } From 79d615cb53afae1cff9ddec50b4402278cf77cc4 Mon Sep 17 00:00:00 2001 From: Andrei Baltariu Date: Fri, 18 Oct 2024 10:17:44 +0300 Subject: [PATCH 452/523] Added arguments for `register_operation` and `execute_operation` Signed-off-by: Andrei Baltariu --- esdt-safe/interactor/src/interactor_main.rs | 104 ++++++++++---------- esdt-safe/interactor/state.toml | 6 +- 2 files changed, 56 insertions(+), 54 deletions(-) diff --git a/esdt-safe/interactor/src/interactor_main.rs b/esdt-safe/interactor/src/interactor_main.rs index b174087b..f6e16aac 100644 --- a/esdt-safe/interactor/src/interactor_main.rs +++ b/esdt-safe/interactor/src/interactor_main.rs @@ -43,7 +43,7 @@ async fn main() { "addSigners" => interact.add_signers().await, "removeSigners" => interact.remove_signers().await, "registerToken" => interact.register_token().await, - "executeBridgeOps" => interact.execute_operations().await, + // "executeBridgeOps" => interact.execute_operations().await, "setMaxTxBatchSize" => interact.set_max_tx_batch_size().await, "setMaxTxBatchBlockDuration" => interact.set_max_tx_batch_block_duration().await, "getCurrentTxBatch" => interact.get_current_tx_batch().await, @@ -140,8 +140,8 @@ struct ContractInteract { impl ContractInteract { async fn new() -> Self { let mut interactor = Interactor::new(GATEWAY).await; - let wallet_address = interactor.register_wallet(test_wallets::frank()); - let bob_address = interactor.register_wallet(test_wallets::bob()); + let wallet_address = interactor.register_wallet(test_wallets::bob()); + let bob_address = interactor.register_wallet(test_wallets::frank()); let alice_address = interactor.register_wallet(test_wallets::alice()); let mike_address = interactor.register_wallet(test_wallets::mike()); let judy_address = interactor.register_wallet(test_wallets::judy()); @@ -152,7 +152,7 @@ impl ContractInteract { ); let fee_market_code = BytesValue::interpret_from( - "mxsc:../../fee-market/output/fee-market.mxsc.json", + "mxsc:contract-codes/fee-market.mxsc.json", &InterpreterContext::default(), ); @@ -162,7 +162,7 @@ impl ContractInteract { ); let header_verifier_code = BytesValue::interpret_from( - "mxsc:../../header-verifier/output/header-verifier.mxsc.json", + "mxsc:contract-codes/header-verifier.mxsc.json", &InterpreterContext::default(), ); @@ -232,43 +232,43 @@ impl ContractInteract { println!("new fee_market_address: {new_address_bech32}"); } - async fn deploy_price_aggregator(&mut self) { - let mut oracles = MultiValueEncoded::new(); - let first_oracle_adress = managed_address!(&self.bob_address.clone()); - let second_oracle_adress = managed_address!(&self.alice_address.clone()); - let third_oracle_adress = managed_address!(&self.mike_address.clone()); - let forth_oracle_address = managed_address!(&self.judy_address.clone()); - oracles.push(first_oracle_adress); - oracles.push(second_oracle_adress); - oracles.push(third_oracle_adress); - oracles.push(forth_oracle_address); - - let new_address = self - .interactor - .tx() - .from(&self.wallet_address) - .gas(100_000_000u64) - .typed(price_aggregator_proxy::PriceAggregatorProxy) - .init( - TokenIdentifier::from_esdt_bytes(TOKEN_ID), - BigUint::from(1u64), - BigUint::from(1u64), - 3u8, - 3u8, - oracles, - ) - .code(&self.price_aggregator_code) - .returns(ReturnsNewAddress) - .prepare_async() - .run() - .await; - let new_address_bech32 = bech32::encode(&new_address); - self.state - .set_price_aggregator_address(Bech32Address::from_bech32_string( - new_address_bech32.clone(), - )); - println!("new token_handler_address: {new_address_bech32}"); - } + // async fn deploy_price_aggregator(&mut self) { + // let mut oracles = MultiValueEncoded::new(); + // let first_oracle_adress = managed_address!(&self.bob_address.clone()); + // let second_oracle_adress = managed_address!(&self.alice_address.clone()); + // let third_oracle_adress = managed_address!(&self.mike_address.clone()); + // let forth_oracle_address = managed_address!(&self.judy_address.clone()); + // oracles.push(first_oracle_adress); + // oracles.push(second_oracle_adress); + // oracles.push(third_oracle_adress); + // oracles.push(forth_oracle_address); + // + // let new_address = self + // .interactor + // .tx() + // .from(&self.wallet_address) + // .gas(100_000_000u64) + // .typed(price_aggregator_proxy::PriceAggregatorProxy) + // .init( + // TokenIdentifier::from_esdt_bytes(TOKEN_ID), + // BigUint::from(1u64), + // BigUint::from(1u64), + // 3u8, + // 3u8, + // oracles, + // ) + // .code(&self.price_aggregator_code) + // .returns(ReturnsNewAddress) + // .prepare_async() + // .run() + // .await; + // let new_address_bech32 = bech32::encode(&new_address); + // self.state + // .set_price_aggregator_address(Bech32Address::from_bech32_string( + // new_address_bech32.clone(), + // )); + // println!("new token_handler_address: {new_address_bech32}"); + // } async fn deploy_header_verifier_contract(&mut self) { let new_address = self @@ -486,9 +486,8 @@ impl ContractInteract { println!("Result: {response:?}"); } - async fn execute_operations(&mut self) { - let operation = self.setup_operation().await; - let operation_hash = self.get_operation_hash(&operation); + async fn execute_operations(&mut self, operation: &Operation) { + let operation_hash = self.get_operation_hash(operation); let response = self .interactor @@ -890,10 +889,9 @@ impl ContractInteract { Operation::new(to, tokens, data) } - async fn register_operations(&mut self) { - let operation = self.setup_operation().await; + async fn register_operations(&mut self, operation: &Operation) { let bls_signature = ManagedByteArray::default(); - let operation_hash = self.get_operation_hash(&operation); + let operation_hash = self.get_operation_hash(operation); let hash_of_hashes = sha256(&operation_hash); let mut managed_operation_hashes = @@ -905,7 +903,8 @@ impl ContractInteract { managed_operation_hashes.push(managed_operation_hash); if let Some(header_verifier_address) = self.state.header_verifier_address.clone() { - self.interactor + let response = self + .interactor .tx() .from(&self.wallet_address) .to(header_verifier_address) @@ -919,6 +918,8 @@ impl ContractInteract { .prepare_async() .run() .await; + + println!("Result: {response:?}"); } } @@ -983,6 +984,7 @@ async fn test_deploy_sov() { interact.set_header_verifier_address().await; interact.unpause_endpoint().await; - interact.register_operations().await; - interact.execute_operations().await; + let operation = interact.setup_operation().await; + interact.register_operations(&operation).await; + interact.execute_operations(&operation).await; } diff --git a/esdt-safe/interactor/state.toml b/esdt-safe/interactor/state.toml index bd765ca2..8e70f901 100644 --- a/esdt-safe/interactor/state.toml +++ b/esdt-safe/interactor/state.toml @@ -1,4 +1,4 @@ -contract_address = "erd1qqqqqqqqqqqqqpgqcnv2tuqkmllgltxmuv52mdvcuws83wsut7asdpagcv" -fee_market_address = "erd1qqqqqqqqqqqqqpgqcfne2fs7xs9lf2wshyr3cc78mv6wrpwgt7asw3gaew" +contract_address = "erd1qqqqqqqqqqqqqpgq5njhhvv5ld6f6kj0wumlwzyghv8kz7g0rruqk2ssq0" +fee_market_address = "erd1qqqqqqqqqqqqqpgq7qzqdk2302jesxhl87hcmu2ewx87hke0rruqgg4srf" price_aggregator_address = "erd1qqqqqqqqqqqqqpgq4sshr5wx4ch5gd8847dsavahytt732kut7as6z3mv6" -header_verifier_address = "erd1qqqqqqqqqqqqqpgqg4wen7hg6yypu77ach6dm0g2hvs3pey8t7asc0a02t" +header_verifier_address = "erd1qqqqqqqqqqqqqpgqgf5x6ysk68wg3p78qrvw8c48rjct9x6lrruql8hfm3" From 4321235a56cbf79ea45a5fdd71945f9b7b68d399 Mon Sep 17 00:00:00 2001 From: Andrei Baltariu Date: Fri, 18 Oct 2024 16:24:55 +0300 Subject: [PATCH 453/523] Modified paths setup to pick corect output files Signed-off-by: Andrei Baltariu --- esdt-safe/interactor/src/interactor_main.rs | 78 +++++++++++++-------- esdt-safe/interactor/state.toml | 6 +- 2 files changed, 53 insertions(+), 31 deletions(-) diff --git a/esdt-safe/interactor/src/interactor_main.rs b/esdt-safe/interactor/src/interactor_main.rs index f6e16aac..1e339ae4 100644 --- a/esdt-safe/interactor/src/interactor_main.rs +++ b/esdt-safe/interactor/src/interactor_main.rs @@ -11,6 +11,7 @@ use multiversx_sc_snippets::imports::*; use multiversx_sc_snippets::sdk::{self}; use proxies::*; use serde::{Deserialize, Serialize}; +use std::env::{self}; use std::{ io::{Read, Write}, path::Path, @@ -130,10 +131,10 @@ struct ContractInteract { alice_address: Address, mike_address: Address, judy_address: Address, - contract_code: BytesValue, - fee_market_code: BytesValue, - price_aggregator_code: BytesValue, - header_verifier_code: BytesValue, + esdt_safe_code: String, + fee_market_code: String, + price_aggregator_code: String, + header_verifier_code: String, state: State, } @@ -146,25 +147,39 @@ impl ContractInteract { let mike_address = interactor.register_wallet(test_wallets::mike()); let judy_address = interactor.register_wallet(test_wallets::judy()); - let contract_code = BytesValue::interpret_from( - "mxsc:../output/esdt-safe.mxsc.json", - &InterpreterContext::default(), - ); - - let fee_market_code = BytesValue::interpret_from( - "mxsc:contract-codes/fee-market.mxsc.json", - &InterpreterContext::default(), - ); - - let price_aggregator_code = BytesValue::interpret_from( - "mxsc:contract-codes/multiversx-price-aggregator-sc.mxsc.json", - &InterpreterContext::default(), - ); - - let header_verifier_code = BytesValue::interpret_from( - "mxsc:contract-codes/header-verifier.mxsc.json", - &InterpreterContext::default(), - ); + let current_dir = env::current_dir().expect("Failed to get current directory"); + println!("Current directory is: {}", current_dir.display()); + + let repo_dir = current_dir + .parent() + .and_then(|p| p.parent()) + .expect("Failed to go up 2 levels"); + println!("Repo directory is: {}", repo_dir.display()); + + let fee_market_output_path = "fee-market/output/fee-market.mxsc.json"; + let fee_market_code = repo_dir + .join(fee_market_output_path) + .to_string_lossy() + .to_string(); + + let header_verifier_output_path = "header-verifier/output/header-verifier.mxsc.json"; + let header_verifier_code = repo_dir + .join(header_verifier_output_path) + .to_string_lossy() + .to_string(); + + let esdt_safe_output_path = "../output/esdt-safe.mxsc.json"; + let esdt_safe_code = repo_dir + .join(esdt_safe_output_path) + .to_string_lossy() + .to_string(); + + let price_aggregator_output_path = + "../contract-codes/multiversx-price-aggregator-sc.mxsc.json".to_string(); + let price_aggregator_code = repo_dir + .join(price_aggregator_output_path) + .to_string_lossy() + .to_string(); ContractInteract { interactor, @@ -173,7 +188,7 @@ impl ContractInteract { alice_address, mike_address, judy_address, - contract_code, + esdt_safe_code, fee_market_code, price_aggregator_code, header_verifier_code, @@ -182,6 +197,8 @@ impl ContractInteract { } async fn deploy(&mut self, is_sov_chain: bool) { + let code_path = MxscPath::new(&self.esdt_safe_code); + let new_address = self .interactor .tx() @@ -189,7 +206,7 @@ impl ContractInteract { .gas(110_000_000u64) .typed(proxy::EsdtSafeProxy) .init(is_sov_chain) - .code(&self.contract_code) + .code(code_path) .returns(ReturnsNewAddress) .prepare_async() .run() @@ -212,6 +229,7 @@ impl ContractInteract { }, }; + let fee_market_code_path = MxscPath::new(&self.fee_market_code); let new_address = self .interactor .tx() @@ -219,7 +237,7 @@ impl ContractInteract { .gas(100_000_000u64) .typed(fee_market_proxy::FeeMarketProxy) .init(self.state.current_address(), Option::Some(fee)) - .code(&self.fee_market_code) + .code(fee_market_code_path) .returns(ReturnsNewAddress) .prepare_async() .run() @@ -271,6 +289,8 @@ impl ContractInteract { // } async fn deploy_header_verifier_contract(&mut self) { + let header_verifier_code_path = MxscPath::new(&self.header_verifier_code); + let new_address = self .interactor .tx() @@ -278,7 +298,7 @@ impl ContractInteract { .gas(100_000_000u64) .typed(header_verifier_proxy::HeaderverifierProxy) .init(MultiValueEncoded::new()) - .code(&self.header_verifier_code) + .code(header_verifier_code_path) .returns(ReturnsNewAddress) .prepare_async() .run() @@ -293,6 +313,8 @@ impl ContractInteract { } async fn upgrade(&mut self) { + let code_path = MxscPath::new(&self.esdt_safe_code); + let response = self .interactor .tx() @@ -301,7 +323,7 @@ impl ContractInteract { .gas(30_000_000u64) .typed(proxy::EsdtSafeProxy) .upgrade() - .code(&self.contract_code) + .code(code_path) .code_metadata(CodeMetadata::UPGRADEABLE) .returns(ReturnsNewAddress) .prepare_async() diff --git a/esdt-safe/interactor/state.toml b/esdt-safe/interactor/state.toml index 8e70f901..7d1de38f 100644 --- a/esdt-safe/interactor/state.toml +++ b/esdt-safe/interactor/state.toml @@ -1,4 +1,4 @@ -contract_address = "erd1qqqqqqqqqqqqqpgq5njhhvv5ld6f6kj0wumlwzyghv8kz7g0rruqk2ssq0" -fee_market_address = "erd1qqqqqqqqqqqqqpgq7qzqdk2302jesxhl87hcmu2ewx87hke0rruqgg4srf" +contract_address = "erd1qqqqqqqqqqqqqpgq5kw0e78d70sw3xqr3a3fuy563g57c8plrruq2ur0ph" +fee_market_address = "erd1qqqqqqqqqqqqqpgq3h3dfcgezfwu7057y7vqmt2c03q45de3rruqzlq8ez" price_aggregator_address = "erd1qqqqqqqqqqqqqpgq4sshr5wx4ch5gd8847dsavahytt732kut7as6z3mv6" -header_verifier_address = "erd1qqqqqqqqqqqqqpgqgf5x6ysk68wg3p78qrvw8c48rjct9x6lrruql8hfm3" +header_verifier_address = "erd1qqqqqqqqqqqqqpgqwwfa27qh4ywfpfl6x4hksd5j00m7tpq2rruq99gmej" From e6e7ed337e954a384518f26c2a70440d82a2c908 Mon Sep 17 00:00:00 2001 From: Andrei Baltariu Date: Fri, 18 Oct 2024 16:31:29 +0300 Subject: [PATCH 454/523] Esdt-Safe output file fix Signed-off-by: Andrei Baltariu --- esdt-safe/interactor/src/interactor_main.rs | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/esdt-safe/interactor/src/interactor_main.rs b/esdt-safe/interactor/src/interactor_main.rs index 1e339ae4..9d73246d 100644 --- a/esdt-safe/interactor/src/interactor_main.rs +++ b/esdt-safe/interactor/src/interactor_main.rs @@ -168,7 +168,7 @@ impl ContractInteract { .to_string_lossy() .to_string(); - let esdt_safe_output_path = "../output/esdt-safe.mxsc.json"; + let esdt_safe_output_path = "esdt-safe/output/esdt-safe.mxsc.json"; let esdt_safe_code = repo_dir .join(esdt_safe_output_path) .to_string_lossy() @@ -899,12 +899,7 @@ impl ContractInteract { } async fn setup_operation(&mut self) -> Operation { - let to = managed_address!(&self - .state - .price_aggregator_address - .clone() - .unwrap() - .to_address()); + let to = managed_address!(&self.state.fee_market_address.clone().unwrap().to_address()); let payments_tuple = self.setup_payments().await; let (tokens, data) = payments_tuple; From f414ff82e6edbfaf381105ded166c87524a61db7 Mon Sep 17 00:00:00 2001 From: Andrei Baltariu Date: Fri, 18 Oct 2024 17:02:29 +0300 Subject: [PATCH 455/523] Fixed operation not registered error Signed-off-by: Andrei Baltariu --- esdt-safe/interactor/src/interactor_main.rs | 6 +++--- esdt-safe/interactor/state.toml | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/esdt-safe/interactor/src/interactor_main.rs b/esdt-safe/interactor/src/interactor_main.rs index 9d73246d..d93ef8f5 100644 --- a/esdt-safe/interactor/src/interactor_main.rs +++ b/esdt-safe/interactor/src/interactor_main.rs @@ -509,16 +509,16 @@ impl ContractInteract { } async fn execute_operations(&mut self, operation: &Operation) { - let operation_hash = self.get_operation_hash(operation); + let hash_of_hashes = sha256(&self.get_operation_hash(operation)); let response = self .interactor .tx() .from(&self.wallet_address) .to(self.state.current_address()) - .gas(30_000_000u64) + .gas(50_000_000u64) .typed(proxy::EsdtSafeProxy) - .execute_operations(&operation_hash, operation) + .execute_operations(&hash_of_hashes, operation) .returns(ReturnsResultUnmanaged) .prepare_async() .run() diff --git a/esdt-safe/interactor/state.toml b/esdt-safe/interactor/state.toml index 7d1de38f..ac501012 100644 --- a/esdt-safe/interactor/state.toml +++ b/esdt-safe/interactor/state.toml @@ -1,4 +1,4 @@ -contract_address = "erd1qqqqqqqqqqqqqpgq5kw0e78d70sw3xqr3a3fuy563g57c8plrruq2ur0ph" -fee_market_address = "erd1qqqqqqqqqqqqqpgq3h3dfcgezfwu7057y7vqmt2c03q45de3rruqzlq8ez" +contract_address = "erd1qqqqqqqqqqqqqpgqkm0kcwasdlv03fc3r2t4n5mln8dpsf8nrruqy2k3ya" +fee_market_address = "erd1qqqqqqqqqqqqqpgq4rsu38s3jcmq4l53f0x552mjpdxh2jharruq4rxkqy" price_aggregator_address = "erd1qqqqqqqqqqqqqpgq4sshr5wx4ch5gd8847dsavahytt732kut7as6z3mv6" -header_verifier_address = "erd1qqqqqqqqqqqqqpgqwwfa27qh4ywfpfl6x4hksd5j00m7tpq2rruq99gmej" +header_verifier_address = "erd1qqqqqqqqqqqqqpgqdf6w0tfcaly25ealg6cnljh5xhkvkyemrruqr7lg5n" From 22b4c914003a13770a3bdb481c6ed7a99d7d4634 Mon Sep 17 00:00:00 2001 From: Andrei Baltariu Date: Fri, 18 Oct 2024 17:13:54 +0300 Subject: [PATCH 456/523] Added function to register esdt_safe address in header_verifier Signed-off-by: Andrei Baltariu --- esdt-safe/interactor/src/interactor_main.rs | 23 +++++++++++++++++++++ esdt-safe/interactor/state.toml | 6 +++--- 2 files changed, 26 insertions(+), 3 deletions(-) diff --git a/esdt-safe/interactor/src/interactor_main.rs b/esdt-safe/interactor/src/interactor_main.rs index d93ef8f5..964994ca 100644 --- a/esdt-safe/interactor/src/interactor_main.rs +++ b/esdt-safe/interactor/src/interactor_main.rs @@ -6,6 +6,7 @@ mod proxies; use fee_market::fee_market_proxy::FeeMarketProxy; use fee_market::fee_market_proxy::{self, FeeStruct, FeeType}; +use header_verifier_proxy::HeaderverifierProxy; use multiversx_sc_scenario::multiversx_chain_vm::crypto_functions::{sha256, SHA256_RESULT_LEN}; use multiversx_sc_snippets::imports::*; use multiversx_sc_snippets::sdk::{self}; @@ -898,6 +899,27 @@ impl ContractInteract { println!("Result: {response:?}"); } + async fn header_verifier_set_esdt_address(&mut self) { + let response = self + .interactor + .tx() + .from(&self.wallet_address) + .to(self + .state + .header_verifier_address + .clone() + .unwrap() + .as_address()) + .gas(30_000_000u64) + .typed(HeaderverifierProxy) + .set_esdt_safe_address(self.state.current_address()) + .prepare_async() + .run() + .await; + + println!("Result: {response:?}"); + } + async fn setup_operation(&mut self) -> Operation { let to = managed_address!(&self.state.fee_market_address.clone().unwrap().to_address()); let payments_tuple = self.setup_payments().await; @@ -1000,6 +1022,7 @@ async fn test_deploy_sov() { interact.deploy_header_verifier_contract().await; interact.set_header_verifier_address().await; interact.unpause_endpoint().await; + interact.header_verifier_set_esdt_address().await; let operation = interact.setup_operation().await; interact.register_operations(&operation).await; diff --git a/esdt-safe/interactor/state.toml b/esdt-safe/interactor/state.toml index ac501012..70c507e7 100644 --- a/esdt-safe/interactor/state.toml +++ b/esdt-safe/interactor/state.toml @@ -1,4 +1,4 @@ -contract_address = "erd1qqqqqqqqqqqqqpgqkm0kcwasdlv03fc3r2t4n5mln8dpsf8nrruqy2k3ya" -fee_market_address = "erd1qqqqqqqqqqqqqpgq4rsu38s3jcmq4l53f0x552mjpdxh2jharruq4rxkqy" +contract_address = "erd1qqqqqqqqqqqqqpgq77gcenfwx5alyfpcmy9j7qthuhs8yj6qrruqp4u4qt" +fee_market_address = "erd1qqqqqqqqqqqqqpgqxa4sjvpr00eyq9vnccw38pca5xa3y0j5rruqf0wxx0" price_aggregator_address = "erd1qqqqqqqqqqqqqpgq4sshr5wx4ch5gd8847dsavahytt732kut7as6z3mv6" -header_verifier_address = "erd1qqqqqqqqqqqqqpgqdf6w0tfcaly25ealg6cnljh5xhkvkyemrruqr7lg5n" +header_verifier_address = "erd1qqqqqqqqqqqqqpgq8t0pym95x4npnzcg9agkkf26ct6m7eqjrruq69536m" From 1fefe881313818fcaeaa93ecd1f08de0a5b3034e Mon Sep 17 00:00:00 2001 From: Andrei Baltariu Date: Fri, 18 Oct 2024 17:15:26 +0300 Subject: [PATCH 457/523] Renamed test Signed-off-by: Andrei Baltariu --- esdt-safe/interactor/src/interactor_main.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/esdt-safe/interactor/src/interactor_main.rs b/esdt-safe/interactor/src/interactor_main.rs index 964994ca..6406a5e1 100644 --- a/esdt-safe/interactor/src/interactor_main.rs +++ b/esdt-safe/interactor/src/interactor_main.rs @@ -1013,7 +1013,7 @@ impl ContractInteract { } #[tokio::test] -async fn test_deploy_sov() { +async fn test_execute_operation_no_transfer_data() { let mut interact = ContractInteract::new().await; interact.deploy(false).await; interact.deploy_fee_market().await; From f11d6b40191e391ba53c81040d13d57b12f88a89 Mon Sep 17 00:00:00 2001 From: Andrei Baltariu Date: Fri, 18 Oct 2024 17:23:22 +0300 Subject: [PATCH 458/523] Added getters for addresses Signed-off-by: Andrei Baltariu --- esdt-safe/interactor/src/interactor_main.rs | 48 ++++++++++++--------- 1 file changed, 28 insertions(+), 20 deletions(-) diff --git a/esdt-safe/interactor/src/interactor_main.rs b/esdt-safe/interactor/src/interactor_main.rs index 6406a5e1..df96cd4b 100644 --- a/esdt-safe/interactor/src/interactor_main.rs +++ b/esdt-safe/interactor/src/interactor_main.rs @@ -114,6 +114,14 @@ impl State { .as_ref() .expect("no known contract, deploy first") } + + pub fn get_header_verifier_address(&self) -> Address { + self.header_verifier_address.clone().unwrap().to_address() + } + + pub fn get_fee_market_address(&self) -> Address { + self.fee_market_address.clone().unwrap().to_address() + } } impl Drop for State { @@ -920,7 +928,7 @@ impl ContractInteract { println!("Result: {response:?}"); } - async fn setup_operation(&mut self) -> Operation { + async fn setup_operation(&mut self, has_transfer_data: bool) -> Operation { let to = managed_address!(&self.state.fee_market_address.clone().unwrap().to_address()); let payments_tuple = self.setup_payments().await; let (tokens, data) = payments_tuple; @@ -941,25 +949,25 @@ impl ContractInteract { managed_operation_hashes.push(managed_operation_hash); - if let Some(header_verifier_address) = self.state.header_verifier_address.clone() { - let response = self - .interactor - .tx() - .from(&self.wallet_address) - .to(header_verifier_address) - .typed(header_verifier_proxy::HeaderverifierProxy) - .register_bridge_operations( - bls_signature, - managed_hash_of_hashes, - managed_operation_hashes, - ) - .returns(ReturnsResult) - .prepare_async() - .run() - .await; - - println!("Result: {response:?}"); - } + let header_verifier_address = self.state.get_header_verifier_address(); + + let response = self + .interactor + .tx() + .from(&self.wallet_address) + .to(header_verifier_address) + .typed(header_verifier_proxy::HeaderverifierProxy) + .register_bridge_operations( + bls_signature, + managed_hash_of_hashes, + managed_operation_hashes, + ) + .returns(ReturnsResult) + .prepare_async() + .run() + .await; + + println!("Result: {response:?}"); } async fn setup_payments( From e2f7628f48b3b6de736558779f08e679c4144072 Mon Sep 17 00:00:00 2001 From: Andrei Baltariu Date: Fri, 18 Oct 2024 17:32:40 +0300 Subject: [PATCH 459/523] Removed transfer_data setup from payments_setup function Signed-off-by: Andrei Baltariu --- esdt-safe/interactor/src/interactor_main.rs | 30 +++++++++------------ 1 file changed, 12 insertions(+), 18 deletions(-) diff --git a/esdt-safe/interactor/src/interactor_main.rs b/esdt-safe/interactor/src/interactor_main.rs index df96cd4b..946dd830 100644 --- a/esdt-safe/interactor/src/interactor_main.rs +++ b/esdt-safe/interactor/src/interactor_main.rs @@ -930,10 +930,16 @@ impl ContractInteract { async fn setup_operation(&mut self, has_transfer_data: bool) -> Operation { let to = managed_address!(&self.state.fee_market_address.clone().unwrap().to_address()); - let payments_tuple = self.setup_payments().await; - let (tokens, data) = payments_tuple; + let payments = self.setup_payments().await; - Operation::new(to, tokens, data) + let op_sender = managed_address!(&self.wallet_address); + let transfer_data: OperationData = OperationData { + op_nonce: 1, + op_sender, + opt_transfer_data: Option::None, + }; + + Operation::new(to, payments, transfer_data) } async fn register_operations(&mut self, operation: &Operation) { @@ -970,12 +976,7 @@ impl ContractInteract { println!("Result: {response:?}"); } - async fn setup_payments( - &mut self, - ) -> ( - ManagedVec>, - OperationData, - ) { + async fn setup_payments(&mut self) -> ManagedVec> { let mut tokens: ManagedVec> = ManagedVec::new(); let token_ids = vec![TOKEN_ID]; @@ -989,14 +990,7 @@ impl ContractInteract { tokens.push(payment); } - let op_sender = managed_address!(&self.wallet_address); - let data: OperationData = OperationData { - op_nonce: 1, - op_sender, - opt_transfer_data: Option::None, - }; - - (tokens, data) + tokens } fn get_operation_hash(&mut self, operation: &Operation) -> [u8; SHA256_RESULT_LEN] { @@ -1032,7 +1026,7 @@ async fn test_execute_operation_no_transfer_data() { interact.unpause_endpoint().await; interact.header_verifier_set_esdt_address().await; - let operation = interact.setup_operation().await; + let operation = interact.setup_operation(false).await; interact.register_operations(&operation).await; interact.execute_operations(&operation).await; } From 6c21d778d162fb6145e03280569f89085e7e94c0 Mon Sep 17 00:00:00 2001 From: Andrei Baltariu Date: Fri, 18 Oct 2024 17:46:07 +0300 Subject: [PATCH 460/523] WIP `OperationData` setup Signed-off-by: Andrei Baltariu --- esdt-safe/interactor/src/interactor_main.rs | 26 ++++++++++++++++++--- 1 file changed, 23 insertions(+), 3 deletions(-) diff --git a/esdt-safe/interactor/src/interactor_main.rs b/esdt-safe/interactor/src/interactor_main.rs index 946dd830..ed709541 100644 --- a/esdt-safe/interactor/src/interactor_main.rs +++ b/esdt-safe/interactor/src/interactor_main.rs @@ -17,8 +17,8 @@ use std::{ io::{Read, Write}, path::Path, }; -use transaction::OperationEsdtPayment; use transaction::{GasLimit, Operation, OperationData, PaymentsVec}; +use transaction::{OperationEsdtPayment, TransferData}; const GATEWAY: &str = sdk::gateway::DEVNET_GATEWAY; const STATE_FILE: &str = "state.toml"; const TOKEN_ID: &[u8] = b"SVT-805b28"; @@ -932,14 +932,34 @@ impl ContractInteract { let to = managed_address!(&self.state.fee_market_address.clone().unwrap().to_address()); let payments = self.setup_payments().await; + let operation_data = self.setup_operation_data(has_transfer_data).await; + + Operation::new(to, payments, operation_data) + } + + async fn setup_operation_data(&mut self, has_transfer_data: bool) -> OperationData { let op_sender = managed_address!(&self.wallet_address); + + let transfer_data = if has_transfer_data { + let mut args = ManagedVec::new(); + args.push(ManagedBuffer::from("arg1")); + + Some(TransferData::new( + 30_000_000u64, + ManagedBuffer::from("some_function"), + args, + )) + } else { + None + }; + let transfer_data: OperationData = OperationData { op_nonce: 1, op_sender, - opt_transfer_data: Option::None, + opt_transfer_data: transfer_data, }; - Operation::new(to, payments, transfer_data) + transfer_data } async fn register_operations(&mut self, operation: &Operation) { From 3c329d94d8d1e9a744817e02662d17d2dbdc10d8 Mon Sep 17 00:00:00 2001 From: Andrei Baltariu Date: Fri, 18 Oct 2024 17:48:27 +0300 Subject: [PATCH 461/523] Added use of getter for `fee_market` address Signed-off-by: Andrei Baltariu --- esdt-safe/interactor/src/interactor_main.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/esdt-safe/interactor/src/interactor_main.rs b/esdt-safe/interactor/src/interactor_main.rs index ed709541..79ad04bd 100644 --- a/esdt-safe/interactor/src/interactor_main.rs +++ b/esdt-safe/interactor/src/interactor_main.rs @@ -929,7 +929,7 @@ impl ContractInteract { } async fn setup_operation(&mut self, has_transfer_data: bool) -> Operation { - let to = managed_address!(&self.state.fee_market_address.clone().unwrap().to_address()); + let to = managed_address!(&self.state.get_fee_market_address()); let payments = self.setup_payments().await; let operation_data = self.setup_operation_data(has_transfer_data).await; From fe75b7ea05bce0d90632a4beb5f1e110c571c5b7 Mon Sep 17 00:00:00 2001 From: Andrei Baltariu Date: Fri, 18 Oct 2024 17:49:51 +0300 Subject: [PATCH 462/523] Generated sc for testing Signed-off-by: Andrei Baltariu --- testing-sc/Cargo.toml | 24 ++++++++++++ testing-sc/meta/Cargo.toml | 12 ++++++ testing-sc/meta/src/main.rs | 3 ++ testing-sc/multiversx.json | 3 ++ testing-sc/scenarios/testing_sc.scen.json | 39 +++++++++++++++++++ testing-sc/src/testing_sc.rs | 14 +++++++ .../tests/testing_sc_scenario_go_test.rs | 10 +++++ .../tests/testing_sc_scenario_rs_test.rs | 13 +++++++ 8 files changed, 118 insertions(+) create mode 100644 testing-sc/Cargo.toml create mode 100644 testing-sc/meta/Cargo.toml create mode 100644 testing-sc/meta/src/main.rs create mode 100644 testing-sc/multiversx.json create mode 100644 testing-sc/scenarios/testing_sc.scen.json create mode 100644 testing-sc/src/testing_sc.rs create mode 100644 testing-sc/tests/testing_sc_scenario_go_test.rs create mode 100644 testing-sc/tests/testing_sc_scenario_rs_test.rs diff --git a/testing-sc/Cargo.toml b/testing-sc/Cargo.toml new file mode 100644 index 00000000..de7ad60d --- /dev/null +++ b/testing-sc/Cargo.toml @@ -0,0 +1,24 @@ +[package] +name = "testing-sc" +version = "0.0.0" +publish = false +edition = "2021" +authors = ["you"] + +[lib] +path = "src/testing_sc.rs" + +[dependencies.multiversx-sc] +version = "0.53.2" + +[dev-dependencies] +num-bigint = "0.4" + +[dev-dependencies.multiversx-sc-scenario] +version = "0.53.2" + +[workspace] +members = [ + ".", + "meta", +] diff --git a/testing-sc/meta/Cargo.toml b/testing-sc/meta/Cargo.toml new file mode 100644 index 00000000..357c5e09 --- /dev/null +++ b/testing-sc/meta/Cargo.toml @@ -0,0 +1,12 @@ +[package] +name = "testing-sc-meta" +version = "0.0.0" +edition = "2021" +publish = false + +[dependencies.testing-sc] +path = ".." + +[dependencies.multiversx-sc-meta-lib] +version = "0.53.2" +default-features = false diff --git a/testing-sc/meta/src/main.rs b/testing-sc/meta/src/main.rs new file mode 100644 index 00000000..5400ce32 --- /dev/null +++ b/testing-sc/meta/src/main.rs @@ -0,0 +1,3 @@ +fn main() { + multiversx_sc_meta_lib::cli_main::(); +} diff --git a/testing-sc/multiversx.json b/testing-sc/multiversx.json new file mode 100644 index 00000000..73655396 --- /dev/null +++ b/testing-sc/multiversx.json @@ -0,0 +1,3 @@ +{ + "language": "rust" +} \ No newline at end of file diff --git a/testing-sc/scenarios/testing_sc.scen.json b/testing-sc/scenarios/testing_sc.scen.json new file mode 100644 index 00000000..59a07a3e --- /dev/null +++ b/testing-sc/scenarios/testing_sc.scen.json @@ -0,0 +1,39 @@ +{ + "name": "empty", + "steps": [ + { + "step": "setState", + "accounts": { + "address:owner": { + "nonce": "1", + "balance": "0" + } + }, + "newAddresses": [ + { + "creatorAddress": "address:owner", + "creatorNonce": "1", + "newAddress": "sc:empty" + } + ] + }, + { + "step": "scDeploy", + "id": "deploy", + "tx": { + "from": "address:owner", + "contractCode": "mxsc:../output/testing-sc.mxsc.json", + "arguments": [], + "gasLimit": "5,000,000", + "gasPrice": "0" + }, + "expect": { + "out": [], + "status": "", + "logs": [], + "gas": "*", + "refund": "*" + } + } + ] +} diff --git a/testing-sc/src/testing_sc.rs b/testing-sc/src/testing_sc.rs new file mode 100644 index 00000000..58e7ccc5 --- /dev/null +++ b/testing-sc/src/testing_sc.rs @@ -0,0 +1,14 @@ +#![no_std] + +#[allow(unused_imports)] +use multiversx_sc::imports::*; + +/// An empty contract. To be used as a template when starting a new contract from scratch. +#[multiversx_sc::contract] +pub trait TestingSc { + #[init] + fn init(&self) {} + + #[upgrade] + fn upgrade(&self) {} +} diff --git a/testing-sc/tests/testing_sc_scenario_go_test.rs b/testing-sc/tests/testing_sc_scenario_go_test.rs new file mode 100644 index 00000000..7609a96b --- /dev/null +++ b/testing-sc/tests/testing_sc_scenario_go_test.rs @@ -0,0 +1,10 @@ +use multiversx_sc_scenario::*; + +fn world() -> ScenarioWorld { + ScenarioWorld::vm_go() +} + +#[test] +fn empty_go() { + world().run("scenarios/testing_sc.scen.json"); +} diff --git a/testing-sc/tests/testing_sc_scenario_rs_test.rs b/testing-sc/tests/testing_sc_scenario_rs_test.rs new file mode 100644 index 00000000..b338ed33 --- /dev/null +++ b/testing-sc/tests/testing_sc_scenario_rs_test.rs @@ -0,0 +1,13 @@ +use multiversx_sc_scenario::*; + +fn world() -> ScenarioWorld { + let mut blockchain = ScenarioWorld::new(); + + blockchain.register_contract("mxsc:output/testing-sc.mxsc.json", testing_sc::ContractBuilder); + blockchain +} + +#[test] +fn empty_rs() { + world().run("scenarios/testing_sc.scen.json"); +} From 2c7ec2dbb87bd9dbed03c30150a671c4954409e9 Mon Sep 17 00:00:00 2001 From: Andrei Baltariu Date: Fri, 18 Oct 2024 17:51:34 +0300 Subject: [PATCH 463/523] Added testing-sc to workspace Signed-off-by: Andrei Baltariu --- Cargo.lock | 17 + Cargo.toml | 4 +- testing-sc/Cargo.lock | 1159 ++++++++++++++++++++++++++++++++++++ testing-sc/Cargo.toml | 6 - testing-sc/wasm/Cargo.lock | 188 ++++++ testing-sc/wasm/Cargo.toml | 34 ++ testing-sc/wasm/src/lib.rs | 26 + 7 files changed, 1427 insertions(+), 7 deletions(-) create mode 100644 testing-sc/Cargo.lock create mode 100644 testing-sc/wasm/Cargo.lock create mode 100644 testing-sc/wasm/Cargo.toml create mode 100644 testing-sc/wasm/src/lib.rs diff --git a/Cargo.lock b/Cargo.lock index 76877f93..fad867e9 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2079,6 +2079,23 @@ dependencies = [ "winapi-util", ] +[[package]] +name = "testing-sc" +version = "0.0.0" +dependencies = [ + "multiversx-sc", + "multiversx-sc-scenario", + "num-bigint", +] + +[[package]] +name = "testing-sc-meta" +version = "0.0.0" +dependencies = [ + "multiversx-sc-meta-lib", + "testing-sc", +] + [[package]] name = "tinyvec" version = "1.8.0" diff --git a/Cargo.toml b/Cargo.toml index ea05c21a..b9a2628f 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -16,5 +16,7 @@ members = [ "enshrine-esdt-safe", "enshrine-esdt-safe/meta", "token-handler", - "token-handler/meta" + "token-handler/meta", + "testing-sc", + "testing-sc/meta", ] diff --git a/testing-sc/Cargo.lock b/testing-sc/Cargo.lock new file mode 100644 index 00000000..13ef7405 --- /dev/null +++ b/testing-sc/Cargo.lock @@ -0,0 +1,1159 @@ +# This file is automatically @generated by Cargo. +# It is not intended for manual editing. +version = 3 + +[[package]] +name = "ahash" +version = "0.8.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e89da841a80418a9b391ebaea17f5c112ffaaa96f621d2c285b5174da76b9011" +dependencies = [ + "cfg-if", + "once_cell", + "version_check", + "zerocopy", +] + +[[package]] +name = "anstream" +version = "0.6.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "64e15c1ab1f89faffbf04a634d5e1962e9074f2741eef6d97f3c4e322426d526" +dependencies = [ + "anstyle", + "anstyle-parse", + "anstyle-query", + "anstyle-wincon", + "colorchoice", + "is_terminal_polyfill", + "utf8parse", +] + +[[package]] +name = "anstyle" +version = "1.0.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1bec1de6f59aedf83baf9ff929c98f2ad654b97c9510f4e70cf6f661d49fd5b1" + +[[package]] +name = "anstyle-parse" +version = "0.2.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "eb47de1e80c2b463c735db5b217a0ddc39d612e7ac9e2e96a5aed1f57616c1cb" +dependencies = [ + "utf8parse", +] + +[[package]] +name = "anstyle-query" +version = "1.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6d36fc52c7f6c869915e99412912f22093507da8d9e942ceaf66fe4b7c14422a" +dependencies = [ + "windows-sys 0.52.0", +] + +[[package]] +name = "anstyle-wincon" +version = "3.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5bf74e1b6e971609db8ca7a9ce79fd5768ab6ae46441c572e46cf596f59e57f8" +dependencies = [ + "anstyle", + "windows-sys 0.52.0", +] + +[[package]] +name = "anyhow" +version = "1.0.90" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "37bf3594c4c988a53154954629820791dde498571819ae4ca50ca811e060cc95" + +[[package]] +name = "arrayvec" +version = "0.7.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7c02d123df017efcdfbd739ef81735b36c5ba83ec3c59c80a9d7ecc718f92e50" + +[[package]] +name = "autocfg" +version = "1.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ace50bade8e6234aa140d9a2f552bbee1db4d353f69b8217bc503490fc1a9f26" + +[[package]] +name = "base64" +version = "0.22.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "72b3254f16251a8381aa12e40e3c4d2f0199f8c6508fbecb9d91f575e0fbb8c6" + +[[package]] +name = "base64ct" +version = "1.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8c3c1a368f70d6cf7302d78f8f7093da241fb8e8807c05cc9e51a125895a6d5b" + +[[package]] +name = "bech32" +version = "0.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d965446196e3b7decd44aa7ee49e31d630118f90ef12f97900f262eb915c951d" + +[[package]] +name = "bitflags" +version = "2.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b048fb63fd8b5923fc5aa7b340d8e156aec7ec02f0c78fa8a6ddc2613f6f71de" + +[[package]] +name = "block-buffer" +version = "0.10.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3078c7629b62d3f0439517fa394996acacc5cbc91c5a20d8c658e77abd503a71" +dependencies = [ + "generic-array", +] + +[[package]] +name = "byteorder" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1fd0f2584146f6f2ef48085050886acf353beff7305ebd1ae69500e27c67f64b" + +[[package]] +name = "cfg-if" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" + +[[package]] +name = "clap" +version = "4.5.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b97f376d85a664d5837dbae44bf546e6477a679ff6610010f17276f686d867e8" +dependencies = [ + "clap_builder", + "clap_derive", +] + +[[package]] +name = "clap_builder" +version = "4.5.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "19bc80abd44e4bed93ca373a0704ccbd1b710dc5749406201bb018272808dc54" +dependencies = [ + "anstream", + "anstyle", + "clap_lex", + "strsim", +] + +[[package]] +name = "clap_derive" +version = "4.5.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4ac6a0c7b1a9e9a5186361f67dfa1b88213572f427fb9ab038efb2bd8c582dab" +dependencies = [ + "heck", + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "clap_lex" +version = "0.7.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1462739cb27611015575c0c11df5df7601141071f07518d56fcc1be504cbec97" + +[[package]] +name = "colorchoice" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d3fd119d74b830634cea2a0f58bbd0d54540518a14397557951e79340abc28c0" + +[[package]] +name = "colored" +version = "2.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cbf2150cce219b664a8a70df7a1f933836724b503f8a413af9365b4dcc4d90b8" +dependencies = [ + "lazy_static", + "windows-sys 0.48.0", +] + +[[package]] +name = "const-oid" +version = "0.9.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c2459377285ad874054d797f3ccebf984978aa39129f6eafde5cdc8315b612f8" + +[[package]] +name = "convert_case" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ec182b0ca2f35d8fc196cf3404988fd8b8c739a4d270ff118a398feb0cbec1ca" +dependencies = [ + "unicode-segmentation", +] + +[[package]] +name = "cpufeatures" +version = "0.2.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "608697df725056feaccfa42cffdaeeec3fccc4ffc38358ecd19b243e716a78e0" +dependencies = [ + "libc", +] + +[[package]] +name = "crypto-common" +version = "0.1.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1bfb12502f3fc46cca1bb51ac28df9d618d813cdc3d2f25b9fe775a34af26bb3" +dependencies = [ + "generic-array", + "typenum", +] + +[[package]] +name = "curve25519-dalek" +version = "4.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "97fb8b7c4503de7d6ae7b42ab72a5a59857b4c937ec27a3d4539dba95b5ab2be" +dependencies = [ + "cfg-if", + "cpufeatures", + "curve25519-dalek-derive", + "digest", + "fiat-crypto", + "rustc_version", + "subtle", + "zeroize", +] + +[[package]] +name = "curve25519-dalek-derive" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f46882e17999c6cc590af592290432be3bce0428cb0d5f8b6715e4dc7b383eb3" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "der" +version = "0.7.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f55bf8e7b65898637379c1b74eb1551107c8294ed26d855ceb9fd1a09cfc9bc0" +dependencies = [ + "const-oid", + "zeroize", +] + +[[package]] +name = "digest" +version = "0.10.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9ed9a281f7bc9b7576e61468ba615a66a5c8cfdff42420a70aa82701a3b1e292" +dependencies = [ + "block-buffer", + "crypto-common", +] + +[[package]] +name = "ed25519" +version = "2.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "115531babc129696a58c64a4fef0a8bf9e9698629fb97e9e40767d235cfbcd53" +dependencies = [ + "pkcs8", + "signature", +] + +[[package]] +name = "ed25519-dalek" +version = "2.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4a3daa8e81a3963a60642bcc1f90a670680bd4a77535faa384e9d1c79d620871" +dependencies = [ + "curve25519-dalek", + "ed25519", + "serde", + "sha2", + "subtle", + "zeroize", +] + +[[package]] +name = "either" +version = "1.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "60b1af1c220855b6ceac025d3f6ecdd2b7c4894bfe9cd9bda4fbb4bc7c0d4cf0" + +[[package]] +name = "endian-type" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c34f04666d835ff5d62e058c3995147c06f42fe86ff053337632bca83e42702d" + +[[package]] +name = "equivalent" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5443807d6dff69373d433ab9ef5378ad8df50ca6298caf15de6e52e24aaf54d5" + +[[package]] +name = "fiat-crypto" +version = "0.2.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "28dea519a9695b9977216879a3ebfddf92f1c08c05d984f8996aecd6ecdc811d" + +[[package]] +name = "generic-array" +version = "0.14.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "85649ca51fd72272d7821adaf274ad91c288277713d9c18820d8499a7ff69e9a" +dependencies = [ + "typenum", + "version_check", +] + +[[package]] +name = "getrandom" +version = "0.2.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c4567c8db10ae91089c99af84c68c38da3ec2f087c3f82960bcdbf3656b6f4d7" +dependencies = [ + "cfg-if", + "libc", + "wasi", +] + +[[package]] +name = "hashbrown" +version = "0.14.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e5274423e17b7c9fc20b6e7e208532f9b19825d82dfd615708b70edd83df41f1" +dependencies = [ + "ahash", + "serde", +] + +[[package]] +name = "hashbrown" +version = "0.15.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1e087f84d4f86bf4b218b927129862374b72199ae7d8657835f1e89000eea4fb" + +[[package]] +name = "heck" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2304e00983f87ffb38b55b444b5e3b60a884b5d30c0fca7d82fe33449bbe55ea" + +[[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 = "indexmap" +version = "2.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "707907fe3c25f5424cce2cb7e1cbcafee6bdbe735ca90ef77c29e84591e5b9da" +dependencies = [ + "equivalent", + "hashbrown 0.15.0", + "serde", +] + +[[package]] +name = "is_terminal_polyfill" +version = "1.70.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7943c866cc5cd64cbc25b2e01621d07fa8eb2a1a23160ee81ce38704e97b8ecf" + +[[package]] +name = "itertools" +version = "0.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "413ee7dfc52ee1a4949ceeb7dbc8a33f2d6c088194d9f922fb8318faf1f01186" +dependencies = [ + "either", +] + +[[package]] +name = "itoa" +version = "1.0.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "49f1f14873335454500d59611f1cf4a4b0f786f9ac11f4312a78e4cf2566695b" + +[[package]] +name = "keccak" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ecc2af9a1119c51f12a14607e783cb977bde58bc069ff0c3da1095e635d70654" +dependencies = [ + "cpufeatures", +] + +[[package]] +name = "lazy_static" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bbd2bcb4c963f2ddae06a2efc7e9f3591312473c50c6685e1f298068316e66fe" + +[[package]] +name = "libc" +version = "0.2.161" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8e9489c2807c139ffd9c1794f4af0ebe86a828db53ecdc7fea2111d0fed085d1" + +[[package]] +name = "log" +version = "0.4.22" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a7a70ba024b9dc04c27ea2f0c0548feb474ec5c54bba33a7f72f873a39d07b24" + +[[package]] +name = "memchr" +version = "2.7.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "78ca9ab1a0babb1e7d5695e3530886289c18cf2f87ec19a575a0abdce112e3a3" + +[[package]] +name = "multiversx-chain-scenario-format" +version = "0.23.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dcca77966bf5eb9c9f96d0597f17a4fa7b64681cc7b83e39bdf31f8c6ca04d44" +dependencies = [ + "bech32", + "hex", + "num-bigint", + "num-traits", + "serde", + "serde_json", + "sha3", +] + +[[package]] +name = "multiversx-chain-vm" +version = "0.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "13c537d27dfc7a8e295d4f7c5f67a967ce66b6c3fc8e31a160e8cf28e14ecb2d" +dependencies = [ + "bitflags", + "colored", + "ed25519-dalek", + "hex", + "hex-literal", + "itertools", + "multiversx-chain-vm-executor", + "num-bigint", + "num-traits", + "rand", + "rand_seeder", + "sha2", + "sha3", +] + +[[package]] +name = "multiversx-chain-vm-executor" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b59072fa0624b55ae5ae3fa6bfa91515bbeb4ac440214bc4a509e2c8806d6e9f" + +[[package]] +name = "multiversx-sc" +version = "0.53.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "75ea89a26f0aacda21437a8ae5ccfbefab99d8191942b3d2eddbcbf84f9866d7" +dependencies = [ + "bitflags", + "hex-literal", + "multiversx-sc-codec", + "multiversx-sc-derive", + "num-traits", + "unwrap-infallible", +] + +[[package]] +name = "multiversx-sc-codec" +version = "0.21.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "007d7a5a8534e5dc9128cb8f15a65a21dd378e135c6016c7cd1491cd012bc8cb" +dependencies = [ + "arrayvec", + "multiversx-sc-codec-derive", + "num-bigint", + "unwrap-infallible", +] + +[[package]] +name = "multiversx-sc-codec-derive" +version = "0.21.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dffba1dce273ed5b61ee1b90aeea5c8c744617d0f12624f620768c144d83e753" +dependencies = [ + "hex", + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "multiversx-sc-derive" +version = "0.53.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4c17fdf90fafca2f19085ae67b0502d9f71bf8ab1be3c83808eb88e02a8c18b9" +dependencies = [ + "hex", + "proc-macro2", + "quote", + "radix_trie", + "syn", +] + +[[package]] +name = "multiversx-sc-meta-lib" +version = "0.53.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ef023806e14a8a6245408c4a7dfdf17d4a1eb39425cedfe50cd2c48f96708ab6" +dependencies = [ + "clap", + "colored", + "convert_case", + "hex", + "lazy_static", + "multiversx-sc", + "rustc_version", + "semver", + "serde", + "serde_json", + "toml", + "wasmparser", + "wasmprinter", +] + +[[package]] +name = "multiversx-sc-scenario" +version = "0.53.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cd16e3bf1f6696d0add36b7b905b1ffdd13b836e584da000f5e265c11e2bfc8d" +dependencies = [ + "base64", + "bech32", + "colored", + "hex", + "itertools", + "log", + "multiversx-chain-scenario-format", + "multiversx-chain-vm", + "multiversx-chain-vm-executor", + "multiversx-sc", + "multiversx-sc-meta-lib", + "num-bigint", + "num-traits", + "pathdiff", + "serde", + "serde_json", + "sha2", + "unwrap-infallible", +] + +[[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-bigint" +version = "0.4.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a5e44f723f1133c9deac646763579fdb3ac745e418f2a7af9cd0c431da1f20b9" +dependencies = [ + "num-integer", + "num-traits", +] + +[[package]] +name = "num-integer" +version = "0.1.46" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7969661fd2958a5cb096e56c8e1ad0444ac2bbcd0061bd28660485a44879858f" +dependencies = [ + "num-traits", +] + +[[package]] +name = "num-traits" +version = "0.2.19" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "071dfc062690e90b734c0b2273ce72ad0ffa95f0c74596bc250dcfd960262841" +dependencies = [ + "autocfg", +] + +[[package]] +name = "once_cell" +version = "1.20.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1261fe7e33c73b354eab43b1273a57c8f967d0391e80353e51f764ac02cf6775" + +[[package]] +name = "pathdiff" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d61c5ce1153ab5b689d0c074c4e7fc613e942dfb7dd9eea5ab202d2ad91fe361" + +[[package]] +name = "pkcs8" +version = "0.10.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f950b2377845cebe5cf8b5165cb3cc1a5e0fa5cfa3e1f7f55707d8fd82e0a7b7" +dependencies = [ + "der", + "spki", +] + +[[package]] +name = "ppv-lite86" +version = "0.2.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "77957b295656769bb8ad2b6a6b09d897d94f05c41b069aede1fcdaa675eaea04" +dependencies = [ + "zerocopy", +] + +[[package]] +name = "proc-macro2" +version = "1.0.86" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5e719e8df665df0d1c8fbfd238015744736151d4445ec0836b8e628aae103b77" +dependencies = [ + "unicode-ident", +] + +[[package]] +name = "quote" +version = "1.0.37" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b5b9d34b8991d19d98081b46eacdd8eb58c6f2b201139f7c5f643cc155a633af" +dependencies = [ + "proc-macro2", +] + +[[package]] +name = "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 = "rand" +version = "0.8.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "34af8d1a0e25924bc5b7c43c079c942339d8f0a8b57c39049bef581b46327404" +dependencies = [ + "libc", + "rand_chacha", + "rand_core", +] + +[[package]] +name = "rand_chacha" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e6c10a63a0fa32252be49d21e7709d4d4baf8d231c2dbce1eaa8141b9b127d88" +dependencies = [ + "ppv-lite86", + "rand_core", +] + +[[package]] +name = "rand_core" +version = "0.6.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c" +dependencies = [ + "getrandom", +] + +[[package]] +name = "rand_seeder" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4a9febe641d2842ffc76ee962668a17578767c4e01735e4802b21ed9a24b2e4e" +dependencies = [ + "rand_core", +] + +[[package]] +name = "rustc_version" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cfcb3a22ef46e85b45de6ee7e79d063319ebb6594faafcf1c225ea92ab6e9b92" +dependencies = [ + "semver", +] + +[[package]] +name = "ryu" +version = "1.0.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f3cb5ba0dc43242ce17de99c180e96db90b235b8a9fdc9543c96d2209116bd9f" + +[[package]] +name = "semver" +version = "1.0.23" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "61697e0a1c7e512e84a621326239844a24d8207b4669b41bc18b32ea5cbf988b" + +[[package]] +name = "serde" +version = "1.0.210" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c8e3592472072e6e22e0a54d5904d9febf8508f65fb8552499a1abc7d1078c3a" +dependencies = [ + "serde_derive", +] + +[[package]] +name = "serde_derive" +version = "1.0.210" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "243902eda00fad750862fc144cea25caca5e20d615af0a81bee94ca738f1df1f" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "serde_json" +version = "1.0.129" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6dbcf9b78a125ee667ae19388837dd12294b858d101fdd393cb9d5501ef09eb2" +dependencies = [ + "itoa", + "memchr", + "ryu", + "serde", +] + +[[package]] +name = "serde_spanned" +version = "0.6.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "87607cb1398ed59d48732e575a4c28a7a8ebf2454b964fe3f224f2afc07909e1" +dependencies = [ + "serde", +] + +[[package]] +name = "sha2" +version = "0.10.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "793db75ad2bcafc3ffa7c68b215fee268f537982cd901d132f89c6343f3a3dc8" +dependencies = [ + "cfg-if", + "cpufeatures", + "digest", +] + +[[package]] +name = "sha3" +version = "0.10.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "75872d278a8f37ef87fa0ddbda7802605cb18344497949862c0d4dcb291eba60" +dependencies = [ + "digest", + "keccak", +] + +[[package]] +name = "signature" +version = "2.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "77549399552de45a898a580c1b41d445bf730df867cc44e6c0233bbc4b8329de" +dependencies = [ + "rand_core", +] + +[[package]] +name = "smallvec" +version = "1.13.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3c5e1a9a646d36c3599cd173a41282daf47c44583ad367b8e6837255952e5c67" + +[[package]] +name = "spki" +version = "0.7.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d91ed6c858b01f942cd56b37a94b3e0a1798290327d1236e4d9cf4eaca44d29d" +dependencies = [ + "base64ct", + "der", +] + +[[package]] +name = "strsim" +version = "0.11.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7da8b5736845d9f2fcb837ea5d9e2628564b3b043a70948a3f0b778838c5fb4f" + +[[package]] +name = "subtle" +version = "2.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "13c2bddecc57b384dee18652358fb23172facb8a2c51ccc10d74c157bdea3292" + +[[package]] +name = "syn" +version = "2.0.77" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9f35bcdf61fd8e7be6caf75f429fdca8beb3ed76584befb503b1569faee373ed" +dependencies = [ + "proc-macro2", + "quote", + "unicode-ident", +] + +[[package]] +name = "termcolor" +version = "1.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "06794f8f6c5c898b3275aebefa6b8a1cb24cd2c6c79397ab15774837a0bc5755" +dependencies = [ + "winapi-util", +] + +[[package]] +name = "testing-sc" +version = "0.0.0" +dependencies = [ + "multiversx-sc", + "multiversx-sc-scenario", + "num-bigint", +] + +[[package]] +name = "testing-sc-meta" +version = "0.0.0" +dependencies = [ + "multiversx-sc-meta-lib", + "testing-sc", +] + +[[package]] +name = "toml" +version = "0.8.19" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a1ed1f98e3fdc28d6d910e6737ae6ab1a93bf1985935a1193e68f93eeb68d24e" +dependencies = [ + "indexmap", + "serde", + "serde_spanned", + "toml_datetime", + "toml_edit", +] + +[[package]] +name = "toml_datetime" +version = "0.6.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0dd7358ecb8fc2f8d014bf86f6f638ce72ba252a2c3a2572f2a795f1d23efb41" +dependencies = [ + "serde", +] + +[[package]] +name = "toml_edit" +version = "0.22.22" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4ae48d6208a266e853d946088ed816055e556cc6028c5e8e2b84d9fa5dd7c7f5" +dependencies = [ + "indexmap", + "serde", + "serde_spanned", + "toml_datetime", + "winnow", +] + +[[package]] +name = "typenum" +version = "1.17.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "42ff0bf0c66b8238c6f3b578df37d0b7848e55df8577b3f74f92a69acceeb825" + +[[package]] +name = "unicode-ident" +version = "1.0.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e91b56cd4cadaeb79bbf1a5645f6b4f8dc5bde8834ad5894a8db35fda9efa1fe" + +[[package]] +name = "unicode-segmentation" +version = "1.12.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f6ccf251212114b54433ec949fd6a7841275f9ada20dddd2f29e9ceea4501493" + +[[package]] +name = "unwrap-infallible" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "151ac09978d3c2862c4e39b557f4eceee2cc72150bc4cb4f16abf061b6e381fb" + +[[package]] +name = "utf8parse" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "06abde3611657adf66d383f00b093d7faecc7fa57071cce2578660c9f1010821" + +[[package]] +name = "version_check" +version = "0.9.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0b928f33d975fc6ad9f86c8f283853ad26bdd5b10b7f1542aa2fa15e2289105a" + +[[package]] +name = "wasi" +version = "0.11.0+wasi-snapshot-preview1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" + +[[package]] +name = "wasmparser" +version = "0.216.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bcdee6bea3619d311fb4b299721e89a986c3470f804b6d534340e412589028e3" +dependencies = [ + "ahash", + "bitflags", + "hashbrown 0.14.5", + "indexmap", + "semver", + "serde", +] + +[[package]] +name = "wasmprinter" +version = "0.216.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8f82916f3892e53620639217d6ec78fe15c678352a3fbf3f3745b6417d0bd70f" +dependencies = [ + "anyhow", + "termcolor", + "wasmparser", +] + +[[package]] +name = "winapi-util" +version = "0.1.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cf221c93e13a30d793f7645a0e7762c55d169dbb0a49671918a2319d289b10bb" +dependencies = [ + "windows-sys 0.59.0", +] + +[[package]] +name = "windows-sys" +version = "0.48.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "677d2418bec65e3338edb076e806bc1ec15693c5d0104683f2efe857f61056a9" +dependencies = [ + "windows-targets 0.48.5", +] + +[[package]] +name = "windows-sys" +version = "0.52.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "282be5f36a8ce781fad8c8ae18fa3f9beff57ec1b52cb3de0789201425d9a33d" +dependencies = [ + "windows-targets 0.52.6", +] + +[[package]] +name = "windows-sys" +version = "0.59.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1e38bc4d79ed67fd075bcc251a1c39b32a1776bbe92e5bef1f0bf1f8c531853b" +dependencies = [ + "windows-targets 0.52.6", +] + +[[package]] +name = "windows-targets" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9a2fa6e2155d7247be68c096456083145c183cbbbc2764150dda45a87197940c" +dependencies = [ + "windows_aarch64_gnullvm 0.48.5", + "windows_aarch64_msvc 0.48.5", + "windows_i686_gnu 0.48.5", + "windows_i686_msvc 0.48.5", + "windows_x86_64_gnu 0.48.5", + "windows_x86_64_gnullvm 0.48.5", + "windows_x86_64_msvc 0.48.5", +] + +[[package]] +name = "windows-targets" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9b724f72796e036ab90c1021d4780d4d3d648aca59e491e6b98e725b84e99973" +dependencies = [ + "windows_aarch64_gnullvm 0.52.6", + "windows_aarch64_msvc 0.52.6", + "windows_i686_gnu 0.52.6", + "windows_i686_gnullvm", + "windows_i686_msvc 0.52.6", + "windows_x86_64_gnu 0.52.6", + "windows_x86_64_gnullvm 0.52.6", + "windows_x86_64_msvc 0.52.6", +] + +[[package]] +name = "windows_aarch64_gnullvm" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2b38e32f0abccf9987a4e3079dfb67dcd799fb61361e53e2882c3cbaf0d905d8" + +[[package]] +name = "windows_aarch64_gnullvm" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "32a4622180e7a0ec044bb555404c800bc9fd9ec262ec147edd5989ccd0c02cd3" + +[[package]] +name = "windows_aarch64_msvc" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dc35310971f3b2dbbf3f0690a219f40e2d9afcf64f9ab7cc1be722937c26b4bc" + +[[package]] +name = "windows_aarch64_msvc" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "09ec2a7bb152e2252b53fa7803150007879548bc709c039df7627cabbd05d469" + +[[package]] +name = "windows_i686_gnu" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a75915e7def60c94dcef72200b9a8e58e5091744960da64ec734a6c6e9b3743e" + +[[package]] +name = "windows_i686_gnu" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8e9b5ad5ab802e97eb8e295ac6720e509ee4c243f69d781394014ebfe8bbfa0b" + +[[package]] +name = "windows_i686_gnullvm" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0eee52d38c090b3caa76c563b86c3a4bd71ef1a819287c19d586d7334ae8ed66" + +[[package]] +name = "windows_i686_msvc" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8f55c233f70c4b27f66c523580f78f1004e8b5a8b659e05a4eb49d4166cca406" + +[[package]] +name = "windows_i686_msvc" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "240948bc05c5e7c6dabba28bf89d89ffce3e303022809e73deaefe4f6ec56c66" + +[[package]] +name = "windows_x86_64_gnu" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "53d40abd2583d23e4718fddf1ebec84dbff8381c07cae67ff7768bbf19c6718e" + +[[package]] +name = "windows_x86_64_gnu" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "147a5c80aabfbf0c7d901cb5895d1de30ef2907eb21fbbab29ca94c5b08b1a78" + +[[package]] +name = "windows_x86_64_gnullvm" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0b7b52767868a23d5bab768e390dc5f5c55825b6d30b86c844ff2dc7414044cc" + +[[package]] +name = "windows_x86_64_gnullvm" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "24d5b23dc417412679681396f2b49f3de8c1473deb516bd34410872eff51ed0d" + +[[package]] +name = "windows_x86_64_msvc" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ed94fce61571a4006852b7389a063ab983c02eb1bb37b47f8272ce92d06d9538" + +[[package]] +name = "windows_x86_64_msvc" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec" + +[[package]] +name = "winnow" +version = "0.6.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "36c1fec1a2bb5866f07c25f68c26e565c4c200aebb96d7e55710c19d3e8ac49b" +dependencies = [ + "memchr", +] + +[[package]] +name = "zerocopy" +version = "0.7.35" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1b9b4fd18abc82b8136838da5d50bae7bdea537c574d8dc1a34ed098d6c166f0" +dependencies = [ + "byteorder", + "zerocopy-derive", +] + +[[package]] +name = "zerocopy-derive" +version = "0.7.35" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fa4f8080344d4671fb4e831a13ad1e68092748387dfc4f55e356242fae12ce3e" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "zeroize" +version = "1.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ced3678a2879b30306d323f4542626697a464a97c0a07c9aebf7ebca65cd4dde" diff --git a/testing-sc/Cargo.toml b/testing-sc/Cargo.toml index de7ad60d..f698888c 100644 --- a/testing-sc/Cargo.toml +++ b/testing-sc/Cargo.toml @@ -16,9 +16,3 @@ num-bigint = "0.4" [dev-dependencies.multiversx-sc-scenario] version = "0.53.2" - -[workspace] -members = [ - ".", - "meta", -] diff --git a/testing-sc/wasm/Cargo.lock b/testing-sc/wasm/Cargo.lock new file mode 100644 index 00000000..10cb39dc --- /dev/null +++ b/testing-sc/wasm/Cargo.lock @@ -0,0 +1,188 @@ +# This file is automatically @generated by Cargo. +# It is not intended for manual editing. +version = 3 + +[[package]] +name = "arrayvec" +version = "0.7.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7c02d123df017efcdfbd739ef81735b36c5ba83ec3c59c80a9d7ecc718f92e50" + +[[package]] +name = "autocfg" +version = "1.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ace50bade8e6234aa140d9a2f552bbee1db4d353f69b8217bc503490fc1a9f26" + +[[package]] +name = "bitflags" +version = "2.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b048fb63fd8b5923fc5aa7b340d8e156aec7ec02f0c78fa8a6ddc2613f6f71de" + +[[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.53.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "75ea89a26f0aacda21437a8ae5ccfbefab99d8191942b3d2eddbcbf84f9866d7" +dependencies = [ + "bitflags", + "hex-literal", + "multiversx-sc-codec", + "multiversx-sc-derive", + "num-traits", + "unwrap-infallible", +] + +[[package]] +name = "multiversx-sc-codec" +version = "0.21.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "007d7a5a8534e5dc9128cb8f15a65a21dd378e135c6016c7cd1491cd012bc8cb" +dependencies = [ + "arrayvec", + "multiversx-sc-codec-derive", + "unwrap-infallible", +] + +[[package]] +name = "multiversx-sc-codec-derive" +version = "0.21.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dffba1dce273ed5b61ee1b90aeea5c8c744617d0f12624f620768c144d83e753" +dependencies = [ + "hex", + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "multiversx-sc-derive" +version = "0.53.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4c17fdf90fafca2f19085ae67b0502d9f71bf8ab1be3c83808eb88e02a8c18b9" +dependencies = [ + "hex", + "proc-macro2", + "quote", + "radix_trie", + "syn", +] + +[[package]] +name = "multiversx-sc-wasm-adapter" +version = "0.53.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "20659915a4377d375c46d7f237e810053a03f7e084fad6362dd5748a7233defb" +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.19" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "071dfc062690e90b734c0b2273ce72ad0ffa95f0c74596bc250dcfd960262841" +dependencies = [ + "autocfg", +] + +[[package]] +name = "proc-macro2" +version = "1.0.86" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5e719e8df665df0d1c8fbfd238015744736151d4445ec0836b8e628aae103b77" +dependencies = [ + "unicode-ident", +] + +[[package]] +name = "quote" +version = "1.0.37" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b5b9d34b8991d19d98081b46eacdd8eb58c6f2b201139f7c5f643cc155a633af" +dependencies = [ + "proc-macro2", +] + +[[package]] +name = "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.77" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9f35bcdf61fd8e7be6caf75f429fdca8beb3ed76584befb503b1569faee373ed" +dependencies = [ + "proc-macro2", + "quote", + "unicode-ident", +] + +[[package]] +name = "testing-sc" +version = "0.0.0" +dependencies = [ + "multiversx-sc", +] + +[[package]] +name = "testing-sc-wasm" +version = "0.0.0" +dependencies = [ + "multiversx-sc-wasm-adapter", + "testing-sc", +] + +[[package]] +name = "unicode-ident" +version = "1.0.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e91b56cd4cadaeb79bbf1a5645f6b4f8dc5bde8834ad5894a8db35fda9efa1fe" + +[[package]] +name = "unwrap-infallible" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "151ac09978d3c2862c4e39b557f4eceee2cc72150bc4cb4f16abf061b6e381fb" diff --git a/testing-sc/wasm/Cargo.toml b/testing-sc/wasm/Cargo.toml new file mode 100644 index 00000000..96001459 --- /dev/null +++ b/testing-sc/wasm/Cargo.toml @@ -0,0 +1,34 @@ +# Code generated by the multiversx-sc build system. DO NOT EDIT. + +# ########################################## +# ############## AUTO-GENERATED ############# +# ########################################## + +[package] +name = "testing-sc-wasm" +version = "0.0.0" +edition = "2021" +publish = false + +[lib] +crate-type = ["cdylib"] + +[profile.release] +codegen-units = 1 +opt-level = "z" +lto = true +debug = false +panic = "abort" +overflow-checks = false + +[profile.dev] +panic = "abort" + +[dependencies.testing-sc] +path = ".." + +[dependencies.multiversx-sc-wasm-adapter] +version = "0.53.2" + +[workspace] +members = ["."] diff --git a/testing-sc/wasm/src/lib.rs b/testing-sc/wasm/src/lib.rs new file mode 100644 index 00000000..c0e46075 --- /dev/null +++ b/testing-sc/wasm/src/lib.rs @@ -0,0 +1,26 @@ +// Code generated by the multiversx-sc build system. DO NOT EDIT. + +//////////////////////////////////////////////////// +////////////////// AUTO-GENERATED ////////////////// +//////////////////////////////////////////////////// + +// Init: 1 +// Upgrade: 1 +// Endpoints: 0 +// Async Callback (empty): 1 +// Total number of exported functions: 3 + +#![no_std] + +multiversx_sc_wasm_adapter::allocator!(); +multiversx_sc_wasm_adapter::panic_handler!(); + +multiversx_sc_wasm_adapter::endpoints! { + testing_sc + ( + init => init + upgrade => upgrade + ) +} + +multiversx_sc_wasm_adapter::async_callback_empty! {} From ca0cf8b82878e0fb865205d1e48f1c16e34c8a29 Mon Sep 17 00:00:00 2001 From: Andrei Baltariu Date: Fri, 18 Oct 2024 17:59:30 +0300 Subject: [PATCH 464/523] Added setup for `testing_sc` Signed-off-by: Andrei Baltariu --- esdt-safe/interactor/src/interactor_main.rs | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/esdt-safe/interactor/src/interactor_main.rs b/esdt-safe/interactor/src/interactor_main.rs index 79ad04bd..6fac1786 100644 --- a/esdt-safe/interactor/src/interactor_main.rs +++ b/esdt-safe/interactor/src/interactor_main.rs @@ -144,6 +144,7 @@ struct ContractInteract { fee_market_code: String, price_aggregator_code: String, header_verifier_code: String, + testing_sc_code: String, state: State, } @@ -184,12 +185,18 @@ impl ContractInteract { .to_string(); let price_aggregator_output_path = - "../contract-codes/multiversx-price-aggregator-sc.mxsc.json".to_string(); + "../contract-codes/multiversx-price-aggregator-sc.mxsc.json"; let price_aggregator_code = repo_dir .join(price_aggregator_output_path) .to_string_lossy() .to_string(); + let testing_sc_output_path = "testing-sc/output/testing-sc.mxsc.json"; + let testing_sc_code = repo_dir + .join(testing_sc_output_path) + .to_string_lossy() + .to_string(); + ContractInteract { interactor, wallet_address, @@ -201,6 +208,7 @@ impl ContractInteract { fee_market_code, price_aggregator_code, header_verifier_code, + testing_sc_code, state: State::load_state(), } } @@ -321,6 +329,10 @@ impl ContractInteract { println!("new header_verifier_address: {new_address_bech32}"); } + async fn deploy_testing_contract(&mut self) { + let testing_sc_code_path = MxscPath::new(&self.testing_sc_code); + } + async fn upgrade(&mut self) { let code_path = MxscPath::new(&self.esdt_safe_code); @@ -537,9 +549,10 @@ impl ContractInteract { } async fn execute_operations_with_error(&mut self, error_msg: ExpectError<'_>) { - let (tokens, data) = self.setup_payments().await; + let tokens = self.setup_payments().await; + let operation_data = self.setup_operation_data(false).await; let to = managed_address!(&self.bob_address); - let operation = Operation::new(to, tokens, data); + let operation = Operation::new(to, tokens, operation_data); let operation_hash = self.get_operation_hash(&operation); let response = self From cfc6eaa481b4eccfc264d4f16f55bb3af9fad196 Mon Sep 17 00:00:00 2001 From: Andrei Baltariu Date: Fri, 18 Oct 2024 17:59:44 +0300 Subject: [PATCH 465/523] Added proxy generation for `testing_sc` Signed-off-by: Andrei Baltariu --- .../src/proxies/testing_sc_proxy.rs | 95 ++++ esdt-safe/interactor/src/proxy.rs | 458 ++++++++++++++++++ testing-sc/Cargo.toml | 2 +- testing-sc/sc-config.toml | 19 + testing-sc/src/{testing_sc.rs => lib.rs} | 7 +- testing-sc/wasm-testing-sc-full/Cargo.lock | 188 +++++++ testing-sc/wasm-testing-sc-full/Cargo.toml | 34 ++ testing-sc/wasm-testing-sc-full/src/lib.rs | 27 ++ testing-sc/wasm-testing-view/Cargo.lock | 188 +++++++ testing-sc/wasm-testing-view/Cargo.toml | 34 ++ testing-sc/wasm-testing-view/src/lib.rs | 25 + testing-sc/wasm/src/lib.rs | 5 +- 12 files changed, 1078 insertions(+), 4 deletions(-) create mode 100644 esdt-safe/interactor/src/proxies/testing_sc_proxy.rs create mode 100644 esdt-safe/interactor/src/proxy.rs create mode 100644 testing-sc/sc-config.toml rename testing-sc/src/{testing_sc.rs => lib.rs} (55%) create mode 100644 testing-sc/wasm-testing-sc-full/Cargo.lock create mode 100644 testing-sc/wasm-testing-sc-full/Cargo.toml create mode 100644 testing-sc/wasm-testing-sc-full/src/lib.rs create mode 100644 testing-sc/wasm-testing-view/Cargo.lock create mode 100644 testing-sc/wasm-testing-view/Cargo.toml create mode 100644 testing-sc/wasm-testing-view/src/lib.rs diff --git a/esdt-safe/interactor/src/proxies/testing_sc_proxy.rs b/esdt-safe/interactor/src/proxies/testing_sc_proxy.rs new file mode 100644 index 00000000..ecfec395 --- /dev/null +++ b/esdt-safe/interactor/src/proxies/testing_sc_proxy.rs @@ -0,0 +1,95 @@ +// Code generated by the multiversx-sc proxy generator. DO NOT EDIT. + +//////////////////////////////////////////////////// +////////////////// AUTO-GENERATED ////////////////// +//////////////////////////////////////////////////// + +#![allow(dead_code)] +#![allow(clippy::all)] + +use multiversx_sc::proxy_imports::*; + +pub struct TestingScProxy; + +impl TxProxyTrait for TestingScProxy +where + Env: TxEnv, + From: TxFrom, + To: TxTo, + Gas: TxGas, +{ + type TxProxyMethods = TestingScProxyMethods; + + fn proxy_methods(self, tx: Tx) -> Self::TxProxyMethods { + TestingScProxyMethods { wrapped_tx: tx } + } +} + +pub struct TestingScProxyMethods +where + Env: TxEnv, + From: TxFrom, + To: TxTo, + Gas: TxGas, +{ + wrapped_tx: Tx, +} + +#[rustfmt::skip] +impl TestingScProxyMethods +where + Env: TxEnv, + Env::Api: VMApi, + From: TxFrom, + Gas: TxGas, +{ + pub fn init( + self, + ) -> TxTypedDeploy { + self.wrapped_tx + .payment(NotPayable) + .raw_deploy() + .original_result() + } +} + +#[rustfmt::skip] +impl TestingScProxyMethods +where + Env: TxEnv, + Env::Api: VMApi, + From: TxFrom, + To: TxTo, + Gas: TxGas, +{ + pub fn upgrade( + self, + ) -> TxTypedUpgrade { + self.wrapped_tx + .payment(NotPayable) + .raw_upgrade() + .original_result() + } +} + +#[rustfmt::skip] +impl TestingScProxyMethods +where + Env: TxEnv, + Env::Api: VMApi, + From: TxFrom, + To: TxTo, + Gas: TxGas, +{ + pub fn hello< + Arg0: ProxyArg>, + >( + self, + value: Arg0, + ) -> TxTypedCall { + self.wrapped_tx + .raw_call("hello") + .argument(&value) + .original_result() + } +} diff --git a/esdt-safe/interactor/src/proxy.rs b/esdt-safe/interactor/src/proxy.rs new file mode 100644 index 00000000..81e2e31d --- /dev/null +++ b/esdt-safe/interactor/src/proxy.rs @@ -0,0 +1,458 @@ +// Code generated by the multiversx-sc proxy generator. DO NOT EDIT. + +//////////////////////////////////////////////////// +////////////////// AUTO-GENERATED ////////////////// +//////////////////////////////////////////////////// + +#![allow(dead_code)] +#![allow(clippy::all)] + +use multiversx_sc::proxy_imports::*; + +pub struct EsdtSafeProxy; + +impl TxProxyTrait for EsdtSafeProxy +where + Env: TxEnv, + From: TxFrom, + To: TxTo, + Gas: TxGas, +{ + type TxProxyMethods = EsdtSafeProxyMethods; + + fn proxy_methods(self, tx: Tx) -> Self::TxProxyMethods { + EsdtSafeProxyMethods { wrapped_tx: tx } + } +} + +pub struct EsdtSafeProxyMethods +where + Env: TxEnv, + From: TxFrom, + To: TxTo, + Gas: TxGas, +{ + wrapped_tx: Tx, +} + +#[rustfmt::skip] +impl EsdtSafeProxyMethods +where + Env: TxEnv, + Env::Api: VMApi, + From: TxFrom, + Gas: TxGas, +{ + pub fn init< + Arg0: ProxyArg, + >( + self, + is_sovereign_chain: Arg0, + ) -> TxTypedDeploy { + self.wrapped_tx + .payment(NotPayable) + .raw_deploy() + .argument(&is_sovereign_chain) + .original_result() + } +} + +#[rustfmt::skip] +impl EsdtSafeProxyMethods +where + Env: TxEnv, + Env::Api: VMApi, + From: TxFrom, + To: TxTo, + Gas: TxGas, +{ + pub fn upgrade( + self, + ) -> TxTypedUpgrade { + self.wrapped_tx + .payment(NotPayable) + .raw_upgrade() + .original_result() + } +} + +#[rustfmt::skip] +impl EsdtSafeProxyMethods +where + Env: TxEnv, + Env::Api: VMApi, + From: TxFrom, + To: TxTo, + Gas: TxGas, +{ + pub fn set_fee_market_address< + Arg0: ProxyArg>, + >( + self, + fee_market_address: Arg0, + ) -> TxTypedCall { + self.wrapped_tx + .payment(NotPayable) + .raw_call("setFeeMarketAddress") + .argument(&fee_market_address) + .original_result() + } + + pub fn set_header_verifier_address< + Arg0: ProxyArg>, + >( + self, + header_verifier_address: Arg0, + ) -> TxTypedCall { + self.wrapped_tx + .payment(NotPayable) + .raw_call("setHeaderVerifierAddress") + .argument(&header_verifier_address) + .original_result() + } + + pub fn set_max_user_tx_gas_limit< + Arg0: ProxyArg, + >( + self, + max_user_tx_gas_limit: Arg0, + ) -> TxTypedCall { + self.wrapped_tx + .payment(NotPayable) + .raw_call("setMaxTxGasLimit") + .argument(&max_user_tx_gas_limit) + .original_result() + } + + pub fn set_banned_endpoint< + Arg0: ProxyArg>, + >( + self, + endpoint_name: Arg0, + ) -> TxTypedCall { + self.wrapped_tx + .payment(NotPayable) + .raw_call("setBannedEndpoint") + .argument(&endpoint_name) + .original_result() + } + + pub fn deposit< + Arg0: ProxyArg>, + Arg1: ProxyArg, ManagedVec>>>>, + >( + self, + to: Arg0, + optional_transfer_data: Arg1, + ) -> TxTypedCall { + self.wrapped_tx + .raw_call("deposit") + .argument(&to) + .argument(&optional_transfer_data) + .original_result() + } + + pub fn set_min_valid_signers< + Arg0: ProxyArg, + >( + self, + new_value: Arg0, + ) -> TxTypedCall { + self.wrapped_tx + .payment(NotPayable) + .raw_call("setMinValidSigners") + .argument(&new_value) + .original_result() + } + + pub fn add_signers< + Arg0: ProxyArg>>, + >( + self, + signers: Arg0, + ) -> TxTypedCall { + self.wrapped_tx + .payment(NotPayable) + .raw_call("addSigners") + .argument(&signers) + .original_result() + } + + pub fn remove_signers< + Arg0: ProxyArg>>, + >( + self, + signers: Arg0, + ) -> TxTypedCall { + self.wrapped_tx + .payment(NotPayable) + .raw_call("removeSigners") + .argument(&signers) + .original_result() + } + + pub fn register_token< + Arg0: ProxyArg>, + Arg1: ProxyArg, + Arg2: ProxyArg>, + Arg3: ProxyArg>, + Arg4: ProxyArg, + >( + self, + sov_token_id: Arg0, + token_type: Arg1, + token_display_name: Arg2, + token_ticker: Arg3, + num_decimals: Arg4, + ) -> TxTypedCall { + self.wrapped_tx + .raw_call("registerToken") + .argument(&sov_token_id) + .argument(&token_type) + .argument(&token_display_name) + .argument(&token_ticker) + .argument(&num_decimals) + .original_result() + } + + pub fn execute_operations< + Arg0: ProxyArg>, + Arg1: ProxyArg>, + >( + self, + hash_of_hashes: Arg0, + operation: Arg1, + ) -> TxTypedCall { + self.wrapped_tx + .payment(NotPayable) + .raw_call("executeBridgeOps") + .argument(&hash_of_hashes) + .argument(&operation) + .original_result() + } + + pub fn set_max_tx_batch_size< + Arg0: ProxyArg, + >( + self, + new_max_tx_batch_size: Arg0, + ) -> TxTypedCall { + self.wrapped_tx + .payment(NotPayable) + .raw_call("setMaxTxBatchSize") + .argument(&new_max_tx_batch_size) + .original_result() + } + + pub fn set_max_tx_batch_block_duration< + Arg0: ProxyArg, + >( + self, + new_max_tx_batch_block_duration: Arg0, + ) -> TxTypedCall { + self.wrapped_tx + .payment(NotPayable) + .raw_call("setMaxTxBatchBlockDuration") + .argument(&new_max_tx_batch_block_duration) + .original_result() + } + + pub fn get_current_tx_batch( + self, + ) -> TxTypedCall, ManagedAddress, ManagedVec>, ManagedVec>, Option>>>>>> { + self.wrapped_tx + .payment(NotPayable) + .raw_call("getCurrentTxBatch") + .original_result() + } + + pub fn get_first_batch_any_status( + self, + ) -> TxTypedCall, ManagedAddress, ManagedVec>, ManagedVec>, Option>>>>>> { + self.wrapped_tx + .payment(NotPayable) + .raw_call("getFirstBatchAnyStatus") + .original_result() + } + + pub fn get_batch< + Arg0: ProxyArg, + >( + self, + batch_id: Arg0, + ) -> TxTypedCall, ManagedAddress, ManagedVec>, ManagedVec>, Option>>>>>> { + self.wrapped_tx + .payment(NotPayable) + .raw_call("getBatch") + .argument(&batch_id) + .original_result() + } + + pub fn get_batch_status< + Arg0: ProxyArg, + >( + self, + batch_id: Arg0, + ) -> TxTypedCall> { + self.wrapped_tx + .payment(NotPayable) + .raw_call("getBatchStatus") + .argument(&batch_id) + .original_result() + } + + pub fn first_batch_id( + self, + ) -> TxTypedCall { + self.wrapped_tx + .payment(NotPayable) + .raw_call("getFirstBatchId") + .original_result() + } + + pub fn last_batch_id( + self, + ) -> TxTypedCall { + self.wrapped_tx + .payment(NotPayable) + .raw_call("getLastBatchId") + .original_result() + } + + pub fn set_max_bridged_amount< + Arg0: ProxyArg>, + Arg1: ProxyArg>, + >( + self, + token_id: Arg0, + max_amount: Arg1, + ) -> TxTypedCall { + self.wrapped_tx + .payment(NotPayable) + .raw_call("setMaxBridgedAmount") + .argument(&token_id) + .argument(&max_amount) + .original_result() + } + + pub fn max_bridged_amount< + Arg0: ProxyArg>, + >( + self, + token_id: Arg0, + ) -> TxTypedCall> { + self.wrapped_tx + .payment(NotPayable) + .raw_call("getMaxBridgedAmount") + .argument(&token_id) + .original_result() + } + + pub fn end_setup_phase( + self, + ) -> TxTypedCall { + self.wrapped_tx + .payment(NotPayable) + .raw_call("endSetupPhase") + .original_result() + } + + /// Tokens in the whitelist can be transferred without fees + pub fn add_tokens_to_whitelist< + Arg0: ProxyArg>>, + >( + self, + tokens: Arg0, + ) -> TxTypedCall { + self.wrapped_tx + .payment(NotPayable) + .raw_call("addTokensToWhitelist") + .argument(&tokens) + .original_result() + } + + pub fn remove_tokens_from_whitelist< + Arg0: ProxyArg>>, + >( + self, + tokens: Arg0, + ) -> TxTypedCall { + self.wrapped_tx + .payment(NotPayable) + .raw_call("removeTokensFromWhitelist") + .argument(&tokens) + .original_result() + } + + /// Tokens in blacklist cannot be transferred + pub fn add_tokens_to_blacklist< + Arg0: ProxyArg>>, + >( + self, + tokens: Arg0, + ) -> TxTypedCall { + self.wrapped_tx + .payment(NotPayable) + .raw_call("addTokensToBlacklist") + .argument(&tokens) + .original_result() + } + + pub fn remove_tokens_from_blacklist< + Arg0: ProxyArg>>, + >( + self, + tokens: Arg0, + ) -> TxTypedCall { + self.wrapped_tx + .payment(NotPayable) + .raw_call("removeTokensFromBlacklist") + .argument(&tokens) + .original_result() + } + + pub fn token_whitelist( + self, + ) -> TxTypedCall>> { + self.wrapped_tx + .payment(NotPayable) + .raw_call("getTokenWhitelist") + .original_result() + } + + pub fn token_blacklist( + self, + ) -> TxTypedCall>> { + self.wrapped_tx + .payment(NotPayable) + .raw_call("getTokenBlacklist") + .original_result() + } + + pub fn pause_endpoint( + self, + ) -> TxTypedCall { + self.wrapped_tx + .payment(NotPayable) + .raw_call("pause") + .original_result() + } + + pub fn unpause_endpoint( + self, + ) -> TxTypedCall { + self.wrapped_tx + .payment(NotPayable) + .raw_call("unpause") + .original_result() + } + + pub fn paused_status( + self, + ) -> TxTypedCall { + self.wrapped_tx + .payment(NotPayable) + .raw_call("isPaused") + .original_result() + } +} diff --git a/testing-sc/Cargo.toml b/testing-sc/Cargo.toml index f698888c..ed563ac1 100644 --- a/testing-sc/Cargo.toml +++ b/testing-sc/Cargo.toml @@ -6,7 +6,7 @@ edition = "2021" authors = ["you"] [lib] -path = "src/testing_sc.rs" +path = "src/lib.rs" [dependencies.multiversx-sc] version = "0.53.2" diff --git a/testing-sc/sc-config.toml b/testing-sc/sc-config.toml new file mode 100644 index 00000000..637d7d75 --- /dev/null +++ b/testing-sc/sc-config.toml @@ -0,0 +1,19 @@ +[settings] +main = "main" + +[contracts.main] +name = "testing-sc" + +[contracts.full] +name = "testing-sc-full" +add-unlabelled = true +add-labels = ["testing-sc-external-view"] + +[contracts.view] +name = "testing-view" +external-view = true +add-unlabelled = false +add-labels = ["testing-sc-external-view"] + +[[proxy]] +path = "../esdt-safe/interactor/src/proxies/testing_sc_proxy.rs" diff --git a/testing-sc/src/testing_sc.rs b/testing-sc/src/lib.rs similarity index 55% rename from testing-sc/src/testing_sc.rs rename to testing-sc/src/lib.rs index 58e7ccc5..c77ccca1 100644 --- a/testing-sc/src/testing_sc.rs +++ b/testing-sc/src/lib.rs @@ -3,7 +3,6 @@ #[allow(unused_imports)] use multiversx_sc::imports::*; -/// An empty contract. To be used as a template when starting a new contract from scratch. #[multiversx_sc::contract] pub trait TestingSc { #[init] @@ -11,4 +10,10 @@ pub trait TestingSc { #[upgrade] fn upgrade(&self) {} + + #[payable("*")] + #[endpoint] + fn hello(&self, value: BigUint) { + require!(value > BigUint::zero(), "Value should be greater than 0") + } } diff --git a/testing-sc/wasm-testing-sc-full/Cargo.lock b/testing-sc/wasm-testing-sc-full/Cargo.lock new file mode 100644 index 00000000..b82eb6ce --- /dev/null +++ b/testing-sc/wasm-testing-sc-full/Cargo.lock @@ -0,0 +1,188 @@ +# This file is automatically @generated by Cargo. +# It is not intended for manual editing. +version = 3 + +[[package]] +name = "arrayvec" +version = "0.7.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7c02d123df017efcdfbd739ef81735b36c5ba83ec3c59c80a9d7ecc718f92e50" + +[[package]] +name = "autocfg" +version = "1.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ace50bade8e6234aa140d9a2f552bbee1db4d353f69b8217bc503490fc1a9f26" + +[[package]] +name = "bitflags" +version = "2.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b048fb63fd8b5923fc5aa7b340d8e156aec7ec02f0c78fa8a6ddc2613f6f71de" + +[[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.53.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "75ea89a26f0aacda21437a8ae5ccfbefab99d8191942b3d2eddbcbf84f9866d7" +dependencies = [ + "bitflags", + "hex-literal", + "multiversx-sc-codec", + "multiversx-sc-derive", + "num-traits", + "unwrap-infallible", +] + +[[package]] +name = "multiversx-sc-codec" +version = "0.21.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "007d7a5a8534e5dc9128cb8f15a65a21dd378e135c6016c7cd1491cd012bc8cb" +dependencies = [ + "arrayvec", + "multiversx-sc-codec-derive", + "unwrap-infallible", +] + +[[package]] +name = "multiversx-sc-codec-derive" +version = "0.21.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dffba1dce273ed5b61ee1b90aeea5c8c744617d0f12624f620768c144d83e753" +dependencies = [ + "hex", + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "multiversx-sc-derive" +version = "0.53.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4c17fdf90fafca2f19085ae67b0502d9f71bf8ab1be3c83808eb88e02a8c18b9" +dependencies = [ + "hex", + "proc-macro2", + "quote", + "radix_trie", + "syn", +] + +[[package]] +name = "multiversx-sc-wasm-adapter" +version = "0.53.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "20659915a4377d375c46d7f237e810053a03f7e084fad6362dd5748a7233defb" +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.19" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "071dfc062690e90b734c0b2273ce72ad0ffa95f0c74596bc250dcfd960262841" +dependencies = [ + "autocfg", +] + +[[package]] +name = "proc-macro2" +version = "1.0.86" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5e719e8df665df0d1c8fbfd238015744736151d4445ec0836b8e628aae103b77" +dependencies = [ + "unicode-ident", +] + +[[package]] +name = "quote" +version = "1.0.37" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b5b9d34b8991d19d98081b46eacdd8eb58c6f2b201139f7c5f643cc155a633af" +dependencies = [ + "proc-macro2", +] + +[[package]] +name = "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.77" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9f35bcdf61fd8e7be6caf75f429fdca8beb3ed76584befb503b1569faee373ed" +dependencies = [ + "proc-macro2", + "quote", + "unicode-ident", +] + +[[package]] +name = "testing-sc" +version = "0.0.0" +dependencies = [ + "multiversx-sc", +] + +[[package]] +name = "testing-sc-full-wasm" +version = "0.0.0" +dependencies = [ + "multiversx-sc-wasm-adapter", + "testing-sc", +] + +[[package]] +name = "unicode-ident" +version = "1.0.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e91b56cd4cadaeb79bbf1a5645f6b4f8dc5bde8834ad5894a8db35fda9efa1fe" + +[[package]] +name = "unwrap-infallible" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "151ac09978d3c2862c4e39b557f4eceee2cc72150bc4cb4f16abf061b6e381fb" diff --git a/testing-sc/wasm-testing-sc-full/Cargo.toml b/testing-sc/wasm-testing-sc-full/Cargo.toml new file mode 100644 index 00000000..59a01838 --- /dev/null +++ b/testing-sc/wasm-testing-sc-full/Cargo.toml @@ -0,0 +1,34 @@ +# Code generated by the multiversx-sc build system. DO NOT EDIT. + +# ########################################## +# ############## AUTO-GENERATED ############# +# ########################################## + +[package] +name = "testing-sc-full-wasm" +version = "0.0.0" +edition = "2021" +publish = false + +[lib] +crate-type = ["cdylib"] + +[profile.release] +codegen-units = 1 +opt-level = "z" +lto = true +debug = false +panic = "abort" +overflow-checks = false + +[profile.dev] +panic = "abort" + +[dependencies.testing-sc] +path = ".." + +[dependencies.multiversx-sc-wasm-adapter] +version = "0.53.2" + +[workspace] +members = ["."] diff --git a/testing-sc/wasm-testing-sc-full/src/lib.rs b/testing-sc/wasm-testing-sc-full/src/lib.rs new file mode 100644 index 00000000..77d113d2 --- /dev/null +++ b/testing-sc/wasm-testing-sc-full/src/lib.rs @@ -0,0 +1,27 @@ +// Code generated by the multiversx-sc build system. DO NOT EDIT. + +//////////////////////////////////////////////////// +////////////////// AUTO-GENERATED ////////////////// +//////////////////////////////////////////////////// + +// Init: 1 +// Upgrade: 1 +// Endpoints: 1 +// Async Callback (empty): 1 +// Total number of exported functions: 4 + +#![no_std] + +multiversx_sc_wasm_adapter::allocator!(); +multiversx_sc_wasm_adapter::panic_handler!(); + +multiversx_sc_wasm_adapter::endpoints! { + testing_sc + ( + init => init + upgrade => upgrade + hello => hello + ) +} + +multiversx_sc_wasm_adapter::async_callback_empty! {} diff --git a/testing-sc/wasm-testing-view/Cargo.lock b/testing-sc/wasm-testing-view/Cargo.lock new file mode 100644 index 00000000..7cbac8f4 --- /dev/null +++ b/testing-sc/wasm-testing-view/Cargo.lock @@ -0,0 +1,188 @@ +# This file is automatically @generated by Cargo. +# It is not intended for manual editing. +version = 3 + +[[package]] +name = "arrayvec" +version = "0.7.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7c02d123df017efcdfbd739ef81735b36c5ba83ec3c59c80a9d7ecc718f92e50" + +[[package]] +name = "autocfg" +version = "1.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ace50bade8e6234aa140d9a2f552bbee1db4d353f69b8217bc503490fc1a9f26" + +[[package]] +name = "bitflags" +version = "2.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b048fb63fd8b5923fc5aa7b340d8e156aec7ec02f0c78fa8a6ddc2613f6f71de" + +[[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.53.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "75ea89a26f0aacda21437a8ae5ccfbefab99d8191942b3d2eddbcbf84f9866d7" +dependencies = [ + "bitflags", + "hex-literal", + "multiversx-sc-codec", + "multiversx-sc-derive", + "num-traits", + "unwrap-infallible", +] + +[[package]] +name = "multiversx-sc-codec" +version = "0.21.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "007d7a5a8534e5dc9128cb8f15a65a21dd378e135c6016c7cd1491cd012bc8cb" +dependencies = [ + "arrayvec", + "multiversx-sc-codec-derive", + "unwrap-infallible", +] + +[[package]] +name = "multiversx-sc-codec-derive" +version = "0.21.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dffba1dce273ed5b61ee1b90aeea5c8c744617d0f12624f620768c144d83e753" +dependencies = [ + "hex", + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "multiversx-sc-derive" +version = "0.53.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4c17fdf90fafca2f19085ae67b0502d9f71bf8ab1be3c83808eb88e02a8c18b9" +dependencies = [ + "hex", + "proc-macro2", + "quote", + "radix_trie", + "syn", +] + +[[package]] +name = "multiversx-sc-wasm-adapter" +version = "0.53.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "20659915a4377d375c46d7f237e810053a03f7e084fad6362dd5748a7233defb" +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.19" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "071dfc062690e90b734c0b2273ce72ad0ffa95f0c74596bc250dcfd960262841" +dependencies = [ + "autocfg", +] + +[[package]] +name = "proc-macro2" +version = "1.0.86" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5e719e8df665df0d1c8fbfd238015744736151d4445ec0836b8e628aae103b77" +dependencies = [ + "unicode-ident", +] + +[[package]] +name = "quote" +version = "1.0.37" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b5b9d34b8991d19d98081b46eacdd8eb58c6f2b201139f7c5f643cc155a633af" +dependencies = [ + "proc-macro2", +] + +[[package]] +name = "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.77" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9f35bcdf61fd8e7be6caf75f429fdca8beb3ed76584befb503b1569faee373ed" +dependencies = [ + "proc-macro2", + "quote", + "unicode-ident", +] + +[[package]] +name = "testing-sc" +version = "0.0.0" +dependencies = [ + "multiversx-sc", +] + +[[package]] +name = "testing-view-wasm" +version = "0.0.0" +dependencies = [ + "multiversx-sc-wasm-adapter", + "testing-sc", +] + +[[package]] +name = "unicode-ident" +version = "1.0.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e91b56cd4cadaeb79bbf1a5645f6b4f8dc5bde8834ad5894a8db35fda9efa1fe" + +[[package]] +name = "unwrap-infallible" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "151ac09978d3c2862c4e39b557f4eceee2cc72150bc4cb4f16abf061b6e381fb" diff --git a/testing-sc/wasm-testing-view/Cargo.toml b/testing-sc/wasm-testing-view/Cargo.toml new file mode 100644 index 00000000..31f09769 --- /dev/null +++ b/testing-sc/wasm-testing-view/Cargo.toml @@ -0,0 +1,34 @@ +# Code generated by the multiversx-sc build system. DO NOT EDIT. + +# ########################################## +# ############## AUTO-GENERATED ############# +# ########################################## + +[package] +name = "testing-view-wasm" +version = "0.0.0" +edition = "2021" +publish = false + +[lib] +crate-type = ["cdylib"] + +[profile.release] +codegen-units = 1 +opt-level = "z" +lto = true +debug = false +panic = "abort" +overflow-checks = false + +[profile.dev] +panic = "abort" + +[dependencies.testing-sc] +path = ".." + +[dependencies.multiversx-sc-wasm-adapter] +version = "0.53.2" + +[workspace] +members = ["."] diff --git a/testing-sc/wasm-testing-view/src/lib.rs b/testing-sc/wasm-testing-view/src/lib.rs new file mode 100644 index 00000000..4b0720f8 --- /dev/null +++ b/testing-sc/wasm-testing-view/src/lib.rs @@ -0,0 +1,25 @@ +// Code generated by the multiversx-sc build system. DO NOT EDIT. + +//////////////////////////////////////////////////// +////////////////// AUTO-GENERATED ////////////////// +//////////////////////////////////////////////////// + +// Init: 1 +// Endpoints: 0 +// Async Callback (empty): 1 +// Total number of exported functions: 2 + +#![no_std] + +multiversx_sc_wasm_adapter::allocator!(); +multiversx_sc_wasm_adapter::panic_handler!(); + +multiversx_sc_wasm_adapter::external_view_init! {} + +multiversx_sc_wasm_adapter::external_view_endpoints! { + testing_sc + ( + ) +} + +multiversx_sc_wasm_adapter::async_callback_empty! {} diff --git a/testing-sc/wasm/src/lib.rs b/testing-sc/wasm/src/lib.rs index c0e46075..77d113d2 100644 --- a/testing-sc/wasm/src/lib.rs +++ b/testing-sc/wasm/src/lib.rs @@ -6,9 +6,9 @@ // Init: 1 // Upgrade: 1 -// Endpoints: 0 +// Endpoints: 1 // Async Callback (empty): 1 -// Total number of exported functions: 3 +// Total number of exported functions: 4 #![no_std] @@ -20,6 +20,7 @@ multiversx_sc_wasm_adapter::endpoints! { ( init => init upgrade => upgrade + hello => hello ) } From a10c0dc0255146272a5b69b1d56d5b17e81fa44a Mon Sep 17 00:00:00 2001 From: Andrei Baltariu Date: Fri, 18 Oct 2024 18:03:08 +0300 Subject: [PATCH 466/523] Added `testing_sc` deploy function Signed-off-by: Andrei Baltariu --- esdt-safe/interactor/src/interactor_main.rs | 27 +++++++++++++++++++++ esdt-safe/interactor/src/proxies/mod.rs | 1 + 2 files changed, 28 insertions(+) diff --git a/esdt-safe/interactor/src/interactor_main.rs b/esdt-safe/interactor/src/interactor_main.rs index 6fac1786..6fa46fb0 100644 --- a/esdt-safe/interactor/src/interactor_main.rs +++ b/esdt-safe/interactor/src/interactor_main.rs @@ -17,6 +17,7 @@ use std::{ io::{Read, Write}, path::Path, }; +use testing_sc_proxy::TestingScProxy; use transaction::{GasLimit, Operation, OperationData, PaymentsVec}; use transaction::{OperationEsdtPayment, TransferData}; const GATEWAY: &str = sdk::gateway::DEVNET_GATEWAY; @@ -76,6 +77,7 @@ struct State { fee_market_address: Option, price_aggregator_address: Option, header_verifier_address: Option, + testing_sc_address: Option, } impl State { @@ -108,6 +110,10 @@ impl State { self.header_verifier_address = Some(address); } + pub fn set_testing_sc_address(&mut self, address: Bech32Address) { + self.testing_sc_address = Some(address); + } + /// Returns the contract address pub fn current_address(&self) -> &Bech32Address { self.contract_address @@ -331,6 +337,27 @@ impl ContractInteract { async fn deploy_testing_contract(&mut self) { let testing_sc_code_path = MxscPath::new(&self.testing_sc_code); + + let new_address = self + .interactor + .tx() + .from(&self.wallet_address) + .gas(100_000_000u64) + .typed(TestingScProxy) + .init() + .code(testing_sc_code_path) + .returns(ReturnsNewAddress) + .prepare_async() + .run() + .await; + + let new_address_bech32 = bech32::encode(&new_address); + self.state + .set_testing_sc_address(Bech32Address::from_bech32_string( + new_address_bech32.clone(), + )); + + println!("new testing_sc_address: {new_address_bech32}"); } async fn upgrade(&mut self) { diff --git a/esdt-safe/interactor/src/proxies/mod.rs b/esdt-safe/interactor/src/proxies/mod.rs index 540750df..171e160b 100644 --- a/esdt-safe/interactor/src/proxies/mod.rs +++ b/esdt-safe/interactor/src/proxies/mod.rs @@ -2,3 +2,4 @@ pub mod fee_market_proxy; pub mod header_verifier_proxy; pub mod price_aggregator_proxy; pub mod proxy; +pub mod testing_sc_proxy; From 04df5ee7923d581fd4eec2d8a004d664c05b98c6 Mon Sep 17 00:00:00 2001 From: Andrei Baltariu Date: Fri, 18 Oct 2024 18:12:25 +0300 Subject: [PATCH 467/523] Added `call_hello_endpoint` Signed-off-by: Andrei Baltariu --- esdt-safe/interactor/src/interactor_main.rs | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/esdt-safe/interactor/src/interactor_main.rs b/esdt-safe/interactor/src/interactor_main.rs index 6fa46fb0..9230b6ef 100644 --- a/esdt-safe/interactor/src/interactor_main.rs +++ b/esdt-safe/interactor/src/interactor_main.rs @@ -128,6 +128,10 @@ impl State { pub fn get_fee_market_address(&self) -> Address { self.fee_market_address.clone().unwrap().to_address() } + + pub fn get_testing_sc_address(&self) -> Address { + self.testing_sc_address.clone().unwrap().to_address() + } } impl Drop for State { @@ -360,6 +364,23 @@ impl ContractInteract { println!("new testing_sc_address: {new_address_bech32}"); } + async fn call_hello_endpoint(&mut self, value: u64) { + let response = self + .interactor + .tx() + .from(&self.wallet_address) + .to(&self.state.get_testing_sc_address()) + .gas(50_000_000u64) + .typed(TestingScProxy) + .hello(value) + .returns(ReturnsResultUnmanaged) + .prepare_async() + .run() + .await; + + println!("Result: {response:?}"); + } + async fn upgrade(&mut self) { let code_path = MxscPath::new(&self.esdt_safe_code); From 7d1956aceb2d1bbbb40dd4e86d514c6926ec09d7 Mon Sep 17 00:00:00 2001 From: Andrei Baltariu Date: Fri, 18 Oct 2024 18:17:02 +0300 Subject: [PATCH 468/523] Used getter for adresses Signed-off-by: Andrei Baltariu --- esdt-safe/interactor/src/interactor_main.rs | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/esdt-safe/interactor/src/interactor_main.rs b/esdt-safe/interactor/src/interactor_main.rs index 9230b6ef..59028991 100644 --- a/esdt-safe/interactor/src/interactor_main.rs +++ b/esdt-safe/interactor/src/interactor_main.rs @@ -956,7 +956,7 @@ impl ContractInteract { .interactor .tx() .from(&self.wallet_address) - .to(self.state.fee_market_address.clone().unwrap().as_address()) + .to(self.state.get_fee_market_address()) .gas(30_000_000u64) .typed(FeeMarketProxy) .disable_fee(TOKEN_ID) @@ -973,12 +973,7 @@ impl ContractInteract { .interactor .tx() .from(&self.wallet_address) - .to(self - .state - .header_verifier_address - .clone() - .unwrap() - .as_address()) + .to(self.state.get_header_verifier_address()) .gas(30_000_000u64) .typed(HeaderverifierProxy) .set_esdt_safe_address(self.state.current_address()) From fb57d3f67faa905b82e89428b977266e5b8e46cb Mon Sep 17 00:00:00 2001 From: Andrei Baltariu Date: Fri, 18 Oct 2024 18:17:42 +0300 Subject: [PATCH 469/523] Removed commented code Signed-off-by: Andrei Baltariu --- esdt-safe/interactor/src/interactor_main.rs | 38 --------------------- 1 file changed, 38 deletions(-) diff --git a/esdt-safe/interactor/src/interactor_main.rs b/esdt-safe/interactor/src/interactor_main.rs index 59028991..b2f71a0d 100644 --- a/esdt-safe/interactor/src/interactor_main.rs +++ b/esdt-safe/interactor/src/interactor_main.rs @@ -277,44 +277,6 @@ impl ContractInteract { println!("new fee_market_address: {new_address_bech32}"); } - // async fn deploy_price_aggregator(&mut self) { - // let mut oracles = MultiValueEncoded::new(); - // let first_oracle_adress = managed_address!(&self.bob_address.clone()); - // let second_oracle_adress = managed_address!(&self.alice_address.clone()); - // let third_oracle_adress = managed_address!(&self.mike_address.clone()); - // let forth_oracle_address = managed_address!(&self.judy_address.clone()); - // oracles.push(first_oracle_adress); - // oracles.push(second_oracle_adress); - // oracles.push(third_oracle_adress); - // oracles.push(forth_oracle_address); - // - // let new_address = self - // .interactor - // .tx() - // .from(&self.wallet_address) - // .gas(100_000_000u64) - // .typed(price_aggregator_proxy::PriceAggregatorProxy) - // .init( - // TokenIdentifier::from_esdt_bytes(TOKEN_ID), - // BigUint::from(1u64), - // BigUint::from(1u64), - // 3u8, - // 3u8, - // oracles, - // ) - // .code(&self.price_aggregator_code) - // .returns(ReturnsNewAddress) - // .prepare_async() - // .run() - // .await; - // let new_address_bech32 = bech32::encode(&new_address); - // self.state - // .set_price_aggregator_address(Bech32Address::from_bech32_string( - // new_address_bech32.clone(), - // )); - // println!("new token_handler_address: {new_address_bech32}"); - // } - async fn deploy_header_verifier_contract(&mut self) { let header_verifier_code_path = MxscPath::new(&self.header_verifier_code); From aa1ef92acf1a2f513e195966edf58bd337d6c747 Mon Sep 17 00:00:00 2001 From: Andrei Baltariu Date: Fri, 18 Oct 2024 20:17:34 +0300 Subject: [PATCH 470/523] Added payments vec to use as transfer Signed-off-by: Andrei Baltariu --- esdt-safe/interactor/src/interactor_main.rs | 7 +++++++ esdt-safe/interactor/state.toml | 7 ++++--- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/esdt-safe/interactor/src/interactor_main.rs b/esdt-safe/interactor/src/interactor_main.rs index b2f71a0d..4b751c1d 100644 --- a/esdt-safe/interactor/src/interactor_main.rs +++ b/esdt-safe/interactor/src/interactor_main.rs @@ -541,12 +541,18 @@ impl ContractInteract { async fn execute_operations(&mut self, operation: &Operation) { let hash_of_hashes = sha256(&self.get_operation_hash(operation)); + let payment: ManagedVec> = operation + .tokens + .into_iter() + .map(|payment| payment.into()) + .collect(); let response = self .interactor .tx() .from(&self.wallet_address) .to(self.state.current_address()) + // .payment(payment) .gas(50_000_000u64) .typed(proxy::EsdtSafeProxy) .execute_operations(&hash_of_hashes, operation) @@ -1063,6 +1069,7 @@ async fn test_execute_operation_no_transfer_data() { interact.set_header_verifier_address().await; interact.unpause_endpoint().await; interact.header_verifier_set_esdt_address().await; + interact.deploy_testing_contract().await; let operation = interact.setup_operation(false).await; interact.register_operations(&operation).await; diff --git a/esdt-safe/interactor/state.toml b/esdt-safe/interactor/state.toml index 70c507e7..86cbc9ab 100644 --- a/esdt-safe/interactor/state.toml +++ b/esdt-safe/interactor/state.toml @@ -1,4 +1,5 @@ -contract_address = "erd1qqqqqqqqqqqqqpgq77gcenfwx5alyfpcmy9j7qthuhs8yj6qrruqp4u4qt" -fee_market_address = "erd1qqqqqqqqqqqqqpgqxa4sjvpr00eyq9vnccw38pca5xa3y0j5rruqf0wxx0" +contract_address = "erd1qqqqqqqqqqqqqpgqrm4wzw736rkp8zn66rn4jn7wvq5mv9mgrruq7ljpjg" +fee_market_address = "erd1qqqqqqqqqqqqqpgqa8fczxmgzytpa0gepnglrwrjv6zeenc3rruqzxjhh6" price_aggregator_address = "erd1qqqqqqqqqqqqqpgq4sshr5wx4ch5gd8847dsavahytt732kut7as6z3mv6" -header_verifier_address = "erd1qqqqqqqqqqqqqpgq8t0pym95x4npnzcg9agkkf26ct6m7eqjrruq69536m" +header_verifier_address = "erd1qqqqqqqqqqqqqpgq9dar9a3afukcuvhppathcgd9cmvpc06hrruqeul28l" +testing_sc_address = "erd1qqqqqqqqqqqqqpgqj6xx22q2xfsm3tts6gspqutd6hymlzc7rruq5rdvmy" From c78ec454cfc36924fe2f760d9491cf6d6da9518c Mon Sep 17 00:00:00 2001 From: Andrei Baltariu Date: Fri, 18 Oct 2024 20:36:50 +0300 Subject: [PATCH 471/523] Added call for the testing_sc contract Signed-off-by: Andrei Baltariu --- esdt-safe/interactor/src/interactor_main.rs | 12 +++--------- esdt-safe/interactor/state.toml | 8 ++++---- 2 files changed, 7 insertions(+), 13 deletions(-) diff --git a/esdt-safe/interactor/src/interactor_main.rs b/esdt-safe/interactor/src/interactor_main.rs index 4b751c1d..e338ecf1 100644 --- a/esdt-safe/interactor/src/interactor_main.rs +++ b/esdt-safe/interactor/src/interactor_main.rs @@ -541,18 +541,12 @@ impl ContractInteract { async fn execute_operations(&mut self, operation: &Operation) { let hash_of_hashes = sha256(&self.get_operation_hash(operation)); - let payment: ManagedVec> = operation - .tokens - .into_iter() - .map(|payment| payment.into()) - .collect(); let response = self .interactor .tx() .from(&self.wallet_address) .to(self.state.current_address()) - // .payment(payment) .gas(50_000_000u64) .typed(proxy::EsdtSafeProxy) .execute_operations(&hash_of_hashes, operation) @@ -953,7 +947,7 @@ impl ContractInteract { } async fn setup_operation(&mut self, has_transfer_data: bool) -> Operation { - let to = managed_address!(&self.state.get_fee_market_address()); + let to = managed_address!(&self.state.get_testing_sc_address()); let payments = self.setup_payments().await; let operation_data = self.setup_operation_data(has_transfer_data).await; @@ -966,11 +960,11 @@ impl ContractInteract { let transfer_data = if has_transfer_data { let mut args = ManagedVec::new(); - args.push(ManagedBuffer::from("arg1")); + args.push(ManagedBuffer::from("1")); Some(TransferData::new( 30_000_000u64, - ManagedBuffer::from("some_function"), + ManagedBuffer::from("hello"), args, )) } else { diff --git a/esdt-safe/interactor/state.toml b/esdt-safe/interactor/state.toml index 86cbc9ab..af658432 100644 --- a/esdt-safe/interactor/state.toml +++ b/esdt-safe/interactor/state.toml @@ -1,5 +1,5 @@ -contract_address = "erd1qqqqqqqqqqqqqpgqrm4wzw736rkp8zn66rn4jn7wvq5mv9mgrruq7ljpjg" -fee_market_address = "erd1qqqqqqqqqqqqqpgqa8fczxmgzytpa0gepnglrwrjv6zeenc3rruqzxjhh6" +contract_address = "erd1qqqqqqqqqqqqqpgqq8rrpwuqcsz9qrvzl3u0evfhsts536uurruqhpazdl" +fee_market_address = "erd1qqqqqqqqqqqqqpgqkr3uwzer9pswjwfemd4qrmhy8krvj7ysrruq7jqpxh" price_aggregator_address = "erd1qqqqqqqqqqqqqpgq4sshr5wx4ch5gd8847dsavahytt732kut7as6z3mv6" -header_verifier_address = "erd1qqqqqqqqqqqqqpgq9dar9a3afukcuvhppathcgd9cmvpc06hrruqeul28l" -testing_sc_address = "erd1qqqqqqqqqqqqqpgqj6xx22q2xfsm3tts6gspqutd6hymlzc7rruq5rdvmy" +header_verifier_address = "erd1qqqqqqqqqqqqqpgqynssknta6hks8u6za0res0cjxu7pepeerruq2xjq6n" +testing_sc_address = "erd1qqqqqqqqqqqqqpgqku8sgx0d5t5esuhgkaxmv92qlkduzeryrruqtz2lf4" From 4e878ee3e7c2db167e2840c21fac62a493f8bfb0 Mon Sep 17 00:00:00 2001 From: Andrei Baltariu Date: Mon, 21 Oct 2024 10:13:09 +0300 Subject: [PATCH 472/523] Other fixes Signed-off-by: Andrei Baltariu --- esdt-safe/interactor/src/interactor_main.rs | 21 +++++++++++---------- esdt-safe/interactor/state.toml | 8 ++++---- 2 files changed, 15 insertions(+), 14 deletions(-) diff --git a/esdt-safe/interactor/src/interactor_main.rs b/esdt-safe/interactor/src/interactor_main.rs index e338ecf1..71b28a11 100644 --- a/esdt-safe/interactor/src/interactor_main.rs +++ b/esdt-safe/interactor/src/interactor_main.rs @@ -22,7 +22,7 @@ use transaction::{GasLimit, Operation, OperationData, PaymentsVec}; use transaction::{OperationEsdtPayment, TransferData}; const GATEWAY: &str = sdk::gateway::DEVNET_GATEWAY; const STATE_FILE: &str = "state.toml"; -const TOKEN_ID: &[u8] = b"SVT-805b28"; +const TOKEN_ID: &[u8] = b"SOV-101252"; const WHITELISTED_TOKEN_ID: &[u8] = b"CHOCOLATE-daf625"; type OptionalTransferData = @@ -162,7 +162,7 @@ impl ContractInteract { async fn new() -> Self { let mut interactor = Interactor::new(GATEWAY).await; let wallet_address = interactor.register_wallet(test_wallets::bob()); - let bob_address = interactor.register_wallet(test_wallets::frank()); + let frank_address = interactor.register_wallet(test_wallets::frank()); let alice_address = interactor.register_wallet(test_wallets::alice()); let mike_address = interactor.register_wallet(test_wallets::mike()); let judy_address = interactor.register_wallet(test_wallets::judy()); @@ -210,7 +210,7 @@ impl ContractInteract { ContractInteract { interactor, wallet_address, - bob_address, + bob_address: frank_address, alice_address, mike_address, judy_address, @@ -510,9 +510,9 @@ impl ContractInteract { async fn register_token(&mut self) { let egld_amount = BigUint::::from(50_000_000_000_000_000u64); - let sov_token_id = TokenIdentifier::from_esdt_bytes(&b"SOV"[..]); + let sov_token_id = TokenIdentifier::from_esdt_bytes(b"SOV"); let token_type = EsdtTokenType::Fungible; - let token_display_name = ManagedBuffer::new_from_bytes(&b"SOVEREIGN"[..]); + let token_display_name = ManagedBuffer::new_from_bytes(&b"SOVEREIGN-TOKEN"[..]); let token_ticker = ManagedBuffer::new_from_bytes(&b"SVCT"[..]); let num_decimals = 18u32; @@ -547,7 +547,7 @@ impl ContractInteract { .tx() .from(&self.wallet_address) .to(self.state.current_address()) - .gas(50_000_000u64) + .gas(70_000_000u64) .typed(proxy::EsdtSafeProxy) .execute_operations(&hash_of_hashes, operation) .returns(ReturnsResultUnmanaged) @@ -971,13 +971,13 @@ impl ContractInteract { None }; - let transfer_data: OperationData = OperationData { + let operation_data: OperationData = OperationData { op_nonce: 1, op_sender, opt_transfer_data: transfer_data, }; - transfer_data + operation_data } async fn register_operations(&mut self, operation: &Operation) { @@ -1021,7 +1021,7 @@ impl ContractInteract { for token_id in token_ids { let payment: OperationEsdtPayment = OperationEsdtPayment { token_identifier: token_id.into(), - token_nonce: 1, + token_nonce: 0, token_data: EsdtTokenData::default(), }; @@ -1064,8 +1064,9 @@ async fn test_execute_operation_no_transfer_data() { interact.unpause_endpoint().await; interact.header_verifier_set_esdt_address().await; interact.deploy_testing_contract().await; + interact.register_token().await; - let operation = interact.setup_operation(false).await; + let operation = interact.setup_operation(true).await; interact.register_operations(&operation).await; interact.execute_operations(&operation).await; } diff --git a/esdt-safe/interactor/state.toml b/esdt-safe/interactor/state.toml index af658432..cc74d9b8 100644 --- a/esdt-safe/interactor/state.toml +++ b/esdt-safe/interactor/state.toml @@ -1,5 +1,5 @@ -contract_address = "erd1qqqqqqqqqqqqqpgqq8rrpwuqcsz9qrvzl3u0evfhsts536uurruqhpazdl" -fee_market_address = "erd1qqqqqqqqqqqqqpgqkr3uwzer9pswjwfemd4qrmhy8krvj7ysrruq7jqpxh" +contract_address = "erd1qqqqqqqqqqqqqpgqq7uzqmfqj378rtw69crq9a457esa7pcerruqqfdkrg" +fee_market_address = "erd1qqqqqqqqqqqqqpgq09rk7w07ws6gwgg0xr60nxsmenv5kwjvrruqql0a9k" price_aggregator_address = "erd1qqqqqqqqqqqqqpgq4sshr5wx4ch5gd8847dsavahytt732kut7as6z3mv6" -header_verifier_address = "erd1qqqqqqqqqqqqqpgqynssknta6hks8u6za0res0cjxu7pepeerruq2xjq6n" -testing_sc_address = "erd1qqqqqqqqqqqqqpgqku8sgx0d5t5esuhgkaxmv92qlkduzeryrruqtz2lf4" +header_verifier_address = "erd1qqqqqqqqqqqqqpgq5ysrr7d6yjp0skz2w0vgdxmv8f0zf7qyrruqck8qnk" +testing_sc_address = "erd1qqqqqqqqqqqqqpgqy23kdt7xt85xydk3ssv7rc0tngvx9zzvrruq3lh7w6" From f258d0f8065f9c9c57f213be0c031d8e00238dfb Mon Sep 17 00:00:00 2001 From: Andrei Baltariu Date: Mon, 21 Oct 2024 11:43:39 +0300 Subject: [PATCH 473/523] Fixed setup for bridge op execution Signed-off-by: Andrei Baltariu --- esdt-safe/interactor/src/interactor_main.rs | 21 ++++++++++++++++----- esdt-safe/interactor/state.toml | 8 ++++---- 2 files changed, 20 insertions(+), 9 deletions(-) diff --git a/esdt-safe/interactor/src/interactor_main.rs b/esdt-safe/interactor/src/interactor_main.rs index 71b28a11..8ff5fd8b 100644 --- a/esdt-safe/interactor/src/interactor_main.rs +++ b/esdt-safe/interactor/src/interactor_main.rs @@ -23,6 +23,7 @@ use transaction::{OperationEsdtPayment, TransferData}; const GATEWAY: &str = sdk::gateway::DEVNET_GATEWAY; const STATE_FILE: &str = "state.toml"; const TOKEN_ID: &[u8] = b"SOV-101252"; +const TOKEN_ID_FOR_EXECUTE: &[u8] = b"x-SOV-101252"; const WHITELISTED_TOKEN_ID: &[u8] = b"CHOCOLATE-daf625"; type OptionalTransferData = @@ -510,10 +511,10 @@ impl ContractInteract { async fn register_token(&mut self) { let egld_amount = BigUint::::from(50_000_000_000_000_000u64); - let sov_token_id = TokenIdentifier::from_esdt_bytes(b"SOV"); + let sov_token_id = TokenIdentifier::from_esdt_bytes(b"x-SOV-101252"); let token_type = EsdtTokenType::Fungible; - let token_display_name = ManagedBuffer::new_from_bytes(&b"SOVEREIGN-TOKEN"[..]); - let token_ticker = ManagedBuffer::new_from_bytes(&b"SVCT"[..]); + let token_display_name = ManagedBuffer::new_from_bytes(b"TESDT"); + let token_ticker = ManagedBuffer::new_from_bytes(b"TEST"); let num_decimals = 18u32; let response = self @@ -1016,13 +1017,23 @@ impl ContractInteract { async fn setup_payments(&mut self) -> ManagedVec> { let mut tokens: ManagedVec> = ManagedVec::new(); - let token_ids = vec![TOKEN_ID]; + let token_ids = vec![TOKEN_ID_FOR_EXECUTE]; for token_id in token_ids { let payment: OperationEsdtPayment = OperationEsdtPayment { token_identifier: token_id.into(), token_nonce: 0, - token_data: EsdtTokenData::default(), + token_data: EsdtTokenData { + token_type: EsdtTokenType::Fungible, + amount: BigUint::from(10_000u64), + frozen: false, + hash: ManagedBuffer::new(), + name: ManagedBuffer::from("SovToken"), + attributes: ManagedBuffer::new(), + creator: managed_address!(&self.bob_address), + royalties: BigUint::zero(), + uris: ManagedVec::new(), + }, }; tokens.push(payment); diff --git a/esdt-safe/interactor/state.toml b/esdt-safe/interactor/state.toml index cc74d9b8..7536f34a 100644 --- a/esdt-safe/interactor/state.toml +++ b/esdt-safe/interactor/state.toml @@ -1,5 +1,5 @@ -contract_address = "erd1qqqqqqqqqqqqqpgqq7uzqmfqj378rtw69crq9a457esa7pcerruqqfdkrg" -fee_market_address = "erd1qqqqqqqqqqqqqpgq09rk7w07ws6gwgg0xr60nxsmenv5kwjvrruqql0a9k" +contract_address = "erd1qqqqqqqqqqqqqpgqymk3fgkphwvs6q800rl8ldet6nfjufsvrruqkj36fe" +fee_market_address = "erd1qqqqqqqqqqqqqpgqf0s7t53nq560vkuv9ut2u02w8rnhs6wmrruqvvwrn6" price_aggregator_address = "erd1qqqqqqqqqqqqqpgq4sshr5wx4ch5gd8847dsavahytt732kut7as6z3mv6" -header_verifier_address = "erd1qqqqqqqqqqqqqpgq5ysrr7d6yjp0skz2w0vgdxmv8f0zf7qyrruqck8qnk" -testing_sc_address = "erd1qqqqqqqqqqqqqpgqy23kdt7xt85xydk3ssv7rc0tngvx9zzvrruq3lh7w6" +header_verifier_address = "erd1qqqqqqqqqqqqqpgq3j0qzmndhdz82d5wgcksgcxalv97fa60rruqhjkmxw" +testing_sc_address = "erd1qqqqqqqqqqqqqpgqy6t7krdeytjz7c404z0nxdy8r3phju7nrruqhwaqcl" From d837c9dfbd5402ebb25380ad2f33c2407331b77d Mon Sep 17 00:00:00 2001 From: Andrei Baltariu Date: Mon, 21 Oct 2024 13:46:06 +0300 Subject: [PATCH 474/523] Modified arg to fit testing sc endpoint needs Signed-off-by: Andrei Baltariu --- esdt-safe/interactor/src/interactor_main.rs | 3 ++- esdt-safe/interactor/state.toml | 8 ++++---- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/esdt-safe/interactor/src/interactor_main.rs b/esdt-safe/interactor/src/interactor_main.rs index 8ff5fd8b..6cd789b0 100644 --- a/esdt-safe/interactor/src/interactor_main.rs +++ b/esdt-safe/interactor/src/interactor_main.rs @@ -961,7 +961,8 @@ impl ContractInteract { let transfer_data = if has_transfer_data { let mut args = ManagedVec::new(); - args.push(ManagedBuffer::from("1")); + let value = BigUint::::from(0u64); + args.push(ManagedBuffer::from(value.to_bytes_be())); Some(TransferData::new( 30_000_000u64, diff --git a/esdt-safe/interactor/state.toml b/esdt-safe/interactor/state.toml index 7536f34a..d36d0551 100644 --- a/esdt-safe/interactor/state.toml +++ b/esdt-safe/interactor/state.toml @@ -1,5 +1,5 @@ -contract_address = "erd1qqqqqqqqqqqqqpgqymk3fgkphwvs6q800rl8ldet6nfjufsvrruqkj36fe" -fee_market_address = "erd1qqqqqqqqqqqqqpgqf0s7t53nq560vkuv9ut2u02w8rnhs6wmrruqvvwrn6" +contract_address = "erd1qqqqqqqqqqqqqpgqqcvr4u6u7sc4a7jhfc0axfas2qfc9calrruqwf5trx" +fee_market_address = "erd1qqqqqqqqqqqqqpgqq7l3qdzzygjjjwsymawn86y3e3fla2ezrruqmm5a7c" price_aggregator_address = "erd1qqqqqqqqqqqqqpgq4sshr5wx4ch5gd8847dsavahytt732kut7as6z3mv6" -header_verifier_address = "erd1qqqqqqqqqqqqqpgq3j0qzmndhdz82d5wgcksgcxalv97fa60rruqhjkmxw" -testing_sc_address = "erd1qqqqqqqqqqqqqpgqy6t7krdeytjz7c404z0nxdy8r3phju7nrruqhwaqcl" +header_verifier_address = "erd1qqqqqqqqqqqqqpgqmplcdd2wzy3j57skecmzgklcg9ewrzvprruqgjpfh9" +testing_sc_address = "erd1qqqqqqqqqqqqqpgqr22m5qs5n3u0u07vrjmcvejzeljdm7qkrruq9n022t" From a7b6bfb50c6f3f729c574e517a7ad7a02f2488ef Mon Sep 17 00:00:00 2001 From: Andrei Baltariu Date: Tue, 22 Oct 2024 10:05:42 +0300 Subject: [PATCH 475/523] Added tracer for debugging Signed-off-by: Andrei Baltariu --- .../interactor/interactor_trace.scen.json | 235 ++++++++++++++++++ esdt-safe/interactor/src/interactor_main.rs | 7 +- esdt-safe/interactor/state.toml | 8 +- .../tests/esdt_safe_sc_scenario_go_test.rs | 10 + 4 files changed, 255 insertions(+), 5 deletions(-) create mode 100644 esdt-safe/interactor/interactor_trace.scen.json create mode 100644 esdt-safe/tests/esdt_safe_sc_scenario_go_test.rs diff --git a/esdt-safe/interactor/interactor_trace.scen.json b/esdt-safe/interactor/interactor_trace.scen.json new file mode 100644 index 00000000..d35adcfb --- /dev/null +++ b/esdt-safe/interactor/interactor_trace.scen.json @@ -0,0 +1,235 @@ +{ + "steps": [ + { + "step": "setState", + "newAddresses": [ + { + "creatorAddress": "0x8049d639e5a6980d1cd2392abcce41029cda74a1563523a202f09641cc2618f8", + "creatorNonce": "2091", + "newAddress": "bech32:erd1qqqqqqqqqqqqqpgqfaqhhqwn5en78zpxvhxtr0er832d75xzrruqmds7jw" + } + ] + }, + { + "step": "scDeploy", + "id": "", + "tx": { + "from": "0x8049d639e5a6980d1cd2392abcce41029cda74a1563523a202f09641cc2618f8", + "contractCode": "mxsc:/../output/esdt-safe.mxsc.json", + "arguments": [ + "0x" + ], + "gasLimit": "110000000" + }, + "expect": { + "out": [], + "status": "0" + } + }, + { + "step": "setState", + "newAddresses": [ + { + "creatorAddress": "0x8049d639e5a6980d1cd2392abcce41029cda74a1563523a202f09641cc2618f8", + "creatorNonce": "2092", + "newAddress": "bech32:erd1qqqqqqqqqqqqqpgqrm67grf92zrvwjedw6v3gs00yfw0zgfxrruqqsr7v2" + } + ] + }, + { + "step": "scDeploy", + "id": "", + "tx": { + "from": "0x8049d639e5a6980d1cd2392abcce41029cda74a1563523a202f09641cc2618f8", + "contractCode": "mxsc:/../../fee-market/output/fee-market.mxsc.json", + "arguments": [ + "0x000000000000000005004f417b81d3a667e3882665ccb1bf233c54df50c218f8", + "0x010000000a534f562d313031323532010000000a534f562d313031323532000000010a00000000" + ], + "gasLimit": "100000000" + }, + "expect": { + "out": [], + "status": "0" + } + }, + { + "step": "scCall", + "id": "", + "tx": { + "from": "0x8049d639e5a6980d1cd2392abcce41029cda74a1563523a202f09641cc2618f8", + "to": "bech32:erd1qqqqqqqqqqqqqpgqfaqhhqwn5en78zpxvhxtr0er832d75xzrruqmds7jw", + "function": "setFeeMarketAddress", + "arguments": [ + "0x000000000000000005001ef5e40d255086c74b2d76991441ef225cf1212618f8" + ], + "gasLimit": "30000000" + }, + "expect": { + "out": [], + "status": "0" + } + }, + { + "step": "scCall", + "id": "", + "tx": { + "from": "0x8049d639e5a6980d1cd2392abcce41029cda74a1563523a202f09641cc2618f8", + "to": "0x000000000000000005001ef5e40d255086c74b2d76991441ef225cf1212618f8", + "function": "removeFee", + "arguments": [ + "0x534f562d313031323532" + ], + "gasLimit": "30000000" + }, + "expect": { + "out": [], + "status": "0" + } + }, + { + "step": "setState", + "newAddresses": [ + { + "creatorAddress": "0x8049d639e5a6980d1cd2392abcce41029cda74a1563523a202f09641cc2618f8", + "creatorNonce": "2095", + "newAddress": "bech32:erd1qqqqqqqqqqqqqpgq3p9nnjjz4v6q3pp2gmlye955zzwmh6utrruqpa2h8j" + } + ] + }, + { + "step": "scDeploy", + "id": "", + "tx": { + "from": "0x8049d639e5a6980d1cd2392abcce41029cda74a1563523a202f09641cc2618f8", + "contractCode": "mxsc:/../../header-verifier/output/header-verifier.mxsc.json", + "arguments": [], + "gasLimit": "100000000" + }, + "expect": { + "out": [], + "status": "0" + } + }, + { + "step": "scCall", + "id": "", + "tx": { + "from": "0x8049d639e5a6980d1cd2392abcce41029cda74a1563523a202f09641cc2618f8", + "to": "bech32:erd1qqqqqqqqqqqqqpgqfaqhhqwn5en78zpxvhxtr0er832d75xzrruqmds7jw", + "function": "setHeaderVerifierAddress", + "arguments": [ + "0x00000000000000000500884b39ca42ab3408842a46fe4c9694109dbbeb8b18f8" + ], + "gasLimit": "30000000" + }, + "expect": { + "out": [], + "status": "0" + } + }, + { + "step": "scCall", + "id": "", + "tx": { + "from": "0x8049d639e5a6980d1cd2392abcce41029cda74a1563523a202f09641cc2618f8", + "to": "bech32:erd1qqqqqqqqqqqqqpgqfaqhhqwn5en78zpxvhxtr0er832d75xzrruqmds7jw", + "function": "unpause", + "arguments": [], + "gasLimit": "30000000" + }, + "expect": { + "out": [], + "status": "0" + } + }, + { + "step": "scCall", + "id": "", + "tx": { + "from": "0x8049d639e5a6980d1cd2392abcce41029cda74a1563523a202f09641cc2618f8", + "to": "0x00000000000000000500884b39ca42ab3408842a46fe4c9694109dbbeb8b18f8", + "function": "setEsdtSafeAddress", + "arguments": [ + "0x000000000000000005004f417b81d3a667e3882665ccb1bf233c54df50c218f8" + ], + "gasLimit": "30000000" + }, + "expect": { + "out": [], + "status": "0" + } + }, + { + "step": "setState", + "newAddresses": [ + { + "creatorAddress": "0x8049d639e5a6980d1cd2392abcce41029cda74a1563523a202f09641cc2618f8", + "creatorNonce": "2099", + "newAddress": "bech32:erd1qqqqqqqqqqqqqpgqj6jmt3sdryetqsft7k8xydjmklc37tuvrruqerhnan" + } + ] + }, + { + "step": "scDeploy", + "id": "", + "tx": { + "from": "0x8049d639e5a6980d1cd2392abcce41029cda74a1563523a202f09641cc2618f8", + "contractCode": "mxsc:/../../testing-sc/output/testing-sc.mxsc.json", + "arguments": [], + "gasLimit": "100000000" + }, + "expect": { + "out": [], + "status": "0" + } + }, + { + "step": "setState", + "newTokenIdentifiers": [ + "TEST-38d5c5" + ] + }, + { + "step": "scCall", + "id": "", + "tx": { + "from": "0x8049d639e5a6980d1cd2392abcce41029cda74a1563523a202f09641cc2618f8", + "to": "bech32:erd1qqqqqqqqqqqqqpgqfaqhhqwn5en78zpxvhxtr0er832d75xzrruqmds7jw", + "egldValue": "50000000000000000", + "function": "registerToken", + "arguments": [ + "0x782d534f562d313031323532", + "0x", + "0x5445534454", + "0x54455354", + "0x12" + ], + "gasLimit": "90000000" + }, + "expect": { + "out": [], + "status": "0" + } + }, + { + "step": "scCall", + "id": "", + "tx": { + "from": "0x8049d639e5a6980d1cd2392abcce41029cda74a1563523a202f09641cc2618f8", + "to": "0x00000000000000000500884b39ca42ab3408842a46fe4c9694109dbbeb8b18f8", + "function": "registerBridgeOps", + "arguments": [ + "0x000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "0xd5db074bcabf4dc375352d252854e2d049c385b6f4da5acd7b0e3f0117184870", + "0x73db32383e56f1f010809c7d644b92f835b02bafed76e53a571aaf79d96c6653" + ], + "gasLimit": "5,000,000" + }, + "expect": { + "out": [], + "status": "0" + } + } + ] +} diff --git a/esdt-safe/interactor/src/interactor_main.rs b/esdt-safe/interactor/src/interactor_main.rs index 6cd789b0..3d027de3 100644 --- a/esdt-safe/interactor/src/interactor_main.rs +++ b/esdt-safe/interactor/src/interactor_main.rs @@ -25,6 +25,7 @@ const STATE_FILE: &str = "state.toml"; const TOKEN_ID: &[u8] = b"SOV-101252"; const TOKEN_ID_FOR_EXECUTE: &[u8] = b"x-SOV-101252"; const WHITELISTED_TOKEN_ID: &[u8] = b"CHOCOLATE-daf625"; +const INTERACTOR_SCENARIO_TRACE_PATH: &str = "interactor_trace.scen.json"; type OptionalTransferData = OptionalValue, ManagedVec>>>; @@ -161,7 +162,11 @@ struct ContractInteract { impl ContractInteract { async fn new() -> Self { - let mut interactor = Interactor::new(GATEWAY).await; + let mut interactor = Interactor::new(GATEWAY) + .await + .with_tracer(INTERACTOR_SCENARIO_TRACE_PATH) + .await; + let wallet_address = interactor.register_wallet(test_wallets::bob()); let frank_address = interactor.register_wallet(test_wallets::frank()); let alice_address = interactor.register_wallet(test_wallets::alice()); diff --git a/esdt-safe/interactor/state.toml b/esdt-safe/interactor/state.toml index d36d0551..1d02b7dd 100644 --- a/esdt-safe/interactor/state.toml +++ b/esdt-safe/interactor/state.toml @@ -1,5 +1,5 @@ -contract_address = "erd1qqqqqqqqqqqqqpgqqcvr4u6u7sc4a7jhfc0axfas2qfc9calrruqwf5trx" -fee_market_address = "erd1qqqqqqqqqqqqqpgqq7l3qdzzygjjjwsymawn86y3e3fla2ezrruqmm5a7c" +contract_address = "erd1qqqqqqqqqqqqqpgqfaqhhqwn5en78zpxvhxtr0er832d75xzrruqmds7jw" +fee_market_address = "erd1qqqqqqqqqqqqqpgqrm67grf92zrvwjedw6v3gs00yfw0zgfxrruqqsr7v2" price_aggregator_address = "erd1qqqqqqqqqqqqqpgq4sshr5wx4ch5gd8847dsavahytt732kut7as6z3mv6" -header_verifier_address = "erd1qqqqqqqqqqqqqpgqmplcdd2wzy3j57skecmzgklcg9ewrzvprruqgjpfh9" -testing_sc_address = "erd1qqqqqqqqqqqqqpgqr22m5qs5n3u0u07vrjmcvejzeljdm7qkrruq9n022t" +header_verifier_address = "erd1qqqqqqqqqqqqqpgq3p9nnjjz4v6q3pp2gmlye955zzwmh6utrruqpa2h8j" +testing_sc_address = "erd1qqqqqqqqqqqqqpgqj6jmt3sdryetqsft7k8xydjmklc37tuvrruqerhnan" diff --git a/esdt-safe/tests/esdt_safe_sc_scenario_go_test.rs b/esdt-safe/tests/esdt_safe_sc_scenario_go_test.rs new file mode 100644 index 00000000..4ebe9266 --- /dev/null +++ b/esdt-safe/tests/esdt_safe_sc_scenario_go_test.rs @@ -0,0 +1,10 @@ +use multiversx_sc_scenario::*; + +fn world() -> ScenarioWorld { + ScenarioWorld::vm_go() +} + +#[test] +fn interactor_go() { + world().run("interactor/interactor_trace.scen.json"); +} From ab5892717f0b847b9f72d44525c227c0e590fb67 Mon Sep 17 00:00:00 2001 From: Andrei Baltariu Date: Wed, 23 Oct 2024 14:43:31 +0300 Subject: [PATCH 476/523] Small endpoint fixes Signed-off-by: Andrei Baltariu --- esdt-safe/src/from_sovereign/token_mapping.rs | 4 ++-- fee-market/src/fee_market_proxy.rs | 4 ++-- fee-market/src/fee_type.rs | 4 ++-- fee-market/wasm-fee-marker-full/src/lib.rs | 4 ++-- fee-market/wasm/src/lib.rs | 4 ++-- 5 files changed, 10 insertions(+), 10 deletions(-) diff --git a/esdt-safe/src/from_sovereign/token_mapping.rs b/esdt-safe/src/from_sovereign/token_mapping.rs index db5ea78e..dc4ca566 100644 --- a/esdt-safe/src/from_sovereign/token_mapping.rs +++ b/esdt-safe/src/from_sovereign/token_mapping.rs @@ -88,8 +88,8 @@ pub trait TokenMappingModule: utils::UtilsModule { ManagedAsyncCallResult::Ok(mvx_token_id) => { self.set_corresponding_token_ids(sov_token_id, &mvx_token_id); } - ManagedAsyncCallResult::Err(_) => { - sc_panic!("There was an error at issuing nonfungible tokens"); + ManagedAsyncCallResult::Err(error) => { + sc_panic!("There was an error at issuing token: '{}'", error.err_msg); } } } diff --git a/fee-market/src/fee_market_proxy.rs b/fee-market/src/fee_market_proxy.rs index 36ed1bc8..774b6ec5 100644 --- a/fee-market/src/fee_market_proxy.rs +++ b/fee-market/src/fee_market_proxy.rs @@ -109,12 +109,12 @@ where ) -> TxTypedCall { self.wrapped_tx .payment(NotPayable) - .raw_call("addFee") + .raw_call("setFee") .argument(&fee_struct) .original_result() } - pub fn disable_fee< + pub fn remove_fee< Arg0: ProxyArg>, >( self, diff --git a/fee-market/src/fee_type.rs b/fee-market/src/fee_type.rs index 9621d436..b3a7b1ca 100644 --- a/fee-market/src/fee_type.rs +++ b/fee-market/src/fee_type.rs @@ -27,7 +27,7 @@ pub struct FeeStruct { #[multiversx_sc::module] pub trait FeeTypeModule: utils::UtilsModule + bls_signature::BlsSignatureModule { #[only_owner] - #[endpoint(addFee)] + #[endpoint(setFee)] fn set_fee(&self, fee_struct: FeeStruct) { self.require_valid_token_id(&fee_struct.base_token); @@ -61,7 +61,7 @@ pub trait FeeTypeModule: utils::UtilsModule + bls_signature::BlsSignatureModule #[only_owner] #[endpoint(removeFee)] - fn disable_fee(&self, base_token: TokenIdentifier) { + fn remove_fee(&self, base_token: TokenIdentifier) { self.token_fee(&base_token).clear(); self.fee_enabled().set(false); } diff --git a/fee-market/wasm-fee-marker-full/src/lib.rs b/fee-market/wasm-fee-marker-full/src/lib.rs index a07b92d6..0c3e5426 100644 --- a/fee-market/wasm-fee-marker-full/src/lib.rs +++ b/fee-market/wasm-fee-marker-full/src/lib.rs @@ -21,8 +21,8 @@ multiversx_sc_wasm_adapter::endpoints! { init => init upgrade => upgrade setPriceAggregatorAddress => set_price_aggregator_address - addFee => set_fee - removeFee => disable_fee + setFee => set_fee + removeFee => remove_fee getTokenFee => token_fee addUsersToWhitelist => add_users_to_whitelist removeUsersFromWhitelist => remove_users_from_whitelist diff --git a/fee-market/wasm/src/lib.rs b/fee-market/wasm/src/lib.rs index a07b92d6..0c3e5426 100644 --- a/fee-market/wasm/src/lib.rs +++ b/fee-market/wasm/src/lib.rs @@ -21,8 +21,8 @@ multiversx_sc_wasm_adapter::endpoints! { init => init upgrade => upgrade setPriceAggregatorAddress => set_price_aggregator_address - addFee => set_fee - removeFee => disable_fee + setFee => set_fee + removeFee => remove_fee getTokenFee => token_fee addUsersToWhitelist => add_users_to_whitelist removeUsersFromWhitelist => remove_users_from_whitelist From 7bdd9b3daccb69a3ae07eda54fc84484ce8cc352 Mon Sep 17 00:00:00 2001 From: Andrei Baltariu Date: Wed, 23 Oct 2024 14:47:22 +0300 Subject: [PATCH 477/523] Fixed interactor error Signed-off-by: Andrei Baltariu --- esdt-safe/interactor/src/interactor_main.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/esdt-safe/interactor/src/interactor_main.rs b/esdt-safe/interactor/src/interactor_main.rs index 764b64ff..536cb988 100644 --- a/esdt-safe/interactor/src/interactor_main.rs +++ b/esdt-safe/interactor/src/interactor_main.rs @@ -863,7 +863,7 @@ impl ContractInteract { println!("Result: {result_value:?}"); } - async fn disable_fee(&mut self) { + async fn remove_fee(&mut self) { let response = self .interactor .tx() @@ -871,7 +871,7 @@ impl ContractInteract { .to(self.state.fee_market_address.clone().unwrap().as_address()) .gas(30_000_000u64) .typed(FeeMarketProxy) - .disable_fee(TOKEN_ID) + .remove_fee(TOKEN_ID) .returns(ReturnsResultUnmanaged) .prepare_async() .run() @@ -929,7 +929,7 @@ async fn test_deploy() { interact.deploy_price_aggregator().await; interact.deploy_fee_market().await; interact.set_fee_market_address().await; - interact.disable_fee().await; + interact.remove_fee().await; interact.unpause_endpoint().await; } @@ -941,7 +941,7 @@ async fn test_deploy_sov() { interact.deploy_price_aggregator().await; interact.deploy_fee_market().await; interact.set_fee_market_address().await; - interact.disable_fee().await; + interact.remove_fee().await; interact.deploy_header_verifier_contract().await; interact.set_header_verifier_address().await; interact.unpause_endpoint().await; From 8c70071989c05d2f6251e9694ac12976b73fadba Mon Sep 17 00:00:00 2001 From: Andrei Baltariu Date: Wed, 23 Oct 2024 14:52:06 +0300 Subject: [PATCH 478/523] Fixed fee-market tests Signed-off-by: Andrei Baltariu --- fee-market/tests/fee_market_blackbox_test.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/fee-market/tests/fee_market_blackbox_test.rs b/fee-market/tests/fee_market_blackbox_test.rs index f7d43b25..c4baf4d0 100644 --- a/fee-market/tests/fee_market_blackbox_test.rs +++ b/fee-market/tests/fee_market_blackbox_test.rs @@ -133,13 +133,13 @@ impl FeeMarketTestState { } } - fn disable_fee(&mut self) { + fn remove_fee(&mut self) { self.world .tx() .from(OWNER_ADDRESS) .to(FEE_MARKET_ADDRESS) .typed(fee_market_proxy::FeeMarketProxy) - .disable_fee(TOKEN_ID) + .remove_fee(TOKEN_ID) .run(); } @@ -283,7 +283,7 @@ fn test_substract_fee_no_fee() { let mut state = FeeMarketTestState::new(); state.deploy_fee_market(); - state.disable_fee(); + state.remove_fee(); state.substract_fee("Correct", None); From b8e50e0e300960ec1210360767514e2556f386bd Mon Sep 17 00:00:00 2001 From: Andrei Baltariu Date: Thu, 24 Oct 2024 10:59:25 +0300 Subject: [PATCH 479/523] Added rust mandos test Signed-off-by: Andrei Baltariu --- esdt-safe/tests/esdt_safe_sc_scenario_rs_test.rs | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 esdt-safe/tests/esdt_safe_sc_scenario_rs_test.rs diff --git a/esdt-safe/tests/esdt_safe_sc_scenario_rs_test.rs b/esdt-safe/tests/esdt_safe_sc_scenario_rs_test.rs new file mode 100644 index 00000000..634f95f7 --- /dev/null +++ b/esdt-safe/tests/esdt_safe_sc_scenario_rs_test.rs @@ -0,0 +1,16 @@ +use multiversx_sc_scenario::*; + +fn world() -> ScenarioWorld { + let mut blockchain = ScenarioWorld::new(); + + blockchain.register_contract( + "mxsc:output/esdt-safe.mxsc.json", + esdt_safe::ContractBuilder, + ); + blockchain +} + +#[test] +fn interactor_rs() { + world().run("interactor/interactor_trace.scen.json"); +} From 614d8a559144572958223f7bf411d04f3e6a1179 Mon Sep 17 00:00:00 2001 From: Andrei Baltariu Date: Thu, 24 Oct 2024 11:06:13 +0300 Subject: [PATCH 480/523] Removed empty junk file Signed-off-by: Andrei Baltariu --- esdt-safe/testnet.toml | 0 1 file changed, 0 insertions(+), 0 deletions(-) delete mode 100644 esdt-safe/testnet.toml diff --git a/esdt-safe/testnet.toml b/esdt-safe/testnet.toml deleted file mode 100644 index e69de29b..00000000 From d02ea745ba074e1802e19b11d6e53b3c5017d224 Mon Sep 17 00:00:00 2001 From: Andrei Baltariu Date: Fri, 25 Oct 2024 13:16:34 +0300 Subject: [PATCH 481/523] Fixed callback issue for `execute_operation` Signed-off-by: Andrei Baltariu --- esdt-safe/src/from_sovereign/transfer_tokens.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/esdt-safe/src/from_sovereign/transfer_tokens.rs b/esdt-safe/src/from_sovereign/transfer_tokens.rs index dc7ab4d9..9e2ff236 100644 --- a/esdt-safe/src/from_sovereign/transfer_tokens.rs +++ b/esdt-safe/src/from_sovereign/transfer_tokens.rs @@ -199,6 +199,7 @@ pub trait TransferTokensModule: ::callbacks(self) .execute(hash_of_hashes, operation_tuple), ) + .gas_for_callback(CALLBACK_GAS) .register_promise(); } } @@ -271,7 +272,7 @@ pub trait TransferTokensModule: mvx_token_nonce, &operation_token.token_data.amount, ) - .transfer_execute(); + .sync_call(); } } From 7a47b71e259cceb8d5de7dcddc4a6ab73ad27152 Mon Sep 17 00:00:00 2001 From: Andrei Baltariu Date: Fri, 25 Oct 2024 17:17:25 +0300 Subject: [PATCH 482/523] Used framework function to find current workspace dir Signed-off-by: Andrei Baltariu --- esdt-safe/interactor/src/interactor_main.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/esdt-safe/interactor/src/interactor_main.rs b/esdt-safe/interactor/src/interactor_main.rs index efbcd11a..c8fd45f5 100644 --- a/esdt-safe/interactor/src/interactor_main.rs +++ b/esdt-safe/interactor/src/interactor_main.rs @@ -7,6 +7,7 @@ mod proxies; use fee_market::fee_market_proxy::FeeMarketProxy; use fee_market::fee_market_proxy::{self, FeeStruct, FeeType}; use header_verifier_proxy::HeaderverifierProxy; +use multiversx_sc_scenario::meta::tools::find_current_workspace; use multiversx_sc_scenario::multiversx_chain_vm::crypto_functions::{sha256, SHA256_RESULT_LEN}; use multiversx_sc_snippets::imports::*; use multiversx_sc_snippets::sdk::{self}; @@ -173,7 +174,7 @@ impl ContractInteract { let mike_address = interactor.register_wallet(test_wallets::mike()); let judy_address = interactor.register_wallet(test_wallets::judy()); - let current_dir = env::current_dir().expect("Failed to get current directory"); + let current_dir = find_current_workspace().unwrap(); println!("Current directory is: {}", current_dir.display()); let repo_dir = current_dir From 64c8825dee3d49ff631163a14ceab34f2f5e54e2 Mon Sep 17 00:00:00 2001 From: Andrei Baltariu Date: Fri, 25 Oct 2024 17:19:33 +0300 Subject: [PATCH 483/523] Removed `price_aggregator` call Signed-off-by: Andrei Baltariu --- esdt-safe/interactor/src/interactor_main.rs | 15 +-------------- 1 file changed, 1 insertion(+), 14 deletions(-) diff --git a/esdt-safe/interactor/src/interactor_main.rs b/esdt-safe/interactor/src/interactor_main.rs index c8fd45f5..0b4a3345 100644 --- a/esdt-safe/interactor/src/interactor_main.rs +++ b/esdt-safe/interactor/src/interactor_main.rs @@ -231,7 +231,7 @@ impl ContractInteract { } async fn deploy(&mut self, is_sov_chain: bool) { - let code_path = MxscPath::new(&self.esdt_safe_code); + let code_path = MxscPath::new(self.esdt_safe_code.as_ref()); let new_address = self .interactor @@ -1071,22 +1071,9 @@ impl ContractInteract { } #[tokio::test] -async fn test_execute_operation_no_transfer_data() { - let mut interact = ContractInteract::new().await; - interact.deploy(false).await; - interact.deploy_price_aggregator().await; - interact.deploy_fee_market().await; - interact.set_fee_market_address().await; - interact.remove_fee().await; - interact.unpause_endpoint().await; -} - -#[tokio::test] -#[ignore] async fn test_deploy_sov() { let mut interact = ContractInteract::new().await; interact.deploy(true).await; - interact.deploy_price_aggregator().await; interact.deploy_fee_market().await; interact.set_fee_market_address().await; interact.remove_fee().await; From 00662c5fe6786659de774c9911389d02652bfc7b Mon Sep 17 00:00:00 2001 From: Andrei Baltariu Date: Tue, 29 Oct 2024 10:05:38 +0200 Subject: [PATCH 484/523] Added pending flag Signed-off-by: Andrei Baltariu --- esdt-safe/src/from_sovereign/transfer_tokens.rs | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/esdt-safe/src/from_sovereign/transfer_tokens.rs b/esdt-safe/src/from_sovereign/transfer_tokens.rs index 9e2ff236..227ce057 100644 --- a/esdt-safe/src/from_sovereign/transfer_tokens.rs +++ b/esdt-safe/src/from_sovereign/transfer_tokens.rs @@ -28,6 +28,12 @@ pub trait TransferTokensModule: "Invalid method to call in current chain" ); + let is_operation_pending = self.pending_flag(&hash_of_hashes).get(); + require!( + !is_operation_pending, + "The current operations is being executed" + ); + require!(self.not_paused(), "Cannot transfer while paused"); let (operation_hash, is_registered) = @@ -321,6 +327,9 @@ pub trait TransferTokensModule: esdt_info_mapper.get().token_nonce } + #[storage_mapper("pendingFlag")] + fn pending_flag(&self, hash_of_hashes: &ManagedBuffer) -> SingleValueMapper; + #[storage_mapper("pendingHashes")] fn pending_hashes(&self, hash_of_hashes: &ManagedBuffer) -> UnorderedSetMapper; From f3824e77b425d0ff85c62e5f9facc126687478ad Mon Sep 17 00:00:00 2001 From: Andrei Baltariu Date: Tue, 29 Oct 2024 10:10:15 +0200 Subject: [PATCH 485/523] Added logic for flag check and update in function Signed-off-by: Andrei Baltariu --- .../src/from_sovereign/transfer_tokens.rs | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/esdt-safe/src/from_sovereign/transfer_tokens.rs b/esdt-safe/src/from_sovereign/transfer_tokens.rs index 227ce057..5691b921 100644 --- a/esdt-safe/src/from_sovereign/transfer_tokens.rs +++ b/esdt-safe/src/from_sovereign/transfer_tokens.rs @@ -28,11 +28,7 @@ pub trait TransferTokensModule: "Invalid method to call in current chain" ); - let is_operation_pending = self.pending_flag(&hash_of_hashes).get(); - require!( - !is_operation_pending, - "The current operations is being executed" - ); + self.check_and_update_pending_flag(&hash_of_hashes); require!(self.not_paused(), "Cannot transfer while paused"); @@ -327,6 +323,18 @@ pub trait TransferTokensModule: esdt_info_mapper.get().token_nonce } + fn check_and_update_pending_flag(&self, hash_of_hashes: &ManagedBuffer) { + let pending_flag_mapper = self.pending_flag(hash_of_hashes); + let is_operation_pending = pending_flag_mapper.get(); + + require!( + !is_operation_pending, + "The current operations is being executed" + ); + + pending_flag_mapper.set(true); + } + #[storage_mapper("pendingFlag")] fn pending_flag(&self, hash_of_hashes: &ManagedBuffer) -> SingleValueMapper; From 06a18187750dac5e276a30325389e584da1903b5 Mon Sep 17 00:00:00 2001 From: Andrei Baltariu Date: Tue, 29 Oct 2024 10:13:57 +0200 Subject: [PATCH 486/523] Typo Signed-off-by: Andrei Baltariu --- esdt-safe/src/from_sovereign/transfer_tokens.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/esdt-safe/src/from_sovereign/transfer_tokens.rs b/esdt-safe/src/from_sovereign/transfer_tokens.rs index 5691b921..1ce1e315 100644 --- a/esdt-safe/src/from_sovereign/transfer_tokens.rs +++ b/esdt-safe/src/from_sovereign/transfer_tokens.rs @@ -329,7 +329,7 @@ pub trait TransferTokensModule: require!( !is_operation_pending, - "The current operations is being executed" + "The current operation is being executed" ); pending_flag_mapper.set(true); From 717c98d0347ded1af9f63ad4ce300f1b29071330 Mon Sep 17 00:00:00 2001 From: Andrei Baltariu Date: Tue, 29 Oct 2024 11:42:41 +0200 Subject: [PATCH 487/523] Modified pending flag for operation execution Signed-off-by: Andrei Baltariu --- common/transaction/src/lib.rs | 12 ++++++ .../src/from_sovereign/transfer_tokens.rs | 41 ++++++++----------- header-verifier/src/header_verifier_proxy.rs | 16 ++++++++ header-verifier/src/lib.rs | 37 +++++++++++++---- .../wasm-header-verifier-full/src/lib.rs | 5 ++- header-verifier/wasm/src/lib.rs | 5 ++- 6 files changed, 78 insertions(+), 38 deletions(-) diff --git a/common/transaction/src/lib.rs b/common/transaction/src/lib.rs index 93d5ceba..66d87d14 100644 --- a/common/transaction/src/lib.rs +++ b/common/transaction/src/lib.rs @@ -40,6 +40,18 @@ pub struct Operation { pub data: OperationData, } +#[derive(TopEncode, TopDecode, NestedEncode, NestedDecode, TypeAbi, ManagedVecItem, Clone)] +pub struct PendingHash { + pub hash: ManagedBuffer, + pub is_locked: bool, +} + +impl PendingHash { + pub fn new(hash: ManagedBuffer, is_locked: bool) -> Self { + PendingHash { hash, is_locked } + } +} + impl Operation { #[inline] pub fn new( diff --git a/esdt-safe/src/from_sovereign/transfer_tokens.rs b/esdt-safe/src/from_sovereign/transfer_tokens.rs index 1ce1e315..d80256e1 100644 --- a/esdt-safe/src/from_sovereign/transfer_tokens.rs +++ b/esdt-safe/src/from_sovereign/transfer_tokens.rs @@ -32,12 +32,9 @@ pub trait TransferTokensModule: require!(self.not_paused(), "Cannot transfer while paused"); - let (operation_hash, is_registered) = - self.calculate_operation_hash(&hash_of_hashes, &operation); + let operation_hash = self.calculate_operation_hash(&operation); - if !is_registered { - sc_panic!("Operation is not registered"); - } + self.lock_operation_hash(&operation_hash, &hash_of_hashes); let minted_operation_tokens = self.mint_tokens(&operation.tokens); let operation_tuple = OperationTuple { @@ -292,15 +289,8 @@ pub trait TransferTokensModule: } // use pending_operations as param - fn calculate_operation_hash( - &self, - hash_of_hashes: &ManagedBuffer, - operation: &Operation, - ) -> (ManagedBuffer, bool) { + fn calculate_operation_hash(&self, operation: &Operation) -> ManagedBuffer { let mut serialized_data = ManagedBuffer::new(); - let header_verifier_address = self.header_verifier_address().get(); - let pending_operations_mapper = - self.external_pending_hashes(header_verifier_address, hash_of_hashes); if let core::result::Result::Err(err) = operation.top_encode(&mut serialized_data) { sc_panic!("Transfer data encode error: {}", err.message_bytes()); @@ -308,11 +298,19 @@ pub trait TransferTokensModule: let sha256 = self.crypto().sha256(&serialized_data); let hash = sha256.as_managed_buffer().clone(); - if pending_operations_mapper.contains(&hash) { - (hash, true) - } else { - (hash, false) - } + + hash + } + + fn lock_operation_hash(&self, operation_hash: &ManagedBuffer, hash_of_hashes: &ManagedBuffer) { + let header_verifier_address = self.header_verifier_address().get(); + + self.tx() + .to(header_verifier_address) + .typed(header_verifier_proxy::HeaderverifierProxy) + .lock_hash(hash_of_hashes, operation_hash) + .returns(ReturnsResult) + .sync_call(); } fn get_mvx_nonce_from_mapper(self, token_id: &TokenIdentifier, nonce: u64) -> u64 { @@ -343,11 +341,4 @@ pub trait TransferTokensModule: #[storage_mapper("headerVerifierAddress")] fn header_verifier_address(&self) -> SingleValueMapper; - - #[storage_mapper_from_address("pendingHashes")] - fn external_pending_hashes( - &self, - sc_address: ManagedAddress, - hash_of_hashes: &ManagedBuffer, - ) -> UnorderedSetMapper; } diff --git a/header-verifier/src/header_verifier_proxy.rs b/header-verifier/src/header_verifier_proxy.rs index 4f57c709..f850ab26 100644 --- a/header-verifier/src/header_verifier_proxy.rs +++ b/header-verifier/src/header_verifier_proxy.rs @@ -133,6 +133,22 @@ where .original_result() } + pub fn lock_operation_hash< + Arg0: ProxyArg>, + Arg1: ProxyArg>, + >( + self, + hash_of_hashes: Arg0, + operation_hash: Arg1, + ) -> TxTypedCall { + self.wrapped_tx + .payment(NotPayable) + .raw_call("lockOperationHash") + .argument(&hash_of_hashes) + .argument(&operation_hash) + .original_result() + } + pub fn set_min_valid_signers< Arg0: ProxyArg, >( diff --git a/header-verifier/src/lib.rs b/header-verifier/src/lib.rs index bd51ce17..175a2348 100644 --- a/header-verifier/src/lib.rs +++ b/header-verifier/src/lib.rs @@ -1,7 +1,6 @@ #![no_std] use bls_signature::BlsSignature; - pub mod header_verifier_proxy; multiversx_sc::imports!(); @@ -41,8 +40,8 @@ pub trait Headerverifier: bls_signature::BlsSignatureModule { ); for operation_hash in operations_hashes { - self.pending_hashes(&bridge_operations_hash) - .insert(operation_hash); + self.pending_hashes(&bridge_operations_hash, &operation_hash) + .set(false); } self.hash_of_hashes_history().insert(bridge_operations_hash); @@ -56,19 +55,35 @@ pub trait Headerverifier: bls_signature::BlsSignatureModule { #[endpoint(removeExecutedHash)] fn remove_executed_hash(&self, hash_of_hashes: &ManagedBuffer, operation_hash: &ManagedBuffer) { + self.require_caller_esdt_safe(); + self.pending_hashes(hash_of_hashes, operation_hash) + .set(false); + } + + #[endpoint(lockOperationHash)] + fn lock_operation_hash(&self, hash_of_hashes: ManagedBuffer, operation_hash: ManagedBuffer) { + self.require_caller_esdt_safe(); + let pending_hashes_mapper = self.pending_hashes(&hash_of_hashes, &operation_hash); + require!( - !self.esdt_safe_address().is_empty(), + !pending_hashes_mapper.is_empty(), + "The current operation is not registered" + ); + } + + fn require_caller_esdt_safe(&self) { + let esdt_safe_mapper = self.esdt_safe_address(); + + require!( + !esdt_safe_mapper.is_empty(), "There is no registered ESDT address" ); let caller = self.blockchain().get_caller(); require!( - caller == self.esdt_safe_address().get(), + caller == esdt_safe_mapper.get(), "Only ESDT Safe contract can call this endpoint" ); - - self.pending_hashes(hash_of_hashes) - .swap_remove(operation_hash); } fn calculate_and_check_transfers_hashes( @@ -110,7 +125,11 @@ pub trait Headerverifier: bls_signature::BlsSignatureModule { fn bls_pub_keys(&self) -> SetMapper; #[storage_mapper("pendingHashes")] - fn pending_hashes(&self, hash_of_hashes: &ManagedBuffer) -> UnorderedSetMapper; + fn pending_hashes( + &self, + hash_of_hashes: &ManagedBuffer, + operation_hash: &ManagedBuffer, + ) -> SingleValueMapper; #[storage_mapper("hashOfHashesHistory")] fn hash_of_hashes_history(&self) -> UnorderedSetMapper; diff --git a/header-verifier/wasm-header-verifier-full/src/lib.rs b/header-verifier/wasm-header-verifier-full/src/lib.rs index 8ae77c80..627b95c0 100644 --- a/header-verifier/wasm-header-verifier-full/src/lib.rs +++ b/header-verifier/wasm-header-verifier-full/src/lib.rs @@ -6,9 +6,9 @@ // Init: 1 // Upgrade: 1 -// Endpoints: 6 +// Endpoints: 7 // Async Callback (empty): 1 -// Total number of exported functions: 9 +// Total number of exported functions: 10 #![no_std] @@ -23,6 +23,7 @@ multiversx_sc_wasm_adapter::endpoints! { registerBridgeOps => register_bridge_operations setEsdtSafeAddress => set_esdt_safe_address removeExecutedHash => remove_executed_hash + lockOperationHash => lock_operation_hash setMinValidSigners => set_min_valid_signers addSigners => add_signers removeSigners => remove_signers diff --git a/header-verifier/wasm/src/lib.rs b/header-verifier/wasm/src/lib.rs index 8ae77c80..627b95c0 100644 --- a/header-verifier/wasm/src/lib.rs +++ b/header-verifier/wasm/src/lib.rs @@ -6,9 +6,9 @@ // Init: 1 // Upgrade: 1 -// Endpoints: 6 +// Endpoints: 7 // Async Callback (empty): 1 -// Total number of exported functions: 9 +// Total number of exported functions: 10 #![no_std] @@ -23,6 +23,7 @@ multiversx_sc_wasm_adapter::endpoints! { registerBridgeOps => register_bridge_operations setEsdtSafeAddress => set_esdt_safe_address removeExecutedHash => remove_executed_hash + lockOperationHash => lock_operation_hash setMinValidSigners => set_min_valid_signers addSigners => add_signers removeSigners => remove_signers From 6d1dbeb91bb9ef2e1599f736b2d53e7d016ef8a1 Mon Sep 17 00:00:00 2001 From: Andrei Baltariu Date: Tue, 29 Oct 2024 11:43:33 +0200 Subject: [PATCH 488/523] Used corect endpoint name Signed-off-by: Andrei Baltariu --- esdt-safe/src/from_sovereign/transfer_tokens.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/esdt-safe/src/from_sovereign/transfer_tokens.rs b/esdt-safe/src/from_sovereign/transfer_tokens.rs index d80256e1..b187605e 100644 --- a/esdt-safe/src/from_sovereign/transfer_tokens.rs +++ b/esdt-safe/src/from_sovereign/transfer_tokens.rs @@ -308,7 +308,7 @@ pub trait TransferTokensModule: self.tx() .to(header_verifier_address) .typed(header_verifier_proxy::HeaderverifierProxy) - .lock_hash(hash_of_hashes, operation_hash) + .lock_operation_hash(hash_of_hashes, operation_hash) .returns(ReturnsResult) .sync_call(); } From 15be74b8c4905cfac2312a6000438afe315b230d Mon Sep 17 00:00:00 2001 From: Andrei Baltariu Date: Tue, 29 Oct 2024 12:09:52 +0200 Subject: [PATCH 489/523] Removed unused function Signed-off-by: Andrei Baltariu --- esdt-safe/src/from_sovereign/transfer_tokens.rs | 14 -------------- 1 file changed, 14 deletions(-) diff --git a/esdt-safe/src/from_sovereign/transfer_tokens.rs b/esdt-safe/src/from_sovereign/transfer_tokens.rs index b187605e..47704774 100644 --- a/esdt-safe/src/from_sovereign/transfer_tokens.rs +++ b/esdt-safe/src/from_sovereign/transfer_tokens.rs @@ -28,8 +28,6 @@ pub trait TransferTokensModule: "Invalid method to call in current chain" ); - self.check_and_update_pending_flag(&hash_of_hashes); - require!(self.not_paused(), "Cannot transfer while paused"); let operation_hash = self.calculate_operation_hash(&operation); @@ -321,18 +319,6 @@ pub trait TransferTokensModule: esdt_info_mapper.get().token_nonce } - fn check_and_update_pending_flag(&self, hash_of_hashes: &ManagedBuffer) { - let pending_flag_mapper = self.pending_flag(hash_of_hashes); - let is_operation_pending = pending_flag_mapper.get(); - - require!( - !is_operation_pending, - "The current operation is being executed" - ); - - pending_flag_mapper.set(true); - } - #[storage_mapper("pendingFlag")] fn pending_flag(&self, hash_of_hashes: &ManagedBuffer) -> SingleValueMapper; From dc2e50aeb3e69ea76692d1d0d0aaf3d6df051ac4 Mon Sep 17 00:00:00 2001 From: Andrei Baltariu Date: Tue, 29 Oct 2024 12:10:12 +0200 Subject: [PATCH 490/523] Removed unused mapper Signed-off-by: Andrei Baltariu --- esdt-safe/src/from_sovereign/transfer_tokens.rs | 3 --- 1 file changed, 3 deletions(-) diff --git a/esdt-safe/src/from_sovereign/transfer_tokens.rs b/esdt-safe/src/from_sovereign/transfer_tokens.rs index 47704774..c3991105 100644 --- a/esdt-safe/src/from_sovereign/transfer_tokens.rs +++ b/esdt-safe/src/from_sovereign/transfer_tokens.rs @@ -322,9 +322,6 @@ pub trait TransferTokensModule: #[storage_mapper("pendingFlag")] fn pending_flag(&self, hash_of_hashes: &ManagedBuffer) -> SingleValueMapper; - #[storage_mapper("pendingHashes")] - fn pending_hashes(&self, hash_of_hashes: &ManagedBuffer) -> UnorderedSetMapper; - #[storage_mapper("headerVerifierAddress")] fn header_verifier_address(&self) -> SingleValueMapper; } From 0e8340016a55d3cc8dba60d76bca4a3ae5e5807c Mon Sep 17 00:00:00 2001 From: Andrei Baltariu Date: Tue, 29 Oct 2024 12:10:43 +0200 Subject: [PATCH 491/523] Added `clear` instead of `set` Signed-off-by: Andrei Baltariu --- header-verifier/src/lib.rs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/header-verifier/src/lib.rs b/header-verifier/src/lib.rs index 175a2348..eb3d7dbf 100644 --- a/header-verifier/src/lib.rs +++ b/header-verifier/src/lib.rs @@ -56,8 +56,7 @@ pub trait Headerverifier: bls_signature::BlsSignatureModule { #[endpoint(removeExecutedHash)] fn remove_executed_hash(&self, hash_of_hashes: &ManagedBuffer, operation_hash: &ManagedBuffer) { self.require_caller_esdt_safe(); - self.pending_hashes(hash_of_hashes, operation_hash) - .set(false); + self.pending_hashes(hash_of_hashes, operation_hash).clear(); } #[endpoint(lockOperationHash)] From 61c92f4be7a17e6b838169a544f07634b0443f8c Mon Sep 17 00:00:00 2001 From: Andrei Baltariu Date: Tue, 29 Oct 2024 12:17:09 +0200 Subject: [PATCH 492/523] Added require to check if operation is in execution Signed-off-by: Andrei Baltariu --- header-verifier/src/lib.rs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/header-verifier/src/lib.rs b/header-verifier/src/lib.rs index eb3d7dbf..bc8ab5b6 100644 --- a/header-verifier/src/lib.rs +++ b/header-verifier/src/lib.rs @@ -68,6 +68,12 @@ pub trait Headerverifier: bls_signature::BlsSignatureModule { !pending_hashes_mapper.is_empty(), "The current operation is not registered" ); + + let is_hash_in_execution = pending_hashes_mapper.get(); + require!( + !is_hash_in_execution, + "The current operation is already in execution" + ); } fn require_caller_esdt_safe(&self) { From a2547fc73f22cbbcbd1d30420ca3f77a75992b03 Mon Sep 17 00:00:00 2001 From: Andrei Baltariu Date: Tue, 29 Oct 2024 12:18:21 +0200 Subject: [PATCH 493/523] Renamed mapper + proxy regen Signed-off-by: Andrei Baltariu --- header-verifier/src/lib.rs | 10 ++++++---- .../tests/header_verifier_blackbox_test.rs | 12 ++++++------ 2 files changed, 12 insertions(+), 10 deletions(-) diff --git a/header-verifier/src/lib.rs b/header-verifier/src/lib.rs index bc8ab5b6..6ea47f47 100644 --- a/header-verifier/src/lib.rs +++ b/header-verifier/src/lib.rs @@ -40,7 +40,7 @@ pub trait Headerverifier: bls_signature::BlsSignatureModule { ); for operation_hash in operations_hashes { - self.pending_hashes(&bridge_operations_hash, &operation_hash) + self.pending_hash(&bridge_operations_hash, &operation_hash) .set(false); } @@ -56,13 +56,13 @@ pub trait Headerverifier: bls_signature::BlsSignatureModule { #[endpoint(removeExecutedHash)] fn remove_executed_hash(&self, hash_of_hashes: &ManagedBuffer, operation_hash: &ManagedBuffer) { self.require_caller_esdt_safe(); - self.pending_hashes(hash_of_hashes, operation_hash).clear(); + self.pending_hash(hash_of_hashes, operation_hash).clear(); } #[endpoint(lockOperationHash)] fn lock_operation_hash(&self, hash_of_hashes: ManagedBuffer, operation_hash: ManagedBuffer) { self.require_caller_esdt_safe(); - let pending_hashes_mapper = self.pending_hashes(&hash_of_hashes, &operation_hash); + let pending_hashes_mapper = self.pending_hash(&hash_of_hashes, &operation_hash); require!( !pending_hashes_mapper.is_empty(), @@ -74,6 +74,8 @@ pub trait Headerverifier: bls_signature::BlsSignatureModule { !is_hash_in_execution, "The current operation is already in execution" ); + + pending_hashes_mapper.set(true); } fn require_caller_esdt_safe(&self) { @@ -130,7 +132,7 @@ pub trait Headerverifier: bls_signature::BlsSignatureModule { fn bls_pub_keys(&self) -> SetMapper; #[storage_mapper("pendingHashes")] - fn pending_hashes( + fn pending_hash( &self, hash_of_hashes: &ManagedBuffer, operation_hash: &ManagedBuffer, diff --git a/header-verifier/tests/header_verifier_blackbox_test.rs b/header-verifier/tests/header_verifier_blackbox_test.rs index 50a62073..f3f10b97 100644 --- a/header-verifier/tests/header_verifier_blackbox_test.rs +++ b/header-verifier/tests/header_verifier_blackbox_test.rs @@ -216,11 +216,11 @@ fn test_register_bridge_operation() { assert!(!sc.hash_of_hashes_history().is_empty()); assert!(sc.hash_of_hashes_history().len() == 1); assert!(sc.hash_of_hashes_history().contains(&hash_of_hashes)); - assert!(!sc.pending_hashes(&hash_of_hashes).is_empty()); + assert!(!sc.pending_hash(&hash_of_hashes).is_empty()); for (mut i, operation_hash) in operation.operations_hashes.into_iter().enumerate() { i += 1; - let pending_hash = sc.pending_hashes(&hash_of_hashes).get_by_index(i); + let pending_hash = sc.pending_hash(&hash_of_hashes).get_by_index(i); let expected_hash_debug_api: ManagedBuffer = ManagedBuffer::from(operation_hash.to_vec()); assert_eq!(pending_hash, expected_hash_debug_api); @@ -304,10 +304,10 @@ fn test_remove_one_executed_hash() { .whitebox(header_verifier::contract_obj, |sc| { let hash_of_hashes: ManagedBuffer = ManagedBuffer::from(operation.bridge_operation_hash.to_vec()); - assert!(!sc.pending_hashes(&hash_of_hashes).is_empty()); - assert!(sc.pending_hashes(&hash_of_hashes).len() == 1); + assert!(!sc.pending_hash(&hash_of_hashes).is_empty()); + assert!(sc.pending_hash(&hash_of_hashes).len() == 1); - let pending_hash_2 = sc.pending_hashes(&hash_of_hashes).get_by_index(1); + let pending_hash_2 = sc.pending_hash(&hash_of_hashes).get_by_index(1); let expected_hash_2_debug_api: ManagedBuffer = ManagedBuffer::from(operation_hash_2.to_vec()); @@ -350,7 +350,7 @@ fn test_remove_all_executed_hashes() { .whitebox(header_verifier::contract_obj, |sc| { let hash_of_hashes: ManagedBuffer = ManagedBuffer::from(operation.bridge_operation_hash.to_vec()); - assert!(sc.pending_hashes(&hash_of_hashes).is_empty()); + assert!(sc.pending_hash(&hash_of_hashes).is_empty()); assert!(sc.hash_of_hashes_history().contains(&hash_of_hashes)); }); } From 71dfbef0cb6d1f3127e8270e5d43879f7de39528 Mon Sep 17 00:00:00 2001 From: Andrei Baltariu Date: Tue, 29 Oct 2024 13:22:45 +0200 Subject: [PATCH 494/523] Test fixes Signed-off-by: Andrei Baltariu --- .../tests/header_verifier_blackbox_test.rs | 40 +++++++++++-------- 1 file changed, 23 insertions(+), 17 deletions(-) diff --git a/header-verifier/tests/header_verifier_blackbox_test.rs b/header-verifier/tests/header_verifier_blackbox_test.rs index f3f10b97..9b379a6a 100644 --- a/header-verifier/tests/header_verifier_blackbox_test.rs +++ b/header-verifier/tests/header_verifier_blackbox_test.rs @@ -115,7 +115,7 @@ impl HeaderVerifierTestState { } fn get_bls_keys(&mut self, bls_keys_vec: Vec>) -> BlsKeys { - let bls_keys = bls_keys_vec.iter().map(|key| key).cloned().collect(); + let bls_keys = bls_keys_vec.iter().cloned().collect(); bls_keys } @@ -216,14 +216,17 @@ fn test_register_bridge_operation() { assert!(!sc.hash_of_hashes_history().is_empty()); assert!(sc.hash_of_hashes_history().len() == 1); assert!(sc.hash_of_hashes_history().contains(&hash_of_hashes)); - assert!(!sc.pending_hash(&hash_of_hashes).is_empty()); - - for (mut i, operation_hash) in operation.operations_hashes.into_iter().enumerate() { - i += 1; - let pending_hash = sc.pending_hash(&hash_of_hashes).get_by_index(i); - let expected_hash_debug_api: ManagedBuffer = - ManagedBuffer::from(operation_hash.to_vec()); - assert_eq!(pending_hash, expected_hash_debug_api); + + for operation_hash in operation.operations_hashes { + let operation_hash_debug_api = ManagedBuffer::from(operation_hash.to_vec()); + + let pending_hashes_mapper = + sc.pending_hash(&hash_of_hashes, &operation_hash_debug_api); + + let is_hash_locked = pending_hashes_mapper.get(); + let is_mapper_empty = pending_hashes_mapper.is_empty(); + assert!(!is_mapper_empty); + assert!(!is_hash_locked); } }); } @@ -293,7 +296,7 @@ fn test_remove_one_executed_hash() { state.propose_remove_executed_hash( ENSHRINE_ADDRESS, &operation.bridge_operation_hash, - operation_hash_1, + operation_hash_1.clone(), None, ); @@ -304,14 +307,17 @@ fn test_remove_one_executed_hash() { .whitebox(header_verifier::contract_obj, |sc| { let hash_of_hashes: ManagedBuffer = ManagedBuffer::from(operation.bridge_operation_hash.to_vec()); - assert!(!sc.pending_hash(&hash_of_hashes).is_empty()); - assert!(sc.pending_hash(&hash_of_hashes).len() == 1); + for operation_hash in operation.operations_hashes { + let operation_hash_debug_api = ManagedBuffer::from(operation_hash.to_vec()); - let pending_hash_2 = sc.pending_hash(&hash_of_hashes).get_by_index(1); - let expected_hash_2_debug_api: ManagedBuffer = - ManagedBuffer::from(operation_hash_2.to_vec()); + let pending_hashes_mapper = + sc.pending_hash(&hash_of_hashes, &operation_hash_debug_api); - assert_eq!(pending_hash_2, expected_hash_2_debug_api); + let is_hash_locked = pending_hashes_mapper.get(); + let is_mapper_empty = pending_hashes_mapper.is_empty(); + assert!(is_mapper_empty); + assert!(!is_hash_locked); + } }); } @@ -350,7 +356,7 @@ fn test_remove_all_executed_hashes() { .whitebox(header_verifier::contract_obj, |sc| { let hash_of_hashes: ManagedBuffer = ManagedBuffer::from(operation.bridge_operation_hash.to_vec()); - assert!(sc.pending_hash(&hash_of_hashes).is_empty()); + // assert!(sc.pending_hash(&hash_of_hashes).is_empty()); assert!(sc.hash_of_hashes_history().contains(&hash_of_hashes)); }); } From 0e09b706338b7b167f21ccf5b07c5aadcb8ad8ea Mon Sep 17 00:00:00 2001 From: Andrei Baltariu Date: Tue, 29 Oct 2024 13:25:00 +0200 Subject: [PATCH 495/523] Fix after review Signed-off-by: Andrei Baltariu --- esdt-safe/src/from_sovereign/transfer_tokens.rs | 5 ----- header-verifier/src/lib.rs | 2 ++ 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/esdt-safe/src/from_sovereign/transfer_tokens.rs b/esdt-safe/src/from_sovereign/transfer_tokens.rs index c3991105..112d8d6e 100644 --- a/esdt-safe/src/from_sovereign/transfer_tokens.rs +++ b/esdt-safe/src/from_sovereign/transfer_tokens.rs @@ -286,7 +286,6 @@ pub trait TransferTokensModule: ); } - // use pending_operations as param fn calculate_operation_hash(&self, operation: &Operation) -> ManagedBuffer { let mut serialized_data = ManagedBuffer::new(); @@ -307,7 +306,6 @@ pub trait TransferTokensModule: .to(header_verifier_address) .typed(header_verifier_proxy::HeaderverifierProxy) .lock_operation_hash(hash_of_hashes, operation_hash) - .returns(ReturnsResult) .sync_call(); } @@ -319,9 +317,6 @@ pub trait TransferTokensModule: esdt_info_mapper.get().token_nonce } - #[storage_mapper("pendingFlag")] - fn pending_flag(&self, hash_of_hashes: &ManagedBuffer) -> SingleValueMapper; - #[storage_mapper("headerVerifierAddress")] fn header_verifier_address(&self) -> SingleValueMapper; } diff --git a/header-verifier/src/lib.rs b/header-verifier/src/lib.rs index 6ea47f47..dc5aece3 100644 --- a/header-verifier/src/lib.rs +++ b/header-verifier/src/lib.rs @@ -56,12 +56,14 @@ pub trait Headerverifier: bls_signature::BlsSignatureModule { #[endpoint(removeExecutedHash)] fn remove_executed_hash(&self, hash_of_hashes: &ManagedBuffer, operation_hash: &ManagedBuffer) { self.require_caller_esdt_safe(); + self.pending_hash(hash_of_hashes, operation_hash).clear(); } #[endpoint(lockOperationHash)] fn lock_operation_hash(&self, hash_of_hashes: ManagedBuffer, operation_hash: ManagedBuffer) { self.require_caller_esdt_safe(); + let pending_hashes_mapper = self.pending_hash(&hash_of_hashes, &operation_hash); require!( From 6f86413db8f8e6421406f661ec7e147feeae3904 Mon Sep 17 00:00:00 2001 From: Andrei Baltariu Date: Tue, 29 Oct 2024 13:32:09 +0200 Subject: [PATCH 496/523] Removed struct Signed-off-by: Andrei Baltariu --- common/transaction/src/lib.rs | 12 ------------ 1 file changed, 12 deletions(-) diff --git a/common/transaction/src/lib.rs b/common/transaction/src/lib.rs index 66d87d14..93d5ceba 100644 --- a/common/transaction/src/lib.rs +++ b/common/transaction/src/lib.rs @@ -40,18 +40,6 @@ pub struct Operation { pub data: OperationData, } -#[derive(TopEncode, TopDecode, NestedEncode, NestedDecode, TypeAbi, ManagedVecItem, Clone)] -pub struct PendingHash { - pub hash: ManagedBuffer, - pub is_locked: bool, -} - -impl PendingHash { - pub fn new(hash: ManagedBuffer, is_locked: bool) -> Self { - PendingHash { hash, is_locked } - } -} - impl Operation { #[inline] pub fn new( From 276c55d05a54622b074b030875f9326a4df28f98 Mon Sep 17 00:00:00 2001 From: Andrei Baltariu Date: Tue, 29 Oct 2024 13:35:25 +0200 Subject: [PATCH 497/523] Added enum to check if operation is locked or not Signed-off-by: Andrei Baltariu --- header-verifier/src/lib.rs | 23 +++++++++++++++-------- 1 file changed, 15 insertions(+), 8 deletions(-) diff --git a/header-verifier/src/lib.rs b/header-verifier/src/lib.rs index dc5aece3..4afe22a8 100644 --- a/header-verifier/src/lib.rs +++ b/header-verifier/src/lib.rs @@ -1,10 +1,18 @@ #![no_std] use bls_signature::BlsSignature; +use multiversx_sc::codec; +use multiversx_sc::proxy_imports::{TopDecode, TopEncode}; pub mod header_verifier_proxy; multiversx_sc::imports!(); +#[derive(TopEncode, TopDecode)] +pub enum PendingHash { + NotLocked = 1, + Locked, +} + #[multiversx_sc::contract] pub trait Headerverifier: bls_signature::BlsSignatureModule { #[init] @@ -41,7 +49,7 @@ pub trait Headerverifier: bls_signature::BlsSignatureModule { for operation_hash in operations_hashes { self.pending_hash(&bridge_operations_hash, &operation_hash) - .set(false); + .set(PendingHash::NotLocked); } self.hash_of_hashes_history().insert(bridge_operations_hash); @@ -72,12 +80,11 @@ pub trait Headerverifier: bls_signature::BlsSignatureModule { ); let is_hash_in_execution = pending_hashes_mapper.get(); - require!( - !is_hash_in_execution, - "The current operation is already in execution" - ); - - pending_hashes_mapper.set(true); + match is_hash_in_execution { + PendingHash::None => sc_panic!("Invalid enum variant"), + PendingHash::NotLocked => pending_hashes_mapper.set(PendingHash::Locked), + PendingHash::Locked => sc_panic!("The current operation is already in execution"), + } } fn require_caller_esdt_safe(&self) { @@ -138,7 +145,7 @@ pub trait Headerverifier: bls_signature::BlsSignatureModule { &self, hash_of_hashes: &ManagedBuffer, operation_hash: &ManagedBuffer, - ) -> SingleValueMapper; + ) -> SingleValueMapper; #[storage_mapper("hashOfHashesHistory")] fn hash_of_hashes_history(&self) -> UnorderedSetMapper; From 50656428320d12157313dec20f4cfc987d8044c9 Mon Sep 17 00:00:00 2001 From: Andrei Baltariu Date: Tue, 29 Oct 2024 13:42:11 +0200 Subject: [PATCH 498/523] Fixed tests Signed-off-by: Andrei Baltariu --- header-verifier/src/lib.rs | 3 +-- .../tests/header_verifier_blackbox_test.rs | 23 +++++++++---------- 2 files changed, 12 insertions(+), 14 deletions(-) diff --git a/header-verifier/src/lib.rs b/header-verifier/src/lib.rs index 4afe22a8..12a0fa83 100644 --- a/header-verifier/src/lib.rs +++ b/header-verifier/src/lib.rs @@ -7,7 +7,7 @@ pub mod header_verifier_proxy; multiversx_sc::imports!(); -#[derive(TopEncode, TopDecode)] +#[derive(TopEncode, TopDecode, PartialEq)] pub enum PendingHash { NotLocked = 1, Locked, @@ -81,7 +81,6 @@ pub trait Headerverifier: bls_signature::BlsSignatureModule { let is_hash_in_execution = pending_hashes_mapper.get(); match is_hash_in_execution { - PendingHash::None => sc_panic!("Invalid enum variant"), PendingHash::NotLocked => pending_hashes_mapper.set(PendingHash::Locked), PendingHash::Locked => sc_panic!("The current operation is already in execution"), } diff --git a/header-verifier/tests/header_verifier_blackbox_test.rs b/header-verifier/tests/header_verifier_blackbox_test.rs index 9b379a6a..d2c7351a 100644 --- a/header-verifier/tests/header_verifier_blackbox_test.rs +++ b/header-verifier/tests/header_verifier_blackbox_test.rs @@ -1,5 +1,5 @@ use bls_signature::BlsSignature; -use header_verifier::{header_verifier_proxy, Headerverifier}; +use header_verifier::{header_verifier_proxy, Headerverifier, PendingHash}; use multiversx_sc::types::ManagedBuffer; use multiversx_sc::{ api::ManagedTypeApi, @@ -223,10 +223,11 @@ fn test_register_bridge_operation() { let pending_hashes_mapper = sc.pending_hash(&hash_of_hashes, &operation_hash_debug_api); - let is_hash_locked = pending_hashes_mapper.get(); let is_mapper_empty = pending_hashes_mapper.is_empty(); + let is_operation_hash_locked = pending_hashes_mapper.get(); + assert!(!is_mapper_empty); - assert!(!is_hash_locked); + assert!(is_operation_hash_locked == PendingHash::NotLocked); } }); } @@ -307,17 +308,15 @@ fn test_remove_one_executed_hash() { .whitebox(header_verifier::contract_obj, |sc| { let hash_of_hashes: ManagedBuffer = ManagedBuffer::from(operation.bridge_operation_hash.to_vec()); - for operation_hash in operation.operations_hashes { - let operation_hash_debug_api = ManagedBuffer::from(operation_hash.to_vec()); + let operation_hash_debug_api = ManagedBuffer::from(operation_hash_2.to_vec()); - let pending_hashes_mapper = - sc.pending_hash(&hash_of_hashes, &operation_hash_debug_api); + let pending_hashes_mapper = sc.pending_hash(&hash_of_hashes, &operation_hash_debug_api); - let is_hash_locked = pending_hashes_mapper.get(); - let is_mapper_empty = pending_hashes_mapper.is_empty(); - assert!(is_mapper_empty); - assert!(!is_hash_locked); - } + let is_hash_locked = pending_hashes_mapper.get(); + let is_mapper_empty = pending_hashes_mapper.is_empty(); + + assert!(!is_mapper_empty); + assert!(is_hash_locked == PendingHash::NotLocked); }); } From b6a0ea2ed96b3de3b9d748d20e5beb7287f1a340 Mon Sep 17 00:00:00 2001 From: Andrei Baltariu Date: Tue, 29 Oct 2024 14:55:43 +0200 Subject: [PATCH 499/523] Added same logic for `enshrine-esdt` Signed-off-by: Andrei Baltariu --- .../src/from_sovereign/transfer_tokens.rs | 44 +++++++------------ 1 file changed, 16 insertions(+), 28 deletions(-) diff --git a/enshrine-esdt-safe/src/from_sovereign/transfer_tokens.rs b/enshrine-esdt-safe/src/from_sovereign/transfer_tokens.rs index f75ee5f7..4c9079ff 100644 --- a/enshrine-esdt-safe/src/from_sovereign/transfer_tokens.rs +++ b/enshrine-esdt-safe/src/from_sovereign/transfer_tokens.rs @@ -43,10 +43,9 @@ pub trait TransferTokensModule: ); require!(self.not_paused(), "Cannot transfer while paused"); - let (op_hash, is_registered) = self.calculate_operation_hash(&hash_of_hashes, &operation); - if !is_registered { - sc_panic!("Operation is not registered"); - } + let op_hash = self.calculate_operation_hash(&operation); + + self.lock_operation_hash(&op_hash, &hash_of_hashes); let split_result = self.split_payments_for_prefix_and_fee(&operation.tokens); if !split_result.are_tokens_registered { @@ -159,16 +158,8 @@ pub trait TransferTokensModule: ); } - // use pending_operations as param - fn calculate_operation_hash( - &self, - hash_of_hashes: &ManagedBuffer, - operation: &Operation, - ) -> (ManagedBuffer, bool) { + fn calculate_operation_hash(&self, operation: &Operation) -> ManagedBuffer { let mut serialized_data = ManagedBuffer::new(); - let header_verifier_address = self.header_verifier_address().get(); - let pending_operations_mapper = - self.external_pending_hashes(header_verifier_address, hash_of_hashes); if let core::result::Result::Err(err) = operation.top_encode(&mut serialized_data) { sc_panic!("Transfer data encode error: {}", err.message_bytes()); @@ -176,11 +167,18 @@ pub trait TransferTokensModule: let sha256 = self.crypto().sha256(&serialized_data); let hash = sha256.as_managed_buffer().clone(); - if pending_operations_mapper.contains(&hash) { - (hash, true) - } else { - (hash, false) - } + + hash + } + + fn lock_operation_hash(&self, operation_hash: &ManagedBuffer, hash_of_hashes: &ManagedBuffer) { + let header_verifier_address = self.header_verifier_address().get(); + + self.tx() + .to(header_verifier_address) + .typed(header_verifier_proxy::HeaderverifierProxy) + .lock_operation_hash(hash_of_hashes, operation_hash) + .sync_call(); } #[inline] @@ -198,19 +196,9 @@ pub trait TransferTokensModule: token_id.eq(&self.wegld_identifier().get()) } - #[storage_mapper("pendingHashes")] - fn pending_hashes(&self, hash_of_hashes: &ManagedBuffer) -> UnorderedSetMapper; - #[storage_mapper("headerVerifierAddress")] fn header_verifier_address(&self) -> SingleValueMapper; #[storage_mapper("paidIssuedTokens")] fn paid_issued_tokens(&self) -> UnorderedSetMapper>; - - #[storage_mapper_from_address("pendingHashes")] - fn external_pending_hashes( - &self, - sc_address: ManagedAddress, - hash_of_hashes: &ManagedBuffer, - ) -> UnorderedSetMapper; } From 6dcdc584697ca1576b3f633ef51dda07a6644f55 Mon Sep 17 00:00:00 2001 From: Andrei Baltariu Date: Tue, 29 Oct 2024 14:55:54 +0200 Subject: [PATCH 500/523] Fixed tests by registering ESDT address Signed-off-by: Andrei Baltariu --- .../tests/enshrine_esdt_safe_blackbox_test.rs | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/enshrine-esdt-safe/tests/enshrine_esdt_safe_blackbox_test.rs b/enshrine-esdt-safe/tests/enshrine_esdt_safe_blackbox_test.rs index 789254d2..577a686a 100644 --- a/enshrine-esdt-safe/tests/enshrine_esdt_safe_blackbox_test.rs +++ b/enshrine-esdt-safe/tests/enshrine_esdt_safe_blackbox_test.rs @@ -398,6 +398,16 @@ impl EnshrineTestState { .run(); } + fn propose_register_esdt_in_header_verifier(&mut self) { + self.world + .tx() + .from(ENSHRINE_ESDT_OWNER_ADDRESS) + .to(HEADER_VERIFIER_ADDRESS) + .typed(header_verifier_proxy::HeaderverifierProxy) + .set_esdt_safe_address(ENSHRINE_ESDT_ADDRESS) + .run(); + } + fn mock_bls_signature( &mut self, operation_hash: &ManagedBuffer, @@ -482,6 +492,7 @@ fn test_sovereign_prefix_no_prefix() { state.propose_setup_contracts(false, None); state.propose_register_operation(&token_vec); + state.propose_register_esdt_in_header_verifier(); state.propose_whitelist_enshrine_esdt(); state.propose_execute_operation(Some(ExpectError(10, "action is not allowed")), &token_vec); } @@ -493,6 +504,7 @@ fn test_sovereign_prefix_has_prefix() { state.propose_setup_contracts(false, None); state.propose_register_operation(&token_vec); + state.propose_register_esdt_in_header_verifier(); state.propose_whitelist_enshrine_esdt(); state.propose_execute_operation(None, &token_vec); } From fe69e293ef03c7a1dd6ef3ee96a9cef2c40bea7f Mon Sep 17 00:00:00 2001 From: Andrei Baltariu Date: Tue, 29 Oct 2024 14:59:41 +0200 Subject: [PATCH 501/523] Fixed ESDT Safe test Signed-off-by: Andrei Baltariu --- esdt-safe/tests/bridge_blackbox_tests.rs | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) diff --git a/esdt-safe/tests/bridge_blackbox_tests.rs b/esdt-safe/tests/bridge_blackbox_tests.rs index a2313502..6bd3b153 100644 --- a/esdt-safe/tests/bridge_blackbox_tests.rs +++ b/esdt-safe/tests/bridge_blackbox_tests.rs @@ -9,10 +9,7 @@ use multiversx_sc::types::{ }; use multiversx_sc::{ imports::{MultiValue3, OptionalValue}, - types::{ - BigUint, EsdtTokenPayment, ManagedBuffer, ManagedVec, ReturnsResult, TestAddress, - TestSCAddress, - }, + types::{BigUint, EsdtTokenPayment, ManagedBuffer, ManagedVec, TestAddress, TestSCAddress}, }; use multiversx_sc_scenario::managed_address; use multiversx_sc_scenario::multiversx_chain_vm::crypto_functions::sha256; @@ -285,7 +282,16 @@ impl BridgeTestState { .to(BRIDGE_ADDRESS) .typed(esdt_safe_proxy::EsdtSafeProxy) .unpause_endpoint() - .returns(ReturnsResult) + .run(); + } + + fn propose_set_esdt_safe_address(&mut self) { + self.world + .tx() + .from(BRIDGE_OWNER_ADDRESS) + .to(HEADER_VERIFIER_ADDRESS) + .typed(header_verifier_proxy::HeaderverifierProxy) + .set_esdt_safe_address(BRIDGE_ADDRESS) .run(); } @@ -392,7 +398,7 @@ fn test_main_to_sov_deposit_ok() { #[test] fn test_execute_operation_not_registered() { let mut state = BridgeTestState::new(); - let err_message = "Operation is not registered"; + let err_message = "The current operation is not registered"; state.deploy_bridge_contract(false); @@ -400,6 +406,8 @@ fn test_execute_operation_not_registered() { state.propose_set_header_verifier_address(); + state.propose_set_esdt_safe_address(); + state.propose_execute_operation_and_expect_err(err_message); } @@ -426,6 +434,8 @@ fn test_execute_operation() { state.propose_set_header_verifier_address(); + state.propose_set_esdt_safe_address(); + state.propose_register_operation(); state.propose_execute_operation(); From 727f00479b2d0dcbcbb135e679f2f7a55fa6ac37 Mon Sep 17 00:00:00 2001 From: Andrei Baltariu Date: Tue, 29 Oct 2024 15:35:56 +0200 Subject: [PATCH 502/523] Added unit tests for `lock_hash` endpoint Signed-off-by: Andrei Baltariu --- .../tests/header_verifier_blackbox_test.rs | 97 +++++++++++++++++-- 1 file changed, 91 insertions(+), 6 deletions(-) diff --git a/header-verifier/tests/header_verifier_blackbox_test.rs b/header-verifier/tests/header_verifier_blackbox_test.rs index d2c7351a..fe20a090 100644 --- a/header-verifier/tests/header_verifier_blackbox_test.rs +++ b/header-verifier/tests/header_verifier_blackbox_test.rs @@ -97,7 +97,7 @@ impl HeaderVerifierTestState { &mut self, caller: TestAddress, hash_of_hashes: &ManagedBuffer, - operation_hash: ManagedBuffer, + operation_hash: &ManagedBuffer, expected_result: Option>, ) { let transaction = self @@ -114,6 +114,27 @@ impl HeaderVerifierTestState { } } + fn propose_lock_operation_hash( + &mut self, + caller: TestAddress, + hash_of_hashes: &ManagedBuffer, + operation_hash: &ManagedBuffer, + expected_result: Option>, + ) { + let transaction = self + .world + .tx() + .from(caller) + .to(HEADER_VERIFIER_ADDRESS) + .typed(header_verifier_proxy::HeaderverifierProxy) + .lock_operation_hash(hash_of_hashes, operation_hash); + + match expected_result { + Some(error) => transaction.returns(error).run(), + None => transaction.run(), + } + } + fn get_bls_keys(&mut self, bls_keys_vec: Vec>) -> BlsKeys { let bls_keys = bls_keys_vec.iter().cloned().collect(); @@ -249,7 +270,7 @@ fn test_remove_executed_hash_caller_not_esdt_address() { state.propose_remove_executed_hash( OWNER, &operation.bridge_operation_hash, - operation_1, + &operation_1, Some(ExpectError( 4, "Only ESDT Safe contract can call this endpoint", @@ -273,7 +294,7 @@ fn test_remove_executed_hash_no_esdt_address_registered() { state.propose_remove_executed_hash( ENSHRINE_ADDRESS, &operation.bridge_operation_hash, - operation_1, + &operation_1, Some(ExpectError(4, "There is no registered ESDT address")), ); } @@ -297,7 +318,7 @@ fn test_remove_one_executed_hash() { state.propose_remove_executed_hash( ENSHRINE_ADDRESS, &operation.bridge_operation_hash, - operation_hash_1.clone(), + &operation_hash_1, None, ); @@ -338,14 +359,14 @@ fn test_remove_all_executed_hashes() { state.propose_remove_executed_hash( ENSHRINE_ADDRESS, &operation.bridge_operation_hash, - operation_1, + &operation_1, None, ); state.propose_remove_executed_hash( ENSHRINE_ADDRESS, &operation.bridge_operation_hash, - operation_2, + &operation_2, None, ); state @@ -359,3 +380,67 @@ fn test_remove_all_executed_hashes() { assert!(sc.hash_of_hashes_history().contains(&hash_of_hashes)); }); } + +#[test] +fn test_lock_operation_not_registered() { + let mut state = HeaderVerifierTestState::new(); + let bls_key_1 = ManagedBuffer::from("bls_key_1"); + let managed_bls_keys = state.get_bls_keys(vec![bls_key_1]); + + state.deploy_header_verifier_contract(managed_bls_keys); + state.propose_register_esdt_address(ENSHRINE_ADDRESS); + + let operation_1 = ManagedBuffer::from("operation_1"); + let operation_2 = ManagedBuffer::from("operation_2"); + let operation = state.generate_bridge_operation_struct(vec![&operation_1, &operation_2]); + + state.propose_lock_operation_hash( + ENSHRINE_ADDRESS, + &operation.bridge_operation_hash, + &operation_1, + Some(ExpectError(4, "The current operation is not registered")), + ); +} + +#[test] +fn test_lock_operation() { + let mut state = HeaderVerifierTestState::new(); + let bls_key_1 = ManagedBuffer::from("bls_key_1"); + let managed_bls_keys = state.get_bls_keys(vec![bls_key_1]); + + state.deploy_header_verifier_contract(managed_bls_keys); + state.propose_register_esdt_address(ENSHRINE_ADDRESS); + + let operation_1 = ManagedBuffer::from("operation_1"); + let operation_2 = ManagedBuffer::from("operation_2"); + let operation = state.generate_bridge_operation_struct(vec![&operation_1, &operation_2]); + + state.propose_register_operations(operation.clone()); + + state.propose_lock_operation_hash( + ENSHRINE_ADDRESS, + &operation.bridge_operation_hash, + &operation_1, + None, + ); + + state + .world + .query() + .to(HEADER_VERIFIER_ADDRESS) + .whitebox(header_verifier::contract_obj, |sc| { + let hash_of_hashes: ManagedBuffer = + ManagedBuffer::from(operation.bridge_operation_hash.to_vec()); + let operation_hash_debug_api_1 = ManagedBuffer::from(operation_1.to_vec()); + let operation_hash_debug_api_2 = ManagedBuffer::from(operation_2.to_vec()); + let is_hash_1_locked = sc + .pending_hash(&hash_of_hashes, &operation_hash_debug_api_1) + .get(); + let is_hash_2_locked = sc + .pending_hash(&hash_of_hashes, &operation_hash_debug_api_2) + .get(); + + assert!(is_hash_1_locked == PendingHash::Locked); + assert!(is_hash_2_locked == PendingHash::NotLocked); + }) +} From 05631f16a77cd241b1f64abcc79083b36312efab Mon Sep 17 00:00:00 2001 From: Andrei Baltariu Date: Wed, 30 Oct 2024 11:08:47 +0200 Subject: [PATCH 503/523] Uncommented code and added asserts Signed-off-by: Andrei Baltariu --- header-verifier/tests/header_verifier_blackbox_test.rs | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/header-verifier/tests/header_verifier_blackbox_test.rs b/header-verifier/tests/header_verifier_blackbox_test.rs index fe20a090..ce19b821 100644 --- a/header-verifier/tests/header_verifier_blackbox_test.rs +++ b/header-verifier/tests/header_verifier_blackbox_test.rs @@ -376,7 +376,14 @@ fn test_remove_all_executed_hashes() { .whitebox(header_verifier::contract_obj, |sc| { let hash_of_hashes: ManagedBuffer = ManagedBuffer::from(operation.bridge_operation_hash.to_vec()); - // assert!(sc.pending_hash(&hash_of_hashes).is_empty()); + let operation_hash_debug_api_1 = ManagedBuffer::from(operation_1.to_vec()); + let operation_hash_debug_api_2 = ManagedBuffer::from(operation_2.to_vec()); + assert!(sc + .pending_hash(&hash_of_hashes, &operation_hash_debug_api_1) + .is_empty()); + assert!(sc + .pending_hash(&hash_of_hashes, &operation_hash_debug_api_2) + .is_empty()); assert!(sc.hash_of_hashes_history().contains(&hash_of_hashes)); }); } From e385b305767937d85edc4d5a177f5bdde135d10c Mon Sep 17 00:00:00 2001 From: Andrei Baltariu Date: Thu, 31 Oct 2024 09:07:33 +0200 Subject: [PATCH 504/523] Renamed mapper and enum Signed-off-by: Andrei Baltariu --- header-verifier/src/lib.rs | 30 +++++++++++-------- .../tests/header_verifier_blackbox_test.rs | 23 +++++++------- 2 files changed, 30 insertions(+), 23 deletions(-) diff --git a/header-verifier/src/lib.rs b/header-verifier/src/lib.rs index 12a0fa83..67d26cf7 100644 --- a/header-verifier/src/lib.rs +++ b/header-verifier/src/lib.rs @@ -8,7 +8,7 @@ pub mod header_verifier_proxy; multiversx_sc::imports!(); #[derive(TopEncode, TopDecode, PartialEq)] -pub enum PendingHash { +pub enum OperationHashStatus { NotLocked = 1, Locked, } @@ -48,8 +48,8 @@ pub trait Headerverifier: bls_signature::BlsSignatureModule { ); for operation_hash in operations_hashes { - self.pending_hash(&bridge_operations_hash, &operation_hash) - .set(PendingHash::NotLocked); + self.operation_hash_status(&bridge_operations_hash, &operation_hash) + .set(OperationHashStatus::NotLocked); } self.hash_of_hashes_history().insert(bridge_operations_hash); @@ -65,24 +65,30 @@ pub trait Headerverifier: bls_signature::BlsSignatureModule { fn remove_executed_hash(&self, hash_of_hashes: &ManagedBuffer, operation_hash: &ManagedBuffer) { self.require_caller_esdt_safe(); - self.pending_hash(hash_of_hashes, operation_hash).clear(); + self.operation_hash_status(hash_of_hashes, operation_hash) + .clear(); } #[endpoint(lockOperationHash)] fn lock_operation_hash(&self, hash_of_hashes: ManagedBuffer, operation_hash: ManagedBuffer) { self.require_caller_esdt_safe(); - let pending_hashes_mapper = self.pending_hash(&hash_of_hashes, &operation_hash); + let operation_hash_status_mapper = + self.operation_hash_status(&hash_of_hashes, &operation_hash); require!( - !pending_hashes_mapper.is_empty(), + !operation_hash_status_mapper.is_empty(), "The current operation is not registered" ); - let is_hash_in_execution = pending_hashes_mapper.get(); + let is_hash_in_execution = operation_hash_status_mapper.get(); match is_hash_in_execution { - PendingHash::NotLocked => pending_hashes_mapper.set(PendingHash::Locked), - PendingHash::Locked => sc_panic!("The current operation is already in execution"), + OperationHashStatus::NotLocked => { + operation_hash_status_mapper.set(OperationHashStatus::Locked) + } + OperationHashStatus::Locked => { + sc_panic!("The current operation is already in execution") + } } } @@ -139,12 +145,12 @@ pub trait Headerverifier: bls_signature::BlsSignatureModule { #[storage_mapper("blsPubKeys")] fn bls_pub_keys(&self) -> SetMapper; - #[storage_mapper("pendingHashes")] - fn pending_hash( + #[storage_mapper("operationHashStatus")] + fn operation_hash_status( &self, hash_of_hashes: &ManagedBuffer, operation_hash: &ManagedBuffer, - ) -> SingleValueMapper; + ) -> SingleValueMapper; #[storage_mapper("hashOfHashesHistory")] fn hash_of_hashes_history(&self) -> UnorderedSetMapper; diff --git a/header-verifier/tests/header_verifier_blackbox_test.rs b/header-verifier/tests/header_verifier_blackbox_test.rs index ce19b821..eaaf3725 100644 --- a/header-verifier/tests/header_verifier_blackbox_test.rs +++ b/header-verifier/tests/header_verifier_blackbox_test.rs @@ -1,5 +1,5 @@ use bls_signature::BlsSignature; -use header_verifier::{header_verifier_proxy, Headerverifier, PendingHash}; +use header_verifier::{header_verifier_proxy, Headerverifier, OperationHashStatus}; use multiversx_sc::types::ManagedBuffer; use multiversx_sc::{ api::ManagedTypeApi, @@ -242,13 +242,13 @@ fn test_register_bridge_operation() { let operation_hash_debug_api = ManagedBuffer::from(operation_hash.to_vec()); let pending_hashes_mapper = - sc.pending_hash(&hash_of_hashes, &operation_hash_debug_api); + sc.operation_hash_status(&hash_of_hashes, &operation_hash_debug_api); let is_mapper_empty = pending_hashes_mapper.is_empty(); let is_operation_hash_locked = pending_hashes_mapper.get(); assert!(!is_mapper_empty); - assert!(is_operation_hash_locked == PendingHash::NotLocked); + assert!(is_operation_hash_locked == OperationHashStatus::NotLocked); } }); } @@ -331,13 +331,14 @@ fn test_remove_one_executed_hash() { ManagedBuffer::from(operation.bridge_operation_hash.to_vec()); let operation_hash_debug_api = ManagedBuffer::from(operation_hash_2.to_vec()); - let pending_hashes_mapper = sc.pending_hash(&hash_of_hashes, &operation_hash_debug_api); + let pending_hashes_mapper = + sc.operation_hash_status(&hash_of_hashes, &operation_hash_debug_api); let is_hash_locked = pending_hashes_mapper.get(); let is_mapper_empty = pending_hashes_mapper.is_empty(); assert!(!is_mapper_empty); - assert!(is_hash_locked == PendingHash::NotLocked); + assert!(is_hash_locked == OperationHashStatus::NotLocked); }); } @@ -379,10 +380,10 @@ fn test_remove_all_executed_hashes() { let operation_hash_debug_api_1 = ManagedBuffer::from(operation_1.to_vec()); let operation_hash_debug_api_2 = ManagedBuffer::from(operation_2.to_vec()); assert!(sc - .pending_hash(&hash_of_hashes, &operation_hash_debug_api_1) + .operation_hash_status(&hash_of_hashes, &operation_hash_debug_api_1) .is_empty()); assert!(sc - .pending_hash(&hash_of_hashes, &operation_hash_debug_api_2) + .operation_hash_status(&hash_of_hashes, &operation_hash_debug_api_2) .is_empty()); assert!(sc.hash_of_hashes_history().contains(&hash_of_hashes)); }); @@ -441,13 +442,13 @@ fn test_lock_operation() { let operation_hash_debug_api_1 = ManagedBuffer::from(operation_1.to_vec()); let operation_hash_debug_api_2 = ManagedBuffer::from(operation_2.to_vec()); let is_hash_1_locked = sc - .pending_hash(&hash_of_hashes, &operation_hash_debug_api_1) + .operation_hash_status(&hash_of_hashes, &operation_hash_debug_api_1) .get(); let is_hash_2_locked = sc - .pending_hash(&hash_of_hashes, &operation_hash_debug_api_2) + .operation_hash_status(&hash_of_hashes, &operation_hash_debug_api_2) .get(); - assert!(is_hash_1_locked == PendingHash::Locked); - assert!(is_hash_2_locked == PendingHash::NotLocked); + assert!(is_hash_1_locked == OperationHashStatus::Locked); + assert!(is_hash_2_locked == OperationHashStatus::NotLocked); }) } From 78a313b93639aff5a4cc142b796fc03f2981d47c Mon Sep 17 00:00:00 2001 From: Andrei Baltariu Date: Thu, 31 Oct 2024 11:35:46 +0200 Subject: [PATCH 505/523] Modified tx gas constant Signed-off-by: Andrei Baltariu --- esdt-safe/src/from_sovereign/transfer_tokens.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/esdt-safe/src/from_sovereign/transfer_tokens.rs b/esdt-safe/src/from_sovereign/transfer_tokens.rs index 112d8d6e..c7215f78 100644 --- a/esdt-safe/src/from_sovereign/transfer_tokens.rs +++ b/esdt-safe/src/from_sovereign/transfer_tokens.rs @@ -7,7 +7,7 @@ use crate::to_sovereign; multiversx_sc::imports!(); const CALLBACK_GAS: GasLimit = 10_000_000; // Increase if not enough -const TRANSACTION_GAS: GasLimit = 30_000_000; +const ESDT_TRANSACTION_GAS: GasLimit = 5_000_000; #[multiversx_sc::module] pub trait TransferTokensModule: @@ -191,7 +191,7 @@ pub trait TransferTokensModule: .to(&operation_tuple.operation.to) .raw_call(ESDT_MULTI_TRANSFER_FUNC_NAME) .payment(&mapped_tokens) - .gas(TRANSACTION_GAS) + .gas(ESDT_TRANSACTION_GAS) .callback( ::callbacks(self) .execute(hash_of_hashes, operation_tuple), From ef31150f970d7d743219829945b92145aeed0762 Mon Sep 17 00:00:00 2001 From: Andrei Baltariu Date: Thu, 31 Oct 2024 11:36:59 +0200 Subject: [PATCH 506/523] Modified fee-market call to be sync Signed-off-by: Andrei Baltariu --- esdt-safe/src/to_sovereign/create_tx.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/esdt-safe/src/to_sovereign/create_tx.rs b/esdt-safe/src/to_sovereign/create_tx.rs index ef9dac88..738b2862 100644 --- a/esdt-safe/src/to_sovereign/create_tx.rs +++ b/esdt-safe/src/to_sovereign/create_tx.rs @@ -222,7 +222,7 @@ pub trait CreateTxModule: .typed(fee_market_proxy::FeeMarketProxy) .subtract_fee(caller, total_tokens_for_fees, OptionalValue::Some(gas)) .payment(fee) - .async_call_and_exit(); + .sync_call(); } OptionalValue::None => (), }; From 08e888ac95601ba7f8dcc7db2433de214071b8bc Mon Sep 17 00:00:00 2001 From: Andrei Baltariu Date: Thu, 31 Oct 2024 11:57:21 +0200 Subject: [PATCH 507/523] Added `hash_of_hashes` mapper variable Signed-off-by: Andrei Baltariu --- header-verifier/src/lib.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/header-verifier/src/lib.rs b/header-verifier/src/lib.rs index 67d26cf7..da861c22 100644 --- a/header-verifier/src/lib.rs +++ b/header-verifier/src/lib.rs @@ -32,10 +32,10 @@ pub trait Headerverifier: bls_signature::BlsSignatureModule { bridge_operations_hash: ManagedBuffer, operations_hashes: MultiValueEncoded, ) { + let mut hash_of_hashes_history_mapper = self.hash_of_hashes_history(); + require!( - !self - .hash_of_hashes_history() - .contains(&bridge_operations_hash), + !hash_of_hashes_history_mapper.contains(&bridge_operations_hash), "The OutGoingTxsHash has already been registered" ); @@ -52,7 +52,7 @@ pub trait Headerverifier: bls_signature::BlsSignatureModule { .set(OperationHashStatus::NotLocked); } - self.hash_of_hashes_history().insert(bridge_operations_hash); + hash_of_hashes_history_mapper.insert(bridge_operations_hash); } #[only_owner] From 0998833f083dc873488a137546f66a3e436a31e1 Mon Sep 17 00:00:00 2001 From: Andrei Baltariu Date: Thu, 31 Oct 2024 12:22:41 +0200 Subject: [PATCH 508/523] Added `new()` for `OperationEsdtPayment` in ESDT-Safe Signed-off-by: Andrei Baltariu --- .../src/from_sovereign/transfer_tokens.rs | 20 +++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/esdt-safe/src/from_sovereign/transfer_tokens.rs b/esdt-safe/src/from_sovereign/transfer_tokens.rs index c7215f78..720fb537 100644 --- a/esdt-safe/src/from_sovereign/transfer_tokens.rs +++ b/esdt-safe/src/from_sovereign/transfer_tokens.rs @@ -71,22 +71,22 @@ pub trait TransferTokensModule: .esdt_local_mint(&mvx_token_id, 0, &operation_token.token_data.amount) .sync_call(); - output_payments.push(OperationEsdtPayment { - token_identifier: mvx_token_id, - token_nonce: 0, - token_data: operation_token.token_data, - }); + output_payments.push(OperationEsdtPayment::new( + mvx_token_id, + 0, + operation_token.token_data, + )); continue; } let nft_nonce = self.esdt_create_and_update_mapper(&mvx_token_id, &operation_token); - output_payments.push(OperationEsdtPayment { - token_identifier: mvx_token_id, - token_nonce: nft_nonce, - token_data: operation_token.token_data, - }); + output_payments.push(OperationEsdtPayment::new( + mvx_token_id, + nft_nonce, + operation_token.token_data, + )); } output_payments From ac2dfbf6e1ad1c6efe157bcd436f4bf70785dadc Mon Sep 17 00:00:00 2001 From: Andrei Baltariu Date: Fri, 8 Nov 2024 10:22:22 +0200 Subject: [PATCH 509/523] Enshrine FW-upgrade Signed-off-by: Andrei Baltariu --- Cargo.lock | 289 +++++++----------- chain-config/Cargo.toml | 6 +- chain-config/meta/Cargo.toml | 2 +- chain-config/wasm/Cargo.lock | 27 +- chain-config/wasm/Cargo.toml | 2 +- chain-factory/Cargo.toml | 4 +- chain-factory/meta/Cargo.toml | 2 +- .../wasm-chain-factory-full/Cargo.lock | 27 +- .../wasm-chain-factory-full/Cargo.toml | 2 +- .../wasm-chain-factory-view/Cargo.lock | 27 +- .../wasm-chain-factory-view/Cargo.toml | 2 +- chain-factory/wasm/Cargo.lock | 27 +- chain-factory/wasm/Cargo.toml | 2 +- common/bls-signature/Cargo.toml | 4 +- common/max-bridged-amount-module/Cargo.toml | 4 +- common/setup-phase/Cargo.toml | 4 +- common/token-whitelist/Cargo.toml | 4 +- common/transaction/Cargo.toml | 2 +- common/tx-batch-module/Cargo.toml | 4 +- common/utils/Cargo.toml | 2 +- enshrine-esdt-safe/Cargo.toml | 6 +- enshrine-esdt-safe/meta/Cargo.toml | 2 +- .../wasm-enshrine-esdt-safe-full/Cargo.lock | 27 +- .../wasm-enshrine-esdt-safe-full/Cargo.toml | 2 +- .../wasm-enshrine-esdt-safe-view/Cargo.lock | 27 +- .../wasm-enshrine-esdt-safe-view/Cargo.toml | 2 +- enshrine-esdt-safe/wasm/Cargo.lock | 27 +- enshrine-esdt-safe/wasm/Cargo.toml | 2 +- esdt-safe/Cargo.toml | 6 +- esdt-safe/interactor/Cargo.toml | 27 +- esdt-safe/meta/Cargo.toml | 2 +- .../src/from_sovereign/transfer_tokens.rs | 2 +- esdt-safe/wasm-esdt-safe-full/Cargo.lock | 27 +- esdt-safe/wasm-esdt-safe-full/Cargo.toml | 2 +- esdt-safe/wasm-esdt-safe-view/Cargo.lock | 27 +- esdt-safe/wasm-esdt-safe-view/Cargo.toml | 2 +- esdt-safe/wasm/Cargo.lock | 27 +- esdt-safe/wasm/Cargo.toml | 2 +- fee-market/Cargo.toml | 4 +- fee-market/meta/Cargo.toml | 2 +- fee-market/wasm-fee-marker-full/Cargo.lock | 23 +- fee-market/wasm-fee-marker-full/Cargo.toml | 2 +- fee-market/wasm-multisig-view/Cargo.lock | 23 +- fee-market/wasm-multisig-view/Cargo.toml | 2 +- fee-market/wasm/Cargo.lock | 23 +- fee-market/wasm/Cargo.toml | 2 +- header-verifier/Cargo.toml | 4 +- header-verifier/meta/Cargo.toml | 2 +- .../wasm-header-verifier-full/Cargo.lock | 23 +- .../wasm-header-verifier-full/Cargo.toml | 2 +- header-verifier/wasm-multisig-view/Cargo.lock | 23 +- header-verifier/wasm-multisig-view/Cargo.toml | 2 +- header-verifier/wasm/Cargo.lock | 23 +- header-verifier/wasm/Cargo.toml | 2 +- token-handler/Cargo.toml | 4 +- token-handler/meta/Cargo.toml | 2 +- .../wasm-token-handler-full/Cargo.lock | 27 +- .../wasm-token-handler-full/Cargo.toml | 2 +- .../wasm-token-handler-view/Cargo.lock | 27 +- .../wasm-token-handler-view/Cargo.toml | 2 +- token-handler/wasm/Cargo.lock | 27 +- token-handler/wasm/Cargo.toml | 2 +- 62 files changed, 527 insertions(+), 390 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 76877f93..1475b9ac 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -109,12 +109,6 @@ version = "0.7.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7c02d123df017efcdfbd739ef81735b36c5ba83ec3c59c80a9d7ecc718f92e50" -[[package]] -name = "atomic-waker" -version = "1.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1505bd5d3d116872e7271a6d4e16d81d0c8570876c8de68093a09ac269d8aac0" - [[package]] name = "autocfg" version = "1.2.0" @@ -183,12 +177,6 @@ dependencies = [ "hex-conservative", ] -[[package]] -name = "bitflags" -version = "1.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" - [[package]] name = "bitflags" version = "2.6.0" @@ -481,15 +469,6 @@ version = "1.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "11157ac094ffbdde99aa67b23417ebdd801842852b500e395a45a9c0aac03e4a" -[[package]] -name = "encoding_rs" -version = "0.8.34" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b45de904aa0b010bce2ab45264d0631681847fa7b6f2eaa7dab7619943bc4f59" -dependencies = [ - "cfg-if", -] - [[package]] name = "endian-type" version = "0.1.2" @@ -772,25 +751,6 @@ version = "0.29.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "40ecd4077b5ae9fd2e9e169b102c6c330d0605168eb0e8bf79952b256dbefffd" -[[package]] -name = "h2" -version = "0.4.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "524e8ac6999421f49a846c2d4411f337e53497d8ec55d67753beffa43c5d9205" -dependencies = [ - "atomic-waker", - "bytes", - "fnv", - "futures-core", - "futures-sink", - "http", - "indexmap", - "slab", - "tokio", - "tokio-util", - "tracing", -] - [[package]] name = "hashbrown" version = "0.14.3" @@ -914,7 +874,6 @@ dependencies = [ "bytes", "futures-channel", "futures-util", - "h2", "http", "http-body", "httparse", @@ -925,23 +884,6 @@ dependencies = [ "want", ] -[[package]] -name = "hyper-rustls" -version = "0.27.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "08afdbb5c31130e3034af566421053ab03787c640246a446327f550d11bcb333" -dependencies = [ - "futures-util", - "http", - "hyper", - "hyper-util", - "rustls", - "rustls-pki-types", - "tokio", - "tokio-rustls", - "tower-service", -] - [[package]] name = "hyper-tls" version = "0.6.0" @@ -1052,6 +994,12 @@ version = "1.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" +[[package]] +name = "leb128" +version = "0.2.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "884e2677b40cc8c339eaefcb701c32ef1fd2493d71118dc0ca4b6a736c93bd67" + [[package]] name = "libc" version = "0.2.153" @@ -1121,6 +1069,16 @@ dependencies = [ "windows-sys 0.52.0", ] +[[package]] +name = "multiversx-chain-core" +version = "0.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0c1088b268cad0d8c1146df9ca71a1f2baaee78267ab75e2202c0c0c71cc4b6e" +dependencies = [ + "bitflags", + "multiversx-sc-codec", +] + [[package]] name = "multiversx-chain-scenario-format" version = "0.23.0" @@ -1138,16 +1096,17 @@ dependencies = [ [[package]] name = "multiversx-chain-vm" -version = "0.10.0" +version = "0.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "13c537d27dfc7a8e295d4f7c5f67a967ce66b6c3fc8e31a160e8cf28e14ecb2d" +checksum = "0d885c04e117cf5ca37303825a578385dbc880ee89890b0649dbbb22ad19dc59" dependencies = [ - "bitflags 2.6.0", + "bitflags", "colored", "ed25519-dalek", "hex", "hex-literal", "itertools", + "multiversx-chain-core", "multiversx-chain-vm-executor", "num-bigint", "num-traits", @@ -1165,12 +1124,13 @@ checksum = "b59072fa0624b55ae5ae3fa6bfa91515bbeb4ac440214bc4a509e2c8806d6e9f" [[package]] name = "multiversx-sc" -version = "0.53.2" +version = "0.54.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "75ea89a26f0aacda21437a8ae5ccfbefab99d8191942b3d2eddbcbf84f9866d7" +checksum = "b9e5cee0b8c5fbaa9edfee2e38f2162adb01700a0028942d2cd14808cd26b130" dependencies = [ - "bitflags 2.6.0", + "bitflags", "hex-literal", + "multiversx-chain-core", "multiversx-sc-codec", "multiversx-sc-derive", "num-traits", @@ -1203,9 +1163,9 @@ dependencies = [ [[package]] name = "multiversx-sc-derive" -version = "0.53.2" +version = "0.54.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4c17fdf90fafca2f19085ae67b0502d9f71bf8ab1be3c83808eb88e02a8c18b9" +checksum = "931669b080cf793b205bf08b5d1f4a658d0ac0ad628844d9a9d13649a73c7540" dependencies = [ "hex", "proc-macro2", @@ -1216,9 +1176,9 @@ dependencies = [ [[package]] name = "multiversx-sc-meta-lib" -version = "0.53.2" +version = "0.54.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ef023806e14a8a6245408c4a7dfdf17d4a1eb39425cedfe50cd2c48f96708ab6" +checksum = "f9e6e7f9091e647e1a51d147de1029c753eef254f5a5c19fc6ecc4c5292359be" dependencies = [ "clap", "colored", @@ -1231,24 +1191,25 @@ dependencies = [ "serde", "serde_json", "toml", - "wasmparser", + "wasmparser 0.216.0", "wasmprinter", + "wat", ] [[package]] name = "multiversx-sc-modules" -version = "0.53.2" +version = "0.54.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "daeb48acbd39255868a3241798df2f85050f0ae8d82d6417bd2cd0e30a241855" +checksum = "5373903a01dd7d33547b83f0034dc6e12fbbc8e49fcb316a3efb6ef4ff6573a8" dependencies = [ "multiversx-sc", ] [[package]] name = "multiversx-sc-scenario" -version = "0.53.2" +version = "0.54.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cd16e3bf1f6696d0add36b7b905b1ffdd13b836e584da000f5e265c11e2bfc8d" +checksum = "1eae4de5e3ae0de3631ad0777b97ef14c92d13894a7e55e2d3d304a2e5f40aa5" dependencies = [ "base64", "bech32", @@ -1272,10 +1233,11 @@ dependencies = [ [[package]] name = "multiversx-sc-snippets" -version = "0.53.2" +version = "0.54.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ad7edebc3a84f3f08b40e928e44bb0042f13058c33c040510a218746d4bf5476" +checksum = "83eec6ebd7efc32eb77d19ea29f3f13d42b7d848662b173c920201741ec3897e" dependencies = [ + "anyhow", "base64", "env_logger", "futures", @@ -1284,14 +1246,15 @@ dependencies = [ "multiversx-chain-scenario-format", "multiversx-sc-scenario", "multiversx-sdk", + "multiversx-sdk-http", "tokio", ] [[package]] name = "multiversx-sdk" -version = "0.6.1" +version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ccf9bc1c31815db80017c68353b7187bc606b573af26f13331e9507d29f1976f" +checksum = "1c393e7b58c5eafcfc814bb13efe2a09f20fa0dbfee93bc501ca4236135a7647" dependencies = [ "aes", "anyhow", @@ -1303,21 +1266,35 @@ dependencies = [ "hmac", "itertools", "log", + "multiversx-chain-core", "pbkdf2", "pem", "rand", - "reqwest", "scrypt", "serde", "serde_json", "serde_repr", "sha2", "sha3", - "tokio", "uuid", "zeroize", ] +[[package]] +name = "multiversx-sdk-http" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6f0727639c2b44d21d024f8134231c37d50ad76788675c77bee342016a63e226" +dependencies = [ + "anyhow", + "hex", + "itertools", + "log", + "multiversx-sdk", + "reqwest", + "tokio", +] + [[package]] name = "native-tls" version = "0.2.12" @@ -1393,7 +1370,7 @@ version = "0.10.66" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9529f4786b70a3e8c61e11179af17ab6188ad8d0ded78c5529441ed39d4bd9c1" dependencies = [ - "bitflags 2.6.0", + "bitflags", "cfg-if", "foreign-types", "libc", @@ -1604,7 +1581,7 @@ version = "0.5.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9b6dfecf2c74bce2466cabf93f6664d6998a69eb21e39f4207930065b27b771f" dependencies = [ - "bitflags 2.6.0", + "bitflags", ] [[package]] @@ -1644,16 +1621,13 @@ checksum = "c7d6d2a27d57148378eb5e111173f4276ad26340ecc5c49a4a2152167a2d6a37" dependencies = [ "base64", "bytes", - "encoding_rs", "futures-channel", "futures-core", "futures-util", - "h2", "http", "http-body", "http-body-util", "hyper", - "hyper-rustls", "hyper-tls", "hyper-util", "ipnet", @@ -1669,7 +1643,6 @@ dependencies = [ "serde_json", "serde_urlencoded", "sync_wrapper", - "system-configuration", "tokio", "tokio-native-tls", "tower-service", @@ -1680,21 +1653,6 @@ dependencies = [ "winreg", ] -[[package]] -name = "ring" -version = "0.17.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c17fa4cb658e3583423e915b9f3acc01cceaee1860e33d59ebae66adc3a2dc0d" -dependencies = [ - "cc", - "cfg-if", - "getrandom", - "libc", - "spin", - "untrusted", - "windows-sys 0.52.0", -] - [[package]] name = "rust-interact" version = "0.0.0" @@ -1732,26 +1690,13 @@ version = "0.38.34" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "70dc5ec042f7a43c4a73241207cecc9873a06d45debb38b329f8541d85c2730f" dependencies = [ - "bitflags 2.6.0", + "bitflags", "errno", "libc", "linux-raw-sys", "windows-sys 0.52.0", ] -[[package]] -name = "rustls" -version = "0.23.14" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "415d9944693cb90382053259f89fbb077ea730ad7273047ec63b19bc9b160ba8" -dependencies = [ - "once_cell", - "rustls-pki-types", - "rustls-webpki", - "subtle", - "zeroize", -] - [[package]] name = "rustls-pemfile" version = "2.2.0" @@ -1767,17 +1712,6 @@ version = "1.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0e696e35370c65c9c541198af4543ccd580cf17fc25d8e05c5a242b202488c55" -[[package]] -name = "rustls-webpki" -version = "0.102.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "64ca1bc8749bd4cf37b5ce386cc146580777b4e8572c7b97baf22c83f444bee9" -dependencies = [ - "ring", - "rustls-pki-types", - "untrusted", -] - [[package]] name = "ryu" version = "1.0.17" @@ -1826,7 +1760,7 @@ version = "2.11.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "897b2245f0b511c87893af39b033e5ca9cce68824c4d7e7630b5a1d339658d02" dependencies = [ - "bitflags 2.6.0", + "bitflags", "core-foundation", "core-foundation-sys", "libc", @@ -1991,12 +1925,6 @@ dependencies = [ "windows-sys 0.52.0", ] -[[package]] -name = "spin" -version = "0.9.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6980e8d7511241f8acf4aebddbb1ff938df5eebe98691418c4468d0b72a96a67" - [[package]] name = "spki" version = "0.7.3" @@ -2036,27 +1964,6 @@ version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a7065abeca94b6a8a577f9bd45aa0867a2238b74e8eb67cf10d492bc39351394" -[[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.11.0" @@ -2164,30 +2071,6 @@ dependencies = [ "tokio", ] -[[package]] -name = "tokio-rustls" -version = "0.26.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0c7bc40d0e5a97695bb96e27995cd3a08538541b0a846f65bba7a359f36700d4" -dependencies = [ - "rustls", - "rustls-pki-types", - "tokio", -] - -[[package]] -name = "tokio-util" -version = "0.7.12" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "61e7c3654c13bcd040d4a03abee2c75b1d14a37b423cf5a813ceae1cc903ec6a" -dependencies = [ - "bytes", - "futures-core", - "futures-sink", - "pin-project-lite", - "tokio", -] - [[package]] name = "toml" version = "0.8.12" @@ -2304,10 +2187,10 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d4c87d22b6e3f4a18d4d40ef354e97c90fcb14dd91d7dc0aa9d8a1172ebf7202" [[package]] -name = "untrusted" -version = "0.9.0" +name = "unicode-width" +version = "0.1.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8ecb6da28b8a351d773b68d5825ac39017e680750f980f3a1a85cd8dd28a47c1" +checksum = "7dd6e30e90baa6f72411720665d41d89b9a3d039dc45b8faea1ddd07f617f6af" [[package]] name = "unwrap-infallible" @@ -2443,6 +2326,16 @@ version = "0.2.93" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c62a0a307cb4a311d3a07867860911ca130c3494e8c2719593806c08bc5d0484" +[[package]] +name = "wasm-encoder" +version = "0.219.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "29cbbd772edcb8e7d524a82ee8cef8dd046fc14033796a754c3ad246d019fa54" +dependencies = [ + "leb128", + "wasmparser 0.219.1", +] + [[package]] name = "wasmparser" version = "0.216.0" @@ -2450,13 +2343,23 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bcdee6bea3619d311fb4b299721e89a986c3470f804b6d534340e412589028e3" dependencies = [ "ahash", - "bitflags 2.6.0", + "bitflags", "hashbrown", "indexmap", "semver", "serde", ] +[[package]] +name = "wasmparser" +version = "0.219.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5c771866898879073c53b565a6c7b49953795159836714ac56a5befb581227c5" +dependencies = [ + "bitflags", + "indexmap", +] + [[package]] name = "wasmprinter" version = "0.216.0" @@ -2465,7 +2368,29 @@ checksum = "8f82916f3892e53620639217d6ec78fe15c678352a3fbf3f3745b6417d0bd70f" dependencies = [ "anyhow", "termcolor", - "wasmparser", + "wasmparser 0.216.0", +] + +[[package]] +name = "wast" +version = "219.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4f79a9d9df79986a68689a6b40bcc8d5d40d807487b235bebc2ac69a242b54a1" +dependencies = [ + "bumpalo", + "leb128", + "memchr", + "unicode-width", + "wasm-encoder", +] + +[[package]] +name = "wat" +version = "1.219.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8bc3cf014fb336883a411cd662f987abf6a1d2a27f2f0008616a0070bbf6bd0d" +dependencies = [ + "wast", ] [[package]] diff --git a/chain-config/Cargo.toml b/chain-config/Cargo.toml index 2c50fa75..2f30c7f5 100644 --- a/chain-config/Cargo.toml +++ b/chain-config/Cargo.toml @@ -12,10 +12,10 @@ path = "src/lib.rs" num-bigint = "0.4.2" [dev-dependencies.multiversx-sc-scenario] -version = "=0.53.2" +version = "=0.54.0" [dependencies.multiversx-sc] -version = "=0.53.2" +version = "=0.54.0" [dependencies.multiversx-sc-modules] -version = "=0.53.2" +version = "=0.54.0" diff --git a/chain-config/meta/Cargo.toml b/chain-config/meta/Cargo.toml index 6b3ac65f..8128b0dd 100644 --- a/chain-config/meta/Cargo.toml +++ b/chain-config/meta/Cargo.toml @@ -11,4 +11,4 @@ authors = ["you"] path = ".." [dependencies.multiversx-sc-meta-lib] -version = "=0.53.2" +version = "=0.54.0" diff --git a/chain-config/wasm/Cargo.lock b/chain-config/wasm/Cargo.lock index ae53e5bc..71f0a3f0 100644 --- a/chain-config/wasm/Cargo.lock +++ b/chain-config/wasm/Cargo.lock @@ -54,14 +54,25 @@ version = "0.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6fe2267d4ed49bc07b63801559be28c718ea06c4738b7a03c94df7386d2cde46" +[[package]] +name = "multiversx-chain-core" +version = "0.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0c1088b268cad0d8c1146df9ca71a1f2baaee78267ab75e2202c0c0c71cc4b6e" +dependencies = [ + "bitflags", + "multiversx-sc-codec", +] + [[package]] name = "multiversx-sc" -version = "0.53.2" +version = "0.54.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "75ea89a26f0aacda21437a8ae5ccfbefab99d8191942b3d2eddbcbf84f9866d7" +checksum = "b9e5cee0b8c5fbaa9edfee2e38f2162adb01700a0028942d2cd14808cd26b130" dependencies = [ "bitflags", "hex-literal", + "multiversx-chain-core", "multiversx-sc-codec", "multiversx-sc-derive", "num-traits", @@ -93,9 +104,9 @@ dependencies = [ [[package]] name = "multiversx-sc-derive" -version = "0.53.2" +version = "0.54.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4c17fdf90fafca2f19085ae67b0502d9f71bf8ab1be3c83808eb88e02a8c18b9" +checksum = "931669b080cf793b205bf08b5d1f4a658d0ac0ad628844d9a9d13649a73c7540" dependencies = [ "hex", "proc-macro2", @@ -106,18 +117,18 @@ dependencies = [ [[package]] name = "multiversx-sc-modules" -version = "0.53.2" +version = "0.54.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "daeb48acbd39255868a3241798df2f85050f0ae8d82d6417bd2cd0e30a241855" +checksum = "5373903a01dd7d33547b83f0034dc6e12fbbc8e49fcb316a3efb6ef4ff6573a8" dependencies = [ "multiversx-sc", ] [[package]] name = "multiversx-sc-wasm-adapter" -version = "0.53.2" +version = "0.54.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "20659915a4377d375c46d7f237e810053a03f7e084fad6362dd5748a7233defb" +checksum = "c034ae143cfd971cf0c4d67476af1920a9a0165bd99713458397ac06762fca0d" dependencies = [ "multiversx-sc", ] diff --git a/chain-config/wasm/Cargo.toml b/chain-config/wasm/Cargo.toml index 338d37b3..3e4e107a 100644 --- a/chain-config/wasm/Cargo.toml +++ b/chain-config/wasm/Cargo.toml @@ -28,7 +28,7 @@ panic = "abort" path = ".." [dependencies.multiversx-sc-wasm-adapter] -version = "=0.53.2" +version = "=0.54.0" [workspace] members = ["."] diff --git a/chain-factory/Cargo.toml b/chain-factory/Cargo.toml index 23f2b3b3..652abd76 100644 --- a/chain-factory/Cargo.toml +++ b/chain-factory/Cargo.toml @@ -12,10 +12,10 @@ path = "src/lib.rs" num-bigint = "0.4.2" [dev-dependencies.multiversx-sc-scenario] -version = "=0.53.2" +version = "=0.54.0" [dependencies.multiversx-sc] -version = "=0.53.2" +version = "=0.54.0" [dependencies.utils] path = "../common/utils" diff --git a/chain-factory/meta/Cargo.toml b/chain-factory/meta/Cargo.toml index cb29aa4c..49bad95a 100644 --- a/chain-factory/meta/Cargo.toml +++ b/chain-factory/meta/Cargo.toml @@ -11,4 +11,4 @@ authors = ["you"] path = ".." [dependencies.multiversx-sc-meta-lib] -version = "=0.53.2" +version = "=0.54.0" diff --git a/chain-factory/wasm-chain-factory-full/Cargo.lock b/chain-factory/wasm-chain-factory-full/Cargo.lock index 7678c881..356cb629 100644 --- a/chain-factory/wasm-chain-factory-full/Cargo.lock +++ b/chain-factory/wasm-chain-factory-full/Cargo.lock @@ -72,14 +72,25 @@ version = "0.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6fe2267d4ed49bc07b63801559be28c718ea06c4738b7a03c94df7386d2cde46" +[[package]] +name = "multiversx-chain-core" +version = "0.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0c1088b268cad0d8c1146df9ca71a1f2baaee78267ab75e2202c0c0c71cc4b6e" +dependencies = [ + "bitflags", + "multiversx-sc-codec", +] + [[package]] name = "multiversx-sc" -version = "0.53.2" +version = "0.54.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "75ea89a26f0aacda21437a8ae5ccfbefab99d8191942b3d2eddbcbf84f9866d7" +checksum = "b9e5cee0b8c5fbaa9edfee2e38f2162adb01700a0028942d2cd14808cd26b130" dependencies = [ "bitflags", "hex-literal", + "multiversx-chain-core", "multiversx-sc-codec", "multiversx-sc-derive", "num-traits", @@ -111,9 +122,9 @@ dependencies = [ [[package]] name = "multiversx-sc-derive" -version = "0.53.2" +version = "0.54.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4c17fdf90fafca2f19085ae67b0502d9f71bf8ab1be3c83808eb88e02a8c18b9" +checksum = "931669b080cf793b205bf08b5d1f4a658d0ac0ad628844d9a9d13649a73c7540" dependencies = [ "hex", "proc-macro2", @@ -124,18 +135,18 @@ dependencies = [ [[package]] name = "multiversx-sc-modules" -version = "0.53.2" +version = "0.54.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "daeb48acbd39255868a3241798df2f85050f0ae8d82d6417bd2cd0e30a241855" +checksum = "5373903a01dd7d33547b83f0034dc6e12fbbc8e49fcb316a3efb6ef4ff6573a8" dependencies = [ "multiversx-sc", ] [[package]] name = "multiversx-sc-wasm-adapter" -version = "0.53.2" +version = "0.54.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "20659915a4377d375c46d7f237e810053a03f7e084fad6362dd5748a7233defb" +checksum = "c034ae143cfd971cf0c4d67476af1920a9a0165bd99713458397ac06762fca0d" dependencies = [ "multiversx-sc", ] diff --git a/chain-factory/wasm-chain-factory-full/Cargo.toml b/chain-factory/wasm-chain-factory-full/Cargo.toml index 967fcfcf..6eea8a36 100644 --- a/chain-factory/wasm-chain-factory-full/Cargo.toml +++ b/chain-factory/wasm-chain-factory-full/Cargo.toml @@ -28,7 +28,7 @@ panic = "abort" path = ".." [dependencies.multiversx-sc-wasm-adapter] -version = "=0.53.2" +version = "=0.54.0" [workspace] members = ["."] diff --git a/chain-factory/wasm-chain-factory-view/Cargo.lock b/chain-factory/wasm-chain-factory-view/Cargo.lock index c9ee4371..f9fbda65 100644 --- a/chain-factory/wasm-chain-factory-view/Cargo.lock +++ b/chain-factory/wasm-chain-factory-view/Cargo.lock @@ -72,14 +72,25 @@ version = "0.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6fe2267d4ed49bc07b63801559be28c718ea06c4738b7a03c94df7386d2cde46" +[[package]] +name = "multiversx-chain-core" +version = "0.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0c1088b268cad0d8c1146df9ca71a1f2baaee78267ab75e2202c0c0c71cc4b6e" +dependencies = [ + "bitflags", + "multiversx-sc-codec", +] + [[package]] name = "multiversx-sc" -version = "0.53.2" +version = "0.54.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "75ea89a26f0aacda21437a8ae5ccfbefab99d8191942b3d2eddbcbf84f9866d7" +checksum = "b9e5cee0b8c5fbaa9edfee2e38f2162adb01700a0028942d2cd14808cd26b130" dependencies = [ "bitflags", "hex-literal", + "multiversx-chain-core", "multiversx-sc-codec", "multiversx-sc-derive", "num-traits", @@ -111,9 +122,9 @@ dependencies = [ [[package]] name = "multiversx-sc-derive" -version = "0.53.2" +version = "0.54.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4c17fdf90fafca2f19085ae67b0502d9f71bf8ab1be3c83808eb88e02a8c18b9" +checksum = "931669b080cf793b205bf08b5d1f4a658d0ac0ad628844d9a9d13649a73c7540" dependencies = [ "hex", "proc-macro2", @@ -124,18 +135,18 @@ dependencies = [ [[package]] name = "multiversx-sc-modules" -version = "0.53.2" +version = "0.54.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "daeb48acbd39255868a3241798df2f85050f0ae8d82d6417bd2cd0e30a241855" +checksum = "5373903a01dd7d33547b83f0034dc6e12fbbc8e49fcb316a3efb6ef4ff6573a8" dependencies = [ "multiversx-sc", ] [[package]] name = "multiversx-sc-wasm-adapter" -version = "0.53.2" +version = "0.54.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "20659915a4377d375c46d7f237e810053a03f7e084fad6362dd5748a7233defb" +checksum = "c034ae143cfd971cf0c4d67476af1920a9a0165bd99713458397ac06762fca0d" dependencies = [ "multiversx-sc", ] diff --git a/chain-factory/wasm-chain-factory-view/Cargo.toml b/chain-factory/wasm-chain-factory-view/Cargo.toml index 982df969..6033d11c 100644 --- a/chain-factory/wasm-chain-factory-view/Cargo.toml +++ b/chain-factory/wasm-chain-factory-view/Cargo.toml @@ -28,7 +28,7 @@ panic = "abort" path = ".." [dependencies.multiversx-sc-wasm-adapter] -version = "=0.53.2" +version = "=0.54.0" [workspace] members = ["."] diff --git a/chain-factory/wasm/Cargo.lock b/chain-factory/wasm/Cargo.lock index 9ecb087f..6b4bc5f5 100644 --- a/chain-factory/wasm/Cargo.lock +++ b/chain-factory/wasm/Cargo.lock @@ -72,14 +72,25 @@ version = "0.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6fe2267d4ed49bc07b63801559be28c718ea06c4738b7a03c94df7386d2cde46" +[[package]] +name = "multiversx-chain-core" +version = "0.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0c1088b268cad0d8c1146df9ca71a1f2baaee78267ab75e2202c0c0c71cc4b6e" +dependencies = [ + "bitflags", + "multiversx-sc-codec", +] + [[package]] name = "multiversx-sc" -version = "0.53.2" +version = "0.54.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "75ea89a26f0aacda21437a8ae5ccfbefab99d8191942b3d2eddbcbf84f9866d7" +checksum = "b9e5cee0b8c5fbaa9edfee2e38f2162adb01700a0028942d2cd14808cd26b130" dependencies = [ "bitflags", "hex-literal", + "multiversx-chain-core", "multiversx-sc-codec", "multiversx-sc-derive", "num-traits", @@ -111,9 +122,9 @@ dependencies = [ [[package]] name = "multiversx-sc-derive" -version = "0.53.2" +version = "0.54.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4c17fdf90fafca2f19085ae67b0502d9f71bf8ab1be3c83808eb88e02a8c18b9" +checksum = "931669b080cf793b205bf08b5d1f4a658d0ac0ad628844d9a9d13649a73c7540" dependencies = [ "hex", "proc-macro2", @@ -124,18 +135,18 @@ dependencies = [ [[package]] name = "multiversx-sc-modules" -version = "0.53.2" +version = "0.54.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "daeb48acbd39255868a3241798df2f85050f0ae8d82d6417bd2cd0e30a241855" +checksum = "5373903a01dd7d33547b83f0034dc6e12fbbc8e49fcb316a3efb6ef4ff6573a8" dependencies = [ "multiversx-sc", ] [[package]] name = "multiversx-sc-wasm-adapter" -version = "0.53.2" +version = "0.54.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "20659915a4377d375c46d7f237e810053a03f7e084fad6362dd5748a7233defb" +checksum = "c034ae143cfd971cf0c4d67476af1920a9a0165bd99713458397ac06762fca0d" dependencies = [ "multiversx-sc", ] diff --git a/chain-factory/wasm/Cargo.toml b/chain-factory/wasm/Cargo.toml index 29f5c1b8..1cb3ec30 100644 --- a/chain-factory/wasm/Cargo.toml +++ b/chain-factory/wasm/Cargo.toml @@ -28,7 +28,7 @@ panic = "abort" path = ".." [dependencies.multiversx-sc-wasm-adapter] -version = "=0.53.2" +version = "=0.54.0" [workspace] members = ["."] diff --git a/common/bls-signature/Cargo.toml b/common/bls-signature/Cargo.toml index 969c2b38..30bf2faf 100644 --- a/common/bls-signature/Cargo.toml +++ b/common/bls-signature/Cargo.toml @@ -5,10 +5,10 @@ authors = ["dorin-iancu "] edition = "2018" [dependencies.multiversx-sc] -version = "=0.53.2" +version = "=0.54.0" [dependencies.transaction] path = "../transaction" [dev-dependencies.multiversx-sc-scenario] -version = "=0.53.2" +version = "=0.54.0" diff --git a/common/max-bridged-amount-module/Cargo.toml b/common/max-bridged-amount-module/Cargo.toml index 02409a83..6436805c 100644 --- a/common/max-bridged-amount-module/Cargo.toml +++ b/common/max-bridged-amount-module/Cargo.toml @@ -5,7 +5,7 @@ authors = ["dorin-iancu "] edition = "2018" [dependencies.multiversx-sc] -version = "=0.53.2" +version = "=0.54.0" [dev-dependencies.multiversx-sc-scenario] -version = "=0.53.2" +version = "=0.54.0" diff --git a/common/setup-phase/Cargo.toml b/common/setup-phase/Cargo.toml index 83128ab1..9ff4aba3 100644 --- a/common/setup-phase/Cargo.toml +++ b/common/setup-phase/Cargo.toml @@ -5,7 +5,7 @@ authors = ["dorin-iancu "] edition = "2018" [dependencies.multiversx-sc] -version = "=0.53.2" +version = "=0.54.0" [dev-dependencies.multiversx-sc-scenario] -version = "=0.53.2" +version = "=0.54.0" diff --git a/common/token-whitelist/Cargo.toml b/common/token-whitelist/Cargo.toml index 9c2320a7..a5bad4a1 100644 --- a/common/token-whitelist/Cargo.toml +++ b/common/token-whitelist/Cargo.toml @@ -14,7 +14,7 @@ path = "../setup-phase" path = "../utils" [dependencies.multiversx-sc] -version = "=0.53.2" +version = "=0.54.0" [dev-dependencies.multiversx-sc-scenario] -version = "=0.53.2" +version = "=0.54.0" diff --git a/common/transaction/Cargo.toml b/common/transaction/Cargo.toml index 1e7a9472..2eb77cd5 100644 --- a/common/transaction/Cargo.toml +++ b/common/transaction/Cargo.toml @@ -8,4 +8,4 @@ edition = "2018" path = "src/lib.rs" [dependencies.multiversx-sc] -version = "=0.53.2" +version = "=0.54.0" diff --git a/common/tx-batch-module/Cargo.toml b/common/tx-batch-module/Cargo.toml index 190c9082..75db54c5 100644 --- a/common/tx-batch-module/Cargo.toml +++ b/common/tx-batch-module/Cargo.toml @@ -5,10 +5,10 @@ authors = ["dorin-iancu "] edition = "2018" [dependencies.multiversx-sc] -version = "=0.53.2" +version = "=0.54.0" [dependencies.transaction] path = "../transaction" [dev-dependencies.multiversx-sc-scenario] -version = "=0.53.2" +version = "=0.54.0" diff --git a/common/utils/Cargo.toml b/common/utils/Cargo.toml index b09521e5..2b60ab45 100644 --- a/common/utils/Cargo.toml +++ b/common/utils/Cargo.toml @@ -11,5 +11,5 @@ path = "src/lib.rs" path = "../bls-signature" [dependencies.multiversx-sc] -version = "=0.53.2" +version = "=0.54.0" features = ["esdt-token-payment-legacy-decode"] diff --git a/enshrine-esdt-safe/Cargo.toml b/enshrine-esdt-safe/Cargo.toml index af342497..73ceb763 100644 --- a/enshrine-esdt-safe/Cargo.toml +++ b/enshrine-esdt-safe/Cargo.toml @@ -39,10 +39,10 @@ path = "../header-verifier" path = "../token-handler" [dependencies.multiversx-sc] -version = "=0.53.2" +version = "=0.54.0" [dependencies.multiversx-sc-modules] -version = "=0.53.2" +version = "=0.54.0" [dev-dependencies] num-bigint = "0.4.2" @@ -50,4 +50,4 @@ num-traits = "0.2" hex = "0.4" [dev-dependencies.multiversx-sc-scenario] -version = "=0.53.2" +version = "=0.54.0" diff --git a/enshrine-esdt-safe/meta/Cargo.toml b/enshrine-esdt-safe/meta/Cargo.toml index 84eac8d4..55e86dc8 100644 --- a/enshrine-esdt-safe/meta/Cargo.toml +++ b/enshrine-esdt-safe/meta/Cargo.toml @@ -8,5 +8,5 @@ publish = false path = ".." [dependencies.multiversx-sc-meta-lib] -version = "0.53.2" +version = "0.54.0" default-features = false diff --git a/enshrine-esdt-safe/wasm-enshrine-esdt-safe-full/Cargo.lock b/enshrine-esdt-safe/wasm-enshrine-esdt-safe-full/Cargo.lock index fe32f8dc..886f601c 100644 --- a/enshrine-esdt-safe/wasm-enshrine-esdt-safe-full/Cargo.lock +++ b/enshrine-esdt-safe/wasm-enshrine-esdt-safe-full/Cargo.lock @@ -116,14 +116,25 @@ dependencies = [ "multiversx-sc", ] +[[package]] +name = "multiversx-chain-core" +version = "0.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0c1088b268cad0d8c1146df9ca71a1f2baaee78267ab75e2202c0c0c71cc4b6e" +dependencies = [ + "bitflags", + "multiversx-sc-codec", +] + [[package]] name = "multiversx-sc" -version = "0.53.2" +version = "0.54.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "75ea89a26f0aacda21437a8ae5ccfbefab99d8191942b3d2eddbcbf84f9866d7" +checksum = "b9e5cee0b8c5fbaa9edfee2e38f2162adb01700a0028942d2cd14808cd26b130" dependencies = [ "bitflags", "hex-literal", + "multiversx-chain-core", "multiversx-sc-codec", "multiversx-sc-derive", "num-traits", @@ -155,9 +166,9 @@ dependencies = [ [[package]] name = "multiversx-sc-derive" -version = "0.53.2" +version = "0.54.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4c17fdf90fafca2f19085ae67b0502d9f71bf8ab1be3c83808eb88e02a8c18b9" +checksum = "931669b080cf793b205bf08b5d1f4a658d0ac0ad628844d9a9d13649a73c7540" dependencies = [ "hex", "proc-macro2", @@ -168,18 +179,18 @@ dependencies = [ [[package]] name = "multiversx-sc-modules" -version = "0.53.2" +version = "0.54.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "daeb48acbd39255868a3241798df2f85050f0ae8d82d6417bd2cd0e30a241855" +checksum = "5373903a01dd7d33547b83f0034dc6e12fbbc8e49fcb316a3efb6ef4ff6573a8" dependencies = [ "multiversx-sc", ] [[package]] name = "multiversx-sc-wasm-adapter" -version = "0.53.2" +version = "0.54.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "20659915a4377d375c46d7f237e810053a03f7e084fad6362dd5748a7233defb" +checksum = "c034ae143cfd971cf0c4d67476af1920a9a0165bd99713458397ac06762fca0d" dependencies = [ "multiversx-sc", ] diff --git a/enshrine-esdt-safe/wasm-enshrine-esdt-safe-full/Cargo.toml b/enshrine-esdt-safe/wasm-enshrine-esdt-safe-full/Cargo.toml index 1dbf47f8..5ffe73ba 100644 --- a/enshrine-esdt-safe/wasm-enshrine-esdt-safe-full/Cargo.toml +++ b/enshrine-esdt-safe/wasm-enshrine-esdt-safe-full/Cargo.toml @@ -28,7 +28,7 @@ panic = "abort" path = ".." [dependencies.multiversx-sc-wasm-adapter] -version = "=0.53.2" +version = "=0.54.0" [workspace] members = ["."] diff --git a/enshrine-esdt-safe/wasm-enshrine-esdt-safe-view/Cargo.lock b/enshrine-esdt-safe/wasm-enshrine-esdt-safe-view/Cargo.lock index f59bd879..e608aec7 100644 --- a/enshrine-esdt-safe/wasm-enshrine-esdt-safe-view/Cargo.lock +++ b/enshrine-esdt-safe/wasm-enshrine-esdt-safe-view/Cargo.lock @@ -116,14 +116,25 @@ dependencies = [ "multiversx-sc", ] +[[package]] +name = "multiversx-chain-core" +version = "0.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0c1088b268cad0d8c1146df9ca71a1f2baaee78267ab75e2202c0c0c71cc4b6e" +dependencies = [ + "bitflags", + "multiversx-sc-codec", +] + [[package]] name = "multiversx-sc" -version = "0.53.2" +version = "0.54.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "75ea89a26f0aacda21437a8ae5ccfbefab99d8191942b3d2eddbcbf84f9866d7" +checksum = "b9e5cee0b8c5fbaa9edfee2e38f2162adb01700a0028942d2cd14808cd26b130" dependencies = [ "bitflags", "hex-literal", + "multiversx-chain-core", "multiversx-sc-codec", "multiversx-sc-derive", "num-traits", @@ -155,9 +166,9 @@ dependencies = [ [[package]] name = "multiversx-sc-derive" -version = "0.53.2" +version = "0.54.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4c17fdf90fafca2f19085ae67b0502d9f71bf8ab1be3c83808eb88e02a8c18b9" +checksum = "931669b080cf793b205bf08b5d1f4a658d0ac0ad628844d9a9d13649a73c7540" dependencies = [ "hex", "proc-macro2", @@ -168,18 +179,18 @@ dependencies = [ [[package]] name = "multiversx-sc-modules" -version = "0.53.2" +version = "0.54.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "daeb48acbd39255868a3241798df2f85050f0ae8d82d6417bd2cd0e30a241855" +checksum = "5373903a01dd7d33547b83f0034dc6e12fbbc8e49fcb316a3efb6ef4ff6573a8" dependencies = [ "multiversx-sc", ] [[package]] name = "multiversx-sc-wasm-adapter" -version = "0.53.2" +version = "0.54.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "20659915a4377d375c46d7f237e810053a03f7e084fad6362dd5748a7233defb" +checksum = "c034ae143cfd971cf0c4d67476af1920a9a0165bd99713458397ac06762fca0d" dependencies = [ "multiversx-sc", ] diff --git a/enshrine-esdt-safe/wasm-enshrine-esdt-safe-view/Cargo.toml b/enshrine-esdt-safe/wasm-enshrine-esdt-safe-view/Cargo.toml index 73c5d920..f84649a8 100644 --- a/enshrine-esdt-safe/wasm-enshrine-esdt-safe-view/Cargo.toml +++ b/enshrine-esdt-safe/wasm-enshrine-esdt-safe-view/Cargo.toml @@ -28,7 +28,7 @@ panic = "abort" path = ".." [dependencies.multiversx-sc-wasm-adapter] -version = "=0.53.2" +version = "=0.54.0" [workspace] members = ["."] diff --git a/enshrine-esdt-safe/wasm/Cargo.lock b/enshrine-esdt-safe/wasm/Cargo.lock index f640e893..f30c0c46 100644 --- a/enshrine-esdt-safe/wasm/Cargo.lock +++ b/enshrine-esdt-safe/wasm/Cargo.lock @@ -116,14 +116,25 @@ dependencies = [ "multiversx-sc", ] +[[package]] +name = "multiversx-chain-core" +version = "0.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0c1088b268cad0d8c1146df9ca71a1f2baaee78267ab75e2202c0c0c71cc4b6e" +dependencies = [ + "bitflags", + "multiversx-sc-codec", +] + [[package]] name = "multiversx-sc" -version = "0.53.2" +version = "0.54.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "75ea89a26f0aacda21437a8ae5ccfbefab99d8191942b3d2eddbcbf84f9866d7" +checksum = "b9e5cee0b8c5fbaa9edfee2e38f2162adb01700a0028942d2cd14808cd26b130" dependencies = [ "bitflags", "hex-literal", + "multiversx-chain-core", "multiversx-sc-codec", "multiversx-sc-derive", "num-traits", @@ -155,9 +166,9 @@ dependencies = [ [[package]] name = "multiversx-sc-derive" -version = "0.53.2" +version = "0.54.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4c17fdf90fafca2f19085ae67b0502d9f71bf8ab1be3c83808eb88e02a8c18b9" +checksum = "931669b080cf793b205bf08b5d1f4a658d0ac0ad628844d9a9d13649a73c7540" dependencies = [ "hex", "proc-macro2", @@ -168,18 +179,18 @@ dependencies = [ [[package]] name = "multiversx-sc-modules" -version = "0.53.2" +version = "0.54.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "daeb48acbd39255868a3241798df2f85050f0ae8d82d6417bd2cd0e30a241855" +checksum = "5373903a01dd7d33547b83f0034dc6e12fbbc8e49fcb316a3efb6ef4ff6573a8" dependencies = [ "multiversx-sc", ] [[package]] name = "multiversx-sc-wasm-adapter" -version = "0.53.2" +version = "0.54.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "20659915a4377d375c46d7f237e810053a03f7e084fad6362dd5748a7233defb" +checksum = "c034ae143cfd971cf0c4d67476af1920a9a0165bd99713458397ac06762fca0d" dependencies = [ "multiversx-sc", ] diff --git a/enshrine-esdt-safe/wasm/Cargo.toml b/enshrine-esdt-safe/wasm/Cargo.toml index fab206cf..3e340b15 100644 --- a/enshrine-esdt-safe/wasm/Cargo.toml +++ b/enshrine-esdt-safe/wasm/Cargo.toml @@ -28,7 +28,7 @@ panic = "abort" path = ".." [dependencies.multiversx-sc-wasm-adapter] -version = "=0.53.2" +version = "=0.54.0" [workspace] members = ["."] diff --git a/esdt-safe/Cargo.toml b/esdt-safe/Cargo.toml index 7550e0f2..c7e4268c 100644 --- a/esdt-safe/Cargo.toml +++ b/esdt-safe/Cargo.toml @@ -36,10 +36,10 @@ path = "../fee-market" path = "../header-verifier" [dependencies.multiversx-sc] -version = "=0.53.2" +version = "=0.54.0" [dependencies.multiversx-sc-modules] -version = "=0.53.2" +version = "=0.54.0" [dev-dependencies] num-bigint = "0.4.2" @@ -47,4 +47,4 @@ num-traits = "0.2" hex = "0.4" [dev-dependencies.multiversx-sc-scenario] -version = "=0.53.2" +version = "=0.54.0" diff --git a/esdt-safe/interactor/Cargo.toml b/esdt-safe/interactor/Cargo.toml index b6256c44..871543da 100644 --- a/esdt-safe/interactor/Cargo.toml +++ b/esdt-safe/interactor/Cargo.toml @@ -1,3 +1,7 @@ +[[bin]] +name = "rust-interact" +path = "src/interactor_main.rs" + [package] name = "rust-interact" version = "0.0.0" @@ -5,9 +9,8 @@ authors = ["you"] edition = "2021" publish = false -[[bin]] -name = "rust-interact" -path = "src/interactor_main.rs" +[dependencies] +toml = "0.8.6" [dependencies.esdt-safe] path = ".." @@ -22,18 +25,18 @@ path = "../../common/tx-batch-module" path = "../../fee-market" [dependencies.multiversx-sc-snippets] -version = "0.53.2" +version = "0.54.0" [dependencies.multiversx-sc] -version = "0.53.2" +version = "0.54.0" [dependencies.multiversx-sc-scenario] -version = "=0.53.2" - -[dependencies] -clap = { version = "4.4.7", features = ["derive"] } -serde = { version = "1.0", features = ["derive"] } -toml = "0.8.6" +version = "=0.54.0" -# [workspace] +[dependencies.clap] +version = "4.4.7" +features = ["derive"] +[dependencies.serde] +version = "1.0" +features = ["derive"] diff --git a/esdt-safe/meta/Cargo.toml b/esdt-safe/meta/Cargo.toml index b242d4ee..ac415d02 100644 --- a/esdt-safe/meta/Cargo.toml +++ b/esdt-safe/meta/Cargo.toml @@ -11,4 +11,4 @@ publish = false path = ".." [dependencies.multiversx-sc-meta-lib] -version = "=0.53.2" +version = "=0.54.0" diff --git a/esdt-safe/src/from_sovereign/transfer_tokens.rs b/esdt-safe/src/from_sovereign/transfer_tokens.rs index 720fb537..7cde06ce 100644 --- a/esdt-safe/src/from_sovereign/transfer_tokens.rs +++ b/esdt-safe/src/from_sovereign/transfer_tokens.rs @@ -1,5 +1,5 @@ -use builtin_func_names::ESDT_MULTI_TRANSFER_FUNC_NAME; use header_verifier::header_verifier_proxy; +use multiversx_sc::api::ESDT_MULTI_TRANSFER_FUNC_NAME; use transaction::{GasLimit, Operation, OperationData, OperationEsdtPayment, OperationTuple}; use crate::to_sovereign; diff --git a/esdt-safe/wasm-esdt-safe-full/Cargo.lock b/esdt-safe/wasm-esdt-safe-full/Cargo.lock index a5162c4b..12d2a31c 100644 --- a/esdt-safe/wasm-esdt-safe-full/Cargo.lock +++ b/esdt-safe/wasm-esdt-safe-full/Cargo.lock @@ -97,14 +97,25 @@ dependencies = [ "multiversx-sc", ] +[[package]] +name = "multiversx-chain-core" +version = "0.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0c1088b268cad0d8c1146df9ca71a1f2baaee78267ab75e2202c0c0c71cc4b6e" +dependencies = [ + "bitflags", + "multiversx-sc-codec", +] + [[package]] name = "multiversx-sc" -version = "0.53.2" +version = "0.54.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "75ea89a26f0aacda21437a8ae5ccfbefab99d8191942b3d2eddbcbf84f9866d7" +checksum = "b9e5cee0b8c5fbaa9edfee2e38f2162adb01700a0028942d2cd14808cd26b130" dependencies = [ "bitflags", "hex-literal", + "multiversx-chain-core", "multiversx-sc-codec", "multiversx-sc-derive", "num-traits", @@ -136,9 +147,9 @@ dependencies = [ [[package]] name = "multiversx-sc-derive" -version = "0.53.2" +version = "0.54.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4c17fdf90fafca2f19085ae67b0502d9f71bf8ab1be3c83808eb88e02a8c18b9" +checksum = "931669b080cf793b205bf08b5d1f4a658d0ac0ad628844d9a9d13649a73c7540" dependencies = [ "hex", "proc-macro2", @@ -149,18 +160,18 @@ dependencies = [ [[package]] name = "multiversx-sc-modules" -version = "0.53.2" +version = "0.54.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "daeb48acbd39255868a3241798df2f85050f0ae8d82d6417bd2cd0e30a241855" +checksum = "5373903a01dd7d33547b83f0034dc6e12fbbc8e49fcb316a3efb6ef4ff6573a8" dependencies = [ "multiversx-sc", ] [[package]] name = "multiversx-sc-wasm-adapter" -version = "0.53.2" +version = "0.54.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "20659915a4377d375c46d7f237e810053a03f7e084fad6362dd5748a7233defb" +checksum = "c034ae143cfd971cf0c4d67476af1920a9a0165bd99713458397ac06762fca0d" dependencies = [ "multiversx-sc", ] diff --git a/esdt-safe/wasm-esdt-safe-full/Cargo.toml b/esdt-safe/wasm-esdt-safe-full/Cargo.toml index 167d5173..718f70f9 100644 --- a/esdt-safe/wasm-esdt-safe-full/Cargo.toml +++ b/esdt-safe/wasm-esdt-safe-full/Cargo.toml @@ -28,7 +28,7 @@ panic = "abort" path = ".." [dependencies.multiversx-sc-wasm-adapter] -version = "=0.53.2" +version = "=0.54.0" [workspace] members = ["."] diff --git a/esdt-safe/wasm-esdt-safe-view/Cargo.lock b/esdt-safe/wasm-esdt-safe-view/Cargo.lock index b94ceaa7..3bb75c6d 100644 --- a/esdt-safe/wasm-esdt-safe-view/Cargo.lock +++ b/esdt-safe/wasm-esdt-safe-view/Cargo.lock @@ -97,14 +97,25 @@ dependencies = [ "multiversx-sc", ] +[[package]] +name = "multiversx-chain-core" +version = "0.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0c1088b268cad0d8c1146df9ca71a1f2baaee78267ab75e2202c0c0c71cc4b6e" +dependencies = [ + "bitflags", + "multiversx-sc-codec", +] + [[package]] name = "multiversx-sc" -version = "0.53.2" +version = "0.54.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "75ea89a26f0aacda21437a8ae5ccfbefab99d8191942b3d2eddbcbf84f9866d7" +checksum = "b9e5cee0b8c5fbaa9edfee2e38f2162adb01700a0028942d2cd14808cd26b130" dependencies = [ "bitflags", "hex-literal", + "multiversx-chain-core", "multiversx-sc-codec", "multiversx-sc-derive", "num-traits", @@ -136,9 +147,9 @@ dependencies = [ [[package]] name = "multiversx-sc-derive" -version = "0.53.2" +version = "0.54.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4c17fdf90fafca2f19085ae67b0502d9f71bf8ab1be3c83808eb88e02a8c18b9" +checksum = "931669b080cf793b205bf08b5d1f4a658d0ac0ad628844d9a9d13649a73c7540" dependencies = [ "hex", "proc-macro2", @@ -149,18 +160,18 @@ dependencies = [ [[package]] name = "multiversx-sc-modules" -version = "0.53.2" +version = "0.54.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "daeb48acbd39255868a3241798df2f85050f0ae8d82d6417bd2cd0e30a241855" +checksum = "5373903a01dd7d33547b83f0034dc6e12fbbc8e49fcb316a3efb6ef4ff6573a8" dependencies = [ "multiversx-sc", ] [[package]] name = "multiversx-sc-wasm-adapter" -version = "0.53.2" +version = "0.54.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "20659915a4377d375c46d7f237e810053a03f7e084fad6362dd5748a7233defb" +checksum = "c034ae143cfd971cf0c4d67476af1920a9a0165bd99713458397ac06762fca0d" dependencies = [ "multiversx-sc", ] diff --git a/esdt-safe/wasm-esdt-safe-view/Cargo.toml b/esdt-safe/wasm-esdt-safe-view/Cargo.toml index 4753497c..0454607f 100644 --- a/esdt-safe/wasm-esdt-safe-view/Cargo.toml +++ b/esdt-safe/wasm-esdt-safe-view/Cargo.toml @@ -28,7 +28,7 @@ panic = "abort" path = ".." [dependencies.multiversx-sc-wasm-adapter] -version = "=0.53.2" +version = "=0.54.0" [workspace] members = ["."] diff --git a/esdt-safe/wasm/Cargo.lock b/esdt-safe/wasm/Cargo.lock index f19ccf47..d54e9276 100644 --- a/esdt-safe/wasm/Cargo.lock +++ b/esdt-safe/wasm/Cargo.lock @@ -97,14 +97,25 @@ dependencies = [ "multiversx-sc", ] +[[package]] +name = "multiversx-chain-core" +version = "0.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0c1088b268cad0d8c1146df9ca71a1f2baaee78267ab75e2202c0c0c71cc4b6e" +dependencies = [ + "bitflags", + "multiversx-sc-codec", +] + [[package]] name = "multiversx-sc" -version = "0.53.2" +version = "0.54.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "75ea89a26f0aacda21437a8ae5ccfbefab99d8191942b3d2eddbcbf84f9866d7" +checksum = "b9e5cee0b8c5fbaa9edfee2e38f2162adb01700a0028942d2cd14808cd26b130" dependencies = [ "bitflags", "hex-literal", + "multiversx-chain-core", "multiversx-sc-codec", "multiversx-sc-derive", "num-traits", @@ -136,9 +147,9 @@ dependencies = [ [[package]] name = "multiversx-sc-derive" -version = "0.53.2" +version = "0.54.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4c17fdf90fafca2f19085ae67b0502d9f71bf8ab1be3c83808eb88e02a8c18b9" +checksum = "931669b080cf793b205bf08b5d1f4a658d0ac0ad628844d9a9d13649a73c7540" dependencies = [ "hex", "proc-macro2", @@ -149,18 +160,18 @@ dependencies = [ [[package]] name = "multiversx-sc-modules" -version = "0.53.2" +version = "0.54.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "daeb48acbd39255868a3241798df2f85050f0ae8d82d6417bd2cd0e30a241855" +checksum = "5373903a01dd7d33547b83f0034dc6e12fbbc8e49fcb316a3efb6ef4ff6573a8" dependencies = [ "multiversx-sc", ] [[package]] name = "multiversx-sc-wasm-adapter" -version = "0.53.2" +version = "0.54.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "20659915a4377d375c46d7f237e810053a03f7e084fad6362dd5748a7233defb" +checksum = "c034ae143cfd971cf0c4d67476af1920a9a0165bd99713458397ac06762fca0d" dependencies = [ "multiversx-sc", ] diff --git a/esdt-safe/wasm/Cargo.toml b/esdt-safe/wasm/Cargo.toml index f2ef2089..4ec2b576 100644 --- a/esdt-safe/wasm/Cargo.toml +++ b/esdt-safe/wasm/Cargo.toml @@ -28,7 +28,7 @@ panic = "abort" path = ".." [dependencies.multiversx-sc-wasm-adapter] -version = "=0.53.2" +version = "=0.54.0" [workspace] members = ["."] diff --git a/fee-market/Cargo.toml b/fee-market/Cargo.toml index f4b3423a..40a568a3 100644 --- a/fee-market/Cargo.toml +++ b/fee-market/Cargo.toml @@ -18,10 +18,10 @@ path = "../common/transaction" path = "../common/bls-signature" [dependencies.multiversx-sc] -version = "=0.53.2" +version = "=0.54.0" [dev-dependencies] num-bigint = "0.4.2" [dev-dependencies.multiversx-sc-scenario] -version = "=0.53.2" +version = "=0.54.0" diff --git a/fee-market/meta/Cargo.toml b/fee-market/meta/Cargo.toml index 41b8b31a..5cc16f7b 100644 --- a/fee-market/meta/Cargo.toml +++ b/fee-market/meta/Cargo.toml @@ -8,5 +8,5 @@ publish = false path = ".." [dependencies.multiversx-sc-meta-lib] -version = "=0.53.2" +version = "=0.54.0" default-features = false diff --git a/fee-market/wasm-fee-marker-full/Cargo.lock b/fee-market/wasm-fee-marker-full/Cargo.lock index 6d42739d..7b77577f 100644 --- a/fee-market/wasm-fee-marker-full/Cargo.lock +++ b/fee-market/wasm-fee-marker-full/Cargo.lock @@ -64,14 +64,25 @@ version = "0.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6fe2267d4ed49bc07b63801559be28c718ea06c4738b7a03c94df7386d2cde46" +[[package]] +name = "multiversx-chain-core" +version = "0.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0c1088b268cad0d8c1146df9ca71a1f2baaee78267ab75e2202c0c0c71cc4b6e" +dependencies = [ + "bitflags", + "multiversx-sc-codec", +] + [[package]] name = "multiversx-sc" -version = "0.53.2" +version = "0.54.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "75ea89a26f0aacda21437a8ae5ccfbefab99d8191942b3d2eddbcbf84f9866d7" +checksum = "b9e5cee0b8c5fbaa9edfee2e38f2162adb01700a0028942d2cd14808cd26b130" dependencies = [ "bitflags", "hex-literal", + "multiversx-chain-core", "multiversx-sc-codec", "multiversx-sc-derive", "num-traits", @@ -103,9 +114,9 @@ dependencies = [ [[package]] name = "multiversx-sc-derive" -version = "0.53.2" +version = "0.54.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4c17fdf90fafca2f19085ae67b0502d9f71bf8ab1be3c83808eb88e02a8c18b9" +checksum = "931669b080cf793b205bf08b5d1f4a658d0ac0ad628844d9a9d13649a73c7540" dependencies = [ "hex", "proc-macro2", @@ -116,9 +127,9 @@ dependencies = [ [[package]] name = "multiversx-sc-wasm-adapter" -version = "0.53.2" +version = "0.54.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "20659915a4377d375c46d7f237e810053a03f7e084fad6362dd5748a7233defb" +checksum = "c034ae143cfd971cf0c4d67476af1920a9a0165bd99713458397ac06762fca0d" dependencies = [ "multiversx-sc", ] diff --git a/fee-market/wasm-fee-marker-full/Cargo.toml b/fee-market/wasm-fee-marker-full/Cargo.toml index d2522cb0..f03a1d84 100644 --- a/fee-market/wasm-fee-marker-full/Cargo.toml +++ b/fee-market/wasm-fee-marker-full/Cargo.toml @@ -28,7 +28,7 @@ panic = "abort" path = ".." [dependencies.multiversx-sc-wasm-adapter] -version = "=0.53.2" +version = "=0.54.0" [workspace] members = ["."] diff --git a/fee-market/wasm-multisig-view/Cargo.lock b/fee-market/wasm-multisig-view/Cargo.lock index e72e7c7f..3af841e5 100644 --- a/fee-market/wasm-multisig-view/Cargo.lock +++ b/fee-market/wasm-multisig-view/Cargo.lock @@ -64,14 +64,25 @@ dependencies = [ "multiversx-sc-wasm-adapter", ] +[[package]] +name = "multiversx-chain-core" +version = "0.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0c1088b268cad0d8c1146df9ca71a1f2baaee78267ab75e2202c0c0c71cc4b6e" +dependencies = [ + "bitflags", + "multiversx-sc-codec", +] + [[package]] name = "multiversx-sc" -version = "0.53.2" +version = "0.54.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "75ea89a26f0aacda21437a8ae5ccfbefab99d8191942b3d2eddbcbf84f9866d7" +checksum = "b9e5cee0b8c5fbaa9edfee2e38f2162adb01700a0028942d2cd14808cd26b130" dependencies = [ "bitflags", "hex-literal", + "multiversx-chain-core", "multiversx-sc-codec", "multiversx-sc-derive", "num-traits", @@ -103,9 +114,9 @@ dependencies = [ [[package]] name = "multiversx-sc-derive" -version = "0.53.2" +version = "0.54.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4c17fdf90fafca2f19085ae67b0502d9f71bf8ab1be3c83808eb88e02a8c18b9" +checksum = "931669b080cf793b205bf08b5d1f4a658d0ac0ad628844d9a9d13649a73c7540" dependencies = [ "hex", "proc-macro2", @@ -116,9 +127,9 @@ dependencies = [ [[package]] name = "multiversx-sc-wasm-adapter" -version = "0.53.2" +version = "0.54.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "20659915a4377d375c46d7f237e810053a03f7e084fad6362dd5748a7233defb" +checksum = "c034ae143cfd971cf0c4d67476af1920a9a0165bd99713458397ac06762fca0d" dependencies = [ "multiversx-sc", ] diff --git a/fee-market/wasm-multisig-view/Cargo.toml b/fee-market/wasm-multisig-view/Cargo.toml index 5ede84bd..9923d939 100644 --- a/fee-market/wasm-multisig-view/Cargo.toml +++ b/fee-market/wasm-multisig-view/Cargo.toml @@ -28,7 +28,7 @@ panic = "abort" path = ".." [dependencies.multiversx-sc-wasm-adapter] -version = "=0.53.2" +version = "=0.54.0" [workspace] members = ["."] diff --git a/fee-market/wasm/Cargo.lock b/fee-market/wasm/Cargo.lock index 4381e40d..a891b798 100644 --- a/fee-market/wasm/Cargo.lock +++ b/fee-market/wasm/Cargo.lock @@ -64,14 +64,25 @@ version = "0.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6fe2267d4ed49bc07b63801559be28c718ea06c4738b7a03c94df7386d2cde46" +[[package]] +name = "multiversx-chain-core" +version = "0.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0c1088b268cad0d8c1146df9ca71a1f2baaee78267ab75e2202c0c0c71cc4b6e" +dependencies = [ + "bitflags", + "multiversx-sc-codec", +] + [[package]] name = "multiversx-sc" -version = "0.53.2" +version = "0.54.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "75ea89a26f0aacda21437a8ae5ccfbefab99d8191942b3d2eddbcbf84f9866d7" +checksum = "b9e5cee0b8c5fbaa9edfee2e38f2162adb01700a0028942d2cd14808cd26b130" dependencies = [ "bitflags", "hex-literal", + "multiversx-chain-core", "multiversx-sc-codec", "multiversx-sc-derive", "num-traits", @@ -103,9 +114,9 @@ dependencies = [ [[package]] name = "multiversx-sc-derive" -version = "0.53.2" +version = "0.54.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4c17fdf90fafca2f19085ae67b0502d9f71bf8ab1be3c83808eb88e02a8c18b9" +checksum = "931669b080cf793b205bf08b5d1f4a658d0ac0ad628844d9a9d13649a73c7540" dependencies = [ "hex", "proc-macro2", @@ -116,9 +127,9 @@ dependencies = [ [[package]] name = "multiversx-sc-wasm-adapter" -version = "0.53.2" +version = "0.54.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "20659915a4377d375c46d7f237e810053a03f7e084fad6362dd5748a7233defb" +checksum = "c034ae143cfd971cf0c4d67476af1920a9a0165bd99713458397ac06762fca0d" dependencies = [ "multiversx-sc", ] diff --git a/fee-market/wasm/Cargo.toml b/fee-market/wasm/Cargo.toml index 370fa907..cdf095e2 100644 --- a/fee-market/wasm/Cargo.toml +++ b/fee-market/wasm/Cargo.toml @@ -28,7 +28,7 @@ panic = "abort" path = ".." [dependencies.multiversx-sc-wasm-adapter] -version = "=0.53.2" +version = "=0.54.0" [workspace] members = ["."] diff --git a/header-verifier/Cargo.toml b/header-verifier/Cargo.toml index 4e5a6c94..1347c179 100644 --- a/header-verifier/Cargo.toml +++ b/header-verifier/Cargo.toml @@ -9,7 +9,7 @@ publish = false path = "src/lib.rs" [dependencies.multiversx-sc] -version = "0.53.2" +version = "0.54.0" [dependencies.bls-signature] path = "../common/bls-signature" @@ -21,4 +21,4 @@ path = "../common/transaction" num-bigint = "0.4.2" [dev-dependencies.multiversx-sc-scenario] -version = "0.53.2" +version = "0.54.0" diff --git a/header-verifier/meta/Cargo.toml b/header-verifier/meta/Cargo.toml index bb33e707..3d50f525 100644 --- a/header-verifier/meta/Cargo.toml +++ b/header-verifier/meta/Cargo.toml @@ -8,5 +8,5 @@ publish = false path = ".." [dependencies.multiversx-sc-meta-lib] -version = "0.53.2" +version = "0.54.0" default-features = false diff --git a/header-verifier/wasm-header-verifier-full/Cargo.lock b/header-verifier/wasm-header-verifier-full/Cargo.lock index f719a19c..6adaa848 100644 --- a/header-verifier/wasm-header-verifier-full/Cargo.lock +++ b/header-verifier/wasm-header-verifier-full/Cargo.lock @@ -63,14 +63,25 @@ version = "0.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6fe2267d4ed49bc07b63801559be28c718ea06c4738b7a03c94df7386d2cde46" +[[package]] +name = "multiversx-chain-core" +version = "0.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0c1088b268cad0d8c1146df9ca71a1f2baaee78267ab75e2202c0c0c71cc4b6e" +dependencies = [ + "bitflags", + "multiversx-sc-codec", +] + [[package]] name = "multiversx-sc" -version = "0.53.2" +version = "0.54.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "75ea89a26f0aacda21437a8ae5ccfbefab99d8191942b3d2eddbcbf84f9866d7" +checksum = "b9e5cee0b8c5fbaa9edfee2e38f2162adb01700a0028942d2cd14808cd26b130" dependencies = [ "bitflags", "hex-literal", + "multiversx-chain-core", "multiversx-sc-codec", "multiversx-sc-derive", "num-traits", @@ -102,9 +113,9 @@ dependencies = [ [[package]] name = "multiversx-sc-derive" -version = "0.53.2" +version = "0.54.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4c17fdf90fafca2f19085ae67b0502d9f71bf8ab1be3c83808eb88e02a8c18b9" +checksum = "931669b080cf793b205bf08b5d1f4a658d0ac0ad628844d9a9d13649a73c7540" dependencies = [ "hex", "proc-macro2", @@ -115,9 +126,9 @@ dependencies = [ [[package]] name = "multiversx-sc-wasm-adapter" -version = "0.53.2" +version = "0.54.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "20659915a4377d375c46d7f237e810053a03f7e084fad6362dd5748a7233defb" +checksum = "c034ae143cfd971cf0c4d67476af1920a9a0165bd99713458397ac06762fca0d" dependencies = [ "multiversx-sc", ] diff --git a/header-verifier/wasm-header-verifier-full/Cargo.toml b/header-verifier/wasm-header-verifier-full/Cargo.toml index bc788ca8..5007a7fa 100644 --- a/header-verifier/wasm-header-verifier-full/Cargo.toml +++ b/header-verifier/wasm-header-verifier-full/Cargo.toml @@ -28,7 +28,7 @@ panic = "abort" path = ".." [dependencies.multiversx-sc-wasm-adapter] -version = "0.53.2" +version = "0.54.0" [workspace] members = ["."] diff --git a/header-verifier/wasm-multisig-view/Cargo.lock b/header-verifier/wasm-multisig-view/Cargo.lock index 93d97a39..6c70bd0b 100644 --- a/header-verifier/wasm-multisig-view/Cargo.lock +++ b/header-verifier/wasm-multisig-view/Cargo.lock @@ -63,14 +63,25 @@ dependencies = [ "multiversx-sc-wasm-adapter", ] +[[package]] +name = "multiversx-chain-core" +version = "0.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0c1088b268cad0d8c1146df9ca71a1f2baaee78267ab75e2202c0c0c71cc4b6e" +dependencies = [ + "bitflags", + "multiversx-sc-codec", +] + [[package]] name = "multiversx-sc" -version = "0.53.2" +version = "0.54.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "75ea89a26f0aacda21437a8ae5ccfbefab99d8191942b3d2eddbcbf84f9866d7" +checksum = "b9e5cee0b8c5fbaa9edfee2e38f2162adb01700a0028942d2cd14808cd26b130" dependencies = [ "bitflags", "hex-literal", + "multiversx-chain-core", "multiversx-sc-codec", "multiversx-sc-derive", "num-traits", @@ -102,9 +113,9 @@ dependencies = [ [[package]] name = "multiversx-sc-derive" -version = "0.53.2" +version = "0.54.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4c17fdf90fafca2f19085ae67b0502d9f71bf8ab1be3c83808eb88e02a8c18b9" +checksum = "931669b080cf793b205bf08b5d1f4a658d0ac0ad628844d9a9d13649a73c7540" dependencies = [ "hex", "proc-macro2", @@ -115,9 +126,9 @@ dependencies = [ [[package]] name = "multiversx-sc-wasm-adapter" -version = "0.53.2" +version = "0.54.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "20659915a4377d375c46d7f237e810053a03f7e084fad6362dd5748a7233defb" +checksum = "c034ae143cfd971cf0c4d67476af1920a9a0165bd99713458397ac06762fca0d" dependencies = [ "multiversx-sc", ] diff --git a/header-verifier/wasm-multisig-view/Cargo.toml b/header-verifier/wasm-multisig-view/Cargo.toml index 640694e4..a8715457 100644 --- a/header-verifier/wasm-multisig-view/Cargo.toml +++ b/header-verifier/wasm-multisig-view/Cargo.toml @@ -28,7 +28,7 @@ panic = "abort" path = ".." [dependencies.multiversx-sc-wasm-adapter] -version = "0.53.2" +version = "0.54.0" [workspace] members = ["."] diff --git a/header-verifier/wasm/Cargo.lock b/header-verifier/wasm/Cargo.lock index 6dd608cb..8a04f786 100644 --- a/header-verifier/wasm/Cargo.lock +++ b/header-verifier/wasm/Cargo.lock @@ -63,14 +63,25 @@ version = "0.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6fe2267d4ed49bc07b63801559be28c718ea06c4738b7a03c94df7386d2cde46" +[[package]] +name = "multiversx-chain-core" +version = "0.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0c1088b268cad0d8c1146df9ca71a1f2baaee78267ab75e2202c0c0c71cc4b6e" +dependencies = [ + "bitflags", + "multiversx-sc-codec", +] + [[package]] name = "multiversx-sc" -version = "0.53.2" +version = "0.54.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "75ea89a26f0aacda21437a8ae5ccfbefab99d8191942b3d2eddbcbf84f9866d7" +checksum = "b9e5cee0b8c5fbaa9edfee2e38f2162adb01700a0028942d2cd14808cd26b130" dependencies = [ "bitflags", "hex-literal", + "multiversx-chain-core", "multiversx-sc-codec", "multiversx-sc-derive", "num-traits", @@ -102,9 +113,9 @@ dependencies = [ [[package]] name = "multiversx-sc-derive" -version = "0.53.2" +version = "0.54.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4c17fdf90fafca2f19085ae67b0502d9f71bf8ab1be3c83808eb88e02a8c18b9" +checksum = "931669b080cf793b205bf08b5d1f4a658d0ac0ad628844d9a9d13649a73c7540" dependencies = [ "hex", "proc-macro2", @@ -115,9 +126,9 @@ dependencies = [ [[package]] name = "multiversx-sc-wasm-adapter" -version = "0.53.2" +version = "0.54.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "20659915a4377d375c46d7f237e810053a03f7e084fad6362dd5748a7233defb" +checksum = "c034ae143cfd971cf0c4d67476af1920a9a0165bd99713458397ac06762fca0d" dependencies = [ "multiversx-sc", ] diff --git a/header-verifier/wasm/Cargo.toml b/header-verifier/wasm/Cargo.toml index 0ea44624..b543f73d 100644 --- a/header-verifier/wasm/Cargo.toml +++ b/header-verifier/wasm/Cargo.toml @@ -28,7 +28,7 @@ panic = "abort" path = ".." [dependencies.multiversx-sc-wasm-adapter] -version = "0.53.2" +version = "0.54.0" [workspace] members = ["."] diff --git a/token-handler/Cargo.toml b/token-handler/Cargo.toml index 32c0ce09..d67933e6 100644 --- a/token-handler/Cargo.toml +++ b/token-handler/Cargo.toml @@ -18,10 +18,10 @@ path = "../header-verifier/" path = "../chain-factory/" [dependencies.multiversx-sc] -version = "0.53.2" +version = "0.54.0" [dev-dependencies] num-bigint = "0.4" [dev-dependencies.multiversx-sc-scenario] -version = "0.53.2" +version = "0.54.0" diff --git a/token-handler/meta/Cargo.toml b/token-handler/meta/Cargo.toml index 760fb5d4..270033f9 100644 --- a/token-handler/meta/Cargo.toml +++ b/token-handler/meta/Cargo.toml @@ -8,5 +8,5 @@ publish = false path = ".." [dependencies.multiversx-sc-meta-lib] -version = "0.53.2" +version = "0.54.0" default-features = false diff --git a/token-handler/wasm-token-handler-full/Cargo.lock b/token-handler/wasm-token-handler-full/Cargo.lock index 5b20cc34..29aed875 100644 --- a/token-handler/wasm-token-handler-full/Cargo.lock +++ b/token-handler/wasm-token-handler-full/Cargo.lock @@ -73,14 +73,25 @@ version = "0.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6fe2267d4ed49bc07b63801559be28c718ea06c4738b7a03c94df7386d2cde46" +[[package]] +name = "multiversx-chain-core" +version = "0.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0c1088b268cad0d8c1146df9ca71a1f2baaee78267ab75e2202c0c0c71cc4b6e" +dependencies = [ + "bitflags", + "multiversx-sc-codec", +] + [[package]] name = "multiversx-sc" -version = "0.53.2" +version = "0.54.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "75ea89a26f0aacda21437a8ae5ccfbefab99d8191942b3d2eddbcbf84f9866d7" +checksum = "b9e5cee0b8c5fbaa9edfee2e38f2162adb01700a0028942d2cd14808cd26b130" dependencies = [ "bitflags", "hex-literal", + "multiversx-chain-core", "multiversx-sc-codec", "multiversx-sc-derive", "num-traits", @@ -112,9 +123,9 @@ dependencies = [ [[package]] name = "multiversx-sc-derive" -version = "0.53.2" +version = "0.54.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4c17fdf90fafca2f19085ae67b0502d9f71bf8ab1be3c83808eb88e02a8c18b9" +checksum = "931669b080cf793b205bf08b5d1f4a658d0ac0ad628844d9a9d13649a73c7540" dependencies = [ "hex", "proc-macro2", @@ -125,18 +136,18 @@ dependencies = [ [[package]] name = "multiversx-sc-modules" -version = "0.53.2" +version = "0.54.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "daeb48acbd39255868a3241798df2f85050f0ae8d82d6417bd2cd0e30a241855" +checksum = "5373903a01dd7d33547b83f0034dc6e12fbbc8e49fcb316a3efb6ef4ff6573a8" dependencies = [ "multiversx-sc", ] [[package]] name = "multiversx-sc-wasm-adapter" -version = "0.53.2" +version = "0.54.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "20659915a4377d375c46d7f237e810053a03f7e084fad6362dd5748a7233defb" +checksum = "c034ae143cfd971cf0c4d67476af1920a9a0165bd99713458397ac06762fca0d" dependencies = [ "multiversx-sc", ] diff --git a/token-handler/wasm-token-handler-full/Cargo.toml b/token-handler/wasm-token-handler-full/Cargo.toml index fa693534..7e4194fb 100644 --- a/token-handler/wasm-token-handler-full/Cargo.toml +++ b/token-handler/wasm-token-handler-full/Cargo.toml @@ -28,7 +28,7 @@ panic = "abort" path = ".." [dependencies.multiversx-sc-wasm-adapter] -version = "0.53.2" +version = "0.54.0" [workspace] members = ["."] diff --git a/token-handler/wasm-token-handler-view/Cargo.lock b/token-handler/wasm-token-handler-view/Cargo.lock index 9a277cac..e085fbe3 100644 --- a/token-handler/wasm-token-handler-view/Cargo.lock +++ b/token-handler/wasm-token-handler-view/Cargo.lock @@ -73,14 +73,25 @@ version = "0.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6fe2267d4ed49bc07b63801559be28c718ea06c4738b7a03c94df7386d2cde46" +[[package]] +name = "multiversx-chain-core" +version = "0.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0c1088b268cad0d8c1146df9ca71a1f2baaee78267ab75e2202c0c0c71cc4b6e" +dependencies = [ + "bitflags", + "multiversx-sc-codec", +] + [[package]] name = "multiversx-sc" -version = "0.53.2" +version = "0.54.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "75ea89a26f0aacda21437a8ae5ccfbefab99d8191942b3d2eddbcbf84f9866d7" +checksum = "b9e5cee0b8c5fbaa9edfee2e38f2162adb01700a0028942d2cd14808cd26b130" dependencies = [ "bitflags", "hex-literal", + "multiversx-chain-core", "multiversx-sc-codec", "multiversx-sc-derive", "num-traits", @@ -112,9 +123,9 @@ dependencies = [ [[package]] name = "multiversx-sc-derive" -version = "0.53.2" +version = "0.54.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4c17fdf90fafca2f19085ae67b0502d9f71bf8ab1be3c83808eb88e02a8c18b9" +checksum = "931669b080cf793b205bf08b5d1f4a658d0ac0ad628844d9a9d13649a73c7540" dependencies = [ "hex", "proc-macro2", @@ -125,18 +136,18 @@ dependencies = [ [[package]] name = "multiversx-sc-modules" -version = "0.53.2" +version = "0.54.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "daeb48acbd39255868a3241798df2f85050f0ae8d82d6417bd2cd0e30a241855" +checksum = "5373903a01dd7d33547b83f0034dc6e12fbbc8e49fcb316a3efb6ef4ff6573a8" dependencies = [ "multiversx-sc", ] [[package]] name = "multiversx-sc-wasm-adapter" -version = "0.53.2" +version = "0.54.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "20659915a4377d375c46d7f237e810053a03f7e084fad6362dd5748a7233defb" +checksum = "c034ae143cfd971cf0c4d67476af1920a9a0165bd99713458397ac06762fca0d" dependencies = [ "multiversx-sc", ] diff --git a/token-handler/wasm-token-handler-view/Cargo.toml b/token-handler/wasm-token-handler-view/Cargo.toml index 6b216bf5..a549ed7d 100644 --- a/token-handler/wasm-token-handler-view/Cargo.toml +++ b/token-handler/wasm-token-handler-view/Cargo.toml @@ -28,7 +28,7 @@ panic = "abort" path = ".." [dependencies.multiversx-sc-wasm-adapter] -version = "0.53.2" +version = "0.54.0" [workspace] members = ["."] diff --git a/token-handler/wasm/Cargo.lock b/token-handler/wasm/Cargo.lock index 0b097205..c06aaa74 100644 --- a/token-handler/wasm/Cargo.lock +++ b/token-handler/wasm/Cargo.lock @@ -73,14 +73,25 @@ version = "0.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6fe2267d4ed49bc07b63801559be28c718ea06c4738b7a03c94df7386d2cde46" +[[package]] +name = "multiversx-chain-core" +version = "0.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0c1088b268cad0d8c1146df9ca71a1f2baaee78267ab75e2202c0c0c71cc4b6e" +dependencies = [ + "bitflags", + "multiversx-sc-codec", +] + [[package]] name = "multiversx-sc" -version = "0.53.2" +version = "0.54.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "75ea89a26f0aacda21437a8ae5ccfbefab99d8191942b3d2eddbcbf84f9866d7" +checksum = "b9e5cee0b8c5fbaa9edfee2e38f2162adb01700a0028942d2cd14808cd26b130" dependencies = [ "bitflags", "hex-literal", + "multiversx-chain-core", "multiversx-sc-codec", "multiversx-sc-derive", "num-traits", @@ -112,9 +123,9 @@ dependencies = [ [[package]] name = "multiversx-sc-derive" -version = "0.53.2" +version = "0.54.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4c17fdf90fafca2f19085ae67b0502d9f71bf8ab1be3c83808eb88e02a8c18b9" +checksum = "931669b080cf793b205bf08b5d1f4a658d0ac0ad628844d9a9d13649a73c7540" dependencies = [ "hex", "proc-macro2", @@ -125,18 +136,18 @@ dependencies = [ [[package]] name = "multiversx-sc-modules" -version = "0.53.2" +version = "0.54.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "daeb48acbd39255868a3241798df2f85050f0ae8d82d6417bd2cd0e30a241855" +checksum = "5373903a01dd7d33547b83f0034dc6e12fbbc8e49fcb316a3efb6ef4ff6573a8" dependencies = [ "multiversx-sc", ] [[package]] name = "multiversx-sc-wasm-adapter" -version = "0.53.2" +version = "0.54.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "20659915a4377d375c46d7f237e810053a03f7e084fad6362dd5748a7233defb" +checksum = "c034ae143cfd971cf0c4d67476af1920a9a0165bd99713458397ac06762fca0d" dependencies = [ "multiversx-sc", ] diff --git a/token-handler/wasm/Cargo.toml b/token-handler/wasm/Cargo.toml index f322c589..a0b8939c 100644 --- a/token-handler/wasm/Cargo.toml +++ b/token-handler/wasm/Cargo.toml @@ -28,7 +28,7 @@ panic = "abort" path = ".." [dependencies.multiversx-sc-wasm-adapter] -version = "0.53.2" +version = "0.54.0" [workspace] members = ["."] From ab90c0d59d8b238b66619edfdfe750adf61be05b Mon Sep 17 00:00:00 2001 From: Andrei Baltariu Date: Fri, 8 Nov 2024 10:30:36 +0200 Subject: [PATCH 510/523] Fixed interactor after fw upgrade Signed-off-by: Andrei Baltariu --- esdt-safe/interactor/src/interactor_main.rs | 52 ++++----------------- 1 file changed, 10 insertions(+), 42 deletions(-) diff --git a/esdt-safe/interactor/src/interactor_main.rs b/esdt-safe/interactor/src/interactor_main.rs index 536cb988..671fca59 100644 --- a/esdt-safe/interactor/src/interactor_main.rs +++ b/esdt-safe/interactor/src/interactor_main.rs @@ -140,12 +140,12 @@ struct ContractInteract { impl ContractInteract { async fn new() -> Self { - let mut interactor = Interactor::new(GATEWAY).await; - let wallet_address = interactor.register_wallet(test_wallets::frank()); - let bob_address = interactor.register_wallet(test_wallets::bob()); - let alice_address = interactor.register_wallet(test_wallets::alice()); - let mike_address = interactor.register_wallet(test_wallets::mike()); - let judy_address = interactor.register_wallet(test_wallets::judy()); + let mut interactor = Interactor::new(GATEWAY, false).await; + let wallet_address = interactor.register_wallet(test_wallets::frank()).await; + let bob_address = interactor.register_wallet(test_wallets::bob()).await; + let alice_address = interactor.register_wallet(test_wallets::alice()).await; + let mike_address = interactor.register_wallet(test_wallets::mike()).await; + let judy_address = interactor.register_wallet(test_wallets::judy()).await; let contract_code = BytesValue::interpret_from( "mxsc:../output/esdt-safe.mxsc.json", @@ -192,9 +192,9 @@ impl ContractInteract { .init(is_sov_chain) .code(&self.contract_code) .returns(ReturnsNewAddress) - .prepare_async() .run() .await; + let new_address_bech32 = bech32::encode(&new_address); self.state.set_address(Bech32Address::from_bech32_string( new_address_bech32.clone(), @@ -222,9 +222,9 @@ impl ContractInteract { .init(self.state.current_address(), Option::Some(fee)) .code(&self.fee_market_code) .returns(ReturnsNewAddress) - .prepare_async() .run() .await; + let new_address_bech32 = bech32::encode(&new_address); self.state .set_fee_market_address(Bech32Address::from_bech32_string( @@ -260,9 +260,9 @@ impl ContractInteract { ) .code(&self.price_aggregator_code) .returns(ReturnsNewAddress) - .prepare_async() .run() .await; + let new_address_bech32 = bech32::encode(&new_address); self.state .set_price_aggregator_address(Bech32Address::from_bech32_string( @@ -281,9 +281,9 @@ impl ContractInteract { .init(false) .code(&self.header_verifier_code) .returns(ReturnsNewAddress) - .prepare_async() .run() .await; + let new_address_bech32 = bech32::encode(&new_address); self.state .set_header_verifier_address(Bech32Address::from_bech32_string( @@ -305,7 +305,6 @@ impl ContractInteract { .code(&self.contract_code) .code_metadata(CodeMetadata::UPGRADEABLE) .returns(ReturnsNewAddress) - .prepare_async() .run() .await; @@ -323,7 +322,6 @@ impl ContractInteract { .typed(proxy::EsdtSafeProxy) .set_fee_market_address(fee_market_address) .returns(ReturnsResultUnmanaged) - .prepare_async() .run() .await; @@ -342,7 +340,6 @@ impl ContractInteract { .typed(proxy::EsdtSafeProxy) .set_header_verifier_address(header_verifier_address) .returns(ReturnsResultUnmanaged) - .prepare_async() .run() .await; @@ -377,7 +374,6 @@ impl ContractInteract { .deposit(to, transfer_data) .payment(payments) .returns(error) - .prepare_async() .run() .await; } @@ -391,7 +387,6 @@ impl ContractInteract { .deposit(to, transfer_data) .payment(payments) .returns(ReturnsResultUnmanaged) - .prepare_async() .run() .await; } @@ -410,7 +405,6 @@ impl ContractInteract { .typed(proxy::EsdtSafeProxy) .set_min_valid_signers(new_value) .returns(ReturnsResultUnmanaged) - .prepare_async() .run() .await; @@ -429,7 +423,6 @@ impl ContractInteract { .typed(proxy::EsdtSafeProxy) .add_signers(signers) .returns(ReturnsResultUnmanaged) - .prepare_async() .run() .await; @@ -448,7 +441,6 @@ impl ContractInteract { .typed(proxy::EsdtSafeProxy) .remove_signers(signers) .returns(ReturnsResultUnmanaged) - .prepare_async() .run() .await; @@ -480,7 +472,6 @@ impl ContractInteract { ) .egld(egld_amount) .returns(ReturnsResultUnmanaged) - .prepare_async() .run() .await; @@ -502,7 +493,6 @@ impl ContractInteract { .typed(proxy::EsdtSafeProxy) .execute_operations(operation_hash, operation) .returns(ReturnsResultUnmanaged) - .prepare_async() .run() .await; @@ -524,7 +514,6 @@ impl ContractInteract { .typed(proxy::EsdtSafeProxy) .execute_operations(operation_hash, operation) .returns(error_msg) - .prepare_async() .run() .await; @@ -543,7 +532,6 @@ impl ContractInteract { .typed(proxy::EsdtSafeProxy) .set_max_tx_batch_size(new_max_tx_batch_size) .returns(ReturnsResultUnmanaged) - .prepare_async() .run() .await; @@ -562,7 +550,6 @@ impl ContractInteract { .typed(proxy::EsdtSafeProxy) .set_max_tx_batch_block_duration(new_max_tx_batch_block_duration) .returns(ReturnsResultUnmanaged) - .prepare_async() .run() .await; @@ -577,7 +564,6 @@ impl ContractInteract { .typed(proxy::EsdtSafeProxy) .get_current_tx_batch() .returns(ReturnsResultUnmanaged) - .prepare_async() .run() .await; } @@ -590,7 +576,6 @@ impl ContractInteract { .typed(proxy::EsdtSafeProxy) .get_first_batch_any_status() .returns(ReturnsResultUnmanaged) - .prepare_async() .run() .await; } @@ -605,7 +590,6 @@ impl ContractInteract { .typed(proxy::EsdtSafeProxy) .get_batch(batch_id) .returns(ReturnsResultUnmanaged) - .prepare_async() .run() .await; } @@ -619,7 +603,6 @@ impl ContractInteract { .typed(proxy::EsdtSafeProxy) .get_batch_status(batch_id) .returns(ReturnsResultUnmanaged) - .prepare_async() .run() .await; } @@ -632,7 +615,6 @@ impl ContractInteract { .typed(proxy::EsdtSafeProxy) .first_batch_id() .returns(ReturnsResultUnmanaged) - .prepare_async() .run() .await; @@ -647,7 +629,6 @@ impl ContractInteract { .typed(proxy::EsdtSafeProxy) .last_batch_id() .returns(ReturnsResultUnmanaged) - .prepare_async() .run() .await; @@ -667,7 +648,6 @@ impl ContractInteract { .typed(proxy::EsdtSafeProxy) .set_max_bridged_amount(token_id, max_amount) .returns(ReturnsResultUnmanaged) - .prepare_async() .run() .await; @@ -684,7 +664,6 @@ impl ContractInteract { .typed(proxy::EsdtSafeProxy) .max_bridged_amount(token_id) .returns(ReturnsResultUnmanaged) - .prepare_async() .run() .await; @@ -701,7 +680,6 @@ impl ContractInteract { .typed(proxy::EsdtSafeProxy) .end_setup_phase() .returns(ReturnsResultUnmanaged) - .prepare_async() .run() .await; @@ -720,7 +698,6 @@ impl ContractInteract { .typed(proxy::EsdtSafeProxy) .add_tokens_to_whitelist(tokens) .returns(ReturnsResultUnmanaged) - .prepare_async() .run() .await; @@ -739,7 +716,6 @@ impl ContractInteract { .typed(proxy::EsdtSafeProxy) .remove_tokens_from_whitelist(tokens) .returns(ReturnsResultUnmanaged) - .prepare_async() .run() .await; @@ -758,7 +734,6 @@ impl ContractInteract { .typed(proxy::EsdtSafeProxy) .add_tokens_to_blacklist(tokens) .returns(ReturnsResultUnmanaged) - .prepare_async() .run() .await; @@ -777,7 +752,6 @@ impl ContractInteract { .typed(proxy::EsdtSafeProxy) .remove_tokens_from_blacklist(tokens) .returns(ReturnsResultUnmanaged) - .prepare_async() .run() .await; @@ -792,7 +766,6 @@ impl ContractInteract { .typed(proxy::EsdtSafeProxy) .token_whitelist() .returns(ReturnsResultUnmanaged) - .prepare_async() .run() .await; @@ -807,7 +780,6 @@ impl ContractInteract { .typed(proxy::EsdtSafeProxy) .token_blacklist() .returns(ReturnsResultUnmanaged) - .prepare_async() .run() .await; @@ -824,7 +796,6 @@ impl ContractInteract { .typed(proxy::EsdtSafeProxy) .pause_endpoint() .returns(ReturnsResultUnmanaged) - .prepare_async() .run() .await; @@ -841,7 +812,6 @@ impl ContractInteract { .typed(proxy::EsdtSafeProxy) .unpause_endpoint() .returns(ReturnsResultUnmanaged) - .prepare_async() .run() .await; @@ -856,7 +826,6 @@ impl ContractInteract { .typed(proxy::EsdtSafeProxy) .paused_status() .returns(ReturnsResultUnmanaged) - .prepare_async() .run() .await; @@ -873,7 +842,6 @@ impl ContractInteract { .typed(FeeMarketProxy) .remove_fee(TOKEN_ID) .returns(ReturnsResultUnmanaged) - .prepare_async() .run() .await; From 9edbdc083652a2247bcd5c507b716819353f1a17 Mon Sep 17 00:00:00 2001 From: Andrei Baltariu Date: Mon, 11 Nov 2024 15:30:08 +0200 Subject: [PATCH 511/523] Cargo.lock update Signed-off-by: Andrei Baltariu --- Cargo.lock | 185 ++++++++++++++++++++++++++++++++++++++++------------- 1 file changed, 140 insertions(+), 45 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 8b1d257e..237c2ce0 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -196,8 +196,8 @@ dependencies = [ name = "bls-signature" version = "0.0.0" dependencies = [ - "multiversx-sc", - "multiversx-sc-scenario", + "multiversx-sc 0.54.0", + "multiversx-sc-scenario 0.54.0", "transaction", ] @@ -232,9 +232,9 @@ checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" name = "chain-config" version = "0.0.0" dependencies = [ - "multiversx-sc", + "multiversx-sc 0.54.0", "multiversx-sc-modules", - "multiversx-sc-scenario", + "multiversx-sc-scenario 0.54.0", "num-bigint", ] @@ -243,7 +243,7 @@ name = "chain-config-meta" version = "0.0.0" dependencies = [ "chain-config", - "multiversx-sc-meta-lib", + "multiversx-sc-meta-lib 0.54.0", ] [[package]] @@ -252,8 +252,8 @@ version = "0.0.0" dependencies = [ "bls-signature", "chain-config", - "multiversx-sc", - "multiversx-sc-scenario", + "multiversx-sc 0.54.0", + "multiversx-sc-scenario 0.54.0", "num-bigint", "utils", ] @@ -263,7 +263,7 @@ name = "chain-factory-meta" version = "0.0.0" dependencies = [ "chain-factory", - "multiversx-sc-meta-lib", + "multiversx-sc-meta-lib 0.54.0", ] [[package]] @@ -484,9 +484,9 @@ dependencies = [ "header-verifier", "hex", "max-bridged-amount-module", - "multiversx-sc", + "multiversx-sc 0.54.0", "multiversx-sc-modules", - "multiversx-sc-scenario", + "multiversx-sc-scenario 0.54.0", "num-bigint", "num-traits", "setup-phase", @@ -502,7 +502,7 @@ name = "enshrine-esdt-safe-meta" version = "0.0.0" dependencies = [ "enshrine-esdt-safe", - "multiversx-sc-meta-lib", + "multiversx-sc-meta-lib 0.54.0", ] [[package]] @@ -553,9 +553,9 @@ dependencies = [ "header-verifier", "hex", "max-bridged-amount-module", - "multiversx-sc", + "multiversx-sc 0.54.0", "multiversx-sc-modules", - "multiversx-sc-scenario", + "multiversx-sc-scenario 0.54.0", "num-bigint", "num-traits", "setup-phase", @@ -570,7 +570,7 @@ name = "esdt-safe-meta" version = "0.0.0" dependencies = [ "esdt-safe", - "multiversx-sc-meta-lib", + "multiversx-sc-meta-lib 0.54.0", ] [[package]] @@ -584,8 +584,8 @@ name = "fee-market" version = "0.0.0" dependencies = [ "bls-signature", - "multiversx-sc", - "multiversx-sc-scenario", + "multiversx-sc 0.54.0", + "multiversx-sc-scenario 0.54.0", "num-bigint", "transaction", "utils", @@ -596,7 +596,7 @@ name = "fee-market-meta" version = "0.0.0" dependencies = [ "fee-market", - "multiversx-sc-meta-lib", + "multiversx-sc-meta-lib 0.54.0", ] [[package]] @@ -766,8 +766,8 @@ name = "header-verifier" version = "0.0.0" dependencies = [ "bls-signature", - "multiversx-sc", - "multiversx-sc-scenario", + "multiversx-sc 0.54.0", + "multiversx-sc-scenario 0.54.0", "num-bigint", "transaction", ] @@ -777,7 +777,7 @@ name = "header-verifier-meta" version = "0.0.0" dependencies = [ "header-verifier", - "multiversx-sc-meta-lib", + "multiversx-sc-meta-lib 0.54.0", ] [[package]] @@ -1032,8 +1032,8 @@ checksum = "90ed8c1e510134f979dbc4f070f87d4313098b704861a105fe34231c70a3901c" name = "max-bridged-amount-module" version = "0.0.0" dependencies = [ - "multiversx-sc", - "multiversx-sc-scenario", + "multiversx-sc 0.54.0", + "multiversx-sc-scenario 0.54.0", ] [[package]] @@ -1094,6 +1094,27 @@ dependencies = [ "sha3", ] +[[package]] +name = "multiversx-chain-vm" +version = "0.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "13c537d27dfc7a8e295d4f7c5f67a967ce66b6c3fc8e31a160e8cf28e14ecb2d" +dependencies = [ + "bitflags", + "colored", + "ed25519-dalek", + "hex", + "hex-literal", + "itertools", + "multiversx-chain-vm-executor", + "num-bigint", + "num-traits", + "rand", + "rand_seeder", + "sha2", + "sha3", +] + [[package]] name = "multiversx-chain-vm" version = "0.11.0" @@ -1122,6 +1143,20 @@ version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b59072fa0624b55ae5ae3fa6bfa91515bbeb4ac440214bc4a509e2c8806d6e9f" +[[package]] +name = "multiversx-sc" +version = "0.53.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "75ea89a26f0aacda21437a8ae5ccfbefab99d8191942b3d2eddbcbf84f9866d7" +dependencies = [ + "bitflags", + "hex-literal", + "multiversx-sc-codec", + "multiversx-sc-derive 0.53.2", + "num-traits", + "unwrap-infallible", +] + [[package]] name = "multiversx-sc" version = "0.54.0" @@ -1132,7 +1167,7 @@ dependencies = [ "hex-literal", "multiversx-chain-core", "multiversx-sc-codec", - "multiversx-sc-derive", + "multiversx-sc-derive 0.54.0", "num-traits", "unwrap-infallible", ] @@ -1161,6 +1196,19 @@ dependencies = [ "syn", ] +[[package]] +name = "multiversx-sc-derive" +version = "0.53.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4c17fdf90fafca2f19085ae67b0502d9f71bf8ab1be3c83808eb88e02a8c18b9" +dependencies = [ + "hex", + "proc-macro2", + "quote", + "radix_trie", + "syn", +] + [[package]] name = "multiversx-sc-derive" version = "0.54.0" @@ -1174,6 +1222,27 @@ dependencies = [ "syn", ] +[[package]] +name = "multiversx-sc-meta-lib" +version = "0.53.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ef023806e14a8a6245408c4a7dfdf17d4a1eb39425cedfe50cd2c48f96708ab6" +dependencies = [ + "clap", + "colored", + "convert_case", + "hex", + "lazy_static", + "multiversx-sc 0.53.2", + "rustc_version", + "semver", + "serde", + "serde_json", + "toml", + "wasmparser 0.216.0", + "wasmprinter", +] + [[package]] name = "multiversx-sc-meta-lib" version = "0.54.0" @@ -1185,7 +1254,7 @@ dependencies = [ "convert_case", "hex", "lazy_static", - "multiversx-sc", + "multiversx-sc 0.54.0", "rustc_version", "semver", "serde", @@ -1202,7 +1271,33 @@ version = "0.54.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5373903a01dd7d33547b83f0034dc6e12fbbc8e49fcb316a3efb6ef4ff6573a8" dependencies = [ - "multiversx-sc", + "multiversx-sc 0.54.0", +] + +[[package]] +name = "multiversx-sc-scenario" +version = "0.53.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cd16e3bf1f6696d0add36b7b905b1ffdd13b836e584da000f5e265c11e2bfc8d" +dependencies = [ + "base64", + "bech32", + "colored", + "hex", + "itertools", + "log", + "multiversx-chain-scenario-format", + "multiversx-chain-vm 0.10.0", + "multiversx-chain-vm-executor", + "multiversx-sc 0.53.2", + "multiversx-sc-meta-lib 0.53.2", + "num-bigint", + "num-traits", + "pathdiff", + "serde", + "serde_json", + "sha2", + "unwrap-infallible", ] [[package]] @@ -1218,10 +1313,10 @@ dependencies = [ "itertools", "log", "multiversx-chain-scenario-format", - "multiversx-chain-vm", + "multiversx-chain-vm 0.11.0", "multiversx-chain-vm-executor", - "multiversx-sc", - "multiversx-sc-meta-lib", + "multiversx-sc 0.54.0", + "multiversx-sc-meta-lib 0.54.0", "num-bigint", "num-traits", "pathdiff", @@ -1244,7 +1339,7 @@ dependencies = [ "hex", "log", "multiversx-chain-scenario-format", - "multiversx-sc-scenario", + "multiversx-sc-scenario 0.54.0", "multiversx-sdk", "multiversx-sdk-http", "tokio", @@ -1660,8 +1755,8 @@ dependencies = [ "clap", "esdt-safe", "fee-market", - "multiversx-sc", - "multiversx-sc-scenario", + "multiversx-sc 0.54.0", + "multiversx-sc-scenario 0.54.0", "multiversx-sc-snippets", "serde", "toml", @@ -1851,8 +1946,8 @@ dependencies = [ name = "setup-phase" version = "0.0.0" dependencies = [ - "multiversx-sc", - "multiversx-sc-scenario", + "multiversx-sc 0.54.0", + "multiversx-sc-scenario 0.54.0", ] [[package]] @@ -1990,8 +2085,8 @@ dependencies = [ name = "testing-sc" version = "0.0.0" dependencies = [ - "multiversx-sc", - "multiversx-sc-scenario", + "multiversx-sc 0.53.2", + "multiversx-sc-scenario 0.53.2", "num-bigint", ] @@ -1999,7 +2094,7 @@ dependencies = [ name = "testing-sc-meta" version = "0.0.0" dependencies = [ - "multiversx-sc-meta-lib", + "multiversx-sc-meta-lib 0.53.2", "testing-sc", ] @@ -2024,8 +2119,8 @@ version = "0.0.0" dependencies = [ "chain-factory", "header-verifier", - "multiversx-sc", - "multiversx-sc-scenario", + "multiversx-sc 0.54.0", + "multiversx-sc-scenario 0.54.0", "num-bigint", "transaction", ] @@ -2034,7 +2129,7 @@ dependencies = [ name = "token-handler-meta" version = "0.0.0" dependencies = [ - "multiversx-sc-meta-lib", + "multiversx-sc-meta-lib 0.54.0", "token-handler", ] @@ -2043,8 +2138,8 @@ name = "token-whitelist" version = "0.0.0" dependencies = [ "bls-signature", - "multiversx-sc", - "multiversx-sc-scenario", + "multiversx-sc 0.54.0", + "multiversx-sc-scenario 0.54.0", "setup-phase", "utils", ] @@ -2152,7 +2247,7 @@ dependencies = [ name = "transaction" version = "0.0.0" dependencies = [ - "multiversx-sc", + "multiversx-sc 0.54.0", ] [[package]] @@ -2165,8 +2260,8 @@ checksum = "e421abadd41a4225275504ea4d6566923418b7f05506fbc9c0fe86ba7396114b" name = "tx-batch-module" version = "0.0.0" dependencies = [ - "multiversx-sc", - "multiversx-sc-scenario", + "multiversx-sc 0.54.0", + "multiversx-sc-scenario 0.54.0", "transaction", ] @@ -2237,7 +2332,7 @@ name = "utils" version = "0.0.0" dependencies = [ "bls-signature", - "multiversx-sc", + "multiversx-sc 0.54.0", ] [[package]] From eee2b5bbe2e584d82245995e75274904abf0fda7 Mon Sep 17 00:00:00 2001 From: Andrei Baltariu Date: Mon, 11 Nov 2024 15:32:28 +0200 Subject: [PATCH 512/523] Removed `prepare_async` deprecated function Signed-off-by: Andrei Baltariu --- esdt-safe/interactor/src/interactor_main.rs | 4 ---- 1 file changed, 4 deletions(-) diff --git a/esdt-safe/interactor/src/interactor_main.rs b/esdt-safe/interactor/src/interactor_main.rs index 2d2c2fd6..851d97af 100644 --- a/esdt-safe/interactor/src/interactor_main.rs +++ b/esdt-safe/interactor/src/interactor_main.rs @@ -358,7 +358,6 @@ impl ContractInteract { .init() .code(testing_sc_code_path) .returns(ReturnsNewAddress) - .prepare_async() .run() .await; @@ -381,7 +380,6 @@ impl ContractInteract { .typed(TestingScProxy) .hello(value) .returns(ReturnsResultUnmanaged) - .prepare_async() .run() .await; @@ -952,7 +950,6 @@ impl ContractInteract { .gas(30_000_000u64) .typed(HeaderverifierProxy) .set_esdt_safe_address(self.state.current_address()) - .prepare_async() .run() .await; @@ -1021,7 +1018,6 @@ impl ContractInteract { managed_operation_hashes, ) .returns(ReturnsResult) - .prepare_async() .run() .await; From 7eb323e6c2b94204c67f8953eebafa4ebf879560 Mon Sep 17 00:00:00 2001 From: Andrei Baltariu Date: Mon, 11 Nov 2024 15:34:49 +0200 Subject: [PATCH 513/523] Fixed code after fw upgrade Signed-off-by: Andrei Baltariu --- esdt-safe/interactor/src/interactor_main.rs | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/esdt-safe/interactor/src/interactor_main.rs b/esdt-safe/interactor/src/interactor_main.rs index 851d97af..ef00a1a0 100644 --- a/esdt-safe/interactor/src/interactor_main.rs +++ b/esdt-safe/interactor/src/interactor_main.rs @@ -13,7 +13,6 @@ use multiversx_sc_snippets::imports::*; use multiversx_sc_snippets::sdk::{self}; use proxies::*; use serde::{Deserialize, Serialize}; -use std::env::{self}; use std::{ io::{Read, Write}, path::Path, @@ -163,16 +162,16 @@ struct ContractInteract { impl ContractInteract { async fn new() -> Self { - let mut interactor = Interactor::new(GATEWAY) + let mut interactor = Interactor::new(GATEWAY, false) .await .with_tracer(INTERACTOR_SCENARIO_TRACE_PATH) .await; - let wallet_address = interactor.register_wallet(test_wallets::bob()); - let frank_address = interactor.register_wallet(test_wallets::frank()); - let alice_address = interactor.register_wallet(test_wallets::alice()); - let mike_address = interactor.register_wallet(test_wallets::mike()); - let judy_address = interactor.register_wallet(test_wallets::judy()); + let wallet_address = interactor.register_wallet(test_wallets::bob()).await; + let frank_address = interactor.register_wallet(test_wallets::frank()).await; + let alice_address = interactor.register_wallet(test_wallets::alice()).await; + let mike_address = interactor.register_wallet(test_wallets::mike()).await; + let judy_address = interactor.register_wallet(test_wallets::judy()).await; let current_dir = find_current_workspace().unwrap(); println!("Current directory is: {}", current_dir.display()); @@ -285,6 +284,7 @@ impl ContractInteract { } async fn deploy_price_aggregator(&mut self) { + let price_agggregator_code_path = MxscPath::new(&self.price_aggregator_code); let mut oracles = MultiValueEncoded::new(); let first_oracle_adress = managed_address!(&self.bob_address.clone()); let second_oracle_adress = managed_address!(&self.alice_address.clone()); @@ -309,7 +309,7 @@ impl ContractInteract { 3u8, oracles, ) - .code(&self.price_aggregator_code) + .code(price_agggregator_code_path) .returns(ReturnsNewAddress) .run() .await; From 9bfaefdcd3fc5da6a8fec43d767f4bffc38d1e96 Mon Sep 17 00:00:00 2001 From: Andrei Baltariu Date: Mon, 11 Nov 2024 15:37:26 +0200 Subject: [PATCH 514/523] Fixed `esdt-safe` dir Signed-off-by: Andrei Baltariu --- esdt-safe/interactor/src/interactor_main.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/esdt-safe/interactor/src/interactor_main.rs b/esdt-safe/interactor/src/interactor_main.rs index ef00a1a0..abe74fe2 100644 --- a/esdt-safe/interactor/src/interactor_main.rs +++ b/esdt-safe/interactor/src/interactor_main.rs @@ -195,7 +195,7 @@ impl ContractInteract { .to_string(); let esdt_safe_output_path = "esdt-safe/output/esdt-safe.mxsc.json"; - let esdt_safe_code = repo_dir + let esdt_safe_code = current_dir .join(esdt_safe_output_path) .to_string_lossy() .to_string(); From 80554e47b85bf75931c6e2312c542cf59025576d Mon Sep 17 00:00:00 2001 From: Andrei Baltariu Date: Tue, 12 Nov 2024 10:40:00 +0200 Subject: [PATCH 515/523] testing-sc fw upgrade Signed-off-by: Andrei Baltariu --- Cargo.lock | 185 +++++---------------- testing-sc/Cargo.toml | 4 +- testing-sc/meta/Cargo.toml | 2 +- testing-sc/wasm-testing-sc-full/Cargo.lock | 23 ++- testing-sc/wasm-testing-sc-full/Cargo.toml | 2 +- testing-sc/wasm-testing-view/Cargo.lock | 23 ++- testing-sc/wasm-testing-view/Cargo.toml | 2 +- testing-sc/wasm/Cargo.lock | 23 ++- testing-sc/wasm/Cargo.toml | 2 +- 9 files changed, 102 insertions(+), 164 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 237c2ce0..8b1d257e 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -196,8 +196,8 @@ dependencies = [ name = "bls-signature" version = "0.0.0" dependencies = [ - "multiversx-sc 0.54.0", - "multiversx-sc-scenario 0.54.0", + "multiversx-sc", + "multiversx-sc-scenario", "transaction", ] @@ -232,9 +232,9 @@ checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" name = "chain-config" version = "0.0.0" dependencies = [ - "multiversx-sc 0.54.0", + "multiversx-sc", "multiversx-sc-modules", - "multiversx-sc-scenario 0.54.0", + "multiversx-sc-scenario", "num-bigint", ] @@ -243,7 +243,7 @@ name = "chain-config-meta" version = "0.0.0" dependencies = [ "chain-config", - "multiversx-sc-meta-lib 0.54.0", + "multiversx-sc-meta-lib", ] [[package]] @@ -252,8 +252,8 @@ version = "0.0.0" dependencies = [ "bls-signature", "chain-config", - "multiversx-sc 0.54.0", - "multiversx-sc-scenario 0.54.0", + "multiversx-sc", + "multiversx-sc-scenario", "num-bigint", "utils", ] @@ -263,7 +263,7 @@ name = "chain-factory-meta" version = "0.0.0" dependencies = [ "chain-factory", - "multiversx-sc-meta-lib 0.54.0", + "multiversx-sc-meta-lib", ] [[package]] @@ -484,9 +484,9 @@ dependencies = [ "header-verifier", "hex", "max-bridged-amount-module", - "multiversx-sc 0.54.0", + "multiversx-sc", "multiversx-sc-modules", - "multiversx-sc-scenario 0.54.0", + "multiversx-sc-scenario", "num-bigint", "num-traits", "setup-phase", @@ -502,7 +502,7 @@ name = "enshrine-esdt-safe-meta" version = "0.0.0" dependencies = [ "enshrine-esdt-safe", - "multiversx-sc-meta-lib 0.54.0", + "multiversx-sc-meta-lib", ] [[package]] @@ -553,9 +553,9 @@ dependencies = [ "header-verifier", "hex", "max-bridged-amount-module", - "multiversx-sc 0.54.0", + "multiversx-sc", "multiversx-sc-modules", - "multiversx-sc-scenario 0.54.0", + "multiversx-sc-scenario", "num-bigint", "num-traits", "setup-phase", @@ -570,7 +570,7 @@ name = "esdt-safe-meta" version = "0.0.0" dependencies = [ "esdt-safe", - "multiversx-sc-meta-lib 0.54.0", + "multiversx-sc-meta-lib", ] [[package]] @@ -584,8 +584,8 @@ name = "fee-market" version = "0.0.0" dependencies = [ "bls-signature", - "multiversx-sc 0.54.0", - "multiversx-sc-scenario 0.54.0", + "multiversx-sc", + "multiversx-sc-scenario", "num-bigint", "transaction", "utils", @@ -596,7 +596,7 @@ name = "fee-market-meta" version = "0.0.0" dependencies = [ "fee-market", - "multiversx-sc-meta-lib 0.54.0", + "multiversx-sc-meta-lib", ] [[package]] @@ -766,8 +766,8 @@ name = "header-verifier" version = "0.0.0" dependencies = [ "bls-signature", - "multiversx-sc 0.54.0", - "multiversx-sc-scenario 0.54.0", + "multiversx-sc", + "multiversx-sc-scenario", "num-bigint", "transaction", ] @@ -777,7 +777,7 @@ name = "header-verifier-meta" version = "0.0.0" dependencies = [ "header-verifier", - "multiversx-sc-meta-lib 0.54.0", + "multiversx-sc-meta-lib", ] [[package]] @@ -1032,8 +1032,8 @@ checksum = "90ed8c1e510134f979dbc4f070f87d4313098b704861a105fe34231c70a3901c" name = "max-bridged-amount-module" version = "0.0.0" dependencies = [ - "multiversx-sc 0.54.0", - "multiversx-sc-scenario 0.54.0", + "multiversx-sc", + "multiversx-sc-scenario", ] [[package]] @@ -1094,27 +1094,6 @@ dependencies = [ "sha3", ] -[[package]] -name = "multiversx-chain-vm" -version = "0.10.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "13c537d27dfc7a8e295d4f7c5f67a967ce66b6c3fc8e31a160e8cf28e14ecb2d" -dependencies = [ - "bitflags", - "colored", - "ed25519-dalek", - "hex", - "hex-literal", - "itertools", - "multiversx-chain-vm-executor", - "num-bigint", - "num-traits", - "rand", - "rand_seeder", - "sha2", - "sha3", -] - [[package]] name = "multiversx-chain-vm" version = "0.11.0" @@ -1143,20 +1122,6 @@ version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b59072fa0624b55ae5ae3fa6bfa91515bbeb4ac440214bc4a509e2c8806d6e9f" -[[package]] -name = "multiversx-sc" -version = "0.53.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "75ea89a26f0aacda21437a8ae5ccfbefab99d8191942b3d2eddbcbf84f9866d7" -dependencies = [ - "bitflags", - "hex-literal", - "multiversx-sc-codec", - "multiversx-sc-derive 0.53.2", - "num-traits", - "unwrap-infallible", -] - [[package]] name = "multiversx-sc" version = "0.54.0" @@ -1167,7 +1132,7 @@ dependencies = [ "hex-literal", "multiversx-chain-core", "multiversx-sc-codec", - "multiversx-sc-derive 0.54.0", + "multiversx-sc-derive", "num-traits", "unwrap-infallible", ] @@ -1196,19 +1161,6 @@ dependencies = [ "syn", ] -[[package]] -name = "multiversx-sc-derive" -version = "0.53.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4c17fdf90fafca2f19085ae67b0502d9f71bf8ab1be3c83808eb88e02a8c18b9" -dependencies = [ - "hex", - "proc-macro2", - "quote", - "radix_trie", - "syn", -] - [[package]] name = "multiversx-sc-derive" version = "0.54.0" @@ -1222,27 +1174,6 @@ dependencies = [ "syn", ] -[[package]] -name = "multiversx-sc-meta-lib" -version = "0.53.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ef023806e14a8a6245408c4a7dfdf17d4a1eb39425cedfe50cd2c48f96708ab6" -dependencies = [ - "clap", - "colored", - "convert_case", - "hex", - "lazy_static", - "multiversx-sc 0.53.2", - "rustc_version", - "semver", - "serde", - "serde_json", - "toml", - "wasmparser 0.216.0", - "wasmprinter", -] - [[package]] name = "multiversx-sc-meta-lib" version = "0.54.0" @@ -1254,7 +1185,7 @@ dependencies = [ "convert_case", "hex", "lazy_static", - "multiversx-sc 0.54.0", + "multiversx-sc", "rustc_version", "semver", "serde", @@ -1271,33 +1202,7 @@ version = "0.54.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5373903a01dd7d33547b83f0034dc6e12fbbc8e49fcb316a3efb6ef4ff6573a8" dependencies = [ - "multiversx-sc 0.54.0", -] - -[[package]] -name = "multiversx-sc-scenario" -version = "0.53.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cd16e3bf1f6696d0add36b7b905b1ffdd13b836e584da000f5e265c11e2bfc8d" -dependencies = [ - "base64", - "bech32", - "colored", - "hex", - "itertools", - "log", - "multiversx-chain-scenario-format", - "multiversx-chain-vm 0.10.0", - "multiversx-chain-vm-executor", - "multiversx-sc 0.53.2", - "multiversx-sc-meta-lib 0.53.2", - "num-bigint", - "num-traits", - "pathdiff", - "serde", - "serde_json", - "sha2", - "unwrap-infallible", + "multiversx-sc", ] [[package]] @@ -1313,10 +1218,10 @@ dependencies = [ "itertools", "log", "multiversx-chain-scenario-format", - "multiversx-chain-vm 0.11.0", + "multiversx-chain-vm", "multiversx-chain-vm-executor", - "multiversx-sc 0.54.0", - "multiversx-sc-meta-lib 0.54.0", + "multiversx-sc", + "multiversx-sc-meta-lib", "num-bigint", "num-traits", "pathdiff", @@ -1339,7 +1244,7 @@ dependencies = [ "hex", "log", "multiversx-chain-scenario-format", - "multiversx-sc-scenario 0.54.0", + "multiversx-sc-scenario", "multiversx-sdk", "multiversx-sdk-http", "tokio", @@ -1755,8 +1660,8 @@ dependencies = [ "clap", "esdt-safe", "fee-market", - "multiversx-sc 0.54.0", - "multiversx-sc-scenario 0.54.0", + "multiversx-sc", + "multiversx-sc-scenario", "multiversx-sc-snippets", "serde", "toml", @@ -1946,8 +1851,8 @@ dependencies = [ name = "setup-phase" version = "0.0.0" dependencies = [ - "multiversx-sc 0.54.0", - "multiversx-sc-scenario 0.54.0", + "multiversx-sc", + "multiversx-sc-scenario", ] [[package]] @@ -2085,8 +1990,8 @@ dependencies = [ name = "testing-sc" version = "0.0.0" dependencies = [ - "multiversx-sc 0.53.2", - "multiversx-sc-scenario 0.53.2", + "multiversx-sc", + "multiversx-sc-scenario", "num-bigint", ] @@ -2094,7 +1999,7 @@ dependencies = [ name = "testing-sc-meta" version = "0.0.0" dependencies = [ - "multiversx-sc-meta-lib 0.53.2", + "multiversx-sc-meta-lib", "testing-sc", ] @@ -2119,8 +2024,8 @@ version = "0.0.0" dependencies = [ "chain-factory", "header-verifier", - "multiversx-sc 0.54.0", - "multiversx-sc-scenario 0.54.0", + "multiversx-sc", + "multiversx-sc-scenario", "num-bigint", "transaction", ] @@ -2129,7 +2034,7 @@ dependencies = [ name = "token-handler-meta" version = "0.0.0" dependencies = [ - "multiversx-sc-meta-lib 0.54.0", + "multiversx-sc-meta-lib", "token-handler", ] @@ -2138,8 +2043,8 @@ name = "token-whitelist" version = "0.0.0" dependencies = [ "bls-signature", - "multiversx-sc 0.54.0", - "multiversx-sc-scenario 0.54.0", + "multiversx-sc", + "multiversx-sc-scenario", "setup-phase", "utils", ] @@ -2247,7 +2152,7 @@ dependencies = [ name = "transaction" version = "0.0.0" dependencies = [ - "multiversx-sc 0.54.0", + "multiversx-sc", ] [[package]] @@ -2260,8 +2165,8 @@ checksum = "e421abadd41a4225275504ea4d6566923418b7f05506fbc9c0fe86ba7396114b" name = "tx-batch-module" version = "0.0.0" dependencies = [ - "multiversx-sc 0.54.0", - "multiversx-sc-scenario 0.54.0", + "multiversx-sc", + "multiversx-sc-scenario", "transaction", ] @@ -2332,7 +2237,7 @@ name = "utils" version = "0.0.0" dependencies = [ "bls-signature", - "multiversx-sc 0.54.0", + "multiversx-sc", ] [[package]] diff --git a/testing-sc/Cargo.toml b/testing-sc/Cargo.toml index ed563ac1..0b24d91b 100644 --- a/testing-sc/Cargo.toml +++ b/testing-sc/Cargo.toml @@ -9,10 +9,10 @@ authors = ["you"] path = "src/lib.rs" [dependencies.multiversx-sc] -version = "0.53.2" +version = "0.54.0" [dev-dependencies] num-bigint = "0.4" [dev-dependencies.multiversx-sc-scenario] -version = "0.53.2" +version = "0.54.0" diff --git a/testing-sc/meta/Cargo.toml b/testing-sc/meta/Cargo.toml index 357c5e09..b23dbb53 100644 --- a/testing-sc/meta/Cargo.toml +++ b/testing-sc/meta/Cargo.toml @@ -8,5 +8,5 @@ publish = false path = ".." [dependencies.multiversx-sc-meta-lib] -version = "0.53.2" +version = "0.54.0" default-features = false diff --git a/testing-sc/wasm-testing-sc-full/Cargo.lock b/testing-sc/wasm-testing-sc-full/Cargo.lock index b82eb6ce..fe127258 100644 --- a/testing-sc/wasm-testing-sc-full/Cargo.lock +++ b/testing-sc/wasm-testing-sc-full/Cargo.lock @@ -38,14 +38,25 @@ version = "0.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6fe2267d4ed49bc07b63801559be28c718ea06c4738b7a03c94df7386d2cde46" +[[package]] +name = "multiversx-chain-core" +version = "0.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0c1088b268cad0d8c1146df9ca71a1f2baaee78267ab75e2202c0c0c71cc4b6e" +dependencies = [ + "bitflags", + "multiversx-sc-codec", +] + [[package]] name = "multiversx-sc" -version = "0.53.2" +version = "0.54.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "75ea89a26f0aacda21437a8ae5ccfbefab99d8191942b3d2eddbcbf84f9866d7" +checksum = "b9e5cee0b8c5fbaa9edfee2e38f2162adb01700a0028942d2cd14808cd26b130" dependencies = [ "bitflags", "hex-literal", + "multiversx-chain-core", "multiversx-sc-codec", "multiversx-sc-derive", "num-traits", @@ -77,9 +88,9 @@ dependencies = [ [[package]] name = "multiversx-sc-derive" -version = "0.53.2" +version = "0.54.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4c17fdf90fafca2f19085ae67b0502d9f71bf8ab1be3c83808eb88e02a8c18b9" +checksum = "931669b080cf793b205bf08b5d1f4a658d0ac0ad628844d9a9d13649a73c7540" dependencies = [ "hex", "proc-macro2", @@ -90,9 +101,9 @@ dependencies = [ [[package]] name = "multiversx-sc-wasm-adapter" -version = "0.53.2" +version = "0.54.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "20659915a4377d375c46d7f237e810053a03f7e084fad6362dd5748a7233defb" +checksum = "c034ae143cfd971cf0c4d67476af1920a9a0165bd99713458397ac06762fca0d" dependencies = [ "multiversx-sc", ] diff --git a/testing-sc/wasm-testing-sc-full/Cargo.toml b/testing-sc/wasm-testing-sc-full/Cargo.toml index 59a01838..29e03c4e 100644 --- a/testing-sc/wasm-testing-sc-full/Cargo.toml +++ b/testing-sc/wasm-testing-sc-full/Cargo.toml @@ -28,7 +28,7 @@ panic = "abort" path = ".." [dependencies.multiversx-sc-wasm-adapter] -version = "0.53.2" +version = "0.54.0" [workspace] members = ["."] diff --git a/testing-sc/wasm-testing-view/Cargo.lock b/testing-sc/wasm-testing-view/Cargo.lock index 7cbac8f4..137149ed 100644 --- a/testing-sc/wasm-testing-view/Cargo.lock +++ b/testing-sc/wasm-testing-view/Cargo.lock @@ -38,14 +38,25 @@ version = "0.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6fe2267d4ed49bc07b63801559be28c718ea06c4738b7a03c94df7386d2cde46" +[[package]] +name = "multiversx-chain-core" +version = "0.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0c1088b268cad0d8c1146df9ca71a1f2baaee78267ab75e2202c0c0c71cc4b6e" +dependencies = [ + "bitflags", + "multiversx-sc-codec", +] + [[package]] name = "multiversx-sc" -version = "0.53.2" +version = "0.54.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "75ea89a26f0aacda21437a8ae5ccfbefab99d8191942b3d2eddbcbf84f9866d7" +checksum = "b9e5cee0b8c5fbaa9edfee2e38f2162adb01700a0028942d2cd14808cd26b130" dependencies = [ "bitflags", "hex-literal", + "multiversx-chain-core", "multiversx-sc-codec", "multiversx-sc-derive", "num-traits", @@ -77,9 +88,9 @@ dependencies = [ [[package]] name = "multiversx-sc-derive" -version = "0.53.2" +version = "0.54.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4c17fdf90fafca2f19085ae67b0502d9f71bf8ab1be3c83808eb88e02a8c18b9" +checksum = "931669b080cf793b205bf08b5d1f4a658d0ac0ad628844d9a9d13649a73c7540" dependencies = [ "hex", "proc-macro2", @@ -90,9 +101,9 @@ dependencies = [ [[package]] name = "multiversx-sc-wasm-adapter" -version = "0.53.2" +version = "0.54.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "20659915a4377d375c46d7f237e810053a03f7e084fad6362dd5748a7233defb" +checksum = "c034ae143cfd971cf0c4d67476af1920a9a0165bd99713458397ac06762fca0d" dependencies = [ "multiversx-sc", ] diff --git a/testing-sc/wasm-testing-view/Cargo.toml b/testing-sc/wasm-testing-view/Cargo.toml index 31f09769..87df5ce0 100644 --- a/testing-sc/wasm-testing-view/Cargo.toml +++ b/testing-sc/wasm-testing-view/Cargo.toml @@ -28,7 +28,7 @@ panic = "abort" path = ".." [dependencies.multiversx-sc-wasm-adapter] -version = "0.53.2" +version = "0.54.0" [workspace] members = ["."] diff --git a/testing-sc/wasm/Cargo.lock b/testing-sc/wasm/Cargo.lock index 10cb39dc..39cf87db 100644 --- a/testing-sc/wasm/Cargo.lock +++ b/testing-sc/wasm/Cargo.lock @@ -38,14 +38,25 @@ version = "0.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6fe2267d4ed49bc07b63801559be28c718ea06c4738b7a03c94df7386d2cde46" +[[package]] +name = "multiversx-chain-core" +version = "0.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0c1088b268cad0d8c1146df9ca71a1f2baaee78267ab75e2202c0c0c71cc4b6e" +dependencies = [ + "bitflags", + "multiversx-sc-codec", +] + [[package]] name = "multiversx-sc" -version = "0.53.2" +version = "0.54.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "75ea89a26f0aacda21437a8ae5ccfbefab99d8191942b3d2eddbcbf84f9866d7" +checksum = "b9e5cee0b8c5fbaa9edfee2e38f2162adb01700a0028942d2cd14808cd26b130" dependencies = [ "bitflags", "hex-literal", + "multiversx-chain-core", "multiversx-sc-codec", "multiversx-sc-derive", "num-traits", @@ -77,9 +88,9 @@ dependencies = [ [[package]] name = "multiversx-sc-derive" -version = "0.53.2" +version = "0.54.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4c17fdf90fafca2f19085ae67b0502d9f71bf8ab1be3c83808eb88e02a8c18b9" +checksum = "931669b080cf793b205bf08b5d1f4a658d0ac0ad628844d9a9d13649a73c7540" dependencies = [ "hex", "proc-macro2", @@ -90,9 +101,9 @@ dependencies = [ [[package]] name = "multiversx-sc-wasm-adapter" -version = "0.53.2" +version = "0.54.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "20659915a4377d375c46d7f237e810053a03f7e084fad6362dd5748a7233defb" +checksum = "c034ae143cfd971cf0c4d67476af1920a9a0165bd99713458397ac06762fca0d" dependencies = [ "multiversx-sc", ] diff --git a/testing-sc/wasm/Cargo.toml b/testing-sc/wasm/Cargo.toml index 96001459..557b4faa 100644 --- a/testing-sc/wasm/Cargo.toml +++ b/testing-sc/wasm/Cargo.toml @@ -28,7 +28,7 @@ panic = "abort" path = ".." [dependencies.multiversx-sc-wasm-adapter] -version = "0.53.2" +version = "0.54.0" [workspace] members = ["."] From 6e76b7cba4173dbf57d2aef9397e5e4669f6170e Mon Sep 17 00:00:00 2001 From: Andrei Baltariu Date: Tue, 12 Nov 2024 10:59:15 +0200 Subject: [PATCH 516/523] Fixed interactor output files paths Signed-off-by: Andrei Baltariu --- esdt-safe/interactor/src/interactor_main.rs | 52 +++++++-------------- esdt-safe/interactor/state.toml | 8 ++-- 2 files changed, 20 insertions(+), 40 deletions(-) diff --git a/esdt-safe/interactor/src/interactor_main.rs b/esdt-safe/interactor/src/interactor_main.rs index abe74fe2..946f944f 100644 --- a/esdt-safe/interactor/src/interactor_main.rs +++ b/esdt-safe/interactor/src/interactor_main.rs @@ -162,10 +162,9 @@ struct ContractInteract { impl ContractInteract { async fn new() -> Self { - let mut interactor = Interactor::new(GATEWAY, false) - .await - .with_tracer(INTERACTOR_SCENARIO_TRACE_PATH) - .await; + let mut interactor = Interactor::new(GATEWAY, false).await; + + interactor.set_current_dir_from_workspace("esdt-safe/interactor"); let wallet_address = interactor.register_wallet(test_wallets::bob()).await; let frank_address = interactor.register_wallet(test_wallets::frank()).await; @@ -177,41 +176,22 @@ impl ContractInteract { println!("Current directory is: {}", current_dir.display()); let repo_dir = current_dir - .parent() - .and_then(|p| p.parent()) + .ancestors() + .nth(2) .expect("Failed to go up 2 levels"); println!("Repo directory is: {}", repo_dir.display()); - let fee_market_output_path = "fee-market/output/fee-market.mxsc.json"; - let fee_market_code = repo_dir - .join(fee_market_output_path) - .to_string_lossy() - .to_string(); - - let header_verifier_output_path = "header-verifier/output/header-verifier.mxsc.json"; - let header_verifier_code = repo_dir - .join(header_verifier_output_path) - .to_string_lossy() - .to_string(); - - let esdt_safe_output_path = "esdt-safe/output/esdt-safe.mxsc.json"; - let esdt_safe_code = current_dir - .join(esdt_safe_output_path) - .to_string_lossy() - .to_string(); - - let price_aggregator_output_path = - "../contract-codes/multiversx-price-aggregator-sc.mxsc.json"; - let price_aggregator_code = repo_dir - .join(price_aggregator_output_path) - .to_string_lossy() - .to_string(); - - let testing_sc_output_path = "testing-sc/output/testing-sc.mxsc.json"; - let testing_sc_code = repo_dir - .join(testing_sc_output_path) - .to_string_lossy() - .to_string(); + let fee_market_code = "../../fee-market/output/fee-market.mxsc.json".to_owned(); + + let header_verifier_code = + "../../header-verifier/output/header-verifier.mxsc.json".to_owned(); + + let esdt_safe_code = "../output/esdt-safe.mxsc.json".to_owned(); + + let price_aggregator_code = + "contract-codes/multiversx-price-aggregator-sc.mxsc.json".to_owned(); + + let testing_sc_code = "../../testing-sc/output/testing-sc.mxsc.json".to_owned(); ContractInteract { interactor, diff --git a/esdt-safe/interactor/state.toml b/esdt-safe/interactor/state.toml index 1d02b7dd..209845e0 100644 --- a/esdt-safe/interactor/state.toml +++ b/esdt-safe/interactor/state.toml @@ -1,5 +1,5 @@ -contract_address = "erd1qqqqqqqqqqqqqpgqfaqhhqwn5en78zpxvhxtr0er832d75xzrruqmds7jw" -fee_market_address = "erd1qqqqqqqqqqqqqpgqrm67grf92zrvwjedw6v3gs00yfw0zgfxrruqqsr7v2" +contract_address = "erd1qqqqqqqqqqqqqpgqe9r8mmsyv53lzcpqczax3w6mkghfj4gjrruql6mjek" +fee_market_address = "erd1qqqqqqqqqqqqqpgqe6ervcr3gcnyhzqnctg0gc0qdsenl0a2rruqq3zqdx" price_aggregator_address = "erd1qqqqqqqqqqqqqpgq4sshr5wx4ch5gd8847dsavahytt732kut7as6z3mv6" -header_verifier_address = "erd1qqqqqqqqqqqqqpgq3p9nnjjz4v6q3pp2gmlye955zzwmh6utrruqpa2h8j" -testing_sc_address = "erd1qqqqqqqqqqqqqpgqj6jmt3sdryetqsft7k8xydjmklc37tuvrruqerhnan" +header_verifier_address = "erd1qqqqqqqqqqqqqpgq65rle2cmk9y5jy46n7ujl7nx56l4n5fyrruqfxkeka" +testing_sc_address = "erd1qqqqqqqqqqqqqpgq8hagwha7ld9cfzvvjwqh98hzn8aj23s5rruqtf580k" From fc2071def9f6df66d77bd7ab17e12ac2c55e2216 Mon Sep 17 00:00:00 2001 From: Andrei Baltariu Date: Tue, 12 Nov 2024 11:18:49 +0200 Subject: [PATCH 517/523] Fixed failing test Signed-off-by: Andrei Baltariu --- esdt-safe/interactor/src/interactor_main.rs | 25 ++++++++++++++++----- esdt-safe/interactor/state.toml | 8 +++---- 2 files changed, 24 insertions(+), 9 deletions(-) diff --git a/esdt-safe/interactor/src/interactor_main.rs b/esdt-safe/interactor/src/interactor_main.rs index 946f944f..7ebb61d0 100644 --- a/esdt-safe/interactor/src/interactor_main.rs +++ b/esdt-safe/interactor/src/interactor_main.rs @@ -9,6 +9,7 @@ use fee_market::fee_market_proxy::{self, FeeStruct, FeeType}; use header_verifier_proxy::HeaderverifierProxy; use multiversx_sc_scenario::meta::tools::find_current_workspace; use multiversx_sc_scenario::multiversx_chain_vm::crypto_functions::{sha256, SHA256_RESULT_LEN}; +use multiversx_sc_scenario::scenario_model::TxResponseStatus; use multiversx_sc_snippets::imports::*; use multiversx_sc_snippets::sdk::{self}; use proxies::*; @@ -553,7 +554,11 @@ impl ContractInteract { println!("Result: {response:?}"); } - async fn execute_operations(&mut self, operation: &Operation) { + async fn execute_operations( + &mut self, + operation: &Operation, + expect_error: Option, + ) { let hash_of_hashes = sha256(&self.get_operation_hash(operation)); let response = self @@ -564,11 +569,13 @@ impl ContractInteract { .gas(70_000_000u64) .typed(proxy::EsdtSafeProxy) .execute_operations(&hash_of_hashes, operation) - .returns(ReturnsResultUnmanaged) + .returns(ReturnsHandledOrError::new().returns(ReturnsResultUnmanaged)) .run() .await; - println!("Result: {response:?}"); + if let Err(err) = response { + assert!(err == expect_error.unwrap()); + } } async fn execute_operations_with_error(&mut self, error_msg: ExpectError<'_>) { @@ -1055,7 +1062,7 @@ impl ContractInteract { #[tokio::test] async fn test_deploy_sov() { let mut interact = ContractInteract::new().await; - interact.deploy(true).await; + interact.deploy(false).await; interact.deploy_fee_market().await; interact.set_fee_market_address().await; interact.remove_fee().await; @@ -1068,5 +1075,13 @@ async fn test_deploy_sov() { let operation = interact.setup_operation(true).await; interact.register_operations(&operation).await; - interact.execute_operations(&operation).await; + interact + .execute_operations( + &operation, + Some(TxResponseStatus::new( + ReturnCode::UserError, + "Value should be greater than 0", + )), + ) + .await; } diff --git a/esdt-safe/interactor/state.toml b/esdt-safe/interactor/state.toml index 209845e0..203020a1 100644 --- a/esdt-safe/interactor/state.toml +++ b/esdt-safe/interactor/state.toml @@ -1,5 +1,5 @@ -contract_address = "erd1qqqqqqqqqqqqqpgqe9r8mmsyv53lzcpqczax3w6mkghfj4gjrruql6mjek" -fee_market_address = "erd1qqqqqqqqqqqqqpgqe6ervcr3gcnyhzqnctg0gc0qdsenl0a2rruqq3zqdx" +contract_address = "erd1qqqqqqqqqqqqqpgqx6td5ezm7f2kynjsdg9u54lwwyhr0e8srruqazhkq2" +fee_market_address = "erd1qqqqqqqqqqqqqpgqqa6f8u9mzqwft2v9lgwhyjfehuhmylegrruq8mrtuw" price_aggregator_address = "erd1qqqqqqqqqqqqqpgq4sshr5wx4ch5gd8847dsavahytt732kut7as6z3mv6" -header_verifier_address = "erd1qqqqqqqqqqqqqpgq65rle2cmk9y5jy46n7ujl7nx56l4n5fyrruqfxkeka" -testing_sc_address = "erd1qqqqqqqqqqqqqpgq8hagwha7ld9cfzvvjwqh98hzn8aj23s5rruqtf580k" +header_verifier_address = "erd1qqqqqqqqqqqqqpgqqyhlhxwke87nwyvxafg5r6q9wfgyh2chrruq7qjcnj" +testing_sc_address = "erd1qqqqqqqqqqqqqpgqmsd3tr2e3t863dp8kc4y9sdu0fdfzcc0rruq872jth" From 8fb1762e9bcfeeb3d4d56df111822d10e7e2cf05 Mon Sep 17 00:00:00 2001 From: Andrei Baltariu Date: Tue, 12 Nov 2024 11:37:26 +0200 Subject: [PATCH 518/523] Removed mandos test Signed-off-by: Andrei Baltariu --- .../interactor/interactor_trace.scen.json | 235 ------------------ esdt-safe/interactor/src/interactor_main.rs | 1 + .../tests/esdt_safe_sc_scenario_rs_test.rs | 16 -- 3 files changed, 1 insertion(+), 251 deletions(-) delete mode 100644 esdt-safe/interactor/interactor_trace.scen.json delete mode 100644 esdt-safe/tests/esdt_safe_sc_scenario_rs_test.rs diff --git a/esdt-safe/interactor/interactor_trace.scen.json b/esdt-safe/interactor/interactor_trace.scen.json deleted file mode 100644 index d35adcfb..00000000 --- a/esdt-safe/interactor/interactor_trace.scen.json +++ /dev/null @@ -1,235 +0,0 @@ -{ - "steps": [ - { - "step": "setState", - "newAddresses": [ - { - "creatorAddress": "0x8049d639e5a6980d1cd2392abcce41029cda74a1563523a202f09641cc2618f8", - "creatorNonce": "2091", - "newAddress": "bech32:erd1qqqqqqqqqqqqqpgqfaqhhqwn5en78zpxvhxtr0er832d75xzrruqmds7jw" - } - ] - }, - { - "step": "scDeploy", - "id": "", - "tx": { - "from": "0x8049d639e5a6980d1cd2392abcce41029cda74a1563523a202f09641cc2618f8", - "contractCode": "mxsc:/../output/esdt-safe.mxsc.json", - "arguments": [ - "0x" - ], - "gasLimit": "110000000" - }, - "expect": { - "out": [], - "status": "0" - } - }, - { - "step": "setState", - "newAddresses": [ - { - "creatorAddress": "0x8049d639e5a6980d1cd2392abcce41029cda74a1563523a202f09641cc2618f8", - "creatorNonce": "2092", - "newAddress": "bech32:erd1qqqqqqqqqqqqqpgqrm67grf92zrvwjedw6v3gs00yfw0zgfxrruqqsr7v2" - } - ] - }, - { - "step": "scDeploy", - "id": "", - "tx": { - "from": "0x8049d639e5a6980d1cd2392abcce41029cda74a1563523a202f09641cc2618f8", - "contractCode": "mxsc:/../../fee-market/output/fee-market.mxsc.json", - "arguments": [ - "0x000000000000000005004f417b81d3a667e3882665ccb1bf233c54df50c218f8", - "0x010000000a534f562d313031323532010000000a534f562d313031323532000000010a00000000" - ], - "gasLimit": "100000000" - }, - "expect": { - "out": [], - "status": "0" - } - }, - { - "step": "scCall", - "id": "", - "tx": { - "from": "0x8049d639e5a6980d1cd2392abcce41029cda74a1563523a202f09641cc2618f8", - "to": "bech32:erd1qqqqqqqqqqqqqpgqfaqhhqwn5en78zpxvhxtr0er832d75xzrruqmds7jw", - "function": "setFeeMarketAddress", - "arguments": [ - "0x000000000000000005001ef5e40d255086c74b2d76991441ef225cf1212618f8" - ], - "gasLimit": "30000000" - }, - "expect": { - "out": [], - "status": "0" - } - }, - { - "step": "scCall", - "id": "", - "tx": { - "from": "0x8049d639e5a6980d1cd2392abcce41029cda74a1563523a202f09641cc2618f8", - "to": "0x000000000000000005001ef5e40d255086c74b2d76991441ef225cf1212618f8", - "function": "removeFee", - "arguments": [ - "0x534f562d313031323532" - ], - "gasLimit": "30000000" - }, - "expect": { - "out": [], - "status": "0" - } - }, - { - "step": "setState", - "newAddresses": [ - { - "creatorAddress": "0x8049d639e5a6980d1cd2392abcce41029cda74a1563523a202f09641cc2618f8", - "creatorNonce": "2095", - "newAddress": "bech32:erd1qqqqqqqqqqqqqpgq3p9nnjjz4v6q3pp2gmlye955zzwmh6utrruqpa2h8j" - } - ] - }, - { - "step": "scDeploy", - "id": "", - "tx": { - "from": "0x8049d639e5a6980d1cd2392abcce41029cda74a1563523a202f09641cc2618f8", - "contractCode": "mxsc:/../../header-verifier/output/header-verifier.mxsc.json", - "arguments": [], - "gasLimit": "100000000" - }, - "expect": { - "out": [], - "status": "0" - } - }, - { - "step": "scCall", - "id": "", - "tx": { - "from": "0x8049d639e5a6980d1cd2392abcce41029cda74a1563523a202f09641cc2618f8", - "to": "bech32:erd1qqqqqqqqqqqqqpgqfaqhhqwn5en78zpxvhxtr0er832d75xzrruqmds7jw", - "function": "setHeaderVerifierAddress", - "arguments": [ - "0x00000000000000000500884b39ca42ab3408842a46fe4c9694109dbbeb8b18f8" - ], - "gasLimit": "30000000" - }, - "expect": { - "out": [], - "status": "0" - } - }, - { - "step": "scCall", - "id": "", - "tx": { - "from": "0x8049d639e5a6980d1cd2392abcce41029cda74a1563523a202f09641cc2618f8", - "to": "bech32:erd1qqqqqqqqqqqqqpgqfaqhhqwn5en78zpxvhxtr0er832d75xzrruqmds7jw", - "function": "unpause", - "arguments": [], - "gasLimit": "30000000" - }, - "expect": { - "out": [], - "status": "0" - } - }, - { - "step": "scCall", - "id": "", - "tx": { - "from": "0x8049d639e5a6980d1cd2392abcce41029cda74a1563523a202f09641cc2618f8", - "to": "0x00000000000000000500884b39ca42ab3408842a46fe4c9694109dbbeb8b18f8", - "function": "setEsdtSafeAddress", - "arguments": [ - "0x000000000000000005004f417b81d3a667e3882665ccb1bf233c54df50c218f8" - ], - "gasLimit": "30000000" - }, - "expect": { - "out": [], - "status": "0" - } - }, - { - "step": "setState", - "newAddresses": [ - { - "creatorAddress": "0x8049d639e5a6980d1cd2392abcce41029cda74a1563523a202f09641cc2618f8", - "creatorNonce": "2099", - "newAddress": "bech32:erd1qqqqqqqqqqqqqpgqj6jmt3sdryetqsft7k8xydjmklc37tuvrruqerhnan" - } - ] - }, - { - "step": "scDeploy", - "id": "", - "tx": { - "from": "0x8049d639e5a6980d1cd2392abcce41029cda74a1563523a202f09641cc2618f8", - "contractCode": "mxsc:/../../testing-sc/output/testing-sc.mxsc.json", - "arguments": [], - "gasLimit": "100000000" - }, - "expect": { - "out": [], - "status": "0" - } - }, - { - "step": "setState", - "newTokenIdentifiers": [ - "TEST-38d5c5" - ] - }, - { - "step": "scCall", - "id": "", - "tx": { - "from": "0x8049d639e5a6980d1cd2392abcce41029cda74a1563523a202f09641cc2618f8", - "to": "bech32:erd1qqqqqqqqqqqqqpgqfaqhhqwn5en78zpxvhxtr0er832d75xzrruqmds7jw", - "egldValue": "50000000000000000", - "function": "registerToken", - "arguments": [ - "0x782d534f562d313031323532", - "0x", - "0x5445534454", - "0x54455354", - "0x12" - ], - "gasLimit": "90000000" - }, - "expect": { - "out": [], - "status": "0" - } - }, - { - "step": "scCall", - "id": "", - "tx": { - "from": "0x8049d639e5a6980d1cd2392abcce41029cda74a1563523a202f09641cc2618f8", - "to": "0x00000000000000000500884b39ca42ab3408842a46fe4c9694109dbbeb8b18f8", - "function": "registerBridgeOps", - "arguments": [ - "0x000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", - "0xd5db074bcabf4dc375352d252854e2d049c385b6f4da5acd7b0e3f0117184870", - "0x73db32383e56f1f010809c7d644b92f835b02bafed76e53a571aaf79d96c6653" - ], - "gasLimit": "5,000,000" - }, - "expect": { - "out": [], - "status": "0" - } - } - ] -} diff --git a/esdt-safe/interactor/src/interactor_main.rs b/esdt-safe/interactor/src/interactor_main.rs index 7ebb61d0..fe637ee9 100644 --- a/esdt-safe/interactor/src/interactor_main.rs +++ b/esdt-safe/interactor/src/interactor_main.rs @@ -1060,6 +1060,7 @@ impl ContractInteract { } #[tokio::test] +#[ignore] async fn test_deploy_sov() { let mut interact = ContractInteract::new().await; interact.deploy(false).await; diff --git a/esdt-safe/tests/esdt_safe_sc_scenario_rs_test.rs b/esdt-safe/tests/esdt_safe_sc_scenario_rs_test.rs deleted file mode 100644 index 634f95f7..00000000 --- a/esdt-safe/tests/esdt_safe_sc_scenario_rs_test.rs +++ /dev/null @@ -1,16 +0,0 @@ -use multiversx_sc_scenario::*; - -fn world() -> ScenarioWorld { - let mut blockchain = ScenarioWorld::new(); - - blockchain.register_contract( - "mxsc:output/esdt-safe.mxsc.json", - esdt_safe::ContractBuilder, - ); - blockchain -} - -#[test] -fn interactor_rs() { - world().run("interactor/interactor_trace.scen.json"); -} From bb2826b704cd8dd608e35c9d2c0429fea134d9c3 Mon Sep 17 00:00:00 2001 From: Andrei Baltariu Date: Tue, 12 Nov 2024 11:40:10 +0200 Subject: [PATCH 519/523] Removed go mandos test Signed-off-by: Andrei Baltariu --- esdt-safe/tests/esdt_safe_sc_scenario_go_test.rs | 10 ---------- 1 file changed, 10 deletions(-) delete mode 100644 esdt-safe/tests/esdt_safe_sc_scenario_go_test.rs diff --git a/esdt-safe/tests/esdt_safe_sc_scenario_go_test.rs b/esdt-safe/tests/esdt_safe_sc_scenario_go_test.rs deleted file mode 100644 index 4ebe9266..00000000 --- a/esdt-safe/tests/esdt_safe_sc_scenario_go_test.rs +++ /dev/null @@ -1,10 +0,0 @@ -use multiversx_sc_scenario::*; - -fn world() -> ScenarioWorld { - ScenarioWorld::vm_go() -} - -#[test] -fn interactor_go() { - world().run("interactor/interactor_trace.scen.json"); -} From 5739db69438ca28f31209bb1bd360983fc67157b Mon Sep 17 00:00:00 2001 From: Andrei Baltariu Date: Tue, 12 Nov 2024 11:42:56 +0200 Subject: [PATCH 520/523] Removed contract codes from the common folder Signed-off-by: Andrei Baltariu --- .../contract-codes/fee-market.mxsc.json | 354 ------------------ .../contract-codes/header-verifier.mxsc.json | 160 -------- 2 files changed, 514 deletions(-) delete mode 100644 esdt-safe/interactor/contract-codes/fee-market.mxsc.json delete mode 100644 esdt-safe/interactor/contract-codes/header-verifier.mxsc.json diff --git a/esdt-safe/interactor/contract-codes/fee-market.mxsc.json b/esdt-safe/interactor/contract-codes/fee-market.mxsc.json deleted file mode 100644 index 80a31224..00000000 --- a/esdt-safe/interactor/contract-codes/fee-market.mxsc.json +++ /dev/null @@ -1,354 +0,0 @@ -{ - "buildInfo": { - "rustc": { - "version": "1.81.0", - "commitHash": "eeb90cda1969383f56a2637cbd3037bdf598841c", - "commitDate": "2024-09-04", - "channel": "Stable", - "short": "rustc 1.81.0 (eeb90cda1 2024-09-04)" - }, - "contractCrate": { - "name": "fee-market", - "version": "0.0.0" - }, - "framework": { - "name": "multiversx-sc", - "version": "0.53.2" - } - }, - "abi": { - "name": "FeeMarket", - "constructor": { - "inputs": [ - { - "name": "esdt_safe_address", - "type": "Address" - }, - { - "name": "fee", - "type": "Option" - } - ], - "outputs": [] - }, - "upgradeConstructor": { - "inputs": [], - "outputs": [] - }, - "endpoints": [ - { - "name": "setPriceAggregatorAddress", - "mutability": "mutable", - "inputs": [ - { - "name": "price_aggregator_address", - "type": "Address" - } - ], - "outputs": [] - }, - { - "name": "addFee", - "onlyOwner": true, - "mutability": "mutable", - "inputs": [ - { - "name": "fee_struct", - "type": "FeeStruct" - } - ], - "outputs": [] - }, - { - "name": "removeFee", - "onlyOwner": true, - "mutability": "mutable", - "inputs": [ - { - "name": "base_token", - "type": "TokenIdentifier" - } - ], - "outputs": [] - }, - { - "name": "getTokenFee", - "mutability": "readonly", - "inputs": [ - { - "name": "token_id", - "type": "TokenIdentifier" - } - ], - "outputs": [ - { - "type": "FeeType" - } - ] - }, - { - "name": "addUsersToWhitelist", - "onlyOwner": true, - "mutability": "mutable", - "inputs": [ - { - "name": "users", - "type": "variadic
", - "multi_arg": true - } - ], - "outputs": [] - }, - { - "name": "removeUsersFromWhitelist", - "onlyOwner": true, - "mutability": "mutable", - "inputs": [ - { - "name": "users", - "type": "variadic
", - "multi_arg": true - } - ], - "outputs": [] - }, - { - "docs": [ - "Percentages have to be between 0 and 10_000, and must all add up to 100% (i.e. 10_000)" - ], - "name": "distributeFees", - "onlyOwner": true, - "mutability": "mutable", - "inputs": [ - { - "name": "address_percentage_pairs", - "type": "variadic>", - "multi_arg": true - } - ], - "outputs": [] - }, - { - "name": "subtractFee", - "mutability": "mutable", - "payableInTokens": [ - "*" - ], - "inputs": [ - { - "name": "original_caller", - "type": "Address" - }, - { - "name": "total_transfers", - "type": "u32" - }, - { - "name": "opt_gas_limit", - "type": "optional", - "multi_arg": true - } - ], - "outputs": [ - { - "type": "FinalPayment" - } - ] - }, - { - "name": "getUsersWhitelist", - "mutability": "readonly", - "inputs": [], - "outputs": [ - { - "type": "variadic
", - "multi_result": true - } - ] - }, - { - "name": "setMinValidSigners", - "onlyOwner": true, - "mutability": "mutable", - "inputs": [ - { - "name": "new_value", - "type": "u32" - } - ], - "outputs": [] - }, - { - "name": "addSigners", - "onlyOwner": true, - "mutability": "mutable", - "inputs": [ - { - "name": "signers", - "type": "variadic
", - "multi_arg": true - } - ], - "outputs": [] - }, - { - "name": "removeSigners", - "onlyOwner": true, - "mutability": "mutable", - "inputs": [ - { - "name": "signers", - "type": "variadic
", - "multi_arg": true - } - ], - "outputs": [] - } - ], - "esdtAttributes": [], - "hasCallback": false, - "types": { - "EsdtTokenPayment": { - "type": "struct", - "fields": [ - { - "name": "token_identifier", - "type": "TokenIdentifier" - }, - { - "name": "token_nonce", - "type": "u64" - }, - { - "name": "amount", - "type": "BigUint" - } - ] - }, - "FeeStruct": { - "type": "struct", - "fields": [ - { - "name": "base_token", - "type": "TokenIdentifier" - }, - { - "name": "fee_type", - "type": "FeeType" - } - ] - }, - "FeeType": { - "type": "enum", - "variants": [ - { - "name": "None", - "discriminant": 0 - }, - { - "name": "Fixed", - "discriminant": 1, - "fields": [ - { - "name": "token", - "type": "TokenIdentifier" - }, - { - "name": "per_transfer", - "type": "BigUint" - }, - { - "name": "per_gas", - "type": "BigUint" - } - ] - }, - { - "name": "AnyToken", - "discriminant": 2, - "fields": [ - { - "name": "base_fee_token", - "type": "TokenIdentifier" - }, - { - "name": "per_transfer", - "type": "BigUint" - }, - { - "name": "per_gas", - "type": "BigUint" - } - ] - } - ] - }, - "FinalPayment": { - "type": "struct", - "fields": [ - { - "name": "fee", - "type": "EsdtTokenPayment" - }, - { - "name": "remaining_tokens", - "type": "EsdtTokenPayment" - } - ] - } - } - }, - "code": "0061736d0100000001791460027f7f0060017f017f60027f7f017f60000060017f0060037f7f7f006000017f60037f7f7f017f60047f7f7f7f017f60047f7f7f7f0060027f7e0060017f017e60057f7f7e7f7f017f60017e006000017e60067e7f7f7f7f7f017f60057f7f7f7f7f0060047f7e7f7f0060027f7f017e60037f7f7f017e02e8062503656e760e626967496e74536574496e743634000a03656e7609626967496e74416464000503656e760b7369676e616c4572726f72000003656e7609626967496e744d756c000503656e760a6d4275666665724e6577000603656e760d6d427566666572417070656e64000203656e76096d4275666665724571000203656e760d6d42756666657246696e697368000103656e76106d4275666665724765744c656e677468000103656e760d6d616e6167656443616c6c6572000403656e76136d616e616765644f776e657241646472657373000403656e76126d427566666572476574417267756d656e74000203656e76126d427566666572417070656e644279746573000703656e76126d616e616765645369676e616c4572726f72000403656e761b736d616c6c496e74476574556e7369676e6564417267756d656e74000b03656e760f6765744e756d417267756d656e7473000603656e7609626967496e74537562000503656e76226d616e616765644d756c74695472616e73666572455344544e465445786563757465000c03656e76146d427566666572436f707942797465536c696365000803656e760f6d4275666665725365744279746573000703656e761776616c6964617465546f6b656e4964656e746966696572000103656e76196d42756666657246726f6d426967496e74556e7369676e6564000203656e76176d427566666572546f426967496e74556e7369676e6564000203656e76126d42756666657253746f726167654c6f6164000203656e76136d42756666657253746f7261676553746f7265000203656e7609626967496e74436d70000203656e760f6d4275666665724765744279746573000203656e760f6973536d617274436f6e7472616374000103656e760e636865636b4e6f5061796d656e74000303656e7616736d616c6c496e7446696e697368556e7369676e6564000d03656e760a626967496e7454446976000503656e761c6d616e616765644765744d756c74694553445443616c6c56616c7565000403656e760a6765744761734c656674000e03656e761b6d616e61676564457865637574654f6e44657374436f6e74657874000f03656e760f636c65616e52657475726e44617461000303656e760a626967496e745369676e000103656e76136d42756666657247657442797465536c6963650008037a790106000200010001010904040600010a06000000000907090707010000020204000102020101060307070600020404040305010905000409051000010108080002080301000004000201010011050001020205020002020012050007000100130104040604040106040303030303030303030303030303030305030100030616037f01418080080b7f0041a5d6080b7f0041b0d6080b07a50212066d656d6f7279020004696e6974008e010775706772616465008f0119736574507269636541676772656761746f7241646472657373009001066164644665650091010972656d6f76654665650092010b676574546f6b656e466565009301136164645573657273546f57686974656c6973740094011872656d6f7665557365727346726f6d57686974656c6973740095010e64697374726962757465466565730096010b737562747261637446656500970111676574557365727357686974656c697374009801127365744d696e56616c69645369676e6572730099010a6164645369676e657273009a010d72656d6f76655369676e657273009b010863616c6c4261636b009c010a5f5f646174615f656e6403010b5f5f686561705f6261736503020afe4a791601017f1026220142001000200120012000100120010b1901017f41e4870841e4870828020041016b220036020020000bdf0102047f017e0240024020012802182204200128022010280440200128022421024172200135022c100020022002417210032001290300500440200129030822064200530d0220012802282103417220061000200320034172100320022002200310010b417f2002200128021c22031019220541004720054100481b41ff01714101460d022003200210292004102a21032000200236020c2000200336020820004200370300200041186a200141186a290300370300200020012903103703100f0b41b18108411e102b000b41ba840841111002000b41cf8108411a102b000b0b0020002001100641004a0b0a0020002000200110560b0f01017f10042201200010051a20010b0900200020011002000b3c01017f230041106b220124002000102d450440419582084117102b000b200141086a200041002000100841076b102e200128020c200141106a24000b0900200010144100470b1f0020012002200310042201101221022000200136020420002002453602000bbe0101047f2000280210220210300240024002400240024002402000280200220141016b0e020201000b41c382084110102b000b200028020421030c010b2002200028020422031028450d010b20031030103141011032200041106a10332104200028020c210220002802082100024002400240200141016b0e020102000b2004420010340f0b41011035220110360c020b41021035220110360c010b41d38208410b102b000b2003200110372000200110382002200110382004200110390b13002000102d45044041c786084110102b000b0b0a0041898608410e10430b3701017f230041106b220224002002420037030820022001ad4101200241086a10712000200228020020022802041072200241106a24000b1901017f4197860841081043210120002802002001107c20010b3601017f230041106b2202240020024200370308200220014100200241086a10712000200228020020022802041072200241106a24000b08004101410010430b2601017f230041106b22022400200220003a000f20012002410f6a4101107e200241106a24000b4f01027f230041106b22022400200220001008220341187420034180fe03714108747220034108764180fe03712003411876727236020c20012002410c6a4104107e200120001064200241106a24000b0a002000104a200110370b09002000200110181a0ba40101027f0240024002400240200120022003103b41ff01710e03010203000b2002200341808008410d103c000b200041003602000f0b200120022003103d2104200120022003103e21052000200120022003103e36020c2000200536020820002004360204200041013602000f0b200120022003103d2104200120022003103e21052000200120022003103e36020c2000200536020820002004360204200041023602000b2f01017f230041106b22032400200341003a000f20002003410f6a410120012002105e20032d000f200341106a24000b2e01017f419a830841171043220420002001100c1a200441b183084103100c1a200420022003100c1a2004100d000b890101037f230041106b220324002003410036020c20002003410c6a410420012002105e2003200028020820002802002205200328020c220441187420044180fe03714108747220044108764180fe0371200441187672722204102e200328020041014704402001200241ab8408410f103c000b20032802042000200420056a360200200341106a24000b0c00200020012002103d10490b0f01017f102622012000ad100020010b3002017f017e2001280208102a2102200129030021032000200128020c102536020c20002003370300200020023602080b4301017f2001280204220220012802084b047f4100052001200241016a3602042001280200280200200210421068210141010b210220002001360204200020023602000b5401017f230041106b220224002000102a220041eb84084105100c1a2002200141187420014180fe03714108747220014108764180fe03712001411876727236020c20002002410c6a105f200241106a240020000b1101017f102622022000200110131a20020b0700200010071a0b3101017f20011046220210082101200041003a00102000200136020c2000200236020820002001360204200041003602000b0d00200010262200100b1a20000b0a0020002001104810490b850101037f230041106b220224002002410036020c20002002410c6a41042001105c2002200028020820002802002204200228020c220341187420034180fe03714108747220034108764180fe0371200341187672722203102e20022802004101470440200141ab8408410f105d000b20022802042000200320046a360200200241106a24000b0d0020001026220010161a20000b0f01017f10262201200010151a20010b0c01017f10262200100920000b1d01017f10262200100a2000104b102804400f0b419e870841241002000b2f01017f200028020022034180d6082802004e04402001200241b483084111103c000b2000200341016a36020020030b2e01017f104f2103034020002802004180d6082802004e4504402003200020012002104d104610500c010b0b20030b1101017f102622004101410010131a20000b4601017f230041106b220224002002200141187420014180fe03714108747220014108764180fe03712001411876727236020c20002002410c6a4104100c1a200241106a24000b2101017f410010462202100841204704402000200141ae85084110103c000b20020b190020004180d6082802004e04400f0b41c5830841121002000b1400100f20004604400f0b41d7830841191002000b190020004180d6082802004c04400f0b41b4830841111002000b0b004180d608100f3602000b1f0020002001200210102000105741ff017104400f0b41f0830841301002000b1500410241012000102322001b4100200041004e1b0bf30102017e037f230041106b2206240020002903002104200028020c2000280208104f2107280200102a2100280200102521052006200442388620044280fe0383422886842004428080fc0783421886200442808080f80f834208868484200442088842808080f80f832004421888428080fc07838420044228884280fe038320044238888484843702042006200041187420004180fe03714108747220004108764180fe0371200041187672723602002006200541187420054180fe03714108747220054108764180fe03712005411876727236020c200720064110100c1a2001200742002002200310111a200641106a24000b2c01017f2001280204104f1a2002102a1050200041086a200141086a280200360200200020012902003702000b5401037f230041206b22022400200241086a105b200228020c2103200228020821042002200141086a36021820022001410c6a36021c20022001290300370310200241106a2000200420031058200241206a24000b1601017f104f21012000104f360204200020013602000b2d00200041086a20002802002001200210660440200341ab8408410f105d000b2000200028020020026a3602000b2c01017f41f68408411b10432203200010051a200341b183084103100c1a200320012002100c1a2003100d000b2f00200041086a200028020020012002106604402003200441ab8408410f103c000b2000200028020020026a3602000b0b00200020014104100c1a0b0b002000106141ff0171450b09002000105741016b0b0c00200020012002200310630b0f00200020012003200210244100470b09002000200110051a0b1001017f1026220220002001100320020bc60301067f02400240027f024020002d000845044020002802002204100822054190ce004b0d0141fcd5082d00000d0141f8d508200536020041fcd50841013a00002004410041e88708200510621a200041013a00080b4101200120036a220041f8d5082802004b0d011a20002001490d0220004190ce004b0d03200141e887086a2100200341104f04402002410020026b41037122046a210520040440200021010340200220012d00003a0000200141016a2101200241016a22022005490d000b0b2005200320046b2203417c7122066a21020240200020046a22044103710440200641004c0d012004410374220141187121072004417c71220841046a2100410020016b4118712109200828020021010340200520012007762000280200220120097472360200200041046a2100200541046a22052002490d000b0c010b200641004c0d0020042100034020052000280200360200200041046a2100200541046a22052002490d000b0b20034103712103200420066a21000b20030440200220036a21010340200220002d00003a0000200041016a2100200241016a22022001490d000b0b41000f0b200041003a0008200420012002200310620b0f0b109d01000b1067000b0600109d01000b0d0020001026220010171a20000b08002000200110390b0b0020002001104a10181a0b1200416c4101410010131a2000416c10181a0b090020002001ad10340b0a00200020011042106e0b1f01017f20001068220110084120470440200041ae85084110105d000b20010b2401017e20002000107d22014280808080105a04402000418d8008410e105d000b2001a70b08002000200110690b900101037f200320013c00072003410036000020032001420888a722063a000620032001421088a722053a000520032001421888a722043a000420004108200420057241ff017145220541044105200441ff01711b6a41002005200641ff01711b22046a200441002001501b6a2204200320044107716a2c00004100482002716b22026b3602042000200220036a3602000b0d00200020012002104310181a0b860201057f230041206b220224002001416710171a02400240416710084504400c010b20011068220510082103200241003a001820022003360214200220053602102002200336020c20024100360208200241003a001f200241086a2002411f6a41012001105c024002400240024020022d001f22040e03030201000b200141808008410d105d000b410221040b200241086a22032001104821052003200110472103200241086a2001104721060b200228020c2002280208470d0120022d0018450d0041f8d508410036020041fcd50841003a00000b2000200636020c200020033602082000200536020420002004360200200241206a24000f0b2001418d8008410e105d000b08002000106810490ba30101067f02402000280208220520011076220204400240200220002802042204106f22034d044020022003460d012004106f2003490d03200028020022072003106d21062004106f2002490d03200720021042200610690c010b0c020b2004106f2003490d01200028020020031042106b2004200341016b106c2002200347044020052006200210770b200520011078106b0b20024100470f0b41c2870841121002000b0a00200020011078106f0b0d002000200110782002ad10340b19002000102a220041f084084106100c1a20002001106420000b4001037f200028020822032001107a45044020002802042202106f21042000280200200441016a220010422001106920022000106c200320012002106f10770b0b0b002000200110764100470b19002000102a220041f084084106100c1a20012000107c20000b4d01027f230041106b22022400200220001008220341187420034180fe03714108747220034108764180fe03712003411876727236020c20012002410c6a105f200120001064200241106a24000ba30102017e027f230041106b22032400200342003703082000106822041008220041094f04402001418d8008410e105d000b20044100200320006b41106a200010631a20032903082102200341106a2400200242388620024280fe0383422886842002428080fc0783421886200242808080f80f834208868484200242088842808080f80f832002421888428080fc07838420024228884280fe038320024238888484840b0b00200020012002100c1a0b900102017e017f230041106b2203240020002802082001103720032000290300220242388620024280fe0383422886842002428080fc0783421886200242808080f80f834208868484200242088842808080f80f832002421888428080fc07838420024228884280fe038320024238888484843703082001200341086a4108107e200028020c20011038200341106a24000b7b01027f230041106b22032400200028020821042003410036020c200028020020044102742003410c6a41041062450440200328020c21012000200441016a360208200141187420014180fe03714108747220014108764180fe037120014118767272102a200341106a24000f0b2001200241b483084111103c000b2e01017f200128020820012802044f047f4100052001108201210141010b210220002001360204200020023602000b2a00200041be85084108108001102a22001008412047044041be8508410841ae85084110103c000b20000b2e01027f2001102a21022001102a220341aa85084104100c1a2000200336020420002001360200200020023602080ba10102017e027f230041106b220424002004420037030820001008220541094f044020012002418d8008410e103c000b20004100200420056b41106a200510631a20042903082103200441106a2400200342388620034280fe0383422886842003428080fc0783421886200342808080f80f834208868484200342088842808080f80f832003421888428080fc07838420034228884280fe038320034238888484840b0d002000106141ff01714101460b0f00200041f08508410a10431083010bbc0101077f230041206b2201240002400240200010084120460440200141186a4200370300200141106a4200370300200141086a420037030020014200370300200041002001412010631a200121024120210541cb840821030240034020022d0000220620032d00002207460440200241016a2102200341016a2103200541016b22050d010c020b0b200620076b21040b2004450d010b20004185d608101a1a4185d608101b41004a0d010b41b586084112102b000b200141206a24000b0a0041d78608410f10430b3601037f41e68608410d10432201102a21022001102a220341aa85084104100c1a2000200336020420002001360200200020023602080b0f00200041f38608410e10431083010b1901017f4181870841071043210120002802002001107c20010b0a0041888708411610430b1000200041a08408410b108001102a1a0bab0301067f230041306b22012400101c41021053418482084111105121042001411c6a2103230041406a22002400200041046a41011045410321020240024020002802082000280204470440024002400240200041046a418182084103103b41ff01710e020201000b41818208410341808008410d103c000b200041046a2202418182084103103d2105200041286a2002418182084103103a20002005360238200041206a200041346a2902003703002000200029022c370318200028022821020b20002802082000280204470d01200041306a200041206a290300370300200020002903183703280b20002d0014044041f8d508410036020041fcd50841003a00000b20032002360200200320002903283702042003410c6a200041306a290300370200200041406b24000c010b418182084103418d8008410e103c000b200141106a2203200141286a220229020037030020012001290220370308200128021c2100200410870110880120041070024020004103470440200220032903003702002001200036021c200120012903083702202001411c6a102f0c010b1031410010320b200141306a24000b0800101c410010530b1e01017f101c4101105341e98108411810512200108701108c01200010700bd30101057f230041206b22032400101c104c410110532003410c6a2101230041406a220024002000411c6a220241001045200241de8208410a103d2104200041306a200241de8208410a103a02402000280220200028021c460440200041106a2202200041386a2902003703002000200029023037030820002d002c044041f8d508410036020041fcd50841003a00000b2001200029030837020020012004360210200141086a2002290300370200200041406b24000c010b41de8208410a418d8008410e103c000b2001102f200341206a24000b3401017f230041106b22002400101c104c4101105320004100104636020c2000410c6a1033106b103141001032200041106a24000ba00101027f230041206b22002400101c4101105320004100104636020c200041106a2000410c6a103310730240024002400240200028021041016b0e020102000b4200101d0c020b4101103522011036200028021420011037200028021820011038200028021c20011038200110440c010b4102103522011036200028021420011037200028021820011038200028021c20011038200110440b200041206a24000b840101037f230041206b22002400101c104c10554100105420004100360214200041146a41fd80084105104e210120002802141052200041086a108a012001100821022000410036021c200020024102763602182000200136021403402000200041146a10810120002802000440200041086a200028020410790c010b0b200041206a24000b900101037f230041206b22002400101c104c10554100105420004100360214200041146a41fd80084105104e210120002802141052200041086a108a012001100821022000410036021c2000200241027636021820002001360214024003402000200041146a1081012000280200450d01200041086a200028020410750d000b419f86084116102b000b200041206a24000bc806020d7f027e230041e0006b22002400101c104c10554100105420004100360250200041d0006a41e580084118104e2102200028025010524190ce00103f2108104f210520021008210320004100360258200020034102762203360254200020023602500240034020012003490440200041d0006a22021082012101200241be8508410810800141be85084108108401220e4280808080105a0d022000200141187420014180fe03714108747220014108764180fe0371200141187672723602402000200ea7220141187420014180fe03714108747220014108764180fe0371200141187672723602442005200041406b4108100c1a200d200e7c210d20002802542103200028025821010c010b0b200d4290ce00510440200041246a220110890120002000280228106f3602382000410136023420002001360230200041cc006a2109200041c8006a210a03400240200041186a200041306a10412000280218450440200041406b220110890120002000280244106f36025820004101360254200020013602500340200041086a200041d0006a1041200028020804402000280248200028020c107b106b0c0105410021032000280244106f21024101210103402003200120024b720d04200028024020011042106b200120024f2103200120012002496a21010c000b000b000b000b2000200028021c220b36023c2000413c6a108b011074220610600d014100210120061025210720051008210c0340200c200141086a22024904402000413c6a108b012007106a0c030b2000420037035020052001200041d0006a410810631a2000280250210320062000280254220141187420014180fe03714108747220014108764180fe037120014118767272103f106521011026220420012008101e200221012004108501450d00200720041029200b102a21022000200436024c2000200236024820004200370340200041106a105b20002802142102200028021021042000200a3602582000200936025c20002000290340370350200041d0006a200341187420034180fe03714108747220034108764180fe0371200341187672722004200210580c000b000b0b200028024442001034200041e0006a24000f0b418281084116102b000b41be85084108418d8008410e103c000bc00d020c7f037e230041d0016b2200240010554102105441d68008410f105121074101100e220d4280808080105a044041c78008410f418d8008410e103c000b200da7210820004102360260200041e0006a22012802004180d6082802004e047e420105200141ba8008410d104d100e210e42000b210d2000200e3703082000200d3703002000290308210e2000290300210d200028026010520240024002400240104b108801106e10280440104b210b416b210602404184d6082d000022010440416b41ffffffff0720011b21060c010b4184d60841013a0000416b101f0b0240200610084170714110460440200610082105200041e8006a2104410121090340200241106a220120054b0d02200442003703002000420037036020062002200041e0006a411010631a200904402000290264220c423886200c4280fe038342288684200c428080fc0783421886200c42808080f80f834208868484200c42088842808080f80f83200c421888428080fc078384200c4228884280fe0383200c423888848484210c2000280260220241187420024180fe03714108747220024108764180fe037120024118767272210a200028026c220241187420024180fe03714108747220024108764180fe037120024118767272210341002109200121020c010b0b1067000b41f8820841221002000b2000200336021c2000200a3602182000200c3703100240103122012001107d220c4201580440200ca741016b0d040c010b200141c685084112105d000b200041e0006a108a0120002802682007107a0d02200041c8006a2201200041186a29030037030020002000290310370340200041d0006a2001103310730240024002400240200028025041016b0e020102000b419881084119102b000b200041f8006a2001290300370300200020002903403703702000200836028c012000200028025c3602880120002000290254370380012000200e3703682000200d370360200041206a200041e0006a10270c010b2000290258210c20002802542202102a2105200041f0006a2201200041406b10402000200836028c012000200c3702840120002005360280012000200e3703682000200d37036020022000280248102845044020004190016a20011040108c01106e21042000280278102c21032005102c2102200441feffffff07460d0341ac82084117104321012000104f3602a401200020013602a001200020043602a801200041206a2201200041a0016a20031059200041c4016a2001200210591020210c20002802c801210320002802c401210220002802cc012101417642001000200c42a08d067d200c200c42a08d06561b20014176200220031026220210211a1022200210082101200041003602a801200020023602a001200020014102763602a4010240200141044f0440200041a0016a41a08408410b10800141a08408410b1084014280808080105a0d08200041a0016a2201108d012001108d01200141a08408410b10800141a08408410b1084011a200141a08408410b10800110492102200041a0016a41a08408410b10800141a08408410b108401428002540d010c080b41d8850841181002000b2005102a210120002002102536027c2000200136027820004200370370200041a0016a200041e0006a102720002802bc01106045044020002802ac01200028029c0122031065220120012002101e2003200320011056200041286a200041a8016a2903003703002000200336023c20004200370330200020002903a00137032020002000280298013602380c020b200041386a200041b8016a290300370300200041306a200041b0016a290300370300200041286a200041a8016a290300370300200020002903a0013703200c010b200041206a200041e0006a10270b200041e0006a1089012000280228102a2104200028026822022004107b106f45044020002802642203106f21012000280260200141016a22011042200410181a20032001106c2003106f210120022004107b2001ad10340b200041286a108b012201107422022002200028022c100120012002106a200028023c10850104402007200041306a105a0b200041f8006a200041386a290300370300200041f0006a200041306a290300370300200041e8006a200041286a290300370300200020002903203703600c030b419b8008411f102b000b4191850841191002000b200b200041106a105a200a102a21021026220142001000200041f8006a200041186a2903003703002000200136026c2000200236026820004200370360200020002903103703700b200041e0006a10352201107f200041f0006a2001107f20011044200041d0016a24000f0b41a08408410b418d8008410e103c000b5401047f230041106b22002400101c41001053200041046a108a012000280208106f210220002802042103410121010340200120024b45044020032001106d10071a200141016a21010c010b0b200041106a24000b3f02017e017f101c104c410110534100100e22004280808080105a044041ef82084109418d8008410e103c000b2000a7210141fa8508410f10432001ad10340b870101037f230041206b22002400101c104c10554100105420004100360214200041146a41e882084107104e210120002802141052200110082102200041003602102000200241027636020c2000200136020803402000200041086a1081012000280200044020002802042101200041146a22021086012002200110790c010b0b200041206a24000b880101037f230041206b22002400101c104c10554100105420004100360214200041146a41e882084107104e210120002802141052200110082102200041003602102000200241027636020c2000200136020803402000200041086a1081012000280200044020002802042101200041146a22021086012002200110751a0c010b0b200041206a24000b0300010b0b0041d48708410e1002000b0bde070300418080080bcb04696e76616c69642076616c7565696e70757420746f6f206c6f6e674f6e6c7920455344542053616665206d61792063616c6c20746869732053436f70745f6761735f6c696d6974746f74616c5f7472616e73666572736f726967696e616c5f63616c6c6572616464726573735f70657263656e746167655f70616972737573657273496e76616c69642070657263656e746167652073756d546f6b656e206e6f7420616363657074656420617320666565496e76616c696420746f6b656e2070726f766964656420666f72206665655061796d656e7420646f6573206e6f7420636f7665722066656570726963655f61676772656761746f725f61646472657373666565657364745f736166655f61646472657373496e76616c69642045534454206964656e7469666965726c61746573745072696365466565644f7074696f6e616c496e76616c6964206665652074797065496e76616c6964206665656665655f7374727563747369676e6572736e65775f76616c7565696e636f7272656374206e756d626572206f662045534454207472616e7366657273617267756d656e74206465636f6465206572726f722028293a20746f6f2066657720617267756d656e7473746f6f206d616e7920617267756d656e747377726f6e67206e756d626572206f6620617267756d656e747363616e6e6f74207375627472616374206265636175736520726573756c7420776f756c64206265206e6567617469766573796e6320726573756c74696e70757420746f6f2073686f72746361737420746f20693634206572726f720041eb84080bf7022e6974656d2e696e64657873746f72616765206465636f6465206572726f7220286b65793a20726563697069656e742061646472657373206e6f74207365742e6c656e626164206172726179206c656e6774687661722061726773696e707574206f7574206f662072616e6765496e76616c69642061676772656761746f722076616c7565616c6c5369676e6572736d696e56616c69645369676e657273666565456e61626c6564466c6167746f6b656e4665654974656d206e6f7420666f756e6420696e206c697374496e76616c69642053432061646472657373496e76616c696420746f6b656e204944657364745361666541646472657373746f6b656e73466f7246656573757365727357686974656c69737461636346656573707269636541676772656761746f7241646472657373456e64706f696e742063616e206f6e6c792062652063616c6c6564206279206f776e6572696e646578206f7574206f662072616e676570616e6963206f636375727265640041e487080b0438ffffff", - "report": { - "imports": [ - "bigIntAdd", - "bigIntCmp", - "bigIntMul", - "bigIntSetInt64", - "bigIntSign", - "bigIntSub", - "bigIntTDiv", - "checkNoPayment", - "cleanReturnData", - "getGasLeft", - "getNumArguments", - "isSmartContract", - "mBufferAppend", - "mBufferAppendBytes", - "mBufferCopyByteSlice", - "mBufferEq", - "mBufferFinish", - "mBufferFromBigIntUnsigned", - "mBufferGetArgument", - "mBufferGetByteSlice", - "mBufferGetBytes", - "mBufferGetLength", - "mBufferNew", - "mBufferSetBytes", - "mBufferStorageLoad", - "mBufferStorageStore", - "mBufferToBigIntUnsigned", - "managedCaller", - "managedExecuteOnDestContext", - "managedGetMultiESDTCallValue", - "managedMultiTransferESDTNFTExecute", - "managedOwnerAddress", - "managedSignalError", - "signalError", - "smallIntFinishUnsigned", - "smallIntGetUnsignedArgument", - "validateTokenIdentifier" - ], - "isMemGrow": false, - "eiCheck": { - "eiVersion": "1.3", - "ok": true - }, - "codeReport": { - "path": "../output/fee-marker-full.wasm", - "size": 12049, - "hasAllocator": false, - "hasPanic": "without message" - } - } -} diff --git a/esdt-safe/interactor/contract-codes/header-verifier.mxsc.json b/esdt-safe/interactor/contract-codes/header-verifier.mxsc.json deleted file mode 100644 index f2d17ad4..00000000 --- a/esdt-safe/interactor/contract-codes/header-verifier.mxsc.json +++ /dev/null @@ -1,160 +0,0 @@ -{ - "buildInfo": { - "rustc": { - "version": "1.81.0", - "commitHash": "eeb90cda1969383f56a2637cbd3037bdf598841c", - "commitDate": "2024-09-04", - "channel": "Stable", - "short": "rustc 1.81.0 (eeb90cda1 2024-09-04)" - }, - "contractCrate": { - "name": "header-verifier", - "version": "0.0.0" - }, - "framework": { - "name": "multiversx-sc", - "version": "0.53.2" - } - }, - "abi": { - "name": "Headerverifier", - "constructor": { - "inputs": [ - { - "name": "bls_pub_keys", - "type": "variadic", - "multi_arg": true - } - ], - "outputs": [] - }, - "upgradeConstructor": { - "inputs": [], - "outputs": [] - }, - "endpoints": [ - { - "name": "registerBridgeOps", - "mutability": "mutable", - "inputs": [ - { - "name": "signature", - "type": "array48" - }, - { - "name": "bridge_operations_hash", - "type": "bytes" - }, - { - "name": "operations_hashes", - "type": "variadic", - "multi_arg": true - } - ], - "outputs": [] - }, - { - "name": "setEsdtSafeAddress", - "onlyOwner": true, - "mutability": "mutable", - "inputs": [ - { - "name": "esdt_safe_address", - "type": "Address" - } - ], - "outputs": [] - }, - { - "name": "removeExecutedHash", - "mutability": "mutable", - "inputs": [ - { - "name": "hash_of_hashes", - "type": "bytes" - }, - { - "name": "operation_hash", - "type": "bytes" - } - ], - "outputs": [] - }, - { - "name": "setMinValidSigners", - "onlyOwner": true, - "mutability": "mutable", - "inputs": [ - { - "name": "new_value", - "type": "u32" - } - ], - "outputs": [] - }, - { - "name": "addSigners", - "onlyOwner": true, - "mutability": "mutable", - "inputs": [ - { - "name": "signers", - "type": "variadic
", - "multi_arg": true - } - ], - "outputs": [] - }, - { - "name": "removeSigners", - "onlyOwner": true, - "mutability": "mutable", - "inputs": [ - { - "name": "signers", - "type": "variadic
", - "multi_arg": true - } - ], - "outputs": [] - } - ], - "esdtAttributes": [], - "hasCallback": false, - "types": {} - }, - "code": "0061736d0100000001480d60027f7f0060027f7f017f60000060017f017f60017f006000017f60037f7f7f0060047f7f7f7f017f60037f7f7f017f60047f7f7f7f0060017f017e60027f7e0060027f7f017e029c031203656e760b7369676e616c4572726f72000003656e760a6d4275666665724e6577000503656e760d6d427566666572417070656e64000103656e76096d4275666665724571000103656e76106d4275666665724765744c656e677468000303656e760d6d616e6167656443616c6c6572000403656e76136d616e616765644f776e657241646472657373000403656e76126d427566666572417070656e644279746573000803656e76126d616e616765645369676e616c4572726f72000403656e761b736d616c6c496e74476574556e7369676e6564417267756d656e74000a03656e760f6765744e756d417267756d656e7473000503656e76136d42756666657247657442797465536c696365000703656e760f6d4275666665725365744279746573000803656e76126d42756666657253746f726167654c6f6164000103656e76136d42756666657253746f7261676553746f7265000103656e76126d427566666572476574417267756d656e74000103656e760e636865636b4e6f5061796d656e74000203656e760d6d616e616765645368613235360001034544030100030005050209010305030004040402000700030000040100000b0301000907050003000106010601010106060c030300000001000504040202020202020202020205030100030616037f01418080080b7f004190d3080b7f004190d3080b07b1010c066d656d6f7279020004696e6974004c0775706772616465004d1172656769737465724272696467654f7073004e12736574457364745361666541646472657373004f1272656d6f76654578656375746564486173680050127365744d696e56616c69645369676e65727300510a6164645369676e65727300520d72656d6f76655369676e65727300530863616c6c4261636b00540a5f5f646174615f656e6403010b5f5f686561705f6261736503020aaa1f440f01017f10012201200010021a20010b0b0020002001100341004a0b3101017f20011015220210042101200041003a00102000200136020c2000200236020820002001360204200041003602000b0d00200010182200100d1a20000b0900200020011000000b0c01017f10182200100520000b1901017f41f0840841f0840828020041016b220036020020000b1d01017f10182200100620001017101304400f0b41aa840841241000000b2e01017f419e80084117101b22042000200110071a200441b58008410310071a20042002200310071a20041008000b1101017f1018220220002001100c1a20020b3b01037f101d2102200028020021010340418cd30828020020014a04402000200141016a220336020020022001101e101f200321010c010b0b20020b1101017f1018220041014100100c1a20000b0d00200010182200100f1a20000b4601017f230041106b220224002002200141187420014180fe03714108747220014108764180fe03712001411876727236020c20002002410c6a410410071a200241106a24000b19002000418cd3082802004e04400f0b41c9800841121000000b1400100a20004604400f0b41db800841191000000b19002000418cd3082802004c04400f0b41b8800841111000000b0b00418cd308100a3602000b0b0020002001410410071a0b0f002000200120032002100b4100470b09002000200110021a0b0d0020004167100d1a416710040b08002000200110290b090020002001100e1a0b1200416c41014100100c1a2000416c100e1a0b190020001012220041f48008410810071a20012000102c20000b4d01027f230041106b22022400200220001004220341187420034180fe03714108747220034108764180fe03712003411876727236020c20012002410c6a1024200120001026200241106a24000b090020002001ad102e0b890101047f230041106b22022400200220013c000f20022001421888a722033a000c20022001421088a722043a000d20022001420888a722053a000e200241003602082000200320047241ff017145220041044105200341ff01711b6a41002000200541ff01711b22006a200041002001501b6a2200200241086a6a410820006b103f200241106a24000b2401017e20002000104122014280808080105a0440200041808008410e1040000b2001a70b190020001012220041fc8008410510071a20012000103120000b4301017f230041106b220224002002200041187420004180fe03714108747220004108764180fe03712000411876727236020c20012002410c6a1024200241106a24000b2000200041868108410b200110332002103422001035200320001035200010290b17002000101222002001200210071a20032000103120000b080041014100101b0b4601017f230041106b220224002002200041187420004180fe03714108747220004108764180fe03712000411876727236020c20012002410c6a410410071a200241106a24000b130020001012220041818108410510071a20000b4001037f200028020822032001103845044020002802042202102f21042000280200200441016a220010302001102820022000102d200320012002102f10390b0b0b0020002001103d4100470b0d0020002001103a2002ad102e0b190020001012220041978108410610071a20012000102c20000b0d0020002001103c2002ad102e0b190020001012220041978108410610071a20002001102620000b0a0020002001103a102f0b0a0020002001103c102f0b0d00200020012002101b100e1a0b2c01017f419d8108411b101b2203200010021a200341b58008410310071a20032001200210071a20031008000ba30102017e027f230041106b22032400200342003703082000101522041004220041094f0440200141808008410e1040000b20044100200320006b41106a200010251a20032903082102200341106a2400200242388620024280fe0383422886842002428080fc0783421886200242808080f80f834208868484200242088842808080f80f832002421888428080fc07838420024228884280fe038320024238888484840b1f01017f20001015220110044120470440200041bc810841101040000b20010b7d01037f230041106b22012400200028020821032001410036020c200028020020034102742001410c6a41041025450440200128020c21022000200341016a360208200241187420024180fe03714108747220024108764180fe0371200241187672721012200141106a24000f0b41c18308410841b880084111101a000b4701017f0240200128020820012802044f04400c010b41012102200110431012220110044120460d0041c18308410841bc81084110101a000b20002001360204200020023602000b2f01017f200128020820012802044f047f410005200110431012210141010b210220002001360204200020023602000b2e01027f20011012210220011012220341b88108410410071a2000200336020420002001360200200020023602080b8b0201047f230041106b220424002004410036020c20002802002103024002400240027f0240024020002d001045044020002802082202100422054190ce004b0d014188d3082d00000d014184d30820053602004188d30841013a00002002410041f48408200510251a200041013a00100b200341046a22024184d3082802004d0d010c050b200041003a0010200220032004410c6a410410250d04200341046a21022004410c6a0c010b2003417b4b0d0120024190ce004b0d02200341f484086a0b200020023602002800002100200441106a2400200041187420004180fe03714108747220004108764180fe0371200041187672720f0b1055000b1055000b200141c98308410f1040000b1600200141e28308410d101b2201102c2000200110460b0a0041ef8308410f101b0b0e00200041fe83084113101b10460b3601037f41918408410a101b22011012210220011012220341b88108410410071a2000200336020420002001360200200020023602080b9c04020a7f017e230041306b2200240010101023410010222000410036021c2000411c6a101c2101200028021c102020011004210520004100360218200020054102763602142000200136021002400240024003400240200041086a200041106a10452000280208450d00200028020c210741d88308410a101b2202101222092007102b220120011041220a4280808080105a0d02200a4200520d0102402002103622011027450440410121014101210341012105410021040c010b2000411c6a22052001101420052001104721082000411c6a2001104721052000411c6a2001104721042000411c6a200110472000280220200028021c470d0420002d002c04404184d30841003602004188d30841003a00000b4101210341016a2101200845044020012105410021040c010b2000411c6a2206200241868108410b200410332203101420062003104721062000411c6a200310471a2000280220200028021c470d0520002d002c04404184d30841003602004188d30841003a00000b20022004200620011032200841016a21030b200220012004410010322002419181084106200110332007102820021036210402402003044020031034220210352005200210352001200210352001200210352004200210290c010b200441014100103f0b20092007102b2001ad102e0c010b0b200041306a24000f0b200141808008410e1040000b200141808008410e1040000b200341808008410e1040000b08001010410010210b990301077f230041306b2200240010101023410210224100101e1004413047044041ac8308410941bc81084110101a000b4101101e210320004102360224200041246a2201101c2104200028022410202001104a200028022c20031038450440101d21052004100421064100210103402006200141046a22024f04402000410036022420042001200041246a410410251a20052000280224220141187420014180fe03714108747220014108764180fe0371200141187672721012101f200221010c010b0b101d21012005100421022000410036022c200020024102763602282000200536022403400240200041106a200041246a1045200028021004402001200028021410021a0c020520011018220110111a200320011013450d01200410042101200041003602202000200141027636021c200020043602180340200041086a200041186a104520002802080440200028020c2101200041246a2202200310482002200110370c010b0b200041246a2201104a200120031037200041306a24000f0b000b0b41cc8208413e1016000b419d8208412f1016000b2f01017f10101019410110214100101e220010044120470440418a8308411141bc81084110101a000b1049200010280bf20101087f230041106b220124001010410210214100101e21004101101e210402400240024002401049102704401017104910421013450d01200141046a20001048200128020c22052004103d2202450d0320012802082203102f22002002490d0420002002460d022003102f2000490d042001280204220720001030101521062003102f2002490d04200720021030200610280c020b41fa810841231016000b41cc8108412e1016000b2003102f2000490d01200128020420001030102a2003200041016b102d2000200247044020052006200210390b20052004103a102a0b200141106a24000f0b41ce840841121000000b3f02017e017f10101019410110214100100922004280808080105a044041958008410941808008410e101a000b2000a72101419b8408410f101b2001ad102e0bb40101057f230041206b220024001010101910234100102220004100360214200041146a101c210120002802141020200110042102200041003602102000200241027636020c20002001360208034002402000200041086a10442000280200450d0020002802042101200041146a104b200028021c22042001103e0d0120002802182202102f21032000280214200341016a220310302001102820022003102d200420012002102f103b0c010b0b200041206a24000b930201087f230041206b220024001010101910234100102220004100360214200041146a101c210120002802141020200110042102200041003602102000200241027636020c20002001360208034002402000200041086a104402402000280200044020002802042104200041146a104b200028021c22052004103e2202450d0320002802182203102f22012002490d0220012002460d012003102f2001490d022000280214220720011030104221062003102f2002490d02200720021030200610280c010b200041206a24000f0b2003102f20014904400c010b200028021420011030102a2003200141016b102d20012002470440200520062002103b0b20052004103c102a0c010b0b41ce840841121000000b0300010b0b0041e08408410e1000000b0b82050200418080080bee04696e70757420746f6f206c6f6e677369676e6572736e65775f76616c7565617267756d656e74206465636f6465206572726f722028293a20746f6f2066657720617267756d656e7473746f6f206d616e7920617267756d656e747377726f6e67206e756d626572206f6620617267756d656e74732e6e6f64655f69642e6974656d2e696e666f2e6e6f64655f6c696e6b732e76616c75652e696e64657873746f72616765206465636f6465206572726f7220286b65793a202e6c656e626164206172726179206c656e6774684f6e6c792045534454205361666520636f6e74726163742063616e2063616c6c207468697320656e64706f696e745468657265206973206e6f207265676973746572656420455344542061646472657373546865204f7574476f696e67547873486173682068617320616c7265616479206265656e207265676973746572656448617368206f6620616c6c206f7065726174696f6e7320646f65736e2774206d61746368207468652068617368206f66207472616e736665722064617461657364745f736166655f616464726573736f7065726174696f6e735f6861736865737369676e6174757265626c735f7075625f6b6579737661722061726773696e70757420746f6f2073686f7274626c735075624b65797370656e64696e67486173686573657364745361666541646472657373686173684f66486173686573486973746f7279616c6c5369676e6572736d696e56616c69645369676e657273456e64706f696e742063616e206f6e6c792062652063616c6c6564206279206f776e6572696e646578206f7574206f662072616e676570616e6963206f636375727265640041f084080b0438ffffff", - "report": { - "imports": [ - "checkNoPayment", - "getNumArguments", - "mBufferAppend", - "mBufferAppendBytes", - "mBufferEq", - "mBufferGetArgument", - "mBufferGetByteSlice", - "mBufferGetLength", - "mBufferNew", - "mBufferSetBytes", - "mBufferStorageLoad", - "mBufferStorageStore", - "managedCaller", - "managedOwnerAddress", - "managedSha256", - "managedSignalError", - "signalError", - "smallIntGetUnsignedArgument" - ], - "isMemGrow": false, - "eiCheck": { - "eiVersion": "1.3", - "ok": true - }, - "codeReport": { - "path": "../output/header-verifier.wasm", - "size": 5435, - "hasAllocator": false, - "hasPanic": "without message" - } - } -} From 0b0b504fbff517dd79b20c7d2d44a14b347af3b2 Mon Sep 17 00:00:00 2001 From: Andrei Baltariu Date: Tue, 12 Nov 2024 12:16:08 +0200 Subject: [PATCH 521/523] Modified structs wallet address field Signed-off-by: Andrei Baltariu --- esdt-safe/interactor/src/interactor_main.rs | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/esdt-safe/interactor/src/interactor_main.rs b/esdt-safe/interactor/src/interactor_main.rs index fe637ee9..74dc900c 100644 --- a/esdt-safe/interactor/src/interactor_main.rs +++ b/esdt-safe/interactor/src/interactor_main.rs @@ -149,7 +149,7 @@ impl Drop for State { struct ContractInteract { interactor: Interactor, wallet_address: Address, - bob_address: Address, + frank_address: Address, alice_address: Address, mike_address: Address, judy_address: Address, @@ -197,7 +197,7 @@ impl ContractInteract { ContractInteract { interactor, wallet_address, - bob_address: frank_address, + frank_address, alice_address, mike_address, judy_address, @@ -267,7 +267,7 @@ impl ContractInteract { async fn deploy_price_aggregator(&mut self) { let price_agggregator_code_path = MxscPath::new(&self.price_aggregator_code); let mut oracles = MultiValueEncoded::new(); - let first_oracle_adress = managed_address!(&self.bob_address.clone()); + let first_oracle_adress = managed_address!(&self.frank_address.clone()); let second_oracle_adress = managed_address!(&self.alice_address.clone()); let third_oracle_adress = managed_address!(&self.mike_address.clone()); let forth_oracle_address = managed_address!(&self.judy_address.clone()); @@ -431,7 +431,7 @@ impl ContractInteract { let token_nonce = 0u64; let token_amount = BigUint::::from(20u64); - let to = &self.bob_address; + let to = &self.frank_address; let mut payments = PaymentsVec::new(); payments.push(EsdtTokenPayment::new( TokenIdentifier::from(token_id), @@ -581,7 +581,7 @@ impl ContractInteract { async fn execute_operations_with_error(&mut self, error_msg: ExpectError<'_>) { let tokens = self.setup_payments().await; let operation_data = self.setup_operation_data(false).await; - let to = managed_address!(&self.bob_address); + let to = managed_address!(&self.frank_address); let operation = Operation::new(to, tokens, operation_data); let operation_hash = self.get_operation_hash(&operation); @@ -1026,7 +1026,7 @@ impl ContractInteract { hash: ManagedBuffer::new(), name: ManagedBuffer::from("SovToken"), attributes: ManagedBuffer::new(), - creator: managed_address!(&self.bob_address), + creator: managed_address!(&self.frank_address), royalties: BigUint::zero(), uris: ManagedVec::new(), }, From 540e82d66ffbe210023091a62913c0b114e6e17f Mon Sep 17 00:00:00 2001 From: Andrei Baltariu Date: Thu, 14 Nov 2024 16:08:22 +0200 Subject: [PATCH 522/523] Enshrine ESDT fw upgrade Signed-off-by: Andrei Baltariu --- Cargo.lock | 24 +++++++++---------- chain-config/Cargo.toml | 6 ++--- chain-config/meta/Cargo.toml | 2 +- chain-config/wasm/Cargo.lock | 16 ++++++------- chain-config/wasm/Cargo.toml | 2 +- chain-factory/Cargo.toml | 4 ++-- chain-factory/meta/Cargo.toml | 2 +- .../wasm-chain-factory-full/Cargo.lock | 16 ++++++------- .../wasm-chain-factory-full/Cargo.toml | 2 +- .../wasm-chain-factory-view/Cargo.lock | 16 ++++++------- .../wasm-chain-factory-view/Cargo.toml | 2 +- chain-factory/wasm/Cargo.lock | 16 ++++++------- chain-factory/wasm/Cargo.toml | 2 +- common/bls-signature/Cargo.toml | 4 ++-- common/max-bridged-amount-module/Cargo.toml | 4 ++-- common/setup-phase/Cargo.toml | 4 ++-- common/token-whitelist/Cargo.toml | 4 ++-- common/transaction/Cargo.toml | 2 +- common/tx-batch-module/Cargo.toml | 4 ++-- common/utils/Cargo.toml | 2 +- enshrine-esdt-safe/Cargo.toml | 6 ++--- enshrine-esdt-safe/meta/Cargo.toml | 2 +- .../wasm-enshrine-esdt-safe-full/Cargo.lock | 16 ++++++------- .../wasm-enshrine-esdt-safe-full/Cargo.toml | 2 +- .../wasm-enshrine-esdt-safe-view/Cargo.lock | 16 ++++++------- .../wasm-enshrine-esdt-safe-view/Cargo.toml | 2 +- enshrine-esdt-safe/wasm/Cargo.lock | 16 ++++++------- enshrine-esdt-safe/wasm/Cargo.toml | 2 +- esdt-safe/Cargo.toml | 6 ++--- esdt-safe/interactor/Cargo.toml | 6 ++--- esdt-safe/interactor/src/interactor_main.rs | 2 +- esdt-safe/meta/Cargo.toml | 2 +- esdt-safe/wasm-esdt-safe-full/Cargo.lock | 16 ++++++------- esdt-safe/wasm-esdt-safe-full/Cargo.toml | 2 +- esdt-safe/wasm-esdt-safe-view/Cargo.lock | 16 ++++++------- esdt-safe/wasm-esdt-safe-view/Cargo.toml | 2 +- esdt-safe/wasm/Cargo.lock | 16 ++++++------- esdt-safe/wasm/Cargo.toml | 2 +- fee-market/Cargo.toml | 4 ++-- fee-market/meta/Cargo.toml | 2 +- fee-market/wasm-fee-market/Cargo.lock | 12 +++++----- fee-market/wasm-fee-market/Cargo.toml | 2 +- fee-market/wasm-multisig-view/Cargo.lock | 12 +++++----- fee-market/wasm-multisig-view/Cargo.toml | 2 +- fee-market/wasm/Cargo.lock | 12 +++++----- fee-market/wasm/Cargo.toml | 2 +- header-verifier/Cargo.toml | 4 ++-- header-verifier/meta/Cargo.toml | 2 +- .../wasm-header-verifier-full/Cargo.lock | 12 +++++----- .../wasm-header-verifier-full/Cargo.toml | 2 +- header-verifier/wasm-multisig-view/Cargo.lock | 12 +++++----- header-verifier/wasm-multisig-view/Cargo.toml | 2 +- header-verifier/wasm/Cargo.lock | 12 +++++----- header-verifier/wasm/Cargo.toml | 2 +- testing-sc/Cargo.toml | 4 ++-- testing-sc/meta/Cargo.toml | 2 +- testing-sc/wasm-testing-sc-full/Cargo.lock | 12 +++++----- testing-sc/wasm-testing-sc-full/Cargo.toml | 2 +- testing-sc/wasm-testing-view/Cargo.lock | 12 +++++----- testing-sc/wasm-testing-view/Cargo.toml | 2 +- testing-sc/wasm/Cargo.lock | 12 +++++----- testing-sc/wasm/Cargo.toml | 2 +- token-handler/Cargo.toml | 4 ++-- token-handler/meta/Cargo.toml | 2 +- .../wasm-token-handler-full/Cargo.lock | 16 ++++++------- .../wasm-token-handler-full/Cargo.toml | 2 +- .../wasm-token-handler-view/Cargo.lock | 16 ++++++------- .../wasm-token-handler-view/Cargo.toml | 2 +- token-handler/wasm/Cargo.lock | 16 ++++++------- token-handler/wasm/Cargo.toml | 2 +- 70 files changed, 235 insertions(+), 235 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 8b1d257e..b416dd45 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1124,9 +1124,9 @@ checksum = "b59072fa0624b55ae5ae3fa6bfa91515bbeb4ac440214bc4a509e2c8806d6e9f" [[package]] name = "multiversx-sc" -version = "0.54.0" +version = "0.54.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b9e5cee0b8c5fbaa9edfee2e38f2162adb01700a0028942d2cd14808cd26b130" +checksum = "c4abf60eb027d0b005a1778dc9d670a473065ab8e5bea22eeb6ace7f118dc36f" dependencies = [ "bitflags", "hex-literal", @@ -1163,9 +1163,9 @@ dependencies = [ [[package]] name = "multiversx-sc-derive" -version = "0.54.0" +version = "0.54.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "931669b080cf793b205bf08b5d1f4a658d0ac0ad628844d9a9d13649a73c7540" +checksum = "3caeda89d90190c4002f7482e934e3981968d6853f70f865d23c8d2938bd907b" dependencies = [ "hex", "proc-macro2", @@ -1176,9 +1176,9 @@ dependencies = [ [[package]] name = "multiversx-sc-meta-lib" -version = "0.54.0" +version = "0.54.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f9e6e7f9091e647e1a51d147de1029c753eef254f5a5c19fc6ecc4c5292359be" +checksum = "1aba25f649febadc7c8fa191bfd3140feaa0b7025a4db74e298a88c554b04409" dependencies = [ "clap", "colored", @@ -1198,18 +1198,18 @@ dependencies = [ [[package]] name = "multiversx-sc-modules" -version = "0.54.0" +version = "0.54.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5373903a01dd7d33547b83f0034dc6e12fbbc8e49fcb316a3efb6ef4ff6573a8" +checksum = "624f7a758e2d5dc3e87fd095cb76d47f3cf4b0cee41b5415aa95b8e323ffe162" dependencies = [ "multiversx-sc", ] [[package]] name = "multiversx-sc-scenario" -version = "0.54.0" +version = "0.54.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1eae4de5e3ae0de3631ad0777b97ef14c92d13894a7e55e2d3d304a2e5f40aa5" +checksum = "c802278309d07bab20b144c5dd97e5228c70e9c73a1855821d527fcc03aeb638" dependencies = [ "base64", "bech32", @@ -1233,9 +1233,9 @@ dependencies = [ [[package]] name = "multiversx-sc-snippets" -version = "0.54.0" +version = "0.54.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "83eec6ebd7efc32eb77d19ea29f3f13d42b7d848662b173c920201741ec3897e" +checksum = "f7f6b9720e98528d0ce50efa11ab06f2f9ef049f8edd0a3469f1d0f62bf1af0a" dependencies = [ "anyhow", "base64", diff --git a/chain-config/Cargo.toml b/chain-config/Cargo.toml index 2f30c7f5..31622857 100644 --- a/chain-config/Cargo.toml +++ b/chain-config/Cargo.toml @@ -12,10 +12,10 @@ path = "src/lib.rs" num-bigint = "0.4.2" [dev-dependencies.multiversx-sc-scenario] -version = "=0.54.0" +version = "=0.54.1" [dependencies.multiversx-sc] -version = "=0.54.0" +version = "=0.54.1" [dependencies.multiversx-sc-modules] -version = "=0.54.0" +version = "=0.54.1" diff --git a/chain-config/meta/Cargo.toml b/chain-config/meta/Cargo.toml index 8128b0dd..ec4e78e6 100644 --- a/chain-config/meta/Cargo.toml +++ b/chain-config/meta/Cargo.toml @@ -11,4 +11,4 @@ authors = ["you"] path = ".." [dependencies.multiversx-sc-meta-lib] -version = "=0.54.0" +version = "=0.54.1" diff --git a/chain-config/wasm/Cargo.lock b/chain-config/wasm/Cargo.lock index 71f0a3f0..1d2aec1a 100644 --- a/chain-config/wasm/Cargo.lock +++ b/chain-config/wasm/Cargo.lock @@ -66,9 +66,9 @@ dependencies = [ [[package]] name = "multiversx-sc" -version = "0.54.0" +version = "0.54.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b9e5cee0b8c5fbaa9edfee2e38f2162adb01700a0028942d2cd14808cd26b130" +checksum = "c4abf60eb027d0b005a1778dc9d670a473065ab8e5bea22eeb6ace7f118dc36f" dependencies = [ "bitflags", "hex-literal", @@ -104,9 +104,9 @@ dependencies = [ [[package]] name = "multiversx-sc-derive" -version = "0.54.0" +version = "0.54.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "931669b080cf793b205bf08b5d1f4a658d0ac0ad628844d9a9d13649a73c7540" +checksum = "3caeda89d90190c4002f7482e934e3981968d6853f70f865d23c8d2938bd907b" dependencies = [ "hex", "proc-macro2", @@ -117,18 +117,18 @@ dependencies = [ [[package]] name = "multiversx-sc-modules" -version = "0.54.0" +version = "0.54.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5373903a01dd7d33547b83f0034dc6e12fbbc8e49fcb316a3efb6ef4ff6573a8" +checksum = "624f7a758e2d5dc3e87fd095cb76d47f3cf4b0cee41b5415aa95b8e323ffe162" dependencies = [ "multiversx-sc", ] [[package]] name = "multiversx-sc-wasm-adapter" -version = "0.54.0" +version = "0.54.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c034ae143cfd971cf0c4d67476af1920a9a0165bd99713458397ac06762fca0d" +checksum = "b10f0b29d4bcd7520e659ae2429ea9a4f02b7203a77d7788bebc79786babd250" dependencies = [ "multiversx-sc", ] diff --git a/chain-config/wasm/Cargo.toml b/chain-config/wasm/Cargo.toml index 3e4e107a..5705689f 100644 --- a/chain-config/wasm/Cargo.toml +++ b/chain-config/wasm/Cargo.toml @@ -28,7 +28,7 @@ panic = "abort" path = ".." [dependencies.multiversx-sc-wasm-adapter] -version = "=0.54.0" +version = "=0.54.1" [workspace] members = ["."] diff --git a/chain-factory/Cargo.toml b/chain-factory/Cargo.toml index 652abd76..54550a64 100644 --- a/chain-factory/Cargo.toml +++ b/chain-factory/Cargo.toml @@ -12,10 +12,10 @@ path = "src/lib.rs" num-bigint = "0.4.2" [dev-dependencies.multiversx-sc-scenario] -version = "=0.54.0" +version = "=0.54.1" [dependencies.multiversx-sc] -version = "=0.54.0" +version = "=0.54.1" [dependencies.utils] path = "../common/utils" diff --git a/chain-factory/meta/Cargo.toml b/chain-factory/meta/Cargo.toml index 49bad95a..c832ed0d 100644 --- a/chain-factory/meta/Cargo.toml +++ b/chain-factory/meta/Cargo.toml @@ -11,4 +11,4 @@ authors = ["you"] path = ".." [dependencies.multiversx-sc-meta-lib] -version = "=0.54.0" +version = "=0.54.1" diff --git a/chain-factory/wasm-chain-factory-full/Cargo.lock b/chain-factory/wasm-chain-factory-full/Cargo.lock index 356cb629..f7d77790 100644 --- a/chain-factory/wasm-chain-factory-full/Cargo.lock +++ b/chain-factory/wasm-chain-factory-full/Cargo.lock @@ -84,9 +84,9 @@ dependencies = [ [[package]] name = "multiversx-sc" -version = "0.54.0" +version = "0.54.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b9e5cee0b8c5fbaa9edfee2e38f2162adb01700a0028942d2cd14808cd26b130" +checksum = "c4abf60eb027d0b005a1778dc9d670a473065ab8e5bea22eeb6ace7f118dc36f" dependencies = [ "bitflags", "hex-literal", @@ -122,9 +122,9 @@ dependencies = [ [[package]] name = "multiversx-sc-derive" -version = "0.54.0" +version = "0.54.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "931669b080cf793b205bf08b5d1f4a658d0ac0ad628844d9a9d13649a73c7540" +checksum = "3caeda89d90190c4002f7482e934e3981968d6853f70f865d23c8d2938bd907b" dependencies = [ "hex", "proc-macro2", @@ -135,18 +135,18 @@ dependencies = [ [[package]] name = "multiversx-sc-modules" -version = "0.54.0" +version = "0.54.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5373903a01dd7d33547b83f0034dc6e12fbbc8e49fcb316a3efb6ef4ff6573a8" +checksum = "624f7a758e2d5dc3e87fd095cb76d47f3cf4b0cee41b5415aa95b8e323ffe162" dependencies = [ "multiversx-sc", ] [[package]] name = "multiversx-sc-wasm-adapter" -version = "0.54.0" +version = "0.54.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c034ae143cfd971cf0c4d67476af1920a9a0165bd99713458397ac06762fca0d" +checksum = "b10f0b29d4bcd7520e659ae2429ea9a4f02b7203a77d7788bebc79786babd250" dependencies = [ "multiversx-sc", ] diff --git a/chain-factory/wasm-chain-factory-full/Cargo.toml b/chain-factory/wasm-chain-factory-full/Cargo.toml index 6eea8a36..0a859578 100644 --- a/chain-factory/wasm-chain-factory-full/Cargo.toml +++ b/chain-factory/wasm-chain-factory-full/Cargo.toml @@ -28,7 +28,7 @@ panic = "abort" path = ".." [dependencies.multiversx-sc-wasm-adapter] -version = "=0.54.0" +version = "=0.54.1" [workspace] members = ["."] diff --git a/chain-factory/wasm-chain-factory-view/Cargo.lock b/chain-factory/wasm-chain-factory-view/Cargo.lock index f9fbda65..3187f89c 100644 --- a/chain-factory/wasm-chain-factory-view/Cargo.lock +++ b/chain-factory/wasm-chain-factory-view/Cargo.lock @@ -84,9 +84,9 @@ dependencies = [ [[package]] name = "multiversx-sc" -version = "0.54.0" +version = "0.54.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b9e5cee0b8c5fbaa9edfee2e38f2162adb01700a0028942d2cd14808cd26b130" +checksum = "c4abf60eb027d0b005a1778dc9d670a473065ab8e5bea22eeb6ace7f118dc36f" dependencies = [ "bitflags", "hex-literal", @@ -122,9 +122,9 @@ dependencies = [ [[package]] name = "multiversx-sc-derive" -version = "0.54.0" +version = "0.54.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "931669b080cf793b205bf08b5d1f4a658d0ac0ad628844d9a9d13649a73c7540" +checksum = "3caeda89d90190c4002f7482e934e3981968d6853f70f865d23c8d2938bd907b" dependencies = [ "hex", "proc-macro2", @@ -135,18 +135,18 @@ dependencies = [ [[package]] name = "multiversx-sc-modules" -version = "0.54.0" +version = "0.54.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5373903a01dd7d33547b83f0034dc6e12fbbc8e49fcb316a3efb6ef4ff6573a8" +checksum = "624f7a758e2d5dc3e87fd095cb76d47f3cf4b0cee41b5415aa95b8e323ffe162" dependencies = [ "multiversx-sc", ] [[package]] name = "multiversx-sc-wasm-adapter" -version = "0.54.0" +version = "0.54.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c034ae143cfd971cf0c4d67476af1920a9a0165bd99713458397ac06762fca0d" +checksum = "b10f0b29d4bcd7520e659ae2429ea9a4f02b7203a77d7788bebc79786babd250" dependencies = [ "multiversx-sc", ] diff --git a/chain-factory/wasm-chain-factory-view/Cargo.toml b/chain-factory/wasm-chain-factory-view/Cargo.toml index 6033d11c..19001629 100644 --- a/chain-factory/wasm-chain-factory-view/Cargo.toml +++ b/chain-factory/wasm-chain-factory-view/Cargo.toml @@ -28,7 +28,7 @@ panic = "abort" path = ".." [dependencies.multiversx-sc-wasm-adapter] -version = "=0.54.0" +version = "=0.54.1" [workspace] members = ["."] diff --git a/chain-factory/wasm/Cargo.lock b/chain-factory/wasm/Cargo.lock index 6b4bc5f5..c1e14d7b 100644 --- a/chain-factory/wasm/Cargo.lock +++ b/chain-factory/wasm/Cargo.lock @@ -84,9 +84,9 @@ dependencies = [ [[package]] name = "multiversx-sc" -version = "0.54.0" +version = "0.54.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b9e5cee0b8c5fbaa9edfee2e38f2162adb01700a0028942d2cd14808cd26b130" +checksum = "c4abf60eb027d0b005a1778dc9d670a473065ab8e5bea22eeb6ace7f118dc36f" dependencies = [ "bitflags", "hex-literal", @@ -122,9 +122,9 @@ dependencies = [ [[package]] name = "multiversx-sc-derive" -version = "0.54.0" +version = "0.54.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "931669b080cf793b205bf08b5d1f4a658d0ac0ad628844d9a9d13649a73c7540" +checksum = "3caeda89d90190c4002f7482e934e3981968d6853f70f865d23c8d2938bd907b" dependencies = [ "hex", "proc-macro2", @@ -135,18 +135,18 @@ dependencies = [ [[package]] name = "multiversx-sc-modules" -version = "0.54.0" +version = "0.54.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5373903a01dd7d33547b83f0034dc6e12fbbc8e49fcb316a3efb6ef4ff6573a8" +checksum = "624f7a758e2d5dc3e87fd095cb76d47f3cf4b0cee41b5415aa95b8e323ffe162" dependencies = [ "multiversx-sc", ] [[package]] name = "multiversx-sc-wasm-adapter" -version = "0.54.0" +version = "0.54.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c034ae143cfd971cf0c4d67476af1920a9a0165bd99713458397ac06762fca0d" +checksum = "b10f0b29d4bcd7520e659ae2429ea9a4f02b7203a77d7788bebc79786babd250" dependencies = [ "multiversx-sc", ] diff --git a/chain-factory/wasm/Cargo.toml b/chain-factory/wasm/Cargo.toml index 1cb3ec30..e1f4de3e 100644 --- a/chain-factory/wasm/Cargo.toml +++ b/chain-factory/wasm/Cargo.toml @@ -28,7 +28,7 @@ panic = "abort" path = ".." [dependencies.multiversx-sc-wasm-adapter] -version = "=0.54.0" +version = "=0.54.1" [workspace] members = ["."] diff --git a/common/bls-signature/Cargo.toml b/common/bls-signature/Cargo.toml index 30bf2faf..0b8021aa 100644 --- a/common/bls-signature/Cargo.toml +++ b/common/bls-signature/Cargo.toml @@ -5,10 +5,10 @@ authors = ["dorin-iancu "] edition = "2018" [dependencies.multiversx-sc] -version = "=0.54.0" +version = "=0.54.1" [dependencies.transaction] path = "../transaction" [dev-dependencies.multiversx-sc-scenario] -version = "=0.54.0" +version = "=0.54.1" diff --git a/common/max-bridged-amount-module/Cargo.toml b/common/max-bridged-amount-module/Cargo.toml index 6436805c..44237369 100644 --- a/common/max-bridged-amount-module/Cargo.toml +++ b/common/max-bridged-amount-module/Cargo.toml @@ -5,7 +5,7 @@ authors = ["dorin-iancu "] edition = "2018" [dependencies.multiversx-sc] -version = "=0.54.0" +version = "=0.54.1" [dev-dependencies.multiversx-sc-scenario] -version = "=0.54.0" +version = "=0.54.1" diff --git a/common/setup-phase/Cargo.toml b/common/setup-phase/Cargo.toml index 9ff4aba3..02896c74 100644 --- a/common/setup-phase/Cargo.toml +++ b/common/setup-phase/Cargo.toml @@ -5,7 +5,7 @@ authors = ["dorin-iancu "] edition = "2018" [dependencies.multiversx-sc] -version = "=0.54.0" +version = "=0.54.1" [dev-dependencies.multiversx-sc-scenario] -version = "=0.54.0" +version = "=0.54.1" diff --git a/common/token-whitelist/Cargo.toml b/common/token-whitelist/Cargo.toml index a5bad4a1..4f8b443b 100644 --- a/common/token-whitelist/Cargo.toml +++ b/common/token-whitelist/Cargo.toml @@ -14,7 +14,7 @@ path = "../setup-phase" path = "../utils" [dependencies.multiversx-sc] -version = "=0.54.0" +version = "=0.54.1" [dev-dependencies.multiversx-sc-scenario] -version = "=0.54.0" +version = "=0.54.1" diff --git a/common/transaction/Cargo.toml b/common/transaction/Cargo.toml index 2eb77cd5..641cef36 100644 --- a/common/transaction/Cargo.toml +++ b/common/transaction/Cargo.toml @@ -8,4 +8,4 @@ edition = "2018" path = "src/lib.rs" [dependencies.multiversx-sc] -version = "=0.54.0" +version = "=0.54.1" diff --git a/common/tx-batch-module/Cargo.toml b/common/tx-batch-module/Cargo.toml index 75db54c5..70f31480 100644 --- a/common/tx-batch-module/Cargo.toml +++ b/common/tx-batch-module/Cargo.toml @@ -5,10 +5,10 @@ authors = ["dorin-iancu "] edition = "2018" [dependencies.multiversx-sc] -version = "=0.54.0" +version = "=0.54.1" [dependencies.transaction] path = "../transaction" [dev-dependencies.multiversx-sc-scenario] -version = "=0.54.0" +version = "=0.54.1" diff --git a/common/utils/Cargo.toml b/common/utils/Cargo.toml index 2b60ab45..f7d20dcf 100644 --- a/common/utils/Cargo.toml +++ b/common/utils/Cargo.toml @@ -11,5 +11,5 @@ path = "src/lib.rs" path = "../bls-signature" [dependencies.multiversx-sc] -version = "=0.54.0" +version = "=0.54.1" features = ["esdt-token-payment-legacy-decode"] diff --git a/enshrine-esdt-safe/Cargo.toml b/enshrine-esdt-safe/Cargo.toml index 73ceb763..1ae03b36 100644 --- a/enshrine-esdt-safe/Cargo.toml +++ b/enshrine-esdt-safe/Cargo.toml @@ -39,10 +39,10 @@ path = "../header-verifier" path = "../token-handler" [dependencies.multiversx-sc] -version = "=0.54.0" +version = "=0.54.1" [dependencies.multiversx-sc-modules] -version = "=0.54.0" +version = "=0.54.1" [dev-dependencies] num-bigint = "0.4.2" @@ -50,4 +50,4 @@ num-traits = "0.2" hex = "0.4" [dev-dependencies.multiversx-sc-scenario] -version = "=0.54.0" +version = "=0.54.1" diff --git a/enshrine-esdt-safe/meta/Cargo.toml b/enshrine-esdt-safe/meta/Cargo.toml index 55e86dc8..b1b74288 100644 --- a/enshrine-esdt-safe/meta/Cargo.toml +++ b/enshrine-esdt-safe/meta/Cargo.toml @@ -8,5 +8,5 @@ publish = false path = ".." [dependencies.multiversx-sc-meta-lib] -version = "0.54.0" +version = "0.54.1" default-features = false diff --git a/enshrine-esdt-safe/wasm-enshrine-esdt-safe-full/Cargo.lock b/enshrine-esdt-safe/wasm-enshrine-esdt-safe-full/Cargo.lock index 886f601c..2ce2ab63 100644 --- a/enshrine-esdt-safe/wasm-enshrine-esdt-safe-full/Cargo.lock +++ b/enshrine-esdt-safe/wasm-enshrine-esdt-safe-full/Cargo.lock @@ -128,9 +128,9 @@ dependencies = [ [[package]] name = "multiversx-sc" -version = "0.54.0" +version = "0.54.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b9e5cee0b8c5fbaa9edfee2e38f2162adb01700a0028942d2cd14808cd26b130" +checksum = "c4abf60eb027d0b005a1778dc9d670a473065ab8e5bea22eeb6ace7f118dc36f" dependencies = [ "bitflags", "hex-literal", @@ -166,9 +166,9 @@ dependencies = [ [[package]] name = "multiversx-sc-derive" -version = "0.54.0" +version = "0.54.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "931669b080cf793b205bf08b5d1f4a658d0ac0ad628844d9a9d13649a73c7540" +checksum = "3caeda89d90190c4002f7482e934e3981968d6853f70f865d23c8d2938bd907b" dependencies = [ "hex", "proc-macro2", @@ -179,18 +179,18 @@ dependencies = [ [[package]] name = "multiversx-sc-modules" -version = "0.54.0" +version = "0.54.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5373903a01dd7d33547b83f0034dc6e12fbbc8e49fcb316a3efb6ef4ff6573a8" +checksum = "624f7a758e2d5dc3e87fd095cb76d47f3cf4b0cee41b5415aa95b8e323ffe162" dependencies = [ "multiversx-sc", ] [[package]] name = "multiversx-sc-wasm-adapter" -version = "0.54.0" +version = "0.54.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c034ae143cfd971cf0c4d67476af1920a9a0165bd99713458397ac06762fca0d" +checksum = "b10f0b29d4bcd7520e659ae2429ea9a4f02b7203a77d7788bebc79786babd250" dependencies = [ "multiversx-sc", ] diff --git a/enshrine-esdt-safe/wasm-enshrine-esdt-safe-full/Cargo.toml b/enshrine-esdt-safe/wasm-enshrine-esdt-safe-full/Cargo.toml index 5ffe73ba..73241905 100644 --- a/enshrine-esdt-safe/wasm-enshrine-esdt-safe-full/Cargo.toml +++ b/enshrine-esdt-safe/wasm-enshrine-esdt-safe-full/Cargo.toml @@ -28,7 +28,7 @@ panic = "abort" path = ".." [dependencies.multiversx-sc-wasm-adapter] -version = "=0.54.0" +version = "=0.54.1" [workspace] members = ["."] diff --git a/enshrine-esdt-safe/wasm-enshrine-esdt-safe-view/Cargo.lock b/enshrine-esdt-safe/wasm-enshrine-esdt-safe-view/Cargo.lock index e608aec7..e1d3e3e0 100644 --- a/enshrine-esdt-safe/wasm-enshrine-esdt-safe-view/Cargo.lock +++ b/enshrine-esdt-safe/wasm-enshrine-esdt-safe-view/Cargo.lock @@ -128,9 +128,9 @@ dependencies = [ [[package]] name = "multiversx-sc" -version = "0.54.0" +version = "0.54.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b9e5cee0b8c5fbaa9edfee2e38f2162adb01700a0028942d2cd14808cd26b130" +checksum = "c4abf60eb027d0b005a1778dc9d670a473065ab8e5bea22eeb6ace7f118dc36f" dependencies = [ "bitflags", "hex-literal", @@ -166,9 +166,9 @@ dependencies = [ [[package]] name = "multiversx-sc-derive" -version = "0.54.0" +version = "0.54.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "931669b080cf793b205bf08b5d1f4a658d0ac0ad628844d9a9d13649a73c7540" +checksum = "3caeda89d90190c4002f7482e934e3981968d6853f70f865d23c8d2938bd907b" dependencies = [ "hex", "proc-macro2", @@ -179,18 +179,18 @@ dependencies = [ [[package]] name = "multiversx-sc-modules" -version = "0.54.0" +version = "0.54.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5373903a01dd7d33547b83f0034dc6e12fbbc8e49fcb316a3efb6ef4ff6573a8" +checksum = "624f7a758e2d5dc3e87fd095cb76d47f3cf4b0cee41b5415aa95b8e323ffe162" dependencies = [ "multiversx-sc", ] [[package]] name = "multiversx-sc-wasm-adapter" -version = "0.54.0" +version = "0.54.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c034ae143cfd971cf0c4d67476af1920a9a0165bd99713458397ac06762fca0d" +checksum = "b10f0b29d4bcd7520e659ae2429ea9a4f02b7203a77d7788bebc79786babd250" dependencies = [ "multiversx-sc", ] diff --git a/enshrine-esdt-safe/wasm-enshrine-esdt-safe-view/Cargo.toml b/enshrine-esdt-safe/wasm-enshrine-esdt-safe-view/Cargo.toml index f84649a8..b8754db7 100644 --- a/enshrine-esdt-safe/wasm-enshrine-esdt-safe-view/Cargo.toml +++ b/enshrine-esdt-safe/wasm-enshrine-esdt-safe-view/Cargo.toml @@ -28,7 +28,7 @@ panic = "abort" path = ".." [dependencies.multiversx-sc-wasm-adapter] -version = "=0.54.0" +version = "=0.54.1" [workspace] members = ["."] diff --git a/enshrine-esdt-safe/wasm/Cargo.lock b/enshrine-esdt-safe/wasm/Cargo.lock index f30c0c46..708ccb1a 100644 --- a/enshrine-esdt-safe/wasm/Cargo.lock +++ b/enshrine-esdt-safe/wasm/Cargo.lock @@ -128,9 +128,9 @@ dependencies = [ [[package]] name = "multiversx-sc" -version = "0.54.0" +version = "0.54.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b9e5cee0b8c5fbaa9edfee2e38f2162adb01700a0028942d2cd14808cd26b130" +checksum = "c4abf60eb027d0b005a1778dc9d670a473065ab8e5bea22eeb6ace7f118dc36f" dependencies = [ "bitflags", "hex-literal", @@ -166,9 +166,9 @@ dependencies = [ [[package]] name = "multiversx-sc-derive" -version = "0.54.0" +version = "0.54.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "931669b080cf793b205bf08b5d1f4a658d0ac0ad628844d9a9d13649a73c7540" +checksum = "3caeda89d90190c4002f7482e934e3981968d6853f70f865d23c8d2938bd907b" dependencies = [ "hex", "proc-macro2", @@ -179,18 +179,18 @@ dependencies = [ [[package]] name = "multiversx-sc-modules" -version = "0.54.0" +version = "0.54.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5373903a01dd7d33547b83f0034dc6e12fbbc8e49fcb316a3efb6ef4ff6573a8" +checksum = "624f7a758e2d5dc3e87fd095cb76d47f3cf4b0cee41b5415aa95b8e323ffe162" dependencies = [ "multiversx-sc", ] [[package]] name = "multiversx-sc-wasm-adapter" -version = "0.54.0" +version = "0.54.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c034ae143cfd971cf0c4d67476af1920a9a0165bd99713458397ac06762fca0d" +checksum = "b10f0b29d4bcd7520e659ae2429ea9a4f02b7203a77d7788bebc79786babd250" dependencies = [ "multiversx-sc", ] diff --git a/enshrine-esdt-safe/wasm/Cargo.toml b/enshrine-esdt-safe/wasm/Cargo.toml index 3e340b15..b4c7336e 100644 --- a/enshrine-esdt-safe/wasm/Cargo.toml +++ b/enshrine-esdt-safe/wasm/Cargo.toml @@ -28,7 +28,7 @@ panic = "abort" path = ".." [dependencies.multiversx-sc-wasm-adapter] -version = "=0.54.0" +version = "=0.54.1" [workspace] members = ["."] diff --git a/esdt-safe/Cargo.toml b/esdt-safe/Cargo.toml index c7e4268c..16789bf4 100644 --- a/esdt-safe/Cargo.toml +++ b/esdt-safe/Cargo.toml @@ -36,10 +36,10 @@ path = "../fee-market" path = "../header-verifier" [dependencies.multiversx-sc] -version = "=0.54.0" +version = "=0.54.1" [dependencies.multiversx-sc-modules] -version = "=0.54.0" +version = "=0.54.1" [dev-dependencies] num-bigint = "0.4.2" @@ -47,4 +47,4 @@ num-traits = "0.2" hex = "0.4" [dev-dependencies.multiversx-sc-scenario] -version = "=0.54.0" +version = "=0.54.1" diff --git a/esdt-safe/interactor/Cargo.toml b/esdt-safe/interactor/Cargo.toml index 871543da..ab2ae923 100644 --- a/esdt-safe/interactor/Cargo.toml +++ b/esdt-safe/interactor/Cargo.toml @@ -25,13 +25,13 @@ path = "../../common/tx-batch-module" path = "../../fee-market" [dependencies.multiversx-sc-snippets] -version = "0.54.0" +version = "0.54.1" [dependencies.multiversx-sc] -version = "0.54.0" +version = "0.54.1" [dependencies.multiversx-sc-scenario] -version = "=0.54.0" +version = "=0.54.1" [dependencies.clap] version = "4.4.7" diff --git a/esdt-safe/interactor/src/interactor_main.rs b/esdt-safe/interactor/src/interactor_main.rs index 74dc900c..e3a55540 100644 --- a/esdt-safe/interactor/src/interactor_main.rs +++ b/esdt-safe/interactor/src/interactor_main.rs @@ -163,7 +163,7 @@ struct ContractInteract { impl ContractInteract { async fn new() -> Self { - let mut interactor = Interactor::new(GATEWAY, false).await; + let mut interactor = Interactor::new(GATEWAY).await; interactor.set_current_dir_from_workspace("esdt-safe/interactor"); diff --git a/esdt-safe/meta/Cargo.toml b/esdt-safe/meta/Cargo.toml index ac415d02..3e66c0df 100644 --- a/esdt-safe/meta/Cargo.toml +++ b/esdt-safe/meta/Cargo.toml @@ -11,4 +11,4 @@ publish = false path = ".." [dependencies.multiversx-sc-meta-lib] -version = "=0.54.0" +version = "=0.54.1" diff --git a/esdt-safe/wasm-esdt-safe-full/Cargo.lock b/esdt-safe/wasm-esdt-safe-full/Cargo.lock index 12d2a31c..f53167c3 100644 --- a/esdt-safe/wasm-esdt-safe-full/Cargo.lock +++ b/esdt-safe/wasm-esdt-safe-full/Cargo.lock @@ -109,9 +109,9 @@ dependencies = [ [[package]] name = "multiversx-sc" -version = "0.54.0" +version = "0.54.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b9e5cee0b8c5fbaa9edfee2e38f2162adb01700a0028942d2cd14808cd26b130" +checksum = "c4abf60eb027d0b005a1778dc9d670a473065ab8e5bea22eeb6ace7f118dc36f" dependencies = [ "bitflags", "hex-literal", @@ -147,9 +147,9 @@ dependencies = [ [[package]] name = "multiversx-sc-derive" -version = "0.54.0" +version = "0.54.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "931669b080cf793b205bf08b5d1f4a658d0ac0ad628844d9a9d13649a73c7540" +checksum = "3caeda89d90190c4002f7482e934e3981968d6853f70f865d23c8d2938bd907b" dependencies = [ "hex", "proc-macro2", @@ -160,18 +160,18 @@ dependencies = [ [[package]] name = "multiversx-sc-modules" -version = "0.54.0" +version = "0.54.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5373903a01dd7d33547b83f0034dc6e12fbbc8e49fcb316a3efb6ef4ff6573a8" +checksum = "624f7a758e2d5dc3e87fd095cb76d47f3cf4b0cee41b5415aa95b8e323ffe162" dependencies = [ "multiversx-sc", ] [[package]] name = "multiversx-sc-wasm-adapter" -version = "0.54.0" +version = "0.54.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c034ae143cfd971cf0c4d67476af1920a9a0165bd99713458397ac06762fca0d" +checksum = "b10f0b29d4bcd7520e659ae2429ea9a4f02b7203a77d7788bebc79786babd250" dependencies = [ "multiversx-sc", ] diff --git a/esdt-safe/wasm-esdt-safe-full/Cargo.toml b/esdt-safe/wasm-esdt-safe-full/Cargo.toml index 718f70f9..d22b18e0 100644 --- a/esdt-safe/wasm-esdt-safe-full/Cargo.toml +++ b/esdt-safe/wasm-esdt-safe-full/Cargo.toml @@ -28,7 +28,7 @@ panic = "abort" path = ".." [dependencies.multiversx-sc-wasm-adapter] -version = "=0.54.0" +version = "=0.54.1" [workspace] members = ["."] diff --git a/esdt-safe/wasm-esdt-safe-view/Cargo.lock b/esdt-safe/wasm-esdt-safe-view/Cargo.lock index 3bb75c6d..f7cfff38 100644 --- a/esdt-safe/wasm-esdt-safe-view/Cargo.lock +++ b/esdt-safe/wasm-esdt-safe-view/Cargo.lock @@ -109,9 +109,9 @@ dependencies = [ [[package]] name = "multiversx-sc" -version = "0.54.0" +version = "0.54.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b9e5cee0b8c5fbaa9edfee2e38f2162adb01700a0028942d2cd14808cd26b130" +checksum = "c4abf60eb027d0b005a1778dc9d670a473065ab8e5bea22eeb6ace7f118dc36f" dependencies = [ "bitflags", "hex-literal", @@ -147,9 +147,9 @@ dependencies = [ [[package]] name = "multiversx-sc-derive" -version = "0.54.0" +version = "0.54.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "931669b080cf793b205bf08b5d1f4a658d0ac0ad628844d9a9d13649a73c7540" +checksum = "3caeda89d90190c4002f7482e934e3981968d6853f70f865d23c8d2938bd907b" dependencies = [ "hex", "proc-macro2", @@ -160,18 +160,18 @@ dependencies = [ [[package]] name = "multiversx-sc-modules" -version = "0.54.0" +version = "0.54.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5373903a01dd7d33547b83f0034dc6e12fbbc8e49fcb316a3efb6ef4ff6573a8" +checksum = "624f7a758e2d5dc3e87fd095cb76d47f3cf4b0cee41b5415aa95b8e323ffe162" dependencies = [ "multiversx-sc", ] [[package]] name = "multiversx-sc-wasm-adapter" -version = "0.54.0" +version = "0.54.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c034ae143cfd971cf0c4d67476af1920a9a0165bd99713458397ac06762fca0d" +checksum = "b10f0b29d4bcd7520e659ae2429ea9a4f02b7203a77d7788bebc79786babd250" dependencies = [ "multiversx-sc", ] diff --git a/esdt-safe/wasm-esdt-safe-view/Cargo.toml b/esdt-safe/wasm-esdt-safe-view/Cargo.toml index 0454607f..f293b5df 100644 --- a/esdt-safe/wasm-esdt-safe-view/Cargo.toml +++ b/esdt-safe/wasm-esdt-safe-view/Cargo.toml @@ -28,7 +28,7 @@ panic = "abort" path = ".." [dependencies.multiversx-sc-wasm-adapter] -version = "=0.54.0" +version = "=0.54.1" [workspace] members = ["."] diff --git a/esdt-safe/wasm/Cargo.lock b/esdt-safe/wasm/Cargo.lock index d54e9276..1fec290d 100644 --- a/esdt-safe/wasm/Cargo.lock +++ b/esdt-safe/wasm/Cargo.lock @@ -109,9 +109,9 @@ dependencies = [ [[package]] name = "multiversx-sc" -version = "0.54.0" +version = "0.54.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b9e5cee0b8c5fbaa9edfee2e38f2162adb01700a0028942d2cd14808cd26b130" +checksum = "c4abf60eb027d0b005a1778dc9d670a473065ab8e5bea22eeb6ace7f118dc36f" dependencies = [ "bitflags", "hex-literal", @@ -147,9 +147,9 @@ dependencies = [ [[package]] name = "multiversx-sc-derive" -version = "0.54.0" +version = "0.54.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "931669b080cf793b205bf08b5d1f4a658d0ac0ad628844d9a9d13649a73c7540" +checksum = "3caeda89d90190c4002f7482e934e3981968d6853f70f865d23c8d2938bd907b" dependencies = [ "hex", "proc-macro2", @@ -160,18 +160,18 @@ dependencies = [ [[package]] name = "multiversx-sc-modules" -version = "0.54.0" +version = "0.54.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5373903a01dd7d33547b83f0034dc6e12fbbc8e49fcb316a3efb6ef4ff6573a8" +checksum = "624f7a758e2d5dc3e87fd095cb76d47f3cf4b0cee41b5415aa95b8e323ffe162" dependencies = [ "multiversx-sc", ] [[package]] name = "multiversx-sc-wasm-adapter" -version = "0.54.0" +version = "0.54.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c034ae143cfd971cf0c4d67476af1920a9a0165bd99713458397ac06762fca0d" +checksum = "b10f0b29d4bcd7520e659ae2429ea9a4f02b7203a77d7788bebc79786babd250" dependencies = [ "multiversx-sc", ] diff --git a/esdt-safe/wasm/Cargo.toml b/esdt-safe/wasm/Cargo.toml index 4ec2b576..c17fba19 100644 --- a/esdt-safe/wasm/Cargo.toml +++ b/esdt-safe/wasm/Cargo.toml @@ -28,7 +28,7 @@ panic = "abort" path = ".." [dependencies.multiversx-sc-wasm-adapter] -version = "=0.54.0" +version = "=0.54.1" [workspace] members = ["."] diff --git a/fee-market/Cargo.toml b/fee-market/Cargo.toml index 40a568a3..0b3e3227 100644 --- a/fee-market/Cargo.toml +++ b/fee-market/Cargo.toml @@ -18,10 +18,10 @@ path = "../common/transaction" path = "../common/bls-signature" [dependencies.multiversx-sc] -version = "=0.54.0" +version = "=0.54.1" [dev-dependencies] num-bigint = "0.4.2" [dev-dependencies.multiversx-sc-scenario] -version = "=0.54.0" +version = "=0.54.1" diff --git a/fee-market/meta/Cargo.toml b/fee-market/meta/Cargo.toml index 5cc16f7b..ec6a6c70 100644 --- a/fee-market/meta/Cargo.toml +++ b/fee-market/meta/Cargo.toml @@ -8,5 +8,5 @@ publish = false path = ".." [dependencies.multiversx-sc-meta-lib] -version = "=0.54.0" +version = "=0.54.1" default-features = false diff --git a/fee-market/wasm-fee-market/Cargo.lock b/fee-market/wasm-fee-market/Cargo.lock index a891b798..73562e34 100644 --- a/fee-market/wasm-fee-market/Cargo.lock +++ b/fee-market/wasm-fee-market/Cargo.lock @@ -76,9 +76,9 @@ dependencies = [ [[package]] name = "multiversx-sc" -version = "0.54.0" +version = "0.54.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b9e5cee0b8c5fbaa9edfee2e38f2162adb01700a0028942d2cd14808cd26b130" +checksum = "c4abf60eb027d0b005a1778dc9d670a473065ab8e5bea22eeb6ace7f118dc36f" dependencies = [ "bitflags", "hex-literal", @@ -114,9 +114,9 @@ dependencies = [ [[package]] name = "multiversx-sc-derive" -version = "0.54.0" +version = "0.54.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "931669b080cf793b205bf08b5d1f4a658d0ac0ad628844d9a9d13649a73c7540" +checksum = "3caeda89d90190c4002f7482e934e3981968d6853f70f865d23c8d2938bd907b" dependencies = [ "hex", "proc-macro2", @@ -127,9 +127,9 @@ dependencies = [ [[package]] name = "multiversx-sc-wasm-adapter" -version = "0.54.0" +version = "0.54.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c034ae143cfd971cf0c4d67476af1920a9a0165bd99713458397ac06762fca0d" +checksum = "b10f0b29d4bcd7520e659ae2429ea9a4f02b7203a77d7788bebc79786babd250" dependencies = [ "multiversx-sc", ] diff --git a/fee-market/wasm-fee-market/Cargo.toml b/fee-market/wasm-fee-market/Cargo.toml index cdf095e2..5883c024 100644 --- a/fee-market/wasm-fee-market/Cargo.toml +++ b/fee-market/wasm-fee-market/Cargo.toml @@ -28,7 +28,7 @@ panic = "abort" path = ".." [dependencies.multiversx-sc-wasm-adapter] -version = "=0.54.0" +version = "=0.54.1" [workspace] members = ["."] diff --git a/fee-market/wasm-multisig-view/Cargo.lock b/fee-market/wasm-multisig-view/Cargo.lock index 3af841e5..eec0173c 100644 --- a/fee-market/wasm-multisig-view/Cargo.lock +++ b/fee-market/wasm-multisig-view/Cargo.lock @@ -76,9 +76,9 @@ dependencies = [ [[package]] name = "multiversx-sc" -version = "0.54.0" +version = "0.54.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b9e5cee0b8c5fbaa9edfee2e38f2162adb01700a0028942d2cd14808cd26b130" +checksum = "c4abf60eb027d0b005a1778dc9d670a473065ab8e5bea22eeb6ace7f118dc36f" dependencies = [ "bitflags", "hex-literal", @@ -114,9 +114,9 @@ dependencies = [ [[package]] name = "multiversx-sc-derive" -version = "0.54.0" +version = "0.54.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "931669b080cf793b205bf08b5d1f4a658d0ac0ad628844d9a9d13649a73c7540" +checksum = "3caeda89d90190c4002f7482e934e3981968d6853f70f865d23c8d2938bd907b" dependencies = [ "hex", "proc-macro2", @@ -127,9 +127,9 @@ dependencies = [ [[package]] name = "multiversx-sc-wasm-adapter" -version = "0.54.0" +version = "0.54.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c034ae143cfd971cf0c4d67476af1920a9a0165bd99713458397ac06762fca0d" +checksum = "b10f0b29d4bcd7520e659ae2429ea9a4f02b7203a77d7788bebc79786babd250" dependencies = [ "multiversx-sc", ] diff --git a/fee-market/wasm-multisig-view/Cargo.toml b/fee-market/wasm-multisig-view/Cargo.toml index 9923d939..c2d7e362 100644 --- a/fee-market/wasm-multisig-view/Cargo.toml +++ b/fee-market/wasm-multisig-view/Cargo.toml @@ -28,7 +28,7 @@ panic = "abort" path = ".." [dependencies.multiversx-sc-wasm-adapter] -version = "=0.54.0" +version = "=0.54.1" [workspace] members = ["."] diff --git a/fee-market/wasm/Cargo.lock b/fee-market/wasm/Cargo.lock index a891b798..73562e34 100644 --- a/fee-market/wasm/Cargo.lock +++ b/fee-market/wasm/Cargo.lock @@ -76,9 +76,9 @@ dependencies = [ [[package]] name = "multiversx-sc" -version = "0.54.0" +version = "0.54.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b9e5cee0b8c5fbaa9edfee2e38f2162adb01700a0028942d2cd14808cd26b130" +checksum = "c4abf60eb027d0b005a1778dc9d670a473065ab8e5bea22eeb6ace7f118dc36f" dependencies = [ "bitflags", "hex-literal", @@ -114,9 +114,9 @@ dependencies = [ [[package]] name = "multiversx-sc-derive" -version = "0.54.0" +version = "0.54.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "931669b080cf793b205bf08b5d1f4a658d0ac0ad628844d9a9d13649a73c7540" +checksum = "3caeda89d90190c4002f7482e934e3981968d6853f70f865d23c8d2938bd907b" dependencies = [ "hex", "proc-macro2", @@ -127,9 +127,9 @@ dependencies = [ [[package]] name = "multiversx-sc-wasm-adapter" -version = "0.54.0" +version = "0.54.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c034ae143cfd971cf0c4d67476af1920a9a0165bd99713458397ac06762fca0d" +checksum = "b10f0b29d4bcd7520e659ae2429ea9a4f02b7203a77d7788bebc79786babd250" dependencies = [ "multiversx-sc", ] diff --git a/fee-market/wasm/Cargo.toml b/fee-market/wasm/Cargo.toml index cdf095e2..5883c024 100644 --- a/fee-market/wasm/Cargo.toml +++ b/fee-market/wasm/Cargo.toml @@ -28,7 +28,7 @@ panic = "abort" path = ".." [dependencies.multiversx-sc-wasm-adapter] -version = "=0.54.0" +version = "=0.54.1" [workspace] members = ["."] diff --git a/header-verifier/Cargo.toml b/header-verifier/Cargo.toml index 1347c179..97e0227d 100644 --- a/header-verifier/Cargo.toml +++ b/header-verifier/Cargo.toml @@ -9,7 +9,7 @@ publish = false path = "src/lib.rs" [dependencies.multiversx-sc] -version = "0.54.0" +version = "0.54.1" [dependencies.bls-signature] path = "../common/bls-signature" @@ -21,4 +21,4 @@ path = "../common/transaction" num-bigint = "0.4.2" [dev-dependencies.multiversx-sc-scenario] -version = "0.54.0" +version = "0.54.1" diff --git a/header-verifier/meta/Cargo.toml b/header-verifier/meta/Cargo.toml index 3d50f525..c46cbf92 100644 --- a/header-verifier/meta/Cargo.toml +++ b/header-verifier/meta/Cargo.toml @@ -8,5 +8,5 @@ publish = false path = ".." [dependencies.multiversx-sc-meta-lib] -version = "0.54.0" +version = "0.54.1" default-features = false diff --git a/header-verifier/wasm-header-verifier-full/Cargo.lock b/header-verifier/wasm-header-verifier-full/Cargo.lock index 6adaa848..4877a574 100644 --- a/header-verifier/wasm-header-verifier-full/Cargo.lock +++ b/header-verifier/wasm-header-verifier-full/Cargo.lock @@ -75,9 +75,9 @@ dependencies = [ [[package]] name = "multiversx-sc" -version = "0.54.0" +version = "0.54.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b9e5cee0b8c5fbaa9edfee2e38f2162adb01700a0028942d2cd14808cd26b130" +checksum = "c4abf60eb027d0b005a1778dc9d670a473065ab8e5bea22eeb6ace7f118dc36f" dependencies = [ "bitflags", "hex-literal", @@ -113,9 +113,9 @@ dependencies = [ [[package]] name = "multiversx-sc-derive" -version = "0.54.0" +version = "0.54.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "931669b080cf793b205bf08b5d1f4a658d0ac0ad628844d9a9d13649a73c7540" +checksum = "3caeda89d90190c4002f7482e934e3981968d6853f70f865d23c8d2938bd907b" dependencies = [ "hex", "proc-macro2", @@ -126,9 +126,9 @@ dependencies = [ [[package]] name = "multiversx-sc-wasm-adapter" -version = "0.54.0" +version = "0.54.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c034ae143cfd971cf0c4d67476af1920a9a0165bd99713458397ac06762fca0d" +checksum = "b10f0b29d4bcd7520e659ae2429ea9a4f02b7203a77d7788bebc79786babd250" dependencies = [ "multiversx-sc", ] diff --git a/header-verifier/wasm-header-verifier-full/Cargo.toml b/header-verifier/wasm-header-verifier-full/Cargo.toml index 5007a7fa..4555b5bf 100644 --- a/header-verifier/wasm-header-verifier-full/Cargo.toml +++ b/header-verifier/wasm-header-verifier-full/Cargo.toml @@ -28,7 +28,7 @@ panic = "abort" path = ".." [dependencies.multiversx-sc-wasm-adapter] -version = "0.54.0" +version = "0.54.1" [workspace] members = ["."] diff --git a/header-verifier/wasm-multisig-view/Cargo.lock b/header-verifier/wasm-multisig-view/Cargo.lock index 6c70bd0b..e220f320 100644 --- a/header-verifier/wasm-multisig-view/Cargo.lock +++ b/header-verifier/wasm-multisig-view/Cargo.lock @@ -75,9 +75,9 @@ dependencies = [ [[package]] name = "multiversx-sc" -version = "0.54.0" +version = "0.54.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b9e5cee0b8c5fbaa9edfee2e38f2162adb01700a0028942d2cd14808cd26b130" +checksum = "c4abf60eb027d0b005a1778dc9d670a473065ab8e5bea22eeb6ace7f118dc36f" dependencies = [ "bitflags", "hex-literal", @@ -113,9 +113,9 @@ dependencies = [ [[package]] name = "multiversx-sc-derive" -version = "0.54.0" +version = "0.54.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "931669b080cf793b205bf08b5d1f4a658d0ac0ad628844d9a9d13649a73c7540" +checksum = "3caeda89d90190c4002f7482e934e3981968d6853f70f865d23c8d2938bd907b" dependencies = [ "hex", "proc-macro2", @@ -126,9 +126,9 @@ dependencies = [ [[package]] name = "multiversx-sc-wasm-adapter" -version = "0.54.0" +version = "0.54.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c034ae143cfd971cf0c4d67476af1920a9a0165bd99713458397ac06762fca0d" +checksum = "b10f0b29d4bcd7520e659ae2429ea9a4f02b7203a77d7788bebc79786babd250" dependencies = [ "multiversx-sc", ] diff --git a/header-verifier/wasm-multisig-view/Cargo.toml b/header-verifier/wasm-multisig-view/Cargo.toml index a8715457..9a5a9034 100644 --- a/header-verifier/wasm-multisig-view/Cargo.toml +++ b/header-verifier/wasm-multisig-view/Cargo.toml @@ -28,7 +28,7 @@ panic = "abort" path = ".." [dependencies.multiversx-sc-wasm-adapter] -version = "0.54.0" +version = "0.54.1" [workspace] members = ["."] diff --git a/header-verifier/wasm/Cargo.lock b/header-verifier/wasm/Cargo.lock index 8a04f786..c691fd0e 100644 --- a/header-verifier/wasm/Cargo.lock +++ b/header-verifier/wasm/Cargo.lock @@ -75,9 +75,9 @@ dependencies = [ [[package]] name = "multiversx-sc" -version = "0.54.0" +version = "0.54.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b9e5cee0b8c5fbaa9edfee2e38f2162adb01700a0028942d2cd14808cd26b130" +checksum = "c4abf60eb027d0b005a1778dc9d670a473065ab8e5bea22eeb6ace7f118dc36f" dependencies = [ "bitflags", "hex-literal", @@ -113,9 +113,9 @@ dependencies = [ [[package]] name = "multiversx-sc-derive" -version = "0.54.0" +version = "0.54.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "931669b080cf793b205bf08b5d1f4a658d0ac0ad628844d9a9d13649a73c7540" +checksum = "3caeda89d90190c4002f7482e934e3981968d6853f70f865d23c8d2938bd907b" dependencies = [ "hex", "proc-macro2", @@ -126,9 +126,9 @@ dependencies = [ [[package]] name = "multiversx-sc-wasm-adapter" -version = "0.54.0" +version = "0.54.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c034ae143cfd971cf0c4d67476af1920a9a0165bd99713458397ac06762fca0d" +checksum = "b10f0b29d4bcd7520e659ae2429ea9a4f02b7203a77d7788bebc79786babd250" dependencies = [ "multiversx-sc", ] diff --git a/header-verifier/wasm/Cargo.toml b/header-verifier/wasm/Cargo.toml index b543f73d..9f64455f 100644 --- a/header-verifier/wasm/Cargo.toml +++ b/header-verifier/wasm/Cargo.toml @@ -28,7 +28,7 @@ panic = "abort" path = ".." [dependencies.multiversx-sc-wasm-adapter] -version = "0.54.0" +version = "0.54.1" [workspace] members = ["."] diff --git a/testing-sc/Cargo.toml b/testing-sc/Cargo.toml index 0b24d91b..8b9a83f6 100644 --- a/testing-sc/Cargo.toml +++ b/testing-sc/Cargo.toml @@ -9,10 +9,10 @@ authors = ["you"] path = "src/lib.rs" [dependencies.multiversx-sc] -version = "0.54.0" +version = "0.54.1" [dev-dependencies] num-bigint = "0.4" [dev-dependencies.multiversx-sc-scenario] -version = "0.54.0" +version = "0.54.1" diff --git a/testing-sc/meta/Cargo.toml b/testing-sc/meta/Cargo.toml index b23dbb53..abb59075 100644 --- a/testing-sc/meta/Cargo.toml +++ b/testing-sc/meta/Cargo.toml @@ -8,5 +8,5 @@ publish = false path = ".." [dependencies.multiversx-sc-meta-lib] -version = "0.54.0" +version = "0.54.1" default-features = false diff --git a/testing-sc/wasm-testing-sc-full/Cargo.lock b/testing-sc/wasm-testing-sc-full/Cargo.lock index fe127258..475df976 100644 --- a/testing-sc/wasm-testing-sc-full/Cargo.lock +++ b/testing-sc/wasm-testing-sc-full/Cargo.lock @@ -50,9 +50,9 @@ dependencies = [ [[package]] name = "multiversx-sc" -version = "0.54.0" +version = "0.54.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b9e5cee0b8c5fbaa9edfee2e38f2162adb01700a0028942d2cd14808cd26b130" +checksum = "c4abf60eb027d0b005a1778dc9d670a473065ab8e5bea22eeb6ace7f118dc36f" dependencies = [ "bitflags", "hex-literal", @@ -88,9 +88,9 @@ dependencies = [ [[package]] name = "multiversx-sc-derive" -version = "0.54.0" +version = "0.54.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "931669b080cf793b205bf08b5d1f4a658d0ac0ad628844d9a9d13649a73c7540" +checksum = "3caeda89d90190c4002f7482e934e3981968d6853f70f865d23c8d2938bd907b" dependencies = [ "hex", "proc-macro2", @@ -101,9 +101,9 @@ dependencies = [ [[package]] name = "multiversx-sc-wasm-adapter" -version = "0.54.0" +version = "0.54.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c034ae143cfd971cf0c4d67476af1920a9a0165bd99713458397ac06762fca0d" +checksum = "b10f0b29d4bcd7520e659ae2429ea9a4f02b7203a77d7788bebc79786babd250" dependencies = [ "multiversx-sc", ] diff --git a/testing-sc/wasm-testing-sc-full/Cargo.toml b/testing-sc/wasm-testing-sc-full/Cargo.toml index 29e03c4e..1b78e120 100644 --- a/testing-sc/wasm-testing-sc-full/Cargo.toml +++ b/testing-sc/wasm-testing-sc-full/Cargo.toml @@ -28,7 +28,7 @@ panic = "abort" path = ".." [dependencies.multiversx-sc-wasm-adapter] -version = "0.54.0" +version = "0.54.1" [workspace] members = ["."] diff --git a/testing-sc/wasm-testing-view/Cargo.lock b/testing-sc/wasm-testing-view/Cargo.lock index 137149ed..2295daf1 100644 --- a/testing-sc/wasm-testing-view/Cargo.lock +++ b/testing-sc/wasm-testing-view/Cargo.lock @@ -50,9 +50,9 @@ dependencies = [ [[package]] name = "multiversx-sc" -version = "0.54.0" +version = "0.54.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b9e5cee0b8c5fbaa9edfee2e38f2162adb01700a0028942d2cd14808cd26b130" +checksum = "c4abf60eb027d0b005a1778dc9d670a473065ab8e5bea22eeb6ace7f118dc36f" dependencies = [ "bitflags", "hex-literal", @@ -88,9 +88,9 @@ dependencies = [ [[package]] name = "multiversx-sc-derive" -version = "0.54.0" +version = "0.54.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "931669b080cf793b205bf08b5d1f4a658d0ac0ad628844d9a9d13649a73c7540" +checksum = "3caeda89d90190c4002f7482e934e3981968d6853f70f865d23c8d2938bd907b" dependencies = [ "hex", "proc-macro2", @@ -101,9 +101,9 @@ dependencies = [ [[package]] name = "multiversx-sc-wasm-adapter" -version = "0.54.0" +version = "0.54.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c034ae143cfd971cf0c4d67476af1920a9a0165bd99713458397ac06762fca0d" +checksum = "b10f0b29d4bcd7520e659ae2429ea9a4f02b7203a77d7788bebc79786babd250" dependencies = [ "multiversx-sc", ] diff --git a/testing-sc/wasm-testing-view/Cargo.toml b/testing-sc/wasm-testing-view/Cargo.toml index 87df5ce0..671dc140 100644 --- a/testing-sc/wasm-testing-view/Cargo.toml +++ b/testing-sc/wasm-testing-view/Cargo.toml @@ -28,7 +28,7 @@ panic = "abort" path = ".." [dependencies.multiversx-sc-wasm-adapter] -version = "0.54.0" +version = "0.54.1" [workspace] members = ["."] diff --git a/testing-sc/wasm/Cargo.lock b/testing-sc/wasm/Cargo.lock index 39cf87db..c10ff672 100644 --- a/testing-sc/wasm/Cargo.lock +++ b/testing-sc/wasm/Cargo.lock @@ -50,9 +50,9 @@ dependencies = [ [[package]] name = "multiversx-sc" -version = "0.54.0" +version = "0.54.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b9e5cee0b8c5fbaa9edfee2e38f2162adb01700a0028942d2cd14808cd26b130" +checksum = "c4abf60eb027d0b005a1778dc9d670a473065ab8e5bea22eeb6ace7f118dc36f" dependencies = [ "bitflags", "hex-literal", @@ -88,9 +88,9 @@ dependencies = [ [[package]] name = "multiversx-sc-derive" -version = "0.54.0" +version = "0.54.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "931669b080cf793b205bf08b5d1f4a658d0ac0ad628844d9a9d13649a73c7540" +checksum = "3caeda89d90190c4002f7482e934e3981968d6853f70f865d23c8d2938bd907b" dependencies = [ "hex", "proc-macro2", @@ -101,9 +101,9 @@ dependencies = [ [[package]] name = "multiversx-sc-wasm-adapter" -version = "0.54.0" +version = "0.54.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c034ae143cfd971cf0c4d67476af1920a9a0165bd99713458397ac06762fca0d" +checksum = "b10f0b29d4bcd7520e659ae2429ea9a4f02b7203a77d7788bebc79786babd250" dependencies = [ "multiversx-sc", ] diff --git a/testing-sc/wasm/Cargo.toml b/testing-sc/wasm/Cargo.toml index 557b4faa..203102f8 100644 --- a/testing-sc/wasm/Cargo.toml +++ b/testing-sc/wasm/Cargo.toml @@ -28,7 +28,7 @@ panic = "abort" path = ".." [dependencies.multiversx-sc-wasm-adapter] -version = "0.54.0" +version = "0.54.1" [workspace] members = ["."] diff --git a/token-handler/Cargo.toml b/token-handler/Cargo.toml index d67933e6..c7e06783 100644 --- a/token-handler/Cargo.toml +++ b/token-handler/Cargo.toml @@ -18,10 +18,10 @@ path = "../header-verifier/" path = "../chain-factory/" [dependencies.multiversx-sc] -version = "0.54.0" +version = "0.54.1" [dev-dependencies] num-bigint = "0.4" [dev-dependencies.multiversx-sc-scenario] -version = "0.54.0" +version = "0.54.1" diff --git a/token-handler/meta/Cargo.toml b/token-handler/meta/Cargo.toml index 270033f9..24cd8be3 100644 --- a/token-handler/meta/Cargo.toml +++ b/token-handler/meta/Cargo.toml @@ -8,5 +8,5 @@ publish = false path = ".." [dependencies.multiversx-sc-meta-lib] -version = "0.54.0" +version = "0.54.1" default-features = false diff --git a/token-handler/wasm-token-handler-full/Cargo.lock b/token-handler/wasm-token-handler-full/Cargo.lock index 29aed875..50222dcf 100644 --- a/token-handler/wasm-token-handler-full/Cargo.lock +++ b/token-handler/wasm-token-handler-full/Cargo.lock @@ -85,9 +85,9 @@ dependencies = [ [[package]] name = "multiversx-sc" -version = "0.54.0" +version = "0.54.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b9e5cee0b8c5fbaa9edfee2e38f2162adb01700a0028942d2cd14808cd26b130" +checksum = "c4abf60eb027d0b005a1778dc9d670a473065ab8e5bea22eeb6ace7f118dc36f" dependencies = [ "bitflags", "hex-literal", @@ -123,9 +123,9 @@ dependencies = [ [[package]] name = "multiversx-sc-derive" -version = "0.54.0" +version = "0.54.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "931669b080cf793b205bf08b5d1f4a658d0ac0ad628844d9a9d13649a73c7540" +checksum = "3caeda89d90190c4002f7482e934e3981968d6853f70f865d23c8d2938bd907b" dependencies = [ "hex", "proc-macro2", @@ -136,18 +136,18 @@ dependencies = [ [[package]] name = "multiversx-sc-modules" -version = "0.54.0" +version = "0.54.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5373903a01dd7d33547b83f0034dc6e12fbbc8e49fcb316a3efb6ef4ff6573a8" +checksum = "624f7a758e2d5dc3e87fd095cb76d47f3cf4b0cee41b5415aa95b8e323ffe162" dependencies = [ "multiversx-sc", ] [[package]] name = "multiversx-sc-wasm-adapter" -version = "0.54.0" +version = "0.54.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c034ae143cfd971cf0c4d67476af1920a9a0165bd99713458397ac06762fca0d" +checksum = "b10f0b29d4bcd7520e659ae2429ea9a4f02b7203a77d7788bebc79786babd250" dependencies = [ "multiversx-sc", ] diff --git a/token-handler/wasm-token-handler-full/Cargo.toml b/token-handler/wasm-token-handler-full/Cargo.toml index 7e4194fb..6e4e4b5c 100644 --- a/token-handler/wasm-token-handler-full/Cargo.toml +++ b/token-handler/wasm-token-handler-full/Cargo.toml @@ -28,7 +28,7 @@ panic = "abort" path = ".." [dependencies.multiversx-sc-wasm-adapter] -version = "0.54.0" +version = "0.54.1" [workspace] members = ["."] diff --git a/token-handler/wasm-token-handler-view/Cargo.lock b/token-handler/wasm-token-handler-view/Cargo.lock index e085fbe3..4f307afe 100644 --- a/token-handler/wasm-token-handler-view/Cargo.lock +++ b/token-handler/wasm-token-handler-view/Cargo.lock @@ -85,9 +85,9 @@ dependencies = [ [[package]] name = "multiversx-sc" -version = "0.54.0" +version = "0.54.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b9e5cee0b8c5fbaa9edfee2e38f2162adb01700a0028942d2cd14808cd26b130" +checksum = "c4abf60eb027d0b005a1778dc9d670a473065ab8e5bea22eeb6ace7f118dc36f" dependencies = [ "bitflags", "hex-literal", @@ -123,9 +123,9 @@ dependencies = [ [[package]] name = "multiversx-sc-derive" -version = "0.54.0" +version = "0.54.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "931669b080cf793b205bf08b5d1f4a658d0ac0ad628844d9a9d13649a73c7540" +checksum = "3caeda89d90190c4002f7482e934e3981968d6853f70f865d23c8d2938bd907b" dependencies = [ "hex", "proc-macro2", @@ -136,18 +136,18 @@ dependencies = [ [[package]] name = "multiversx-sc-modules" -version = "0.54.0" +version = "0.54.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5373903a01dd7d33547b83f0034dc6e12fbbc8e49fcb316a3efb6ef4ff6573a8" +checksum = "624f7a758e2d5dc3e87fd095cb76d47f3cf4b0cee41b5415aa95b8e323ffe162" dependencies = [ "multiversx-sc", ] [[package]] name = "multiversx-sc-wasm-adapter" -version = "0.54.0" +version = "0.54.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c034ae143cfd971cf0c4d67476af1920a9a0165bd99713458397ac06762fca0d" +checksum = "b10f0b29d4bcd7520e659ae2429ea9a4f02b7203a77d7788bebc79786babd250" dependencies = [ "multiversx-sc", ] diff --git a/token-handler/wasm-token-handler-view/Cargo.toml b/token-handler/wasm-token-handler-view/Cargo.toml index a549ed7d..26b6d074 100644 --- a/token-handler/wasm-token-handler-view/Cargo.toml +++ b/token-handler/wasm-token-handler-view/Cargo.toml @@ -28,7 +28,7 @@ panic = "abort" path = ".." [dependencies.multiversx-sc-wasm-adapter] -version = "0.54.0" +version = "0.54.1" [workspace] members = ["."] diff --git a/token-handler/wasm/Cargo.lock b/token-handler/wasm/Cargo.lock index c06aaa74..2d212d9b 100644 --- a/token-handler/wasm/Cargo.lock +++ b/token-handler/wasm/Cargo.lock @@ -85,9 +85,9 @@ dependencies = [ [[package]] name = "multiversx-sc" -version = "0.54.0" +version = "0.54.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b9e5cee0b8c5fbaa9edfee2e38f2162adb01700a0028942d2cd14808cd26b130" +checksum = "c4abf60eb027d0b005a1778dc9d670a473065ab8e5bea22eeb6ace7f118dc36f" dependencies = [ "bitflags", "hex-literal", @@ -123,9 +123,9 @@ dependencies = [ [[package]] name = "multiversx-sc-derive" -version = "0.54.0" +version = "0.54.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "931669b080cf793b205bf08b5d1f4a658d0ac0ad628844d9a9d13649a73c7540" +checksum = "3caeda89d90190c4002f7482e934e3981968d6853f70f865d23c8d2938bd907b" dependencies = [ "hex", "proc-macro2", @@ -136,18 +136,18 @@ dependencies = [ [[package]] name = "multiversx-sc-modules" -version = "0.54.0" +version = "0.54.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5373903a01dd7d33547b83f0034dc6e12fbbc8e49fcb316a3efb6ef4ff6573a8" +checksum = "624f7a758e2d5dc3e87fd095cb76d47f3cf4b0cee41b5415aa95b8e323ffe162" dependencies = [ "multiversx-sc", ] [[package]] name = "multiversx-sc-wasm-adapter" -version = "0.54.0" +version = "0.54.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c034ae143cfd971cf0c4d67476af1920a9a0165bd99713458397ac06762fca0d" +checksum = "b10f0b29d4bcd7520e659ae2429ea9a4f02b7203a77d7788bebc79786babd250" dependencies = [ "multiversx-sc", ] diff --git a/token-handler/wasm/Cargo.toml b/token-handler/wasm/Cargo.toml index a0b8939c..b1790e3f 100644 --- a/token-handler/wasm/Cargo.toml +++ b/token-handler/wasm/Cargo.toml @@ -28,7 +28,7 @@ panic = "abort" path = ".." [dependencies.multiversx-sc-wasm-adapter] -version = "0.54.0" +version = "0.54.1" [workspace] members = ["."] From 99383b6ad14ab319b06d048d95f44133f7b62dcb Mon Sep 17 00:00:00 2001 From: Andrei Baltariu Date: Fri, 15 Nov 2024 10:41:53 +0200 Subject: [PATCH 523/523] Updated proxy and cargo.lock Signed-off-by: Andrei Baltariu --- Cargo.lock | 843 ++---------------- .../src/proxies/fee_market_proxy.rs | 24 +- 2 files changed, 106 insertions(+), 761 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 1e19b7c6..37d03c6f 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -4,18 +4,18 @@ version = 3 [[package]] name = "addr2line" -version = "0.22.0" +version = "0.24.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6e4503c46a5c0c7844e948c9a4d6acd9f50cccb4de1c48eb9e291ea17470c678" +checksum = "dfbe277e56a376000877090da837660b4427aad530e3028d44e0bffe4f89a1c1" dependencies = [ "gimli", ] [[package]] -name = "adler" -version = "1.0.2" +name = "adler2" +version = "2.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f26201604c87b1e01bd3d98f8d5d9a8fcbb815e8cedb41ffccbeb4bf593a35fe" +checksum = "512761e0bb2578dd7380c6baaa0f4ce03e84f95e960231d1dec8bf4d7d6e2627" [[package]] name = "aes" @@ -49,15 +49,6 @@ dependencies = [ "memchr", ] -[[package]] -name = "anstream" -version = "0.6.13" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8e60d3430d3a69478ad0993f19238d2df97c507009a52b3c10addcd7f6bcb916" -dependencies = [ - "memchr", -] - [[package]] name = "anstream" version = "0.6.18" @@ -140,21 +131,6 @@ dependencies = [ "windows-targets 0.52.6", ] -[[package]] -name = "backtrace" -version = "0.3.73" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5cc23269a4f8976d0a4d2e7109211a419fe30e8d88d677cd60b6bc79c5732e0a" -dependencies = [ - "addr2line", - "cc", - "cfg-if", - "libc", - "miniz_oxide", - "object", - "rustc-demangle", -] - [[package]] name = "base64" version = "0.22.1" @@ -232,17 +208,23 @@ version = "3.16.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "79296716171880943b8470b5f8d03aa55eb2e645a4874bdbb28adb49162e012c" +[[package]] +name = "byteorder" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1fd0f2584146f6f2ef48085050886acf353beff7305ebd1ae69500e27c67f64b" + [[package]] name = "bytes" -version = "1.7.2" +version = "1.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "428d9aa8fbc0670b7b8d6030a7fadd0f86151cae55e4dbbece15f3780a3dfaf3" +checksum = "9ac0150caa2ae65ca5bd83f25c7de183dea78d4d366469f148435e2acfbad0da" [[package]] name = "cc" -version = "1.1.28" +version = "1.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2e80e3b6a3ab07840e1cae9b0666a63970dc28e8ed5ffbcdacbfc760c281bfc1" +checksum = "fd9de9f2205d5ef3fd67e685b0df337994ddd4495e2a28d185500d0e1edfea47" dependencies = [ "shlex", ] @@ -301,16 +283,6 @@ dependencies = [ "inout", ] -[[package]] -name = "clap" -version = "4.5.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "773f3b9af64447d2ce9850330c473515014aa235e6a783b02db81ff39e4a3dad" -dependencies = [ - "crypto-common", - "inout", -] - [[package]] name = "clap" version = "4.5.21" @@ -398,22 +370,6 @@ version = "0.8.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "773648b94d0e5d620f64f280777445740e61fe701025087ec8b57f45c791888b" -[[package]] -name = "cpufeatures" -version = "0.2.12" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "91e195e091a93c46f7102ec7818a2aa394e1e1771c3ab4825963fa03e45afb8f" -dependencies = [ - "core-foundation-sys", - "libc", -] - -[[package]] -name = "core-foundation-sys" -version = "0.8.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "773648b94d0e5d620f64f280777445740e61fe701025087ec8b57f45c791888b" - [[package]] name = "cpufeatures" version = "0.2.15" @@ -490,6 +446,17 @@ dependencies = [ "subtle", ] +[[package]] +name = "displaydoc" +version = "0.2.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "97369cbbc041bc366949bc74d34658d6cda5621039731c6310521892a3a20ae0" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + [[package]] name = "ed25519" version = "2.2.3" @@ -626,9 +593,9 @@ dependencies = [ [[package]] name = "fastrand" -version = "2.1.1" +version = "2.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e8c02a5121d4ea3eb16a80748c74f5549a5665e4c21333c6098f283870fbdea6" +checksum = "486f806e73c5707928240ddc295403b1b93c96a02038563881c4a2fd84b81ac4" [[package]] name = "fee-market" @@ -798,13 +765,7 @@ dependencies = [ [[package]] name = "gimli" -version = "0.29.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "40ecd4077b5ae9fd2e9e169b102c6c330d0605168eb0e8bf79952b256dbefffd" - -[[package]] -name = "hashbrown" -version = "0.14.3" +version = "0.31.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "07e28edb80900c19c28f1072f2e8aeca7fa06b23cd4169cefe1af5aa3260783f" @@ -928,125 +889,6 @@ version = "2.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9a3a5bfb195931eeb336b2a7b4d761daec841b97f947d34394601737a7bba5e4" -[[package]] -name = "hyper" -version = "1.4.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "50dfd22e0e76d0f662d429a5f80fcaf3855009297eab6a0a9f8543834744ba05" -dependencies = [ - "bytes", - "futures-channel", - "futures-util", - "http", - "http-body", - "httparse", - "itoa", - "pin-project-lite", - "smallvec", - "tokio", - "want", -] - -[[package]] -name = "hyper-tls" -version = "0.6.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "70206fc6890eaca9fde8a0bf71caa2ddfc9fe045ac9e5c70df101a7dbde866e0" -dependencies = [ - "bytes", - "http-body-util", - "hyper", - "hyper-util", - "native-tls", - "tokio", - "tokio-native-tls", - "tower-service", -] - -[[package]] -name = "hyper-util" -version = "0.1.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "41296eb09f183ac68eec06e03cdbea2e759633d4067b2f6552fc2e009bcad08b" -dependencies = [ - "bytes", - "futures-channel", - "futures-util", - "http", - "http-body", - "hyper", - "pin-project-lite", - "socket2", - "tokio", - "tower-service", - "tracing", -] - -[[package]] -name = "idna" -version = "0.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "634d9b1461af396cad843f47fdba5597a4f9e6ddd4bfb6ff5d85028c25cb12f6" -dependencies = [ - "unicode-bidi", - "unicode-normalization", -] - -[[package]] -name = "indexmap" -version = "2.2.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6c49c37c09c17a53d937dfbb742eb3a961d65a994e6bcdcf37e7399d0cc8ab5e" -dependencies = [ - "digest", -] - -[[package]] -name = "http" -version = "1.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "21b9ddb458710bc376481b842f5da65cdf31522de232c1ca8146abce2a358258" -dependencies = [ - "bytes", - "fnv", - "itoa", -] - -[[package]] -name = "http-body" -version = "1.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1efedce1fb8e6913f23e0c92de8e62cd5b772a67e7b3946df930a62566c93184" -dependencies = [ - "bytes", - "http", -] - -[[package]] -name = "http-body-util" -version = "0.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "793429d76616a256bcb62c2a2ec2bed781c8307e797e2598c50010f2bee2544f" -dependencies = [ - "bytes", - "futures-util", - "http", - "http-body", - "pin-project-lite", -] - -[[package]] -name = "httparse" -version = "1.9.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7d71d3574edd2771538b901e6549113b4006ece66150fb69c0fb6d9a2adae946" - -[[package]] -name = "humantime" -version = "2.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9a3a5bfb195931eeb336b2a7b4d761daec841b97f947d34394601737a7bba5e4" - [[package]] name = "hyper" version = "1.5.0" @@ -1266,6 +1108,12 @@ version = "2.10.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ddc24109865250148c2e0f3d25d4f0f479571723792d3802153c60922a4fb708" +[[package]] +name = "is_terminal_polyfill" +version = "1.70.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7943c866cc5cd64cbc25b2e01621d07fa8eb2a1a23160ee81ce38704e97b8ecf" + [[package]] name = "itertools" version = "0.13.0" @@ -1283,9 +1131,9 @@ checksum = "49f1f14873335454500d59611f1cf4a4b0f786f9ac11f4312a78e4cf2566695b" [[package]] name = "js-sys" -version = "0.3.70" +version = "0.3.72" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1868808506b929d7b0cfa8f75951347aa71bb21144b7791bae35d9bccfcfe37a" +checksum = "6a88f1bda2bd75b0452a14784937d796722fdebfe50df998aeb3f0b7603019a9" dependencies = [ "wasm-bindgen", ] @@ -1311,12 +1159,6 @@ version = "0.2.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "884e2677b40cc8c339eaefcb701c32ef1fd2493d71118dc0ca4b6a736c93bd67" -[[package]] -name = "leb128" -version = "0.2.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "884e2677b40cc8c339eaefcb701c32ef1fd2493d71118dc0ca4b6a736c93bd67" - [[package]] name = "libc" version = "0.2.162" @@ -1345,22 +1187,6 @@ dependencies = [ "scopeguard", ] -[[package]] -name = "linux-raw-sys" -version = "0.4.14" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "78b3ae25bc7c8c38cec158d1f2757ee79e9b3740fbc7ccf0e59e4b08d793fa89" - -[[package]] -name = "lock_api" -version = "0.4.12" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "07af8b9cdd281b7915f413fa73f29ebd5d55d0d3f0155584dade1ff18cea1b17" -dependencies = [ - "autocfg", - "scopeguard", -] - [[package]] name = "log" version = "0.4.22" @@ -1418,43 +1244,6 @@ dependencies = [ "multiversx-sc-codec", ] -[[package]] -name = "mime" -version = "0.3.17" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6877bb514081ee2a7ff5ef9de3281f14a4dd4bceac4c09388074a6b5df8a139a" - -[[package]] -name = "miniz_oxide" -version = "0.7.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b8a240ddb74feaf34a79a7add65a741f3167852fba007066dcac1ca548d89c08" -dependencies = [ - "adler", -] - -[[package]] -name = "mio" -version = "1.0.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "80e04d1dcff3aae0704555fe5fee3bcfaf3d1fdf8a7e521d5b9d2b42acb52cec" -dependencies = [ - "hermit-abi", - "libc", - "wasi", - "windows-sys 0.52.0", -] - -[[package]] -name = "multiversx-chain-core" -version = "0.11.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0c1088b268cad0d8c1146df9ca71a1f2baaee78267ab75e2202c0c0c71cc4b6e" -dependencies = [ - "bitflags", - "multiversx-sc-codec", -] - [[package]] name = "multiversx-chain-scenario-format" version = "0.23.0" @@ -1734,15 +1523,6 @@ dependencies = [ "memchr", ] -[[package]] -name = "once_cell" -version = "1.19.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "aedf0a2d09c573ed1d8d85b30c119153926a2b36dce0ab28322c09a117a4683e" -dependencies = [ - "memchr", -] - [[package]] name = "once_cell" version = "1.20.2" @@ -1828,86 +1608,8 @@ dependencies = [ ] [[package]] -name = "openssl" -version = "0.10.66" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9529f4786b70a3e8c61e11179af17ab6188ad8d0ded78c5529441ed39d4bd9c1" -dependencies = [ - "bitflags", - "cfg-if", - "foreign-types", - "libc", - "once_cell", - "openssl-macros", - "openssl-sys", -] - -[[package]] -name = "openssl-macros" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a948666b637a0f465e8564c73e89d4dde00d72d4d473cc972f390fc3dcee7d9c" -dependencies = [ - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "openssl-probe" -version = "0.1.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ff011a302c396a5197692431fc1948019154afc178baf7d8e37367442a4601cf" - -[[package]] -name = "openssl-sys" -version = "0.9.103" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7f9e8deee91df40a943c71b917e5874b951d32a802526c85721ce3b776c929d6" -dependencies = [ - "cc", - "libc", - "pkg-config", - "vcpkg", -] - -[[package]] -name = "parking_lot" -version = "0.12.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f1bf18183cf54e8d6059647fc3063646a1801cf30896933ec2311622cc4b9a27" -dependencies = [ - "lock_api", - "parking_lot_core", -] - -[[package]] -name = "parking_lot_core" -version = "0.9.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1e401f977ab385c9e4e3ab30627d6f26d00e2c73eef317493c4ec6d468726cf8" -dependencies = [ - "cfg-if", - "libc", - "redox_syscall", - "smallvec", - "windows-targets 0.52.4", -] - -[[package]] -name = "password-hash" -version = "0.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "346f04948ba92c43e8469c1ee6736c7563d71012b17d40745260fe106aac2166" -dependencies = [ - "base64ct", - "rand_core", - "subtle", -] - -[[package]] -name = "pathdiff" -version = "0.2.2" +name = "pathdiff" +version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d61c5ce1153ab5b689d0c074c4e7fc613e942dfb7dd9eea5ab202d2ad91fe361" @@ -1949,44 +1651,6 @@ version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184" -[[package]] -name = "pbkdf2" -version = "0.12.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f8ed6a7761f76e3b9f92dfb0a60a6a6477c61024b775147ff0973a02653abaf2" -dependencies = [ - "digest", - "hmac", -] - -[[package]] -name = "pem" -version = "3.0.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8e459365e590736a54c3fa561947c84837534b8e9af6fc5bf781307e82658fae" -dependencies = [ - "base64", - "serde", -] - -[[package]] -name = "percent-encoding" -version = "2.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e3148f5046208a5d56bcfc03053e3ca6334e51da8dfb19b6cdc8b306fae3283e" - -[[package]] -name = "pin-project-lite" -version = "0.2.14" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bda66fc9667c18cb2758a2ac84d1167245054bcf85d5d1aaa6923f45801bdd02" - -[[package]] -name = "pin-utils" -version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184" - [[package]] name = "pkcs8" version = "0.10.2" @@ -2003,12 +1667,6 @@ version = "0.3.31" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "953ec861398dccce10c670dfeaf3ec4911ca479e9c02154b3a215178c5f566f2" -[[package]] -name = "ppv-lite86" -version = "0.2.17" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "953ec861398dccce10c670dfeaf3ec4911ca479e9c02154b3a215178c5f566f2" - [[package]] name = "ppv-lite86" version = "0.2.20" @@ -2094,106 +1752,6 @@ dependencies = [ "bitflags", ] -[[package]] -name = "regex" -version = "1.11.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "38200e5ee88914975b69f657f0801b6f6dccafd44fd9326302a4aaeecfacb1d8" -dependencies = [ - "aho-corasick", - "memchr", - "regex-automata", - "regex-syntax", -] - -[[package]] -name = "regex-automata" -version = "0.4.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "368758f23274712b504848e9d5a6f010445cc8b87a7cdb4d7cbee666c1288da3" -dependencies = [ - "aho-corasick", - "memchr", - "regex-syntax", -] - -[[package]] -name = "regex-syntax" -version = "0.8.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2b15c43186be67a4fd63bee50d0303afffcef381492ebe2c5d87f324e1b8815c" - -[[package]] -name = "reqwest" -version = "0.12.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c7d6d2a27d57148378eb5e111173f4276ad26340ecc5c49a4a2152167a2d6a37" -dependencies = [ - "base64", - "bytes", - "futures-channel", - "futures-core", - "futures-util", - "http", - "http-body", - "http-body-util", - "hyper", - "hyper-tls", - "hyper-util", - "ipnet", - "js-sys", - "log", - "mime", - "native-tls", - "once_cell", - "percent-encoding", - "pin-project-lite", - "rustls-pemfile", - "serde", - "serde_json", - "serde_urlencoded", - "sync_wrapper", - "tokio", - "tokio-native-tls", - "tower-service", - "url", - "wasm-bindgen", - "wasm-bindgen-futures", - "web-sys", - "winreg", -] - -[[package]] -name = "rust-interact" -version = "0.0.0" -dependencies = [ - "clap", - "esdt-safe", - "fee-market", - "multiversx-sc", - "multiversx-sc-scenario", - "multiversx-sc-snippets", - "serde", - "toml", - "transaction", - "tx-batch-module", -] - -[[package]] -name = "rustc-demangle" -version = "0.1.24" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "719b953e2095829ee67db738b3bfa9fa368c94900df327b3f07fe6e794d2fe1f" - -[[package]] -name = "rustc_version" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9b6dfecf2c74bce2466cabf93f6664d6998a69eb21e39f4207930065b27b771f" -dependencies = [ - "bitflags", -] - [[package]] name = "regex" version = "1.11.1" @@ -2296,35 +1854,7 @@ dependencies = [ [[package]] name = "rustix" -version = "0.38.34" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "70dc5ec042f7a43c4a73241207cecc9873a06d45debb38b329f8541d85c2730f" -dependencies = [ - "bitflags", - "errno", - "libc", - "linux-raw-sys", - "windows-sys 0.52.0", -] - -[[package]] -name = "rustls-pemfile" -version = "2.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dce314e5fee3f39953d46bb63bb8a46d40c2f8fb7cc5a3b6cab2bde9721d6e50" -dependencies = [ - "rustls-pki-types", -] - -[[package]] -name = "rustls-pki-types" -version = "1.9.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0e696e35370c65c9c541198af4543ccd580cf17fc25d8e05c5a242b202488c55" - -[[package]] -name = "ryu" -version = "1.0.17" +version = "0.38.40" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "99e4ea3e1cdc4b559b8e5650f9c8e5998e3e5c1343b4eaf034565f32318d63c0" dependencies = [ @@ -2415,65 +1945,6 @@ dependencies = [ "libc", ] -[[package]] -name = "salsa20" -version = "0.10.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "97a22f5af31f73a954c10289c93e8a50cc23d971e80ee446f1f6f7137a088213" -dependencies = [ - "cipher", -] - -[[package]] -name = "schannel" -version = "0.1.23" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fbc91545643bcf3a0bbb6569265615222618bdf33ce4ffbbd13c4bbd4c093534" -dependencies = [ - "windows-sys 0.52.0", -] - -[[package]] -name = "scopeguard" -version = "1.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49" - -[[package]] -name = "scrypt" -version = "0.11.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0516a385866c09368f0b5bcd1caff3366aace790fcd46e2bb032697bb172fd1f" -dependencies = [ - "password-hash", - "pbkdf2", - "salsa20", - "sha2", -] - -[[package]] -name = "security-framework" -version = "2.11.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "897b2245f0b511c87893af39b033e5ca9cce68824c4d7e7630b5a1d339658d02" -dependencies = [ - "bitflags", - "core-foundation", - "core-foundation-sys", - "libc", - "security-framework-sys", -] - -[[package]] -name = "security-framework-sys" -version = "2.12.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ea4a292869320c0272d7bc55a5a6aafaff59b4f63404a003887b679a2e05b4b6" -dependencies = [ - "core-foundation-sys", - "libc", -] - [[package]] name = "semver" version = "1.0.23" @@ -2524,17 +1995,6 @@ dependencies = [ "syn", ] -[[package]] -name = "serde_spanned" -version = "0.6.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6c64451ba24fc7a6a2d60fc75dd9c83c90903b19028d4eff35e88fc1e86564e9" -dependencies = [ - "proc-macro2", - "quote", - "syn", -] - [[package]] name = "serde_spanned" version = "0.6.8" @@ -2556,18 +2016,6 @@ dependencies = [ "serde", ] -[[package]] -name = "serde_urlencoded" -version = "0.7.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d3491c14715ca2294c4d6a88f15e84739788c1d030eed8c110436aafdaa2f3fd" -dependencies = [ - "form_urlencoded", - "itoa", - "ryu", - "serde", -] - [[package]] name = "setup-phase" version = "0.0.0" @@ -2690,18 +2138,32 @@ name = "sync_wrapper" version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a7065abeca94b6a8a577f9bd45aa0867a2238b74e8eb67cf10d492bc39351394" +dependencies = [ + "futures-core", +] + +[[package]] +name = "synstructure" +version = "0.13.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c8af7666ab7b6390ab78131fb5b0fce11d6b7a6951602017c35fa82800708971" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] [[package]] name = "tempfile" -version = "3.11.0" +version = "3.14.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b8fcd239983515c23a32fb82099f97d0b11b8c72f654ed659363a95c3dad7a53" +checksum = "28cce251fcbc87fac86a866eeb0d6c2d536fc16d06f184bb61aeae11aa4cee0c" dependencies = [ "cfg-if", "fastrand", "once_cell", "rustix", - "windows-sys 0.52.0", + "windows-sys 0.59.0", ] [[package]] @@ -2730,6 +2192,16 @@ dependencies = [ "testing-sc", ] +[[package]] +name = "tinystr" +version = "0.7.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9117f5d4db391c1cf6927e7bea3db74b9a1c1add8f7eda9ffd5364f40f57b82f" +dependencies = [ + "displaydoc", + "zerovec", +] + [[package]] name = "tinyvec" version = "1.8.0" @@ -2778,46 +2250,7 @@ dependencies = [ [[package]] name = "tokio" -version = "1.40.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e2b070231665d27ad9ec9b8df639893f46727666c6767db40317fbe920a5d998" -dependencies = [ - "backtrace", - "bytes", - "libc", - "mio", - "parking_lot", - "pin-project-lite", - "signal-hook-registry", - "socket2", - "tokio-macros", - "windows-sys 0.52.0", -] - -[[package]] -name = "tokio-macros" -version = "2.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "693d596312e88961bc67d7f1f97af8a70227d9f90c31bba5806eec004978d752" -dependencies = [ - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "tokio-native-tls" -version = "0.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bbae76ab933c85776efabc971569dd6119c580d8f5d448769dec1764bf796ef2" -dependencies = [ - "native-tls", - "tokio", -] - -[[package]] -name = "toml" -version = "0.8.12" +version = "1.41.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "22cfb5bee7a6a52939ca9224d6ac897bb669134078daa8735560897f69de4d33" dependencies = [ @@ -2942,12 +2375,6 @@ version = "1.17.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "42ff0bf0c66b8238c6f3b578df37d0b7848e55df8577b3f74f92a69acceeb825" -[[package]] -name = "unicode-bidi" -version = "0.3.17" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5ab17db44d7388991a428b2ee655ce0c212e862eff1768a455c58f9aad6e7893" - [[package]] name = "unicode-ident" version = "1.0.13" @@ -2963,15 +2390,6 @@ dependencies = [ "tinyvec", ] -[[package]] -name = "unicode-normalization" -version = "0.1.22" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5c5713f0fc4b5db668a2ac63cdb7bb4469d8c9fed047b1d0292cc7b0ce2ba921" -dependencies = [ - "tinyvec", -] - [[package]] name = "unicode-segmentation" version = "1.12.0" @@ -2984,12 +2402,6 @@ version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1fc81956842c57dac11422a97c3b8195a1ff727f06e85c84ed2e8aa277c9a0fd" -[[package]] -name = "unicode-width" -version = "0.1.14" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7dd6e30e90baa6f72411720665d41d89b9a3d039dc45b8faea1ddd07f617f6af" - [[package]] name = "unwrap-infallible" version = "0.1.5" @@ -2998,18 +2410,7 @@ checksum = "151ac09978d3c2862c4e39b557f4eceee2cc72150bc4cb4f16abf061b6e381fb" [[package]] name = "url" -version = "2.5.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "22784dbdf76fdde8af1aeda5622b546b422b6fc585325248a2bf9f5e41e94d6c" -dependencies = [ - "form_urlencoded", - "idna", - "percent-encoding", -] - -[[package]] -name = "utf8parse" -version = "0.2.1" +version = "2.5.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8d157f1b96d14500ffdc1f10ba712e780825526c03d9a49b4d0324b0d9113ada" dependencies = [ @@ -3046,22 +2447,7 @@ dependencies = [ [[package]] name = "uuid" -version = "1.10.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "81dfa00651efa65069b0b6b651f4aaa31ba9e3c3ce0137aaad053604ee7e0314" -dependencies = [ - "getrandom", -] - -[[package]] -name = "vcpkg" -version = "0.2.15" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "accd4ea62f7bb7a82fe23066fb0957d48ef677f6eeb8215f372f52e48bb32426" - -[[package]] -name = "version_check" -version = "0.9.4" +version = "1.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f8c5f0a0af699448548ad1a2fbf920fb4bee257eae39953ba95cb84891a0446a" dependencies = [ @@ -3089,15 +2475,6 @@ dependencies = [ "try-lock", ] -[[package]] -name = "want" -version = "0.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bfa7760aed19e106de2c7c0b581b509f2f25d3dacaf737cb82ac61bc6d760b0e" -dependencies = [ - "try-lock", -] - [[package]] name = "wasi" version = "0.11.0+wasi-snapshot-preview1" @@ -3106,9 +2483,9 @@ checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" [[package]] name = "wasm-bindgen" -version = "0.2.93" +version = "0.2.95" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a82edfc16a6c469f5f44dc7b571814045d60404b55a0ee849f9bcfa2e63dd9b5" +checksum = "128d1e363af62632b8eb57219c8fd7877144af57558fb2ef0368d0087bddeb2e" dependencies = [ "cfg-if", "once_cell", @@ -3117,9 +2494,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-backend" -version = "0.2.93" +version = "0.2.95" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9de396da306523044d3302746f1208fa71d7532227f15e347e2d93e4145dd77b" +checksum = "cb6dd4d3ca0ddffd1dd1c9c04f94b868c37ff5fac97c30b97cff2d74fce3a358" dependencies = [ "bumpalo", "log", @@ -3132,9 +2509,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-futures" -version = "0.4.43" +version = "0.4.45" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "61e9300f63a621e96ed275155c108eb6f843b6a26d053f122ab69724559dc8ed" +checksum = "cc7ec4f8827a71586374db3e87abdb5a2bb3a15afed140221307c3ec06b1f63b" dependencies = [ "cfg-if", "js-sys", @@ -3144,9 +2521,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro" -version = "0.2.93" +version = "0.2.95" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "585c4c91a46b072c92e908d99cb1dcdf95c5218eeb6f3bf1efa991ee7a68cccf" +checksum = "e79384be7f8f5a9dd5d7167216f022090cf1f9ec128e6e6a482a2cb5c5422c56" dependencies = [ "quote", "wasm-bindgen-macro-support", @@ -3154,9 +2531,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro-support" -version = "0.2.93" +version = "0.2.95" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "afc340c74d9005395cf9dd098506f7f44e38f2b4a21c6aaacf9a105ea5e1e836" +checksum = "26c6ab57572f7a24a4985830b120de1594465e5d500f24afe89e16b4e833ef68" dependencies = [ "proc-macro2", "quote", @@ -3167,18 +2544,18 @@ dependencies = [ [[package]] name = "wasm-bindgen-shared" -version = "0.2.93" +version = "0.2.95" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c62a0a307cb4a311d3a07867860911ca130c3494e8c2719593806c08bc5d0484" +checksum = "65fc09f10666a9f147042251e0dda9c18f166ff7de300607007e96bdebc1068d" [[package]] name = "wasm-encoder" -version = "0.219.1" +version = "0.220.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "29cbbd772edcb8e7d524a82ee8cef8dd046fc14033796a754c3ad246d019fa54" +checksum = "ebf48234b389415b226a4daef6562933d38c7b28a8b8f64c5c4130dad1561ab7" dependencies = [ "leb128", - "wasmparser 0.219.1", + "wasmparser 0.220.0", ] [[package]] @@ -3197,9 +2574,9 @@ dependencies = [ [[package]] name = "wasmparser" -version = "0.219.1" +version = "0.220.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5c771866898879073c53b565a6c7b49953795159836714ac56a5befb581227c5" +checksum = "e246c2772ce3ebc83f89a2d4487ac5794cad6c309b2071818a88c7db7c36d87b" dependencies = [ "bitflags", "indexmap", @@ -3216,38 +2593,6 @@ dependencies = [ "wasmparser 0.216.0", ] -[[package]] -name = "wast" -version = "219.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4f79a9d9df79986a68689a6b40bcc8d5d40d807487b235bebc2ac69a242b54a1" -dependencies = [ - "bumpalo", - "leb128", - "memchr", - "unicode-width", - "wasm-encoder", -] - -[[package]] -name = "wat" -version = "1.219.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8bc3cf014fb336883a411cd662f987abf6a1d2a27f2f0008616a0070bbf6bd0d" -dependencies = [ - "wast", -] - -[[package]] -name = "web-sys" -version = "0.3.70" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "26fdeaafd9bd129f65e7c031593c24d62186301e0c72c8978fa1678be7d532c0" -dependencies = [ - "js-sys", - "wasm-bindgen", -] - [[package]] name = "wast" version = "220.0.0" @@ -3477,18 +2822,8 @@ dependencies = [ ] [[package]] -name = "winreg" -version = "0.52.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a277a57398d4bfa075df44f501a17cfdf8542d224f0d36095a2adc7aee4ef0a5" -dependencies = [ - "cfg-if", - "windows-sys 0.48.0", -] - -[[package]] -name = "zerocopy" -version = "0.7.34" +name = "write16" +version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d1890f4022759daae28ed4fe62859b1236caebfc61ede2f63ed4e695f3f6d936" diff --git a/esdt-safe/interactor/src/proxies/fee_market_proxy.rs b/esdt-safe/interactor/src/proxies/fee_market_proxy.rs index b595c0f6..774b6ec5 100644 --- a/esdt-safe/interactor/src/proxies/fee_market_proxy.rs +++ b/esdt-safe/interactor/src/proxies/fee_market_proxy.rs @@ -45,19 +45,16 @@ where { pub fn init< Arg0: ProxyArg>, - Arg1: ProxyArg>, - Arg2: ProxyArg>>, + Arg1: ProxyArg>>, >( self, esdt_safe_address: Arg0, - price_aggregator_address: Arg1, - fee: Arg2, + fee: Arg1, ) -> TxTypedDeploy { self.wrapped_tx .payment(NotPayable) .raw_deploy() .argument(&esdt_safe_address) - .argument(&price_aggregator_address) .argument(&fee) .original_result() } @@ -91,6 +88,19 @@ where To: TxTo, Gas: TxGas, { + pub fn set_price_aggregator_address< + Arg0: ProxyArg>, + >( + self, + price_aggregator_address: Arg0, + ) -> TxTypedCall { + self.wrapped_tx + .payment(NotPayable) + .raw_call("setPriceAggregatorAddress") + .argument(&price_aggregator_address) + .original_result() + } + pub fn set_fee< Arg0: ProxyArg>, >( @@ -99,12 +109,12 @@ where ) -> TxTypedCall { self.wrapped_tx .payment(NotPayable) - .raw_call("addFee") + .raw_call("setFee") .argument(&fee_struct) .original_result() } - pub fn disable_fee< + pub fn remove_fee< Arg0: ProxyArg>, >( self,