diff --git a/examples/erc20/Cargo.lock b/examples/erc20/Cargo.lock index 784922d1..5d342018 100644 --- a/examples/erc20/Cargo.lock +++ b/examples/erc20/Cargo.lock @@ -13,9 +13,9 @@ dependencies = [ [[package]] name = "alloy-json-abi" -version = "0.8.14" +version = "0.8.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ac4b22b3e51cac09fd2adfcc73b55f447b4df669f983c13f7894ec82b607c63f" +checksum = "d62cf1b25f5a50ca2d329b0b4aeb0a0dedeaf225ad3c5099d83b1a4c4616186e" dependencies = [ "alloy-primitives", "alloy-sol-type-parser", @@ -25,9 +25,9 @@ dependencies = [ [[package]] name = "alloy-primitives" -version = "0.8.14" +version = "0.8.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9db948902dfbae96a73c2fbf1f7abec62af034ab883e4c777c3fd29702bd6e2c" +checksum = "bc1360603efdfba91151e623f13a4f4d3dc4af4adc1cbd90bf37c81e84db4c77" dependencies = [ "alloy-rlp", "bytes", @@ -36,7 +36,6 @@ dependencies = [ "derive_more", "foldhash", "hashbrown", - "hex-literal", "indexmap", "itoa", "k256", @@ -63,9 +62,9 @@ dependencies = [ [[package]] name = "alloy-sol-macro" -version = "0.8.18" +version = "0.8.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a07b74d48661ab2e4b50bb5950d74dbff5e61dd8ed03bb822281b706d54ebacb" +checksum = "13f28f2131dc3a7b8e2cda882758ad4d5231ca26281b9861d4b18c700713e2da" dependencies = [ "alloy-sol-macro-expander", "alloy-sol-macro-input", @@ -77,9 +76,9 @@ dependencies = [ [[package]] name = "alloy-sol-macro-expander" -version = "0.8.18" +version = "0.8.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "19cc9c7f20b90f9be1a8f71a3d8e283a43745137b0837b1a1cb13159d37cad72" +checksum = "1ee2da033256a3b27131c030933eab0460a709fbcc4d4bd57bf9a5650b2441c5" dependencies = [ "alloy-sol-macro-input", "const-hex", @@ -95,9 +94,9 @@ dependencies = [ [[package]] name = "alloy-sol-macro-input" -version = "0.8.18" +version = "0.8.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "713b7e6dfe1cb2f55c80fb05fd22ed085a1b4e48217611365ed0ae598a74c6ac" +checksum = "4e9d9918b0abb632818bf27e2dfb86b209be8433baacf22100b190bbc0904bd4" dependencies = [ "const-hex", "dunce", @@ -110,19 +109,19 @@ dependencies = [ [[package]] name = "alloy-sol-type-parser" -version = "0.8.18" +version = "0.8.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1eda2711ab2e1fb517fc6e2ffa9728c9a232e296d16810810e6957b781a1b8bc" +checksum = "a971129d242338d92009470a2f750d3b2630bc5da00a40a94d51f5d456b5712f" dependencies = [ "serde", - "winnow", + "winnow 0.7.1", ] [[package]] name = "alloy-sol-types" -version = "0.8.14" +version = "0.8.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c9dc0fffe397aa17628160e16b89f704098bf3c9d74d5d369ebc239575936de5" +checksum = "75f306fc801b3aa2e3c4785b7b5252ec8b19f77b30e3b75babfd23849c81bd8c" dependencies = [ "alloy-json-abi", "alloy-primitives", @@ -502,6 +501,12 @@ version = "1.0.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "92773504d58c093f6de2459af4af33faa518c13451eb8f2b5698ed3d36e7c813" +[[package]] +name = "dyn-clone" +version = "1.0.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "feeef44e73baff3a26d371801df019877a9866a8c493d315ab00177843314f35" + [[package]] name = "ecdsa" version = "0.16.9" @@ -699,12 +704,6 @@ dependencies = [ "serde", ] -[[package]] -name = "hex-literal" -version = "0.4.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6fe2267d4ed49bc07b63801559be28c718ea06c4738b7a03c94df7386d2cde46" - [[package]] name = "hmac" version = "0.12.1" @@ -1372,6 +1371,16 @@ version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f" +[[package]] +name = "stylus-core" +version = "0.7.0" +dependencies = [ + "alloy-primitives", + "alloy-sol-types", + "cfg-if", + "dyn-clone", +] + [[package]] name = "stylus-proc" version = "0.7.0" @@ -1404,6 +1413,7 @@ dependencies = [ "lazy_static", "mini-alloc", "regex", + "stylus-core", "stylus-proc", ] @@ -1437,9 +1447,9 @@ dependencies = [ [[package]] name = "syn-solidity" -version = "0.8.18" +version = "0.8.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "31e89d8bf2768d277f40573c83a02a099e96d96dd3104e13ea676194e61ac4b0" +checksum = "b7f6a4b9002584ea56d0a19713b65da44cbbf6070aca9ae0360577cba5c4db68" dependencies = [ "paste", "proc-macro2", @@ -1542,7 +1552,7 @@ dependencies = [ "serde", "serde_spanned", "toml_datetime", - "winnow", + "winnow 0.6.22", ] [[package]] @@ -1726,6 +1736,15 @@ dependencies = [ "memchr", ] +[[package]] +name = "winnow" +version = "0.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "86e376c75f4f43f44db463cf729e0d3acbf954d13e22c51e26e4c264b4ab545f" +dependencies = [ + "memchr", +] + [[package]] name = "wyz" version = "0.5.1" diff --git a/examples/erc20/Cargo.toml b/examples/erc20/Cargo.toml index 920ce076..1b1ce8fb 100644 --- a/examples/erc20/Cargo.toml +++ b/examples/erc20/Cargo.toml @@ -4,8 +4,8 @@ version = "0.1.0" edition = "2021" [dependencies] -alloy-primitives = "=0.8.14" -alloy-sol-types = "=0.8.14" +alloy-primitives = "=0.8.20" +alloy-sol-types = "=0.8.20" stylus-sdk = { path = "../../stylus-sdk" } mini-alloc = { path = "../../mini-alloc" } diff --git a/examples/erc20/src/main.rs b/examples/erc20/src/main.rs index f2c08169..01939d4e 100644 --- a/examples/erc20/src/main.rs +++ b/examples/erc20/src/main.rs @@ -1,3 +1,5 @@ +#![cfg_attr(not(feature = "export-abi"), no_main)] + #[cfg(feature = "export-abi")] fn main() { erc20::print_from_args(); diff --git a/examples/erc721/Cargo.lock b/examples/erc721/Cargo.lock index 90e8bb5e..c7d9caed 100644 --- a/examples/erc721/Cargo.lock +++ b/examples/erc721/Cargo.lock @@ -13,9 +13,9 @@ dependencies = [ [[package]] name = "alloy-json-abi" -version = "0.8.14" +version = "0.8.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ac4b22b3e51cac09fd2adfcc73b55f447b4df669f983c13f7894ec82b607c63f" +checksum = "d62cf1b25f5a50ca2d329b0b4aeb0a0dedeaf225ad3c5099d83b1a4c4616186e" dependencies = [ "alloy-primitives", "alloy-sol-type-parser", @@ -25,9 +25,9 @@ dependencies = [ [[package]] name = "alloy-primitives" -version = "0.8.14" +version = "0.8.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9db948902dfbae96a73c2fbf1f7abec62af034ab883e4c777c3fd29702bd6e2c" +checksum = "bc1360603efdfba91151e623f13a4f4d3dc4af4adc1cbd90bf37c81e84db4c77" dependencies = [ "alloy-rlp", "bytes", @@ -36,7 +36,6 @@ dependencies = [ "derive_more", "foldhash", "hashbrown", - "hex-literal", "indexmap", "itoa", "k256", @@ -63,9 +62,9 @@ dependencies = [ [[package]] name = "alloy-sol-macro" -version = "0.8.18" +version = "0.8.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a07b74d48661ab2e4b50bb5950d74dbff5e61dd8ed03bb822281b706d54ebacb" +checksum = "13f28f2131dc3a7b8e2cda882758ad4d5231ca26281b9861d4b18c700713e2da" dependencies = [ "alloy-sol-macro-expander", "alloy-sol-macro-input", @@ -77,9 +76,9 @@ dependencies = [ [[package]] name = "alloy-sol-macro-expander" -version = "0.8.18" +version = "0.8.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "19cc9c7f20b90f9be1a8f71a3d8e283a43745137b0837b1a1cb13159d37cad72" +checksum = "1ee2da033256a3b27131c030933eab0460a709fbcc4d4bd57bf9a5650b2441c5" dependencies = [ "alloy-sol-macro-input", "const-hex", @@ -95,9 +94,9 @@ dependencies = [ [[package]] name = "alloy-sol-macro-input" -version = "0.8.18" +version = "0.8.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "713b7e6dfe1cb2f55c80fb05fd22ed085a1b4e48217611365ed0ae598a74c6ac" +checksum = "4e9d9918b0abb632818bf27e2dfb86b209be8433baacf22100b190bbc0904bd4" dependencies = [ "const-hex", "dunce", @@ -110,19 +109,19 @@ dependencies = [ [[package]] name = "alloy-sol-type-parser" -version = "0.8.18" +version = "0.8.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1eda2711ab2e1fb517fc6e2ffa9728c9a232e296d16810810e6957b781a1b8bc" +checksum = "a971129d242338d92009470a2f750d3b2630bc5da00a40a94d51f5d456b5712f" dependencies = [ "serde", - "winnow", + "winnow 0.7.1", ] [[package]] name = "alloy-sol-types" -version = "0.8.14" +version = "0.8.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c9dc0fffe397aa17628160e16b89f704098bf3c9d74d5d369ebc239575936de5" +checksum = "75f306fc801b3aa2e3c4785b7b5252ec8b19f77b30e3b75babfd23849c81bd8c" dependencies = [ "alloy-json-abi", "alloy-primitives", @@ -502,6 +501,12 @@ version = "1.0.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "92773504d58c093f6de2459af4af33faa518c13451eb8f2b5698ed3d36e7c813" +[[package]] +name = "dyn-clone" +version = "1.0.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "feeef44e73baff3a26d371801df019877a9866a8c493d315ab00177843314f35" + [[package]] name = "ecdsa" version = "0.16.9" @@ -699,12 +704,6 @@ dependencies = [ "serde", ] -[[package]] -name = "hex-literal" -version = "0.4.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6fe2267d4ed49bc07b63801559be28c718ea06c4738b7a03c94df7386d2cde46" - [[package]] name = "hmac" version = "0.12.1" @@ -1372,6 +1371,16 @@ version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f" +[[package]] +name = "stylus-core" +version = "0.7.0" +dependencies = [ + "alloy-primitives", + "alloy-sol-types", + "cfg-if", + "dyn-clone", +] + [[package]] name = "stylus-proc" version = "0.7.0" @@ -1404,6 +1413,7 @@ dependencies = [ "lazy_static", "mini-alloc", "regex", + "stylus-core", "stylus-proc", ] @@ -1437,9 +1447,9 @@ dependencies = [ [[package]] name = "syn-solidity" -version = "0.8.18" +version = "0.8.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "31e89d8bf2768d277f40573c83a02a099e96d96dd3104e13ea676194e61ac4b0" +checksum = "b7f6a4b9002584ea56d0a19713b65da44cbbf6070aca9ae0360577cba5c4db68" dependencies = [ "paste", "proc-macro2", @@ -1542,7 +1552,7 @@ dependencies = [ "serde", "serde_spanned", "toml_datetime", - "winnow", + "winnow 0.6.22", ] [[package]] @@ -1726,6 +1736,15 @@ dependencies = [ "memchr", ] +[[package]] +name = "winnow" +version = "0.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "86e376c75f4f43f44db463cf729e0d3acbf954d13e22c51e26e4c264b4ab545f" +dependencies = [ + "memchr", +] + [[package]] name = "wyz" version = "0.5.1" diff --git a/examples/erc721/Cargo.toml b/examples/erc721/Cargo.toml index 745643dd..e6fed1b9 100644 --- a/examples/erc721/Cargo.toml +++ b/examples/erc721/Cargo.toml @@ -4,8 +4,8 @@ version = "0.1.0" edition = "2021" [dependencies] -alloy-primitives = "=0.8.14" -alloy-sol-types = "=0.8.14" +alloy-primitives = "=0.8.20" +alloy-sol-types = "=0.8.20" stylus-sdk = { path = "../../stylus-sdk" } mini-alloc = { path = "../../mini-alloc" } diff --git a/examples/erc721/src/main.rs b/examples/erc721/src/main.rs index 43280f51..52d4394f 100644 --- a/examples/erc721/src/main.rs +++ b/examples/erc721/src/main.rs @@ -1,3 +1,5 @@ +#![cfg_attr(not(feature = "export-abi"), no_main)] + #[cfg(feature = "export-abi")] fn main() { erc721::print_from_args(); diff --git a/examples/single_call/Cargo.lock b/examples/single_call/Cargo.lock index dd1d9da4..0a899866 100644 --- a/examples/single_call/Cargo.lock +++ b/examples/single_call/Cargo.lock @@ -13,9 +13,9 @@ dependencies = [ [[package]] name = "alloy-json-abi" -version = "0.8.14" +version = "0.8.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ac4b22b3e51cac09fd2adfcc73b55f447b4df669f983c13f7894ec82b607c63f" +checksum = "d62cf1b25f5a50ca2d329b0b4aeb0a0dedeaf225ad3c5099d83b1a4c4616186e" dependencies = [ "alloy-primitives", "alloy-sol-type-parser", @@ -25,9 +25,9 @@ dependencies = [ [[package]] name = "alloy-primitives" -version = "0.8.14" +version = "0.8.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9db948902dfbae96a73c2fbf1f7abec62af034ab883e4c777c3fd29702bd6e2c" +checksum = "bc1360603efdfba91151e623f13a4f4d3dc4af4adc1cbd90bf37c81e84db4c77" dependencies = [ "alloy-rlp", "bytes", @@ -36,7 +36,6 @@ dependencies = [ "derive_more", "foldhash", "hashbrown", - "hex-literal", "indexmap", "itoa", "k256", @@ -63,9 +62,9 @@ dependencies = [ [[package]] name = "alloy-sol-macro" -version = "0.8.18" +version = "0.8.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a07b74d48661ab2e4b50bb5950d74dbff5e61dd8ed03bb822281b706d54ebacb" +checksum = "13f28f2131dc3a7b8e2cda882758ad4d5231ca26281b9861d4b18c700713e2da" dependencies = [ "alloy-sol-macro-expander", "alloy-sol-macro-input", @@ -77,9 +76,9 @@ dependencies = [ [[package]] name = "alloy-sol-macro-expander" -version = "0.8.18" +version = "0.8.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "19cc9c7f20b90f9be1a8f71a3d8e283a43745137b0837b1a1cb13159d37cad72" +checksum = "1ee2da033256a3b27131c030933eab0460a709fbcc4d4bd57bf9a5650b2441c5" dependencies = [ "alloy-sol-macro-input", "const-hex", @@ -95,9 +94,9 @@ dependencies = [ [[package]] name = "alloy-sol-macro-input" -version = "0.8.18" +version = "0.8.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "713b7e6dfe1cb2f55c80fb05fd22ed085a1b4e48217611365ed0ae598a74c6ac" +checksum = "4e9d9918b0abb632818bf27e2dfb86b209be8433baacf22100b190bbc0904bd4" dependencies = [ "const-hex", "dunce", @@ -110,19 +109,19 @@ dependencies = [ [[package]] name = "alloy-sol-type-parser" -version = "0.8.18" +version = "0.8.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1eda2711ab2e1fb517fc6e2ffa9728c9a232e296d16810810e6957b781a1b8bc" +checksum = "a971129d242338d92009470a2f750d3b2630bc5da00a40a94d51f5d456b5712f" dependencies = [ "serde", - "winnow", + "winnow 0.7.1", ] [[package]] name = "alloy-sol-types" -version = "0.8.14" +version = "0.8.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c9dc0fffe397aa17628160e16b89f704098bf3c9d74d5d369ebc239575936de5" +checksum = "75f306fc801b3aa2e3c4785b7b5252ec8b19f77b30e3b75babfd23849c81bd8c" dependencies = [ "alloy-json-abi", "alloy-primitives", @@ -502,6 +501,12 @@ version = "1.0.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "92773504d58c093f6de2459af4af33faa518c13451eb8f2b5698ed3d36e7c813" +[[package]] +name = "dyn-clone" +version = "1.0.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "feeef44e73baff3a26d371801df019877a9866a8c493d315ab00177843314f35" + [[package]] name = "ecdsa" version = "0.16.9" @@ -689,12 +694,6 @@ dependencies = [ "serde", ] -[[package]] -name = "hex-literal" -version = "0.4.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6fe2267d4ed49bc07b63801559be28c718ea06c4738b7a03c94df7386d2cde46" - [[package]] name = "hmac" version = "0.12.1" @@ -1362,6 +1361,16 @@ version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f" +[[package]] +name = "stylus-core" +version = "0.7.0" +dependencies = [ + "alloy-primitives", + "alloy-sol-types", + "cfg-if", + "dyn-clone", +] + [[package]] name = "stylus-proc" version = "0.7.0" @@ -1394,6 +1403,7 @@ dependencies = [ "lazy_static", "mini-alloc", "regex", + "stylus-core", "stylus-proc", ] @@ -1438,9 +1448,9 @@ dependencies = [ [[package]] name = "syn-solidity" -version = "0.8.18" +version = "0.8.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "31e89d8bf2768d277f40573c83a02a099e96d96dd3104e13ea676194e61ac4b0" +checksum = "b7f6a4b9002584ea56d0a19713b65da44cbbf6070aca9ae0360577cba5c4db68" dependencies = [ "paste", "proc-macro2", @@ -1543,7 +1553,7 @@ dependencies = [ "serde", "serde_spanned", "toml_datetime", - "winnow", + "winnow 0.6.22", ] [[package]] @@ -1727,6 +1737,15 @@ dependencies = [ "memchr", ] +[[package]] +name = "winnow" +version = "0.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "86e376c75f4f43f44db463cf729e0d3acbf954d13e22c51e26e4c264b4ab545f" +dependencies = [ + "memchr", +] + [[package]] name = "wyz" version = "0.5.1" diff --git a/examples/single_call/Cargo.toml b/examples/single_call/Cargo.toml index 3b2bf9c0..e466bd22 100644 --- a/examples/single_call/Cargo.toml +++ b/examples/single_call/Cargo.toml @@ -7,8 +7,8 @@ keywords = ["arbitrum", "ethereum", "stylus", "alloy"] description = "Stylus single call router contract" [dependencies] -alloy-primitives = "=0.8.14" -alloy-sol-types = "=0.8.14" +alloy-primitives = "=0.8.20" +alloy-sol-types = "=0.8.20" hex = "0.4.3" stylus-sdk = { path = "../../stylus-sdk" } mini-alloc = { path = "../../mini-alloc" } diff --git a/examples/single_call/src/lib.rs b/examples/single_call/src/lib.rs index dabbbcae..b4b66f9e 100644 --- a/examples/single_call/src/lib.rs +++ b/examples/single_call/src/lib.rs @@ -1,7 +1,9 @@ #![cfg_attr(not(feature = "export-abi"), no_main)] extern crate alloc; -use stylus_sdk::{abi::Bytes, alloy_primitives::Address, call::RawCall, prelude::*}; +use stylus_sdk::{ + abi::Bytes, alloy_primitives::Address, prelude::*, stylus_core::calls::context::Call, +}; #[storage] #[entrypoint] @@ -10,7 +12,7 @@ pub struct SingleCall; #[public] impl SingleCall { pub fn execute(&self, target: Address, data: Bytes) -> Bytes { - let result = RawCall::new().call(target, data.to_vec().as_slice()); + let result = self.vm().call(&Call::default(), target, &data); result.unwrap().into() } diff --git a/stylus-core/src/lib.rs b/stylus-core/src/lib.rs index 22a44420..ce6c1fe8 100644 --- a/stylus-core/src/lib.rs +++ b/stylus-core/src/lib.rs @@ -9,6 +9,7 @@ pub mod storage; use alloy_sol_types::{abi::token::WordToken, SolEvent, TopicList}; pub use host::*; +pub use storage::TopLevelStorage; /// Emits a typed, Alloy log. pub fn log(vm: &dyn Host, event: T) { diff --git a/stylus-sdk/Cargo.toml b/stylus-sdk/Cargo.toml index dd40d427..6680e3e6 100644 --- a/stylus-sdk/Cargo.toml +++ b/stylus-sdk/Cargo.toml @@ -16,7 +16,6 @@ alloy-sol-types.workspace = true cfg-if.workspace = true clap.workspace = true derivative.workspace = true -stylus-test.workspace = true hex = { workspace = true, default-features = false, features = ["alloc"] } keccak-const.workspace = true lazy_static.workspace = true @@ -28,12 +27,13 @@ regex = { workspace = true, optional = true } mini-alloc = { workspace = true, optional = true } stylus-proc.workspace = true stylus-core.workspace = true -rclite.workspace = true [dev-dependencies] paste.workspace = true sha3.workspace = true alloy-primitives = { workspace = true, default-features = false, features=["tiny-keccak"] } +rclite.workspace = true +stylus-test.workspace = true [package.metadata.docs.rs] features = ["default", "docs", "debug", "export-abi"] diff --git a/stylus-sdk/src/call/mod.rs b/stylus-sdk/src/call/mod.rs index 041a1ade..d41d8200 100644 --- a/stylus-sdk/src/call/mod.rs +++ b/stylus-sdk/src/call/mod.rs @@ -15,7 +15,10 @@ use alloc::vec::Vec; use alloy_primitives::Address; #[allow(deprecated)] -pub use self::{context::Call, error::Error, error::MethodError, raw::RawCall, traits::*}; +pub use self::{ + context::Call, error::Error, error::MethodError, raw::RawCall, traits::*, + transfer::transfer_eth, +}; pub(crate) use raw::CachePolicy; diff --git a/stylus-sdk/src/host/calls.rs b/stylus-sdk/src/host/calls.rs index 05b03ef0..2f4dbfb4 100644 --- a/stylus-sdk/src/host/calls.rs +++ b/stylus-sdk/src/host/calls.rs @@ -121,13 +121,15 @@ impl ValueTransfer for WasmVM { /// If this is not desired, the [`call`] function may be used directly. /// /// ``` - /// # use stylus_sdk::call::{call, Call, transfer_eth}; + /// # use stylus_sdk::stylus_core::calls::{ValueTransfer, context::Call}; + /// # use stylus_test::*; /// # fn wrap() -> Result<(), Vec> { + /// # let vm = TestVM::default(); /// # let value = alloy_primitives::U256::ZERO; /// # let recipient = alloy_primitives::Address::ZERO; - /// transfer_eth(recipient, value)?; // these two are equivalent - /// call(Call::new().value(value), recipient, &[])?; // these two are equivalent - /// # Ok(()) + /// vm.transfer_eth(recipient, value)?; // these two are equivalent + /// vm.call(&Call::new().value(value), recipient, &[])?; // these two are equivalent + /// # Ok(()) /// # } /// ``` #[cfg(not(feature = "reentrant"))] diff --git a/stylus-sdk/src/lib.rs b/stylus-sdk/src/lib.rs index 7abdf997..c242fed6 100644 --- a/stylus-sdk/src/lib.rs +++ b/stylus-sdk/src/lib.rs @@ -46,9 +46,9 @@ pub use stylus_proc; // If the target is a testing environment, we export the stylus test module as the `testing` crate // for Stylus SDK consumers, to be used as a test framework. -#[cfg(not(target_arch = "wasm32"))] +#[cfg(all(not(target_arch = "wasm32"), test))] pub use rclite as rc; -#[cfg(not(target_arch = "wasm32"))] +#[cfg(all(not(target_arch = "wasm32"), test))] pub use stylus_test as testing; #[macro_use] diff --git a/stylus-sdk/src/storage/vec.rs b/stylus-sdk/src/storage/vec.rs index f65a431c..7ad0f431 100644 --- a/stylus-sdk/src/storage/vec.rs +++ b/stylus-sdk/src/storage/vec.rs @@ -168,7 +168,7 @@ impl StorageVec { /// extern crate alloc; /// use stylus_sdk::storage::{StorageVec, StorageType, StorageU256}; /// use stylus_sdk::alloy_primitives::U256; - /// use stylus_sdk::testing::*; + /// use stylus_test::*; /// /// let vm = TestVM::default(); /// let mut vec: StorageVec> = StorageVec::from(&vm); diff --git a/stylus-test/src/vm.rs b/stylus-test/src/vm.rs index 089deeb6..5aaa1c6b 100644 --- a/stylus-test/src/vm.rs +++ b/stylus-test/src/vm.rs @@ -40,7 +40,7 @@ use alloy_primitives::{Address, B256, U256}; use alloy_provider::Provider; -use calls::{errors::Error, CallAccess, MutatingCallContext, StaticCallContext, ValueTransfer}; +pub use calls::{errors::Error, CallAccess, MutatingCallContext, StaticCallContext, ValueTransfer}; use deploy::DeploymentAccess; use std::cell::RefCell; use std::rc::Rc;