diff --git a/.gitignore b/.gitignore index 3d5b3fa7..9573e42d 100644 --- a/.gitignore +++ b/.gitignore @@ -1,12 +1,44 @@ # Generated by Cargo # will have compiled files and executables -/target/ +**/target/** + +# Remove Cargo.lock from the framework, but not from the wasm contracts. +# In contracts it helps with tracing builds. +# More information here https://doc.rust-lang.org/cargo/guide/cargo-toml-vs-cargo-lock.html +# The root Cargo.lock is kept for dependabot. +contracts/**/Cargo.lock +!contracts/**/wasm*/Cargo.lock +contracts/**/output*/ +data/**/Cargo.lock +framework/**/Cargo.lock +sdk/**/Cargo.lock +tools/**/Cargo.lock +vm/**/Cargo.lock + + + +# Coverage outputs +*.profraw +*.profdata +*.coverage +coverage.md # These are backup files generated by rustfmt **/*.rs.bk -# Local testnet files -**/deploy-testnet.interaction.json +# Editors config +.vscode +.zed +.idea + +tags + +# MultiversX IDE +**/node_modules +**/output/** +**/testnet/** **/mxpy.data-storage.json -**/testnet/ -**/deploy-child-sc-spam.json +**/*.interaction.json + +# Python scripts +**/__pycache__/** \ No newline at end of file diff --git a/Cargo.lock b/Cargo.lock index d0da69a5..868a8f8d 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -71,9 +71,9 @@ checksum = "86fdf8605db99b54d3cd748a44c6d04df638eb5dafb219b135d0149bd0db01f6" [[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" @@ -87,11 +87,17 @@ 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.9.1" +version = "0.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d86b93f97252c47b41663388e6d155714a9d0c398b99f1005cbc5f978b29f445" +checksum = "d965446196e3b7decd44aa7ee49e31d630118f90ef12f97900f262eb915c951d" [[package]] name = "bitflags" @@ -99,15 +105,6 @@ 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" @@ -125,10 +122,18 @@ dependencies = [ "crowdfunding-esdt", "esdt-safe", "eth-address", + "mock-bridged-tokens-wrapper", + "mock-esdt-safe", + "mock-multi-transfer-esdt", + "mock-multisig", + "mock-price-aggregator", + "mock-proxies", "multiversx-sc", "multiversx-sc-modules", "multiversx-sc-scenario", "num-bigint", + "sc-proxies", + "storage-module", "token-module", "transaction", "tx-batch-module", @@ -147,9 +152,12 @@ name = "bridged-tokens-wrapper" version = "0.0.0" dependencies = [ "eth-address", + "mock-esdt-safe", "multiversx-sc", "multiversx-sc-modules", "multiversx-sc-scenario", + "sc-proxies", + "storage-module", "token-module", "transaction", "tx-batch-module", @@ -237,6 +245,12 @@ dependencies = [ "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" @@ -258,7 +272,7 @@ dependencies = [ [[package]] name = "crowdfunding-esdt" version = "0.0.0" -source = "git+https://github.com/multiversx/mx-contracts-rs?rev=d91bbff#d91bbff295295c2f7e2baf1cd569dd5693ddfb56" +source = "git+https://github.com/multiversx/mx-contracts-rs?rev=e72c201#e72c2017bdc2bffef50d8e9d76fc3a24a81ad00d" dependencies = [ "multiversx-sc", ] @@ -275,24 +289,39 @@ dependencies = [ [[package]] name = "curve25519-dalek" -version = "3.2.1" +version = "4.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "90f9d052967f590a76e62eb387bd0bbb1b000182c3cefe5364db6b7211651bc0" +checksum = "97fb8b7c4503de7d6ae7b42ab72a5a59857b4c937ec27a3d4539dba95b5ab2be" dependencies = [ - "byteorder", - "digest 0.9.0", - "rand_core 0.5.1", + "cfg-if", + "cpufeatures", + "curve25519-dalek-derive", + "digest", + "fiat-crypto", + "rustc_version", "subtle", "zeroize", ] [[package]] -name = "digest" -version = "0.9.0" +name = "curve25519-dalek-derive" +version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d3dd60d1080a57a05ab032377049e0591415d2b31afd7028356dbf3cc6dcb066" +checksum = "f46882e17999c6cc590af592290432be3bce0428cb0d5f8b6715e4dc7b383eb3" dependencies = [ - "generic-array", + "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]] @@ -301,30 +330,31 @@ version = "0.10.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9ed9a281f7bc9b7576e61468ba615a66a5c8cfdff42420a70aa82701a3b1e292" dependencies = [ - "block-buffer 0.10.4", + "block-buffer", "crypto-common", ] [[package]] name = "ed25519" -version = "1.5.3" +version = "2.2.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "91cff35c70bba8a626e3185d8cd48cc11b5437e1a5bcd15b9b5fa3c64b6dfee7" +checksum = "115531babc129696a58c64a4fef0a8bf9e9698629fb97e9e40767d235cfbcd53" dependencies = [ + "pkcs8", "signature", ] [[package]] name = "ed25519-dalek" -version = "1.0.1" +version = "2.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c762bae6dcaf24c4c84667b8579785430908723d5c889f469d76a41d59cc7a9d" +checksum = "4a3daa8e81a3963a60642bcc1f90a670680bd4a77535faa384e9d1c79d620871" dependencies = [ "curve25519-dalek", "ed25519", - "rand 0.7.3", "serde", - "sha2 0.9.9", + "sha2", + "subtle", "zeroize", ] @@ -353,10 +383,18 @@ dependencies = [ "eth-address", "fee-estimator-module", "max-bridged-amount-module", + "mock-bridge-proxy", + "mock-bridged-tokens-wrapper", + "mock-multi-transfer-esdt", + "mock-multisig", + "mock-price-aggregator", + "mock-proxies", "multiversx-price-aggregator-sc", "multiversx-sc", "multiversx-sc-modules", "multiversx-sc-scenario", + "sc-proxies", + "storage-module", "token-module", "transaction", "tx-batch-module", @@ -383,8 +421,15 @@ version = "0.0.0" dependencies = [ "multiversx-sc", "multiversx-sc-scenario", + "storage-module", ] +[[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" @@ -395,17 +440,6 @@ dependencies = [ "version_check", ] -[[package]] -name = "getrandom" -version = "0.1.16" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8fc3cb4d91f53b50155bdcfd23f6a4c39ae1969c2ae85982b135750cccaf5fce" -dependencies = [ - "cfg-if", - "libc", - "wasi 0.9.0+wasi-snapshot-preview1", -] - [[package]] name = "getrandom" version = "0.2.15" @@ -415,7 +449,7 @@ dependencies = [ "cfg-if", "js-sys", "libc", - "wasi 0.11.0+wasi-snapshot-preview1", + "wasi", "wasm-bindgen", ] @@ -535,6 +569,117 @@ version = "2.7.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "78ca9ab1a0babb1e7d5695e3530886289c18cf2f87ec19a575a0abdce112e3a3" +[[package]] +name = "mock-bridge-proxy" +version = "0.0.0" +dependencies = [ + "multiversx-sc", + "multiversx-sc-scenario", + "num-bigint", +] + +[[package]] +name = "mock-bridge-proxy-meta" +version = "0.0.0" +dependencies = [ + "mock-bridge-proxy", + "multiversx-sc-meta-lib", +] + +[[package]] +name = "mock-bridged-tokens-wrapper" +version = "0.0.0" +dependencies = [ + "eth-address", + "multiversx-sc", + "multiversx-sc-scenario", + "num-bigint", +] + +[[package]] +name = "mock-bridged-tokens-wrapper-meta" +version = "0.0.0" +dependencies = [ + "mock-bridged-tokens-wrapper", + "multiversx-sc-meta-lib", +] + +[[package]] +name = "mock-esdt-safe" +version = "0.0.0" +dependencies = [ + "eth-address", + "multiversx-sc", + "multiversx-sc-modules", + "multiversx-sc-scenario", +] + +[[package]] +name = "mock-esdt-safe-meta" +version = "0.0.0" +dependencies = [ + "mock-esdt-safe", + "multiversx-sc-meta-lib", +] + +[[package]] +name = "mock-multi-transfer-esdt" +version = "0.0.0" +dependencies = [ + "multiversx-sc", + "multiversx-sc-scenario", + "num-bigint", +] + +[[package]] +name = "mock-multi-transfer-esdt-meta" +version = "0.0.0" +dependencies = [ + "mock-multi-transfer-esdt", + "multiversx-sc-meta-lib", +] + +[[package]] +name = "mock-multisig" +version = "0.0.0" +dependencies = [ + "multiversx-sc", + "multiversx-sc-scenario", + "num-bigint", +] + +[[package]] +name = "mock-multisig-meta" +version = "0.0.0" +dependencies = [ + "mock-multisig", + "multiversx-sc-meta-lib", +] + +[[package]] +name = "mock-price-aggregator" +version = "0.0.0" +dependencies = [ + "multiversx-sc", + "multiversx-sc-scenario", + "num-bigint", +] + +[[package]] +name = "mock-price-aggregator-meta" +version = "0.0.0" +dependencies = [ + "mock-price-aggregator", + "multiversx-sc-meta-lib", +] + +[[package]] +name = "mock-proxies" +version = "0.0.0" +dependencies = [ + "multiversx-sc", +] + [[package]] name = "multi-transfer-esdt" version = "0.0.0" @@ -544,9 +689,15 @@ dependencies = [ "esdt-safe", "eth-address", "max-bridged-amount-module", + "mock-multi-transfer-esdt", + "mock-multisig", + "mock-price-aggregator", + "mock-proxies", "multiversx-sc", "multiversx-sc-modules", "multiversx-sc-scenario", + "sc-proxies", + "storage-module", "token-module", "transaction", "tx-batch-module", @@ -575,6 +726,7 @@ dependencies = [ "multiversx-sc", "multiversx-sc-modules", "multiversx-sc-scenario", + "sc-proxies", "token-module", "transaction", "tx-batch-module", @@ -590,9 +742,9 @@ dependencies = [ [[package]] name = "multiversx-chain-scenario-format" -version = "0.22.3" +version = "0.23.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "921a66f6db5ffff311e355d42a49fd49baf72d7a6a6215b0484dcd9d8dd512a3" +checksum = "dcca77966bf5eb9c9f96d0597f17a4fa7b64681cc7b83e39bdf31f8c6ca04d44" dependencies = [ "bech32", "hex", @@ -605,9 +757,9 @@ dependencies = [ [[package]] name = "multiversx-chain-vm" -version = "0.9.0" +version = "0.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a8d91b6ce610a3ac1272f0813284a3f03a34d55db2f86cddaff357bf651074ee" +checksum = "13c537d27dfc7a8e295d4f7c5f67a967ce66b6c3fc8e31a160e8cf28e14ecb2d" dependencies = [ "bitflags", "colored", @@ -618,9 +770,9 @@ dependencies = [ "multiversx-chain-vm-executor", "num-bigint", "num-traits", - "rand 0.8.5", + "rand", "rand_seeder", - "sha2 0.10.8", + "sha2", "sha3", ] @@ -632,22 +784,22 @@ checksum = "b59072fa0624b55ae5ae3fa6bfa91515bbeb4ac440214bc4a509e2c8806d6e9f" [[package]] name = "multiversx-price-aggregator-sc" -version = "0.52.0" +version = "0.53.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5ea572ebab3a6addd937cad829076b13e320851503fb6adf1ad66f544b2bf100" +checksum = "7317294898d2f57b5181f3310014dec755359925b26d7b992a5f8fc968c7ee0a" dependencies = [ "arrayvec", - "getrandom 0.2.15", + "getrandom", "multiversx-sc", "multiversx-sc-modules", - "rand 0.8.5", + "rand", ] [[package]] name = "multiversx-sc" -version = "0.52.3" +version = "0.53.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "526760b1d6236c011285b264a70a0a9dd3b3dbc53c3b5f76932f4bcfd3a8910c" +checksum = "75ea89a26f0aacda21437a8ae5ccfbefab99d8191942b3d2eddbcbf84f9866d7" dependencies = [ "bitflags", "hex-literal", @@ -659,9 +811,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", @@ -671,9 +823,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", @@ -683,9 +835,9 @@ dependencies = [ [[package]] name = "multiversx-sc-derive" -version = "0.52.3" +version = "0.53.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3557f2f12640a8a07fa6af66cc2a13b188c5b61bed72db22fe631fb3a60c3e96" +checksum = "4c17fdf90fafca2f19085ae67b0502d9f71bf8ab1be3c83808eb88e02a8c18b9" dependencies = [ "hex", "proc-macro2", @@ -696,9 +848,9 @@ dependencies = [ [[package]] name = "multiversx-sc-meta-lib" -version = "0.52.3" +version = "0.53.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b8deccfcc760b8fd281e2603268fa1a453ed65e4caac7a51a2d71c40cec37ae3" +checksum = "ef023806e14a8a6245408c4a7dfdf17d4a1eb39425cedfe50cd2c48f96708ab6" dependencies = [ "clap", "colored", @@ -717,18 +869,18 @@ dependencies = [ [[package]] name = "multiversx-sc-modules" -version = "0.52.3" +version = "0.53.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "61f5c29c6044f3dc9e866858feee625d7fae5604a68ac7bd66dec683eee97563" +checksum = "daeb48acbd39255868a3241798df2f85050f0ae8d82d6417bd2cd0e30a241855" dependencies = [ "multiversx-sc", ] [[package]] name = "multiversx-sc-scenario" -version = "0.52.3" +version = "0.53.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5d3024d52e2cb7d455f5a560218be8968e446eabc7c31dc9fc479c329f45e05e" +checksum = "cd16e3bf1f6696d0add36b7b905b1ffdd13b836e584da000f5e265c11e2bfc8d" dependencies = [ "base64", "bech32", @@ -746,7 +898,7 @@ dependencies = [ "pathdiff", "serde", "serde_json", - "sha2 0.10.8", + "sha2", "unwrap-infallible", ] @@ -793,18 +945,22 @@ version = "1.20.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1261fe7e33c73b354eab43b1273a57c8f967d0391e80353e51f764ac02cf6775" -[[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.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" @@ -825,9 +981,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", ] @@ -842,19 +998,6 @@ dependencies = [ "nibble_vec", ] -[[package]] -name = "rand" -version = "0.7.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6a6b1679d49b24bbfe0c803429aa1874472f50d9b363131f0e89fc356b544d03" -dependencies = [ - "getrandom 0.1.16", - "libc", - "rand_chacha 0.2.2", - "rand_core 0.5.1", - "rand_hc", -] - [[package]] name = "rand" version = "0.8.5" @@ -862,18 +1005,8 @@ 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", + "rand_chacha", + "rand_core", ] [[package]] @@ -883,16 +1016,7 @@ 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", + "rand_core", ] [[package]] @@ -901,25 +1025,16 @@ 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", + "getrandom", ] [[package]] name = "rand_seeder" -version = "0.2.3" +version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cf2890aaef0aa82719a50e808de264f9484b74b442e1a3a0e5ee38243ac40bdb" +checksum = "4a9febe641d2842ffc76ee962668a17578767c4e01735e4802b21ed9a24b2e4e" dependencies = [ - "rand_core 0.6.4", + "rand_core", ] [[package]] @@ -937,6 +1052,18 @@ version = "1.0.18" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f3cb5ba0dc43242ce17de99c180e96db90b235b8a9fdc9543c96d2209116bd9f" +[[package]] +name = "sc-proxies" +version = "0.0.0" +dependencies = [ + "eth-address", + "multiversx-sc", + "multiversx-sc-scenario", + "token-module", + "transaction", + "tx-batch-module", +] + [[package]] name = "semver" version = "1.0.23" @@ -984,19 +1111,6 @@ 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" @@ -1005,7 +1119,7 @@ checksum = "793db75ad2bcafc3ffa7c68b215fee268f537982cd901d132f89c6343f3a3dc8" dependencies = [ "cfg-if", "cpufeatures", - "digest 0.10.7", + "digest", ] [[package]] @@ -1014,15 +1128,18 @@ version = "0.10.8" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "75872d278a8f37ef87fa0ddbda7802605cb18344497949862c0d4dcb291eba60" dependencies = [ - "digest 0.10.7", + "digest", "keccak", ] [[package]] name = "signature" -version = "1.6.4" +version = "2.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "74233d3b3b2f6d4b006dc19dee745e73e2a6bfb6f93607cd3b02bd5b00797d7c" +checksum = "77549399552de45a898a580c1b41d445bf730df867cc44e6c0233bbc4b8329de" +dependencies = [ + "rand_core", +] [[package]] name = "smallvec" @@ -1030,6 +1147,24 @@ 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 = "storage-module" +version = "0.1.0" +dependencies = [ + "multiversx-sc", + "multiversx-sc-scenario", +] + [[package]] name = "strsim" version = "0.11.1" @@ -1044,9 +1179,9 @@ checksum = "13c2bddecc57b384dee18652358fb23172facb8a2c51ccc10d74c157bdea3292" [[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", @@ -1087,6 +1222,7 @@ dependencies = [ "fee-estimator-module", "multiversx-sc", "multiversx-sc-scenario", + "storage-module", ] [[package]] @@ -1177,12 +1313,6 @@ version = "0.9.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0b928f33d975fc6ad9f86c8f283853ad26bdd5b10b7f1542aa2fa15e2289105a" -[[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" @@ -1246,9 +1376,9 @@ checksum = "65fc09f10666a9f147042251e0dda9c18f166ff7de300607007e96bdebc1068d" [[package]] name = "wasmparser" -version = "0.214.0" +version = "0.216.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5309c1090e3e84dad0d382f42064e9933fdaedb87e468cc239f0eabea73ddcb6" +checksum = "bcdee6bea3619d311fb4b299721e89a986c3470f804b6d534340e412589028e3" dependencies = [ "ahash", "bitflags", @@ -1260,9 +1390,9 @@ dependencies = [ [[package]] name = "wasmprinter" -version = "0.214.0" +version = "0.216.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "58d4f2b3f7bd2ba10f99e03f885ff90d5db3455e163bccecebbbf60406bd8980" +checksum = "8f82916f3892e53620639217d6ec78fe15c678352a3fbf3f3745b6417d0bd70f" dependencies = [ "anyhow", "termcolor", @@ -1458,20 +1588,6 @@ dependencies = [ [[package]] name = "zeroize" -version = "1.3.0" +version = "1.8.1" 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", -] +checksum = "ced3678a2879b30306d323f4542626697a464a97c0a07c9aebf7ebca65cd4dde" diff --git a/Cargo.toml b/Cargo.toml index 2c45d19e..6b964fcc 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -11,5 +11,12 @@ members = [ "bridged-tokens-wrapper", "bridged-tokens-wrapper/meta", "test-caller", - "test-caller/meta" + "test-caller/meta", + "common/storage-module", + "common/mock-contracts/mock-price-aggregator/meta", + "common/mock-contracts/mock-multi-transfer-esdt/meta", + "common/mock-contracts/mock-bridge-proxy/meta", + "common/mock-contracts/mock-bridged-tokens-wrapper/meta", + "common/mock-contracts/mock-multisig/meta", + "common/mock-contracts/mock-esdt-safe/meta", ] diff --git a/bridge-proxy/Cargo.toml b/bridge-proxy/Cargo.toml index dcd40cbb..44d13f32 100644 --- a/bridge-proxy/Cargo.toml +++ b/bridge-proxy/Cargo.toml @@ -17,27 +17,51 @@ path = "../common/eth-address" [dependencies.token-module] path = "../common/token-module" +[dependencies.storage-module] +path = "../common/storage-module" + [dependencies.tx-batch-module] path = "../common/tx-batch-module" +[dependencies.sc-proxies] +path = "../common/sc-proxies" + +[dependencies.mock-proxies] +path = "../common/mock-proxies" + [dependencies.esdt-safe] path = "../esdt-safe" [dependencies.bridged-tokens-wrapper] path = "../bridged-tokens-wrapper" +[dependencies.mock-bridged-tokens-wrapper] +path = "../common/mock-contracts/mock-bridged-tokens-wrapper" + +[dependencies.mock-esdt-safe] +path = "../common/mock-contracts/mock-esdt-safe" + +[dependencies.mock-multisig] +path = "../common/mock-contracts/mock-multisig" + +[dependencies.mock-price-aggregator] +path = "../common/mock-contracts/mock-price-aggregator" + +[dependencies.mock-multi-transfer-esdt] +path = "../common/mock-contracts/mock-multi-transfer-esdt" + [dependencies.multiversx-sc] -version = "=0.52.3" +version = "=0.53.2" [dependencies.multiversx-sc-modules] -version = "0.52.3" +version = "0.53.2" [dependencies.crowdfunding-esdt] git = "https://github.com/multiversx/mx-contracts-rs" -rev = "d91bbff" +rev = "e72c201" [dev-dependencies] num-bigint = "0.4.2" [dev-dependencies.multiversx-sc-scenario] -version = "=0.52.3" +version = "=0.53.2" diff --git a/bridge-proxy/meta/Cargo.toml b/bridge-proxy/meta/Cargo.toml index 9e646b0b..c98adbf5 100644 --- a/bridge-proxy/meta/Cargo.toml +++ b/bridge-proxy/meta/Cargo.toml @@ -11,4 +11,4 @@ authors = ["you"] path = ".." [dependencies.multiversx-sc-meta-lib] -version = "=0.52.3" +version = "=0.53.2" diff --git a/bridge-proxy/sc-config.toml b/bridge-proxy/sc-config.toml index 91f6f1ee..bc5e7220 100644 --- a/bridge-proxy/sc-config.toml +++ b/bridge-proxy/sc-config.toml @@ -1,10 +1,4 @@ [settings] [[proxy]] -path = "../multi-transfer-esdt/src/bridge_proxy_contract_proxy.rs" - -[[proxy]] -path = "../multisig/src/bridge_proxy_contract_proxy.rs" - -[[proxy]] -path = "./src/bridge_proxy_contract_proxy.rs" \ No newline at end of file +path = "../common/sc-proxies/src/bridge_proxy_contract_proxy.rs" diff --git a/bridge-proxy/src/bridge-proxy.rs b/bridge-proxy/src/bridge-proxy.rs index 17f5bec7..3ddd7c21 100644 --- a/bridge-proxy/src/bridge-proxy.rs +++ b/bridge-proxy/src/bridge-proxy.rs @@ -1,11 +1,10 @@ #![no_std] use multiversx_sc::imports::*; -pub mod bridge_proxy_contract_proxy; -pub mod bridged_tokens_wrapper_proxy; pub mod config; -pub mod esdt_safe_proxy; +use sc_proxies::bridged_tokens_wrapper_proxy; +use sc_proxies::esdt_safe_proxy; use transaction::{CallData, EthTransaction}; const MIN_GAS_LIMIT_FOR_SC_CALL: u64 = 10_000_000; const MAX_GAS_LIMIT_FOR_SC_CALL: u64 = 249999999; @@ -16,10 +15,10 @@ const DELAY_BEFORE_OWNER_CAN_CANCEL_TRANSACTION: u64 = 300; pub trait BridgeProxyContract: config::ConfigModule + multiversx_sc_modules::pause::PauseModule + + storage_module::CommonStorageModule { #[init] - fn init(&self, opt_multi_transfer_address: OptionalValue) { - self.set_multi_transfer_contract_address(opt_multi_transfer_address); + fn init(&self) { self.set_paused(true); } @@ -35,7 +34,7 @@ pub trait BridgeProxyContract: let caller = self.blockchain().get_caller(); let payment = self.call_value().single_esdt(); require!( - caller == self.multi_transfer_address().get(), + caller == self.get_multi_transfer_address(), "Only MultiTransfer can do deposits" ); let next_tx_id = self.get_next_tx_id(); @@ -129,7 +128,7 @@ pub trait BridgeProxyContract: fn refund_transaction(&self, tx_id: usize) { let tx = self.get_pending_transaction_by_id(tx_id); - let esdt_safe_contract_address = self.esdt_safe_contract_address().get(); + let esdt_safe_contract_address = self.get_esdt_safe_address(); let unwrapped_token = self.unwrap_token(&tx.token_id, tx_id); let batch_id = self.batch_id(tx_id).get(); @@ -154,7 +153,7 @@ pub trait BridgeProxyContract: fn unwrap_token(&self, requested_token: &TokenIdentifier, tx_id: usize) -> EsdtTokenPayment { let payment = self.payments(tx_id).get(); - let bridged_tokens_wrapper_address = self.bridged_tokens_wrapper_address().get(); + let bridged_tokens_wrapper_address = self.get_bridged_tokens_wrapper_address(); if requested_token == &payment.token_identifier { return payment; diff --git a/bridge-proxy/src/config.rs b/bridge-proxy/src/config.rs index 6c81b837..79f94ee1 100644 --- a/bridge-proxy/src/config.rs +++ b/bridge-proxy/src/config.rs @@ -4,69 +4,6 @@ use transaction::EthTransaction; #[multiversx_sc::module] pub trait ConfigModule { - #[only_owner] - #[endpoint(setMultiTransferAddress)] - fn set_multi_transfer_contract_address( - &self, - opt_multi_transfer_address: OptionalValue, - ) { - match opt_multi_transfer_address { - OptionalValue::Some(sc_addr) => { - require!( - self.blockchain().is_smart_contract(&sc_addr), - "Invalid multi-transfer address" - ); - self.multi_transfer_address().set(&sc_addr); - } - OptionalValue::None => self.multi_transfer_address().clear(), - } - } - - #[only_owner] - #[endpoint(setBridgedTokensWrapperAddress)] - fn set_bridged_tokens_wrapper_contract_address( - &self, - opt_address: OptionalValue, - ) { - match opt_address { - OptionalValue::Some(sc_addr) => { - require!( - self.blockchain().is_smart_contract(&sc_addr), - "Invalid bridged tokens wrapper address" - ); - self.bridged_tokens_wrapper_address().set(&sc_addr); - } - OptionalValue::None => self.bridged_tokens_wrapper_address().clear(), - } - } - - #[only_owner] - #[endpoint(setEsdtSafeAddress)] - fn set_esdt_safe_contract_address(&self, opt_address: OptionalValue) { - match opt_address { - OptionalValue::Some(sc_addr) => { - require!( - self.blockchain().is_smart_contract(&sc_addr), - "Invalid bridged tokens wrapper address" - ); - self.esdt_safe_contract_address().set(&sc_addr); - } - OptionalValue::None => self.esdt_safe_contract_address().clear(), - } - } - - #[view(getMultiTransferAddress)] - #[storage_mapper("multiTransferAddress")] - fn multi_transfer_address(&self) -> SingleValueMapper; - - #[view(getBridgedTokensWrapperAddress)] - #[storage_mapper("bridgedTokensWrapperAddress")] - fn bridged_tokens_wrapper_address(&self) -> SingleValueMapper; - - #[view(getEsdtSafeContractAddress)] - #[storage_mapper("esdtSafeContractAddress")] - fn esdt_safe_contract_address(&self) -> SingleValueMapper; - #[storage_mapper("pending_transactions")] fn pending_transactions(&self) -> MapMapper>; diff --git a/bridge-proxy/src/esdt_safe_proxy.rs b/bridge-proxy/src/esdt_safe_proxy.rs deleted file mode 100644 index 3832da69..00000000 --- a/bridge-proxy/src/esdt_safe_proxy.rs +++ /dev/null @@ -1,810 +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 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, -{ - /// fee_estimator_contract_address - The address of a Price Aggregator contract, - /// which will get the price of token A in token B - /// - /// eth_tx_gas_limit - The gas limit that will be used for transactions on the ETH side. - /// Will be used to compute the fees for the transfer - pub fn init< - Arg0: ProxyArg>, - Arg1: ProxyArg>, - Arg2: ProxyArg>, - >( - self, - fee_estimator_contract_address: Arg0, - multi_transfer_contract_address: Arg1, - eth_tx_gas_limit: Arg2, - ) -> TxTypedDeploy { - self.wrapped_tx - .payment(NotPayable) - .raw_deploy() - .argument(&fee_estimator_contract_address) - .argument(&multi_transfer_contract_address) - .argument(ð_tx_gas_limit) - .original_result() - } -} - -#[rustfmt::skip] -impl EsdtSafeProxyMethods -where - Env: TxEnv, - Env::Api: VMApi, - From: TxFrom, - To: TxTo, - Gas: TxGas, -{ - pub fn upgrade< - Arg0: ProxyArg>, - Arg1: ProxyArg>, - Arg2: ProxyArg>, - Arg3: ProxyArg>, - >( - self, - fee_estimator_contract_address: Arg0, - multi_transfer_contract_address: Arg1, - bridge_proxy_contract_address: Arg2, - eth_tx_gas_limit: Arg3, - ) -> TxTypedUpgrade { - self.wrapped_tx - .payment(NotPayable) - .raw_upgrade() - .argument(&fee_estimator_contract_address) - .argument(&multi_transfer_contract_address) - .argument(&bridge_proxy_contract_address) - .argument(ð_tx_gas_limit) - .original_result() - } -} - -#[rustfmt::skip] -impl EsdtSafeProxyMethods -where - Env: TxEnv, - Env::Api: VMApi, - From: TxFrom, - To: TxTo, - Gas: TxGas, -{ - /// Sets the statuses for the transactions, after they were executed on the Ethereum 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>, - >( - self, - batch_id: Arg0, - tx_statuses: Arg1, - ) -> TxTypedCall { - self.wrapped_tx - .payment(NotPayable) - .raw_call("setTransactionBatchStatus") - .argument(&batch_id) - .argument(&tx_statuses) - .original_result() - } - - /// Converts failed Ethereum -> MultiversX transactions to MultiversX -> Ethereum transaction. - /// This is done every now and then to refund the tokens. - /// - /// As with normal MultiversX -> Ethereum transactions, a part of the tokens will be - /// subtracted to pay for the fees - pub fn add_refund_batch< - Arg0: ProxyArg>>, - >( - self, - refund_transactions: Arg0, - ) -> TxTypedCall { - self.wrapped_tx - .raw_call("addRefundBatch") - .argument(&refund_transactions) - .original_result() - } - - /// Create an MultiversX -> Ethereum transaction. Only fungible tokens are accepted. - /// - /// Every transfer will have a part of the tokens subtracted as fees. - /// The fee amount depends on the global eth_tx_gas_limit - /// and the current GWEI price, respective to the bridged token - /// - /// fee_amount = price_per_gas_unit * eth_tx_gas_limit - pub fn create_transaction< - Arg0: ProxyArg>, - Arg1: ProxyArg>>, - >( - self, - to: Arg0, - opt_refund_info: Arg1, - ) -> TxTypedCall { - self.wrapped_tx - .raw_call("createTransaction") - .argument(&to) - .argument(&opt_refund_info) - .original_result() - } - - /// Claim funds for failed MultiversX -> Ethereum 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() - } - - pub fn set_bridged_tokens_wrapper_contract_address< - Arg0: ProxyArg>>, - >( - self, - opt_address: Arg0, - ) -> TxTypedCall { - self.wrapped_tx - .payment(NotPayable) - .raw_call("setBridgedTokensWrapperAddress") - .argument(&opt_address) - .original_result() - } - - pub fn set_bridge_proxy_contract_address< - Arg0: ProxyArg>>, - >( - self, - opt_new_address: Arg0, - ) -> TxTypedCall { - self.wrapped_tx - .payment(NotPayable) - .raw_call("setBridgeProxyContractAddress") - .argument(&opt_new_address) - .original_result() - } - - pub fn withdraw_refund_fees_for_ethereum< - Arg0: ProxyArg>, - Arg1: ProxyArg>, - >( - self, - token_id: Arg0, - multisig_owner: Arg1, - ) -> TxTypedCall { - self.wrapped_tx - .payment(NotPayable) - .raw_call("withdrawRefundFeesForEthereum") - .argument(&token_id) - .argument(&multisig_owner) - .original_result() - } - - pub fn withdraw_transaction_fees< - Arg0: ProxyArg>, - Arg1: ProxyArg>, - >( - self, - token_id: Arg0, - multisig_owner: Arg1, - ) -> TxTypedCall { - self.wrapped_tx - .payment(NotPayable) - .raw_call("withdrawTransactionFees") - .argument(&token_id) - .argument(&multisig_owner) - .original_result() - } - - pub fn compute_total_amounts_from_index< - Arg0: ProxyArg, - Arg1: ProxyArg, - >( - self, - start_index: Arg0, - end_index: Arg1, - ) -> TxTypedCall>> { - self.wrapped_tx - .payment(NotPayable) - .raw_call("computeTotalAmmountsFromIndex") - .argument(&start_index) - .argument(&end_index) - .original_result() - } - - /// Query function that lists all refund amounts for a user. - /// Useful for knowing which token IDs to pass to the claimRefund endpoint. - pub fn get_refund_amounts< - Arg0: ProxyArg>, - >( - self, - address: Arg0, - ) -> TxTypedCall, BigUint>>> { - self.wrapped_tx - .payment(NotPayable) - .raw_call("getRefundAmounts") - .argument(&address) - .original_result() - } - - pub fn get_total_refund_amounts( - self, - ) -> TxTypedCall, BigUint>>> { - self.wrapped_tx - .payment(NotPayable) - .raw_call("getTotalRefundAmounts") - .original_result() - } - - pub fn get_refund_fees_for_ethereum< - Arg0: ProxyArg>, - >( - self, - token_id: Arg0, - ) -> TxTypedCall> { - self.wrapped_tx - .payment(NotPayable) - .raw_call("getRefundFeesForEthereum") - .argument(&token_id) - .original_result() - } - - pub fn get_transaction_fees< - Arg0: ProxyArg>, - >( - self, - token_id: Arg0, - ) -> TxTypedCall> { - self.wrapped_tx - .payment(NotPayable) - .raw_call("getTransactionFees") - .argument(&token_id) - .original_result() - } - - pub fn bridged_tokens_wrapper_address( - self, - ) -> TxTypedCall> { - self.wrapped_tx - .payment(NotPayable) - .raw_call("getBridgedTokensWrapperAddress") - .original_result() - } - - pub fn bridge_proxy_contract_address( - self, - ) -> TxTypedCall> { - self.wrapped_tx - .payment(NotPayable) - .raw_call("getBridgeProxyContractAddress") - .original_result() - } - - pub fn set_fee_estimator_contract_address< - Arg0: ProxyArg>, - >( - self, - new_address: Arg0, - ) -> TxTypedCall { - self.wrapped_tx - .payment(NotPayable) - .raw_call("setFeeEstimatorContractAddress") - .argument(&new_address) - .original_result() - } - - pub fn set_eth_tx_gas_limit< - Arg0: ProxyArg>, - >( - self, - new_limit: Arg0, - ) -> TxTypedCall { - self.wrapped_tx - .payment(NotPayable) - .raw_call("setEthTxGasLimit") - .argument(&new_limit) - .original_result() - } - - /// Default price being used if the aggregator lacks a mapping for this token - /// or the aggregator address is not set - pub fn set_default_price_per_gas_unit< - Arg0: ProxyArg>, - Arg1: ProxyArg>, - >( - self, - token_id: Arg0, - default_price_per_gas_unit: Arg1, - ) -> TxTypedCall { - self.wrapped_tx - .payment(NotPayable) - .raw_call("setDefaultPricePerGasUnit") - .argument(&token_id) - .argument(&default_price_per_gas_unit) - .original_result() - } - - /// Token ticker being used when querying the aggregator for GWEI prices - pub fn set_token_ticker< - Arg0: ProxyArg>, - Arg1: ProxyArg>, - >( - self, - token_id: Arg0, - ticker: Arg1, - ) -> TxTypedCall { - self.wrapped_tx - .payment(NotPayable) - .raw_call("setTokenTicker") - .argument(&token_id) - .argument(&ticker) - .original_result() - } - - /// Returns the fee for the given token ID (the fee amount is in the given token) - pub fn calculate_required_fee< - Arg0: ProxyArg>, - >( - self, - token_id: Arg0, - ) -> TxTypedCall> { - self.wrapped_tx - .payment(NotPayable) - .raw_call("calculateRequiredFee") - .argument(&token_id) - .original_result() - } - - pub fn fee_estimator_contract_address( - self, - ) -> TxTypedCall> { - self.wrapped_tx - .payment(NotPayable) - .raw_call("getFeeEstimatorContractAddress") - .original_result() - } - - pub fn default_price_per_gas_unit< - Arg0: ProxyArg>, - >( - self, - token_id: Arg0, - ) -> TxTypedCall> { - self.wrapped_tx - .payment(NotPayable) - .raw_call("getDefaultPricePerGasUnit") - .argument(&token_id) - .original_result() - } - - pub fn eth_tx_gas_limit( - self, - ) -> TxTypedCall> { - self.wrapped_tx - .payment(NotPayable) - .raw_call("getEthTxGasLimit") - .original_result() - } - - /// Distributes the accumulated fees to the given addresses. - /// Expected arguments are pairs of (address, percentage), - /// where percentages must add up to the PERCENTAGE_TOTAL constant - pub fn distribute_fees< - Arg0: ProxyArg>>, - >( - self, - address_percentage_pairs: Arg0, - ) -> TxTypedCall { - self.wrapped_tx - .payment(NotPayable) - .raw_call("distributeFees") - .argument(&address_percentage_pairs) - .original_result() - } - - pub fn add_token_to_whitelist< - Arg0: ProxyArg>, - Arg1: ProxyArg>, - Arg2: ProxyArg, - Arg3: ProxyArg, - Arg4: ProxyArg>, - Arg5: ProxyArg>, - Arg6: ProxyArg>, - Arg7: ProxyArg>>, - >( - self, - token_id: Arg0, - ticker: Arg1, - mint_burn_token: Arg2, - native_token: Arg3, - total_balance: Arg4, - mint_balance: Arg5, - burn_balance: Arg6, - opt_default_price_per_gas_unit: Arg7, - ) -> TxTypedCall { - self.wrapped_tx - .raw_call("addTokenToWhitelist") - .argument(&token_id) - .argument(&ticker) - .argument(&mint_burn_token) - .argument(&native_token) - .argument(&total_balance) - .argument(&mint_balance) - .argument(&burn_balance) - .argument(&opt_default_price_per_gas_unit) - .original_result() - } - - pub fn remove_token_from_whitelist< - Arg0: ProxyArg>, - >( - self, - token_id: Arg0, - ) -> TxTypedCall { - self.wrapped_tx - .payment(NotPayable) - .raw_call("removeTokenFromWhitelist") - .argument(&token_id) - .original_result() - } - - pub fn get_tokens< - Arg0: ProxyArg>, - Arg1: ProxyArg>, - >( - self, - token_id: Arg0, - amount: Arg1, - ) -> TxTypedCall { - self.wrapped_tx - .payment(NotPayable) - .raw_call("getTokens") - .argument(&token_id) - .argument(&amount) - .original_result() - } - - pub fn init_supply< - Arg0: ProxyArg>, - Arg1: ProxyArg>, - >( - self, - token_id: Arg0, - amount: Arg1, - ) -> TxTypedCall { - self.wrapped_tx - .raw_call("initSupply") - .argument(&token_id) - .argument(&amount) - .original_result() - } - - pub fn init_supply_mint_burn< - Arg0: ProxyArg>, - Arg1: ProxyArg>, - Arg2: ProxyArg>, - >( - self, - token_id: Arg0, - mint_amount: Arg1, - burn_amount: Arg2, - ) -> TxTypedCall { - self.wrapped_tx - .payment(NotPayable) - .raw_call("initSupplyMintBurn") - .argument(&token_id) - .argument(&mint_amount) - .argument(&burn_amount) - .original_result() - } - - pub fn set_multi_transfer_contract_address< - Arg0: ProxyArg>>, - >( - self, - opt_new_address: Arg0, - ) -> TxTypedCall { - self.wrapped_tx - .payment(NotPayable) - .raw_call("setMultiTransferContractAddress") - .argument(&opt_new_address) - .original_result() - } - - pub fn token_whitelist( - self, - ) -> TxTypedCall>> { - self.wrapped_tx - .payment(NotPayable) - .raw_call("getAllKnownTokens") - .original_result() - } - - pub fn native_token< - Arg0: ProxyArg>, - >( - self, - token: Arg0, - ) -> TxTypedCall { - self.wrapped_tx - .payment(NotPayable) - .raw_call("isNativeToken") - .argument(&token) - .original_result() - } - - pub fn mint_burn_token< - Arg0: ProxyArg>, - >( - self, - token: Arg0, - ) -> TxTypedCall { - self.wrapped_tx - .payment(NotPayable) - .raw_call("isMintBurnToken") - .argument(&token) - .original_result() - } - - pub fn multi_transfer_contract_address( - self, - ) -> TxTypedCall> { - self.wrapped_tx - .payment(NotPayable) - .raw_call("getMultiTransferContractAddress") - .original_result() - } - - pub fn accumulated_transaction_fees< - Arg0: ProxyArg>, - >( - self, - token_id: Arg0, - ) -> TxTypedCall> { - self.wrapped_tx - .payment(NotPayable) - .raw_call("getAccumulatedTransactionFees") - .argument(&token_id) - .original_result() - } - - pub fn total_balances< - Arg0: ProxyArg>, - >( - self, - token_id: Arg0, - ) -> TxTypedCall> { - self.wrapped_tx - .payment(NotPayable) - .raw_call("getTotalBalances") - .argument(&token_id) - .original_result() - } - - pub fn mint_balances< - Arg0: ProxyArg>, - >( - self, - token_id: Arg0, - ) -> TxTypedCall> { - self.wrapped_tx - .payment(NotPayable) - .raw_call("getMintBalances") - .argument(&token_id) - .original_result() - } - - pub fn burn_balances< - Arg0: ProxyArg>, - >( - self, - token_id: Arg0, - ) -> TxTypedCall> { - self.wrapped_tx - .payment(NotPayable) - .raw_call("getBurnBalances") - .argument(&token_id) - .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, ManagedBuffer, TokenIdentifier, BigUint>>>>> { - self.wrapped_tx - .payment(NotPayable) - .raw_call("getCurrentTxBatch") - .original_result() - } - - pub fn get_first_batch_any_status( - self, - ) -> TxTypedCall, ManagedBuffer, TokenIdentifier, BigUint>>>>> { - self.wrapped_tx - .payment(NotPayable) - .raw_call("getFirstBatchAnyStatus") - .original_result() - } - - pub fn get_batch< - Arg0: ProxyArg, - >( - self, - batch_id: Arg0, - ) -> TxTypedCall, ManagedBuffer, TokenIdentifier, BigUint>>>>> { - 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 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() - } -} - -#[type_abi] -#[derive(TopEncode, TopDecode, NestedEncode, NestedDecode, Clone, ManagedVecItem, PartialEq)] -pub struct RefundInfo -where - Api: ManagedTypeApi, -{ - pub address: ManagedAddress, - pub initial_batch_id: u64, - pub initial_nonce: u64, -} diff --git a/bridge-proxy/tests/bridge_proxy_blackbox_test.rs b/bridge-proxy/tests/bridge_proxy_blackbox_test.rs index c4693ecc..20e287fc 100644 --- a/bridge-proxy/tests/bridge_proxy_blackbox_test.rs +++ b/bridge-proxy/tests/bridge_proxy_blackbox_test.rs @@ -3,16 +3,15 @@ use std::collections::LinkedList; use std::ops::Add; -use bridge_proxy::{bridge_proxy_contract_proxy, config::ProxyTrait as _}; -use bridge_proxy::{bridged_tokens_wrapper_proxy, ProxyTrait}; +use bridge_proxy::config::ProxyTrait as _; use crowdfunding_esdt::crowdfunding_esdt_proxy; use multiversx_sc::codec::NestedEncode; use multiversx_sc::contract_base::ManagedSerializer; use multiversx_sc::sc_print; use multiversx_sc::types::{ - EgldOrEsdtTokenIdentifier, EsdtTokenPayment, ManagedOption, ReturnsNewAddress, TestAddress, - TestSCAddress, TestTokenIdentifier, + EgldOrEsdtTokenIdentifier, EsdtTokenPayment, ManagedOption, MultiValueEncoded, + ReturnsNewAddress, ReturnsResult, TestAddress, TestSCAddress, TestTokenIdentifier, }; use multiversx_sc::{ api::{HandleConstraints, ManagedTypeApi}, @@ -37,12 +36,16 @@ use multiversx_sc_scenario::{ use multiversx_sc_scenario::{ExpectValue, ScenarioTxRun}; use eth_address::*; +use mock_proxies::mock_multisig_proxy; +use sc_proxies::{bridge_proxy_contract_proxy, bridged_tokens_wrapper_proxy, esdt_safe_proxy}; use transaction::{CallData, EthTransaction}; const BRIDGE_TOKEN_ID: TestTokenIdentifier = TestTokenIdentifier::new("BRIDGE-123456"); const WBRIDGE_TOKEN_ID: TestTokenIdentifier = TestTokenIdentifier::new("WBRIDGE-123456"); const GAS_LIMIT: u64 = 10_000_000; +const TOO_SMALL_GAS_LIMIT: u64 = 1_000_000; + const CF_DEADLINE: u64 = 7 * 24 * 60 * 60; // 1 week in seconds const OWNER_ADDRESS: TestAddress = TestAddress::new("owner"); @@ -50,16 +53,30 @@ const BRIDGE_PROXY_ADDRESS: TestSCAddress = TestSCAddress::new("bridge-proxy"); const CROWDFUNDING_ADDRESS: TestSCAddress = TestSCAddress::new("crowfunding"); const MULTI_TRANSFER_ADDRESS: TestSCAddress = TestSCAddress::new("multi-transfer"); const ESDT_SAFE_ADDRESS: TestSCAddress = TestSCAddress::new("esdt-safe"); +const FEE_ESTIMATOR_ADDRESS: TestSCAddress = TestSCAddress::new("fee-estimator"); +const MULTISIG_ADDRESS: TestSCAddress = TestSCAddress::new("multisig"); const BRIDGED_TOKENS_WRAPPER_ADDRESS: TestSCAddress = TestSCAddress::new("bridged-tokens-wrapper"); +const NO_INIT_SC_ADDRESS: TestSCAddress = TestSCAddress::new("no-init-sc"); const BRIDGE_PROXY_PATH_EXPR: MxscPath = MxscPath::new("output/bridge-proxy.mxsc.json"); const CROWDFUNDING_PATH_EXPR: MxscPath = MxscPath::new("tests/test-contract/crowdfunding-esdt.mxsc.json"); -const MULTI_TRANSFER_PATH_EXPR: &str = - "mxsc:../multi-transfer-esdt/output/multi-transfer-esdt.mxsc.json"; -const ESDT_SAFE_PATH_EXPR: &str = "mxsc:../esdt-safe/output/esdt-safe.mxsc.json"; -const BRIDGED_TOKENS_WRAPPER_CODE_PATH_EXPR: MxscPath = - MxscPath::new("../bridged-tokens-wrapper/output/bridged-tokens-wrapper.mxsc.json"); +const MOCK_MULTI_TRANSFER_PATH_EXPR: MxscPath = MxscPath::new( + "../common/mock-contracts/mock-multi-transfer-esdt/output/mock-multi-transfer-esdt.mxsc.json", +); +const MOCK_ESDT_SAFE_PATH_EXPR: MxscPath = + MxscPath::new("../common/mock-contrats/mock-esdt-safe/output/mock-esdt-safe.mxsc.json"); +const MOCK_BRIDGED_TOKENS_WRAPPER_CODE_PATH_EXPR: MxscPath = + MxscPath::new("../common/mock-contracts/mock-bridged-tokens-wrapper/output/mock-bridged-tokens-wrapper.mxsc.json"); +const MOCK_MULTISIG_CODE_PATH: MxscPath = + MxscPath::new("../common/mock-contracts/mock-multisig/output/mock-multisig.mxsc.json"); +const MOCK_PRICE_AGGREGATOR_CODE_PATH: MxscPath = MxscPath::new( + "../common/mock-contracts/mock-price-aggregator/output/mock-price-aggregator.mxsc.json", +); +const USER1_ADDRESS: TestAddress = TestAddress::new("user1"); +const USER2_ADDRESS: TestAddress = TestAddress::new("user2"); +const RELAYER1_ADDRESS: TestAddress = TestAddress::new("relayer1"); +const RELAYER2_ADDRESS: TestAddress = TestAddress::new("relayer2"); fn world() -> ScenarioWorld { let mut blockchain = ScenarioWorld::new(); @@ -67,17 +84,25 @@ fn world() -> ScenarioWorld { blockchain.register_contract(BRIDGE_PROXY_PATH_EXPR, bridge_proxy::ContractBuilder); blockchain.register_contract(CROWDFUNDING_PATH_EXPR, crowdfunding_esdt::ContractBuilder); blockchain.register_contract( - BRIDGED_TOKENS_WRAPPER_CODE_PATH_EXPR, - bridged_tokens_wrapper::ContractBuilder, + MOCK_BRIDGED_TOKENS_WRAPPER_CODE_PATH_EXPR, + mock_bridged_tokens_wrapper::ContractBuilder, + ); + blockchain.register_contract( + MOCK_PRICE_AGGREGATOR_CODE_PATH, + mock_price_aggregator::ContractBuilder, + ); + blockchain.register_contract( + MOCK_MULTI_TRANSFER_PATH_EXPR, + mock_multi_transfer_esdt::ContractBuilder, ); - blockchain.register_contract(ESDT_SAFE_PATH_EXPR, esdt_safe::ContractBuilder); + blockchain.register_contract(MOCK_ESDT_SAFE_PATH_EXPR, mock_esdt_safe::ContractBuilder); + blockchain.register_contract(MOCK_MULTISIG_CODE_PATH, mock_multisig::ContractBuilder); blockchain } type BridgeProxyContract = ContractInfo>; type CrowdfundingContract = ContractInfo>; -type BridgedTokensWrapperContract = ContractInfo>; struct BridgeProxyTestState { world: ScenarioWorld, @@ -86,8 +111,10 @@ struct BridgeProxyTestState { impl BridgeProxyTestState { fn new() -> Self { let mut world = world(); - let multi_transfer_code = world.code_expression(MULTI_TRANSFER_PATH_EXPR); - let esdt_safe_code = world.code_expression(ESDT_SAFE_PATH_EXPR); + let multi_transfer_code = + world.code_expression(MOCK_MULTI_TRANSFER_PATH_EXPR.eval_to_expr().as_str()); + let esdt_safe_code = + world.code_expression(MOCK_ESDT_SAFE_PATH_EXPR.eval_to_expr().as_str()); world .account(OWNER_ADDRESS) @@ -108,20 +135,18 @@ impl BridgeProxyTestState { .account(BRIDGED_TOKENS_WRAPPER_ADDRESS) .esdt_roles(WBRIDGE_TOKEN_ID, roles.clone()) .esdt_roles(BRIDGE_TOKEN_ID, roles) - .esdt_balance(TokenIdentifier::from(WBRIDGE_TOKEN_ID), 10_000u64) - .esdt_balance(TokenIdentifier::from(BRIDGE_TOKEN_ID), 10_000u64) - .code(BRIDGED_TOKENS_WRAPPER_CODE_PATH_EXPR) + .code(MOCK_BRIDGED_TOKENS_WRAPPER_CODE_PATH_EXPR) .owner(OWNER_ADDRESS); Self { world } } - fn bridge_proxy_deploy(&mut self) -> &mut Self { + fn deploy_bridge_proxy(&mut self) -> &mut Self { self.world .tx() - .from(OWNER_ADDRESS) + .from(MULTISIG_ADDRESS) .typed(bridge_proxy_contract_proxy::BridgeProxyContractProxy) - .init(OptionalValue::Some(MULTI_TRANSFER_ADDRESS)) + .init() .code(BRIDGE_PROXY_PATH_EXPR) .new_address(BRIDGE_PROXY_ADDRESS) .run(); @@ -129,13 +154,52 @@ impl BridgeProxyTestState { self } - fn bridged_tokens_wrapper_deploy(&mut self) -> &mut Self { + fn multisig_deploy(&mut self) -> &mut Self { + let mut board: MultiValueEncoded> = + MultiValueEncoded::new(); + board.push(ManagedAddress::from(RELAYER1_ADDRESS.eval_to_array())); + board.push(ManagedAddress::from(RELAYER2_ADDRESS.eval_to_array())); self.world .tx() .from(OWNER_ADDRESS) + .typed(mock_multisig_proxy::MockMultisigProxy) + .init( + ESDT_SAFE_ADDRESS, + MULTI_TRANSFER_ADDRESS, + BRIDGE_PROXY_ADDRESS, + BRIDGED_TOKENS_WRAPPER_ADDRESS, + FEE_ESTIMATOR_ADDRESS, + 1_000u64, + 500u64, + 2usize, + board, + ) + .code(MOCK_MULTISIG_CODE_PATH) + .new_address(MULTISIG_ADDRESS) + .run(); + self + } + + fn deploy_esdt_safe(&mut self) -> &mut Self { + self.world + .tx() + .from(MULTISIG_ADDRESS) + .typed(esdt_safe_proxy::EsdtSafeProxy) + .init(BigUint::zero()) + .code(MOCK_ESDT_SAFE_PATH_EXPR) + .new_address(BRIDGE_PROXY_ADDRESS) + .run(); + + self + } + + fn deploy_bridged_tokens_wrapper(&mut self) -> &mut Self { + self.world + .tx() + .from(MULTISIG_ADDRESS) .typed(bridged_tokens_wrapper_proxy::BridgedTokensWrapperProxy) .init() - .code(BRIDGED_TOKENS_WRAPPER_CODE_PATH_EXPR) + .code(MOCK_BRIDGED_TOKENS_WRAPPER_CODE_PATH_EXPR) .new_address(BRIDGED_TOKENS_WRAPPER_ADDRESS) .run(); @@ -145,7 +209,7 @@ impl BridgeProxyTestState { fn deploy_crowdfunding(&mut self) -> &mut Self { self.world .tx() - .from(OWNER_ADDRESS) + .from(MULTISIG_ADDRESS) .typed(crowdfunding_esdt_proxy::CrowdfundingProxy) .init( 2_000u32, @@ -161,59 +225,12 @@ impl BridgeProxyTestState { fn config_bridge(&mut self) -> &mut Self { self.world .tx() - .from(OWNER_ADDRESS) + .from(MULTISIG_ADDRESS) .to(BRIDGE_PROXY_ADDRESS) .typed(bridge_proxy_contract_proxy::BridgeProxyContractProxy) .unpause_endpoint() .run(); - self.world - .tx() - .from(OWNER_ADDRESS) - .to(BRIDGED_TOKENS_WRAPPER_ADDRESS) - .typed(bridged_tokens_wrapper_proxy::BridgedTokensWrapperProxy) - .unpause_endpoint() - .run(); - - self.world - .tx() - .from(OWNER_ADDRESS) - .to(BRIDGE_PROXY_ADDRESS) - .typed(bridge_proxy_contract_proxy::BridgeProxyContractProxy) - .set_bridged_tokens_wrapper_contract_address(OptionalValue::Some( - BRIDGED_TOKENS_WRAPPER_ADDRESS, - )) - .run(); - - self.world - .tx() - .from(OWNER_ADDRESS) - .to(BRIDGED_TOKENS_WRAPPER_ADDRESS) - .typed(bridged_tokens_wrapper_proxy::BridgedTokensWrapperProxy) - .whitelist_token(BRIDGE_TOKEN_ID, 18u32, WBRIDGE_TOKEN_ID) - .run(); - - self.world - .tx() - .from(OWNER_ADDRESS) - .to(BRIDGED_TOKENS_WRAPPER_ADDRESS) - .typed(bridged_tokens_wrapper_proxy::BridgedTokensWrapperProxy) - .add_wrapped_token(WBRIDGE_TOKEN_ID, 18u32) - .run(); - - self.world - .tx() - .from(OWNER_ADDRESS) - .to(BRIDGED_TOKENS_WRAPPER_ADDRESS) - .typed(bridged_tokens_wrapper_proxy::BridgedTokensWrapperProxy) - .deposit_liquidity() - .single_esdt( - &TokenIdentifier::from(BRIDGE_TOKEN_ID), - 0u64, - &BigUint::from(5_000u64), - ) - .run(); - self } } @@ -221,19 +238,43 @@ impl BridgeProxyTestState { #[test] fn deploy_test() { let mut test = BridgeProxyTestState::new(); - - test.bridge_proxy_deploy(); + test.multisig_deploy(); + test.deploy_bridge_proxy(); test.deploy_crowdfunding(); + test.config_bridge(); + + test.world + .query() + .to(MULTISIG_ADDRESS) + .typed(mock_multisig_proxy::MockMultisigProxy) + .multi_transfer_esdt_address() + .returns(ExpectValue(MULTI_TRANSFER_ADDRESS)) + .run(); + + test.world + .query() + .to(MULTISIG_ADDRESS) + .typed(mock_multisig_proxy::MockMultisigProxy) + .esdt_safe_address() + .returns(ExpectValue(ESDT_SAFE_ADDRESS)) + .run(); + + test.world + .query() + .to(MULTISIG_ADDRESS) + .typed(mock_multisig_proxy::MockMultisigProxy) + .bridged_tokens_wrapper_address() + .returns(ExpectValue(BRIDGED_TOKENS_WRAPPER_ADDRESS)) + .run(); } #[test] fn bridge_proxy_execute_crowdfunding_test() { let mut test = BridgeProxyTestState::new(); + test.multisig_deploy(); - test.world.start_trace(); - - test.bridge_proxy_deploy(); + test.deploy_bridge_proxy(); test.deploy_crowdfunding(); test.config_bridge(); @@ -296,16 +337,14 @@ fn bridge_proxy_execute_crowdfunding_test() { .get_current_funds() .returns(ExpectValue(500u64)) .run(); - - test.world - .write_scenario_trace("scenarios/bridge_proxy_execute_crowdfunding.scen.json"); } #[test] fn multiple_deposit_test() { let mut test = BridgeProxyTestState::new(); - test.bridge_proxy_deploy(); + test.multisig_deploy(); + test.deploy_bridge_proxy(); test.deploy_crowdfunding(); test.config_bridge(); @@ -421,7 +460,8 @@ fn multiple_deposit_test() { fn test_highest_tx_id() { let mut test = BridgeProxyTestState::new(); - test.bridge_proxy_deploy(); + test.multisig_deploy(); + test.deploy_bridge_proxy(); test.deploy_crowdfunding(); test.config_bridge(); @@ -495,3 +535,244 @@ fn test_highest_tx_id() { .run(); } } + +// Will be moved to integration test +// #[test] +fn bridge_proxy_wrong_formatting_sc_call_test() { + let mut test = BridgeProxyTestState::new(); + + test.multisig_deploy(); + test.deploy_bridge_proxy(); + test.deploy_crowdfunding(); + test.config_bridge(); + + let eth_tx = EthTransaction { + from: EthAddress { + raw_addr: ManagedByteArray::new_from_bytes(b"01020304050607080910"), + }, + to: ManagedAddress::from(NO_INIT_SC_ADDRESS.eval_to_array()), + token_id: BRIDGE_TOKEN_ID.into(), + amount: BigUint::from(500u64), + tx_nonce: 1u64, + call_data: ManagedOption::none(), + }; + + let amount = BigUint::from(500u64); + // Destination is not an initialized contract + test.world + .tx() + .from(MULTI_TRANSFER_ADDRESS) + .to(BRIDGE_PROXY_ADDRESS) + .typed(bridge_proxy_contract_proxy::BridgeProxyContractProxy) + .deposit(ð_tx, 1u64) + .egld_or_single_esdt( + &EgldOrEsdtTokenIdentifier::esdt(BRIDGE_TOKEN_ID), + 0, + &amount, + ) + .run(); + + test.world + .query() + .to(BRIDGE_PROXY_ADDRESS) + .typed(bridge_proxy_contract_proxy::BridgeProxyContractProxy) + .get_pending_transaction_by_id(1u32) + .returns(ExpectValue(eth_tx)) + .run(); + + test.world + .tx() + .from(OWNER_ADDRESS) + .to(BRIDGE_PROXY_ADDRESS) + .typed(bridge_proxy_contract_proxy::BridgeProxyContractProxy) + .execute(1u32) + .run(); + + // Refund: Funds are transfered to BridgedTokensWrapper + test.world + .check_account(BRIDGED_TOKENS_WRAPPER_ADDRESS) + .esdt_balance(BRIDGE_TOKEN_ID, amount.clone()); + + // Wrong endpoint for callData + let mut args = ManagedVec::new(); + let call_data: CallData = CallData { + endpoint: ManagedBuffer::from(b"nofunc"), + gas_limit: GAS_LIMIT, + args: ManagedOption::some(args), + }; + + let call_data: ManagedBuffer = + ManagedSerializer::new().top_encode_to_managed_buffer(&call_data); + + let eth_tx = EthTransaction { + from: EthAddress { + raw_addr: ManagedByteArray::new_from_bytes(b"01020304050607080910"), + }, + to: ManagedAddress::from(CROWDFUNDING_ADDRESS.eval_to_array()), + token_id: BRIDGE_TOKEN_ID.into(), + amount: amount.clone(), + tx_nonce: 2u64, + call_data: ManagedOption::some(call_data), + }; + + test.world + .tx() + .from(MULTI_TRANSFER_ADDRESS) + .to(BRIDGE_PROXY_ADDRESS) + .typed(bridge_proxy_contract_proxy::BridgeProxyContractProxy) + .deposit(ð_tx, 1u64) + .egld_or_single_esdt( + &EgldOrEsdtTokenIdentifier::esdt(BRIDGE_TOKEN_ID), + 0, + &amount, + ) + .run(); + + test.world + .query() + .to(BRIDGE_PROXY_ADDRESS) + .typed(bridge_proxy_contract_proxy::BridgeProxyContractProxy) + .get_pending_transaction_by_id(2u32) + .returns(ExpectValue(eth_tx)) + .run(); + + test.world + .tx() + .from(OWNER_ADDRESS) + .to(BRIDGE_PROXY_ADDRESS) + .typed(bridge_proxy_contract_proxy::BridgeProxyContractProxy) + .execute(2u32) + .run(); + + // Refund: Funds are transfered to BridgedTokensWrapper + test.world + .check_account(BRIDGED_TOKENS_WRAPPER_ADDRESS) + .esdt_balance(BRIDGE_TOKEN_ID, amount.clone() * 2u64); + + // Wrong args + let mut args = ManagedVec::new(); + args.push(ManagedBuffer::from(b"wrongargs")); + + let call_data: CallData = CallData { + endpoint: ManagedBuffer::from(b"fund"), + gas_limit: GAS_LIMIT, + args: ManagedOption::some(args), + }; + + let call_data: ManagedBuffer = + ManagedSerializer::new().top_encode_to_managed_buffer(&call_data); + + let eth_tx = EthTransaction { + from: EthAddress { + raw_addr: ManagedByteArray::new_from_bytes(b"01020304050607080910"), + }, + to: ManagedAddress::from(CROWDFUNDING_ADDRESS.eval_to_array()), + token_id: BRIDGE_TOKEN_ID.into(), + amount: amount.clone(), + tx_nonce: 3u64, + call_data: ManagedOption::some(call_data), + }; + + test.world + .tx() + .from(MULTI_TRANSFER_ADDRESS) + .to(BRIDGE_PROXY_ADDRESS) + .typed(bridge_proxy_contract_proxy::BridgeProxyContractProxy) + .deposit(ð_tx, 1u64) + .egld_or_single_esdt( + &EgldOrEsdtTokenIdentifier::esdt(BRIDGE_TOKEN_ID), + 0, + &amount, + ) + .run(); + + test.world + .query() + .to(BRIDGE_PROXY_ADDRESS) + .typed(bridge_proxy_contract_proxy::BridgeProxyContractProxy) + .get_pending_transaction_by_id(3u32) + .returns(ExpectValue(eth_tx)) + .run(); + + test.world + .tx() + .from(OWNER_ADDRESS) + .to(BRIDGE_PROXY_ADDRESS) + .typed(bridge_proxy_contract_proxy::BridgeProxyContractProxy) + .execute(3u32) + .run(); + + // Refund: Funds are transfered to BridgedTokensWrapper + test.world + .check_account(BRIDGED_TOKENS_WRAPPER_ADDRESS) + .esdt_balance(BRIDGE_TOKEN_ID, amount * 3u64); +} + +#[test] +fn bridge_proxy_too_small_gas_sc_call_test() { + let mut test = BridgeProxyTestState::new(); + + test.world.start_trace(); + + test.multisig_deploy(); + test.deploy_bridge_proxy(); + test.deploy_crowdfunding(); + test.config_bridge(); + + let mut args = ManagedVec::new(); + let call_data: CallData = CallData { + endpoint: ManagedBuffer::from(b"fund"), + gas_limit: TOO_SMALL_GAS_LIMIT, + args: ManagedOption::some(args), + }; + + let call_data: ManagedBuffer = + ManagedSerializer::new().top_encode_to_managed_buffer(&call_data); + + let eth_tx = EthTransaction { + from: EthAddress { + raw_addr: ManagedByteArray::new_from_bytes(b"01020304050607080910"), + }, + to: ManagedAddress::from(CROWDFUNDING_ADDRESS.eval_to_array()), + token_id: BRIDGE_TOKEN_ID.into(), + amount: BigUint::from(500u64), + tx_nonce: 1u64, + call_data: ManagedOption::some(call_data), + }; + + let amount = BigUint::from(500u64); + // Destination is not an initialized contract + test.world + .tx() + .from(MULTI_TRANSFER_ADDRESS) + .to(BRIDGE_PROXY_ADDRESS) + .typed(bridge_proxy_contract_proxy::BridgeProxyContractProxy) + .deposit(ð_tx, 1u64) + .egld_or_single_esdt( + &EgldOrEsdtTokenIdentifier::esdt(BRIDGE_TOKEN_ID), + 0, + &amount, + ) + .run(); + + test.world + .query() + .to(BRIDGE_PROXY_ADDRESS) + .typed(bridge_proxy_contract_proxy::BridgeProxyContractProxy) + .get_pending_transaction_by_id(1u32) + .returns(ExpectValue(eth_tx)) + .run(); + + test.world + .tx() + .from(OWNER_ADDRESS) + .to(BRIDGE_PROXY_ADDRESS) + .typed(bridge_proxy_contract_proxy::BridgeProxyContractProxy) + .execute(1u32) + .run(); + + // Refund: Funds are transfered to EsdtSafe + test.world + .check_account(ESDT_SAFE_ADDRESS) + .esdt_balance(BRIDGE_TOKEN_ID, amount.clone()); +} diff --git a/bridge-proxy/tests/test-contract/crowdfunding-esdt.mxsc.json b/bridge-proxy/tests/test-contract/crowdfunding-esdt.mxsc.json index 90e0d0fe..53d64e45 100644 --- a/bridge-proxy/tests/test-contract/crowdfunding-esdt.mxsc.json +++ b/bridge-proxy/tests/test-contract/crowdfunding-esdt.mxsc.json @@ -13,7 +13,7 @@ }, "framework": { "name": "multiversx-sc", - "version": "0.52.3" + "version": "0.53.2" } }, "abi": { @@ -193,4 +193,4 @@ "hasPanic": "none" } } -} +} \ No newline at end of file diff --git a/bridge-proxy/wasm/Cargo.lock b/bridge-proxy/wasm/Cargo.lock index f273f040..27a44e1f 100644 --- a/bridge-proxy/wasm/Cargo.lock +++ b/bridge-proxy/wasm/Cargo.lock @@ -4,15 +4,15 @@ 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" -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" @@ -28,8 +28,15 @@ dependencies = [ "crowdfunding-esdt", "esdt-safe", "eth-address", + "mock-bridged-tokens-wrapper", + "mock-esdt-safe", + "mock-multi-transfer-esdt", + "mock-multisig", + "mock-price-aggregator", "multiversx-sc", "multiversx-sc-modules", + "sc-proxies", + "storage-module", "token-module", "transaction", "tx-batch-module", @@ -50,6 +57,8 @@ dependencies = [ "eth-address", "multiversx-sc", "multiversx-sc-modules", + "sc-proxies", + "storage-module", "token-module", "transaction", "tx-batch-module", @@ -76,7 +85,7 @@ checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" [[package]] name = "crowdfunding-esdt" version = "0.0.0" -source = "git+https://github.com/multiversx/mx-contracts-rs?rev=d91bbff#d91bbff295295c2f7e2baf1cd569dd5693ddfb56" +source = "git+https://github.com/multiversx/mx-contracts-rs?rev=e72c201#e72c2017bdc2bffef50d8e9d76fc3a24a81ad00d" dependencies = [ "multiversx-sc", ] @@ -94,9 +103,16 @@ dependencies = [ "eth-address", "fee-estimator-module", "max-bridged-amount-module", + "mock-bridge-proxy", + "mock-bridged-tokens-wrapper", + "mock-multi-transfer-esdt", + "mock-multisig", + "mock-price-aggregator", "multiversx-price-aggregator-sc", "multiversx-sc", "multiversx-sc-modules", + "sc-proxies", + "storage-module", "token-module", "transaction", "tx-batch-module", @@ -114,6 +130,7 @@ name = "fee-estimator-module" version = "0.0.0" dependencies = [ "multiversx-sc", + "storage-module", ] [[package]] @@ -143,18 +160,18 @@ checksum = "6fe2267d4ed49bc07b63801559be28c718ea06c4738b7a03c94df7386d2cde46" [[package]] name = "js-sys" -version = "0.3.69" +version = "0.3.72" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "29c15563dc2726973df627357ce0c9ddddbea194836909d655df6a75d2cf296d" +checksum = "6a88f1bda2bd75b0452a14784937d796722fdebfe50df998aeb3f0b7603019a9" dependencies = [ "wasm-bindgen", ] [[package]] name = "libc" -version = "0.2.155" +version = "0.2.160" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "97b3888a4aecf77e811145cadf6eef5901f4782c53886191b2f693f24761847c" +checksum = "f0b21006cd1874ae9e650973c565615676dc4a274c965bb0a73796dac838ce4f" [[package]] name = "log" @@ -169,11 +186,54 @@ dependencies = [ "multiversx-sc", ] +[[package]] +name = "mock-bridge-proxy" +version = "0.0.0" +dependencies = [ + "multiversx-sc", +] + +[[package]] +name = "mock-bridged-tokens-wrapper" +version = "0.0.0" +dependencies = [ + "eth-address", + "multiversx-sc", +] + +[[package]] +name = "mock-esdt-safe" +version = "0.0.0" +dependencies = [ + "multiversx-sc", +] + +[[package]] +name = "mock-multi-transfer-esdt" +version = "0.0.0" +dependencies = [ + "multiversx-sc", +] + +[[package]] +name = "mock-multisig" +version = "0.0.0" +dependencies = [ + "multiversx-sc", +] + +[[package]] +name = "mock-price-aggregator" +version = "0.0.0" +dependencies = [ + "multiversx-sc", +] + [[package]] name = "multiversx-price-aggregator-sc" -version = "0.52.0" +version = "0.53.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5ea572ebab3a6addd937cad829076b13e320851503fb6adf1ad66f544b2bf100" +checksum = "7317294898d2f57b5181f3310014dec755359925b26d7b992a5f8fc968c7ee0a" dependencies = [ "arrayvec", "getrandom", @@ -184,9 +244,9 @@ dependencies = [ [[package]] name = "multiversx-sc" -version = "0.52.3" +version = "0.53.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "526760b1d6236c011285b264a70a0a9dd3b3dbc53c3b5f76932f4bcfd3a8910c" +checksum = "75ea89a26f0aacda21437a8ae5ccfbefab99d8191942b3d2eddbcbf84f9866d7" dependencies = [ "bitflags", "hex-literal", @@ -198,9 +258,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", @@ -209,9 +269,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", @@ -221,9 +281,9 @@ dependencies = [ [[package]] name = "multiversx-sc-derive" -version = "0.52.3" +version = "0.53.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3557f2f12640a8a07fa6af66cc2a13b188c5b61bed72db22fe631fb3a60c3e96" +checksum = "4c17fdf90fafca2f19085ae67b0502d9f71bf8ab1be3c83808eb88e02a8c18b9" dependencies = [ "hex", "proc-macro2", @@ -234,18 +294,18 @@ dependencies = [ [[package]] name = "multiversx-sc-modules" -version = "0.52.3" +version = "0.53.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "61f5c29c6044f3dc9e866858feee625d7fae5604a68ac7bd66dec683eee97563" +checksum = "daeb48acbd39255868a3241798df2f85050f0ae8d82d6417bd2cd0e30a241855" dependencies = [ "multiversx-sc", ] [[package]] name = "multiversx-sc-wasm-adapter" -version = "0.52.3" +version = "0.53.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ed13aaca9cbdbc6911174cd3029e750a7563d85dd3daaa1107b1fd31c7f17245" +checksum = "20659915a4377d375c46d7f237e810053a03f7e084fad6362dd5748a7233defb" dependencies = [ "multiversx-sc", ] @@ -270,9 +330,9 @@ dependencies = [ [[package]] name = "once_cell" -version = "1.19.0" +version = "1.20.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3fdb12b2476b595f9358c5161aa467c2438859caa136dec86c26fdd2efe17b92" +checksum = "1261fe7e33c73b354eab43b1273a57c8f967d0391e80353e51f764ac02cf6775" [[package]] name = "ppv-lite86" @@ -294,9 +354,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", ] @@ -341,17 +401,35 @@ dependencies = [ "getrandom", ] +[[package]] +name = "sc-proxies" +version = "0.0.0" +dependencies = [ + "eth-address", + "multiversx-sc", + "token-module", + "transaction", + "tx-batch-module", +] + [[package]] name = "smallvec" version = "1.13.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3c5e1a9a646d36c3599cd173a41282daf47c44583ad367b8e6837255952e5c67" +[[package]] +name = "storage-module" +version = "0.1.0" +dependencies = [ + "multiversx-sc", +] + [[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", @@ -364,6 +442,7 @@ version = "0.0.0" dependencies = [ "fee-estimator-module", "multiversx-sc", + "storage-module", ] [[package]] @@ -384,9 +463,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" @@ -402,19 +481,20 @@ checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" [[package]] name = "wasm-bindgen" -version = "0.2.92" +version = "0.2.95" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4be2531df63900aeb2bca0daaaddec08491ee64ceecbee5076636a3b026795a8" +checksum = "128d1e363af62632b8eb57219c8fd7877144af57558fb2ef0368d0087bddeb2e" dependencies = [ "cfg-if", + "once_cell", "wasm-bindgen-macro", ] [[package]] name = "wasm-bindgen-backend" -version = "0.2.92" +version = "0.2.95" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "614d787b966d3989fa7bb98a654e369c762374fd3213d212cfc0251257e747da" +checksum = "cb6dd4d3ca0ddffd1dd1c9c04f94b868c37ff5fac97c30b97cff2d74fce3a358" dependencies = [ "bumpalo", "log", @@ -427,9 +507,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro" -version = "0.2.92" +version = "0.2.95" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a1f8823de937b71b9460c0c34e25f3da88250760bec0ebac694b49997550d726" +checksum = "e79384be7f8f5a9dd5d7167216f022090cf1f9ec128e6e6a482a2cb5c5422c56" dependencies = [ "quote", "wasm-bindgen-macro-support", @@ -437,9 +517,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro-support" -version = "0.2.92" +version = "0.2.95" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e94f17b526d0a461a191c78ea52bbce64071ed5c04c9ffe424dcb38f74171bb7" +checksum = "26c6ab57572f7a24a4985830b120de1594465e5d500f24afe89e16b4e833ef68" dependencies = [ "proc-macro2", "quote", @@ -450,9 +530,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-shared" -version = "0.2.92" +version = "0.2.95" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "af190c94f2773fdb3729c55b007a722abb5384da03bc0986df4c289bf5567e96" +checksum = "65fc09f10666a9f147042251e0dda9c18f166ff7de300607007e96bdebc1068d" [[package]] name = "zerocopy" diff --git a/bridge-proxy/wasm/Cargo.toml b/bridge-proxy/wasm/Cargo.toml index 53e14637..f7d7270c 100644 --- a/bridge-proxy/wasm/Cargo.toml +++ b/bridge-proxy/wasm/Cargo.toml @@ -28,7 +28,7 @@ panic = "abort" path = ".." [dependencies.multiversx-sc-wasm-adapter] -version = "=0.52.3" +version = "=0.53.2" [workspace] members = ["."] diff --git a/bridge-proxy/wasm/src/lib.rs b/bridge-proxy/wasm/src/lib.rs index 7036dacd..54e773c8 100644 --- a/bridge-proxy/wasm/src/lib.rs +++ b/bridge-proxy/wasm/src/lib.rs @@ -6,10 +6,10 @@ // Init: 1 // Upgrade: 1 -// Endpoints: 14 +// Endpoints: 9 // Async Callback (empty): 1 // Promise callbacks: 1 -// Total number of exported functions: 18 +// Total number of exported functions: 13 #![no_std] @@ -25,12 +25,6 @@ multiversx_sc_wasm_adapter::endpoints! { execute => execute getPendingTransactionById => get_pending_transaction_by_id getPendingTransactions => get_pending_transactions - setMultiTransferAddress => set_multi_transfer_contract_address - setBridgedTokensWrapperAddress => set_bridged_tokens_wrapper_contract_address - setEsdtSafeAddress => set_esdt_safe_contract_address - getMultiTransferAddress => multi_transfer_address - getBridgedTokensWrapperAddress => bridged_tokens_wrapper_address - getEsdtSafeContractAddress => esdt_safe_contract_address highestTxId => highest_tx_id pause => pause_endpoint unpause => unpause_endpoint diff --git a/bridged-tokens-wrapper/Cargo.toml b/bridged-tokens-wrapper/Cargo.toml index 1c6e1682..0724b47c 100644 --- a/bridged-tokens-wrapper/Cargo.toml +++ b/bridged-tokens-wrapper/Cargo.toml @@ -20,11 +20,20 @@ path = "../common/token-module" [dependencies.tx-batch-module] path = "../common/tx-batch-module" +[dependencies.storage-module] +path = "../common/storage-module" + +[dependencies.sc-proxies] +path = "../common/sc-proxies" + +[dependencies.mock-esdt-safe] +path = "../common/mock-contracts/mock-esdt-safe" + [dependencies.multiversx-sc] -version = "=0.52.3" +version = "=0.53.2" [dependencies.multiversx-sc-modules] -version = "=0.52.3" +version = "=0.53.2" [dev-dependencies.multiversx-sc-scenario] -version = "=0.52.3" +version = "=0.53.2" diff --git a/bridged-tokens-wrapper/meta/Cargo.toml b/bridged-tokens-wrapper/meta/Cargo.toml index 7668f9a6..7e0272e5 100644 --- a/bridged-tokens-wrapper/meta/Cargo.toml +++ b/bridged-tokens-wrapper/meta/Cargo.toml @@ -8,5 +8,5 @@ publish = false path = ".." [dependencies.multiversx-sc-meta-lib] -version = "=0.52.3" +version = "=0.53.2" default-features = false diff --git a/bridged-tokens-wrapper/sc-config.toml b/bridged-tokens-wrapper/sc-config.toml index dc186997..0b9bf491 100644 --- a/bridged-tokens-wrapper/sc-config.toml +++ b/bridged-tokens-wrapper/sc-config.toml @@ -1,10 +1,4 @@ [settings] [[proxy]] -path = "../multi-transfer-esdt/src/bridged_tokens_wrapper_proxy.rs" - -[[proxy]] -path = "../multisig/src/bridged_tokens_wrapper_proxy.rs" - -[[proxy]] -path = "../bridge-proxy/src/bridged_tokens_wrapper_proxy.rs" \ No newline at end of file +path = "../common/sc-proxies/src/bridged_tokens_wrapper_proxy.rs" diff --git a/bridged-tokens-wrapper/src/esdt_safe_proxy.rs b/bridged-tokens-wrapper/src/esdt_safe_proxy.rs deleted file mode 100644 index 3832da69..00000000 --- a/bridged-tokens-wrapper/src/esdt_safe_proxy.rs +++ /dev/null @@ -1,810 +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 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, -{ - /// fee_estimator_contract_address - The address of a Price Aggregator contract, - /// which will get the price of token A in token B - /// - /// eth_tx_gas_limit - The gas limit that will be used for transactions on the ETH side. - /// Will be used to compute the fees for the transfer - pub fn init< - Arg0: ProxyArg>, - Arg1: ProxyArg>, - Arg2: ProxyArg>, - >( - self, - fee_estimator_contract_address: Arg0, - multi_transfer_contract_address: Arg1, - eth_tx_gas_limit: Arg2, - ) -> TxTypedDeploy { - self.wrapped_tx - .payment(NotPayable) - .raw_deploy() - .argument(&fee_estimator_contract_address) - .argument(&multi_transfer_contract_address) - .argument(ð_tx_gas_limit) - .original_result() - } -} - -#[rustfmt::skip] -impl EsdtSafeProxyMethods -where - Env: TxEnv, - Env::Api: VMApi, - From: TxFrom, - To: TxTo, - Gas: TxGas, -{ - pub fn upgrade< - Arg0: ProxyArg>, - Arg1: ProxyArg>, - Arg2: ProxyArg>, - Arg3: ProxyArg>, - >( - self, - fee_estimator_contract_address: Arg0, - multi_transfer_contract_address: Arg1, - bridge_proxy_contract_address: Arg2, - eth_tx_gas_limit: Arg3, - ) -> TxTypedUpgrade { - self.wrapped_tx - .payment(NotPayable) - .raw_upgrade() - .argument(&fee_estimator_contract_address) - .argument(&multi_transfer_contract_address) - .argument(&bridge_proxy_contract_address) - .argument(ð_tx_gas_limit) - .original_result() - } -} - -#[rustfmt::skip] -impl EsdtSafeProxyMethods -where - Env: TxEnv, - Env::Api: VMApi, - From: TxFrom, - To: TxTo, - Gas: TxGas, -{ - /// Sets the statuses for the transactions, after they were executed on the Ethereum 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>, - >( - self, - batch_id: Arg0, - tx_statuses: Arg1, - ) -> TxTypedCall { - self.wrapped_tx - .payment(NotPayable) - .raw_call("setTransactionBatchStatus") - .argument(&batch_id) - .argument(&tx_statuses) - .original_result() - } - - /// Converts failed Ethereum -> MultiversX transactions to MultiversX -> Ethereum transaction. - /// This is done every now and then to refund the tokens. - /// - /// As with normal MultiversX -> Ethereum transactions, a part of the tokens will be - /// subtracted to pay for the fees - pub fn add_refund_batch< - Arg0: ProxyArg>>, - >( - self, - refund_transactions: Arg0, - ) -> TxTypedCall { - self.wrapped_tx - .raw_call("addRefundBatch") - .argument(&refund_transactions) - .original_result() - } - - /// Create an MultiversX -> Ethereum transaction. Only fungible tokens are accepted. - /// - /// Every transfer will have a part of the tokens subtracted as fees. - /// The fee amount depends on the global eth_tx_gas_limit - /// and the current GWEI price, respective to the bridged token - /// - /// fee_amount = price_per_gas_unit * eth_tx_gas_limit - pub fn create_transaction< - Arg0: ProxyArg>, - Arg1: ProxyArg>>, - >( - self, - to: Arg0, - opt_refund_info: Arg1, - ) -> TxTypedCall { - self.wrapped_tx - .raw_call("createTransaction") - .argument(&to) - .argument(&opt_refund_info) - .original_result() - } - - /// Claim funds for failed MultiversX -> Ethereum 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() - } - - pub fn set_bridged_tokens_wrapper_contract_address< - Arg0: ProxyArg>>, - >( - self, - opt_address: Arg0, - ) -> TxTypedCall { - self.wrapped_tx - .payment(NotPayable) - .raw_call("setBridgedTokensWrapperAddress") - .argument(&opt_address) - .original_result() - } - - pub fn set_bridge_proxy_contract_address< - Arg0: ProxyArg>>, - >( - self, - opt_new_address: Arg0, - ) -> TxTypedCall { - self.wrapped_tx - .payment(NotPayable) - .raw_call("setBridgeProxyContractAddress") - .argument(&opt_new_address) - .original_result() - } - - pub fn withdraw_refund_fees_for_ethereum< - Arg0: ProxyArg>, - Arg1: ProxyArg>, - >( - self, - token_id: Arg0, - multisig_owner: Arg1, - ) -> TxTypedCall { - self.wrapped_tx - .payment(NotPayable) - .raw_call("withdrawRefundFeesForEthereum") - .argument(&token_id) - .argument(&multisig_owner) - .original_result() - } - - pub fn withdraw_transaction_fees< - Arg0: ProxyArg>, - Arg1: ProxyArg>, - >( - self, - token_id: Arg0, - multisig_owner: Arg1, - ) -> TxTypedCall { - self.wrapped_tx - .payment(NotPayable) - .raw_call("withdrawTransactionFees") - .argument(&token_id) - .argument(&multisig_owner) - .original_result() - } - - pub fn compute_total_amounts_from_index< - Arg0: ProxyArg, - Arg1: ProxyArg, - >( - self, - start_index: Arg0, - end_index: Arg1, - ) -> TxTypedCall>> { - self.wrapped_tx - .payment(NotPayable) - .raw_call("computeTotalAmmountsFromIndex") - .argument(&start_index) - .argument(&end_index) - .original_result() - } - - /// Query function that lists all refund amounts for a user. - /// Useful for knowing which token IDs to pass to the claimRefund endpoint. - pub fn get_refund_amounts< - Arg0: ProxyArg>, - >( - self, - address: Arg0, - ) -> TxTypedCall, BigUint>>> { - self.wrapped_tx - .payment(NotPayable) - .raw_call("getRefundAmounts") - .argument(&address) - .original_result() - } - - pub fn get_total_refund_amounts( - self, - ) -> TxTypedCall, BigUint>>> { - self.wrapped_tx - .payment(NotPayable) - .raw_call("getTotalRefundAmounts") - .original_result() - } - - pub fn get_refund_fees_for_ethereum< - Arg0: ProxyArg>, - >( - self, - token_id: Arg0, - ) -> TxTypedCall> { - self.wrapped_tx - .payment(NotPayable) - .raw_call("getRefundFeesForEthereum") - .argument(&token_id) - .original_result() - } - - pub fn get_transaction_fees< - Arg0: ProxyArg>, - >( - self, - token_id: Arg0, - ) -> TxTypedCall> { - self.wrapped_tx - .payment(NotPayable) - .raw_call("getTransactionFees") - .argument(&token_id) - .original_result() - } - - pub fn bridged_tokens_wrapper_address( - self, - ) -> TxTypedCall> { - self.wrapped_tx - .payment(NotPayable) - .raw_call("getBridgedTokensWrapperAddress") - .original_result() - } - - pub fn bridge_proxy_contract_address( - self, - ) -> TxTypedCall> { - self.wrapped_tx - .payment(NotPayable) - .raw_call("getBridgeProxyContractAddress") - .original_result() - } - - pub fn set_fee_estimator_contract_address< - Arg0: ProxyArg>, - >( - self, - new_address: Arg0, - ) -> TxTypedCall { - self.wrapped_tx - .payment(NotPayable) - .raw_call("setFeeEstimatorContractAddress") - .argument(&new_address) - .original_result() - } - - pub fn set_eth_tx_gas_limit< - Arg0: ProxyArg>, - >( - self, - new_limit: Arg0, - ) -> TxTypedCall { - self.wrapped_tx - .payment(NotPayable) - .raw_call("setEthTxGasLimit") - .argument(&new_limit) - .original_result() - } - - /// Default price being used if the aggregator lacks a mapping for this token - /// or the aggregator address is not set - pub fn set_default_price_per_gas_unit< - Arg0: ProxyArg>, - Arg1: ProxyArg>, - >( - self, - token_id: Arg0, - default_price_per_gas_unit: Arg1, - ) -> TxTypedCall { - self.wrapped_tx - .payment(NotPayable) - .raw_call("setDefaultPricePerGasUnit") - .argument(&token_id) - .argument(&default_price_per_gas_unit) - .original_result() - } - - /// Token ticker being used when querying the aggregator for GWEI prices - pub fn set_token_ticker< - Arg0: ProxyArg>, - Arg1: ProxyArg>, - >( - self, - token_id: Arg0, - ticker: Arg1, - ) -> TxTypedCall { - self.wrapped_tx - .payment(NotPayable) - .raw_call("setTokenTicker") - .argument(&token_id) - .argument(&ticker) - .original_result() - } - - /// Returns the fee for the given token ID (the fee amount is in the given token) - pub fn calculate_required_fee< - Arg0: ProxyArg>, - >( - self, - token_id: Arg0, - ) -> TxTypedCall> { - self.wrapped_tx - .payment(NotPayable) - .raw_call("calculateRequiredFee") - .argument(&token_id) - .original_result() - } - - pub fn fee_estimator_contract_address( - self, - ) -> TxTypedCall> { - self.wrapped_tx - .payment(NotPayable) - .raw_call("getFeeEstimatorContractAddress") - .original_result() - } - - pub fn default_price_per_gas_unit< - Arg0: ProxyArg>, - >( - self, - token_id: Arg0, - ) -> TxTypedCall> { - self.wrapped_tx - .payment(NotPayable) - .raw_call("getDefaultPricePerGasUnit") - .argument(&token_id) - .original_result() - } - - pub fn eth_tx_gas_limit( - self, - ) -> TxTypedCall> { - self.wrapped_tx - .payment(NotPayable) - .raw_call("getEthTxGasLimit") - .original_result() - } - - /// Distributes the accumulated fees to the given addresses. - /// Expected arguments are pairs of (address, percentage), - /// where percentages must add up to the PERCENTAGE_TOTAL constant - pub fn distribute_fees< - Arg0: ProxyArg>>, - >( - self, - address_percentage_pairs: Arg0, - ) -> TxTypedCall { - self.wrapped_tx - .payment(NotPayable) - .raw_call("distributeFees") - .argument(&address_percentage_pairs) - .original_result() - } - - pub fn add_token_to_whitelist< - Arg0: ProxyArg>, - Arg1: ProxyArg>, - Arg2: ProxyArg, - Arg3: ProxyArg, - Arg4: ProxyArg>, - Arg5: ProxyArg>, - Arg6: ProxyArg>, - Arg7: ProxyArg>>, - >( - self, - token_id: Arg0, - ticker: Arg1, - mint_burn_token: Arg2, - native_token: Arg3, - total_balance: Arg4, - mint_balance: Arg5, - burn_balance: Arg6, - opt_default_price_per_gas_unit: Arg7, - ) -> TxTypedCall { - self.wrapped_tx - .raw_call("addTokenToWhitelist") - .argument(&token_id) - .argument(&ticker) - .argument(&mint_burn_token) - .argument(&native_token) - .argument(&total_balance) - .argument(&mint_balance) - .argument(&burn_balance) - .argument(&opt_default_price_per_gas_unit) - .original_result() - } - - pub fn remove_token_from_whitelist< - Arg0: ProxyArg>, - >( - self, - token_id: Arg0, - ) -> TxTypedCall { - self.wrapped_tx - .payment(NotPayable) - .raw_call("removeTokenFromWhitelist") - .argument(&token_id) - .original_result() - } - - pub fn get_tokens< - Arg0: ProxyArg>, - Arg1: ProxyArg>, - >( - self, - token_id: Arg0, - amount: Arg1, - ) -> TxTypedCall { - self.wrapped_tx - .payment(NotPayable) - .raw_call("getTokens") - .argument(&token_id) - .argument(&amount) - .original_result() - } - - pub fn init_supply< - Arg0: ProxyArg>, - Arg1: ProxyArg>, - >( - self, - token_id: Arg0, - amount: Arg1, - ) -> TxTypedCall { - self.wrapped_tx - .raw_call("initSupply") - .argument(&token_id) - .argument(&amount) - .original_result() - } - - pub fn init_supply_mint_burn< - Arg0: ProxyArg>, - Arg1: ProxyArg>, - Arg2: ProxyArg>, - >( - self, - token_id: Arg0, - mint_amount: Arg1, - burn_amount: Arg2, - ) -> TxTypedCall { - self.wrapped_tx - .payment(NotPayable) - .raw_call("initSupplyMintBurn") - .argument(&token_id) - .argument(&mint_amount) - .argument(&burn_amount) - .original_result() - } - - pub fn set_multi_transfer_contract_address< - Arg0: ProxyArg>>, - >( - self, - opt_new_address: Arg0, - ) -> TxTypedCall { - self.wrapped_tx - .payment(NotPayable) - .raw_call("setMultiTransferContractAddress") - .argument(&opt_new_address) - .original_result() - } - - pub fn token_whitelist( - self, - ) -> TxTypedCall>> { - self.wrapped_tx - .payment(NotPayable) - .raw_call("getAllKnownTokens") - .original_result() - } - - pub fn native_token< - Arg0: ProxyArg>, - >( - self, - token: Arg0, - ) -> TxTypedCall { - self.wrapped_tx - .payment(NotPayable) - .raw_call("isNativeToken") - .argument(&token) - .original_result() - } - - pub fn mint_burn_token< - Arg0: ProxyArg>, - >( - self, - token: Arg0, - ) -> TxTypedCall { - self.wrapped_tx - .payment(NotPayable) - .raw_call("isMintBurnToken") - .argument(&token) - .original_result() - } - - pub fn multi_transfer_contract_address( - self, - ) -> TxTypedCall> { - self.wrapped_tx - .payment(NotPayable) - .raw_call("getMultiTransferContractAddress") - .original_result() - } - - pub fn accumulated_transaction_fees< - Arg0: ProxyArg>, - >( - self, - token_id: Arg0, - ) -> TxTypedCall> { - self.wrapped_tx - .payment(NotPayable) - .raw_call("getAccumulatedTransactionFees") - .argument(&token_id) - .original_result() - } - - pub fn total_balances< - Arg0: ProxyArg>, - >( - self, - token_id: Arg0, - ) -> TxTypedCall> { - self.wrapped_tx - .payment(NotPayable) - .raw_call("getTotalBalances") - .argument(&token_id) - .original_result() - } - - pub fn mint_balances< - Arg0: ProxyArg>, - >( - self, - token_id: Arg0, - ) -> TxTypedCall> { - self.wrapped_tx - .payment(NotPayable) - .raw_call("getMintBalances") - .argument(&token_id) - .original_result() - } - - pub fn burn_balances< - Arg0: ProxyArg>, - >( - self, - token_id: Arg0, - ) -> TxTypedCall> { - self.wrapped_tx - .payment(NotPayable) - .raw_call("getBurnBalances") - .argument(&token_id) - .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, ManagedBuffer, TokenIdentifier, BigUint>>>>> { - self.wrapped_tx - .payment(NotPayable) - .raw_call("getCurrentTxBatch") - .original_result() - } - - pub fn get_first_batch_any_status( - self, - ) -> TxTypedCall, ManagedBuffer, TokenIdentifier, BigUint>>>>> { - self.wrapped_tx - .payment(NotPayable) - .raw_call("getFirstBatchAnyStatus") - .original_result() - } - - pub fn get_batch< - Arg0: ProxyArg, - >( - self, - batch_id: Arg0, - ) -> TxTypedCall, ManagedBuffer, TokenIdentifier, BigUint>>>>> { - 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 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() - } -} - -#[type_abi] -#[derive(TopEncode, TopDecode, NestedEncode, NestedDecode, Clone, ManagedVecItem, PartialEq)] -pub struct RefundInfo -where - Api: ManagedTypeApi, -{ - pub address: ManagedAddress, - pub initial_batch_id: u64, - pub initial_nonce: u64, -} diff --git a/bridged-tokens-wrapper/src/lib.rs b/bridged-tokens-wrapper/src/lib.rs index 15d4fabc..deb5541f 100644 --- a/bridged-tokens-wrapper/src/lib.rs +++ b/bridged-tokens-wrapper/src/lib.rs @@ -1,11 +1,11 @@ #![no_std] mod dfp_big_uint; -mod esdt_safe_proxy; mod events; use core::ops::Deref; pub use dfp_big_uint::DFPBigUint; +use sc_proxies::esdt_safe_proxy; use transaction::PaymentsVec; use eth_address::*; @@ -15,7 +15,9 @@ impl DFPBigUint {} #[multiversx_sc::contract] pub trait BridgedTokensWrapper: - multiversx_sc_modules::pause::PauseModule + events::EventsModule + multiversx_sc_modules::pause::PauseModule + + events::EventsModule + + storage_module::CommonStorageModule { #[init] fn init(&self) { diff --git a/bridged-tokens-wrapper/tests/bridged_tokens_wrapper_whitebox_test.rs b/bridged-tokens-wrapper/tests/bridged_tokens_wrapper_whitebox_test.rs index 8472a856..a36bd34d 100644 --- a/bridged-tokens-wrapper/tests/bridged_tokens_wrapper_whitebox_test.rs +++ b/bridged-tokens-wrapper/tests/bridged_tokens_wrapper_whitebox_test.rs @@ -1,3 +1,5 @@ +#![allow(deprecated)] + use bridged_tokens_wrapper::BridgedTokensWrapper; use eth_address::EthAddress; use multiversx_sc_modules::pause::PauseModule; @@ -12,8 +14,6 @@ const NUM_DECIMALS: u32 = 18; const OWNER_ADDRESS_EXPR: &str = "address:owner"; const BRIDGE_TOKENS_WRAPPER_ADDRESS_EXPR: &str = "sc:bridged-tokens-wrapper"; const BRIDGE_TOKENS_WRAPPER_PATH_EXPR: &str = "mxsc:output/bridged-tokens-wrapper.mxsc.json"; -// const ESDT_SAFE_CONTRACT_ADDRESS_EXPR: &str = "address:esdt_safe"; -// const ESDT_SAFE_CONTRACT_PATH_EXPR: &str = "mxsc:../esdt-safe/output/esdt-safe.mxsc.json"; fn world() -> ScenarioWorld { let mut blockchain = ScenarioWorld::new(); @@ -1109,30 +1109,6 @@ fn setup() -> ScenarioWorld { }, ); - // let esdt_safe_whitebox = - // WhiteboxContract::new(ESDT_SAFE_CONTRACT_ADDRESS_EXPR, esdt_safe::contract_obj); - // let esdt_safe_code = world.code_expression(ESDT_SAFE_CONTRACT_PATH_EXPR); - - // let state_step = SetStateStep::new() - // .put_account(OWNER_ADDRESS_EXPR, Account::new().nonce(1)) - // .new_address(OWNER_ADDRESS_EXPR, 1, ESDT_SAFE_ADDRESS) - // .block_timestamp(100); - - // world - // .tx() - // .from(OWNER_ADDRESS) - // .typed(esdt_safe_proxy::EsdtSafeProxy) - // .init( - // ManagedAddress::zero(), - // ManagedAddress::zero(), - // BigUint::zero(), - // ) - // .code(ESDT_SAFE_CODE_PATH) - // .new_address(ESDT_SAFE_ADDRESS) - // .run(); - - // world.set_state_step(state_step); - world } diff --git a/bridged-tokens-wrapper/wasm/Cargo.lock b/bridged-tokens-wrapper/wasm/Cargo.lock index 9de5b8cd..b9c24aa6 100644 --- a/bridged-tokens-wrapper/wasm/Cargo.lock +++ b/bridged-tokens-wrapper/wasm/Cargo.lock @@ -4,15 +4,15 @@ 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" -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" @@ -27,6 +27,8 @@ dependencies = [ "eth-address", "multiversx-sc", "multiversx-sc-modules", + "sc-proxies", + "storage-module", "token-module", "transaction", "tx-batch-module", @@ -58,6 +60,7 @@ name = "fee-estimator-module" version = "0.0.0" dependencies = [ "multiversx-sc", + "storage-module", ] [[package]] @@ -74,9 +77,9 @@ checksum = "6fe2267d4ed49bc07b63801559be28c718ea06c4738b7a03c94df7386d2cde46" [[package]] name = "multiversx-sc" -version = "0.52.3" +version = "0.53.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "526760b1d6236c011285b264a70a0a9dd3b3dbc53c3b5f76932f4bcfd3a8910c" +checksum = "75ea89a26f0aacda21437a8ae5ccfbefab99d8191942b3d2eddbcbf84f9866d7" dependencies = [ "bitflags", "hex-literal", @@ -88,9 +91,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 +102,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 +114,9 @@ dependencies = [ [[package]] name = "multiversx-sc-derive" -version = "0.52.3" +version = "0.53.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3557f2f12640a8a07fa6af66cc2a13b188c5b61bed72db22fe631fb3a60c3e96" +checksum = "4c17fdf90fafca2f19085ae67b0502d9f71bf8ab1be3c83808eb88e02a8c18b9" dependencies = [ "hex", "proc-macro2", @@ -124,18 +127,18 @@ dependencies = [ [[package]] name = "multiversx-sc-modules" -version = "0.52.3" +version = "0.53.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "61f5c29c6044f3dc9e866858feee625d7fae5604a68ac7bd66dec683eee97563" +checksum = "daeb48acbd39255868a3241798df2f85050f0ae8d82d6417bd2cd0e30a241855" dependencies = [ "multiversx-sc", ] [[package]] name = "multiversx-sc-wasm-adapter" -version = "0.52.3" +version = "0.53.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ed13aaca9cbdbc6911174cd3029e750a7563d85dd3daaa1107b1fd31c7f17245" +checksum = "20659915a4377d375c46d7f237e810053a03f7e084fad6362dd5748a7233defb" dependencies = [ "multiversx-sc", ] @@ -169,9 +172,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", ] @@ -186,17 +189,35 @@ dependencies = [ "nibble_vec", ] +[[package]] +name = "sc-proxies" +version = "0.0.0" +dependencies = [ + "eth-address", + "multiversx-sc", + "token-module", + "transaction", + "tx-batch-module", +] + [[package]] name = "smallvec" version = "1.13.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3c5e1a9a646d36c3599cd173a41282daf47c44583ad367b8e6837255952e5c67" +[[package]] +name = "storage-module" +version = "0.1.0" +dependencies = [ + "multiversx-sc", +] + [[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", @@ -209,6 +230,7 @@ version = "0.0.0" dependencies = [ "fee-estimator-module", "multiversx-sc", + "storage-module", ] [[package]] @@ -229,9 +251,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/bridged-tokens-wrapper/wasm/Cargo.toml b/bridged-tokens-wrapper/wasm/Cargo.toml index 12b6d648..ceba7569 100644 --- a/bridged-tokens-wrapper/wasm/Cargo.toml +++ b/bridged-tokens-wrapper/wasm/Cargo.toml @@ -28,7 +28,7 @@ panic = "abort" path = ".." [dependencies.multiversx-sc-wasm-adapter] -version = "=0.52.3" +version = "=0.53.2" [workspace] members = ["."] diff --git a/common/eth-address/Cargo.toml b/common/eth-address/Cargo.toml index 69e29eb8..776ecbc9 100644 --- a/common/eth-address/Cargo.toml +++ b/common/eth-address/Cargo.toml @@ -8,4 +8,4 @@ edition = "2018" path = "src/lib.rs" [dependencies.multiversx-sc] -version = "=0.52.3" +version = "=0.53.2" diff --git a/common/fee-estimator-module/Cargo.toml b/common/fee-estimator-module/Cargo.toml index aed9a0db..93174d71 100644 --- a/common/fee-estimator-module/Cargo.toml +++ b/common/fee-estimator-module/Cargo.toml @@ -5,7 +5,10 @@ authors = ["dorin-iancu "] edition = "2018" [dependencies.multiversx-sc] -version = "=0.52.3" +version = "=0.53.2" [dev-dependencies.multiversx-sc-scenario] -version = "=0.52.3" +version = "=0.53.2" + +[dependencies.storage-module] +path = "../storage-module" \ No newline at end of file diff --git a/common/fee-estimator-module/src/lib.rs b/common/fee-estimator-module/src/lib.rs index e7aa8cb3..ebb44168 100644 --- a/common/fee-estimator-module/src/lib.rs +++ b/common/fee-estimator-module/src/lib.rs @@ -6,13 +6,7 @@ mod price_aggregator_proxy; pub const GWEI_STRING: &[u8] = b"GWEI"; #[multiversx_sc::module] -pub trait FeeEstimatorModule { - #[only_owner] - #[endpoint(setFeeEstimatorContractAddress)] - fn set_fee_estimator_contract_address(&self, new_address: ManagedAddress) { - self.fee_estimator_contract_address().set(&new_address); - } - +pub trait FeeEstimatorModule: storage_module::CommonStorageModule { #[only_owner] #[endpoint(setEthTxGasLimit)] fn set_eth_tx_gas_limit(&self, new_limit: BigUint) { @@ -59,7 +53,7 @@ pub trait FeeEstimatorModule { from: &TokenIdentifier, to: &TokenIdentifier, ) -> Option { - let fee_estimator_sc_address = self.fee_estimator_contract_address().get(); + let fee_estimator_sc_address = self.get_fee_estimator_address(); if fee_estimator_sc_address.is_zero() { return None; } @@ -82,10 +76,6 @@ pub trait FeeEstimatorModule { // storage - #[view(getFeeEstimatorContractAddress)] - #[storage_mapper("feeEstimatorContractAddress")] - fn fee_estimator_contract_address(&self) -> SingleValueMapper; - #[view(getDefaultPricePerGasUnit)] #[storage_mapper("defaultPricePerGasUnit")] fn default_price_per_gas_unit(&self, token_id: &TokenIdentifier) -> SingleValueMapper; diff --git a/common/max-bridged-amount-module/Cargo.toml b/common/max-bridged-amount-module/Cargo.toml index 3492e794..56f07d9e 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.3" +version = "=0.53.2" [dev-dependencies.multiversx-sc-scenario] -version = "=0.52.3" +version = "=0.53.2" diff --git a/common/mock-contracts/mock-bridge-proxy/Cargo.lock b/common/mock-contracts/mock-bridge-proxy/Cargo.lock new file mode 100644 index 00000000..49278014 --- /dev/null +++ b/common/mock-contracts/mock-bridge-proxy/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.89" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "86fdf8605db99b54d3cd748a44c6d04df638eb5dafb219b135d0149bd0db01f6" + +[[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.159" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "561d97a539a36e26a9a5fad1ea11a3039a67714694aaa379433e580854bc3dc5" + +[[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 = "mock-bridge-proxy" +version = "0.0.0" +dependencies = [ + "multiversx-sc", + "multiversx-sc-scenario", + "num-bigint", +] + +[[package]] +name = "mock-bridge-proxy-meta" +version = "0.0.0" +dependencies = [ + "mock-bridge-proxy", + "multiversx-sc-meta-lib", +] + +[[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.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8835116a5c179084a830efb3adc117ab007512b535bc1a21c991d3b32a6b44dd" + +[[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.128" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6ff5456707a1de34e7e37f2a6fd3d3f808c318259cbd01ab6377795054b483d8" +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 = "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/common/mock-contracts/mock-bridge-proxy/Cargo.toml b/common/mock-contracts/mock-bridge-proxy/Cargo.toml new file mode 100644 index 00000000..a3416287 --- /dev/null +++ b/common/mock-contracts/mock-bridge-proxy/Cargo.toml @@ -0,0 +1,18 @@ +[package] +name = "mock-bridge-proxy" +version = "0.0.0" +publish = false +edition = "2021" +authors = ["you"] + +[lib] +path = "src/mock_bridge_proxy.rs" + +[dependencies.multiversx-sc] +version = "0.53.2" + +[dev-dependencies] +num-bigint = "0.4" + +[dev-dependencies.multiversx-sc-scenario] +version = "0.53.2" diff --git a/common/mock-contracts/mock-bridge-proxy/meta/Cargo.toml b/common/mock-contracts/mock-bridge-proxy/meta/Cargo.toml new file mode 100644 index 00000000..23c56abb --- /dev/null +++ b/common/mock-contracts/mock-bridge-proxy/meta/Cargo.toml @@ -0,0 +1,12 @@ +[package] +name = "mock-bridge-proxy-meta" +version = "0.0.0" +edition = "2021" +publish = false + +[dependencies.mock-bridge-proxy] +path = ".." + +[dependencies.multiversx-sc-meta-lib] +version = "0.53.2" +default-features = false diff --git a/common/mock-contracts/mock-bridge-proxy/meta/src/main.rs b/common/mock-contracts/mock-bridge-proxy/meta/src/main.rs new file mode 100644 index 00000000..ff373dc2 --- /dev/null +++ b/common/mock-contracts/mock-bridge-proxy/meta/src/main.rs @@ -0,0 +1,3 @@ +fn main() { + multiversx_sc_meta_lib::cli_main::(); +} diff --git a/common/mock-contracts/mock-bridge-proxy/multiversx.json b/common/mock-contracts/mock-bridge-proxy/multiversx.json new file mode 100644 index 00000000..73655396 --- /dev/null +++ b/common/mock-contracts/mock-bridge-proxy/multiversx.json @@ -0,0 +1,3 @@ +{ + "language": "rust" +} \ No newline at end of file diff --git a/common/mock-contracts/mock-bridge-proxy/src/mock_bridge_proxy.rs b/common/mock-contracts/mock-bridge-proxy/src/mock_bridge_proxy.rs new file mode 100644 index 00000000..ebd51f63 --- /dev/null +++ b/common/mock-contracts/mock-bridge-proxy/src/mock_bridge_proxy.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 MockBridgeProxy { + #[init] + fn init(&self, _opt_multi_transfer_address: OptionalValue) {} + + #[upgrade] + fn upgrade(&self) {} +} diff --git a/common/mock-contracts/mock-bridge-proxy/wasm/Cargo.lock b/common/mock-contracts/mock-bridge-proxy/wasm/Cargo.lock new file mode 100644 index 00000000..054fccfa --- /dev/null +++ b/common/mock-contracts/mock-bridge-proxy/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 = "mock-bridge-proxy" +version = "0.0.0" +dependencies = [ + "multiversx-sc", +] + +[[package]] +name = "mock-bridge-proxy-wasm" +version = "0.0.0" +dependencies = [ + "mock-bridge-proxy", + "multiversx-sc-wasm-adapter", +] + +[[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 = "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/common/mock-contracts/mock-bridge-proxy/wasm/Cargo.toml b/common/mock-contracts/mock-bridge-proxy/wasm/Cargo.toml new file mode 100644 index 00000000..c8bb9169 --- /dev/null +++ b/common/mock-contracts/mock-bridge-proxy/wasm/Cargo.toml @@ -0,0 +1,34 @@ +# Code generated by the multiversx-sc build system. DO NOT EDIT. + +# ########################################## +# ############## AUTO-GENERATED ############# +# ########################################## + +[package] +name = "mock-bridge-proxy-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.mock-bridge-proxy] +path = ".." + +[dependencies.multiversx-sc-wasm-adapter] +version = "0.53.2" + +[workspace] +members = ["."] diff --git a/common/mock-contracts/mock-bridge-proxy/wasm/src/lib.rs b/common/mock-contracts/mock-bridge-proxy/wasm/src/lib.rs new file mode 100644 index 00000000..5ecacafc --- /dev/null +++ b/common/mock-contracts/mock-bridge-proxy/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! { + mock_bridge_proxy + ( + init => init + upgrade => upgrade + ) +} + +multiversx_sc_wasm_adapter::async_callback_empty! {} diff --git a/common/mock-contracts/mock-bridged-tokens-wrapper/Cargo.lock b/common/mock-contracts/mock-bridged-tokens-wrapper/Cargo.lock new file mode 100644 index 00000000..ab281ca4 --- /dev/null +++ b/common/mock-contracts/mock-bridged-tokens-wrapper/Cargo.lock @@ -0,0 +1,1167 @@ +# 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.89" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "86fdf8605db99b54d3cd748a44c6d04df638eb5dafb219b135d0149bd0db01f6" + +[[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 = "eth-address" +version = "0.0.0" +dependencies = [ + "multiversx-sc", +] + +[[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.159" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "561d97a539a36e26a9a5fad1ea11a3039a67714694aaa379433e580854bc3dc5" + +[[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 = "mock-bridged-tokens-wrapper" +version = "0.0.0" +dependencies = [ + "eth-address", + "multiversx-sc", + "multiversx-sc-scenario", + "num-bigint", +] + +[[package]] +name = "mock-bridged-tokens-wrapper-meta" +version = "0.0.0" +dependencies = [ + "mock-bridged-tokens-wrapper", + "multiversx-sc-meta-lib", +] + +[[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.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8835116a5c179084a830efb3adc117ab007512b535bc1a21c991d3b32a6b44dd" + +[[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.128" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6ff5456707a1de34e7e37f2a6fd3d3f808c318259cbd01ab6377795054b483d8" +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 = "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/common/mock-contracts/mock-bridged-tokens-wrapper/Cargo.toml b/common/mock-contracts/mock-bridged-tokens-wrapper/Cargo.toml new file mode 100644 index 00000000..29bc0f87 --- /dev/null +++ b/common/mock-contracts/mock-bridged-tokens-wrapper/Cargo.toml @@ -0,0 +1,21 @@ +[package] +name = "mock-bridged-tokens-wrapper" +version = "0.0.0" +publish = false +edition = "2021" +authors = ["you"] + +[lib] +path = "src/mock_bridged_tokens_wrapper.rs" + +[dependencies.eth-address] +path = "../../eth-address" + +[dependencies.multiversx-sc] +version = "0.53.2" + +[dev-dependencies] +num-bigint = "0.4" + +[dev-dependencies.multiversx-sc-scenario] +version = "0.53.2" \ No newline at end of file diff --git a/common/mock-contracts/mock-bridged-tokens-wrapper/meta/Cargo.toml b/common/mock-contracts/mock-bridged-tokens-wrapper/meta/Cargo.toml new file mode 100644 index 00000000..abda2358 --- /dev/null +++ b/common/mock-contracts/mock-bridged-tokens-wrapper/meta/Cargo.toml @@ -0,0 +1,12 @@ +[package] +name = "mock-bridged-tokens-wrapper-meta" +version = "0.0.0" +edition = "2021" +publish = false + +[dependencies.mock-bridged-tokens-wrapper] +path = ".." + +[dependencies.multiversx-sc-meta-lib] +version = "0.53.2" +default-features = false diff --git a/common/mock-contracts/mock-bridged-tokens-wrapper/meta/src/main.rs b/common/mock-contracts/mock-bridged-tokens-wrapper/meta/src/main.rs new file mode 100644 index 00000000..2d58073b --- /dev/null +++ b/common/mock-contracts/mock-bridged-tokens-wrapper/meta/src/main.rs @@ -0,0 +1,3 @@ +fn main() { + multiversx_sc_meta_lib::cli_main::(); +} diff --git a/common/mock-contracts/mock-bridged-tokens-wrapper/multiversx.json b/common/mock-contracts/mock-bridged-tokens-wrapper/multiversx.json new file mode 100644 index 00000000..73655396 --- /dev/null +++ b/common/mock-contracts/mock-bridged-tokens-wrapper/multiversx.json @@ -0,0 +1,3 @@ +{ + "language": "rust" +} \ No newline at end of file diff --git a/common/mock-contracts/mock-bridged-tokens-wrapper/src/mock_bridged_tokens_wrapper.rs b/common/mock-contracts/mock-bridged-tokens-wrapper/src/mock_bridged_tokens_wrapper.rs new file mode 100644 index 00000000..9ac6e947 --- /dev/null +++ b/common/mock-contracts/mock-bridged-tokens-wrapper/src/mock_bridged_tokens_wrapper.rs @@ -0,0 +1,25 @@ +#![no_std] + +use eth_address::EthAddress; +#[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 MockBridgedTokensWrapper { + #[init] + fn init(&self) {} + + #[upgrade] + fn upgrade(&self) {} + + #[payable("*")] + #[endpoint(unwrapTokenCreateTransaction)] + fn unwrap_token_create_transaction( + &self, + _requested_token: TokenIdentifier, + _to: EthAddress, + _opt_refunding_address: OptionalValue, + ) { + } +} diff --git a/common/mock-contracts/mock-bridged-tokens-wrapper/wasm/Cargo.lock b/common/mock-contracts/mock-bridged-tokens-wrapper/wasm/Cargo.lock new file mode 100644 index 00000000..8ce87bf0 --- /dev/null +++ b/common/mock-contracts/mock-bridged-tokens-wrapper/wasm/Cargo.lock @@ -0,0 +1,196 @@ +# 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 = "eth-address" +version = "0.0.0" +dependencies = [ + "multiversx-sc", +] + +[[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 = "mock-bridged-tokens-wrapper" +version = "0.0.0" +dependencies = [ + "eth-address", + "multiversx-sc", +] + +[[package]] +name = "mock-bridged-tokens-wrapper-wasm" +version = "0.0.0" +dependencies = [ + "mock-bridged-tokens-wrapper", + "multiversx-sc-wasm-adapter", +] + +[[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 = "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/common/mock-contracts/mock-bridged-tokens-wrapper/wasm/Cargo.toml b/common/mock-contracts/mock-bridged-tokens-wrapper/wasm/Cargo.toml new file mode 100644 index 00000000..40e98cbe --- /dev/null +++ b/common/mock-contracts/mock-bridged-tokens-wrapper/wasm/Cargo.toml @@ -0,0 +1,34 @@ +# Code generated by the multiversx-sc build system. DO NOT EDIT. + +# ########################################## +# ############## AUTO-GENERATED ############# +# ########################################## + +[package] +name = "mock-bridged-tokens-wrapper-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.mock-bridged-tokens-wrapper] +path = ".." + +[dependencies.multiversx-sc-wasm-adapter] +version = "0.53.2" + +[workspace] +members = ["."] diff --git a/common/mock-contracts/mock-bridged-tokens-wrapper/wasm/src/lib.rs b/common/mock-contracts/mock-bridged-tokens-wrapper/wasm/src/lib.rs new file mode 100644 index 00000000..8b9be8d1 --- /dev/null +++ b/common/mock-contracts/mock-bridged-tokens-wrapper/wasm/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! { + mock_bridged_tokens_wrapper + ( + init => init + upgrade => upgrade + unwrapTokenCreateTransaction => unwrap_token_create_transaction + ) +} + +multiversx_sc_wasm_adapter::async_callback_empty! {} diff --git a/common/mock-contracts/mock-esdt-safe/Cargo.lock b/common/mock-contracts/mock-esdt-safe/Cargo.lock new file mode 100644 index 00000000..e2e1a10b --- /dev/null +++ b/common/mock-contracts/mock-esdt-safe/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.89" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "86fdf8605db99b54d3cd748a44c6d04df638eb5dafb219b135d0149bd0db01f6" + +[[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.159" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "561d97a539a36e26a9a5fad1ea11a3039a67714694aaa379433e580854bc3dc5" + +[[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 = "mock-esdt-safe" +version = "0.0.0" +dependencies = [ + "multiversx-sc", + "multiversx-sc-scenario", + "num-bigint", +] + +[[package]] +name = "mock-esdt-safe-meta" +version = "0.0.0" +dependencies = [ + "mock-esdt-safe", + "multiversx-sc-meta-lib", +] + +[[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.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8835116a5c179084a830efb3adc117ab007512b535bc1a21c991d3b32a6b44dd" + +[[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.128" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6ff5456707a1de34e7e37f2a6fd3d3f808c318259cbd01ab6377795054b483d8" +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 = "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/common/mock-contracts/mock-esdt-safe/Cargo.toml b/common/mock-contracts/mock-esdt-safe/Cargo.toml new file mode 100644 index 00000000..b08e4109 --- /dev/null +++ b/common/mock-contracts/mock-esdt-safe/Cargo.toml @@ -0,0 +1,21 @@ +[package] +name = "mock-esdt-safe" +version = "0.0.0" +publish = false +edition = "2021" +authors = ["you"] + +[lib] +path = "src/mock_esdt_safe.rs" + +[dependencies.multiversx-sc] +version = "=0.53.2" + +[dependencies.multiversx-sc-modules] +version = "=0.53.2" + +[dev-dependencies.multiversx-sc-scenario] +version = "=0.53.2" + +[dependencies.eth-address] +path = "../../eth-address" \ No newline at end of file diff --git a/common/mock-contracts/mock-esdt-safe/meta/Cargo.toml b/common/mock-contracts/mock-esdt-safe/meta/Cargo.toml new file mode 100644 index 00000000..563451cd --- /dev/null +++ b/common/mock-contracts/mock-esdt-safe/meta/Cargo.toml @@ -0,0 +1,12 @@ +[package] +name = "mock-esdt-safe-meta" +version = "0.0.0" +edition = "2021" +publish = false + +[dependencies.mock-esdt-safe] +path = ".." + +[dependencies.multiversx-sc-meta-lib] +version = "0.53.2" +default-features = false diff --git a/common/mock-contracts/mock-esdt-safe/meta/src/main.rs b/common/mock-contracts/mock-esdt-safe/meta/src/main.rs new file mode 100644 index 00000000..488aa69a --- /dev/null +++ b/common/mock-contracts/mock-esdt-safe/meta/src/main.rs @@ -0,0 +1,3 @@ +fn main() { + multiversx_sc_meta_lib::cli_main::(); +} diff --git a/common/mock-contracts/mock-esdt-safe/multiversx.json b/common/mock-contracts/mock-esdt-safe/multiversx.json new file mode 100644 index 00000000..73655396 --- /dev/null +++ b/common/mock-contracts/mock-esdt-safe/multiversx.json @@ -0,0 +1,3 @@ +{ + "language": "rust" +} \ No newline at end of file diff --git a/common/mock-contracts/mock-esdt-safe/src/mock_esdt_safe.rs b/common/mock-contracts/mock-esdt-safe/src/mock_esdt_safe.rs new file mode 100644 index 00000000..991fc205 --- /dev/null +++ b/common/mock-contracts/mock-esdt-safe/src/mock_esdt_safe.rs @@ -0,0 +1,38 @@ +#![no_std] +multiversx_sc::imports!(); +multiversx_sc::derive_imports!(); + +use eth_address::EthAddress; + +#[type_abi] +#[derive(TopEncode, TopDecode, NestedEncode, NestedDecode, Clone, ManagedVecItem, PartialEq)] +pub struct RefundInfo { + pub address: ManagedAddress, + pub initial_batch_id: u64, + pub initial_nonce: u64, +} + +/// An empty contract. To be used as a template when starting a new contract from scratch. +#[multiversx_sc::contract] +pub trait MockEsdtSafe { + #[init] + fn init( + &self, + _fee_estimator_contract_address: ManagedAddress, + _multi_transfer_contract_address: ManagedAddress, + _eth_tx_gas_limit: BigUint, + ) { + } + + #[upgrade] + fn upgrade(&self) {} + + #[payable("*")] + #[endpoint(createTransaction)] + fn create_transaction( + &self, + _to: EthAddress, + _opt_refund_info: OptionalValue>, + ) { + } +} diff --git a/common/mock-contracts/mock-esdt-safe/wasm/Cargo.lock b/common/mock-contracts/mock-esdt-safe/wasm/Cargo.lock new file mode 100644 index 00000000..ba9f94e7 --- /dev/null +++ b/common/mock-contracts/mock-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.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 = "mock-esdt-safe" +version = "0.0.0" +dependencies = [ + "multiversx-sc", +] + +[[package]] +name = "mock-esdt-safe-wasm" +version = "0.0.0" +dependencies = [ + "mock-esdt-safe", + "multiversx-sc-wasm-adapter", +] + +[[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 = "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/common/mock-contracts/mock-esdt-safe/wasm/Cargo.toml b/common/mock-contracts/mock-esdt-safe/wasm/Cargo.toml new file mode 100644 index 00000000..cf6bffc5 --- /dev/null +++ b/common/mock-contracts/mock-esdt-safe/wasm/Cargo.toml @@ -0,0 +1,34 @@ +# Code generated by the multiversx-sc build system. DO NOT EDIT. + +# ########################################## +# ############## AUTO-GENERATED ############# +# ########################################## + +[package] +name = "mock-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.mock-esdt-safe] +path = ".." + +[dependencies.multiversx-sc-wasm-adapter] +version = "0.53.2" + +[workspace] +members = ["."] diff --git a/common/mock-contracts/mock-esdt-safe/wasm/src/lib.rs b/common/mock-contracts/mock-esdt-safe/wasm/src/lib.rs new file mode 100644 index 00000000..e6872d67 --- /dev/null +++ b/common/mock-contracts/mock-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! { + mock_esdt_safe + ( + init => init + upgrade => upgrade + ) +} + +multiversx_sc_wasm_adapter::async_callback_empty! {} diff --git a/common/mock-contracts/mock-multi-transfer-esdt/Cargo.lock b/common/mock-contracts/mock-multi-transfer-esdt/Cargo.lock new file mode 100644 index 00000000..ff2a87cf --- /dev/null +++ b/common/mock-contracts/mock-multi-transfer-esdt/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.89" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "86fdf8605db99b54d3cd748a44c6d04df638eb5dafb219b135d0149bd0db01f6" + +[[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.159" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "561d97a539a36e26a9a5fad1ea11a3039a67714694aaa379433e580854bc3dc5" + +[[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 = "mock-multi-transfer-esdt" +version = "0.0.0" +dependencies = [ + "multiversx-sc", + "multiversx-sc-scenario", + "num-bigint", +] + +[[package]] +name = "mock-multi-transfer-esdt-meta" +version = "0.0.0" +dependencies = [ + "mock-multi-transfer-esdt", + "multiversx-sc-meta-lib", +] + +[[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.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8835116a5c179084a830efb3adc117ab007512b535bc1a21c991d3b32a6b44dd" + +[[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.128" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6ff5456707a1de34e7e37f2a6fd3d3f808c318259cbd01ab6377795054b483d8" +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 = "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/common/mock-contracts/mock-multi-transfer-esdt/Cargo.toml b/common/mock-contracts/mock-multi-transfer-esdt/Cargo.toml new file mode 100644 index 00000000..c14230ea --- /dev/null +++ b/common/mock-contracts/mock-multi-transfer-esdt/Cargo.toml @@ -0,0 +1,18 @@ +[package] +name = "mock-multi-transfer-esdt" +version = "0.0.0" +publish = false +edition = "2021" +authors = ["you"] + +[lib] +path = "src/mock_multi_transfer_esdt.rs" + +[dependencies.multiversx-sc] +version = "0.53.2" + +[dev-dependencies] +num-bigint = "0.4" + +[dev-dependencies.multiversx-sc-scenario] +version = "0.53.2" \ No newline at end of file diff --git a/common/mock-contracts/mock-multi-transfer-esdt/meta/Cargo.toml b/common/mock-contracts/mock-multi-transfer-esdt/meta/Cargo.toml new file mode 100644 index 00000000..d78de83b --- /dev/null +++ b/common/mock-contracts/mock-multi-transfer-esdt/meta/Cargo.toml @@ -0,0 +1,12 @@ +[package] +name = "mock-multi-transfer-esdt-meta" +version = "0.0.0" +edition = "2021" +publish = false + +[dependencies.mock-multi-transfer-esdt] +path = ".." + +[dependencies.multiversx-sc-meta-lib] +version = "0.53.2" +default-features = false diff --git a/common/mock-contracts/mock-multi-transfer-esdt/meta/src/main.rs b/common/mock-contracts/mock-multi-transfer-esdt/meta/src/main.rs new file mode 100644 index 00000000..d899c9e4 --- /dev/null +++ b/common/mock-contracts/mock-multi-transfer-esdt/meta/src/main.rs @@ -0,0 +1,3 @@ +fn main() { + multiversx_sc_meta_lib::cli_main::(); +} diff --git a/common/mock-contracts/mock-multi-transfer-esdt/multiversx.json b/common/mock-contracts/mock-multi-transfer-esdt/multiversx.json new file mode 100644 index 00000000..73655396 --- /dev/null +++ b/common/mock-contracts/mock-multi-transfer-esdt/multiversx.json @@ -0,0 +1,3 @@ +{ + "language": "rust" +} \ No newline at end of file diff --git a/common/mock-contracts/mock-multi-transfer-esdt/src/mock_multi_transfer_esdt.rs b/common/mock-contracts/mock-multi-transfer-esdt/src/mock_multi_transfer_esdt.rs new file mode 100644 index 00000000..629d799b --- /dev/null +++ b/common/mock-contracts/mock-multi-transfer-esdt/src/mock_multi_transfer_esdt.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 MockMultiTransferEsdt { + #[init] + fn init(&self) {} + + #[upgrade] + fn upgrade(&self) {} +} diff --git a/common/mock-contracts/mock-multi-transfer-esdt/wasm/Cargo.lock b/common/mock-contracts/mock-multi-transfer-esdt/wasm/Cargo.lock new file mode 100644 index 00000000..5ff39fbd --- /dev/null +++ b/common/mock-contracts/mock-multi-transfer-esdt/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 = "mock-multi-transfer-esdt" +version = "0.0.0" +dependencies = [ + "multiversx-sc", +] + +[[package]] +name = "mock-multi-transfer-esdt-wasm" +version = "0.0.0" +dependencies = [ + "mock-multi-transfer-esdt", + "multiversx-sc-wasm-adapter", +] + +[[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 = "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/common/mock-contracts/mock-multi-transfer-esdt/wasm/Cargo.toml b/common/mock-contracts/mock-multi-transfer-esdt/wasm/Cargo.toml new file mode 100644 index 00000000..e6faf1b6 --- /dev/null +++ b/common/mock-contracts/mock-multi-transfer-esdt/wasm/Cargo.toml @@ -0,0 +1,34 @@ +# Code generated by the multiversx-sc build system. DO NOT EDIT. + +# ########################################## +# ############## AUTO-GENERATED ############# +# ########################################## + +[package] +name = "mock-multi-transfer-esdt-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.mock-multi-transfer-esdt] +path = ".." + +[dependencies.multiversx-sc-wasm-adapter] +version = "0.53.2" + +[workspace] +members = ["."] diff --git a/common/mock-contracts/mock-multi-transfer-esdt/wasm/src/lib.rs b/common/mock-contracts/mock-multi-transfer-esdt/wasm/src/lib.rs new file mode 100644 index 00000000..36a8284b --- /dev/null +++ b/common/mock-contracts/mock-multi-transfer-esdt/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! { + mock_multi_transfer_esdt + ( + init => init + upgrade => upgrade + ) +} + +multiversx_sc_wasm_adapter::async_callback_empty! {} diff --git a/common/mock-contracts/mock-multisig/Cargo.lock b/common/mock-contracts/mock-multisig/Cargo.lock new file mode 100644 index 00000000..5455d638 --- /dev/null +++ b/common/mock-contracts/mock-multisig/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.89" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "86fdf8605db99b54d3cd748a44c6d04df638eb5dafb219b135d0149bd0db01f6" + +[[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.159" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "561d97a539a36e26a9a5fad1ea11a3039a67714694aaa379433e580854bc3dc5" + +[[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 = "mock-multisig" +version = "0.0.0" +dependencies = [ + "multiversx-sc", + "multiversx-sc-scenario", + "num-bigint", +] + +[[package]] +name = "mock-multisig-meta" +version = "0.0.0" +dependencies = [ + "mock-multisig", + "multiversx-sc-meta-lib", +] + +[[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.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8835116a5c179084a830efb3adc117ab007512b535bc1a21c991d3b32a6b44dd" + +[[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.128" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6ff5456707a1de34e7e37f2a6fd3d3f808c318259cbd01ab6377795054b483d8" +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 = "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/common/mock-contracts/mock-multisig/Cargo.toml b/common/mock-contracts/mock-multisig/Cargo.toml new file mode 100644 index 00000000..c4273f9a --- /dev/null +++ b/common/mock-contracts/mock-multisig/Cargo.toml @@ -0,0 +1,18 @@ +[package] +name = "mock-multisig" +version = "0.0.0" +publish = false +edition = "2021" +authors = ["you"] + +[lib] +path = "src/mock_multisig.rs" + +[dependencies.multiversx-sc] +version = "0.53.2" + +[dev-dependencies] +num-bigint = "0.4" + +[dev-dependencies.multiversx-sc-scenario] +version = "0.53.2" \ No newline at end of file diff --git a/common/mock-contracts/mock-multisig/meta/Cargo.toml b/common/mock-contracts/mock-multisig/meta/Cargo.toml new file mode 100644 index 00000000..b53ee996 --- /dev/null +++ b/common/mock-contracts/mock-multisig/meta/Cargo.toml @@ -0,0 +1,12 @@ +[package] +name = "mock-multisig-meta" +version = "0.0.0" +edition = "2021" +publish = false + +[dependencies.mock-multisig] +path = ".." + +[dependencies.multiversx-sc-meta-lib] +version = "0.53.2" +default-features = false diff --git a/common/mock-contracts/mock-multisig/meta/src/main.rs b/common/mock-contracts/mock-multisig/meta/src/main.rs new file mode 100644 index 00000000..9c7c8149 --- /dev/null +++ b/common/mock-contracts/mock-multisig/meta/src/main.rs @@ -0,0 +1,3 @@ +fn main() { + multiversx_sc_meta_lib::cli_main::(); +} diff --git a/common/mock-contracts/mock-multisig/multiversx.json b/common/mock-contracts/mock-multisig/multiversx.json new file mode 100644 index 00000000..73655396 --- /dev/null +++ b/common/mock-contracts/mock-multisig/multiversx.json @@ -0,0 +1,3 @@ +{ + "language": "rust" +} \ No newline at end of file diff --git a/common/mock-contracts/mock-multisig/sc-config.toml b/common/mock-contracts/mock-multisig/sc-config.toml new file mode 100644 index 00000000..4909f4db --- /dev/null +++ b/common/mock-contracts/mock-multisig/sc-config.toml @@ -0,0 +1,4 @@ +[settings] + +[[proxy]] +path = "../../sc-proxies/src/mock_multisig_proxy.rs" \ No newline at end of file diff --git a/common/mock-contracts/mock-multisig/src/mock_multisig.rs b/common/mock-contracts/mock-multisig/src/mock_multisig.rs new file mode 100644 index 00000000..f68ecbe8 --- /dev/null +++ b/common/mock-contracts/mock-multisig/src/mock_multisig.rs @@ -0,0 +1,83 @@ +#![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 MockMultisig { + #[init] + fn init( + &self, + esdt_safe_sc_address: ManagedAddress, + multi_transfer_sc_address: ManagedAddress, + proxy_sc_address: ManagedAddress, + bridged_tokens_wrapper_sc_address: ManagedAddress, + price_aggregator_sc_address: ManagedAddress, + _required_stake: BigUint, + _slash_amount: BigUint, + _quorum: usize, + _board: MultiValueEncoded, + ) { + require!( + self.blockchain().is_smart_contract(&esdt_safe_sc_address), + "Esdt Safe address is not a Smart Contract address" + ); + self.esdt_safe_address().set(&esdt_safe_sc_address); + + require!( + self.blockchain() + .is_smart_contract(&multi_transfer_sc_address), + "Multi Transfer address is not a Smart Contract address" + ); + self.multi_transfer_esdt_address() + .set(&multi_transfer_sc_address); + + require!( + self.blockchain().is_smart_contract(&proxy_sc_address), + "Proxy address is not a Smart Contract address" + ); + self.proxy_address().set(&proxy_sc_address); + + require!( + self.blockchain() + .is_smart_contract(&bridged_tokens_wrapper_sc_address), + "Bridged Tokens Wrapper address is not a Smart Contract address" + ); + self.bridged_tokens_wrapper_address() + .set(&bridged_tokens_wrapper_sc_address); + + require!( + self.blockchain() + .is_smart_contract(&price_aggregator_sc_address), + "Price Aggregator address is not a Smart Contract address" + ); + self.fee_estimator_address() + .set(&price_aggregator_sc_address); + } + + #[upgrade] + fn upgrade(&self) {} + + #[view(getEsdtSafeAddress)] + #[storage_mapper("esdtSafeAddress")] + fn esdt_safe_address(&self) -> SingleValueMapper; + + #[view(getMultiTransferEsdtAddress)] + #[storage_mapper("multiTransferEsdtAddress")] + fn multi_transfer_esdt_address(&self) -> SingleValueMapper; + + #[view(getProxyAddress)] + #[storage_mapper("proxyAddress")] + fn proxy_address(&self) -> SingleValueMapper; + + #[view(getBridgedTokensWrapperAddress)] + #[storage_mapper("bridgedTokensWrapperAddress")] + fn bridged_tokens_wrapper_address( + &self, + ) -> SingleValueMapper>; + + #[view(getFeeEstimatorAddress)] + #[storage_mapper("feeEstimatorAddress")] + fn fee_estimator_address(&self) -> SingleValueMapper>; +} diff --git a/common/mock-contracts/mock-multisig/wasm/Cargo.lock b/common/mock-contracts/mock-multisig/wasm/Cargo.lock new file mode 100644 index 00000000..867fb5b5 --- /dev/null +++ b/common/mock-contracts/mock-multisig/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 = "mock-multisig" +version = "0.0.0" +dependencies = [ + "multiversx-sc", +] + +[[package]] +name = "mock-multisig-wasm" +version = "0.0.0" +dependencies = [ + "mock-multisig", + "multiversx-sc-wasm-adapter", +] + +[[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 = "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/common/mock-contracts/mock-multisig/wasm/Cargo.toml b/common/mock-contracts/mock-multisig/wasm/Cargo.toml new file mode 100644 index 00000000..4b7084c2 --- /dev/null +++ b/common/mock-contracts/mock-multisig/wasm/Cargo.toml @@ -0,0 +1,34 @@ +# Code generated by the multiversx-sc build system. DO NOT EDIT. + +# ########################################## +# ############## AUTO-GENERATED ############# +# ########################################## + +[package] +name = "mock-multisig-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.mock-multisig] +path = ".." + +[dependencies.multiversx-sc-wasm-adapter] +version = "0.53.2" + +[workspace] +members = ["."] diff --git a/common/mock-contracts/mock-multisig/wasm/src/lib.rs b/common/mock-contracts/mock-multisig/wasm/src/lib.rs new file mode 100644 index 00000000..d0dfbf36 --- /dev/null +++ b/common/mock-contracts/mock-multisig/wasm/src/lib.rs @@ -0,0 +1,31 @@ +// Code generated by the multiversx-sc build system. DO NOT EDIT. + +//////////////////////////////////////////////////// +////////////////// AUTO-GENERATED ////////////////// +//////////////////////////////////////////////////// + +// Init: 1 +// Upgrade: 1 +// Endpoints: 5 +// Async Callback (empty): 1 +// Total number of exported functions: 8 + +#![no_std] + +multiversx_sc_wasm_adapter::allocator!(); +multiversx_sc_wasm_adapter::panic_handler!(); + +multiversx_sc_wasm_adapter::endpoints! { + mock_multisig + ( + init => init + upgrade => upgrade + getEsdtSafeAddress => esdt_safe_address + getMultiTransferEsdtAddress => multi_transfer_esdt_address + getProxyAddress => proxy_address + getBridgedTokensWrapperAddress => bridged_tokens_wrapper_address + getFeeEstimatorAddress => fee_estimator_address + ) +} + +multiversx_sc_wasm_adapter::async_callback_empty! {} diff --git a/common/mock-contracts/mock-price-aggregator/Cargo.lock b/common/mock-contracts/mock-price-aggregator/Cargo.lock new file mode 100644 index 00000000..a3347184 --- /dev/null +++ b/common/mock-contracts/mock-price-aggregator/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.89" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "86fdf8605db99b54d3cd748a44c6d04df638eb5dafb219b135d0149bd0db01f6" + +[[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.159" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "561d97a539a36e26a9a5fad1ea11a3039a67714694aaa379433e580854bc3dc5" + +[[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 = "mock-price-aggregator" +version = "0.0.0" +dependencies = [ + "multiversx-sc", + "multiversx-sc-scenario", + "num-bigint", +] + +[[package]] +name = "mock-price-aggregator-meta" +version = "0.0.0" +dependencies = [ + "mock-price-aggregator", + "multiversx-sc-meta-lib", +] + +[[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.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8835116a5c179084a830efb3adc117ab007512b535bc1a21c991d3b32a6b44dd" + +[[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.128" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6ff5456707a1de34e7e37f2a6fd3d3f808c318259cbd01ab6377795054b483d8" +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 = "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/common/mock-contracts/mock-price-aggregator/Cargo.toml b/common/mock-contracts/mock-price-aggregator/Cargo.toml new file mode 100644 index 00000000..b13d5ab3 --- /dev/null +++ b/common/mock-contracts/mock-price-aggregator/Cargo.toml @@ -0,0 +1,18 @@ +[package] +name = "mock-price-aggregator" +version = "0.0.0" +publish = false +edition = "2021" +authors = ["you"] + +[lib] +path = "src/mock_price_aggregator.rs" + +[dependencies.multiversx-sc] +version = "0.53.2" + +[dev-dependencies] +num-bigint = "0.4" + +[dev-dependencies.multiversx-sc-scenario] +version = "0.53.2" \ No newline at end of file diff --git a/common/mock-contracts/mock-price-aggregator/meta/Cargo.toml b/common/mock-contracts/mock-price-aggregator/meta/Cargo.toml new file mode 100644 index 00000000..8d0731f8 --- /dev/null +++ b/common/mock-contracts/mock-price-aggregator/meta/Cargo.toml @@ -0,0 +1,12 @@ +[package] +name = "mock-price-aggregator-meta" +version = "0.0.0" +edition = "2021" +publish = false + +[dependencies.mock-price-aggregator] +path = ".." + +[dependencies.multiversx-sc-meta-lib] +version = "0.53.2" +default-features = false diff --git a/common/mock-contracts/mock-price-aggregator/meta/src/main.rs b/common/mock-contracts/mock-price-aggregator/meta/src/main.rs new file mode 100644 index 00000000..91693dd0 --- /dev/null +++ b/common/mock-contracts/mock-price-aggregator/meta/src/main.rs @@ -0,0 +1,3 @@ +fn main() { + multiversx_sc_meta_lib::cli_main::(); +} diff --git a/common/mock-contracts/mock-price-aggregator/multiversx.json b/common/mock-contracts/mock-price-aggregator/multiversx.json new file mode 100644 index 00000000..73655396 --- /dev/null +++ b/common/mock-contracts/mock-price-aggregator/multiversx.json @@ -0,0 +1,3 @@ +{ + "language": "rust" +} \ No newline at end of file diff --git a/common/mock-contracts/mock-price-aggregator/src/mock_price_aggregator.rs b/common/mock-contracts/mock-price-aggregator/src/mock_price_aggregator.rs new file mode 100644 index 00000000..98fce5d7 --- /dev/null +++ b/common/mock-contracts/mock-price-aggregator/src/mock_price_aggregator.rs @@ -0,0 +1,26 @@ +#![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 MockPriceAggregator { + #[init] + fn init( + &self, + _staking_token: EgldOrEsdtTokenIdentifier, + _staking_amount: BigUint, + _slash_amount: BigUint, + _slash_quorum: usize, + _submission_count: usize, + _oracles: MultiValueEncoded, + ) { + } + + #[upgrade] + fn upgrade(&self) {} + + #[view(latestPriceFeedOptional)] + fn latest_price_feed_optional(&self, _from: ManagedBuffer, _to: ManagedBuffer) {} +} diff --git a/common/mock-contracts/mock-price-aggregator/wasm/Cargo.lock b/common/mock-contracts/mock-price-aggregator/wasm/Cargo.lock new file mode 100644 index 00000000..8f281b3d --- /dev/null +++ b/common/mock-contracts/mock-price-aggregator/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 = "mock-price-aggregator" +version = "0.0.0" +dependencies = [ + "multiversx-sc", +] + +[[package]] +name = "mock-price-aggregator-wasm" +version = "0.0.0" +dependencies = [ + "mock-price-aggregator", + "multiversx-sc-wasm-adapter", +] + +[[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 = "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/common/mock-contracts/mock-price-aggregator/wasm/Cargo.toml b/common/mock-contracts/mock-price-aggregator/wasm/Cargo.toml new file mode 100644 index 00000000..deb73c1b --- /dev/null +++ b/common/mock-contracts/mock-price-aggregator/wasm/Cargo.toml @@ -0,0 +1,34 @@ +# Code generated by the multiversx-sc build system. DO NOT EDIT. + +# ########################################## +# ############## AUTO-GENERATED ############# +# ########################################## + +[package] +name = "mock-price-aggregator-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.mock-price-aggregator] +path = ".." + +[dependencies.multiversx-sc-wasm-adapter] +version = "0.53.2" + +[workspace] +members = ["."] diff --git a/common/mock-contracts/mock-price-aggregator/wasm/src/lib.rs b/common/mock-contracts/mock-price-aggregator/wasm/src/lib.rs new file mode 100644 index 00000000..6347bbc3 --- /dev/null +++ b/common/mock-contracts/mock-price-aggregator/wasm/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! { + mock_price_aggregator + ( + init => init + upgrade => upgrade + latestPriceFeedOptional => latest_price_feed_optional + ) +} + +multiversx_sc_wasm_adapter::async_callback_empty! {} diff --git a/common/mock-proxies/Cargo.toml b/common/mock-proxies/Cargo.toml new file mode 100644 index 00000000..50d14510 --- /dev/null +++ b/common/mock-proxies/Cargo.toml @@ -0,0 +1,8 @@ +[package] +name = "mock-proxies" +version = "0.0.0" +authors = ["MultiversX "] +edition = "2018" + +[dependencies.multiversx-sc] +version = "=0.53.2" diff --git a/common/mock-proxies/src/lib.rs b/common/mock-proxies/src/lib.rs new file mode 100644 index 00000000..24cd29ab --- /dev/null +++ b/common/mock-proxies/src/lib.rs @@ -0,0 +1,3 @@ +#![no_std] + +pub mod mock_multisig_proxy; diff --git a/common/mock-proxies/src/mock_multisig_proxy.rs b/common/mock-proxies/src/mock_multisig_proxy.rs new file mode 100644 index 00000000..8f23fa83 --- /dev/null +++ b/common/mock-proxies/src/mock_multisig_proxy.rs @@ -0,0 +1,156 @@ +// 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 MockMultisigProxy; + +impl TxProxyTrait for MockMultisigProxy +where + Env: TxEnv, + From: TxFrom, + To: TxTo, + Gas: TxGas, +{ + type TxProxyMethods = MockMultisigProxyMethods; + + fn proxy_methods(self, tx: Tx) -> Self::TxProxyMethods { + MockMultisigProxyMethods { wrapped_tx: tx } + } +} + +pub struct MockMultisigProxyMethods +where + Env: TxEnv, + From: TxFrom, + To: TxTo, + Gas: TxGas, +{ + wrapped_tx: Tx, +} + +#[rustfmt::skip] +impl MockMultisigProxyMethods +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>, + Arg6: ProxyArg>, + Arg7: ProxyArg, + Arg8: ProxyArg>>, + >( + self, + esdt_safe_sc_address: Arg0, + multi_transfer_sc_address: Arg1, + proxy_sc_address: Arg2, + bridged_tokens_wrapper_sc_address: Arg3, + price_aggregator_sc_address: Arg4, + _required_stake: Arg5, + _slash_amount: Arg6, + _quorum: Arg7, + _board: Arg8, + ) -> TxTypedDeploy { + self.wrapped_tx + .payment(NotPayable) + .raw_deploy() + .argument(&esdt_safe_sc_address) + .argument(&multi_transfer_sc_address) + .argument(&proxy_sc_address) + .argument(&bridged_tokens_wrapper_sc_address) + .argument(&price_aggregator_sc_address) + .argument(&_required_stake) + .argument(&_slash_amount) + .argument(&_quorum) + .argument(&_board) + .original_result() + } +} + +#[rustfmt::skip] +impl MockMultisigProxyMethods +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 MockMultisigProxyMethods +where + Env: TxEnv, + Env::Api: VMApi, + From: TxFrom, + To: TxTo, + Gas: TxGas, +{ + pub fn esdt_safe_address( + self, + ) -> TxTypedCall> { + self.wrapped_tx + .payment(NotPayable) + .raw_call("getEsdtSafeAddress") + .original_result() + } + + pub fn multi_transfer_esdt_address( + self, + ) -> TxTypedCall> { + self.wrapped_tx + .payment(NotPayable) + .raw_call("getMultiTransferEsdtAddress") + .original_result() + } + + pub fn proxy_address( + self, + ) -> TxTypedCall> { + self.wrapped_tx + .payment(NotPayable) + .raw_call("getProxyAddress") + .original_result() + } + + pub fn bridged_tokens_wrapper_address( + self, + ) -> TxTypedCall> { + self.wrapped_tx + .payment(NotPayable) + .raw_call("getBridgedTokensWrapperAddress") + .original_result() + } + + pub fn fee_estimator_address( + self, + ) -> TxTypedCall> { + self.wrapped_tx + .payment(NotPayable) + .raw_call("getFeeEstimatorAddress") + .original_result() + } +} diff --git a/common/sc-proxies/Cargo.toml b/common/sc-proxies/Cargo.toml new file mode 100644 index 00000000..c67dac78 --- /dev/null +++ b/common/sc-proxies/Cargo.toml @@ -0,0 +1,23 @@ +[package] +name = "sc-proxies" +version = "0.0.0" +authors = ["MultiversX "] +edition = "2018" + +[dependencies.multiversx-sc] +version = "=0.53.2" + +[dependencies.transaction] +path = "../transaction" + +[dependencies.eth-address] +path = "../eth-address" + +[dependencies.token-module] +path = "../token-module" + +[dependencies.tx-batch-module] +path = "../tx-batch-module" + +[dev-dependencies.multiversx-sc-scenario] +version = "=0.53.2" diff --git a/bridge-proxy/src/bridge_proxy_contract_proxy.rs b/common/sc-proxies/src/bridge_proxy_contract_proxy.rs similarity index 65% rename from bridge-proxy/src/bridge_proxy_contract_proxy.rs rename to common/sc-proxies/src/bridge_proxy_contract_proxy.rs index 3cb21d18..e6010500 100644 --- a/bridge-proxy/src/bridge_proxy_contract_proxy.rs +++ b/common/sc-proxies/src/bridge_proxy_contract_proxy.rs @@ -43,16 +43,12 @@ where From: TxFrom, Gas: TxGas, { - pub fn init< - Arg0: ProxyArg>>, - >( + pub fn init( self, - opt_multi_transfer_address: Arg0, ) -> TxTypedDeploy { self.wrapped_tx .payment(NotPayable) .raw_deploy() - .argument(&opt_multi_transfer_address) .original_result() } } @@ -135,72 +131,6 @@ where .original_result() } - pub fn set_multi_transfer_contract_address< - Arg0: ProxyArg>>, - >( - self, - opt_multi_transfer_address: Arg0, - ) -> TxTypedCall { - self.wrapped_tx - .payment(NotPayable) - .raw_call("setMultiTransferAddress") - .argument(&opt_multi_transfer_address) - .original_result() - } - - pub fn set_bridged_tokens_wrapper_contract_address< - Arg0: ProxyArg>>, - >( - self, - opt_address: Arg0, - ) -> TxTypedCall { - self.wrapped_tx - .payment(NotPayable) - .raw_call("setBridgedTokensWrapperAddress") - .argument(&opt_address) - .original_result() - } - - pub fn set_esdt_safe_contract_address< - Arg0: ProxyArg>>, - >( - self, - opt_address: Arg0, - ) -> TxTypedCall { - self.wrapped_tx - .payment(NotPayable) - .raw_call("setEsdtSafeAddress") - .argument(&opt_address) - .original_result() - } - - pub fn multi_transfer_address( - self, - ) -> TxTypedCall> { - self.wrapped_tx - .payment(NotPayable) - .raw_call("getMultiTransferAddress") - .original_result() - } - - pub fn bridged_tokens_wrapper_address( - self, - ) -> TxTypedCall> { - self.wrapped_tx - .payment(NotPayable) - .raw_call("getBridgedTokensWrapperAddress") - .original_result() - } - - pub fn esdt_safe_contract_address( - self, - ) -> TxTypedCall> { - self.wrapped_tx - .payment(NotPayable) - .raw_call("getEsdtSafeContractAddress") - .original_result() - } - pub fn highest_tx_id( self, ) -> TxTypedCall { diff --git a/bridge-proxy/src/bridged_tokens_wrapper_proxy.rs b/common/sc-proxies/src/bridged_tokens_wrapper_proxy.rs similarity index 100% rename from bridge-proxy/src/bridged_tokens_wrapper_proxy.rs rename to common/sc-proxies/src/bridged_tokens_wrapper_proxy.rs diff --git a/bridge-proxy/src/crowdfunding_esdt_proxy.rs b/common/sc-proxies/src/crowdfunding_esdt_proxy.rs similarity index 100% rename from bridge-proxy/src/crowdfunding_esdt_proxy.rs rename to common/sc-proxies/src/crowdfunding_esdt_proxy.rs diff --git a/multi-transfer-esdt/src/esdt_safe_proxy.rs b/common/sc-proxies/src/esdt_safe_proxy.rs similarity index 85% rename from multi-transfer-esdt/src/esdt_safe_proxy.rs rename to common/sc-proxies/src/esdt_safe_proxy.rs index 3832da69..3b29e253 100644 --- a/multi-transfer-esdt/src/esdt_safe_proxy.rs +++ b/common/sc-proxies/src/esdt_safe_proxy.rs @@ -49,20 +49,14 @@ where /// eth_tx_gas_limit - The gas limit that will be used for transactions on the ETH side. /// Will be used to compute the fees for the transfer pub fn init< - Arg0: ProxyArg>, - Arg1: ProxyArg>, - Arg2: ProxyArg>, + Arg0: ProxyArg>, >( self, - fee_estimator_contract_address: Arg0, - multi_transfer_contract_address: Arg1, - eth_tx_gas_limit: Arg2, + eth_tx_gas_limit: Arg0, ) -> TxTypedDeploy { self.wrapped_tx .payment(NotPayable) .raw_deploy() - .argument(&fee_estimator_contract_address) - .argument(&multi_transfer_contract_address) .argument(ð_tx_gas_limit) .original_result() } @@ -78,23 +72,14 @@ where Gas: TxGas, { pub fn upgrade< - Arg0: ProxyArg>, - Arg1: ProxyArg>, - Arg2: ProxyArg>, - Arg3: ProxyArg>, + Arg0: ProxyArg>, >( self, - fee_estimator_contract_address: Arg0, - multi_transfer_contract_address: Arg1, - bridge_proxy_contract_address: Arg2, - eth_tx_gas_limit: Arg3, + eth_tx_gas_limit: Arg0, ) -> TxTypedUpgrade { self.wrapped_tx .payment(NotPayable) .raw_upgrade() - .argument(&fee_estimator_contract_address) - .argument(&multi_transfer_contract_address) - .argument(&bridge_proxy_contract_address) .argument(ð_tx_gas_limit) .original_result() } @@ -168,6 +153,24 @@ where .original_result() } + pub fn create_transaction_sc_call< + Arg0: ProxyArg>, + Arg1: ProxyArg>, + Arg2: ProxyArg>>, + >( + self, + to: Arg0, + data: Arg1, + opt_refund_info: Arg2, + ) -> TxTypedCall { + self.wrapped_tx + .raw_call("createTransactionSCCall") + .argument(&to) + .argument(&data) + .argument(&opt_refund_info) + .original_result() + } + /// Claim funds for failed MultiversX -> Ethereum transactions. /// These are not sent automatically to prevent the contract getting stuck. /// For example, if the receiver is a SC, a frozen account, etc. @@ -184,32 +187,6 @@ where .original_result() } - pub fn set_bridged_tokens_wrapper_contract_address< - Arg0: ProxyArg>>, - >( - self, - opt_address: Arg0, - ) -> TxTypedCall { - self.wrapped_tx - .payment(NotPayable) - .raw_call("setBridgedTokensWrapperAddress") - .argument(&opt_address) - .original_result() - } - - pub fn set_bridge_proxy_contract_address< - Arg0: ProxyArg>>, - >( - self, - opt_new_address: Arg0, - ) -> TxTypedCall { - self.wrapped_tx - .payment(NotPayable) - .raw_call("setBridgeProxyContractAddress") - .argument(&opt_new_address) - .original_result() - } - pub fn withdraw_refund_fees_for_ethereum< Arg0: ProxyArg>, Arg1: ProxyArg>, @@ -308,37 +285,6 @@ where .original_result() } - pub fn bridged_tokens_wrapper_address( - self, - ) -> TxTypedCall> { - self.wrapped_tx - .payment(NotPayable) - .raw_call("getBridgedTokensWrapperAddress") - .original_result() - } - - pub fn bridge_proxy_contract_address( - self, - ) -> TxTypedCall> { - self.wrapped_tx - .payment(NotPayable) - .raw_call("getBridgeProxyContractAddress") - .original_result() - } - - pub fn set_fee_estimator_contract_address< - Arg0: ProxyArg>, - >( - self, - new_address: Arg0, - ) -> TxTypedCall { - self.wrapped_tx - .payment(NotPayable) - .raw_call("setFeeEstimatorContractAddress") - .argument(&new_address) - .original_result() - } - pub fn set_eth_tx_gas_limit< Arg0: ProxyArg>, >( @@ -401,15 +347,6 @@ where .original_result() } - pub fn fee_estimator_contract_address( - self, - ) -> TxTypedCall> { - self.wrapped_tx - .payment(NotPayable) - .raw_call("getFeeEstimatorContractAddress") - .original_result() - } - pub fn default_price_per_gas_unit< Arg0: ProxyArg>, >( @@ -544,19 +481,6 @@ where .original_result() } - pub fn set_multi_transfer_contract_address< - Arg0: ProxyArg>>, - >( - self, - opt_new_address: Arg0, - ) -> TxTypedCall { - self.wrapped_tx - .payment(NotPayable) - .raw_call("setMultiTransferContractAddress") - .argument(&opt_new_address) - .original_result() - } - pub fn token_whitelist( self, ) -> TxTypedCall>> { @@ -592,15 +516,6 @@ where .original_result() } - pub fn multi_transfer_contract_address( - self, - ) -> TxTypedCall> { - self.wrapped_tx - .payment(NotPayable) - .raw_call("getMultiTransferContractAddress") - .original_result() - } - pub fn accumulated_transaction_fees< Arg0: ProxyArg>, >( diff --git a/common/sc-proxies/src/lib.rs b/common/sc-proxies/src/lib.rs new file mode 100644 index 00000000..ca235320 --- /dev/null +++ b/common/sc-proxies/src/lib.rs @@ -0,0 +1,8 @@ +#![no_std] + +pub mod bridge_proxy_contract_proxy; +pub mod bridged_tokens_wrapper_proxy; +pub mod crowdfunding_esdt_proxy; +pub mod esdt_safe_proxy; +pub mod multi_transfer_esdt_proxy; +pub mod multisig_proxy; diff --git a/multisig/src/multi_transfer_esdt_proxy.rs b/common/sc-proxies/src/multi_transfer_esdt_proxy.rs similarity index 76% rename from multisig/src/multi_transfer_esdt_proxy.rs rename to common/sc-proxies/src/multi_transfer_esdt_proxy.rs index 68871989..1fa4e469 100644 --- a/multisig/src/multi_transfer_esdt_proxy.rs +++ b/common/sc-proxies/src/multi_transfer_esdt_proxy.rs @@ -106,32 +106,6 @@ where .original_result() } - pub fn set_wrapping_contract_address< - Arg0: ProxyArg>>, - >( - self, - opt_new_address: Arg0, - ) -> TxTypedCall { - self.wrapped_tx - .payment(NotPayable) - .raw_call("setWrappingContractAddress") - .argument(&opt_new_address) - .original_result() - } - - pub fn set_bridge_proxy_contract_address< - Arg0: ProxyArg>>, - >( - self, - opt_new_address: Arg0, - ) -> TxTypedCall { - self.wrapped_tx - .payment(NotPayable) - .raw_call("setBridgeProxyContractAddress") - .argument(&opt_new_address) - .original_result() - } - pub fn add_unprocessed_refund_tx_to_batch< Arg0: ProxyArg, >( @@ -145,46 +119,6 @@ where .original_result() } - pub fn set_esdt_safe_contract_address< - Arg0: ProxyArg>>, - >( - self, - opt_new_address: Arg0, - ) -> TxTypedCall { - self.wrapped_tx - .payment(NotPayable) - .raw_call("setEsdtSafeContractAddress") - .argument(&opt_new_address) - .original_result() - } - - pub fn wrapping_contract_address( - self, - ) -> TxTypedCall> { - self.wrapped_tx - .payment(NotPayable) - .raw_call("getWrappingContractAddress") - .original_result() - } - - pub fn bridge_proxy_contract_address( - self, - ) -> TxTypedCall> { - self.wrapped_tx - .payment(NotPayable) - .raw_call("getBridgeProxyContractAddress") - .original_result() - } - - pub fn esdt_safe_contract_address( - self, - ) -> TxTypedCall> { - self.wrapped_tx - .payment(NotPayable) - .raw_call("getEsdtSafeContractAddress") - .original_result() - } - pub fn set_max_tx_batch_size< Arg0: ProxyArg, >( diff --git a/multisig/src/multisig_proxy.rs b/common/sc-proxies/src/multisig_proxy.rs similarity index 94% rename from multisig/src/multisig_proxy.rs rename to common/sc-proxies/src/multisig_proxy.rs index a652c8ba..80334b47 100644 --- a/multisig/src/multisig_proxy.rs +++ b/common/sc-proxies/src/multisig_proxy.rs @@ -49,19 +49,23 @@ where Arg0: ProxyArg>, Arg1: ProxyArg>, Arg2: ProxyArg>, - Arg3: ProxyArg>, - Arg4: ProxyArg>, - Arg5: ProxyArg, - Arg6: ProxyArg>>, + Arg3: ProxyArg>, + Arg4: ProxyArg>, + Arg5: ProxyArg>, + Arg6: ProxyArg>, + Arg7: ProxyArg, + Arg8: ProxyArg>>, >( self, esdt_safe_sc_address: Arg0, multi_transfer_sc_address: Arg1, proxy_sc_address: Arg2, - required_stake: Arg3, - slash_amount: Arg4, - quorum: Arg5, - board: Arg6, + bridged_tokens_wrapper_sc_address: Arg3, + price_aggregator_sc_address: Arg4, + required_stake: Arg5, + slash_amount: Arg6, + quorum: Arg7, + board: Arg8, ) -> TxTypedDeploy { self.wrapped_tx .payment(NotPayable) @@ -69,6 +73,8 @@ where .argument(&esdt_safe_sc_address) .argument(&multi_transfer_sc_address) .argument(&proxy_sc_address) + .argument(&bridged_tokens_wrapper_sc_address) + .argument(&price_aggregator_sc_address) .argument(&required_stake) .argument(&slash_amount) .argument(&quorum) @@ -90,11 +96,15 @@ where Arg0: ProxyArg>, Arg1: ProxyArg>, Arg2: ProxyArg>, + Arg3: ProxyArg>, + Arg4: ProxyArg>, >( self, esdt_safe_sc_address: Arg0, multi_transfer_sc_address: Arg1, proxy_sc_address: Arg2, + bridged_tokens_wrapper_sc_address: Arg3, + price_aggregator_sc_address: Arg4, ) -> TxTypedUpgrade { self.wrapped_tx .payment(NotPayable) @@ -102,6 +112,8 @@ where .argument(&esdt_safe_sc_address) .argument(&multi_transfer_sc_address) .argument(&proxy_sc_address) + .argument(&bridged_tokens_wrapper_sc_address) + .argument(&price_aggregator_sc_address) .original_result() } } @@ -483,25 +495,6 @@ where .original_result() } - pub fn change_fee_estimator_contract_address< - Arg0: ProxyArg>, - >( - self, - new_address: Arg0, - ) -> TxTypedCall { - self.wrapped_tx - .payment(NotPayable) - .raw_call("changeFeeEstimatorContractAddress") - .argument(&new_address) - .original_result() - } - - /// Sets the gas limit being used for Ethereum transactions - /// This is used in the EsdtSafe contract to determine the fee amount - /// - /// fee_amount = eth_gas_limit * price_per_gas_unit - /// - /// where price_per_gas_unit is queried from the aggregator (fee estimator SC) pub fn change_multiversx_to_eth_gas_limit< Arg0: ProxyArg>, >( @@ -584,24 +577,6 @@ where .original_result() } - pub fn set_multi_transfer_on_esdt_safe( - self, - ) -> TxTypedCall { - self.wrapped_tx - .payment(NotPayable) - .raw_call("setMultiTransferOnEsdtSafe") - .original_result() - } - - pub fn set_esdt_safe_on_multi_transfer( - self, - ) -> TxTypedCall { - self.wrapped_tx - .payment(NotPayable) - .raw_call("setEsdtSafeOnMultiTransfer") - .original_result() - } - pub fn esdt_safe_remove_token_from_whitelist< Arg0: ProxyArg>, >( @@ -712,26 +687,6 @@ where .original_result() } - /// Sets the wrapping contract address. - /// This contract is used to map multiple tokens to a universal one. - /// Useful in cases where a single token (USDC for example) - /// is being transferred from multiple chains. - /// - /// They will all have different token IDs, but can be swapped 1:1 in the wrapping SC. - /// The wrapping is done automatically, so the user only receives the universal token. - pub fn multi_transfer_esdt_set_wrapping_contract_address< - Arg0: ProxyArg>>, - >( - self, - opt_wrapping_contract_address: Arg0, - ) -> TxTypedCall { - self.wrapped_tx - .payment(NotPayable) - .raw_call("multiTransferEsdtSetWrappingContractAddress") - .argument(&opt_wrapping_contract_address) - .original_result() - } - /// Minimum number of signatures needed to perform any action. pub fn quorum( self, @@ -869,6 +824,24 @@ where .original_result() } + pub fn bridged_tokens_wrapper_address( + self, + ) -> TxTypedCall> { + self.wrapped_tx + .payment(NotPayable) + .raw_call("getBridgedTokensWrapperAddress") + .original_result() + } + + pub fn fee_estimator_address( + self, + ) -> TxTypedCall> { + self.wrapped_tx + .payment(NotPayable) + .raw_call("getFeeEstimatorAddress") + .original_result() + } + /// Returns the current EsdtSafe batch. /// /// First result is the batch ID, then pairs of 6 results, representing transactions diff --git a/common/storage-module/Cargo.toml b/common/storage-module/Cargo.toml new file mode 100644 index 00000000..9378a7ad --- /dev/null +++ b/common/storage-module/Cargo.toml @@ -0,0 +1,10 @@ +[package] +name = "storage-module" +version = "0.1.0" +edition = "2021" + +[dependencies.multiversx-sc] +version = "=0.53.2" + +[dev-dependencies.multiversx-sc-scenario] +version = "=0.53.2" diff --git a/common/storage-module/src/lib.rs b/common/storage-module/src/lib.rs new file mode 100644 index 00000000..cb9565d1 --- /dev/null +++ b/common/storage-module/src/lib.rs @@ -0,0 +1,44 @@ +#![no_std] +use multiversx_sc::imports::*; +use multiversx_sc::storage::StorageKey; + +pub const BRIDGE_PROXY_CONTRACT_ADDRESS_STORAGE_KEY: &[u8] = b"proxyAddress"; +pub const BRIDGED_TOKENS_WRAPPER_ADDRESS_STORAGE_KEY: &[u8] = b"bridgedTokensWrapperAddress"; +pub const ESDT_SAFE_CONTRACT_ADDRESS_STORAGE_KEY: &[u8] = b"esdtSafeAddress"; +pub const MULTI_TRANSFER_CONTRACT_ADDRESS_STORAGE_KEY: &[u8] = b"multiTransferEsdtAddress"; +pub const FEE_ESTIMATOR_CONTRACT_ADDRESS_STORAGE_KEY: &[u8] = b"feeEstimatorAddress"; + +#[multiversx_sc::module] +pub trait CommonStorageModule { + fn single_value_mapper(&self, key: &[u8]) -> SingleValueMapper { + SingleValueMapper::<_, _, ManagedAddress>::new_from_address( + self.blockchain().get_owner_address(), + StorageKey::new(key), + ) + } + + fn get_bridged_tokens_wrapper_address(&self) -> ManagedAddress { + self.single_value_mapper(BRIDGED_TOKENS_WRAPPER_ADDRESS_STORAGE_KEY) + .get() + } + + fn get_bridge_proxy_address(&self) -> ManagedAddress { + self.single_value_mapper(BRIDGE_PROXY_CONTRACT_ADDRESS_STORAGE_KEY) + .get() + } + + fn get_esdt_safe_address(&self) -> ManagedAddress { + self.single_value_mapper(ESDT_SAFE_CONTRACT_ADDRESS_STORAGE_KEY) + .get() + } + + fn get_multi_transfer_address(&self) -> ManagedAddress { + self.single_value_mapper(MULTI_TRANSFER_CONTRACT_ADDRESS_STORAGE_KEY) + .get() + } + + fn get_fee_estimator_address(&self) -> ManagedAddress { + self.single_value_mapper(FEE_ESTIMATOR_CONTRACT_ADDRESS_STORAGE_KEY) + .get() + } +} diff --git a/common/token-module/Cargo.toml b/common/token-module/Cargo.toml index 168b8738..1adce6af 100644 --- a/common/token-module/Cargo.toml +++ b/common/token-module/Cargo.toml @@ -7,8 +7,11 @@ edition = "2018" [dependencies.fee-estimator-module] path = "../fee-estimator-module" +[dependencies.storage-module] +path = "../storage-module" + [dependencies.multiversx-sc] -version = "=0.52.3" +version = "=0.53.2" [dev-dependencies.multiversx-sc-scenario] -version = "=0.52.3" +version = "=0.53.2" diff --git a/common/token-module/src/lib.rs b/common/token-module/src/lib.rs index 06319302..4366d5ae 100644 --- a/common/token-module/src/lib.rs +++ b/common/token-module/src/lib.rs @@ -14,7 +14,9 @@ pub struct AddressPercentagePair { } #[multiversx_sc::module] -pub trait TokenModule: fee_estimator_module::FeeEstimatorModule { +pub trait TokenModule: + fee_estimator_module::FeeEstimatorModule + storage_module::CommonStorageModule +{ // endpoints - owner-only /// Distributes the accumulated fees to the given addresses. @@ -131,7 +133,7 @@ pub trait TokenModule: fee_estimator_module::FeeEstimatorModule { fn get_tokens(&self, token_id: &TokenIdentifier, amount: &BigUint) -> bool { let caller = self.blockchain().get_caller(); require!( - caller == self.multi_transfer_contract_address().get(), + caller == self.get_multi_transfer_address(), "Only MultiTransfer can get tokens" ); @@ -188,7 +190,7 @@ pub trait TokenModule: fee_estimator_module::FeeEstimatorModule { self.require_token_in_whitelist(token_id); require!( !self.mint_burn_token(token_id).get(), - "Cannot init for non mintable/burnable tokens" + "Cannot init for mintable/burnable tokens" ); require!( self.native_token(token_id).get(), @@ -256,17 +258,6 @@ pub trait TokenModule: fee_estimator_module::FeeEstimatorModule { roles.has_role(role) } - #[only_owner] - #[endpoint(setMultiTransferContractAddress)] - fn set_multi_transfer_contract_address(&self, opt_new_address: OptionalValue) { - match opt_new_address { - OptionalValue::Some(sc_addr) => { - self.multi_transfer_contract_address().set(&sc_addr); - } - OptionalValue::None => self.multi_transfer_contract_address().clear(), - } - } - // storage #[view(getAllKnownTokens)] @@ -281,10 +272,6 @@ pub trait TokenModule: fee_estimator_module::FeeEstimatorModule { #[storage_mapper("mintBurnToken")] fn mint_burn_token(&self, token: &TokenIdentifier) -> SingleValueMapper; - #[view(getMultiTransferContractAddress)] - #[storage_mapper("multiTransferContractAddress")] - fn multi_transfer_contract_address(&self) -> SingleValueMapper; - #[view(getAccumulatedTransactionFees)] #[storage_mapper("accumulatedTransactionFees")] fn accumulated_transaction_fees( diff --git a/common/transaction/Cargo.toml b/common/transaction/Cargo.toml index ddde4c76..61cb39f2 100644 --- a/common/transaction/Cargo.toml +++ b/common/transaction/Cargo.toml @@ -11,4 +11,4 @@ path = "src/lib.rs" path = "../eth-address" [dependencies.multiversx-sc] -version = "=0.52.3" +version = "=0.53.2" diff --git a/common/tx-batch-module/Cargo.toml b/common/tx-batch-module/Cargo.toml index 80d4c470..0d8154f0 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.3" +version = "=0.53.2" [dependencies.transaction] path = "../transaction" [dev-dependencies.multiversx-sc-scenario] -version = "=0.52.3" +version = "=0.53.2" diff --git a/common/tx-batch-module/src/batch_status.rs b/common/tx-batch-module/src/batch_status.rs index d8708c01..ddb9942e 100644 --- a/common/tx-batch-module/src/batch_status.rs +++ b/common/tx-batch-module/src/batch_status.rs @@ -4,7 +4,7 @@ use multiversx_sc::{api::ManagedTypeApi, types::ManagedVec}; use transaction::{BlockNonce, TxNonce}; #[type_abi] -#[derive(TopEncode, TopDecode)] +#[derive(TopEncode, TopDecode, Debug, PartialEq, Eq)] pub enum BatchStatus { AlreadyProcessed, Empty, diff --git a/esdt-safe/Cargo.toml b/esdt-safe/Cargo.toml index 2d4b227c..53c7fb2d 100644 --- a/esdt-safe/Cargo.toml +++ b/esdt-safe/Cargo.toml @@ -26,14 +26,38 @@ path = "../common/tx-batch-module" [dependencies.max-bridged-amount-module] path = "../common/max-bridged-amount-module" +[dependencies.storage-module] +path = "../common/storage-module" + +[dependencies.sc-proxies] +path = "../common/sc-proxies" + +[dependencies.mock-proxies] +path = "../common/mock-proxies" + +[dependencies.mock-bridged-tokens-wrapper] +path = "../common/mock-contracts/mock-bridged-tokens-wrapper" + +[dependencies.mock-multisig] +path = "../common/mock-contracts/mock-multisig" + +[dependencies.mock-bridge-proxy] +path = "../common/mock-contracts/mock-bridge-proxy" + +[dependencies.mock-price-aggregator] +path = "../common/mock-contracts/mock-price-aggregator" + +[dependencies.mock-multi-transfer-esdt] +path = "../common/mock-contracts/mock-multi-transfer-esdt" + [dependencies.multiversx-price-aggregator-sc] -version = "=0.52.0" +version = "=0.53.2" [dependencies.multiversx-sc] -version = "=0.52.3" +version = "=0.53.2" [dependencies.multiversx-sc-modules] -version = "=0.52.3" +version = "=0.53.2" [dev-dependencies.multiversx-sc-scenario] -version = "=0.52.3" +version = "=0.53.2" diff --git a/esdt-safe/meta/Cargo.toml b/esdt-safe/meta/Cargo.toml index 8e988868..49696c7c 100644 --- a/esdt-safe/meta/Cargo.toml +++ b/esdt-safe/meta/Cargo.toml @@ -11,5 +11,5 @@ publish = false path = ".." [dependencies.multiversx-sc-meta-lib] -version = "=0.52.3" +version = "=0.53.2" default-features = false diff --git a/esdt-safe/sc-config.toml b/esdt-safe/sc-config.toml index 0dc85bf8..23ca0938 100644 --- a/esdt-safe/sc-config.toml +++ b/esdt-safe/sc-config.toml @@ -1,13 +1,4 @@ [settings] [[proxy]] -path = "../bridge-proxy/src/esdt_safe_proxy.rs" - -[[proxy]] -path = "../bridged-tokens-wrapper/src/esdt_safe_proxy.rs" - -[[proxy]] -path = "../multi-transfer-esdt/src/esdt_safe_proxy.rs" - -[[proxy]] -path = "../multisig/src/esdt_safe_proxy.rs" \ No newline at end of file +path = "../common/sc-proxies/src/esdt_safe_proxy.rs" diff --git a/esdt-safe/scenarios/create_transaction_ok.scen.json b/esdt-safe/scenarios/create_transaction_ok.scen.json index 22bacf7d..2371c290 100644 --- a/esdt-safe/scenarios/create_transaction_ok.scen.json +++ b/esdt-safe/scenarios/create_transaction_ok.scen.json @@ -109,7 +109,8 @@ "str:accumulatedTransactionFees|nested:str:BRIDGE-123456": "1,500,000", "+": "" }, - "code": "file:../output/esdt-safe.wasm" + "code": "file:../output/esdt-safe.wasm", + "owner": "sc:multisig" }, "+": {} } diff --git a/esdt-safe/scenarios/create_transaction_over_max_amount.scen.json b/esdt-safe/scenarios/create_transaction_over_max_amount.scen.json index 44418d98..37de81ff 100644 --- a/esdt-safe/scenarios/create_transaction_over_max_amount.scen.json +++ b/esdt-safe/scenarios/create_transaction_over_max_amount.scen.json @@ -9,7 +9,7 @@ "step": "scCall", "txId": "create-transaction-ok", "tx": { - "from": "address:owner", + "from": "sc:multisig", "to": "sc:esdt_safe", "function": "setMaxBridgedAmount", "arguments": [ diff --git a/esdt-safe/scenarios/distribute_fees.scen.json b/esdt-safe/scenarios/distribute_fees.scen.json index 116bdef3..8899c5dd 100644 --- a/esdt-safe/scenarios/distribute_fees.scen.json +++ b/esdt-safe/scenarios/distribute_fees.scen.json @@ -9,7 +9,7 @@ "step": "scCall", "txId": "owner-distribute-fees", "tx": { - "from": "address:owner", + "from": "sc:multisig", "to": "sc:esdt_safe", "value": "0", "function": "distributeFees", @@ -60,4 +60,4 @@ } } ] -} +} \ No newline at end of file diff --git a/esdt-safe/scenarios/execute_batch_both_rejected.scen.json b/esdt-safe/scenarios/execute_batch_both_rejected.scen.json index a80b108e..1adb7cc4 100644 --- a/esdt-safe/scenarios/execute_batch_both_rejected.scen.json +++ b/esdt-safe/scenarios/execute_batch_both_rejected.scen.json @@ -9,7 +9,7 @@ "step": "scCall", "txId": "set-tx-status-both-rejected", "tx": { - "from": "address:owner", + "from": "sc:multisig", "to": "sc:esdt_safe", "value": "0", "function": "setTransactionBatchStatus", @@ -116,4 +116,4 @@ } } ] -} +} \ No newline at end of file diff --git a/esdt-safe/scenarios/execute_batch_both_success.scen.json b/esdt-safe/scenarios/execute_batch_both_success.scen.json index ddbf763b..07748d8c 100644 --- a/esdt-safe/scenarios/execute_batch_both_success.scen.json +++ b/esdt-safe/scenarios/execute_batch_both_success.scen.json @@ -9,7 +9,7 @@ "step": "scCall", "txId": "set-tx-status-both-executed", "tx": { - "from": "address:owner", + "from": "sc:multisig", "to": "sc:esdt_safe", "value": "0", "function": "setTransactionBatchStatus", @@ -114,4 +114,4 @@ } } ] -} +} \ No newline at end of file diff --git a/esdt-safe/scenarios/execute_batch_one_success_one_rejected.scen.json b/esdt-safe/scenarios/execute_batch_one_success_one_rejected.scen.json index 3a76c22c..f0cda64d 100644 --- a/esdt-safe/scenarios/execute_batch_one_success_one_rejected.scen.json +++ b/esdt-safe/scenarios/execute_batch_one_success_one_rejected.scen.json @@ -9,7 +9,7 @@ "step": "scCall", "txId": "set-tx-status-one-executed-one-rejected", "tx": { - "from": "address:owner", + "from": "sc:multisig", "to": "sc:esdt_safe", "value": "0", "function": "setTransactionBatchStatus", @@ -94,4 +94,4 @@ } } ] -} +} \ No newline at end of file diff --git a/esdt-safe/scenarios/execute_transaction_rejected.scen.json b/esdt-safe/scenarios/execute_transaction_rejected.scen.json index 81345ee9..60adda25 100644 --- a/esdt-safe/scenarios/execute_transaction_rejected.scen.json +++ b/esdt-safe/scenarios/execute_transaction_rejected.scen.json @@ -9,7 +9,7 @@ "step": "scCall", "txId": "set-tx-status-rejected", "tx": { - "from": "address:owner", + "from": "sc:multisig", "to": "sc:esdt_safe", "value": "0", "function": "setTransactionBatchStatus", @@ -85,4 +85,4 @@ } } ] -} +} \ No newline at end of file diff --git a/esdt-safe/scenarios/execute_transaction_success.scen.json b/esdt-safe/scenarios/execute_transaction_success.scen.json index 1731749b..8f79c28e 100644 --- a/esdt-safe/scenarios/execute_transaction_success.scen.json +++ b/esdt-safe/scenarios/execute_transaction_success.scen.json @@ -9,7 +9,7 @@ "step": "scCall", "txId": "set-tx-status-executed", "tx": { - "from": "address:owner", + "from": "sc:multisig", "to": "sc:esdt_safe", "value": "0", "function": "setTransactionBatchStatus", @@ -75,9 +75,7 @@ "str:pendingBatches|u64:1": "", "str:firstBatchId": "2", "str:lastBatchId": "2", - "str:accumulatedTransactionFees|nested:str:BRIDGE-123456": "1,500,000", - "+": "" }, "code": "file:../output/esdt-safe.wasm" @@ -86,4 +84,4 @@ } } ] -} +} \ No newline at end of file diff --git a/esdt-safe/scenarios/get_next_tx_batch.scen.json b/esdt-safe/scenarios/get_next_tx_batch.scen.json index 8a22bcda..54290c41 100644 --- a/esdt-safe/scenarios/get_next_tx_batch.scen.json +++ b/esdt-safe/scenarios/get_next_tx_batch.scen.json @@ -22,14 +22,12 @@ "expect": { "out": [ "1", - "0", "1", "address:user1", "0x0102030405060708091011121314151617181920", "str:BRIDGE-123456", "400", - "0", "2", "address:user2", @@ -40,4 +38,4 @@ } } ] -} +} \ No newline at end of file diff --git a/esdt-safe/scenarios/setup_accounts.scen.json b/esdt-safe/scenarios/setup_accounts.scen.json index b4f5b455..cb7d0d3c 100644 --- a/esdt-safe/scenarios/setup_accounts.scen.json +++ b/esdt-safe/scenarios/setup_accounts.scen.json @@ -45,6 +45,11 @@ "creatorAddress": "address:owner", "creatorNonce": "2", "newAddress": "sc:bridged_tokens_wrapper" + }, + { + "creatorAddress": "address:owner", + "creatorNonce": "3", + "newAddress": "sc:multisig" } ] }, @@ -56,8 +61,6 @@ "contractCode": "file:../output/esdt-safe.wasm", "value": "0", "arguments": [ - "sc:price_aggregator", - "sc:multi_transfer", "150,000" ], "gasLimit": "20,000,000", @@ -97,27 +100,6 @@ "refund": "*" } }, - { - "step": "scCall", - "txId": "add-bridged-tokens-wrapper-addr", - "tx": { - "from": "address:owner", - "to": "sc:esdt_safe", - "value": "0", - "function": "setBridgedTokensWrapperAddress", - "arguments": [ - "sc:bridged_tokens_wrapper" - ], - "gasLimit": "50,000,000", - "gasPrice": "0" - }, - "expect": { - "status": "0", - "message": "", - "gas": "*", - "refund": "*" - } - }, { "step": "checkState", "accounts": { @@ -125,9 +107,6 @@ "nonce": "0", "balance": "0", "storage": { - "str:feeEstimatorContractAddress": "sc:price_aggregator", - "str:multiTransferContractAddress": "sc:multi_transfer", - "str:bridgedTokensWrapperAddress": "sc:bridged_tokens_wrapper", "str:maxTxBatchSize": "10", "str:maxTxBatchBlockDuration": "100", "str:firstBatchId": "1", @@ -167,6 +146,16 @@ "step": "setState", "comment": "setting local burn role", "accounts": { + "sc:multisig": { + "nonce": "0", + "balance": "0", + "storage": { + "str:feeEstimatorAddress": "sc:price_aggregator", + "str:multiTransferEsdtAddress": "sc:multi_transfer" + }, + "code": "file:../../multisig/output/multisig.wasm", + "owner": "address:owner" + }, "sc:esdt_safe": { "nonce": "0", "balance": "0", @@ -180,9 +169,6 @@ } }, "storage": { - "str:feeEstimatorContractAddress": "sc:price_aggregator", - "str:multiTransferContractAddress": "sc:multi_transfer", - "str:bridgedTokensWrapperAddress": "sc:bridged_tokens_wrapper", "str:maxTxBatchSize": "10", "str:maxTxBatchBlockDuration": "100", "str:firstBatchId": "1", @@ -195,7 +181,7 @@ "str:tokenWhitelist.len": "1" }, "code": "file:../output/esdt-safe.wasm", - "owner": "address:owner" + "owner": "sc:multisig" } } }, diff --git a/esdt-safe/scenarios/zero_fees.scen.json b/esdt-safe/scenarios/zero_fees.scen.json index 5e573a8c..de13dd78 100644 --- a/esdt-safe/scenarios/zero_fees.scen.json +++ b/esdt-safe/scenarios/zero_fees.scen.json @@ -6,49 +6,18 @@ "path": "setup_accounts.scen.json" }, { - "step": "scCall", - "txId": "set-fee-estimator-address-to-address-zero", - "tx": { - "from": "address:owner", - "to": "sc:esdt_safe", - "value": "0", - "function": "setFeeEstimatorContractAddress", - "arguments": [ - "0x0000000000000000000000000000000000000000000000000000000000000000" - ], - "gasLimit": "30,000,000", - "gasPrice": "0" - }, - "expect": { - "status": "0", - "message": "", - "out": [], - "gas": "*", - "refund": "*" - } - }, - { - "step": "checkState", + "step": "setState", + "comment": "setting local burn role", "accounts": { - "sc:esdt_safe": { + "sc:multisig": { "nonce": "0", "balance": "0", - "esdt": { - "str:BRIDGE-123456": { - "balance": "0", - "roles": [ - "ESDTRoleLocalBurn", - "ESDTRoleLocalMint" - ] - } - }, "storage": { - "str:feeEstimatorContractAddress": "0x0000000000000000000000000000000000000000000000000000000000000000", - "+": "" + "str:feeEstimatorAddress": "0x0000000000000000000000000000000000000000000000000000000000000000" }, - "code": "file:../output/esdt-safe.wasm" - }, - "+": {} + "code": "file:../../multisig/output/multisig.wasm", + "owner": "address:owner" + } } }, { diff --git a/esdt-safe/src/lib.rs b/esdt-safe/src/lib.rs index 02e76113..c7aad34a 100644 --- a/esdt-safe/src/lib.rs +++ b/esdt-safe/src/lib.rs @@ -16,6 +16,17 @@ const DEFAULT_MAX_TX_BATCH_BLOCK_DURATION: u64 = 100; // ~10 minutes pub type PaymentsVec = ManagedVec>; +pub struct TransactionDetails { + pub batch_id: u64, + pub tx_nonce: u64, + pub payment_token: TokenIdentifier, + pub actual_bridged_amount: BigUint, + pub required_fee: BigUint, + pub to_address: ManagedBuffer, + pub is_refund_tx: bool, + pub refund_info: RefundInfo, +} + #[type_abi] #[derive(TopEncode, TopDecode, NestedEncode, NestedDecode, Clone, ManagedVecItem, PartialEq)] pub struct RefundInfo { @@ -31,6 +42,7 @@ pub trait EsdtSafe: + tx_batch_module::TxBatchModule + max_bridged_amount_module::MaxBridgedAmountModule + multiversx_sc_modules::pause::PauseModule + + storage_module::CommonStorageModule { /// fee_estimator_contract_address - The address of a Price Aggregator contract, /// which will get the price of token A in token B @@ -38,17 +50,7 @@ pub trait EsdtSafe: /// eth_tx_gas_limit - The gas limit that will be used for transactions on the ETH side. /// Will be used to compute the fees for the transfer #[init] - fn init( - &self, - fee_estimator_contract_address: ManagedAddress, - multi_transfer_contract_address: ManagedAddress, - eth_tx_gas_limit: BigUint, - ) { - self.fee_estimator_contract_address() - .set(&fee_estimator_contract_address); - self.multi_transfer_contract_address() - .set(&multi_transfer_contract_address); - + fn init(&self, eth_tx_gas_limit: BigUint) { self.eth_tx_gas_limit().set(ð_tx_gas_limit); self.max_tx_batch_size() @@ -69,20 +71,7 @@ pub trait EsdtSafe: } #[upgrade] - fn upgrade( - &self, - fee_estimator_contract_address: ManagedAddress, - multi_transfer_contract_address: ManagedAddress, - bridge_proxy_contract_address: ManagedAddress, - eth_tx_gas_limit: BigUint, - ) { - self.fee_estimator_contract_address() - .set(&fee_estimator_contract_address); - self.multi_transfer_contract_address() - .set(&multi_transfer_contract_address); - self.bridge_proxy_contract_address() - .set(&bridge_proxy_contract_address); - + fn upgrade(&self, eth_tx_gas_limit: BigUint) { self.eth_tx_gas_limit().set(ð_tx_gas_limit); self.max_tx_batch_size() @@ -166,7 +155,7 @@ pub trait EsdtSafe: #[endpoint(addRefundBatch)] fn add_refund_batch(&self, refund_transactions: ManagedVec>) { let caller = self.blockchain().get_caller(); - let multi_transfer_address = self.multi_transfer_contract_address().get(); + let multi_transfer_address = self.get_multi_transfer_address(); require!(caller == multi_transfer_address, "Invalid caller"); let refund_payments = self.call_value().all_esdt_transfers().deref().clone(); @@ -260,22 +249,11 @@ pub trait EsdtSafe: } } - // endpoints - - /// Create an MultiversX -> Ethereum transaction. Only fungible tokens are accepted. - /// - /// Every transfer will have a part of the tokens subtracted as fees. - /// The fee amount depends on the global eth_tx_gas_limit - /// and the current GWEI price, respective to the bridged token - /// - /// fee_amount = price_per_gas_unit * eth_tx_gas_limit - #[payable("*")] - #[endpoint(createTransaction)] - fn create_transaction( + fn create_transaction_common( &self, to: EthAddress, opt_refund_info: OptionalValue>, - ) { + ) -> TransactionDetails { require!(self.not_paused(), "Cannot create transaction while paused"); let (payment_token, payment_amount) = self.call_value().single_fungible_esdt(); @@ -295,10 +273,10 @@ pub trait EsdtSafe: let caller = self.blockchain().get_caller(); let refund_info = match opt_refund_info { OptionalValue::Some(refund_info) => { - if caller == self.bridge_proxy_contract_address().get() { + if caller == self.get_bridge_proxy_address() { is_refund_tx = true; refund_info - } else if caller == self.bridged_tokens_wrapper_address().get() { + } else if caller == self.get_bridged_tokens_wrapper_address() { refund_info } else { sc_panic!("Cannot specify a refund address from this caller"); @@ -347,25 +325,98 @@ pub trait EsdtSafe: *total += &actual_bridged_amount; }); } - if !is_refund_tx { + TransactionDetails { + batch_id, + tx_nonce, + payment_token, + actual_bridged_amount, + required_fee, + to_address: tx.to, + is_refund_tx, + refund_info, + } + } + + // endpoints + + /// Create an MultiversX -> Ethereum transaction. Only fungible tokens are accepted. + /// + /// Every transfer will have a part of the tokens subtracted as fees. + /// The fee amount depends on the global eth_tx_gas_limit + /// and the current GWEI price, respective to the bridged token + /// + /// fee_amount = price_per_gas_unit * eth_tx_gas_limit + #[payable("*")] + #[endpoint(createTransaction)] + fn create_transaction( + &self, + to: EthAddress, + opt_refund_info: OptionalValue>, + ) { + let transaction_details = self.create_transaction_common(to, opt_refund_info); + + if !transaction_details.is_refund_tx { self.create_transaction_event( - batch_id, - tx_nonce, - payment_token, - actual_bridged_amount, - required_fee, - refund_info.address.as_managed_buffer().clone(), - tx.to, + transaction_details.batch_id, + transaction_details.tx_nonce, + transaction_details.payment_token, + transaction_details.actual_bridged_amount, + transaction_details.required_fee, + transaction_details + .refund_info + .address + .as_managed_buffer() + .clone(), + transaction_details.to_address, ); } else { self.create_refund_transaction_event( - batch_id, - tx_nonce, - payment_token, - actual_bridged_amount, - required_fee, - refund_info.initial_batch_id, - refund_info.initial_nonce, + transaction_details.batch_id, + transaction_details.tx_nonce, + transaction_details.payment_token, + transaction_details.actual_bridged_amount, + transaction_details.required_fee, + transaction_details.refund_info.initial_batch_id, + transaction_details.refund_info.initial_nonce, + ); + } + } + + #[payable("*")] + #[endpoint(createTransactionSCCall)] + fn create_transaction_sc_call( + &self, + to: EthAddress, + data: ManagedBuffer, + opt_refund_info: OptionalValue>, + ) { + let transaction_details = self.create_transaction_common(to, opt_refund_info); + + if !transaction_details.is_refund_tx { + self.create_transaction_sc_call_event( + transaction_details.batch_id, + transaction_details.tx_nonce, + transaction_details.payment_token, + transaction_details.actual_bridged_amount, + transaction_details.required_fee, + transaction_details + .refund_info + .address + .as_managed_buffer() + .clone(), + transaction_details.to_address, + data, + ); + } else { + self.create_refund_transaction_sc_call_event( + transaction_details.batch_id, + transaction_details.tx_nonce, + transaction_details.payment_token, + transaction_details.actual_bridged_amount, + transaction_details.required_fee, + transaction_details.refund_info.initial_batch_id, + transaction_details.refund_info.initial_nonce, + data, ); } } @@ -393,40 +444,6 @@ pub trait EsdtSafe: EsdtTokenPayment::new(token_id, 0, refund_amount) } - #[only_owner] - #[endpoint(setBridgedTokensWrapperAddress)] - fn set_bridged_tokens_wrapper_contract_address( - &self, - opt_address: OptionalValue, - ) { - match opt_address { - OptionalValue::Some(sc_addr) => { - require!( - self.blockchain().is_smart_contract(&sc_addr), - "Invalid bridged tokens wrapper address" - ); - self.bridged_tokens_wrapper_address().set(&sc_addr); - } - OptionalValue::None => self.bridged_tokens_wrapper_address().clear(), - } - } - - #[only_owner] - #[endpoint(setBridgeProxyContractAddress)] - fn set_bridge_proxy_contract_address(&self, opt_new_address: OptionalValue) { - match opt_new_address { - OptionalValue::Some(sc_addr) => { - require!( - self.blockchain().is_smart_contract(&sc_addr), - "Invalid bridge proxy contract address" - ); - - self.bridge_proxy_contract_address().set(&sc_addr); - } - OptionalValue::None => self.bridge_proxy_contract_address().clear(), - } - } - #[only_owner] #[endpoint(withdrawRefundFeesForEthereum)] fn withdraw_refund_fees_for_ethereum( @@ -516,6 +533,8 @@ pub trait EsdtSafe: refund_amounts } + // views + #[view(getTotalRefundAmounts)] fn get_total_refund_amounts(&self) -> MultiValueEncoded> { let mut refund_amounts = MultiValueEncoded::new(); @@ -601,6 +620,32 @@ pub trait EsdtSafe: #[indexed] initial_tx_id: u64, ); + #[event("createRefundTransactionEvent")] + fn create_refund_transaction_sc_call_event( + &self, + #[indexed] batch_id: u64, + #[indexed] tx_id: u64, + #[indexed] token_id: TokenIdentifier, + #[indexed] amount: BigUint, + #[indexed] fee: BigUint, + #[indexed] initial_batch_id: u64, + #[indexed] initial_tx_id: u64, + #[indexed] data: ManagedBuffer, + ); + + #[event("createTransactionScCallEvent")] + fn create_transaction_sc_call_event( + &self, + #[indexed] batch_id: u64, + #[indexed] tx_nonce: u64, + #[indexed] payment_token: TokenIdentifier, + #[indexed] amount: BigUint, + #[indexed] fee: BigUint, + #[indexed] to: ManagedBuffer, + #[indexed] from: ManagedBuffer, + #[indexed] data: ManagedBuffer, + ); + #[event("addRefundTransactionEvent")] fn add_refund_transaction_event( &self, @@ -642,12 +687,4 @@ pub trait EsdtSafe: address: &ManagedAddress, token_id: &TokenIdentifier, ) -> SingleValueMapper; - - #[view(getBridgedTokensWrapperAddress)] - #[storage_mapper("bridgedTokensWrapperAddress")] - fn bridged_tokens_wrapper_address(&self) -> SingleValueMapper; - - #[view(getBridgeProxyContractAddress)] - #[storage_mapper("bridgeProxyContractAddress")] - fn bridge_proxy_contract_address(&self) -> SingleValueMapper; } diff --git a/esdt-safe/tests/esdt_safe_blackbox_test.rs b/esdt-safe/tests/esdt_safe_blackbox_test.rs new file mode 100644 index 00000000..ce8a98da --- /dev/null +++ b/esdt-safe/tests/esdt_safe_blackbox_test.rs @@ -0,0 +1,1387 @@ +#![allow(unused)] +use esdt_safe::*; + +use eth_address::EthAddress; +use mock_proxies::mock_multisig_proxy; +use multiversx_sc_scenario::imports::*; +use sc_proxies::esdt_safe_proxy::{self, EsdtSafeProxyMethods}; +use transaction::transaction_status::TransactionStatus; +use transaction::Transaction; +use tx_batch_module::BatchStatus; + +const OWNER_ADDRESS: TestAddress = TestAddress::new("owner"); + +const BRIDGE_PROXY_ADDRESS: TestSCAddress = TestSCAddress::new("bridge-proxy"); +const CROWDFUNDING_ADDRESS: TestSCAddress = TestSCAddress::new("crowfunding"); +const MULTI_TRANSFER_ADDRESS: TestSCAddress = TestSCAddress::new("multi-transfer"); +const ESDT_SAFE_ADDRESS: TestSCAddress = TestSCAddress::new("esdt-safe"); +const PRICE_AGGREGATOR: TestSCAddress = TestSCAddress::new("price-aggregator"); +const MULTISIG_ADDRESS: TestSCAddress = TestSCAddress::new("multisig"); +const BRIDGED_TOKENS_WRAPPER_ADDRESS: TestSCAddress = TestSCAddress::new("bridged-tokens-wrapper"); +const OWNER_ADDRESS_EXPR: &str = "address:owner"; +const ESTD_SAFE_ADDRESS_EXPR: &str = "sc:esdt-safe"; + +const ESDT_SAFE_CODE_PATH: MxscPath = MxscPath::new("output/esdt-safe.mxsc.json"); +const MOCK_MULTI_TRANSFER_PATH_EXPR: MxscPath = MxscPath::new( + "../common/mock-contracts/mock-multi-transfer-esdt/output/mock-multi-transfer-esdt.mxsc.json", +); +const MOCK_BRIDGED_TOKENS_WRAPPER_CODE_PATH_EXPR: MxscPath = + MxscPath::new("../common/mock-contracts/mock-bridged-tokens-wrapper/output/mock-bridged-tokens-wrapper.mxsc.json"); +const MOCK_MULTISIG_CODE_PATH: MxscPath = + MxscPath::new("../common/mock-contracts/mock-multisig/output/mock-multisig.mxsc.json"); +const MOCK_PRICE_AGGREGATOR_CODE_PATH: MxscPath = MxscPath::new( + "../common/mock-contracts/mock-price-aggregator/output/mock-price-aggregator.mxsc.json", +); +const MOCK_BRIDGE_PROXY_PATH_EXPR: MxscPath = + MxscPath::new("../common/mock-contracts/mock-bridge-proxy/output/mock-bridge-proxy.mxsc.json"); + +const TOKEN_ID: TestTokenIdentifier = TestTokenIdentifier::new("TOKEN-123456"); +const MINT_BURN_TOKEN: TestTokenIdentifier = TestTokenIdentifier::new("MINT-BURN-123456"); +const NON_WHITELISTED_TOKEN: TestTokenIdentifier = + TestTokenIdentifier::new("NON-WHITELISTED-123456"); +const TOKEN_WITH_BURN_ROLE: TestTokenIdentifier = TestTokenIdentifier::new("TOKEN-WITH"); +const NATIVE_TOKEN_ID: TestTokenIdentifier = TestTokenIdentifier::new("ESDT-123"); +const ETH_TX_GAS_LIMIT: u64 = 150_000; +const ETH_TOKEN_ID: TestTokenIdentifier = TestTokenIdentifier::new("ETH-123456"); +const ERROR: u64 = 4; +const USER1_ADDRESS: TestAddress = TestAddress::new("user1"); +const USER2_ADDRESS: TestAddress = TestAddress::new("user2"); +const RELAYER1_ADDRESS: TestAddress = TestAddress::new("relayer1"); +const RELAYER2_ADDRESS: TestAddress = TestAddress::new("relayer2"); + +fn world() -> ScenarioWorld { + let mut blockchain = ScenarioWorld::new(); + blockchain.register_contract(ESDT_SAFE_CODE_PATH, esdt_safe::ContractBuilder); + blockchain.register_contract( + MOCK_BRIDGED_TOKENS_WRAPPER_CODE_PATH_EXPR, + mock_bridged_tokens_wrapper::ContractBuilder, + ); + blockchain.register_contract( + MOCK_PRICE_AGGREGATOR_CODE_PATH, + mock_price_aggregator::ContractBuilder, + ); + blockchain.register_contract( + MOCK_MULTI_TRANSFER_PATH_EXPR, + mock_multi_transfer_esdt::ContractBuilder, + ); + blockchain.register_contract(MOCK_MULTISIG_CODE_PATH, mock_multisig::ContractBuilder); + blockchain.register_contract( + MOCK_BRIDGE_PROXY_PATH_EXPR, + mock_bridge_proxy::ContractBuilder, + ); + + blockchain +} + +struct EsdtSafeTestState { + world: ScenarioWorld, +} + +impl EsdtSafeTestState { + fn new() -> Self { + let mut world = world(); + world + .account(OWNER_ADDRESS) + .nonce(1) + .esdt_balance(ETH_TOKEN_ID, 1001u64) + .esdt_balance(TOKEN_ID, 1_000_000_000_000u64) + .esdt_balance(NON_WHITELISTED_TOKEN, 1001u64) + .esdt_balance(NATIVE_TOKEN_ID, 300_000_000_000u64) + .esdt_balance(MINT_BURN_TOKEN, 200000u64) + .esdt_balance(TOKEN_WITH_BURN_ROLE, 100_000_000_000u64); + + world + .account(PRICE_AGGREGATOR) + .code(MOCK_PRICE_AGGREGATOR_CODE_PATH); + + world + .account(MULTI_TRANSFER_ADDRESS) + .esdt_balance(NATIVE_TOKEN_ID, 300_000_000_000u64) + .esdt_balance(TOKEN_WITH_BURN_ROLE, 100_000_000_000u64) + .esdt_balance(TOKEN_ID, 300_000_000u64) + .code(MOCK_MULTI_TRANSFER_PATH_EXPR) + .account(BRIDGE_PROXY_ADDRESS) + .esdt_balance(TOKEN_ID, 100_000_000u64) + .code(MOCK_BRIDGE_PROXY_PATH_EXPR) + .account(BRIDGED_TOKENS_WRAPPER_ADDRESS) + .esdt_balance(TOKEN_ID, 100_000_000u64) + .code(MOCK_BRIDGED_TOKENS_WRAPPER_CODE_PATH_EXPR); + + Self { world } + } + + fn multisig_deploy(&mut self) -> &mut Self { + let mut board: MultiValueEncoded> = + MultiValueEncoded::new(); + board.push(ManagedAddress::from(RELAYER1_ADDRESS.eval_to_array())); + board.push(ManagedAddress::from(RELAYER2_ADDRESS.eval_to_array())); + self.world + .tx() + .from(OWNER_ADDRESS) + .typed(mock_multisig_proxy::MockMultisigProxy) + .init( + ESDT_SAFE_ADDRESS, + MULTI_TRANSFER_ADDRESS, + BRIDGE_PROXY_ADDRESS, + BRIDGED_TOKENS_WRAPPER_ADDRESS, + PRICE_AGGREGATOR, + 1_000u64, + 500u64, + 2usize, + board, + ) + .code(MOCK_MULTISIG_CODE_PATH) + .new_address(MULTISIG_ADDRESS) + .run(); + self + } + + fn safe_deploy(&mut self) -> &mut Self { + self.world + .tx() + .from(MULTISIG_ADDRESS) + .typed(esdt_safe_proxy::EsdtSafeProxy) + .init(ETH_TX_GAS_LIMIT) + .code(ESDT_SAFE_CODE_PATH) + .new_address(ESDT_SAFE_ADDRESS) + .run(); + + self + } + + fn config_esdtsafe(&mut self) { + self.world + .tx() + .from(MULTISIG_ADDRESS) + .to(ESDT_SAFE_ADDRESS) + .typed(esdt_safe_proxy::EsdtSafeProxy) + .unpause_endpoint() + .run(); + + self.world.set_esdt_local_roles( + ESDT_SAFE_ADDRESS, + b"TOKEN-123456", + &[EsdtLocalRole::Mint, EsdtLocalRole::Burn], + ); + self.world.set_esdt_balance( + ESDT_SAFE_ADDRESS, + b"TOKEN-123456", + BigUint::from(10_000_000u64), + ); + + self.world.set_esdt_balance( + MULTISIG_ADDRESS, + b"TOKEN-123456", + BigUint::from(10_000_000u64), + ); + self.world.set_esdt_balance( + ESDT_SAFE_ADDRESS, + b"MINT-BURN-123456", + BigUint::from(20_000_000u64), + ); + + self.world.set_esdt_balance( + MULTISIG_ADDRESS, + b"MINT-BURN-123456", + BigUint::from(200_000_000_000u64), + ); + self.world.set_esdt_balance( + MULTISIG_ADDRESS, + b"NON-WHITELISTED-123456", + BigUint::from(10_000_000u64), + ); + + self.world + .set_esdt_balance(MULTISIG_ADDRESS, b"ESDT-123", BigUint::from(10_000_000u64)); + + self.world.set_esdt_balance( + MULTISIG_ADDRESS, + b"TOKEN-WITH", + BigUint::from(10_000_000u64), + ); + + self.world.set_esdt_balance( + MULTISIG_ADDRESS, + b"ETH-123456", + BigUint::from(10_000_000u64), + ); + + self.esdt_raw_transaction() + .add_token_to_whitelist( + TOKEN_ID, + "TOKEN", + false, + true, + BigUint::from(0u64), + BigUint::from(0u64), + BigUint::from(0u64), + OptionalValue::Some(BigUint::from(0u64)), + ) + .run(); + + self.esdt_raw_transaction() + .add_token_to_whitelist( + MINT_BURN_TOKEN, + "TOKEN", + true, + false, + BigUint::from(0u64), + BigUint::from(2000u64), + BigUint::from(0u64), + OptionalValue::Some(BigUint::from(0u64)), + ) + .run(); + + self.esdt_raw_transaction() + .add_token_to_whitelist( + TOKEN_WITH_BURN_ROLE, + "TKN", + true, + false, + BigUint::from(0u64), + BigUint::from(0u64), + BigUint::from(0u64), + OptionalValue::Some(BigUint::from(0u64)), + ) + .run(); + + self.esdt_raw_transaction() + .add_token_to_whitelist( + NATIVE_TOKEN_ID, + "NATIVE", + false, + true, + BigUint::from(0u64), + BigUint::from(0u64), + BigUint::from(0u64), + OptionalValue::Some(BigUint::from(0u64)), + ) + .run(); + + self.esdt_raw_transaction() + .add_token_to_whitelist( + TOKEN_ID, + "TOKEN_ID", + false, + true, + BigUint::from(0u64), + BigUint::from(0u64), + BigUint::from(0u64), + OptionalValue::Some(BigUint::from(0u64)), + ) + .run(); + } + + fn init_supply_should_fail( + &mut self, + token_id: TestTokenIdentifier, + tx_token_id: TestTokenIdentifier, + tx_amount: u64, + amount: u64, + expected_status: u64, + expected_error: &str, + ) { + self.esdt_raw_transaction() + .init_supply(token_id, BigUint::from(amount)) + .egld_or_single_esdt( + &EgldOrEsdtTokenIdentifier::esdt(tx_token_id), + 0, + &BigUint::from(tx_amount), + ) + .with_result(ExpectError(expected_status, expected_error)) + .run(); + } + + fn init_supply_should_work( + &mut self, + token_id: TestTokenIdentifier, + tx_token_id: TestTokenIdentifier, + tx_amount: u64, + amount: u64, + ) { + self.esdt_raw_transaction() + .init_supply(token_id, BigUint::from(amount)) + .egld_or_single_esdt( + &EgldOrEsdtTokenIdentifier::esdt(tx_token_id), + 0, + &BigUint::from(tx_amount), + ) + .returns(ReturnsResult) + .run(); + } + fn add_refund_batch_tx_single_payment_should_fail( + &mut self, + from_address: TestSCAddress, + to_address: TestSCAddress, + transfers: ManagedVec>, + token_id: TestTokenIdentifier, + amount: u64, + expected_error: &str, + ) { + self.world + .tx() + .from(from_address) + .to(to_address) + .typed(esdt_safe_proxy::EsdtSafeProxy) + .add_refund_batch(transfers) + .egld_or_single_esdt( + &EgldOrEsdtTokenIdentifier::esdt(token_id), + 0, + &BigUint::from(amount), + ) + .returns(ExpectError(ERROR, expected_error)) + .run(); + } + + fn add_refund_batch_tx_multiple_payment_should_fail( + &mut self, + from_address: TestSCAddress, + to_address: TestSCAddress, + transfers: ManagedVec>, + payment: EgldOrMultiEsdtPayment, + expected_error: &str, + ) { + self.world + .tx() + .from(from_address) + .to(to_address) + .typed(esdt_safe_proxy::EsdtSafeProxy) + .add_refund_batch(transfers) + .egld_or_multi_esdt(payment) + .returns(ExpectError(ERROR, expected_error)) + .run(); + } + + fn single_transaction_should_fail( + &mut self, + token_id: TestTokenIdentifier, + amount: u64, + expected_error: &str, + ) { + self.esdt_raw_transaction() + .create_transaction( + EthAddress::zero(), + OptionalValue::None::>, + ) + .egld_or_single_esdt( + &EgldOrEsdtTokenIdentifier::esdt(token_id), + 0, + &BigUint::from(amount), + ) + .returns(ExpectError(ERROR, expected_error)) + .run(); + } + + fn single_transaction_should_work(&mut self, token_id: TestTokenIdentifier, amount: u64) { + self.esdt_raw_transaction() + .create_transaction( + EthAddress::zero(), + OptionalValue::None::>, + ) + .egld_or_single_esdt( + &EgldOrEsdtTokenIdentifier::esdt(token_id), + 0, + &BigUint::from(amount), + ) + .returns(ReturnsResult) + .run(); + } + + fn set_transaction_batch_status_should_fail( + &mut self, + batch_id: u32, + statuses: MultiValueEncoded, + expected_status: u64, + expected_error: &str, + ) { + self.esdt_raw_transaction() + .set_transaction_batch_status(batch_id, statuses) + .returns(ExpectError(expected_status, expected_error)) + .run(); + } + + fn set_transaction_batch_status_should_work( + &mut self, + batch_id: u32, + statuses: MultiValueEncoded, + ) { + self.esdt_raw_transaction() + .set_transaction_batch_status(batch_id, statuses) + .returns(ReturnsResult) + .run(); + } + + fn esdt_raw_transaction( + &mut self, + ) -> EsdtSafeProxyMethods, TestSCAddress, TestSCAddress, ()> { + self.world + .tx() + .from(MULTISIG_ADDRESS) + .to(ESDT_SAFE_ADDRESS) + .typed(esdt_safe_proxy::EsdtSafeProxy) + } +} + +#[test] +fn config_test() { + let mut state = EsdtSafeTestState::new(); + state.multisig_deploy(); + state.safe_deploy(); + state.config_esdtsafe(); +} + +#[test] +fn upgrade_test() { + let mut state = EsdtSafeTestState::new(); + state.multisig_deploy(); + state.safe_deploy(); + state.config_esdtsafe(); + + let eth_tx_gas_limit_before = state + .world + .query() + .to(ESDT_SAFE_ADDRESS) + .typed(esdt_safe_proxy::EsdtSafeProxy) + .eth_tx_gas_limit() + .returns(ReturnsResult) + .run(); + assert_eq!( + eth_tx_gas_limit_before, + BigUint::from(ETH_TX_GAS_LIMIT), + "Initial eth_tx_gas_limit should match the set value" + ); + + let paused_state_before = state + .world + .query() + .to(ESDT_SAFE_ADDRESS) + .typed(esdt_safe_proxy::EsdtSafeProxy) + .paused_status() + .returns(ReturnsResult) + .run(); + assert!( + !paused_state_before, + "Contract should not be paused before upgrade" + ); + + let new_eth_tx_gas_limit = BigUint::from(5000u64); + state + .world + .tx() + .from(MULTISIG_ADDRESS) + .to(ESDT_SAFE_ADDRESS) + .typed(esdt_safe_proxy::EsdtSafeProxy) + .upgrade(new_eth_tx_gas_limit.clone()) + .code(ESDT_SAFE_CODE_PATH) + .run(); + + let eth_tx_gas_limit_after = state + .world + .query() + .to(ESDT_SAFE_ADDRESS) + .typed(esdt_safe_proxy::EsdtSafeProxy) + .eth_tx_gas_limit() + .returns(ReturnsResult) + .run(); + assert_eq!( + eth_tx_gas_limit_after, + new_eth_tx_gas_limit.clone(), + "eth_tx_gas_limit should be updated after upgrade" + ); + + let paused_state_after = state + .world + .query() + .to(ESDT_SAFE_ADDRESS) + .typed(esdt_safe_proxy::EsdtSafeProxy) + .paused_status() + .returns(ReturnsResult) + .run(); + assert!( + paused_state_after, + "Contract should be paused after upgrade" + ); +} + +#[test] +fn init_supply_test() { + let mut state = EsdtSafeTestState::new(); + state.multisig_deploy(); + state.safe_deploy(); + state.config_esdtsafe(); + + state.init_supply_should_fail( + NON_WHITELISTED_TOKEN, + NATIVE_TOKEN_ID, + 10_000u64, + 10_000u64, + ERROR, + "Invalid token ID", + ); + + state.init_supply_should_fail( + NATIVE_TOKEN_ID, + NATIVE_TOKEN_ID, + 10_000u64, + 1000u64, + ERROR, + "Invalid amount", + ); + + state.init_supply_should_fail( + NON_WHITELISTED_TOKEN, + NON_WHITELISTED_TOKEN, + 1000u64, + 1000u64, + ERROR, + "Token not in whitelist", + ); + + state.init_supply_should_fail( + TOKEN_WITH_BURN_ROLE, + TOKEN_WITH_BURN_ROLE, + 1_000u64, + 1_000u64, + ERROR, + "Cannot init for mintable/burnable tokens", + ); + + state.init_supply_should_work(NATIVE_TOKEN_ID, NATIVE_TOKEN_ID, 10_000u64, 10_000u64); + + let total_supply = state + .world + .query() + .to(ESDT_SAFE_ADDRESS) + .typed(esdt_safe_proxy::EsdtSafeProxy) + .total_balances(NATIVE_TOKEN_ID) + .returns(ReturnsResult) + .run(); + + assert_eq!( + total_supply, + BigUint::from(10_000u64), + "Total supply should be 10,000" + ); + let total_burned = state + .world + .query() + .to(ESDT_SAFE_ADDRESS) + .typed(esdt_safe_proxy::EsdtSafeProxy) + .burn_balances(NATIVE_TOKEN_ID) + .returns(ReturnsResult) + .run(); + + assert_eq!( + total_burned, + BigUint::from(0u64), + "Total supply should be 0" + ) +} + +#[test] +fn init_supply_test_mint_burn() { + let mut state = EsdtSafeTestState::new(); + state.multisig_deploy(); + state.safe_deploy(); + state.config_esdtsafe(); + + state + .esdt_raw_transaction() + .init_supply_mint_burn( + NON_WHITELISTED_TOKEN, + BigUint::from(10_000u64), + BigUint::from(10_000u64), + ) + .with_result(ExpectError(ERROR, "Token not in whitelist")) + .run(); + + state + .esdt_raw_transaction() + .init_supply_mint_burn(TOKEN_ID, BigUint::from(10_000u64), BigUint::from(10_000u64)) + .with_result(ExpectError( + ERROR, + "Cannot init for non mintable/burnable tokens", + )) + .run(); + + state + .esdt_raw_transaction() + .init_supply_mint_burn( + TOKEN_WITH_BURN_ROLE, + BigUint::from(10_000u64), + BigUint::from(10_000u64), + ) + .with_result(ReturnsResult) + .run(); + + let total_minted = state + .world + .query() + .to(ESDT_SAFE_ADDRESS) + .typed(esdt_safe_proxy::EsdtSafeProxy) + .mint_balances(TOKEN_WITH_BURN_ROLE) + .returns(ReturnsResult) + .run(); + + assert_eq!( + total_minted, + BigUint::from(10_000u64), + "Total supply should be 10,000" + ); + + let total_burned = state + .world + .query() + .to(ESDT_SAFE_ADDRESS) + .typed(esdt_safe_proxy::EsdtSafeProxy) + .burn_balances(TOKEN_WITH_BURN_ROLE) + .returns(ReturnsResult) + .run(); + + assert_eq!( + total_burned, + BigUint::from(10_000u64), + "Total supply should be 10,000" + ); +} + +#[test] +fn set_transaction_batch_status_test() { + let mut state = EsdtSafeTestState::new(); + state.multisig_deploy(); + state.safe_deploy(); + state.config_esdtsafe(); + + let mut tx_statuses = MultiValueEncoded::::new(); + tx_statuses.push(TransactionStatus::Executed); + let mut tx_multiple_statuses = MultiValueEncoded::::new(); + tx_multiple_statuses.push(TransactionStatus::Executed); + tx_multiple_statuses.push(TransactionStatus::Pending); + let mut tx_statuses_invalid = MultiValueEncoded::::new(); + tx_statuses_invalid.push(TransactionStatus::Pending); + + state + .world + .tx() + .from(MULTISIG_ADDRESS) + .to(ESDT_SAFE_ADDRESS) + .typed(esdt_safe_proxy::EsdtSafeProxy) + .init_supply_mint_burn( + TOKEN_WITH_BURN_ROLE, + BigUint::from(100_000u64), + BigUint::from(10_000u64), + ) + .run(); + + state + .world + .tx() + .from(MULTISIG_ADDRESS) + .to(ESDT_SAFE_ADDRESS) + .typed(esdt_safe_proxy::EsdtSafeProxy) + .set_eth_tx_gas_limit(1000u64) + .run(); + + state.single_transaction_should_work(TOKEN_ID, 100_000u64); + + state.set_transaction_batch_status_should_fail( + 5u32, + tx_statuses.clone(), + ERROR, + "Batches must be processed in order", + ); + + state.set_transaction_batch_status_should_fail( + 1u32, + tx_multiple_statuses.clone(), + ERROR, + "Invalid number of statuses provided", + ); + + state.set_transaction_batch_status_should_fail( + 1u32, + tx_statuses_invalid.clone(), + ERROR, + "Transaction status may only be set to Executed or Rejected", + ); + + state.set_transaction_batch_status_should_work(1u32, tx_statuses.clone()); + + let result = state + .world + .query() + .to(ESDT_SAFE_ADDRESS) + .typed(esdt_safe_proxy::EsdtSafeProxy) + .get_batch_status(1u64) + .returns(ReturnsResult) + .run(); + assert_eq!(result, BatchStatus::AlreadyProcessed); +} + +#[test] +fn esdt_safe_create_transaction() { + let mut state = EsdtSafeTestState::new(); + state.multisig_deploy(); + state.safe_deploy(); + + state.world.set_esdt_balance( + MULTISIG_ADDRESS, + b"TOKEN-WITH", + BigUint::from(10_000_000u64), + ); + + state.single_transaction_should_fail( + TOKEN_WITH_BURN_ROLE, + 10u64, + "Cannot create transaction while paused", + ); + + state.config_esdtsafe(); + + state.single_transaction_should_fail( + TOKEN_WITH_BURN_ROLE, + 0u64, + "Transaction fees cost more than the entire bridged amount", + ); + + state.single_transaction_should_fail(NON_WHITELISTED_TOKEN, 100u64, "Token not in whitelist"); + + state.single_transaction_should_fail(TOKEN_WITH_BURN_ROLE, 100u64, "Not enough minted tokens!"); + + state.single_transaction_should_fail(MINT_BURN_TOKEN, 10u64, "Cannot do the burn action!"); + + let refund_info = sc_proxies::esdt_safe_proxy::RefundInfo:: { + address: ManagedAddress::from(OWNER_ADDRESS.eval_to_array()), + initial_batch_id: 1u64, + initial_nonce: 1u64, + }; + + state + .world + .tx() + .from(BRIDGE_PROXY_ADDRESS) + .to(ESDT_SAFE_ADDRESS) + .typed(esdt_safe_proxy::EsdtSafeProxy) + .create_transaction(EthAddress::zero(), OptionalValue::Some(refund_info.clone())) + .single_esdt(&TOKEN_ID.into(), 0, &BigUint::from(10u64)) + .run(); + + state + .world + .tx() + .from(OWNER_ADDRESS) + .to(ESDT_SAFE_ADDRESS) + .typed(esdt_safe_proxy::EsdtSafeProxy) + .create_transaction(EthAddress::zero(), OptionalValue::Some(refund_info.clone())) + .single_esdt(&TOKEN_ID.into(), 0, &BigUint::from(10u64)) + .returns(ExpectError( + ERROR, + "Cannot specify a refund address from this caller", + )) + .run(); + + state + .world + .tx() + .from(BRIDGED_TOKENS_WRAPPER_ADDRESS) + .to(ESDT_SAFE_ADDRESS) + .typed(esdt_safe_proxy::EsdtSafeProxy) + .create_transaction(EthAddress::zero(), OptionalValue::Some(refund_info.clone())) + .single_esdt(&TOKEN_ID.into(), 0, &BigUint::from(10u64)) + .run(); + + state + .world + .tx() + .from(MULTISIG_ADDRESS) + .to(ESDT_SAFE_ADDRESS) + .typed(esdt_safe_proxy::EsdtSafeProxy) + .set_eth_tx_gas_limit(1000u64) + .run(); + + state + .world + .tx() + .from(MULTISIG_ADDRESS) + .to(ESDT_SAFE_ADDRESS) + .typed(esdt_safe_proxy::EsdtSafeProxy) + .set_default_price_per_gas_unit(TOKEN_ID, 10u64) + .run(); + + state.single_transaction_should_work(TOKEN_ID, 100_000u64); + + let total_accumulated_transaction_fee = state + .world + .query() + .to(ESDT_SAFE_ADDRESS) + .typed(esdt_safe_proxy::EsdtSafeProxy) + .accumulated_transaction_fees(TOKEN_ID) + .returns(ReturnsResult) + .run(); + + assert_eq!(total_accumulated_transaction_fee, 10000u64); + + state.single_transaction_should_work(NATIVE_TOKEN_ID, 120_000u64); + + let total_balances = state + .world + .query() + .to(ESDT_SAFE_ADDRESS) + .typed(esdt_safe_proxy::EsdtSafeProxy) + .total_balances(NATIVE_TOKEN_ID) + .returns(ReturnsResult) + .run(); + + assert_eq!(total_balances, 120000u64); +} + +#[test] +fn esdt_create_transaction_sc_call_test() { + let mut state = EsdtSafeTestState::new(); + state.multisig_deploy(); + state.safe_deploy(); + + state.world.set_esdt_balance( + MULTISIG_ADDRESS, + b"TOKEN-WITH", + BigUint::from(10_000_000u64), + ); + + state.config_esdtsafe(); + + let refund_info = sc_proxies::esdt_safe_proxy::RefundInfo:: { + address: ManagedAddress::from(OWNER_ADDRESS.eval_to_array()), + initial_batch_id: 1u64, + initial_nonce: 1u64, + }; + + let data = ManagedBuffer::::from(b"Some data"); + + state + .world + .tx() + .from(BRIDGE_PROXY_ADDRESS) + .to(ESDT_SAFE_ADDRESS) + .typed(esdt_safe_proxy::EsdtSafeProxy) + .create_transaction_sc_call( + EthAddress::zero(), + data.clone(), + OptionalValue::Some(refund_info.clone()), + ) + .single_esdt(&TOKEN_ID.into(), 0, &BigUint::from(10u64)) + .returns(ReturnsResult) + .run(); + + state + .world + .tx() + .from(MULTISIG_ADDRESS) + .to(ESDT_SAFE_ADDRESS) + .typed(esdt_safe_proxy::EsdtSafeProxy) + .create_transaction_sc_call( + EthAddress::zero(), + data.clone(), + OptionalValue::None::>, + ) + .single_esdt(&TOKEN_ID.into(), 0, &BigUint::from(10u64)) + .returns(ReturnsResult) + .run(); +} + +#[test] +fn add_refund_batch_test() { + let mut state = EsdtSafeTestState::new(); + state.multisig_deploy(); + state.safe_deploy(); + state.config_esdtsafe(); + + state.world.set_esdt_balance( + MULTI_TRANSFER_ADDRESS, + b"ESDT-123", + BigUint::from(300_000_000_000u64), + ); + + state + .world + .tx() + .from(MULTISIG_ADDRESS) + .to(ESDT_SAFE_ADDRESS) + .typed(esdt_safe_proxy::EsdtSafeProxy) + .set_eth_tx_gas_limit(1u64) + .run(); + + state.world.set_esdt_balance( + ESDT_SAFE_ADDRESS, + b"ESDT-123", + BigUint::from(300_000_000_000u64), + ); + + let eth_tx = Transaction { + from: ManagedBuffer::from(OWNER_ADDRESS_EXPR), + to: ManagedBuffer::from(ESTD_SAFE_ADDRESS_EXPR), + amount: BigUint::from(1_000_000u64), + block_nonce: 0u64, + nonce: 0u64, + token_identifier: TokenIdentifier::from(NATIVE_TOKEN_ID), + is_refund_tx: true, + }; + + let eth_tx2 = Transaction { + from: ManagedBuffer::from(OWNER_ADDRESS_EXPR), + to: ManagedBuffer::from(ESTD_SAFE_ADDRESS_EXPR), + amount: BigUint::from(1_000_000u64), + block_nonce: 0u64, + nonce: 0u64, + token_identifier: TokenIdentifier::from(NATIVE_TOKEN_ID), + is_refund_tx: true, + }; + + let mut transfers: ManagedVec> = ManagedVec::new(); + transfers.push(eth_tx); + transfers.push(eth_tx2); + + let payments = vec![ + EsdtTokenPayment::new(NATIVE_TOKEN_ID.into(), 0, BigUint::from(1_000_000u64)), + EsdtTokenPayment::new(NATIVE_TOKEN_ID.into(), 0, BigUint::from(1_000_000u64)), + ]; + let payment = EgldOrMultiEsdtPayment::MultiEsdt(payments.into()); + + state.world.set_esdt_balance( + ESDT_SAFE_ADDRESS, + b"TOKEN-123456", + BigUint::from(100_000_000_000u64), + ); + + state.add_refund_batch_tx_multiple_payment_should_fail( + ESDT_SAFE_ADDRESS, + ESDT_SAFE_ADDRESS, + transfers.clone(), + payment.clone(), + "Invalid caller", + ); + + let empty_transfers = ManagedVec::>::new(); + + state.world.set_esdt_balance( + MULTI_TRANSFER_ADDRESS, + b"TOKEN-123456", + BigUint::from(10_000u64), + ); + + state.world.set_esdt_balance( + MULTI_TRANSFER_ADDRESS, + b"TOKEN-WITH", + BigUint::from(10_000u64), + ); + + state.world.set_esdt_balance( + MULTI_TRANSFER_ADDRESS, + b"MINT-BURN-123456", + BigUint::from(10_000u64), + ); + + state + .world + .tx() + .from(MULTI_TRANSFER_ADDRESS) + .to(ESDT_SAFE_ADDRESS) + .typed(esdt_safe_proxy::EsdtSafeProxy) + .add_refund_batch(empty_transfers) + .returns(ExpectError(ERROR, "Cannot refund with no payments")) + .run(); + + state.add_refund_batch_tx_single_payment_should_fail( + MULTI_TRANSFER_ADDRESS, + ESDT_SAFE_ADDRESS, + transfers.clone(), + TOKEN_WITH_BURN_ROLE, + 10u64, + "Token identifiers do not match", + ); + + let payments_invalid: Vec> = vec![ + EsdtTokenPayment::new(NATIVE_TOKEN_ID.into(), 0, BigUint::from(1_000u64)), + EsdtTokenPayment::new(NATIVE_TOKEN_ID.into(), 0, BigUint::from(100u64)), + ]; + let payment_invalid = EgldOrMultiEsdtPayment::MultiEsdt(payments_invalid.into()); + + state.add_refund_batch_tx_multiple_payment_should_fail( + MULTI_TRANSFER_ADDRESS, + ESDT_SAFE_ADDRESS, + transfers.clone(), + payment_invalid.clone(), + "Amounts do not match", + ); + + let eth_tx3 = Transaction { + from: ManagedBuffer::from(OWNER_ADDRESS_EXPR), + to: ManagedBuffer::from(ESTD_SAFE_ADDRESS_EXPR), + amount: BigUint::from(10_000u64), + block_nonce: 0u64, + nonce: 0u64, + token_identifier: TokenIdentifier::from(MINT_BURN_TOKEN), + is_refund_tx: true, + }; + + let mut transfers2: ManagedVec> = ManagedVec::new(); + transfers2.push(eth_tx3); + + state + .world + .tx() + .from(MULTI_TRANSFER_ADDRESS) + .to(ESDT_SAFE_ADDRESS) + .typed(esdt_safe_proxy::EsdtSafeProxy) + .add_refund_batch(transfers2) + .single_esdt(&MINT_BURN_TOKEN.into(), 0, &BigUint::from(10_000u64)) + .returns(ExpectError(ERROR, "Not enough minted tokens!")) + .run(); + + let eth_tx4 = Transaction { + from: ManagedBuffer::from(OWNER_ADDRESS_EXPR), + to: ManagedBuffer::from(ESTD_SAFE_ADDRESS_EXPR), + amount: BigUint::from(1_000u64), + block_nonce: 0u64, + nonce: 0u64, + token_identifier: TokenIdentifier::from(MINT_BURN_TOKEN), + is_refund_tx: true, + }; + + let mut transfers3: ManagedVec> = ManagedVec::new(); + transfers3.push(eth_tx4); + + state + .world + .tx() + .from(MULTI_TRANSFER_ADDRESS) + .to(ESDT_SAFE_ADDRESS) + .typed(esdt_safe_proxy::EsdtSafeProxy) + .add_refund_batch(transfers3.clone()) + .single_esdt(&MINT_BURN_TOKEN.into(), 0, &BigUint::from(1_000u64)) + .returns(ExpectError(ERROR, "Cannot do the burn action!")) + .run(); + + state.world.set_esdt_local_roles( + ESDT_SAFE_ADDRESS, + b"MINT-BURN-123456", + &[EsdtLocalRole::Mint, EsdtLocalRole::Burn], + ); + + state + .world + .tx() + .from(MULTI_TRANSFER_ADDRESS) + .to(ESDT_SAFE_ADDRESS) + .typed(esdt_safe_proxy::EsdtSafeProxy) + .add_refund_batch(transfers3) + .single_esdt(&MINT_BURN_TOKEN.into(), 0, &BigUint::from(1_000u64)) + .run(); + + state + .world + .tx() + .from(MULTI_TRANSFER_ADDRESS) + .to(ESDT_SAFE_ADDRESS) + .typed(esdt_safe_proxy::EsdtSafeProxy) + .add_refund_batch(transfers) + .egld_or_multi_esdt(payment) + .returns(ReturnsResult) + .run(); + + let result = state + .world + .query() + .to(ESDT_SAFE_ADDRESS) + .typed(esdt_safe_proxy::EsdtSafeProxy) + .get_batch_status(1u64) + .returns(ReturnsResult) + .run(); + + if let BatchStatus::PartiallyFull { + end_block_nonce, + tx_ids, + } = result + { + assert!(!tx_ids.is_empty(), "tx_ids should not be empty"); + let expected_tx_ids = vec![1u64, 2u64, 3u64]; + let tx_ids_vec: Vec = tx_ids.into_iter().collect(); + assert_eq!( + tx_ids_vec, expected_tx_ids, + "tx_ids do not match expected values" + ); + } else { + panic!("Expected BatchStatus::PartiallyFull, got {:?}", result); + } +} + +#[test] +fn claim_refund_test() { + let mut state = EsdtSafeTestState::new(); + state.multisig_deploy(); + state.safe_deploy(); + state.config_esdtsafe(); + + let mut tx_statuses = MultiValueEncoded::::new(); + tx_statuses.push(TransactionStatus::Rejected); + + state + .esdt_raw_transaction() + .claim_refund(TOKEN_ID) + .with_result(ExpectStatus(ERROR)) + .returns(ExpectError(ERROR, "Nothing to refund")) + .run(); + + state + .world + .tx() + .from(MULTISIG_ADDRESS) + .to(ESDT_SAFE_ADDRESS) + .typed(esdt_safe_proxy::EsdtSafeProxy) + .set_eth_tx_gas_limit(100u64) + .run(); + + state.world.set_esdt_local_roles( + ESDT_SAFE_ADDRESS, + b"MINT-BURN-123456", + &[EsdtLocalRole::Mint, EsdtLocalRole::Burn], + ); + + state.single_transaction_should_work(MINT_BURN_TOKEN, 1000u64); + state.set_transaction_batch_status_should_work(1, tx_statuses.clone()); + + let refund = state + .world + .query() + .to(ESDT_SAFE_ADDRESS) + .typed(esdt_safe_proxy::EsdtSafeProxy) + .get_refund_amounts(MULTISIG_ADDRESS) + .returns(ReturnsResult) + .run(); + + let (token_id, amount) = refund.into_iter().next().unwrap().into_tuple(); + assert_eq!(token_id, TokenIdentifier::from(MINT_BURN_TOKEN)); + assert_eq!(amount, BigUint::from(1000u64)); + + let claim_refund = state + .esdt_raw_transaction() + .claim_refund(MINT_BURN_TOKEN) + .returns(ReturnsResult) + .run(); + + assert_eq!(token_id, claim_refund.token_identifier); + assert_eq!(amount, claim_refund.amount); + + let refund_after = state + .world + .query() + .to(ESDT_SAFE_ADDRESS) + .typed(esdt_safe_proxy::EsdtSafeProxy) + .get_refund_amounts(OWNER_ADDRESS) + .returns(ReturnsResult) + .run(); + assert!(refund_after.is_empty()); + + state + .esdt_raw_transaction() + .claim_refund(MINT_BURN_TOKEN) + .returns(ExpectError(ERROR, "Nothing to refund")) + .run(); +} + +#[test] +fn withdraw_refund_fees_for_ethereum_test() { + let mut state = EsdtSafeTestState::new(); + state.multisig_deploy(); + state.safe_deploy(); + state.config_esdtsafe(); + + state + .world + .tx() + .from(MULTISIG_ADDRESS) + .to(ESDT_SAFE_ADDRESS) + .typed(esdt_safe_proxy::EsdtSafeProxy) + .set_eth_tx_gas_limit(1000u64) + .run(); + + state + .world + .tx() + .from(MULTISIG_ADDRESS) + .to(ESDT_SAFE_ADDRESS) + .typed(esdt_safe_proxy::EsdtSafeProxy) + .set_default_price_per_gas_unit(TOKEN_ID, 10u64) + .run(); + + state + .world + .tx() + .from(MULTISIG_ADDRESS) + .to(ESDT_SAFE_ADDRESS) + .typed(esdt_safe_proxy::EsdtSafeProxy) + .withdraw_refund_fees_for_ethereum(TOKEN_ID, MULTISIG_ADDRESS) + .returns(ExpectError(ERROR, "There are no fees to withdraw")) + .run(); + + let refund_tx = Transaction { + from: ManagedBuffer::from(OWNER_ADDRESS_EXPR), + to: ManagedBuffer::from(ESTD_SAFE_ADDRESS_EXPR), + amount: BigUint::from(1_000_000u64), + block_nonce: 0u64, + nonce: 0u64, + token_identifier: TokenIdentifier::from(TOKEN_ID), + is_refund_tx: true, + }; + + let mut transfers: ManagedVec> = ManagedVec::new(); + transfers.push(refund_tx.clone()); + + let payment = EsdtTokenPayment::new(TOKEN_ID.into(), 0, BigUint::from(1_000_000u64)); + let payments = vec![payment]; + let payment = EgldOrMultiEsdtPayment::MultiEsdt(payments.into()); + + state.world.set_esdt_balance( + MULTI_TRANSFER_ADDRESS, + b"TOKEN-123456", + BigUint::from(1_000_000u64), + ); + + state + .world + .tx() + .from(MULTI_TRANSFER_ADDRESS) + .to(ESDT_SAFE_ADDRESS) + .typed(esdt_safe_proxy::EsdtSafeProxy) + .add_refund_batch(transfers.clone()) + .egld_or_multi_esdt(payment.clone()) + .returns(ReturnsResult) + .run(); + + let refund_fees = state + .world + .query() + .to(ESDT_SAFE_ADDRESS) + .typed(esdt_safe_proxy::EsdtSafeProxy) + .get_refund_fees_for_ethereum(TOKEN_ID) + .returns(ReturnsResult) + .run(); + + assert!( + refund_fees > BigUint::zero(), + "refund_fees_for_ethereum should be greater than zero" + ); + + state + .world + .tx() + .from(MULTISIG_ADDRESS) + .to(ESDT_SAFE_ADDRESS) + .typed(esdt_safe_proxy::EsdtSafeProxy) + .withdraw_refund_fees_for_ethereum(TOKEN_ID, MULTISIG_ADDRESS) + .returns(ReturnsResult) + .run(); + + let refund_fees_after = state + .world + .query() + .to(ESDT_SAFE_ADDRESS) + .typed(esdt_safe_proxy::EsdtSafeProxy) + .get_refund_fees_for_ethereum(TOKEN_ID) + .returns(ReturnsResult) + .run(); + + assert_eq!( + refund_fees_after, + BigUint::zero(), + "refund_fees_for_ethereum should be zero after withdrawal" + ); +} + +#[test] +fn withdraw_transaction_fees_test() { + let mut state = EsdtSafeTestState::new(); + state.multisig_deploy(); + state.safe_deploy(); + state.config_esdtsafe(); + + state + .world + .tx() + .from(MULTISIG_ADDRESS) + .to(ESDT_SAFE_ADDRESS) + .typed(esdt_safe_proxy::EsdtSafeProxy) + .set_eth_tx_gas_limit(1000u64) + .run(); + + state + .world + .tx() + .from(MULTISIG_ADDRESS) + .to(ESDT_SAFE_ADDRESS) + .typed(esdt_safe_proxy::EsdtSafeProxy) + .withdraw_transaction_fees(TOKEN_ID, MULTISIG_ADDRESS) + .returns(ExpectError(ERROR, "There are no fees to withdraw")) + .run(); + + state + .world + .tx() + .from(MULTISIG_ADDRESS) + .to(ESDT_SAFE_ADDRESS) + .typed(esdt_safe_proxy::EsdtSafeProxy) + .set_default_price_per_gas_unit(TOKEN_ID, 10u64) + .run(); + + state + .world + .tx() + .from(OWNER_ADDRESS) + .to(ESDT_SAFE_ADDRESS) + .typed(esdt_safe_proxy::EsdtSafeProxy) + .create_transaction( + EthAddress::zero(), + OptionalValue::None::>, + ) + .single_esdt(&TOKEN_ID.into(), 0, &BigUint::from(1_000_000u64)) + .returns(ReturnsResult) + .run(); + + let transaction_fees = state + .world + .query() + .to(ESDT_SAFE_ADDRESS) + .typed(esdt_safe_proxy::EsdtSafeProxy) + .get_transaction_fees(TOKEN_ID) + .returns(ReturnsResult) + .run(); + + assert!( + transaction_fees > BigUint::zero(), + "accumulated_transaction_fees should be greater than zero" + ); + + state + .world + .tx() + .from(MULTISIG_ADDRESS) + .to(ESDT_SAFE_ADDRESS) + .typed(esdt_safe_proxy::EsdtSafeProxy) + .withdraw_transaction_fees(TOKEN_ID, MULTISIG_ADDRESS) + .returns(ReturnsResult) + .run(); + + let transaction_fees_after = state + .world + .query() + .to(ESDT_SAFE_ADDRESS) + .typed(esdt_safe_proxy::EsdtSafeProxy) + .get_transaction_fees(TOKEN_ID) + .returns(ReturnsResult) + .run(); + + assert_eq!( + transaction_fees_after, + BigUint::zero(), + "accumulated_transaction_fees should be zero after withdrawal" + ); +} diff --git a/esdt-safe/wasm/Cargo.lock b/esdt-safe/wasm/Cargo.lock index 4319c51d..0ddbdbb0 100644 --- a/esdt-safe/wasm/Cargo.lock +++ b/esdt-safe/wasm/Cargo.lock @@ -4,15 +4,15 @@ 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" -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" @@ -51,9 +51,16 @@ dependencies = [ "eth-address", "fee-estimator-module", "max-bridged-amount-module", + "mock-bridge-proxy", + "mock-bridged-tokens-wrapper", + "mock-multi-transfer-esdt", + "mock-multisig", + "mock-price-aggregator", "multiversx-price-aggregator-sc", "multiversx-sc", "multiversx-sc-modules", + "sc-proxies", + "storage-module", "token-module", "transaction", "tx-batch-module", @@ -79,6 +86,7 @@ name = "fee-estimator-module" version = "0.0.0" dependencies = [ "multiversx-sc", + "storage-module", ] [[package]] @@ -108,18 +116,18 @@ checksum = "6fe2267d4ed49bc07b63801559be28c718ea06c4738b7a03c94df7386d2cde46" [[package]] name = "js-sys" -version = "0.3.69" +version = "0.3.72" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "29c15563dc2726973df627357ce0c9ddddbea194836909d655df6a75d2cf296d" +checksum = "6a88f1bda2bd75b0452a14784937d796722fdebfe50df998aeb3f0b7603019a9" dependencies = [ "wasm-bindgen", ] [[package]] name = "libc" -version = "0.2.155" +version = "0.2.160" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "97b3888a4aecf77e811145cadf6eef5901f4782c53886191b2f693f24761847c" +checksum = "f0b21006cd1874ae9e650973c565615676dc4a274c965bb0a73796dac838ce4f" [[package]] name = "log" @@ -134,11 +142,47 @@ dependencies = [ "multiversx-sc", ] +[[package]] +name = "mock-bridge-proxy" +version = "0.0.0" +dependencies = [ + "multiversx-sc", +] + +[[package]] +name = "mock-bridged-tokens-wrapper" +version = "0.0.0" +dependencies = [ + "eth-address", + "multiversx-sc", +] + +[[package]] +name = "mock-multi-transfer-esdt" +version = "0.0.0" +dependencies = [ + "multiversx-sc", +] + +[[package]] +name = "mock-multisig" +version = "0.0.0" +dependencies = [ + "multiversx-sc", +] + +[[package]] +name = "mock-price-aggregator" +version = "0.0.0" +dependencies = [ + "multiversx-sc", +] + [[package]] name = "multiversx-price-aggregator-sc" -version = "0.52.0" +version = "0.53.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5ea572ebab3a6addd937cad829076b13e320851503fb6adf1ad66f544b2bf100" +checksum = "7317294898d2f57b5181f3310014dec755359925b26d7b992a5f8fc968c7ee0a" dependencies = [ "arrayvec", "getrandom", @@ -149,9 +193,9 @@ dependencies = [ [[package]] name = "multiversx-sc" -version = "0.52.3" +version = "0.53.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "526760b1d6236c011285b264a70a0a9dd3b3dbc53c3b5f76932f4bcfd3a8910c" +checksum = "75ea89a26f0aacda21437a8ae5ccfbefab99d8191942b3d2eddbcbf84f9866d7" dependencies = [ "bitflags", "hex-literal", @@ -163,9 +207,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", @@ -174,9 +218,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", @@ -186,9 +230,9 @@ dependencies = [ [[package]] name = "multiversx-sc-derive" -version = "0.52.3" +version = "0.53.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3557f2f12640a8a07fa6af66cc2a13b188c5b61bed72db22fe631fb3a60c3e96" +checksum = "4c17fdf90fafca2f19085ae67b0502d9f71bf8ab1be3c83808eb88e02a8c18b9" dependencies = [ "hex", "proc-macro2", @@ -199,18 +243,18 @@ dependencies = [ [[package]] name = "multiversx-sc-modules" -version = "0.52.3" +version = "0.53.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "61f5c29c6044f3dc9e866858feee625d7fae5604a68ac7bd66dec683eee97563" +checksum = "daeb48acbd39255868a3241798df2f85050f0ae8d82d6417bd2cd0e30a241855" dependencies = [ "multiversx-sc", ] [[package]] name = "multiversx-sc-wasm-adapter" -version = "0.52.3" +version = "0.53.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ed13aaca9cbdbc6911174cd3029e750a7563d85dd3daaa1107b1fd31c7f17245" +checksum = "20659915a4377d375c46d7f237e810053a03f7e084fad6362dd5748a7233defb" dependencies = [ "multiversx-sc", ] @@ -235,9 +279,9 @@ dependencies = [ [[package]] name = "once_cell" -version = "1.19.0" +version = "1.20.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3fdb12b2476b595f9358c5161aa467c2438859caa136dec86c26fdd2efe17b92" +checksum = "1261fe7e33c73b354eab43b1273a57c8f967d0391e80353e51f764ac02cf6775" [[package]] name = "ppv-lite86" @@ -259,9 +303,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", ] @@ -306,17 +350,35 @@ dependencies = [ "getrandom", ] +[[package]] +name = "sc-proxies" +version = "0.0.0" +dependencies = [ + "eth-address", + "multiversx-sc", + "token-module", + "transaction", + "tx-batch-module", +] + [[package]] name = "smallvec" version = "1.13.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3c5e1a9a646d36c3599cd173a41282daf47c44583ad367b8e6837255952e5c67" +[[package]] +name = "storage-module" +version = "0.1.0" +dependencies = [ + "multiversx-sc", +] + [[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", @@ -329,6 +391,7 @@ version = "0.0.0" dependencies = [ "fee-estimator-module", "multiversx-sc", + "storage-module", ] [[package]] @@ -349,9 +412,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" @@ -367,19 +430,20 @@ checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" [[package]] name = "wasm-bindgen" -version = "0.2.92" +version = "0.2.95" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4be2531df63900aeb2bca0daaaddec08491ee64ceecbee5076636a3b026795a8" +checksum = "128d1e363af62632b8eb57219c8fd7877144af57558fb2ef0368d0087bddeb2e" dependencies = [ "cfg-if", + "once_cell", "wasm-bindgen-macro", ] [[package]] name = "wasm-bindgen-backend" -version = "0.2.92" +version = "0.2.95" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "614d787b966d3989fa7bb98a654e369c762374fd3213d212cfc0251257e747da" +checksum = "cb6dd4d3ca0ddffd1dd1c9c04f94b868c37ff5fac97c30b97cff2d74fce3a358" dependencies = [ "bumpalo", "log", @@ -392,9 +456,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro" -version = "0.2.92" +version = "0.2.95" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a1f8823de937b71b9460c0c34e25f3da88250760bec0ebac694b49997550d726" +checksum = "e79384be7f8f5a9dd5d7167216f022090cf1f9ec128e6e6a482a2cb5c5422c56" dependencies = [ "quote", "wasm-bindgen-macro-support", @@ -402,9 +466,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro-support" -version = "0.2.92" +version = "0.2.95" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e94f17b526d0a461a191c78ea52bbce64071ed5c04c9ffe424dcb38f74171bb7" +checksum = "26c6ab57572f7a24a4985830b120de1594465e5d500f24afe89e16b4e833ef68" dependencies = [ "proc-macro2", "quote", @@ -415,9 +479,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-shared" -version = "0.2.92" +version = "0.2.95" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "af190c94f2773fdb3729c55b007a722abb5384da03bc0986df4c289bf5567e96" +checksum = "65fc09f10666a9f147042251e0dda9c18f166ff7de300607007e96bdebc1068d" [[package]] name = "zerocopy" diff --git a/esdt-safe/wasm/Cargo.toml b/esdt-safe/wasm/Cargo.toml index 9b79e7d4..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.52.3" +version = "=0.53.2" [workspace] members = ["."] diff --git a/esdt-safe/wasm/src/lib.rs b/esdt-safe/wasm/src/lib.rs index 9a67f5f0..283851b2 100644 --- a/esdt-safe/wasm/src/lib.rs +++ b/esdt-safe/wasm/src/lib.rs @@ -6,9 +6,9 @@ // Init: 1 // Upgrade: 1 -// Endpoints: 51 +// Endpoints: 44 // Async Callback (empty): 1 -// Total number of exported functions: 54 +// Total number of exported functions: 47 #![no_std] @@ -23,9 +23,8 @@ multiversx_sc_wasm_adapter::endpoints! { setTransactionBatchStatus => set_transaction_batch_status addRefundBatch => add_refund_batch createTransaction => create_transaction + createTransactionSCCall => create_transaction_sc_call claimRefund => claim_refund - setBridgedTokensWrapperAddress => set_bridged_tokens_wrapper_contract_address - setBridgeProxyContractAddress => set_bridge_proxy_contract_address withdrawRefundFeesForEthereum => withdraw_refund_fees_for_ethereum withdrawTransactionFees => withdraw_transaction_fees computeTotalAmmountsFromIndex => compute_total_amounts_from_index @@ -33,14 +32,10 @@ multiversx_sc_wasm_adapter::endpoints! { getTotalRefundAmounts => get_total_refund_amounts getRefundFeesForEthereum => get_refund_fees_for_ethereum getTransactionFees => get_transaction_fees - getBridgedTokensWrapperAddress => bridged_tokens_wrapper_address - getBridgeProxyContractAddress => bridge_proxy_contract_address - setFeeEstimatorContractAddress => set_fee_estimator_contract_address setEthTxGasLimit => set_eth_tx_gas_limit setDefaultPricePerGasUnit => set_default_price_per_gas_unit setTokenTicker => set_token_ticker calculateRequiredFee => calculate_required_fee - getFeeEstimatorContractAddress => fee_estimator_contract_address getDefaultPricePerGasUnit => default_price_per_gas_unit getEthTxGasLimit => eth_tx_gas_limit distributeFees => distribute_fees @@ -49,11 +44,9 @@ multiversx_sc_wasm_adapter::endpoints! { getTokens => get_tokens initSupply => init_supply initSupplyMintBurn => init_supply_mint_burn - setMultiTransferContractAddress => set_multi_transfer_contract_address getAllKnownTokens => token_whitelist isNativeToken => native_token isMintBurnToken => mint_burn_token - getMultiTransferContractAddress => multi_transfer_contract_address getAccumulatedTransactionFees => accumulated_transaction_fees getTotalBalances => total_balances getMintBalances => mint_balances diff --git a/multi-transfer-esdt/Cargo.toml b/multi-transfer-esdt/Cargo.toml index e26adddc..c15d1873 100644 --- a/multi-transfer-esdt/Cargo.toml +++ b/multi-transfer-esdt/Cargo.toml @@ -32,11 +32,29 @@ path = "../esdt-safe" [dependencies.token-module] path = "../common/token-module" +[dependencies.storage-module] +path = "../common/storage-module" + +[dependencies.mock-multisig] +path = "../common/mock-contracts/mock-multisig" + +[dependencies.mock-multi-transfer-esdt] +path = "../common/mock-contracts/mock-multi-transfer-esdt" + +[dependencies.mock-price-aggregator] +path = "../common/mock-contracts/mock-price-aggregator" + +[dependencies.sc-proxies] +path = "../common/sc-proxies" + +[dependencies.mock-proxies] +path = "../common/mock-proxies" + [dependencies.multiversx-sc] -version = "=0.52.3" +version = "=0.53.2" [dependencies.multiversx-sc-modules] -version = "=0.52.3" +version = "=0.53.2" [dev-dependencies.multiversx-sc-scenario] -version = "=0.52.3" +version = "=0.53.2" diff --git a/multi-transfer-esdt/meta/Cargo.toml b/multi-transfer-esdt/meta/Cargo.toml index 83265f9e..cc9a4b67 100644 --- a/multi-transfer-esdt/meta/Cargo.toml +++ b/multi-transfer-esdt/meta/Cargo.toml @@ -11,5 +11,5 @@ publish = false path = ".." [dependencies.multiversx-sc-meta-lib] -version = "=0.52.3" +version = "=0.53.2" default-features = false diff --git a/multi-transfer-esdt/sc-config.toml b/multi-transfer-esdt/sc-config.toml index 1a13bc1b..c89a8d99 100644 --- a/multi-transfer-esdt/sc-config.toml +++ b/multi-transfer-esdt/sc-config.toml @@ -1,4 +1,4 @@ [settings] [[proxy]] -path = "../multisig/src/multi_transfer_esdt_proxy.rs" +path = "../common/sc-proxies/src/multi_transfer_esdt_proxy.rs" diff --git a/multi-transfer-esdt/scenarios/setup_accounts.scen.json b/multi-transfer-esdt/scenarios/setup_accounts.scen.json index 807472e6..5454dccb 100644 --- a/multi-transfer-esdt/scenarios/setup_accounts.scen.json +++ b/multi-transfer-esdt/scenarios/setup_accounts.scen.json @@ -92,9 +92,7 @@ "from": "address:owner", "contractCode": "file:../../bridge-proxy/output/bridge-proxy.wasm", "value": "0", - "arguments": [ - "sc:multi_transfer_esdt" - ], + "arguments": [], "gasLimit": "20,000,000", "gasPrice": "0" }, @@ -105,26 +103,6 @@ "refund": "*" } }, - { - "step": "scCall", - "txId": "add-bridge-proxy-to-multi-transfer", - "tx": { - "from": "address:owner", - "to": "sc:multi_transfer_esdt", - "function": "setBridgeProxyContractAddress", - "arguments": [ - "sc:bridge-proxy" - ], - "gasLimit": "5,000,000", - "gasPrice": "0" - }, - "expect": { - "status": "0", - "message": "", - "gas": "*", - "refund": "*" - } - }, { "step": "scCall", "txId": "add-token-1", @@ -181,52 +159,11 @@ "refund": "*" } }, - { - "step": "scCall", - "txId": "set-multi-transfer-contract-address", - "tx": { - "from": "address:owner", - "to": "sc:esdt-safe", - "value": "0", - "function": "setMultiTransferContractAddress", - "arguments": [ - "sc:multi_transfer_esdt" - ], - "gasLimit": "50,000,000", - "gasPrice": "0" - }, - "expect": { - "status": "0", - "message": "", - "gas": "*", - "refund": "*" - } - }, - { - "step": "scCall", - "txId": "add-bridge-proxy-to-multi-transfer", - "tx": { - "from": "address:owner", - "to": "sc:multi_transfer_esdt", - "function": "setEsdtSafeContractAddress", - "arguments": [ - "sc:esdt-safe" - ], - "gasLimit": "5,000,000", - "gasPrice": "0" - }, - "expect": { - "status": "0", - "message": "", - "gas": "*", - "refund": "*" - } - }, { "step": "checkState", "accounts": { "address:owner": { - "nonce": "7", + "nonce": "4", "balance": "0", "esdt": { "str:BRIDGE-123456": { @@ -252,10 +189,8 @@ "storage": { "str:firstBatchId": "1", "str:lastBatchId": "1", - "str:bridgeProxyContractAddress": "sc:bridge-proxy", "str:maxTxBatchSize": "10", - "str:maxTxBatchBlockDuration": "0xffffffffffffffff", - "str:esdtSafeContractAddress": "sc:esdt-safe" + "str:maxTxBatchBlockDuration": "0xffffffffffffffff" } }, "sc:bridge-proxy": { @@ -328,4 +263,4 @@ } } ] -} +} \ No newline at end of file diff --git a/multi-transfer-esdt/src/bridge_proxy_contract_proxy.rs b/multi-transfer-esdt/src/bridge_proxy_contract_proxy.rs deleted file mode 100644 index 3cb21d18..00000000 --- a/multi-transfer-esdt/src/bridge_proxy_contract_proxy.rs +++ /dev/null @@ -1,239 +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 BridgeProxyContractProxy; - -impl TxProxyTrait for BridgeProxyContractProxy -where - Env: TxEnv, - From: TxFrom, - To: TxTo, - Gas: TxGas, -{ - type TxProxyMethods = BridgeProxyContractProxyMethods; - - fn proxy_methods(self, tx: Tx) -> Self::TxProxyMethods { - BridgeProxyContractProxyMethods { wrapped_tx: tx } - } -} - -pub struct BridgeProxyContractProxyMethods -where - Env: TxEnv, - From: TxFrom, - To: TxTo, - Gas: TxGas, -{ - wrapped_tx: Tx, -} - -#[rustfmt::skip] -impl BridgeProxyContractProxyMethods -where - Env: TxEnv, - Env::Api: VMApi, - From: TxFrom, - Gas: TxGas, -{ - pub fn init< - Arg0: ProxyArg>>, - >( - self, - opt_multi_transfer_address: Arg0, - ) -> TxTypedDeploy { - self.wrapped_tx - .payment(NotPayable) - .raw_deploy() - .argument(&opt_multi_transfer_address) - .original_result() - } -} - -#[rustfmt::skip] -impl BridgeProxyContractProxyMethods -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 BridgeProxyContractProxyMethods -where - Env: TxEnv, - Env::Api: VMApi, - From: TxFrom, - To: TxTo, - Gas: TxGas, -{ - pub fn deposit< - Arg0: ProxyArg>, - Arg1: ProxyArg, - >( - self, - eth_tx: Arg0, - batch_id: Arg1, - ) -> TxTypedCall { - self.wrapped_tx - .raw_call("deposit") - .argument(ð_tx) - .argument(&batch_id) - .original_result() - } - - pub fn execute< - Arg0: ProxyArg, - >( - self, - tx_id: Arg0, - ) -> TxTypedCall { - self.wrapped_tx - .payment(NotPayable) - .raw_call("execute") - .argument(&tx_id) - .original_result() - } - - pub fn get_pending_transaction_by_id< - Arg0: ProxyArg, - >( - self, - tx_id: Arg0, - ) -> TxTypedCall> { - self.wrapped_tx - .payment(NotPayable) - .raw_call("getPendingTransactionById") - .argument(&tx_id) - .original_result() - } - - pub fn get_pending_transactions( - self, - ) -> TxTypedCall>>> { - self.wrapped_tx - .payment(NotPayable) - .raw_call("getPendingTransactions") - .original_result() - } - - pub fn set_multi_transfer_contract_address< - Arg0: ProxyArg>>, - >( - self, - opt_multi_transfer_address: Arg0, - ) -> TxTypedCall { - self.wrapped_tx - .payment(NotPayable) - .raw_call("setMultiTransferAddress") - .argument(&opt_multi_transfer_address) - .original_result() - } - - pub fn set_bridged_tokens_wrapper_contract_address< - Arg0: ProxyArg>>, - >( - self, - opt_address: Arg0, - ) -> TxTypedCall { - self.wrapped_tx - .payment(NotPayable) - .raw_call("setBridgedTokensWrapperAddress") - .argument(&opt_address) - .original_result() - } - - pub fn set_esdt_safe_contract_address< - Arg0: ProxyArg>>, - >( - self, - opt_address: Arg0, - ) -> TxTypedCall { - self.wrapped_tx - .payment(NotPayable) - .raw_call("setEsdtSafeAddress") - .argument(&opt_address) - .original_result() - } - - pub fn multi_transfer_address( - self, - ) -> TxTypedCall> { - self.wrapped_tx - .payment(NotPayable) - .raw_call("getMultiTransferAddress") - .original_result() - } - - pub fn bridged_tokens_wrapper_address( - self, - ) -> TxTypedCall> { - self.wrapped_tx - .payment(NotPayable) - .raw_call("getBridgedTokensWrapperAddress") - .original_result() - } - - pub fn esdt_safe_contract_address( - self, - ) -> TxTypedCall> { - self.wrapped_tx - .payment(NotPayable) - .raw_call("getEsdtSafeContractAddress") - .original_result() - } - - pub fn highest_tx_id( - self, - ) -> TxTypedCall { - self.wrapped_tx - .payment(NotPayable) - .raw_call("highestTxId") - .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/multi-transfer-esdt/src/bridged_tokens_wrapper_proxy.rs b/multi-transfer-esdt/src/bridged_tokens_wrapper_proxy.rs deleted file mode 100644 index ac306e11..00000000 --- a/multi-transfer-esdt/src/bridged_tokens_wrapper_proxy.rs +++ /dev/null @@ -1,298 +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 BridgedTokensWrapperProxy; - -impl TxProxyTrait for BridgedTokensWrapperProxy -where - Env: TxEnv, - From: TxFrom, - To: TxTo, - Gas: TxGas, -{ - type TxProxyMethods = BridgedTokensWrapperProxyMethods; - - fn proxy_methods(self, tx: Tx) -> Self::TxProxyMethods { - BridgedTokensWrapperProxyMethods { wrapped_tx: tx } - } -} - -pub struct BridgedTokensWrapperProxyMethods -where - Env: TxEnv, - From: TxFrom, - To: TxTo, - Gas: TxGas, -{ - wrapped_tx: Tx, -} - -#[rustfmt::skip] -impl BridgedTokensWrapperProxyMethods -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 BridgedTokensWrapperProxyMethods -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 BridgedTokensWrapperProxyMethods -where - Env: TxEnv, - Env::Api: VMApi, - From: TxFrom, - To: TxTo, - Gas: TxGas, -{ - pub fn add_wrapped_token< - Arg0: ProxyArg>, - Arg1: ProxyArg, - >( - self, - universal_bridged_token_ids: Arg0, - num_decimals: Arg1, - ) -> TxTypedCall { - self.wrapped_tx - .payment(NotPayable) - .raw_call("addWrappedToken") - .argument(&universal_bridged_token_ids) - .argument(&num_decimals) - .original_result() - } - - pub fn update_wrapped_token< - Arg0: ProxyArg>, - Arg1: ProxyArg, - >( - self, - universal_bridged_token_ids: Arg0, - num_decimals: Arg1, - ) -> TxTypedCall { - self.wrapped_tx - .payment(NotPayable) - .raw_call("updateWrappedToken") - .argument(&universal_bridged_token_ids) - .argument(&num_decimals) - .original_result() - } - - pub fn remove_wrapped_token< - Arg0: ProxyArg>, - >( - self, - universal_bridged_token_ids: Arg0, - ) -> TxTypedCall { - self.wrapped_tx - .payment(NotPayable) - .raw_call("removeWrappedToken") - .argument(&universal_bridged_token_ids) - .original_result() - } - - pub fn whitelist_token< - Arg0: ProxyArg>, - Arg1: ProxyArg, - Arg2: ProxyArg>, - >( - self, - chain_specific_token_id: Arg0, - chain_specific_token_decimals: Arg1, - universal_bridged_token_ids: Arg2, - ) -> TxTypedCall { - self.wrapped_tx - .payment(NotPayable) - .raw_call("whitelistToken") - .argument(&chain_specific_token_id) - .argument(&chain_specific_token_decimals) - .argument(&universal_bridged_token_ids) - .original_result() - } - - pub fn update_whitelisted_token< - Arg0: ProxyArg>, - Arg1: ProxyArg, - >( - self, - chain_specific_token_id: Arg0, - chain_specific_token_decimals: Arg1, - ) -> TxTypedCall { - self.wrapped_tx - .payment(NotPayable) - .raw_call("updateWhitelistedToken") - .argument(&chain_specific_token_id) - .argument(&chain_specific_token_decimals) - .original_result() - } - - pub fn blacklist_token< - Arg0: ProxyArg>, - >( - self, - chain_specific_token_id: Arg0, - ) -> TxTypedCall { - self.wrapped_tx - .payment(NotPayable) - .raw_call("blacklistToken") - .argument(&chain_specific_token_id) - .original_result() - } - - pub fn deposit_liquidity( - self, - ) -> TxTypedCall { - self.wrapped_tx - .raw_call("depositLiquidity") - .original_result() - } - - /// Will wrap what it can, and send back the rest unchanged - pub fn wrap_tokens( - self, - ) -> TxTypedCall>> { - self.wrapped_tx - .raw_call("wrapTokens") - .original_result() - } - - pub fn unwrap_token< - Arg0: ProxyArg>, - >( - self, - requested_token: Arg0, - ) -> TxTypedCall { - self.wrapped_tx - .raw_call("unwrapToken") - .argument(&requested_token) - .original_result() - } - - pub fn unwrap_token_create_transaction< - Arg0: ProxyArg>, - Arg1: ProxyArg>, - Arg2: ProxyArg>, - >( - self, - requested_token: Arg0, - safe_address: Arg1, - to: Arg2, - ) -> TxTypedCall { - self.wrapped_tx - .raw_call("unwrapTokenCreateTransaction") - .argument(&requested_token) - .argument(&safe_address) - .argument(&to) - .original_result() - } - - pub fn universal_bridged_token_ids( - self, - ) -> TxTypedCall>> { - self.wrapped_tx - .payment(NotPayable) - .raw_call("getUniversalBridgedTokenIds") - .original_result() - } - - pub fn token_liquidity< - Arg0: ProxyArg>, - >( - self, - token: Arg0, - ) -> TxTypedCall> { - self.wrapped_tx - .payment(NotPayable) - .raw_call("getTokenLiquidity") - .argument(&token) - .original_result() - } - - pub fn chain_specific_to_universal_mapping< - Arg0: ProxyArg>, - >( - self, - token: Arg0, - ) -> TxTypedCall> { - self.wrapped_tx - .payment(NotPayable) - .raw_call("getChainSpecificToUniversalMapping") - .argument(&token) - .original_result() - } - - pub fn chain_specific_token_ids< - Arg0: ProxyArg>, - >( - self, - universal_token_id: Arg0, - ) -> TxTypedCall>> { - self.wrapped_tx - .payment(NotPayable) - .raw_call("getchainSpecificTokenIds") - .argument(&universal_token_id) - .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/multi-transfer-esdt/src/lib.rs b/multi-transfer-esdt/src/lib.rs index 82d257c0..70a1c3bf 100644 --- a/multi-transfer-esdt/src/lib.rs +++ b/multi-transfer-esdt/src/lib.rs @@ -3,20 +3,18 @@ use multiversx_sc::{imports::*, storage::StorageKey}; use eth_address::EthAddress; +use sc_proxies::{bridge_proxy_contract_proxy, bridged_tokens_wrapper_proxy, esdt_safe_proxy}; use transaction::{EthTransaction, PaymentsVec, Transaction, TxNonce}; -pub mod bridge_proxy_contract_proxy; -pub mod bridged_tokens_wrapper_proxy; -pub mod esdt_safe_proxy; -pub mod multi_transfer_proxy; - const DEFAULT_MAX_TX_BATCH_SIZE: usize = 10; const DEFAULT_MAX_TX_BATCH_BLOCK_DURATION: u64 = u64::MAX; const CHAIN_SPECIFIC_TO_UNIVERSAL_TOKEN_MAPPING: &[u8] = b"chainSpecificToUniversalMapping"; #[multiversx_sc::contract] pub trait MultiTransferEsdt: - tx_batch_module::TxBatchModule + max_bridged_amount_module::MaxBridgedAmountModule + tx_batch_module::TxBatchModule + + max_bridged_amount_module::MaxBridgedAmountModule + + storage_module::CommonStorageModule { #[init] fn init(&self) { @@ -54,7 +52,7 @@ pub trait MultiTransferEsdt: let own_sc_address = self.blockchain().get_sc_address(); let sc_shard = self.blockchain().get_shard_of_address(&own_sc_address); - let safe_address = self.esdt_safe_contract_address().get(); + let safe_address = self.get_esdt_safe_address(); for eth_tx in transfers { let is_success: bool = self @@ -137,7 +135,7 @@ pub trait MultiTransferEsdt: } } - let esdt_safe_addr = self.esdt_safe_contract_address().get(); + let esdt_safe_addr = self.get_esdt_safe_address(); self.tx() .to(esdt_safe_addr) .typed(esdt_safe_proxy::EsdtSafeProxy) @@ -149,38 +147,6 @@ pub trait MultiTransferEsdt: } } - #[only_owner] - #[endpoint(setWrappingContractAddress)] - fn set_wrapping_contract_address(&self, opt_new_address: OptionalValue) { - match opt_new_address { - OptionalValue::Some(sc_addr) => { - require!( - self.blockchain().is_smart_contract(&sc_addr), - "Invalid unwrapping contract address" - ); - - self.wrapping_contract_address().set(&sc_addr); - } - OptionalValue::None => self.wrapping_contract_address().clear(), - } - } - - #[only_owner] - #[endpoint(setBridgeProxyContractAddress)] - fn set_bridge_proxy_contract_address(&self, opt_new_address: OptionalValue) { - match opt_new_address { - OptionalValue::Some(sc_addr) => { - require!( - self.blockchain().is_smart_contract(&sc_addr), - "Invalid bridge proxy contract address" - ); - - self.bridge_proxy_contract_address().set(&sc_addr); - } - OptionalValue::None => self.bridge_proxy_contract_address().clear(), - } - } - #[only_owner] #[endpoint(addUnprocessedRefundTxToBatch)] fn add_unprocessed_refund_tx_to_batch(&self, tx_id: u64) { @@ -192,21 +158,10 @@ pub trait MultiTransferEsdt: self.unprocessed_refund_txs(tx_id).clear(); } - #[only_owner] - #[endpoint(setEsdtSafeContractAddress)] - fn set_esdt_safe_contract_address(&self, opt_new_address: OptionalValue) { - match opt_new_address { - OptionalValue::Some(sc_addr) => { - self.esdt_safe_contract_address().set(&sc_addr); - } - OptionalValue::None => self.esdt_safe_contract_address().clear(), - } - } - // private fn is_refund_valid(&self, token_id: &TokenIdentifier) -> bool { - let esdt_safe_addr = self.esdt_safe_contract_address().get(); + let esdt_safe_addr = self.get_esdt_safe_address(); let own_sc_address = self.blockchain().get_sc_address(); let sc_shard = self.blockchain().get_shard_of_address(&own_sc_address); @@ -224,7 +179,7 @@ pub trait MultiTransferEsdt: TokenIdentifier, ManagedAddress, > = SingleValueMapper::<_, _, ManagedAddress>::new_from_address( - self.wrapping_contract_address().get(), + self.get_bridged_tokens_wrapper_address(), storage_key, ); if chain_specific_to_universal_token_mapper.is_empty() { @@ -270,11 +225,11 @@ pub trait MultiTransferEsdt: } fn wrap_tokens(&self, payments: PaymentsVec) -> PaymentsVec { - if self.wrapping_contract_address().is_empty() { + if self.get_bridged_tokens_wrapper_address().is_zero() { return payments; } - let bridged_tokens_wrapper_addr = self.wrapping_contract_address().get(); + let bridged_tokens_wrapper_addr = self.get_bridged_tokens_wrapper_address(); self.tx() .to(bridged_tokens_wrapper_addr) .typed(bridged_tokens_wrapper_proxy::BridgedTokensWrapperProxy) @@ -290,7 +245,7 @@ pub trait MultiTransferEsdt: payments: PaymentsVec, batch_id: u64, ) { - let bridge_proxy_addr = self.bridge_proxy_contract_address().get(); + let bridge_proxy_addr = self.get_bridge_proxy_address(); for (eth_tx, p) in transfers.iter().zip(payments.iter()) { if self.blockchain().is_smart_contract(ð_tx.to) { self.tx() @@ -309,17 +264,6 @@ pub trait MultiTransferEsdt: } // storage - #[view(getWrappingContractAddress)] - #[storage_mapper("wrappingContractAddress")] - fn wrapping_contract_address(&self) -> SingleValueMapper; - - #[view(getBridgeProxyContractAddress)] - #[storage_mapper("bridgeProxyContractAddress")] - fn bridge_proxy_contract_address(&self) -> SingleValueMapper; - - #[view(getEsdtSafeContractAddress)] - #[storage_mapper("esdtSafeContractAddress")] - fn esdt_safe_contract_address(&self) -> SingleValueMapper; #[storage_mapper("unprocessedRefundTxs")] fn unprocessed_refund_txs(&self, tx_id: u64) -> SingleValueMapper>; diff --git a/multi-transfer-esdt/src/multi_transfer_proxy.rs b/multi-transfer-esdt/src/multi_transfer_proxy.rs deleted file mode 100644 index 914e46aa..00000000 --- a/multi-transfer-esdt/src/multi_transfer_proxy.rs +++ /dev/null @@ -1,291 +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 MultiTransferEsdtProxy; - -impl TxProxyTrait for MultiTransferEsdtProxy -where - Env: TxEnv, - From: TxFrom, - To: TxTo, - Gas: TxGas, -{ - type TxProxyMethods = MultiTransferEsdtProxyMethods; - - fn proxy_methods(self, tx: Tx) -> Self::TxProxyMethods { - MultiTransferEsdtProxyMethods { wrapped_tx: tx } - } -} - -pub struct MultiTransferEsdtProxyMethods -where - Env: TxEnv, - From: TxFrom, - To: TxTo, - Gas: TxGas, -{ - wrapped_tx: Tx, -} - -#[rustfmt::skip] -impl MultiTransferEsdtProxyMethods -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 MultiTransferEsdtProxyMethods -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 MultiTransferEsdtProxyMethods -where - Env: TxEnv, - Env::Api: VMApi, - From: TxFrom, - To: TxTo, - Gas: TxGas, -{ - pub fn batch_transfer_esdt_token< - Arg0: ProxyArg, - Arg1: ProxyArg>>, - >( - self, - batch_id: Arg0, - transfers: Arg1, - ) -> TxTypedCall { - self.wrapped_tx - .payment(NotPayable) - .raw_call("batchTransferEsdtToken") - .argument(&batch_id) - .argument(&transfers) - .original_result() - } - - pub fn move_refund_batch_to_safe( - self, - ) -> TxTypedCall { - self.wrapped_tx - .payment(NotPayable) - .raw_call("moveRefundBatchToSafe") - .original_result() - } - - pub fn set_wrapping_contract_address< - Arg0: ProxyArg>>, - >( - self, - opt_new_address: Arg0, - ) -> TxTypedCall { - self.wrapped_tx - .payment(NotPayable) - .raw_call("setWrappingContractAddress") - .argument(&opt_new_address) - .original_result() - } - - pub fn set_bridge_proxy_contract_address< - Arg0: ProxyArg>>, - >( - self, - opt_new_address: Arg0, - ) -> TxTypedCall { - self.wrapped_tx - .payment(NotPayable) - .raw_call("setBridgeProxyContractAddress") - .argument(&opt_new_address) - .original_result() - } - - pub fn set_esdt_safe_contract_address< - Arg0: ProxyArg>>, - >( - self, - opt_new_address: Arg0, - ) -> TxTypedCall { - self.wrapped_tx - .payment(NotPayable) - .raw_call("setEsdtSafeContractAddress") - .argument(&opt_new_address) - .original_result() - } - - pub fn wrapping_contract_address( - self, - ) -> TxTypedCall> { - self.wrapped_tx - .payment(NotPayable) - .raw_call("getWrappingContractAddress") - .original_result() - } - - pub fn bridge_proxy_contract_address( - self, - ) -> TxTypedCall> { - self.wrapped_tx - .payment(NotPayable) - .raw_call("getBridgeProxyContractAddress") - .original_result() - } - - pub fn esdt_safe_contract_address( - self, - ) -> TxTypedCall> { - self.wrapped_tx - .payment(NotPayable) - .raw_call("getEsdtSafeContractAddress") - .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, ManagedBuffer, TokenIdentifier, BigUint>>>>> { - self.wrapped_tx - .payment(NotPayable) - .raw_call("getCurrentTxBatch") - .original_result() - } - - pub fn get_first_batch_any_status( - self, - ) -> TxTypedCall, ManagedBuffer, TokenIdentifier, BigUint>>>>> { - self.wrapped_tx - .payment(NotPayable) - .raw_call("getFirstBatchAnyStatus") - .original_result() - } - - pub fn get_batch< - Arg0: ProxyArg, - >( - self, - batch_id: Arg0, - ) -> TxTypedCall, ManagedBuffer, TokenIdentifier, BigUint>>>>> { - 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() - } -} diff --git a/multi-transfer-esdt/tests/multi_transfer_blackbox_test.rs b/multi-transfer-esdt/tests/multi_transfer_blackbox_test.rs index 804e150c..a1fb4d3c 100644 --- a/multi-transfer-esdt/tests/multi_transfer_blackbox_test.rs +++ b/multi-transfer-esdt/tests/multi_transfer_blackbox_test.rs @@ -1,16 +1,7 @@ #![allow(unused)] -use bridge_proxy::{ - bridge_proxy_contract_proxy, - config::{self, ProxyTrait as _}, - ProxyTrait as _, -}; -use bridged_tokens_wrapper::ProxyTrait as _; -use esdt_safe::{EsdtSafe, ProxyTrait as _}; -use multi_transfer_esdt::{ - bridged_tokens_wrapper_proxy, esdt_safe_proxy, multi_transfer_proxy, ProxyTrait as _, -}; - +use esdt_safe_proxy::EsdtSafeProxyMethods; +use multi_transfer_esdt::*; use multiversx_sc::{ api::{HandleConstraints, ManagedTypeApi}, codec::{ @@ -20,59 +11,86 @@ use multiversx_sc::{ contract_base::ManagedSerializer, storage::mappers::SingleValue, types::{ - Address, BigUint, CodeMetadata, EgldOrEsdtTokenIdentifier, EsdtLocalRole, ManagedAddress, - ManagedBuffer, ManagedByteArray, ManagedOption, ManagedVec, MultiValueEncoded, - ReturnsNewManagedAddress, ReturnsResult, TestAddress, TestSCAddress, TestTokenIdentifier, - TokenIdentifier, + Address, BigUint, CodeMetadata, EgldOrEsdtTokenIdentifier, EgldOrMultiEsdtPayment, + EsdtLocalRole, ManagedAddress, ManagedBuffer, ManagedByteArray, ManagedOption, ManagedVec, + MultiValueEncoded, ReturnsNewManagedAddress, ReturnsResult, TestAddress, TestSCAddress, + TestTokenIdentifier, TokenIdentifier, }, }; use multiversx_sc_modules::pause::ProxyTrait; use multiversx_sc_scenario::{ api::{StaticApi, VMHooksApi, VMHooksApiBackend}, - imports::MxscPath, + imports::*, scenario_format::interpret_trait::{InterpretableFrom, InterpreterContext}, scenario_model::*, ContractInfo, DebugApi, ExpectError, ExpectValue, ScenarioTxRun, ScenarioWorld, }; use eth_address::*; +use mock_proxies::mock_multisig_proxy; +use sc_proxies::{ + bridge_proxy_contract_proxy, bridged_tokens_wrapper_proxy, esdt_safe_proxy, + multi_transfer_esdt_proxy, +}; use token_module::ProxyTrait as _; -use transaction::{CallData, EthTransaction}; +use transaction::{transaction_status::TransactionStatus, CallData, EthTransaction, Transaction}; +use tx_batch_module::BatchStatus; const UNIVERSAL_TOKEN_IDENTIFIER: TestTokenIdentifier = TestTokenIdentifier::new("UNIV-abc123"); const BRIDGE_TOKEN_ID: TestTokenIdentifier = TestTokenIdentifier::new("BRIDGE-123456"); const WRAPPED_TOKEN_ID: TestTokenIdentifier = TestTokenIdentifier::new("WRAPPED-123456"); -const TOKEN_ID: TestTokenIdentifier = TestTokenIdentifier::new("TOKEN"); +const TOKEN_TICKER: TestTokenIdentifier = TestTokenIdentifier::new("TOKEN"); +const TOKEN_ID: TestTokenIdentifier = TestTokenIdentifier::new("TOKEN-123456"); +const TOKEN_WITH_BURN_ROLE: TestTokenIdentifier = TestTokenIdentifier::new("TOKEN-WITH"); +const TOKEN_WITHOUT_BURN_ROLE: TestTokenIdentifier = TestTokenIdentifier::new("TOKEN-WITH-OUT"); + +const NON_WHITELISTED_TOKEN: TestTokenIdentifier = + TestTokenIdentifier::new("NON-WHITELISTED-123456"); +const OWNER_ADDRESS_EXPR: &str = "address:owner"; +const ESTD_SAFE_ADDRESS_EXPR: &str = "sc:esdt-safe"; +const ETH_TX_GAS_LIMIT: u64 = 150_000; const USER_ETHEREUM_ADDRESS: &[u8] = b"0x0102030405060708091011121314151617181920"; const GAS_LIMIT: u64 = 100_000_000; -const ERROR: u64 = 4; const MULTI_TRANSFER_CODE_PATH: MxscPath = MxscPath::new("output/multi-transfer-esdt.mxsc.json"); const BRIDGE_PROXY_CODE_PATH: MxscPath = MxscPath::new("../bridge-proxy/output/bridge-proxy.mxsc.json"); +const MOCK_ESDT_SAFE_CODE_PATH: MxscPath = + MxscPath::new("../common/mock-contracts/mock-esdt-safe/output/mock-esdt-safe.mxsc.json"); const ESDT_SAFE_CODE_PATH: MxscPath = MxscPath::new("../esdt-safe/output/esdt-safe.mxsc.json"); const BRIDGED_TOKENS_WRAPPER_CODE_PATH: MxscPath = MxscPath::new("../bridged-tokens-wrapper/output/bridged-tokens-wrapper.mxsc.json"); -const PRICE_AGGREGATOR_CODE_PATH: MxscPath = - MxscPath::new("../price-aggregator/price-aggregator.mxsc.json"); +const MOCK_MULTISIG_CODE_PATH: MxscPath = + MxscPath::new("../common/mock-contracts/mock-multisig/output/mock-multisig.mxsc.json"); +const MOCK_MULTI_TRANSFER_CODE_PATH: MxscPath = MxscPath::new( + "../common/mock-contracts/mock-multi-transfer-esdt/output/mock-multi-transfer-esdt.mxsc.json", +); +const MOCK_PRICE_AGGREGATOR_CODE_PATH: MxscPath = MxscPath::new( + "../common/mock-contracts/mock-price-aggregator/output/mock-price-aggregator.mxsc.json", +); const MULTI_TRANSFER_ADDRESS: TestSCAddress = TestSCAddress::new("multi-transfer"); const BRIDGE_PROXY_ADDRESS: TestSCAddress = TestSCAddress::new("bridge-proxy"); const ESDT_SAFE_ADDRESS: TestSCAddress = TestSCAddress::new("esdt-safe"); const BRIDGED_TOKENS_WRAPPER_ADDRESS: TestSCAddress = TestSCAddress::new("bridged-tokens-wrapper"); const PRICE_AGGREGATOR_ADDRESS: TestSCAddress = TestSCAddress::new("price-aggregator"); +const MULTISIG_ADDRESS: TestSCAddress = TestSCAddress::new("multisig"); const ORACLE_ADDRESS: TestAddress = TestAddress::new("oracle"); const OWNER_ADDRESS: TestAddress = TestAddress::new("owner"); const USER1_ADDRESS: TestAddress = TestAddress::new("user1"); const USER2_ADDRESS: TestAddress = TestAddress::new("user2"); +const RELAYER1_ADDRESS: TestAddress = TestAddress::new("relayer1"); +const RELAYER2_ADDRESS: TestAddress = TestAddress::new("relayer2"); const ESDT_SAFE_ETH_TX_GAS_LIMIT: u64 = 150_000; const MAX_AMOUNT: u64 = 100_000_000_000_000u64; const BALANCE: &str = "2,000,000"; +const ERROR: u64 = 4; +const MINTED_AMOUNT: u64 = 100_000_000_000; fn world() -> ScenarioWorld { let mut blockchain = ScenarioWorld::new(); @@ -84,11 +102,22 @@ fn world() -> ScenarioWorld { blockchain.register_contract(BRIDGE_PROXY_CODE_PATH, bridge_proxy::ContractBuilder); blockchain.register_contract(ESDT_SAFE_CODE_PATH, esdt_safe::ContractBuilder); + blockchain.register_contract(MOCK_ESDT_SAFE_CODE_PATH, esdt_safe::ContractBuilder); blockchain.register_contract( BRIDGED_TOKENS_WRAPPER_CODE_PATH, bridged_tokens_wrapper::ContractBuilder, ); + blockchain.register_contract(MOCK_MULTISIG_CODE_PATH, mock_multisig::ContractBuilder); + blockchain.register_contract( + MOCK_PRICE_AGGREGATOR_CODE_PATH, + mock_price_aggregator::ContractBuilder, + ); + + blockchain.register_contract( + MOCK_MULTI_TRANSFER_CODE_PATH, + mock_multi_transfer_esdt::ContractBuilder, + ); blockchain } @@ -110,8 +139,12 @@ impl MultiTransferTestState { .account(OWNER_ADDRESS) .nonce(1) .esdt_balance(BRIDGE_TOKEN_ID, 1001u64) - .esdt_balance(TOKEN_ID, MAX_AMOUNT) + .esdt_balance(TOKEN_TICKER, MAX_AMOUNT) .esdt_balance(WRAPPED_TOKEN_ID, 1001u64) + .esdt_balance(TOKEN_ID, 1_000_000_000_000u64) + .esdt_balance(NON_WHITELISTED_TOKEN, 1_000_000u64) + .esdt_balance(TOKEN_WITH_BURN_ROLE, 100_000u64) + .esdt_balance(TOKEN_WITHOUT_BURN_ROLE, 150_000u64) .esdt_balance(UNIVERSAL_TOKEN_IDENTIFIER, 1001u64) .account(USER1_ADDRESS) .nonce(1) @@ -122,13 +155,10 @@ impl MultiTransferTestState { "ESDTRoleLocalMint".to_string(), "ESDTRoleLocalBurn".to_string(), ]; + world - .account(ESDT_SAFE_ADDRESS) - .esdt_roles(BRIDGE_TOKEN_ID, roles.clone()) - .esdt_roles(UNIVERSAL_TOKEN_IDENTIFIER, roles.clone()) - .esdt_roles(WRAPPED_TOKEN_ID, roles.clone()) - .code(ESDT_SAFE_CODE_PATH) - .owner(OWNER_ADDRESS); + .account(PRICE_AGGREGATOR_ADDRESS) + .code(MOCK_PRICE_AGGREGATOR_CODE_PATH); Self { world } } @@ -136,8 +166,8 @@ impl MultiTransferTestState { fn multi_transfer_deploy(&mut self) -> &mut Self { self.world .tx() - .from(OWNER_ADDRESS) - .typed(multi_transfer_proxy::MultiTransferEsdtProxy) + .from(MULTISIG_ADDRESS) + .typed(multi_transfer_esdt_proxy::MultiTransferEsdtProxy) .init() .code(MULTI_TRANSFER_CODE_PATH) .new_address(MULTI_TRANSFER_ADDRESS) @@ -145,12 +175,38 @@ impl MultiTransferTestState { self } - fn bridge_proxy_deploy(&mut self) -> &mut Self { + fn multisig_deploy(&mut self) -> &mut Self { + let mut board: MultiValueEncoded> = + MultiValueEncoded::new(); + board.push(ManagedAddress::from(RELAYER1_ADDRESS.eval_to_array())); + board.push(ManagedAddress::from(RELAYER2_ADDRESS.eval_to_array())); self.world .tx() .from(OWNER_ADDRESS) + .typed(mock_multisig_proxy::MockMultisigProxy) + .init( + ESDT_SAFE_ADDRESS, + MULTI_TRANSFER_ADDRESS, + BRIDGE_PROXY_ADDRESS, + BRIDGED_TOKENS_WRAPPER_ADDRESS, + PRICE_AGGREGATOR_ADDRESS, + 1_000u64, + 500u64, + 2usize, + board, + ) + .code(MOCK_MULTISIG_CODE_PATH) + .new_address(MULTISIG_ADDRESS) + .run(); + self + } + + fn bridge_proxy_deploy(&mut self) -> &mut Self { + self.world + .tx() + .from(MULTISIG_ADDRESS) .typed(bridge_proxy_contract_proxy::BridgeProxyContractProxy) - .init(OptionalValue::Some(MULTI_TRANSFER_ADDRESS.to_address())) + .init() .code(BRIDGE_PROXY_CODE_PATH) .new_address(BRIDGE_PROXY_ADDRESS) .run(); @@ -158,19 +214,27 @@ impl MultiTransferTestState { self } - fn safe_deploy(&mut self, price_aggregator_contract_address: Address) -> &mut Self { + fn safe_deploy(&mut self) -> &mut Self { self.world .tx() - .from(OWNER_ADDRESS) - .to(ESDT_SAFE_ADDRESS) + .from(MULTISIG_ADDRESS) .typed(esdt_safe_proxy::EsdtSafeProxy) - .upgrade( - ManagedAddress::zero(), - MULTI_TRANSFER_ADDRESS.to_address(), - BRIDGE_PROXY_ADDRESS.to_address(), - ESDT_SAFE_ETH_TX_GAS_LIMIT, - ) + .init(ETH_TX_GAS_LIMIT) + .code(MOCK_ESDT_SAFE_CODE_PATH) + .new_address(ESDT_SAFE_ADDRESS) + .run(); + + self + } + + fn safe_deploy_real_contract(&mut self) -> &mut Self { + self.world + .tx() + .from(MULTISIG_ADDRESS) + .typed(esdt_safe_proxy::EsdtSafeProxy) + .init(ETH_TX_GAS_LIMIT) .code(ESDT_SAFE_CODE_PATH) + .new_address(ESDT_SAFE_ADDRESS) .run(); self @@ -179,7 +243,7 @@ impl MultiTransferTestState { fn bridged_tokens_wrapper_deploy(&mut self) -> &mut Self { self.world .tx() - .from(OWNER_ADDRESS) + .from(MULTISIG_ADDRESS) .typed(bridged_tokens_wrapper_proxy::BridgedTokensWrapperProxy) .init() .code(BRIDGED_TOKENS_WRAPPER_CODE_PATH) @@ -190,49 +254,48 @@ impl MultiTransferTestState { } fn config_multi_transfer(&mut self) { - self.world - .tx() - .from(OWNER_ADDRESS) - .to(MULTI_TRANSFER_ADDRESS) - .typed(multi_transfer_proxy::MultiTransferEsdtProxy) - .set_wrapping_contract_address(OptionalValue::Some( - BRIDGED_TOKENS_WRAPPER_ADDRESS.to_address(), - )) - .run(); + self.world.set_esdt_balance( + MULTISIG_ADDRESS, + b"BRIDGE-123456", + BigUint::from(100_000_000_000u64), + ); - self.world - .tx() - .from(OWNER_ADDRESS) - .to(MULTI_TRANSFER_ADDRESS) - .typed(multi_transfer_proxy::MultiTransferEsdtProxy) - .set_bridge_proxy_contract_address(OptionalValue::Some( - BRIDGE_PROXY_ADDRESS.to_address(), - )) - .run(); + self.world.set_esdt_balance( + MULTISIG_ADDRESS, + b"WRAPPED-123456", + BigUint::from(100_000_000_000u64), + ); - self.world - .tx() - .from(OWNER_ADDRESS) - .to(MULTI_TRANSFER_ADDRESS) - .typed(multi_transfer_proxy::MultiTransferEsdtProxy) - .set_esdt_safe_contract_address(OptionalValue::Some(ESDT_SAFE_ADDRESS.to_address())) - .run(); + self.world.set_esdt_local_roles( + ESDT_SAFE_ADDRESS, + b"BRIDGE-123456", + &[EsdtLocalRole::Mint, EsdtLocalRole::Burn], + ); - self.world - .tx() - .from(OWNER_ADDRESS) - .to(ESDT_SAFE_ADDRESS) - .typed(esdt_safe_proxy::EsdtSafeProxy) - .set_multi_transfer_contract_address(OptionalValue::Some( - MULTI_TRANSFER_ADDRESS.to_address(), - )) - .run(); + self.world.set_esdt_local_roles( + ESDT_SAFE_ADDRESS, + b"WRAPPED-123456", + &[EsdtLocalRole::Mint, EsdtLocalRole::Burn], + ); - self.world - .tx() - .from(OWNER_ADDRESS) - .to(ESDT_SAFE_ADDRESS) - .typed(esdt_safe_proxy::EsdtSafeProxy) + self.world.set_esdt_balance( + MULTISIG_ADDRESS, + b"TOKEN-123456", + BigUint::from(100_000_000_000u64), + ); + + self.world.set_esdt_balance( + MULTISIG_ADDRESS, + b"TOKEN", + BigUint::from(MAX_AMOUNT + 100000000), + ); + + self.world.set_esdt_local_roles( + ESDT_SAFE_ADDRESS, + b"TOKEN-123456", + &[EsdtLocalRole::Mint, EsdtLocalRole::Burn], + ); + self.esdt_raw_transaction() .add_token_to_whitelist( TokenIdentifier::from_esdt_bytes("BRIDGE-123456"), "BRIDGE", @@ -245,11 +308,7 @@ impl MultiTransferTestState { ) .run(); - self.world - .tx() - .from(OWNER_ADDRESS) - .to(ESDT_SAFE_ADDRESS) - .typed(esdt_safe_proxy::EsdtSafeProxy) + self.esdt_raw_transaction() .add_token_to_whitelist( TokenIdentifier::from_esdt_bytes("TOKEN"), "TOKEN", @@ -269,17 +328,13 @@ impl MultiTransferTestState { self.world .tx() - .from(OWNER_ADDRESS) + .from(MULTISIG_ADDRESS) .to(MULTI_TRANSFER_ADDRESS) - .typed(multi_transfer_proxy::MultiTransferEsdtProxy) - .set_max_bridged_amount(TOKEN_ID, MAX_AMOUNT - 1) + .typed(multi_transfer_esdt_proxy::MultiTransferEsdtProxy) + .set_max_bridged_amount(TOKEN_TICKER, MAX_AMOUNT - 1) .run(); - self.world - .tx() - .from(OWNER_ADDRESS) - .to(ESDT_SAFE_ADDRESS) - .typed(esdt_safe_proxy::EsdtSafeProxy) + self.esdt_raw_transaction() .add_token_to_whitelist( TokenIdentifier::from_esdt_bytes("WRAPPED-123456"), "BRIDGE2", @@ -292,17 +347,11 @@ impl MultiTransferTestState { ) .run(); - self.world - .tx() - .from(OWNER_ADDRESS) - .to(ESDT_SAFE_ADDRESS) - .typed(esdt_safe_proxy::EsdtSafeProxy) - .unpause_endpoint() - .run(); + self.esdt_raw_transaction().unpause_endpoint().run(); self.world .tx() - .from(OWNER_ADDRESS) + .from(MULTISIG_ADDRESS) .to(BRIDGED_TOKENS_WRAPPER_ADDRESS) .typed(bridged_tokens_wrapper_proxy::BridgedTokensWrapperProxy) .unpause_endpoint() @@ -310,7 +359,7 @@ impl MultiTransferTestState { self.world .tx() - .from(OWNER_ADDRESS) + .from(MULTISIG_ADDRESS) .to(BRIDGE_PROXY_ADDRESS) .typed(bridged_tokens_wrapper_proxy::BridgedTokensWrapperProxy) .unpause_endpoint() @@ -318,20 +367,9 @@ impl MultiTransferTestState { } fn config_bridged_tokens_wrapper(&mut self) { - - self.world - .tx() - .from(OWNER_ADDRESS) - .to(ESDT_SAFE_ADDRESS) - .typed(esdt_safe_proxy::EsdtSafeProxy) - .set_bridge_proxy_contract_address(OptionalValue::Some( - BRIDGE_PROXY_ADDRESS.to_address(), - )) - .run(); - self.world .tx() - .from(OWNER_ADDRESS) + .from(MULTISIG_ADDRESS) .to(ESDT_SAFE_ADDRESS) .typed(esdt_safe_proxy::EsdtSafeProxy) .add_token_to_whitelist( @@ -377,7 +415,7 @@ impl MultiTransferTestState { self.world .tx() - .from(OWNER_ADDRESS) + .from(MULTISIG_ADDRESS) .to(ESDT_SAFE_ADDRESS) .typed(esdt_safe_proxy::EsdtSafeProxy) .set_eth_tx_gas_limit(0u64) @@ -385,7 +423,7 @@ impl MultiTransferTestState { self.world .tx() - .from(OWNER_ADDRESS) + .from(MULTISIG_ADDRESS) .to(ESDT_SAFE_ADDRESS) .typed(esdt_safe_proxy::EsdtSafeProxy) .init_supply_mint_burn( @@ -396,7 +434,7 @@ impl MultiTransferTestState { .run(); self.world .tx() - .from(OWNER_ADDRESS) + .from(MULTISIG_ADDRESS) .to(ESDT_SAFE_ADDRESS) .typed(esdt_safe_proxy::EsdtSafeProxy) .add_token_to_whitelist( @@ -412,7 +450,7 @@ impl MultiTransferTestState { .run(); self.world .tx() - .from(OWNER_ADDRESS) + .from(MULTISIG_ADDRESS) .to(ESDT_SAFE_ADDRESS) .typed(esdt_safe_proxy::EsdtSafeProxy) .init_supply_mint_burn( @@ -424,27 +462,7 @@ impl MultiTransferTestState { self.world .tx() - .from(OWNER_ADDRESS) - .to(BRIDGE_PROXY_ADDRESS) - .typed(bridge_proxy_contract_proxy::BridgeProxyContractProxy) - .set_bridged_tokens_wrapper_contract_address(OptionalValue::Some( - BRIDGED_TOKENS_WRAPPER_ADDRESS.to_address(), - )) - .run(); - - self.world - .tx() - .from(OWNER_ADDRESS) - .to(ESDT_SAFE_ADDRESS) - .typed(esdt_safe_proxy::EsdtSafeProxy) - .set_bridged_tokens_wrapper_contract_address(OptionalValue::Some( - BRIDGED_TOKENS_WRAPPER_ADDRESS.to_address(), - )) - .run(); - - self.world - .tx() - .from(OWNER_ADDRESS) + .from(MULTISIG_ADDRESS) .to(BRIDGED_TOKENS_WRAPPER_ADDRESS) .typed(bridged_tokens_wrapper_proxy::BridgedTokensWrapperProxy) .add_wrapped_token(TokenIdentifier::from(UNIVERSAL_TOKEN_IDENTIFIER), 18u32) @@ -452,7 +470,7 @@ impl MultiTransferTestState { self.world .tx() - .from(OWNER_ADDRESS) + .from(MULTISIG_ADDRESS) .to(BRIDGED_TOKENS_WRAPPER_ADDRESS) .typed(bridged_tokens_wrapper_proxy::BridgedTokensWrapperProxy) .whitelist_token( @@ -513,11 +531,207 @@ impl MultiTransferTestState { } fn deploy_contracts(&mut self) { + self.multisig_deploy(); self.multi_transfer_deploy(); self.bridge_proxy_deploy(); - self.safe_deploy(Address::zero()); + self.safe_deploy(); self.bridged_tokens_wrapper_deploy(); } + + fn config_esdtsafe(&mut self) { + self.world.set_esdt_local_roles( + ESDT_SAFE_ADDRESS, + b"TOKEN-123456", + &[EsdtLocalRole::Mint, EsdtLocalRole::Burn], + ); + self.world.set_esdt_balance( + ESDT_SAFE_ADDRESS, + b"TOKEN-123456", + BigUint::from(10_000_000u64), + ); + self.esdt_raw_transaction() + .add_token_to_whitelist( + TOKEN_ID, + "TOKEN", + true, + false, + BigUint::from(0u64), + BigUint::from(0u64), + BigUint::from(0u64), + OptionalValue::Some(BigUint::from(10u64)), + ) + .run(); + self.esdt_raw_transaction() + .add_token_to_whitelist( + TOKEN_WITH_BURN_ROLE, + "TKN", + true, + true, + BigUint::from(0u64), + BigUint::from(0u64), + BigUint::from(0u64), + OptionalValue::Some(BigUint::from(0u64)), + ) + .run(); + self.esdt_raw_transaction() + .add_token_to_whitelist( + TOKEN_WITHOUT_BURN_ROLE, + "TKNW", + false, + true, + BigUint::from(0u64), + BigUint::from(0u64), + BigUint::from(0u64), + OptionalValue::Some(BigUint::from(0u64)), + ) + .run(); + self.world + .tx() + .from(OWNER_ADDRESS) + .to(ESDT_SAFE_ADDRESS) + .typed(esdt_safe_proxy::EsdtSafeProxy) + .init_supply_mint_burn( + TOKEN_ID, + BigUint::from(600_000u64), + BigUint::from(600_000u64), + ) + .run(); + } + fn single_transaction_should_fail( + &mut self, + token_id: TestTokenIdentifier, + amount: u64, + expected_error: &str, + ) { + self.esdt_raw_transaction() + .create_transaction( + EthAddress::zero(), + OptionalValue::None::>, + ) + .egld_or_single_esdt( + &EgldOrEsdtTokenIdentifier::esdt(token_id), + 0, + &BigUint::from(amount), + ) + .returns(ExpectError(ERROR, expected_error)) + .run(); + } + + fn single_transaction_should_work(&mut self, token_id: TestTokenIdentifier, amount: u64) { + self.esdt_raw_transaction() + .create_transaction( + EthAddress::zero(), + OptionalValue::None::>, + ) + .egld_or_single_esdt( + &EgldOrEsdtTokenIdentifier::esdt(token_id), + 0, + &BigUint::from(amount), + ) + .returns(ReturnsResult) + .run(); + } + + fn set_transaction_batch_status_should_fail( + &mut self, + batch_id: u32, + statuses: MultiValueEncoded, + expected_status: u64, + expected_error: &str, + ) { + self.esdt_raw_transaction() + .set_transaction_batch_status(batch_id, statuses) + .returns(ExpectError(expected_status, expected_error)) + .run(); + } + + fn set_transaction_batch_status_should_work( + &mut self, + batch_id: u32, + statuses: MultiValueEncoded, + ) { + self.esdt_raw_transaction() + .set_transaction_batch_status(batch_id, statuses) + .returns(ReturnsResult) + .run(); + } + + fn add_refund_batch_tx_multiple_payment_should_fail( + &mut self, + from_address: TestSCAddress, + to_address: TestSCAddress, + transfers: ManagedVec>, + payment: EgldOrMultiEsdtPayment, + expected_error: &str, + ) { + self.world + .tx() + .from(from_address) + .to(to_address) + .typed(esdt_safe_proxy::EsdtSafeProxy) + .add_refund_batch(transfers) + .egld_or_multi_esdt(payment) + .returns(ExpectError(ERROR, expected_error)) + .run(); + } + + fn add_refund_batch_tx_single_payment_should_fail( + &mut self, + from_address: TestSCAddress, + to_address: TestSCAddress, + transfers: ManagedVec>, + token_id: TestTokenIdentifier, + amount: u64, + expected_error: &str, + ) { + self.world + .tx() + .from(from_address) + .to(to_address) + .typed(esdt_safe_proxy::EsdtSafeProxy) + .add_refund_batch(transfers) + .egld_or_single_esdt( + &EgldOrEsdtTokenIdentifier::esdt(token_id), + 0, + &BigUint::from(amount), + ) + .returns(ExpectError(ERROR, expected_error)) + .run(); + } + + fn esdt_raw_transaction( + &mut self, + ) -> EsdtSafeProxyMethods, TestSCAddress, TestSCAddress, ()> { + self.world + .tx() + .from(MULTISIG_ADDRESS) + .to(ESDT_SAFE_ADDRESS) + .typed(esdt_safe_proxy::EsdtSafeProxy) + } +} + +#[test] +fn test_config() { + let mut state = MultiTransferTestState::new(); + + state.deploy_contracts(); + state.config_multi_transfer(); + state.config_bridged_tokens_wrapper(); +} + +#[test] +fn test_upgrade() { + let mut state = MultiTransferTestState::new(); + state.deploy_contracts(); + state + .world + .tx() + .from(MULTISIG_ADDRESS) + .to(MULTI_TRANSFER_ADDRESS) + .typed(multi_transfer_esdt_proxy::MultiTransferEsdtProxy) + .upgrade() + .code(MULTI_TRANSFER_CODE_PATH) + .run(); } #[test] @@ -552,9 +766,9 @@ fn basic_transfer_test() { state .world .tx() - .from(OWNER_ADDRESS) + .from(MULTISIG_ADDRESS) .to(MULTI_TRANSFER_ADDRESS) - .typed(multi_transfer_proxy::MultiTransferEsdtProxy) + .typed(multi_transfer_esdt_proxy::MultiTransferEsdtProxy) .batch_transfer_esdt_token(1u32, transfers) .run(); @@ -614,9 +828,9 @@ fn batch_transfer_both_executed_test() { state .world .tx() - .from(OWNER_ADDRESS) + .from(MULTISIG_ADDRESS) .to(MULTI_TRANSFER_ADDRESS) - .typed(multi_transfer_proxy::MultiTransferEsdtProxy) + .typed(multi_transfer_esdt_proxy::MultiTransferEsdtProxy) .batch_transfer_esdt_token(1u32, transfers) .run(); @@ -681,9 +895,9 @@ fn batch_two_transfers_same_token_test() { state .world .tx() - .from(OWNER_ADDRESS) + .from(MULTISIG_ADDRESS) .to(MULTI_TRANSFER_ADDRESS) - .typed(multi_transfer_proxy::MultiTransferEsdtProxy) + .typed(multi_transfer_esdt_proxy::MultiTransferEsdtProxy) .batch_transfer_esdt_token(1u32, transfers) .run(); @@ -748,9 +962,9 @@ fn batch_transfer_both_failed_test() { state .world .tx() - .from(OWNER_ADDRESS) + .from(MULTISIG_ADDRESS) .to(MULTI_TRANSFER_ADDRESS) - .typed(multi_transfer_proxy::MultiTransferEsdtProxy) + .typed(multi_transfer_esdt_proxy::MultiTransferEsdtProxy) .batch_transfer_esdt_token(1u32, transfers) .run(); @@ -758,7 +972,7 @@ fn batch_transfer_both_failed_test() { .world .query() .to(MULTI_TRANSFER_ADDRESS) - .typed(multi_transfer_proxy::MultiTransferEsdtProxy) + .typed(multi_transfer_esdt_proxy::MultiTransferEsdtProxy) .get_first_batch_any_status() .returns(ReturnsResult) .run(); @@ -768,9 +982,9 @@ fn batch_transfer_both_failed_test() { state .world .tx() - .from(OWNER_ADDRESS) + .from(MULTISIG_ADDRESS) .to(MULTI_TRANSFER_ADDRESS) - .typed(multi_transfer_proxy::MultiTransferEsdtProxy) + .typed(multi_transfer_esdt_proxy::MultiTransferEsdtProxy) .move_refund_batch_to_safe() .run(); @@ -778,7 +992,7 @@ fn batch_transfer_both_failed_test() { .world .query() .to(MULTI_TRANSFER_ADDRESS) - .typed(multi_transfer_proxy::MultiTransferEsdtProxy) + .typed(multi_transfer_esdt_proxy::MultiTransferEsdtProxy) .get_first_batch_any_status() .returns(ReturnsResult) .run(); @@ -824,7 +1038,7 @@ fn test_unwrap_token_create_transaction_insufficient_liquidity() { state .world .tx() - .from(OWNER_ADDRESS) + .from(MULTISIG_ADDRESS) .to(BRIDGED_TOKENS_WRAPPER_ADDRESS) .typed(bridged_tokens_wrapper_proxy::BridgedTokensWrapperProxy) .unpause_endpoint() @@ -833,7 +1047,7 @@ fn test_unwrap_token_create_transaction_insufficient_liquidity() { state .world .tx() - .from(OWNER_ADDRESS) + .from(MULTISIG_ADDRESS) .to(BRIDGED_TOKENS_WRAPPER_ADDRESS) .typed(bridged_tokens_wrapper_proxy::BridgedTokensWrapperProxy) .deposit_liquidity() @@ -897,7 +1111,7 @@ fn test_unwrap_token_create_transaction_should_work() { BigUint::from(600000u64), BigUint::zero(), ); - + state .world .query() @@ -959,7 +1173,7 @@ fn test_unwrap_token_create_transaction_should_fail() { .typed(bridged_tokens_wrapper_proxy::BridgedTokensWrapperProxy) .unwrap_token_create_transaction(WRAPPED_TOKEN_ID, ESDT_SAFE_ADDRESS.to_address(), EthAddress::zero()) .egld_or_single_esdt( - &EgldOrEsdtTokenIdentifier::esdt(TOKEN_ID), + &EgldOrEsdtTokenIdentifier::esdt(TOKEN_TICKER), 0u64, &BigUint::from(1_000u64), ) @@ -996,19 +1210,20 @@ fn test_unwrap_token_create_transaction_amount_zero() { } #[test] -fn add_refund_batch_test() { - let mut state = MultiTransferTestState::new(); +fn add_refund_batch_test_should_work() { + let mut state: MultiTransferTestState = MultiTransferTestState::new(); + state.multisig_deploy(); state.multi_transfer_deploy(); state.bridge_proxy_deploy(); - state.safe_deploy(Address::zero()); + state.safe_deploy_real_contract(); state.bridged_tokens_wrapper_deploy(); state.config_multi_transfer(); let eth_tx = EthTransaction { from: EthAddress::zero(), to: ManagedAddress::from(USER1_ADDRESS.eval_to_array()), - token_id: TokenIdentifier::from(TOKEN_ID), + token_id: TokenIdentifier::from(TOKEN_TICKER), amount: BigUint::from(MAX_AMOUNT), tx_nonce: 1u64, call_data: ManagedOption::none(), @@ -1023,12 +1238,12 @@ fn add_refund_batch_test() { .query() .to(ESDT_SAFE_ADDRESS) .typed(esdt_safe_proxy::EsdtSafeProxy) - .calculate_required_fee(TOKEN_ID) + .calculate_required_fee(TOKEN_TICKER) .returns(ReturnsResult) .run(); state.check_balances_on_safe( - TOKEN_ID, + TOKEN_TICKER, BigUint::from(MAX_AMOUNT), BigUint::zero(), BigUint::zero(), @@ -1037,26 +1252,65 @@ fn add_refund_batch_test() { state .world .tx() - .from(OWNER_ADDRESS) + .from(MULTISIG_ADDRESS) .to(MULTI_TRANSFER_ADDRESS) - .typed(multi_transfer_proxy::MultiTransferEsdtProxy) + .typed(multi_transfer_esdt_proxy::MultiTransferEsdtProxy) .batch_transfer_esdt_token(1u32, transfers) .run(); - state.check_balances_on_safe(TOKEN_ID, BigUint::zero(), BigUint::zero(), BigUint::zero()); + state.check_balances_on_safe( + TOKEN_TICKER, + BigUint::zero(), + BigUint::zero(), + BigUint::zero(), + ); state .world .tx() - .from(OWNER_ADDRESS) + .from(MULTISIG_ADDRESS) .to(MULTI_TRANSFER_ADDRESS) - .typed(multi_transfer_proxy::MultiTransferEsdtProxy) + .typed(multi_transfer_esdt_proxy::MultiTransferEsdtProxy) .move_refund_batch_to_safe() .run(); state.check_balances_on_safe( - TOKEN_ID, + TOKEN_TICKER, BigUint::from(MAX_AMOUNT) - fee, BigUint::zero(), BigUint::zero(), ); } + +#[test] +fn batch_transfer_esdt_token_to_address_zero() { + let mut state: MultiTransferTestState = MultiTransferTestState::new(); + + state.multisig_deploy(); + state.multi_transfer_deploy(); + state.bridge_proxy_deploy(); + state.safe_deploy_real_contract(); + state.bridged_tokens_wrapper_deploy(); + state.config_multi_transfer(); + + let eth_tx = EthTransaction { + from: EthAddress::zero(), + to: ManagedAddress::zero(), + token_id: TokenIdentifier::from(TOKEN_TICKER), + amount: BigUint::from(MAX_AMOUNT), + tx_nonce: 1u64, + call_data: ManagedOption::none(), + }; + + let mut transfers: MultiValueEncoded> = + MultiValueEncoded::new(); + transfers.push(eth_tx.clone()); + + state + .world + .tx() + .from(MULTISIG_ADDRESS) + .to(MULTI_TRANSFER_ADDRESS) + .typed(multi_transfer_esdt_proxy::MultiTransferEsdtProxy) + .batch_transfer_esdt_token(1u32, transfers) + .run(); +} diff --git a/multi-transfer-esdt/wasm/Cargo.lock b/multi-transfer-esdt/wasm/Cargo.lock index 663a9880..307057d2 100644 --- a/multi-transfer-esdt/wasm/Cargo.lock +++ b/multi-transfer-esdt/wasm/Cargo.lock @@ -4,15 +4,15 @@ 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" -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" @@ -28,8 +28,15 @@ dependencies = [ "crowdfunding-esdt", "esdt-safe", "eth-address", + "mock-bridged-tokens-wrapper", + "mock-esdt-safe", + "mock-multi-transfer-esdt", + "mock-multisig", + "mock-price-aggregator", "multiversx-sc", "multiversx-sc-modules", + "sc-proxies", + "storage-module", "token-module", "transaction", "tx-batch-module", @@ -42,6 +49,8 @@ dependencies = [ "eth-address", "multiversx-sc", "multiversx-sc-modules", + "sc-proxies", + "storage-module", "token-module", "transaction", "tx-batch-module", @@ -68,7 +77,7 @@ checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" [[package]] name = "crowdfunding-esdt" version = "0.0.0" -source = "git+https://github.com/multiversx/mx-contracts-rs?rev=d91bbff#d91bbff295295c2f7e2baf1cd569dd5693ddfb56" +source = "git+https://github.com/multiversx/mx-contracts-rs?rev=e72c201#e72c2017bdc2bffef50d8e9d76fc3a24a81ad00d" dependencies = [ "multiversx-sc", ] @@ -86,9 +95,16 @@ dependencies = [ "eth-address", "fee-estimator-module", "max-bridged-amount-module", + "mock-bridge-proxy", + "mock-bridged-tokens-wrapper", + "mock-multi-transfer-esdt", + "mock-multisig", + "mock-price-aggregator", "multiversx-price-aggregator-sc", "multiversx-sc", "multiversx-sc-modules", + "sc-proxies", + "storage-module", "token-module", "transaction", "tx-batch-module", @@ -106,6 +122,7 @@ name = "fee-estimator-module" version = "0.0.0" dependencies = [ "multiversx-sc", + "storage-module", ] [[package]] @@ -135,18 +152,18 @@ checksum = "6fe2267d4ed49bc07b63801559be28c718ea06c4738b7a03c94df7386d2cde46" [[package]] name = "js-sys" -version = "0.3.69" +version = "0.3.72" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "29c15563dc2726973df627357ce0c9ddddbea194836909d655df6a75d2cf296d" +checksum = "6a88f1bda2bd75b0452a14784937d796722fdebfe50df998aeb3f0b7603019a9" dependencies = [ "wasm-bindgen", ] [[package]] name = "libc" -version = "0.2.155" +version = "0.2.160" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "97b3888a4aecf77e811145cadf6eef5901f4782c53886191b2f693f24761847c" +checksum = "f0b21006cd1874ae9e650973c565615676dc4a274c965bb0a73796dac838ce4f" [[package]] name = "log" @@ -161,6 +178,49 @@ dependencies = [ "multiversx-sc", ] +[[package]] +name = "mock-bridge-proxy" +version = "0.0.0" +dependencies = [ + "multiversx-sc", +] + +[[package]] +name = "mock-bridged-tokens-wrapper" +version = "0.0.0" +dependencies = [ + "eth-address", + "multiversx-sc", +] + +[[package]] +name = "mock-esdt-safe" +version = "0.0.0" +dependencies = [ + "multiversx-sc", +] + +[[package]] +name = "mock-multi-transfer-esdt" +version = "0.0.0" +dependencies = [ + "multiversx-sc", +] + +[[package]] +name = "mock-multisig" +version = "0.0.0" +dependencies = [ + "multiversx-sc", +] + +[[package]] +name = "mock-price-aggregator" +version = "0.0.0" +dependencies = [ + "multiversx-sc", +] + [[package]] name = "multi-transfer-esdt" version = "0.0.0" @@ -170,8 +230,12 @@ dependencies = [ "esdt-safe", "eth-address", "max-bridged-amount-module", + "mock-multisig", + "mock-price-aggregator", "multiversx-sc", "multiversx-sc-modules", + "sc-proxies", + "storage-module", "token-module", "transaction", "tx-batch-module", @@ -187,9 +251,9 @@ dependencies = [ [[package]] name = "multiversx-price-aggregator-sc" -version = "0.52.0" +version = "0.53.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5ea572ebab3a6addd937cad829076b13e320851503fb6adf1ad66f544b2bf100" +checksum = "7317294898d2f57b5181f3310014dec755359925b26d7b992a5f8fc968c7ee0a" dependencies = [ "arrayvec", "getrandom", @@ -200,9 +264,9 @@ dependencies = [ [[package]] name = "multiversx-sc" -version = "0.52.3" +version = "0.53.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "526760b1d6236c011285b264a70a0a9dd3b3dbc53c3b5f76932f4bcfd3a8910c" +checksum = "75ea89a26f0aacda21437a8ae5ccfbefab99d8191942b3d2eddbcbf84f9866d7" dependencies = [ "bitflags", "hex-literal", @@ -214,9 +278,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", @@ -225,9 +289,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", @@ -237,9 +301,9 @@ dependencies = [ [[package]] name = "multiversx-sc-derive" -version = "0.52.3" +version = "0.53.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3557f2f12640a8a07fa6af66cc2a13b188c5b61bed72db22fe631fb3a60c3e96" +checksum = "4c17fdf90fafca2f19085ae67b0502d9f71bf8ab1be3c83808eb88e02a8c18b9" dependencies = [ "hex", "proc-macro2", @@ -250,18 +314,18 @@ dependencies = [ [[package]] name = "multiversx-sc-modules" -version = "0.52.3" +version = "0.53.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "61f5c29c6044f3dc9e866858feee625d7fae5604a68ac7bd66dec683eee97563" +checksum = "daeb48acbd39255868a3241798df2f85050f0ae8d82d6417bd2cd0e30a241855" dependencies = [ "multiversx-sc", ] [[package]] name = "multiversx-sc-wasm-adapter" -version = "0.52.3" +version = "0.53.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ed13aaca9cbdbc6911174cd3029e750a7563d85dd3daaa1107b1fd31c7f17245" +checksum = "20659915a4377d375c46d7f237e810053a03f7e084fad6362dd5748a7233defb" dependencies = [ "multiversx-sc", ] @@ -286,9 +350,9 @@ dependencies = [ [[package]] name = "once_cell" -version = "1.19.0" +version = "1.20.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3fdb12b2476b595f9358c5161aa467c2438859caa136dec86c26fdd2efe17b92" +checksum = "1261fe7e33c73b354eab43b1273a57c8f967d0391e80353e51f764ac02cf6775" [[package]] name = "ppv-lite86" @@ -310,9 +374,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", ] @@ -357,17 +421,35 @@ dependencies = [ "getrandom", ] +[[package]] +name = "sc-proxies" +version = "0.0.0" +dependencies = [ + "eth-address", + "multiversx-sc", + "token-module", + "transaction", + "tx-batch-module", +] + [[package]] name = "smallvec" version = "1.13.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3c5e1a9a646d36c3599cd173a41282daf47c44583ad367b8e6837255952e5c67" +[[package]] +name = "storage-module" +version = "0.1.0" +dependencies = [ + "multiversx-sc", +] + [[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", @@ -380,6 +462,7 @@ version = "0.0.0" dependencies = [ "fee-estimator-module", "multiversx-sc", + "storage-module", ] [[package]] @@ -400,9 +483,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" @@ -418,19 +501,20 @@ checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" [[package]] name = "wasm-bindgen" -version = "0.2.92" +version = "0.2.95" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4be2531df63900aeb2bca0daaaddec08491ee64ceecbee5076636a3b026795a8" +checksum = "128d1e363af62632b8eb57219c8fd7877144af57558fb2ef0368d0087bddeb2e" dependencies = [ "cfg-if", + "once_cell", "wasm-bindgen-macro", ] [[package]] name = "wasm-bindgen-backend" -version = "0.2.92" +version = "0.2.95" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "614d787b966d3989fa7bb98a654e369c762374fd3213d212cfc0251257e747da" +checksum = "cb6dd4d3ca0ddffd1dd1c9c04f94b868c37ff5fac97c30b97cff2d74fce3a358" dependencies = [ "bumpalo", "log", @@ -443,9 +527,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro" -version = "0.2.92" +version = "0.2.95" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a1f8823de937b71b9460c0c34e25f3da88250760bec0ebac694b49997550d726" +checksum = "e79384be7f8f5a9dd5d7167216f022090cf1f9ec128e6e6a482a2cb5c5422c56" dependencies = [ "quote", "wasm-bindgen-macro-support", @@ -453,9 +537,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro-support" -version = "0.2.92" +version = "0.2.95" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e94f17b526d0a461a191c78ea52bbce64071ed5c04c9ffe424dcb38f74171bb7" +checksum = "26c6ab57572f7a24a4985830b120de1594465e5d500f24afe89e16b4e833ef68" dependencies = [ "proc-macro2", "quote", @@ -466,9 +550,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-shared" -version = "0.2.92" +version = "0.2.95" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "af190c94f2773fdb3729c55b007a722abb5384da03bc0986df4c289bf5567e96" +checksum = "65fc09f10666a9f147042251e0dda9c18f166ff7de300607007e96bdebc1068d" [[package]] name = "zerocopy" diff --git a/multi-transfer-esdt/wasm/Cargo.toml b/multi-transfer-esdt/wasm/Cargo.toml index 78436b15..4670b71b 100644 --- a/multi-transfer-esdt/wasm/Cargo.toml +++ b/multi-transfer-esdt/wasm/Cargo.toml @@ -28,7 +28,7 @@ panic = "abort" path = ".." [dependencies.multiversx-sc-wasm-adapter] -version = "=0.52.3" +version = "=0.53.2" [workspace] members = ["."] diff --git a/multi-transfer-esdt/wasm/src/lib.rs b/multi-transfer-esdt/wasm/src/lib.rs index 13c00129..9c76cd1f 100644 --- a/multi-transfer-esdt/wasm/src/lib.rs +++ b/multi-transfer-esdt/wasm/src/lib.rs @@ -6,9 +6,9 @@ // Init: 1 // Upgrade: 1 -// Endpoints: 19 +// Endpoints: 13 // Async Callback (empty): 1 -// Total number of exported functions: 22 +// Total number of exported functions: 16 #![no_std] @@ -22,13 +22,7 @@ multiversx_sc_wasm_adapter::endpoints! { upgrade => upgrade batchTransferEsdtToken => batch_transfer_esdt_token moveRefundBatchToSafe => move_refund_batch_to_safe - setWrappingContractAddress => set_wrapping_contract_address - setBridgeProxyContractAddress => set_bridge_proxy_contract_address addUnprocessedRefundTxToBatch => add_unprocessed_refund_tx_to_batch - setEsdtSafeContractAddress => set_esdt_safe_contract_address - getWrappingContractAddress => wrapping_contract_address - getBridgeProxyContractAddress => bridge_proxy_contract_address - getEsdtSafeContractAddress => esdt_safe_contract_address setMaxTxBatchSize => set_max_tx_batch_size setMaxTxBatchBlockDuration => set_max_tx_batch_block_duration getCurrentTxBatch => get_current_tx_batch diff --git a/multisig/Cargo.toml b/multisig/Cargo.toml index c24b49eb..18413c6c 100644 --- a/multisig/Cargo.toml +++ b/multisig/Cargo.toml @@ -26,6 +26,9 @@ path = "../common/tx-batch-module" [dependencies.max-bridged-amount-module] path = "../common/max-bridged-amount-module" +[dependencies.sc-proxies] +path = "../common/sc-proxies" + [dependencies.esdt-safe] path = "../esdt-safe" @@ -39,13 +42,13 @@ path = "../bridged-tokens-wrapper" path = "../bridge-proxy" [dependencies.multiversx-sc] -version = "=0.52.3" +version = "=0.53.2" [dependencies.multiversx-price-aggregator-sc] -version = "=0.52.0" +version = "=0.53.2" [dependencies.multiversx-sc-modules] -version = "=0.52.3" +version = "=0.53.2" [dev-dependencies.multiversx-sc-scenario] -version = "=0.52.3" +version = "=0.53.2" diff --git a/multisig/meta/Cargo.toml b/multisig/meta/Cargo.toml index 983daa8d..18afcab0 100644 --- a/multisig/meta/Cargo.toml +++ b/multisig/meta/Cargo.toml @@ -9,5 +9,5 @@ publish = false path = ".." [dependencies.multiversx-sc-meta-lib] -version = "=0.52.3" +version = "=0.53.2" default-features = false diff --git a/multisig/sc-config.toml b/multisig/sc-config.toml index f357ac11..16ccf841 100644 --- a/multisig/sc-config.toml +++ b/multisig/sc-config.toml @@ -1,4 +1,4 @@ [settings] [[proxy]] -path = "../multisig/src/multisig_proxy.rs" +path = "../common/sc-proxies/src/multisig_proxy.rs" \ No newline at end of file diff --git a/multisig/scenarios/change_token_config.scen.json b/multisig/scenarios/change_token_config.scen.json index 75610ded..ae9d588e 100644 --- a/multisig/scenarios/change_token_config.scen.json +++ b/multisig/scenarios/change_token_config.scen.json @@ -5,44 +5,6 @@ "step": "externalSteps", "path": "setup.scen.json" }, - { - "step": "scCall", - "txId": "change-fee-estimator-sc-address", - "tx": { - "from": "address:owner", - "to": "sc:multisig", - "value": "0", - "function": "changeFeeEstimatorContractAddress", - "arguments": [ - "sc:egld_esdt_swap" - ], - "gasLimit": "55,000,000", - "gasPrice": "0" - }, - "expect": { - "status": "0", - "message": "", - "out": [], - "gas": "*", - "refund": "*" - } - }, - { - "step": "checkState", - "accounts": { - "sc:esdt_safe": { - "nonce": "0", - "balance": "0", - "esdt": "*", - "storage": { - "str:feeEstimatorContractAddress": "sc:egld_esdt_swap", - "+": "" - }, - "code": "*" - }, - "+": {} - } - }, { "step": "scCall", "txId": "change-default-price-per-gas-unit", @@ -246,4 +208,4 @@ } } ] -} +} \ No newline at end of file diff --git a/multisig/scenarios/ethereum_to_multiversx_relayer_call_data_several_tx_test.scen.json b/multisig/scenarios/ethereum_to_multiversx_relayer_call_data_several_tx_test.scen.json index fbb56f5e..1808087b 100644 --- a/multisig/scenarios/ethereum_to_multiversx_relayer_call_data_several_tx_test.scen.json +++ b/multisig/scenarios/ethereum_to_multiversx_relayer_call_data_several_tx_test.scen.json @@ -20,6 +20,8 @@ "0x00000000000000000500657364742d736166655f5f5f5f5f5f5f5f5f5f5f5f5f", "0x000000000000000005006d756c74692d7472616e736665725f5f5f5f5f5f5f5f", "0x000000000000000005006272696467652d70726f78795f5f5f5f5f5f5f5f5f5f", + "0x00000000000000000500627269646765642d746f6b656e732d77726170706572", + "0x0000000000000000050070726963652d61676772656761746f725f5f5f5f5f5f", "0x03e8", "0x01f4", "0x02", @@ -34,16 +36,22 @@ } }, { - "step": "scCall", + "step": "setState", + "newAddresses": [ + { + "creatorAddress": "sc:multisig", + "creatorNonce": "0", + "newAddress": "sc:esdt-safe" + } + ] + }, + { + "step": "scDeploy", "id": "", "tx": { - "from": "address:owner", - "to": "sc:esdt-safe", - "function": "upgrade", + "from": "sc:multisig", + "contractCode": "mxsc:../esdt-safe/output/esdt-safe.mxsc.json", "arguments": [ - "0x0000000000000000000000000000000000000000000000000000000000000000", - "0x000000000000000005006d756c74692d7472616e736665725f5f5f5f5f5f5f5f", - "0x000000000000000005006272696467652d70726f78795f5f5f5f5f5f5f5f5f5f", "0x0249f0" ], "gasLimit": "5,000,000" @@ -58,7 +66,7 @@ "newAddresses": [ { "creatorAddress": "sc:multisig", - "creatorNonce": "0", + "creatorNonce": "1", "newAddress": "sc:multi-transfer" } ] @@ -81,8 +89,8 @@ "step": "setState", "newAddresses": [ { - "creatorAddress": "address:owner", - "creatorNonce": "3", + "creatorAddress": "sc:multisig", + "creatorNonce": "2", "newAddress": "sc:bridge-proxy" } ] @@ -91,11 +99,9 @@ "step": "scDeploy", "id": "", "tx": { - "from": "address:owner", + "from": "sc:multisig", "contractCode": "mxsc:../bridge-proxy/output/bridge-proxy.mxsc.json", - "arguments": [ - "0x000000000000000005006d756c74692d7472616e736665725f5f5f5f5f5f5f5f" - ], + "arguments": [], "gasLimit": "5,000,000" }, "expect": { @@ -107,8 +113,8 @@ "step": "setState", "newAddresses": [ { - "creatorAddress": "address:owner", - "creatorNonce": "4", + "creatorAddress": "sc:multisig", + "creatorNonce": "3", "newAddress": "sc:bridged-tokens-wrapper" } ] @@ -117,7 +123,7 @@ "step": "scDeploy", "id": "", "tx": { - "from": "address:owner", + "from": "sc:multisig", "contractCode": "mxsc:../bridged-tokens-wrapper/output/bridged-tokens-wrapper.mxsc.json", "arguments": [], "gasLimit": "5,000,000" @@ -132,74 +138,6 @@ "id": "", "tx": { "from": "sc:multisig", - "to": "sc:multi-transfer", - "function": "setWrappingContractAddress", - "arguments": [ - "0x00000000000000000500627269646765642d746f6b656e732d77726170706572" - ], - "gasLimit": "5,000,000" - }, - "expect": { - "out": [], - "status": "0" - } - }, - { - "step": "scCall", - "id": "", - "tx": { - "from": "sc:multisig", - "to": "sc:multi-transfer", - "function": "setBridgeProxyContractAddress", - "arguments": [ - "0x000000000000000005006272696467652d70726f78795f5f5f5f5f5f5f5f5f5f" - ], - "gasLimit": "5,000,000" - }, - "expect": { - "out": [], - "status": "0" - } - }, - { - "step": "scCall", - "id": "", - "tx": { - "from": "sc:multisig", - "to": "sc:multi-transfer", - "function": "setEsdtSafeContractAddress", - "arguments": [ - "0x00000000000000000500657364742d736166655f5f5f5f5f5f5f5f5f5f5f5f5f" - ], - "gasLimit": "5,000,000" - }, - "expect": { - "out": [], - "status": "0" - } - }, - { - "step": "scCall", - "id": "", - "tx": { - "from": "address:owner", - "to": "sc:esdt-safe", - "function": "setMultiTransferContractAddress", - "arguments": [ - "0x000000000000000005006d756c74692d7472616e736665725f5f5f5f5f5f5f5f" - ], - "gasLimit": "5,000,000" - }, - "expect": { - "out": [], - "status": "0" - } - }, - { - "step": "scCall", - "id": "", - "tx": { - "from": "address:owner", "to": "sc:esdt-safe", "function": "addTokenToWhitelist", "arguments": [ @@ -223,7 +161,7 @@ "step": "scCall", "id": "", "tx": { - "from": "address:owner", + "from": "sc:multisig", "to": "sc:esdt-safe", "function": "addTokenToWhitelist", "arguments": [ @@ -262,7 +200,7 @@ "step": "scCall", "id": "", "tx": { - "from": "address:owner", + "from": "sc:multisig", "to": "sc:bridged-tokens-wrapper", "function": "unpause", "arguments": [], @@ -277,7 +215,7 @@ "step": "scCall", "id": "", "tx": { - "from": "address:owner", + "from": "sc:multisig", "to": "sc:bridge-proxy", "function": "unpause", "arguments": [], @@ -292,7 +230,7 @@ "step": "scCall", "id": "", "tx": { - "from": "address:owner", + "from": "sc:multisig", "to": "sc:esdt-safe", "function": "unpause", "arguments": [], diff --git a/multisig/scenarios/ethereum_to_multiversx_relayer_query2_test.scen.json b/multisig/scenarios/ethereum_to_multiversx_relayer_query2_test.scen.json index 78291d1c..b242dfb2 100644 --- a/multisig/scenarios/ethereum_to_multiversx_relayer_query2_test.scen.json +++ b/multisig/scenarios/ethereum_to_multiversx_relayer_query2_test.scen.json @@ -20,6 +20,8 @@ "0x00000000000000000500657364742d736166655f5f5f5f5f5f5f5f5f5f5f5f5f", "0x000000000000000005006d756c74692d7472616e736665725f5f5f5f5f5f5f5f", "0x000000000000000005006272696467652d70726f78795f5f5f5f5f5f5f5f5f5f", + "0x00000000000000000500627269646765642d746f6b656e732d77726170706572", + "0x0000000000000000050070726963652d61676772656761746f725f5f5f5f5f5f", "0x03e8", "0x01f4", "0x02", @@ -34,16 +36,22 @@ } }, { - "step": "scCall", + "step": "setState", + "newAddresses": [ + { + "creatorAddress": "sc:multisig", + "creatorNonce": "0", + "newAddress": "sc:esdt-safe" + } + ] + }, + { + "step": "scDeploy", "id": "", "tx": { - "from": "address:owner", - "to": "sc:esdt-safe", - "function": "upgrade", + "from": "sc:multisig", + "contractCode": "mxsc:../esdt-safe/output/esdt-safe.mxsc.json", "arguments": [ - "0x0000000000000000000000000000000000000000000000000000000000000000", - "0x000000000000000005006d756c74692d7472616e736665725f5f5f5f5f5f5f5f", - "0x000000000000000005006272696467652d70726f78795f5f5f5f5f5f5f5f5f5f", "0x0249f0" ], "gasLimit": "5,000,000" @@ -58,7 +66,7 @@ "newAddresses": [ { "creatorAddress": "sc:multisig", - "creatorNonce": "0", + "creatorNonce": "1", "newAddress": "sc:multi-transfer" } ] @@ -81,8 +89,8 @@ "step": "setState", "newAddresses": [ { - "creatorAddress": "address:owner", - "creatorNonce": "3", + "creatorAddress": "sc:multisig", + "creatorNonce": "2", "newAddress": "sc:bridge-proxy" } ] @@ -91,11 +99,9 @@ "step": "scDeploy", "id": "", "tx": { - "from": "address:owner", + "from": "sc:multisig", "contractCode": "mxsc:../bridge-proxy/output/bridge-proxy.mxsc.json", - "arguments": [ - "0x000000000000000005006d756c74692d7472616e736665725f5f5f5f5f5f5f5f" - ], + "arguments": [], "gasLimit": "5,000,000" }, "expect": { @@ -107,8 +113,8 @@ "step": "setState", "newAddresses": [ { - "creatorAddress": "address:owner", - "creatorNonce": "4", + "creatorAddress": "sc:multisig", + "creatorNonce": "3", "newAddress": "sc:bridged-tokens-wrapper" } ] @@ -117,7 +123,7 @@ "step": "scDeploy", "id": "", "tx": { - "from": "address:owner", + "from": "sc:multisig", "contractCode": "mxsc:../bridged-tokens-wrapper/output/bridged-tokens-wrapper.mxsc.json", "arguments": [], "gasLimit": "5,000,000" @@ -132,74 +138,6 @@ "id": "", "tx": { "from": "sc:multisig", - "to": "sc:multi-transfer", - "function": "setWrappingContractAddress", - "arguments": [ - "0x00000000000000000500627269646765642d746f6b656e732d77726170706572" - ], - "gasLimit": "5,000,000" - }, - "expect": { - "out": [], - "status": "0" - } - }, - { - "step": "scCall", - "id": "", - "tx": { - "from": "sc:multisig", - "to": "sc:multi-transfer", - "function": "setBridgeProxyContractAddress", - "arguments": [ - "0x000000000000000005006272696467652d70726f78795f5f5f5f5f5f5f5f5f5f" - ], - "gasLimit": "5,000,000" - }, - "expect": { - "out": [], - "status": "0" - } - }, - { - "step": "scCall", - "id": "", - "tx": { - "from": "sc:multisig", - "to": "sc:multi-transfer", - "function": "setEsdtSafeContractAddress", - "arguments": [ - "0x00000000000000000500657364742d736166655f5f5f5f5f5f5f5f5f5f5f5f5f" - ], - "gasLimit": "5,000,000" - }, - "expect": { - "out": [], - "status": "0" - } - }, - { - "step": "scCall", - "id": "", - "tx": { - "from": "address:owner", - "to": "sc:esdt-safe", - "function": "setMultiTransferContractAddress", - "arguments": [ - "0x000000000000000005006d756c74692d7472616e736665725f5f5f5f5f5f5f5f" - ], - "gasLimit": "5,000,000" - }, - "expect": { - "out": [], - "status": "0" - } - }, - { - "step": "scCall", - "id": "", - "tx": { - "from": "address:owner", "to": "sc:esdt-safe", "function": "addTokenToWhitelist", "arguments": [ @@ -223,7 +161,7 @@ "step": "scCall", "id": "", "tx": { - "from": "address:owner", + "from": "sc:multisig", "to": "sc:esdt-safe", "function": "addTokenToWhitelist", "arguments": [ @@ -262,7 +200,7 @@ "step": "scCall", "id": "", "tx": { - "from": "address:owner", + "from": "sc:multisig", "to": "sc:bridged-tokens-wrapper", "function": "unpause", "arguments": [], @@ -277,7 +215,7 @@ "step": "scCall", "id": "", "tx": { - "from": "address:owner", + "from": "sc:multisig", "to": "sc:bridge-proxy", "function": "unpause", "arguments": [], @@ -292,7 +230,7 @@ "step": "scCall", "id": "", "tx": { - "from": "address:owner", + "from": "sc:multisig", "to": "sc:esdt-safe", "function": "unpause", "arguments": [], diff --git a/multisig/scenarios/ethereum_to_multiversx_relayer_query_test.scen.json b/multisig/scenarios/ethereum_to_multiversx_relayer_query_test.scen.json index b00b780f..5d68ad84 100644 --- a/multisig/scenarios/ethereum_to_multiversx_relayer_query_test.scen.json +++ b/multisig/scenarios/ethereum_to_multiversx_relayer_query_test.scen.json @@ -20,6 +20,8 @@ "0x00000000000000000500657364742d736166655f5f5f5f5f5f5f5f5f5f5f5f5f", "0x000000000000000005006d756c74692d7472616e736665725f5f5f5f5f5f5f5f", "0x000000000000000005006272696467652d70726f78795f5f5f5f5f5f5f5f5f5f", + "0x00000000000000000500627269646765642d746f6b656e732d77726170706572", + "0x0000000000000000050070726963652d61676772656761746f725f5f5f5f5f5f", "0x03e8", "0x01f4", "0x02", @@ -34,16 +36,22 @@ } }, { - "step": "scCall", + "step": "setState", + "newAddresses": [ + { + "creatorAddress": "sc:multisig", + "creatorNonce": "0", + "newAddress": "sc:esdt-safe" + } + ] + }, + { + "step": "scDeploy", "id": "", "tx": { - "from": "address:owner", - "to": "sc:esdt-safe", - "function": "upgrade", + "from": "sc:multisig", + "contractCode": "mxsc:../esdt-safe/output/esdt-safe.mxsc.json", "arguments": [ - "0x0000000000000000000000000000000000000000000000000000000000000000", - "0x000000000000000005006d756c74692d7472616e736665725f5f5f5f5f5f5f5f", - "0x000000000000000005006272696467652d70726f78795f5f5f5f5f5f5f5f5f5f", "0x0249f0" ], "gasLimit": "5,000,000" @@ -58,7 +66,7 @@ "newAddresses": [ { "creatorAddress": "sc:multisig", - "creatorNonce": "0", + "creatorNonce": "1", "newAddress": "sc:multi-transfer" } ] @@ -81,8 +89,8 @@ "step": "setState", "newAddresses": [ { - "creatorAddress": "address:owner", - "creatorNonce": "3", + "creatorAddress": "sc:multisig", + "creatorNonce": "2", "newAddress": "sc:bridge-proxy" } ] @@ -91,11 +99,9 @@ "step": "scDeploy", "id": "", "tx": { - "from": "address:owner", + "from": "sc:multisig", "contractCode": "mxsc:../bridge-proxy/output/bridge-proxy.mxsc.json", - "arguments": [ - "0x000000000000000005006d756c74692d7472616e736665725f5f5f5f5f5f5f5f" - ], + "arguments": [], "gasLimit": "5,000,000" }, "expect": { @@ -107,8 +113,8 @@ "step": "setState", "newAddresses": [ { - "creatorAddress": "address:owner", - "creatorNonce": "4", + "creatorAddress": "sc:multisig", + "creatorNonce": "3", "newAddress": "sc:bridged-tokens-wrapper" } ] @@ -117,7 +123,7 @@ "step": "scDeploy", "id": "", "tx": { - "from": "address:owner", + "from": "sc:multisig", "contractCode": "mxsc:../bridged-tokens-wrapper/output/bridged-tokens-wrapper.mxsc.json", "arguments": [], "gasLimit": "5,000,000" @@ -132,74 +138,6 @@ "id": "", "tx": { "from": "sc:multisig", - "to": "sc:multi-transfer", - "function": "setWrappingContractAddress", - "arguments": [ - "0x00000000000000000500627269646765642d746f6b656e732d77726170706572" - ], - "gasLimit": "5,000,000" - }, - "expect": { - "out": [], - "status": "0" - } - }, - { - "step": "scCall", - "id": "", - "tx": { - "from": "sc:multisig", - "to": "sc:multi-transfer", - "function": "setBridgeProxyContractAddress", - "arguments": [ - "0x000000000000000005006272696467652d70726f78795f5f5f5f5f5f5f5f5f5f" - ], - "gasLimit": "5,000,000" - }, - "expect": { - "out": [], - "status": "0" - } - }, - { - "step": "scCall", - "id": "", - "tx": { - "from": "sc:multisig", - "to": "sc:multi-transfer", - "function": "setEsdtSafeContractAddress", - "arguments": [ - "0x00000000000000000500657364742d736166655f5f5f5f5f5f5f5f5f5f5f5f5f" - ], - "gasLimit": "5,000,000" - }, - "expect": { - "out": [], - "status": "0" - } - }, - { - "step": "scCall", - "id": "", - "tx": { - "from": "address:owner", - "to": "sc:esdt-safe", - "function": "setMultiTransferContractAddress", - "arguments": [ - "0x000000000000000005006d756c74692d7472616e736665725f5f5f5f5f5f5f5f" - ], - "gasLimit": "5,000,000" - }, - "expect": { - "out": [], - "status": "0" - } - }, - { - "step": "scCall", - "id": "", - "tx": { - "from": "address:owner", "to": "sc:esdt-safe", "function": "addTokenToWhitelist", "arguments": [ @@ -223,7 +161,7 @@ "step": "scCall", "id": "", "tx": { - "from": "address:owner", + "from": "sc:multisig", "to": "sc:esdt-safe", "function": "addTokenToWhitelist", "arguments": [ @@ -262,7 +200,7 @@ "step": "scCall", "id": "", "tx": { - "from": "address:owner", + "from": "sc:multisig", "to": "sc:bridged-tokens-wrapper", "function": "unpause", "arguments": [], @@ -277,7 +215,7 @@ "step": "scCall", "id": "", "tx": { - "from": "address:owner", + "from": "sc:multisig", "to": "sc:bridge-proxy", "function": "unpause", "arguments": [], @@ -292,7 +230,7 @@ "step": "scCall", "id": "", "tx": { - "from": "address:owner", + "from": "sc:multisig", "to": "sc:esdt-safe", "function": "unpause", "arguments": [], diff --git a/multisig/scenarios/ethereum_to_multiversx_tx_batch_ok_call_data_encoded.scen.json b/multisig/scenarios/ethereum_to_multiversx_tx_batch_ok_call_data_encoded.scen.json index 84ec33e6..0d4c80ee 100644 --- a/multisig/scenarios/ethereum_to_multiversx_tx_batch_ok_call_data_encoded.scen.json +++ b/multisig/scenarios/ethereum_to_multiversx_tx_batch_ok_call_data_encoded.scen.json @@ -20,6 +20,8 @@ "0x00000000000000000500657364742d736166655f5f5f5f5f5f5f5f5f5f5f5f5f", "0x000000000000000005006d756c74692d7472616e736665725f5f5f5f5f5f5f5f", "0x000000000000000005006272696467652d70726f78795f5f5f5f5f5f5f5f5f5f", + "0x00000000000000000500627269646765642d746f6b656e732d77726170706572", + "0x0000000000000000050070726963652d61676772656761746f725f5f5f5f5f5f", "0x03e8", "0x01f4", "0x02", @@ -34,16 +36,22 @@ } }, { - "step": "scCall", + "step": "setState", + "newAddresses": [ + { + "creatorAddress": "sc:multisig", + "creatorNonce": "0", + "newAddress": "sc:esdt-safe" + } + ] + }, + { + "step": "scDeploy", "id": "", "tx": { - "from": "address:owner", - "to": "sc:esdt-safe", - "function": "upgrade", + "from": "sc:multisig", + "contractCode": "mxsc:../esdt-safe/output/esdt-safe.mxsc.json", "arguments": [ - "0x0000000000000000000000000000000000000000000000000000000000000000", - "0x000000000000000005006d756c74692d7472616e736665725f5f5f5f5f5f5f5f", - "0x000000000000000005006272696467652d70726f78795f5f5f5f5f5f5f5f5f5f", "0x0249f0" ], "gasLimit": "5,000,000" @@ -58,7 +66,7 @@ "newAddresses": [ { "creatorAddress": "sc:multisig", - "creatorNonce": "0", + "creatorNonce": "1", "newAddress": "sc:multi-transfer" } ] @@ -81,8 +89,8 @@ "step": "setState", "newAddresses": [ { - "creatorAddress": "address:owner", - "creatorNonce": "3", + "creatorAddress": "sc:multisig", + "creatorNonce": "2", "newAddress": "sc:bridge-proxy" } ] @@ -91,11 +99,9 @@ "step": "scDeploy", "id": "", "tx": { - "from": "address:owner", + "from": "sc:multisig", "contractCode": "mxsc:../bridge-proxy/output/bridge-proxy.mxsc.json", - "arguments": [ - "0x000000000000000005006d756c74692d7472616e736665725f5f5f5f5f5f5f5f" - ], + "arguments": [], "gasLimit": "5,000,000" }, "expect": { @@ -107,8 +113,8 @@ "step": "setState", "newAddresses": [ { - "creatorAddress": "address:owner", - "creatorNonce": "4", + "creatorAddress": "sc:multisig", + "creatorNonce": "3", "newAddress": "sc:bridged-tokens-wrapper" } ] @@ -117,7 +123,7 @@ "step": "scDeploy", "id": "", "tx": { - "from": "address:owner", + "from": "sc:multisig", "contractCode": "mxsc:../bridged-tokens-wrapper/output/bridged-tokens-wrapper.mxsc.json", "arguments": [], "gasLimit": "5,000,000" @@ -132,74 +138,6 @@ "id": "", "tx": { "from": "sc:multisig", - "to": "sc:multi-transfer", - "function": "setWrappingContractAddress", - "arguments": [ - "0x00000000000000000500627269646765642d746f6b656e732d77726170706572" - ], - "gasLimit": "5,000,000" - }, - "expect": { - "out": [], - "status": "0" - } - }, - { - "step": "scCall", - "id": "", - "tx": { - "from": "sc:multisig", - "to": "sc:multi-transfer", - "function": "setBridgeProxyContractAddress", - "arguments": [ - "0x000000000000000005006272696467652d70726f78795f5f5f5f5f5f5f5f5f5f" - ], - "gasLimit": "5,000,000" - }, - "expect": { - "out": [], - "status": "0" - } - }, - { - "step": "scCall", - "id": "", - "tx": { - "from": "sc:multisig", - "to": "sc:multi-transfer", - "function": "setEsdtSafeContractAddress", - "arguments": [ - "0x00000000000000000500657364742d736166655f5f5f5f5f5f5f5f5f5f5f5f5f" - ], - "gasLimit": "5,000,000" - }, - "expect": { - "out": [], - "status": "0" - } - }, - { - "step": "scCall", - "id": "", - "tx": { - "from": "address:owner", - "to": "sc:esdt-safe", - "function": "setMultiTransferContractAddress", - "arguments": [ - "0x000000000000000005006d756c74692d7472616e736665725f5f5f5f5f5f5f5f" - ], - "gasLimit": "5,000,000" - }, - "expect": { - "out": [], - "status": "0" - } - }, - { - "step": "scCall", - "id": "", - "tx": { - "from": "address:owner", "to": "sc:esdt-safe", "function": "addTokenToWhitelist", "arguments": [ @@ -223,7 +161,7 @@ "step": "scCall", "id": "", "tx": { - "from": "address:owner", + "from": "sc:multisig", "to": "sc:esdt-safe", "function": "addTokenToWhitelist", "arguments": [ @@ -262,7 +200,7 @@ "step": "scCall", "id": "", "tx": { - "from": "address:owner", + "from": "sc:multisig", "to": "sc:bridged-tokens-wrapper", "function": "unpause", "arguments": [], @@ -277,7 +215,7 @@ "step": "scCall", "id": "", "tx": { - "from": "address:owner", + "from": "sc:multisig", "to": "sc:bridge-proxy", "function": "unpause", "arguments": [], @@ -292,7 +230,7 @@ "step": "scCall", "id": "", "tx": { - "from": "address:owner", + "from": "sc:multisig", "to": "sc:esdt-safe", "function": "unpause", "arguments": [], diff --git a/multisig/scenarios/setup.scen.json b/multisig/scenarios/setup.scen.json index 9572e774..56e2e062 100644 --- a/multisig/scenarios/setup.scen.json +++ b/multisig/scenarios/setup.scen.json @@ -12,10 +12,12 @@ "sc:bridge_proxy": { "code": "file:../../bridge-proxy/output/bridge-proxy.wasm", "nonce": "0", - "balance": "0", - "storage": { - "str:multiTransferAddress": "sc:multi_transfer" - } + "balance": "0" + }, + "sc:bridged_tokens_wrapper": { + "code": "file:../../bridged-tokens-wrapper/output/bridged-tokens-wrapper.wasm", + "nonce": "0", + "balance": "0" }, "sc:multi_transfer": { "nonce": "0", @@ -35,8 +37,6 @@ } }, "storage": { - "str:esdtSafeContractAddress": "sc:esdt_safe", - "str:bridgeProxyContractAddress": "sc:bridge_proxy", "str:maxTxBatchSize": "10", "str:maxTxBatchBlockDuration": "3,600", "str:maxBridgedAmount|nested:str:WEGLD-123456": "100,000,000,000", @@ -67,9 +67,6 @@ } }, "storage": { - "str:multiTransferContractAddress": "sc:multi_transfer", - "str:feeEstimatorContractAddress": "sc:price_aggregator", - "str:bridgedTokensWrapperAddress": "sc:bridged_tokens_wrapper", "str:maxTxBatchSize": "10", "str:maxTxBatchBlockDuration": "100", "str:ethTxGasLimit": "150,000", @@ -143,6 +140,8 @@ "sc:esdt_safe", "sc:multi_transfer", "sc:bridge_proxy", + "sc:bridged_tokens_wrapper", + "sc:price_aggregator", "1000", "500", "2", @@ -169,6 +168,8 @@ "str:esdtSafeAddress": "sc:esdt_safe", "str:multiTransferEsdtAddress": "sc:multi_transfer", "str:proxyAddress": "sc:bridge_proxy", + "str:bridgedTokensWrapperAddress": "sc:bridged_tokens_wrapper", + "str:feeEstimatorAddress": "sc:price_aggregator", "str:num_board_members": "2", "str:quorum": "2", "str:requiredStakeAmount": "1000", diff --git a/multisig/src/bridge_proxy_contract_proxy.rs b/multisig/src/bridge_proxy_contract_proxy.rs deleted file mode 100644 index 3cb21d18..00000000 --- a/multisig/src/bridge_proxy_contract_proxy.rs +++ /dev/null @@ -1,239 +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 BridgeProxyContractProxy; - -impl TxProxyTrait for BridgeProxyContractProxy -where - Env: TxEnv, - From: TxFrom, - To: TxTo, - Gas: TxGas, -{ - type TxProxyMethods = BridgeProxyContractProxyMethods; - - fn proxy_methods(self, tx: Tx) -> Self::TxProxyMethods { - BridgeProxyContractProxyMethods { wrapped_tx: tx } - } -} - -pub struct BridgeProxyContractProxyMethods -where - Env: TxEnv, - From: TxFrom, - To: TxTo, - Gas: TxGas, -{ - wrapped_tx: Tx, -} - -#[rustfmt::skip] -impl BridgeProxyContractProxyMethods -where - Env: TxEnv, - Env::Api: VMApi, - From: TxFrom, - Gas: TxGas, -{ - pub fn init< - Arg0: ProxyArg>>, - >( - self, - opt_multi_transfer_address: Arg0, - ) -> TxTypedDeploy { - self.wrapped_tx - .payment(NotPayable) - .raw_deploy() - .argument(&opt_multi_transfer_address) - .original_result() - } -} - -#[rustfmt::skip] -impl BridgeProxyContractProxyMethods -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 BridgeProxyContractProxyMethods -where - Env: TxEnv, - Env::Api: VMApi, - From: TxFrom, - To: TxTo, - Gas: TxGas, -{ - pub fn deposit< - Arg0: ProxyArg>, - Arg1: ProxyArg, - >( - self, - eth_tx: Arg0, - batch_id: Arg1, - ) -> TxTypedCall { - self.wrapped_tx - .raw_call("deposit") - .argument(ð_tx) - .argument(&batch_id) - .original_result() - } - - pub fn execute< - Arg0: ProxyArg, - >( - self, - tx_id: Arg0, - ) -> TxTypedCall { - self.wrapped_tx - .payment(NotPayable) - .raw_call("execute") - .argument(&tx_id) - .original_result() - } - - pub fn get_pending_transaction_by_id< - Arg0: ProxyArg, - >( - self, - tx_id: Arg0, - ) -> TxTypedCall> { - self.wrapped_tx - .payment(NotPayable) - .raw_call("getPendingTransactionById") - .argument(&tx_id) - .original_result() - } - - pub fn get_pending_transactions( - self, - ) -> TxTypedCall>>> { - self.wrapped_tx - .payment(NotPayable) - .raw_call("getPendingTransactions") - .original_result() - } - - pub fn set_multi_transfer_contract_address< - Arg0: ProxyArg>>, - >( - self, - opt_multi_transfer_address: Arg0, - ) -> TxTypedCall { - self.wrapped_tx - .payment(NotPayable) - .raw_call("setMultiTransferAddress") - .argument(&opt_multi_transfer_address) - .original_result() - } - - pub fn set_bridged_tokens_wrapper_contract_address< - Arg0: ProxyArg>>, - >( - self, - opt_address: Arg0, - ) -> TxTypedCall { - self.wrapped_tx - .payment(NotPayable) - .raw_call("setBridgedTokensWrapperAddress") - .argument(&opt_address) - .original_result() - } - - pub fn set_esdt_safe_contract_address< - Arg0: ProxyArg>>, - >( - self, - opt_address: Arg0, - ) -> TxTypedCall { - self.wrapped_tx - .payment(NotPayable) - .raw_call("setEsdtSafeAddress") - .argument(&opt_address) - .original_result() - } - - pub fn multi_transfer_address( - self, - ) -> TxTypedCall> { - self.wrapped_tx - .payment(NotPayable) - .raw_call("getMultiTransferAddress") - .original_result() - } - - pub fn bridged_tokens_wrapper_address( - self, - ) -> TxTypedCall> { - self.wrapped_tx - .payment(NotPayable) - .raw_call("getBridgedTokensWrapperAddress") - .original_result() - } - - pub fn esdt_safe_contract_address( - self, - ) -> TxTypedCall> { - self.wrapped_tx - .payment(NotPayable) - .raw_call("getEsdtSafeContractAddress") - .original_result() - } - - pub fn highest_tx_id( - self, - ) -> TxTypedCall { - self.wrapped_tx - .payment(NotPayable) - .raw_call("highestTxId") - .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/multisig/src/bridged_tokens_wrapper_proxy.rs b/multisig/src/bridged_tokens_wrapper_proxy.rs deleted file mode 100644 index ac306e11..00000000 --- a/multisig/src/bridged_tokens_wrapper_proxy.rs +++ /dev/null @@ -1,298 +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 BridgedTokensWrapperProxy; - -impl TxProxyTrait for BridgedTokensWrapperProxy -where - Env: TxEnv, - From: TxFrom, - To: TxTo, - Gas: TxGas, -{ - type TxProxyMethods = BridgedTokensWrapperProxyMethods; - - fn proxy_methods(self, tx: Tx) -> Self::TxProxyMethods { - BridgedTokensWrapperProxyMethods { wrapped_tx: tx } - } -} - -pub struct BridgedTokensWrapperProxyMethods -where - Env: TxEnv, - From: TxFrom, - To: TxTo, - Gas: TxGas, -{ - wrapped_tx: Tx, -} - -#[rustfmt::skip] -impl BridgedTokensWrapperProxyMethods -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 BridgedTokensWrapperProxyMethods -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 BridgedTokensWrapperProxyMethods -where - Env: TxEnv, - Env::Api: VMApi, - From: TxFrom, - To: TxTo, - Gas: TxGas, -{ - pub fn add_wrapped_token< - Arg0: ProxyArg>, - Arg1: ProxyArg, - >( - self, - universal_bridged_token_ids: Arg0, - num_decimals: Arg1, - ) -> TxTypedCall { - self.wrapped_tx - .payment(NotPayable) - .raw_call("addWrappedToken") - .argument(&universal_bridged_token_ids) - .argument(&num_decimals) - .original_result() - } - - pub fn update_wrapped_token< - Arg0: ProxyArg>, - Arg1: ProxyArg, - >( - self, - universal_bridged_token_ids: Arg0, - num_decimals: Arg1, - ) -> TxTypedCall { - self.wrapped_tx - .payment(NotPayable) - .raw_call("updateWrappedToken") - .argument(&universal_bridged_token_ids) - .argument(&num_decimals) - .original_result() - } - - pub fn remove_wrapped_token< - Arg0: ProxyArg>, - >( - self, - universal_bridged_token_ids: Arg0, - ) -> TxTypedCall { - self.wrapped_tx - .payment(NotPayable) - .raw_call("removeWrappedToken") - .argument(&universal_bridged_token_ids) - .original_result() - } - - pub fn whitelist_token< - Arg0: ProxyArg>, - Arg1: ProxyArg, - Arg2: ProxyArg>, - >( - self, - chain_specific_token_id: Arg0, - chain_specific_token_decimals: Arg1, - universal_bridged_token_ids: Arg2, - ) -> TxTypedCall { - self.wrapped_tx - .payment(NotPayable) - .raw_call("whitelistToken") - .argument(&chain_specific_token_id) - .argument(&chain_specific_token_decimals) - .argument(&universal_bridged_token_ids) - .original_result() - } - - pub fn update_whitelisted_token< - Arg0: ProxyArg>, - Arg1: ProxyArg, - >( - self, - chain_specific_token_id: Arg0, - chain_specific_token_decimals: Arg1, - ) -> TxTypedCall { - self.wrapped_tx - .payment(NotPayable) - .raw_call("updateWhitelistedToken") - .argument(&chain_specific_token_id) - .argument(&chain_specific_token_decimals) - .original_result() - } - - pub fn blacklist_token< - Arg0: ProxyArg>, - >( - self, - chain_specific_token_id: Arg0, - ) -> TxTypedCall { - self.wrapped_tx - .payment(NotPayable) - .raw_call("blacklistToken") - .argument(&chain_specific_token_id) - .original_result() - } - - pub fn deposit_liquidity( - self, - ) -> TxTypedCall { - self.wrapped_tx - .raw_call("depositLiquidity") - .original_result() - } - - /// Will wrap what it can, and send back the rest unchanged - pub fn wrap_tokens( - self, - ) -> TxTypedCall>> { - self.wrapped_tx - .raw_call("wrapTokens") - .original_result() - } - - pub fn unwrap_token< - Arg0: ProxyArg>, - >( - self, - requested_token: Arg0, - ) -> TxTypedCall { - self.wrapped_tx - .raw_call("unwrapToken") - .argument(&requested_token) - .original_result() - } - - pub fn unwrap_token_create_transaction< - Arg0: ProxyArg>, - Arg1: ProxyArg>, - Arg2: ProxyArg>, - >( - self, - requested_token: Arg0, - safe_address: Arg1, - to: Arg2, - ) -> TxTypedCall { - self.wrapped_tx - .raw_call("unwrapTokenCreateTransaction") - .argument(&requested_token) - .argument(&safe_address) - .argument(&to) - .original_result() - } - - pub fn universal_bridged_token_ids( - self, - ) -> TxTypedCall>> { - self.wrapped_tx - .payment(NotPayable) - .raw_call("getUniversalBridgedTokenIds") - .original_result() - } - - pub fn token_liquidity< - Arg0: ProxyArg>, - >( - self, - token: Arg0, - ) -> TxTypedCall> { - self.wrapped_tx - .payment(NotPayable) - .raw_call("getTokenLiquidity") - .argument(&token) - .original_result() - } - - pub fn chain_specific_to_universal_mapping< - Arg0: ProxyArg>, - >( - self, - token: Arg0, - ) -> TxTypedCall> { - self.wrapped_tx - .payment(NotPayable) - .raw_call("getChainSpecificToUniversalMapping") - .argument(&token) - .original_result() - } - - pub fn chain_specific_token_ids< - Arg0: ProxyArg>, - >( - self, - universal_token_id: Arg0, - ) -> TxTypedCall>> { - self.wrapped_tx - .payment(NotPayable) - .raw_call("getchainSpecificTokenIds") - .argument(&universal_token_id) - .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/multisig/src/esdt_safe_proxy.rs b/multisig/src/esdt_safe_proxy.rs index 3832da69..59e564f3 100644 --- a/multisig/src/esdt_safe_proxy.rs +++ b/multisig/src/esdt_safe_proxy.rs @@ -168,6 +168,24 @@ where .original_result() } + pub fn create_transaction_sc_call< + Arg0: ProxyArg>, + Arg1: ProxyArg>, + Arg2: ProxyArg>>, + >( + self, + to: Arg0, + data: Arg1, + opt_refund_address: Arg2, + ) -> TxTypedCall { + self.wrapped_tx + .raw_call("createTransactionSCCall") + .argument(&to) + .argument(&data) + .argument(&opt_refund_address) + .original_result() + } + /// Claim funds for failed MultiversX -> Ethereum transactions. /// These are not sent automatically to prevent the contract getting stuck. /// For example, if the receiver is a SC, a frozen account, etc. diff --git a/multisig/src/lib.rs b/multisig/src/lib.rs index cb2bef3a..87c526bb 100644 --- a/multisig/src/lib.rs +++ b/multisig/src/lib.rs @@ -10,10 +10,7 @@ mod storage; mod user_role; mod util; -pub mod bridge_proxy_contract_proxy; -pub mod esdt_safe_proxy; -pub mod multi_transfer_esdt_proxy; -pub mod multisig_proxy; +use sc_proxies::{esdt_safe_proxy, multi_transfer_esdt_proxy}; use action::Action; use token_module::{AddressPercentagePair, INVALID_PERCENTAGE_SUM_OVER_ERR_MSG, PERCENTAGE_TOTAL}; @@ -44,6 +41,8 @@ pub trait Multisig: esdt_safe_sc_address: ManagedAddress, multi_transfer_sc_address: ManagedAddress, proxy_sc_address: ManagedAddress, + bridged_tokens_wrapper_sc_address: ManagedAddress, + price_aggregator_sc_address: ManagedAddress, required_stake: BigUint, slash_amount: BigUint, quorum: usize, @@ -91,6 +90,22 @@ pub trait Multisig: ); self.proxy_address().set(&proxy_sc_address); + require!( + self.blockchain() + .is_smart_contract(&bridged_tokens_wrapper_sc_address), + "Bridged Tokens Wrapper address is not a Smart Contract address" + ); + self.bridged_tokens_wrapper_address() + .set(&bridged_tokens_wrapper_sc_address); + + require!( + self.blockchain() + .is_smart_contract(&price_aggregator_sc_address), + "Price Aggregator address is not a Smart Contract address" + ); + self.fee_estimator_address() + .set(&price_aggregator_sc_address); + self.set_paused(true); } @@ -100,6 +115,8 @@ pub trait Multisig: esdt_safe_sc_address: ManagedAddress, multi_transfer_sc_address: ManagedAddress, proxy_sc_address: ManagedAddress, + bridged_tokens_wrapper_sc_address: ManagedAddress, + price_aggregator_sc_address: ManagedAddress, ) { require!( self.blockchain().is_smart_contract(&esdt_safe_sc_address), @@ -121,6 +138,22 @@ pub trait Multisig: ); self.proxy_address().set(&proxy_sc_address); + require!( + self.blockchain() + .is_smart_contract(&bridged_tokens_wrapper_sc_address), + "Bridged Tokens Wrapper address is not a Smart Contract address" + ); + self.bridged_tokens_wrapper_address() + .set(&bridged_tokens_wrapper_sc_address); + + require!( + self.blockchain() + .is_smart_contract(&price_aggregator_sc_address), + "Price Aggregator address is not a Smart Contract address" + ); + self.fee_estimator_address() + .set(&price_aggregator_sc_address); + self.set_paused(true); } diff --git a/multisig/src/queries.rs b/multisig/src/queries.rs index 4bb93210..ba5f3fc6 100644 --- a/multisig/src/queries.rs +++ b/multisig/src/queries.rs @@ -1,6 +1,7 @@ use multiversx_sc::imports::*; +use sc_proxies::{esdt_safe_proxy, multi_transfer_esdt_proxy}; -use crate::{action::Action, esdt_safe_proxy, multi_transfer_esdt_proxy, user_role::UserRole}; +use crate::{action::Action, user_role::UserRole}; use transaction::{transaction_status::TransactionStatus, EthTxAsMultiValue, TxBatchSplitInFields}; /// Note: Additional queries can be found in the Storage module diff --git a/multisig/src/setup.rs b/multisig/src/setup.rs index c1e4706a..9bf99bd7 100644 --- a/multisig/src/setup.rs +++ b/multisig/src/setup.rs @@ -1,8 +1,7 @@ use multiversx_sc::imports::*; use eth_address::EthAddress; - -use crate::{bridge_proxy_contract_proxy, esdt_safe_proxy, multi_transfer_esdt_proxy}; +use sc_proxies::{bridge_proxy_contract_proxy, esdt_safe_proxy, multi_transfer_esdt_proxy}; #[multiversx_sc::module] pub trait SetupModule: @@ -218,24 +217,6 @@ pub trait SetupModule: self.unpause_bridge_proxy_event(); } - #[only_owner] - #[endpoint(changeFeeEstimatorContractAddress)] - fn change_fee_estimator_contract_address(&self, new_address: ManagedAddress) { - let esdt_safe_addr = self.esdt_safe_address().get(); - - self.tx() - .to(esdt_safe_addr) - .typed(esdt_safe_proxy::EsdtSafeProxy) - .set_fee_estimator_contract_address(new_address) - .sync_call(); - } - - /// Sets the gas limit being used for Ethereum transactions - /// This is used in the EsdtSafe contract to determine the fee amount - /// - /// fee_amount = eth_gas_limit * price_per_gas_unit - /// - /// where price_per_gas_unit is queried from the aggregator (fee estimator SC) #[only_owner] #[endpoint(changeMultiversXToEthGasLimit)] fn change_multiversx_to_eth_gas_limit(&self, new_gas_limit: BigUint) { @@ -306,30 +287,6 @@ pub trait SetupModule: .sync_call(); } - #[only_owner] - #[endpoint(setMultiTransferOnEsdtSafe)] - fn set_multi_transfer_on_esdt_safe(&self) { - let multi_transfer_esdt_address = self.multi_transfer_esdt_address().get(); - let esdt_safe_addr = self.esdt_safe_address().get(); - self.tx() - .to(esdt_safe_addr) - .typed(esdt_safe_proxy::EsdtSafeProxy) - .set_multi_transfer_contract_address(OptionalValue::Some(multi_transfer_esdt_address)) - .sync_call(); - } - - #[only_owner] - #[endpoint(setEsdtSafeOnMultiTransfer)] - fn set_esdt_safe_on_multi_transfer(&self) { - let esdt_safe_address = self.esdt_safe_address().get(); - let multi_transfer_esdt_addr = self.multi_transfer_esdt_address().get(); - self.tx() - .to(multi_transfer_esdt_addr) - .typed(multi_transfer_esdt_proxy::MultiTransferEsdtProxy) - .set_esdt_safe_contract_address(OptionalValue::Some(esdt_safe_address)) - .sync_call(); - } - #[only_owner] #[endpoint(esdtSafeRemoveTokenFromWhitelist)] fn esdt_safe_remove_token_from_whitelist(&self, token_id: TokenIdentifier) { @@ -434,26 +391,4 @@ pub trait SetupModule: .set_max_tx_batch_block_duration(new_max_tx_batch_block_duration) .sync_call(); } - - /// Sets the wrapping contract address. - /// This contract is used to map multiple tokens to a universal one. - /// Useful in cases where a single token (USDC for example) - /// is being transferred from multiple chains. - /// - /// They will all have different token IDs, but can be swapped 1:1 in the wrapping SC. - /// The wrapping is done automatically, so the user only receives the universal token. - #[only_owner] - #[endpoint(multiTransferEsdtSetWrappingContractAddress)] - fn multi_transfer_esdt_set_wrapping_contract_address( - &self, - opt_wrapping_contract_address: OptionalValue, - ) { - let multi_transfer_esdt_addr = self.multi_transfer_esdt_address().get(); - - self.tx() - .to(multi_transfer_esdt_addr) - .typed(multi_transfer_esdt_proxy::MultiTransferEsdtProxy) - .set_wrapping_contract_address(opt_wrapping_contract_address) - .sync_call(); - } } diff --git a/multisig/src/storage.rs b/multisig/src/storage.rs index e130c3c4..3823f73a 100644 --- a/multisig/src/storage.rs +++ b/multisig/src/storage.rs @@ -102,4 +102,14 @@ pub trait StorageModule { #[view(getProxyAddress)] #[storage_mapper("proxyAddress")] fn proxy_address(&self) -> SingleValueMapper; + + #[view(getBridgedTokensWrapperAddress)] + #[storage_mapper("bridgedTokensWrapperAddress")] + fn bridged_tokens_wrapper_address( + &self, + ) -> SingleValueMapper>; + + #[view(getFeeEstimatorAddress)] + #[storage_mapper("feeEstimatorAddress")] + fn fee_estimator_address(&self) -> SingleValueMapper>; } diff --git a/multisig/tests/multisig_blackbox_test.rs b/multisig/tests/multisig_blackbox_test.rs index fba5a36c..b297eaf1 100644 --- a/multisig/tests/multisig_blackbox_test.rs +++ b/multisig/tests/multisig_blackbox_test.rs @@ -2,14 +2,10 @@ use std::ops::Add; -use bridge_proxy::{bridge_proxy_contract_proxy, config::ProxyTrait as _, ProxyTrait as _}; +use bridge_proxy::{config::ProxyTrait as _, ProxyTrait as _}; use esdt_safe::{EsdtSafe, ProxyTrait as _}; -use multi_transfer_esdt::{bridged_tokens_wrapper_proxy, multi_transfer_proxy, ProxyTrait as _}; -use multisig::{ - __endpoints_5__::multi_transfer_esdt_address, esdt_safe_proxy, multi_transfer_esdt_proxy, - multisig_proxy, -}; +use multisig::__endpoints_5__::multi_transfer_esdt_address; use multiversx_sc::{ api::{HandleConstraints, ManagedTypeApi}, codec::{ @@ -20,9 +16,10 @@ use multiversx_sc::{ hex_literal::hex, storage::mappers::SingleValue, types::{ - Address, BigUint, CodeMetadata, ManagedAddress, ManagedBuffer, ManagedByteArray, - ManagedOption, ManagedType, ManagedVec, MultiValueEncoded, ReturnsNewManagedAddress, - ReturnsResult, TestAddress, TestSCAddress, TestTokenIdentifier, TokenIdentifier, + Address, BigUint, CodeMetadata, EsdtLocalRole, ManagedAddress, ManagedBuffer, + ManagedByteArray, ManagedOption, ManagedType, ManagedVec, MultiValueEncoded, + ReturnsNewManagedAddress, ReturnsResult, TestAddress, TestSCAddress, TestTokenIdentifier, + TokenIdentifier, }, }; use multiversx_sc_modules::pause::ProxyTrait; @@ -35,8 +32,15 @@ use multiversx_sc_scenario::{ }; use eth_address::*; +use sc_proxies::{ + bridge_proxy_contract_proxy, bridged_tokens_wrapper_proxy, esdt_safe_proxy, + multi_transfer_esdt_proxy, multisig_proxy, +}; use token_module::ProxyTrait as _; -use transaction::{CallData, EthTransaction, EthTxAsMultiValue, TxBatchSplitInFields}; +use transaction::{ + transaction_status::TransactionStatus, CallData, EthTransaction, EthTxAsMultiValue, + TxBatchSplitInFields, +}; const WEGLD_TOKEN_ID: TestTokenIdentifier = TestTokenIdentifier::new("WEGLD-123456"); const ETH_TOKEN_ID: TestTokenIdentifier = TestTokenIdentifier::new("ETH-123456"); @@ -44,6 +48,7 @@ const ETH_TOKEN_ID: TestTokenIdentifier = TestTokenIdentifier::new("ETH-123456") const USER_ETHEREUM_ADDRESS: &[u8] = b"0x0102030405060708091011121314151617181920"; const GAS_LIMIT: u64 = 100_000_000; +const ETH_TX_GAS_LIMIT: u64 = 150_000; const MULTISIG_CODE_PATH: MxscPath = MxscPath::new("output/multisig.mxsc.json"); const MULTI_TRANSFER_CODE_PATH: MxscPath = @@ -67,6 +72,7 @@ const ORACLE_ADDRESS: TestAddress = TestAddress::new("oracle"); const OWNER_ADDRESS: TestAddress = TestAddress::new("owner"); const USER1_ADDRESS: TestAddress = TestAddress::new("user1"); const USER2_ADDRESS: TestAddress = TestAddress::new("user2"); +const NON_BOARD_MEMEBER_ADDRESS: TestAddress = TestAddress::new("non-board-member"); const RELAYER1_ADDRESS: TestAddress = TestAddress::new("relayer1"); const RELAYER2_ADDRESS: TestAddress = TestAddress::new("relayer2"); @@ -90,6 +96,10 @@ fn world() -> ScenarioWorld { BRIDGED_TOKENS_WRAPPER_CODE_PATH, bridged_tokens_wrapper::ContractBuilder, ); + blockchain.register_contract( + PRICE_AGGREGATOR_CODE_PATH, + fee_estimator_module::ContractBuilder, + ); blockchain } @@ -119,18 +129,14 @@ impl MultiTransferTestState { .balance(1_000u64) .account(RELAYER2_ADDRESS) .nonce(1) - .balance(1_000u64); + .balance(1_000u64) + .account(NON_BOARD_MEMEBER_ADDRESS) + .nonce(1); let roles = vec![ "ESDTRoleLocalMint".to_string(), "ESDTRoleLocalBurn".to_string(), ]; - world - .account(ESDT_SAFE_ADDRESS) - .esdt_roles(WEGLD_TOKEN_ID, roles.clone()) - .esdt_roles(ETH_TOKEN_ID, roles) - .code(ESDT_SAFE_CODE_PATH) - .owner(OWNER_ADDRESS); Self { world } } @@ -148,6 +154,8 @@ impl MultiTransferTestState { ESDT_SAFE_ADDRESS, MULTI_TRANSFER_ADDRESS, BRIDGE_PROXY_ADDRESS, + BRIDGED_TOKENS_WRAPPER_ADDRESS, + PRICE_AGGREGATOR_ADDRESS, 1_000u64, 500u64, 2usize, @@ -175,7 +183,7 @@ impl MultiTransferTestState { fn bridged_tokens_wrapper_deploy(&mut self) -> &mut Self { self.world .tx() - .from(OWNER_ADDRESS) + .from(MULTISIG_ADDRESS) .typed(bridged_tokens_wrapper_proxy::BridgedTokensWrapperProxy) .init() .code(BRIDGED_TOKENS_WRAPPER_CODE_PATH) @@ -188,9 +196,9 @@ impl MultiTransferTestState { fn bridge_proxy_deploy(&mut self) -> &mut Self { self.world .tx() - .from(OWNER_ADDRESS) + .from(MULTISIG_ADDRESS) .typed(bridge_proxy_contract_proxy::BridgeProxyContractProxy) - .init(OptionalValue::Some(MULTI_TRANSFER_ADDRESS.to_address())) + .init() .code(BRIDGE_PROXY_CODE_PATH) .new_address(BRIDGE_PROXY_ADDRESS) .run(); @@ -198,66 +206,21 @@ impl MultiTransferTestState { self } - fn safe_deploy(&mut self, price_aggregator_contract_address: Address) -> &mut Self { + fn safe_deploy(&mut self) { self.world .tx() - .from(OWNER_ADDRESS) - .to(ESDT_SAFE_ADDRESS) + .from(MULTISIG_ADDRESS) .typed(esdt_safe_proxy::EsdtSafeProxy) - .upgrade( - ManagedAddress::zero(), - MULTI_TRANSFER_ADDRESS.to_address(), - BRIDGE_PROXY_ADDRESS.to_address(), - ESDT_SAFE_ETH_TX_GAS_LIMIT, - ) + .init(ETH_TX_GAS_LIMIT) .code(ESDT_SAFE_CODE_PATH) + .new_address(ESDT_SAFE_ADDRESS) .run(); - - self } fn config_multisig(&mut self) { self.world .tx() .from(MULTISIG_ADDRESS) - .to(MULTI_TRANSFER_ADDRESS) - .typed(multi_transfer_proxy::MultiTransferEsdtProxy) - .set_wrapping_contract_address(OptionalValue::Some( - BRIDGED_TOKENS_WRAPPER_ADDRESS.to_address(), - )) - .run(); - - self.world - .tx() - .from(MULTISIG_ADDRESS) - .to(MULTI_TRANSFER_ADDRESS) - .typed(multi_transfer_proxy::MultiTransferEsdtProxy) - .set_bridge_proxy_contract_address(OptionalValue::Some( - BRIDGE_PROXY_ADDRESS.to_address(), - )) - .run(); - - self.world - .tx() - .from(MULTISIG_ADDRESS) - .to(MULTI_TRANSFER_ADDRESS) - .typed(multi_transfer_proxy::MultiTransferEsdtProxy) - .set_esdt_safe_contract_address(OptionalValue::Some(ESDT_SAFE_ADDRESS.to_address())) - .run(); - - self.world - .tx() - .from(OWNER_ADDRESS) - .to(ESDT_SAFE_ADDRESS) - .typed(esdt_safe_proxy::EsdtSafeProxy) - .set_multi_transfer_contract_address(OptionalValue::Some( - MULTI_TRANSFER_ADDRESS.to_address(), - )) - .run(); - - self.world - .tx() - .from(OWNER_ADDRESS) .to(ESDT_SAFE_ADDRESS) .typed(esdt_safe_proxy::EsdtSafeProxy) .add_token_to_whitelist( @@ -274,7 +237,7 @@ impl MultiTransferTestState { self.world .tx() - .from(OWNER_ADDRESS) + .from(MULTISIG_ADDRESS) .to(ESDT_SAFE_ADDRESS) .typed(esdt_safe_proxy::EsdtSafeProxy) .add_token_to_whitelist( @@ -299,7 +262,7 @@ impl MultiTransferTestState { self.world .tx() - .from(OWNER_ADDRESS) + .from(MULTISIG_ADDRESS) .to(BRIDGED_TOKENS_WRAPPER_ADDRESS) .typed(bridged_tokens_wrapper_proxy::BridgedTokensWrapperProxy) .unpause_endpoint() @@ -307,7 +270,7 @@ impl MultiTransferTestState { self.world .tx() - .from(OWNER_ADDRESS) + .from(MULTISIG_ADDRESS) .to(BRIDGE_PROXY_ADDRESS) .typed(multisig_proxy::MultisigProxy) .unpause_endpoint() @@ -315,7 +278,7 @@ impl MultiTransferTestState { self.world .tx() - .from(OWNER_ADDRESS) + .from(MULTISIG_ADDRESS) .to(ESDT_SAFE_ADDRESS) .typed(esdt_safe_proxy::EsdtSafeProxy) .unpause_endpoint() @@ -348,6 +311,30 @@ impl MultiTransferTestState { .returns(ReturnsResult) .run(); + self.world.set_esdt_balance( + MULTISIG_ADDRESS, + b"WEGLD-123456", + BigUint::from(100_000_000_000u64), + ); + + self.world.set_esdt_balance( + MULTISIG_ADDRESS, + b"ETH-123456", + BigUint::from(100_000_000_000u64), + ); + + self.world.set_esdt_local_roles( + ESDT_SAFE_ADDRESS, + b"WEGLD-123456", + &[EsdtLocalRole::Mint, EsdtLocalRole::Burn], + ); + + self.world.set_esdt_local_roles( + ESDT_SAFE_ADDRESS, + b"ETH-123456", + &[EsdtLocalRole::Mint, EsdtLocalRole::Burn], + ); + assert!(staked_relayers .to_vec() .contains(&RELAYER1_ADDRESS.to_managed_address())); @@ -362,7 +349,7 @@ fn config_test() { let mut state = MultiTransferTestState::new(); state.multisig_deploy(); - state.safe_deploy(Address::zero()); + state.safe_deploy(); state.multi_transfer_deploy(); state.bridge_proxy_deploy(); state.bridged_tokens_wrapper_deploy(); @@ -372,10 +359,10 @@ fn config_test() { #[test] fn ethereum_to_multiversx_call_data_empty_test() { let mut state = MultiTransferTestState::new(); - let token_amount = BigUint::from(76_000_000_000u64); + let token_amount = BigUint::from(76_000_000u64); state.multisig_deploy(); - state.safe_deploy(Address::zero()); + state.safe_deploy(); state.multi_transfer_deploy(); state.bridge_proxy_deploy(); state.bridged_tokens_wrapper_deploy(); @@ -437,7 +424,7 @@ fn ethereum_to_multiversx_relayer_call_data_several_tx_test() { state.world.start_trace(); state.multisig_deploy(); - state.safe_deploy(Address::zero()); + state.safe_deploy(); state.multi_transfer_deploy(); state.bridge_proxy_deploy(); state.bridged_tokens_wrapper_deploy(); @@ -550,7 +537,7 @@ fn ethereum_to_multiversx_relayer_query_test() { state.world.start_trace(); state.multisig_deploy(); - state.safe_deploy(Address::zero()); + state.safe_deploy(); state.multi_transfer_deploy(); state.bridge_proxy_deploy(); state.bridged_tokens_wrapper_deploy(); @@ -637,7 +624,7 @@ fn ethereum_to_multiversx_relayer_query2_test() { state.world.start_trace(); state.multisig_deploy(); - state.safe_deploy(Address::zero()); + state.safe_deploy(); state.multi_transfer_deploy(); state.bridge_proxy_deploy(); state.bridged_tokens_wrapper_deploy(); @@ -725,7 +712,7 @@ fn ethereum_to_multiversx_tx_batch_ok_test() { state.world.start_trace(); state.multisig_deploy(); - state.safe_deploy(Address::zero()); + state.safe_deploy(); state.multi_transfer_deploy(); state.bridge_proxy_deploy(); state.bridged_tokens_wrapper_deploy(); @@ -816,7 +803,7 @@ fn ethereum_to_multiversx_tx_batch_rejected_test() { let over_the_limit_token_amount = BigUint::from(101_000_000_000u64); state.multisig_deploy(); - state.safe_deploy(Address::zero()); + state.safe_deploy(); state.multi_transfer_deploy(); state.bridge_proxy_deploy(); state.bridged_tokens_wrapper_deploy(); @@ -908,3 +895,158 @@ fn ethereum_to_multiversx_tx_batch_rejected_test() { .move_refund_batch_to_safe_from_child_contract() .run(); } + +#[test] +fn multisig_non_board_member_interaction_test() { + let mut state = MultiTransferTestState::new(); + let token_amount = BigUint::from(76_000_000_000u64); + + state.multisig_deploy(); + state.safe_deploy(); + state.multi_transfer_deploy(); + state.bridge_proxy_deploy(); + state.bridged_tokens_wrapper_deploy(); + state.config_multisig(); + + let eth_tx = EthTxAsMultiValue::::from(( + EthAddress { + raw_addr: ManagedByteArray::new_from_bytes(b"01020304050607080910"), + }, + ManagedAddress::from(USER1_ADDRESS.eval_to_array()), + TokenIdentifier::from(WEGLD_TOKEN_ID), + token_amount.clone(), + 1u64, + ManagedOption::none(), + )); + + let mut transfers: MultiValueEncoded> = + MultiValueEncoded::new(); + transfers.push(eth_tx); + + state + .world + .tx() + .from(NON_BOARD_MEMEBER_ADDRESS) + .to(MULTISIG_ADDRESS) + .typed(multisig_proxy::MultisigProxy) + .propose_multi_transfer_esdt_batch(1u32, transfers.clone()) + .returns(ExpectError(4, "only board members can propose")) + .run(); + + let mut tx_batch_status: MultiValueEncoded = + MultiValueEncoded::::new(); + tx_batch_status.push(TransactionStatus::InProgress); + + state + .world + .tx() + .from(RELAYER1_ADDRESS) + .to(MULTISIG_ADDRESS) + .typed(multisig_proxy::MultisigProxy) + .propose_multi_transfer_esdt_batch(1u32, transfers) + .run(); +} + +#[test] +fn multisig_insuficient_signatures_test() { + let mut state = MultiTransferTestState::new(); + let token_amount = BigUint::from(76_000_000_000u64); + + state.multisig_deploy(); + state.safe_deploy(); + state.multi_transfer_deploy(); + state.bridge_proxy_deploy(); + state.bridged_tokens_wrapper_deploy(); + state.config_multisig(); + + let eth_tx = EthTxAsMultiValue::::from(( + EthAddress { + raw_addr: ManagedByteArray::new_from_bytes(b"01020304050607080910"), + }, + ManagedAddress::from(USER1_ADDRESS.eval_to_array()), + TokenIdentifier::from(WEGLD_TOKEN_ID), + token_amount.clone(), + 1u64, + ManagedOption::none(), + )); + + let mut transfers: MultiValueEncoded> = + MultiValueEncoded::new(); + transfers.push(eth_tx); + + state + .world + .tx() + .from(RELAYER1_ADDRESS) + .to(MULTISIG_ADDRESS) + .typed(multisig_proxy::MultisigProxy) + .propose_multi_transfer_esdt_batch(1u32, transfers) + .run(); + + state + .world + .tx() + .from(RELAYER1_ADDRESS) + .to(MULTISIG_ADDRESS) + .typed(multisig_proxy::MultisigProxy) + .perform_action_endpoint(1usize) + .returns(ExpectError(4, "quorum has not been reached")) + .run(); +} + +#[test] +fn multisig_non_board_member_sign_test() { + let mut state = MultiTransferTestState::new(); + let token_amount = BigUint::from(76_000_000_000u64); + + state.multisig_deploy(); + state.safe_deploy(); + state.multi_transfer_deploy(); + state.bridge_proxy_deploy(); + state.bridged_tokens_wrapper_deploy(); + state.config_multisig(); + + let eth_tx = EthTxAsMultiValue::::from(( + EthAddress { + raw_addr: ManagedByteArray::new_from_bytes(b"01020304050607080910"), + }, + ManagedAddress::from(USER1_ADDRESS.eval_to_array()), + TokenIdentifier::from(WEGLD_TOKEN_ID), + token_amount.clone(), + 1u64, + ManagedOption::none(), + )); + + let mut transfers: MultiValueEncoded> = + MultiValueEncoded::new(); + transfers.push(eth_tx); + + state + .world + .tx() + .from(RELAYER1_ADDRESS) + .to(MULTISIG_ADDRESS) + .typed(multisig_proxy::MultisigProxy) + .propose_multi_transfer_esdt_batch(1u32, transfers) + .run(); + + state + .world + .tx() + .from(NON_BOARD_MEMEBER_ADDRESS) + .to(MULTISIG_ADDRESS) + .typed(multisig_proxy::MultisigProxy) + .sign(1usize) + .returns(ExpectError(4, "only board members can sign")) + .run(); + + state + .world + .tx() + .from(RELAYER1_ADDRESS) + .to(MULTISIG_ADDRESS) + .typed(multisig_proxy::MultisigProxy) + .perform_action_endpoint(1usize) + .returns(ExpectError(4, "quorum has not been reached")) + .run(); +} diff --git a/multisig/wasm/Cargo.lock b/multisig/wasm/Cargo.lock index 7c894f12..25373d30 100644 --- a/multisig/wasm/Cargo.lock +++ b/multisig/wasm/Cargo.lock @@ -4,15 +4,15 @@ 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" -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" @@ -28,8 +28,15 @@ dependencies = [ "crowdfunding-esdt", "esdt-safe", "eth-address", + "mock-bridged-tokens-wrapper", + "mock-esdt-safe", + "mock-multi-transfer-esdt", + "mock-multisig", + "mock-price-aggregator", "multiversx-sc", "multiversx-sc-modules", + "sc-proxies", + "storage-module", "token-module", "transaction", "tx-batch-module", @@ -42,6 +49,8 @@ dependencies = [ "eth-address", "multiversx-sc", "multiversx-sc-modules", + "sc-proxies", + "storage-module", "token-module", "transaction", "tx-batch-module", @@ -68,7 +77,7 @@ checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" [[package]] name = "crowdfunding-esdt" version = "0.0.0" -source = "git+https://github.com/multiversx/mx-contracts-rs?rev=d91bbff#d91bbff295295c2f7e2baf1cd569dd5693ddfb56" +source = "git+https://github.com/multiversx/mx-contracts-rs?rev=e72c201#e72c2017bdc2bffef50d8e9d76fc3a24a81ad00d" dependencies = [ "multiversx-sc", ] @@ -86,9 +95,16 @@ dependencies = [ "eth-address", "fee-estimator-module", "max-bridged-amount-module", + "mock-bridge-proxy", + "mock-bridged-tokens-wrapper", + "mock-multi-transfer-esdt", + "mock-multisig", + "mock-price-aggregator", "multiversx-price-aggregator-sc", "multiversx-sc", "multiversx-sc-modules", + "sc-proxies", + "storage-module", "token-module", "transaction", "tx-batch-module", @@ -106,6 +122,7 @@ name = "fee-estimator-module" version = "0.0.0" dependencies = [ "multiversx-sc", + "storage-module", ] [[package]] @@ -135,18 +152,18 @@ checksum = "6fe2267d4ed49bc07b63801559be28c718ea06c4738b7a03c94df7386d2cde46" [[package]] name = "js-sys" -version = "0.3.69" +version = "0.3.72" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "29c15563dc2726973df627357ce0c9ddddbea194836909d655df6a75d2cf296d" +checksum = "6a88f1bda2bd75b0452a14784937d796722fdebfe50df998aeb3f0b7603019a9" dependencies = [ "wasm-bindgen", ] [[package]] name = "libc" -version = "0.2.155" +version = "0.2.160" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "97b3888a4aecf77e811145cadf6eef5901f4782c53886191b2f693f24761847c" +checksum = "f0b21006cd1874ae9e650973c565615676dc4a274c965bb0a73796dac838ce4f" [[package]] name = "log" @@ -161,6 +178,49 @@ dependencies = [ "multiversx-sc", ] +[[package]] +name = "mock-bridge-proxy" +version = "0.0.0" +dependencies = [ + "multiversx-sc", +] + +[[package]] +name = "mock-bridged-tokens-wrapper" +version = "0.0.0" +dependencies = [ + "eth-address", + "multiversx-sc", +] + +[[package]] +name = "mock-esdt-safe" +version = "0.0.0" +dependencies = [ + "multiversx-sc", +] + +[[package]] +name = "mock-multi-transfer-esdt" +version = "0.0.0" +dependencies = [ + "multiversx-sc", +] + +[[package]] +name = "mock-multisig" +version = "0.0.0" +dependencies = [ + "multiversx-sc", +] + +[[package]] +name = "mock-price-aggregator" +version = "0.0.0" +dependencies = [ + "multiversx-sc", +] + [[package]] name = "multi-transfer-esdt" version = "0.0.0" @@ -170,8 +230,12 @@ dependencies = [ "esdt-safe", "eth-address", "max-bridged-amount-module", + "mock-multisig", + "mock-price-aggregator", "multiversx-sc", "multiversx-sc-modules", + "sc-proxies", + "storage-module", "token-module", "transaction", "tx-batch-module", @@ -191,6 +255,7 @@ dependencies = [ "multiversx-price-aggregator-sc", "multiversx-sc", "multiversx-sc-modules", + "sc-proxies", "token-module", "transaction", "tx-batch-module", @@ -206,9 +271,9 @@ dependencies = [ [[package]] name = "multiversx-price-aggregator-sc" -version = "0.52.0" +version = "0.53.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5ea572ebab3a6addd937cad829076b13e320851503fb6adf1ad66f544b2bf100" +checksum = "7317294898d2f57b5181f3310014dec755359925b26d7b992a5f8fc968c7ee0a" dependencies = [ "arrayvec", "getrandom", @@ -219,9 +284,9 @@ dependencies = [ [[package]] name = "multiversx-sc" -version = "0.52.3" +version = "0.53.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "526760b1d6236c011285b264a70a0a9dd3b3dbc53c3b5f76932f4bcfd3a8910c" +checksum = "75ea89a26f0aacda21437a8ae5ccfbefab99d8191942b3d2eddbcbf84f9866d7" dependencies = [ "bitflags", "hex-literal", @@ -233,9 +298,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", @@ -244,9 +309,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", @@ -256,9 +321,9 @@ dependencies = [ [[package]] name = "multiversx-sc-derive" -version = "0.52.3" +version = "0.53.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3557f2f12640a8a07fa6af66cc2a13b188c5b61bed72db22fe631fb3a60c3e96" +checksum = "4c17fdf90fafca2f19085ae67b0502d9f71bf8ab1be3c83808eb88e02a8c18b9" dependencies = [ "hex", "proc-macro2", @@ -269,18 +334,18 @@ dependencies = [ [[package]] name = "multiversx-sc-modules" -version = "0.52.3" +version = "0.53.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "61f5c29c6044f3dc9e866858feee625d7fae5604a68ac7bd66dec683eee97563" +checksum = "daeb48acbd39255868a3241798df2f85050f0ae8d82d6417bd2cd0e30a241855" dependencies = [ "multiversx-sc", ] [[package]] name = "multiversx-sc-wasm-adapter" -version = "0.52.3" +version = "0.53.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ed13aaca9cbdbc6911174cd3029e750a7563d85dd3daaa1107b1fd31c7f17245" +checksum = "20659915a4377d375c46d7f237e810053a03f7e084fad6362dd5748a7233defb" dependencies = [ "multiversx-sc", ] @@ -305,9 +370,9 @@ dependencies = [ [[package]] name = "once_cell" -version = "1.19.0" +version = "1.20.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3fdb12b2476b595f9358c5161aa467c2438859caa136dec86c26fdd2efe17b92" +checksum = "1261fe7e33c73b354eab43b1273a57c8f967d0391e80353e51f764ac02cf6775" [[package]] name = "ppv-lite86" @@ -329,9 +394,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", ] @@ -376,17 +441,35 @@ dependencies = [ "getrandom", ] +[[package]] +name = "sc-proxies" +version = "0.0.0" +dependencies = [ + "eth-address", + "multiversx-sc", + "token-module", + "transaction", + "tx-batch-module", +] + [[package]] name = "smallvec" version = "1.13.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3c5e1a9a646d36c3599cd173a41282daf47c44583ad367b8e6837255952e5c67" +[[package]] +name = "storage-module" +version = "0.1.0" +dependencies = [ + "multiversx-sc", +] + [[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", @@ -399,6 +482,7 @@ version = "0.0.0" dependencies = [ "fee-estimator-module", "multiversx-sc", + "storage-module", ] [[package]] @@ -419,9 +503,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" @@ -437,19 +521,20 @@ checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" [[package]] name = "wasm-bindgen" -version = "0.2.92" +version = "0.2.95" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4be2531df63900aeb2bca0daaaddec08491ee64ceecbee5076636a3b026795a8" +checksum = "128d1e363af62632b8eb57219c8fd7877144af57558fb2ef0368d0087bddeb2e" dependencies = [ "cfg-if", + "once_cell", "wasm-bindgen-macro", ] [[package]] name = "wasm-bindgen-backend" -version = "0.2.92" +version = "0.2.95" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "614d787b966d3989fa7bb98a654e369c762374fd3213d212cfc0251257e747da" +checksum = "cb6dd4d3ca0ddffd1dd1c9c04f94b868c37ff5fac97c30b97cff2d74fce3a358" dependencies = [ "bumpalo", "log", @@ -462,9 +547,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro" -version = "0.2.92" +version = "0.2.95" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a1f8823de937b71b9460c0c34e25f3da88250760bec0ebac694b49997550d726" +checksum = "e79384be7f8f5a9dd5d7167216f022090cf1f9ec128e6e6a482a2cb5c5422c56" dependencies = [ "quote", "wasm-bindgen-macro-support", @@ -472,9 +557,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro-support" -version = "0.2.92" +version = "0.2.95" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e94f17b526d0a461a191c78ea52bbce64071ed5c04c9ffe424dcb38f74171bb7" +checksum = "26c6ab57572f7a24a4985830b120de1594465e5d500f24afe89e16b4e833ef68" dependencies = [ "proc-macro2", "quote", @@ -485,9 +570,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-shared" -version = "0.2.92" +version = "0.2.95" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "af190c94f2773fdb3729c55b007a722abb5384da03bc0986df4c289bf5567e96" +checksum = "65fc09f10666a9f147042251e0dda9c18f166ff7de300607007e96bdebc1068d" [[package]] name = "zerocopy" diff --git a/multisig/wasm/Cargo.toml b/multisig/wasm/Cargo.toml index 8d164a22..80a3739b 100644 --- a/multisig/wasm/Cargo.toml +++ b/multisig/wasm/Cargo.toml @@ -28,7 +28,7 @@ panic = "abort" path = ".." [dependencies.multiversx-sc-wasm-adapter] -version = "=0.52.3" +version = "=0.53.2" [workspace] members = ["."] diff --git a/multisig/wasm/src/lib.rs b/multisig/wasm/src/lib.rs index d7138aaa..dba3a844 100644 --- a/multisig/wasm/src/lib.rs +++ b/multisig/wasm/src/lib.rs @@ -6,9 +6,9 @@ // Init: 1 // Upgrade: 1 -// Endpoints: 74 +// Endpoints: 72 // Async Callback (empty): 1 -// Total number of exported functions: 77 +// Total number of exported functions: 75 #![no_std] @@ -46,13 +46,10 @@ multiversx_sc_wasm_adapter::endpoints! { initSupplyMintBurnEsdtSafe => init_supply_mint_burn_esdt_safe pauseProxy => pause_proxy unpauseProxy => unpause_proxy - changeFeeEstimatorContractAddress => change_fee_estimator_contract_address changeMultiversXToEthGasLimit => change_multiversx_to_eth_gas_limit changeDefaultPricePerGasUnit => change_default_price_per_gas_unit changeTokenTicker => change_token_ticker esdtSafeAddTokenToWhitelist => esdt_safe_add_token_to_whitelist - setMultiTransferOnEsdtSafe => set_multi_transfer_on_esdt_safe - setEsdtSafeOnMultiTransfer => set_esdt_safe_on_multi_transfer esdtSafeRemoveTokenFromWhitelist => esdt_safe_remove_token_from_whitelist esdtSafeSetMaxTxBatchSize => esdt_safe_set_max_tx_batch_size esdtSafeSetMaxTxBatchBlockDuration => esdt_safe_set_max_tx_batch_block_duration @@ -60,7 +57,6 @@ multiversx_sc_wasm_adapter::endpoints! { multiTransferEsdtSetMaxBridgedAmountForToken => multi_transfer_esdt_set_max_bridged_amount_for_token multiTransferEsdtSetMaxRefundTxBatchSize => multi_transfer_esdt_set_max_refund_tx_batch_size multiTransferEsdtSetMaxRefundTxBatchBlockDuration => multi_transfer_esdt_set_max_refund_tx_batch_block_duration - multiTransferEsdtSetWrappingContractAddress => multi_transfer_esdt_set_wrapping_contract_address getQuorum => quorum getNumBoardMembers => num_board_members getRequiredStakeAmount => required_stake_amount @@ -74,6 +70,8 @@ multiversx_sc_wasm_adapter::endpoints! { getEsdtSafeAddress => esdt_safe_address getMultiTransferEsdtAddress => multi_transfer_esdt_address getProxyAddress => proxy_address + getBridgedTokensWrapperAddress => bridged_tokens_wrapper_address + getFeeEstimatorAddress => fee_estimator_address getCurrentTxBatch => get_current_tx_batch getBatch => get_batch getCurrentRefundBatch => get_current_refund_batch diff --git a/price-aggregator/multiversx-price-aggregator-sc.abi.json b/price-aggregator/multiversx-price-aggregator-sc.abi.json index 67d5f029..62bb9dff 100644 --- a/price-aggregator/multiversx-price-aggregator-sc.abi.json +++ b/price-aggregator/multiversx-price-aggregator-sc.abi.json @@ -9,11 +9,11 @@ }, "contractCrate": { "name": "multiversx-price-aggregator-sc", - "version": "0.52.0" + "version": "0.53.2" }, "framework": { "name": "multiversx-sc", - "version": "0.52.0" + "version": "0.53.2" } }, "name": "PriceAggregator", @@ -436,4 +436,4 @@ ] } } -} +} \ No newline at end of file diff --git a/price-aggregator/multiversx-price-aggregator-sc.mxsc.json b/price-aggregator/multiversx-price-aggregator-sc.mxsc.json index 9748b33b..e01c299d 100644 --- a/price-aggregator/multiversx-price-aggregator-sc.mxsc.json +++ b/price-aggregator/multiversx-price-aggregator-sc.mxsc.json @@ -9,11 +9,11 @@ }, "contractCrate": { "name": "multiversx-price-aggregator-sc", - "version": "0.52.0" + "version": "0.53.2" }, "framework": { "name": "multiversx-sc", - "version": "0.52.0" + "version": "0.53.2" } }, "abi": { @@ -493,4 +493,4 @@ "hasPanic": "without message" } } -} +} \ No newline at end of file diff --git a/test-caller/Cargo.toml b/test-caller/Cargo.toml index 8487b40e..9e993ecd 100644 --- a/test-caller/Cargo.toml +++ b/test-caller/Cargo.toml @@ -9,13 +9,13 @@ publish = false path = "src/test-caller.rs" [dependencies.multiversx-sc] -version = "=0.52.3" +version = "=0.53.2" [dependencies.multiversx-sc-modules] -version = "0.52.3" +version = "0.53.2" [dev-dependencies] num-bigint = "0.4.2" [dev-dependencies.multiversx-sc-scenario] -version = "=0.52.3" +version = "=0.53.2" diff --git a/test-caller/meta/Cargo.toml b/test-caller/meta/Cargo.toml index bf04cf16..36d79297 100644 --- a/test-caller/meta/Cargo.toml +++ b/test-caller/meta/Cargo.toml @@ -11,4 +11,4 @@ authors = ["you"] path = ".." [dependencies.multiversx-sc-meta-lib] -version = "=0.52.3" +version = "=0.53.2" diff --git a/test-caller/wasm/Cargo.lock b/test-caller/wasm/Cargo.lock index 708839a7..ddd491aa 100644 --- a/test-caller/wasm/Cargo.lock +++ b/test-caller/wasm/Cargo.lock @@ -4,15 +4,15 @@ 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" -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" @@ -40,9 +40,9 @@ checksum = "6fe2267d4ed49bc07b63801559be28c718ea06c4738b7a03c94df7386d2cde46" [[package]] name = "multiversx-sc" -version = "0.52.3" +version = "0.53.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "526760b1d6236c011285b264a70a0a9dd3b3dbc53c3b5f76932f4bcfd3a8910c" +checksum = "75ea89a26f0aacda21437a8ae5ccfbefab99d8191942b3d2eddbcbf84f9866d7" dependencies = [ "bitflags", "hex-literal", @@ -54,9 +54,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", @@ -65,9 +65,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", @@ -77,9 +77,9 @@ dependencies = [ [[package]] name = "multiversx-sc-derive" -version = "0.52.3" +version = "0.53.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3557f2f12640a8a07fa6af66cc2a13b188c5b61bed72db22fe631fb3a60c3e96" +checksum = "4c17fdf90fafca2f19085ae67b0502d9f71bf8ab1be3c83808eb88e02a8c18b9" dependencies = [ "hex", "proc-macro2", @@ -90,18 +90,18 @@ dependencies = [ [[package]] name = "multiversx-sc-modules" -version = "0.52.3" +version = "0.53.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "61f5c29c6044f3dc9e866858feee625d7fae5604a68ac7bd66dec683eee97563" +checksum = "daeb48acbd39255868a3241798df2f85050f0ae8d82d6417bd2cd0e30a241855" dependencies = [ "multiversx-sc", ] [[package]] name = "multiversx-sc-wasm-adapter" -version = "0.52.3" +version = "0.53.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ed13aaca9cbdbc6911174cd3029e750a7563d85dd3daaa1107b1fd31c7f17245" +checksum = "20659915a4377d375c46d7f237e810053a03f7e084fad6362dd5748a7233defb" dependencies = [ "multiversx-sc", ] @@ -135,9 +135,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", ] @@ -160,9 +160,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", @@ -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/test-caller/wasm/Cargo.toml b/test-caller/wasm/Cargo.toml index f97bbae6..9575d61c 100644 --- a/test-caller/wasm/Cargo.toml +++ b/test-caller/wasm/Cargo.toml @@ -28,7 +28,7 @@ panic = "abort" path = ".." [dependencies.multiversx-sc-wasm-adapter] -version = "=0.52.3" +version = "=0.53.2" [workspace] members = ["."]