From 42c859f37d7332fbd78a216a283064a5227f9c68 Mon Sep 17 00:00:00 2001 From: Daniel Bigos Date: Thu, 5 Sep 2024 13:47:06 +0200 Subject: [PATCH] build: bump Stylus SDK to v0.6.0 and cargo-stylus to v0.5.1 (#273) Bump: - Stylus SDK to `v0.6.0` - cargo-stylus to `v0.5.1` --- .github/workflows/check-wasm.yml | 2 +- .github/workflows/e2e-tests.yml | 2 +- Cargo.lock | 471 ++++++++---------- Cargo.toml | 10 +- benches/Cargo.toml | 2 +- contracts/src/access/control.rs | 27 +- contracts/src/access/ownable.rs | 4 +- .../src/token/erc20/extensions/capped.rs | 4 +- .../src/token/erc20/extensions/metadata.rs | 4 +- .../src/token/erc20/extensions/permit.rs | 6 +- contracts/src/token/erc20/mod.rs | 4 +- .../token/erc721/extensions/consecutive.rs | 10 +- .../src/token/erc721/extensions/enumerable.rs | 4 +- .../src/token/erc721/extensions/metadata.rs | 4 +- .../token/erc721/extensions/uri_storage.rs | 4 +- contracts/src/token/erc721/mod.rs | 20 +- contracts/src/utils/cryptography/ecdsa.rs | 6 +- contracts/src/utils/cryptography/eip712.rs | 2 +- contracts/src/utils/metadata.rs | 4 +- contracts/src/utils/nonces.rs | 4 +- contracts/src/utils/pausable.rs | 4 +- examples/access-control/src/lib.rs | 4 +- examples/basic/token/src/lib.rs | 4 +- examples/ecdsa/src/lib.rs | 4 +- examples/erc20-permit/src/lib.rs | 4 +- examples/erc20/src/lib.rs | 4 +- examples/erc20/tests/erc20.rs | 3 +- examples/erc721-consecutive/src/lib.rs | 2 +- examples/erc721-metadata/src/lib.rs | 4 +- examples/erc721/src/lib.rs | 4 +- examples/erc721/tests/erc721.rs | 3 +- examples/merkle-proofs/src/lib.rs | 4 +- examples/ownable/src/lib.rs | 4 +- scripts/check-wasm.sh | 2 +- 34 files changed, 299 insertions(+), 345 deletions(-) diff --git a/.github/workflows/check-wasm.yml b/.github/workflows/check-wasm.yml index ca16f313..f452c4fa 100644 --- a/.github/workflows/check-wasm.yml +++ b/.github/workflows/check-wasm.yml @@ -30,7 +30,7 @@ jobs: - uses: Swatinem/rust-cache@v2 - name: install cargo-stylus - run: cargo install cargo-stylus@0.4.2 cargo-stylus-check@0.4.2 + run: cargo install cargo-stylus@0.5.1 - name: run wasm check run: | diff --git a/.github/workflows/e2e-tests.yml b/.github/workflows/e2e-tests.yml index 22fa1d85..f1a5880b 100644 --- a/.github/workflows/e2e-tests.yml +++ b/.github/workflows/e2e-tests.yml @@ -39,7 +39,7 @@ jobs: key: "e2e-tests" - name: install cargo-stylus - run: cargo install cargo-stylus@0.4.2 cargo-stylus-check@0.4.2 + run: cargo install cargo-stylus@0.5.1 - name: install solc run: | diff --git a/Cargo.lock b/Cargo.lock index 6b04119e..ebb25bb5 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -7,7 +7,7 @@ name = "access-control-example" version = "0.0.0" dependencies = [ "alloy", - "alloy-primitives 0.3.3", + "alloy-primitives", "e2e", "eyre", "mini-alloc", @@ -83,9 +83,9 @@ checksum = "5c6cb57a04249c6480766f7f7cef5467412af1490f8d1e243141daddada3264f" [[package]] name = "alloy" -version = "0.1.3" +version = "0.1.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "096bfe5b4ae72138eab21ba5789e74e09f80461352b2261dfde69e7538f0b3f6" +checksum = "0ba1c79677c9ce51c8d45e20845b05e6fb070ea2c863fba03ad6af2c778474bd" dependencies = [ "alloy-consensus", "alloy-contract", @@ -101,7 +101,6 @@ dependencies = [ "alloy-signer-local", "alloy-transport", "alloy-transport-http", - "reqwest", ] [[package]] @@ -121,7 +120,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3f63a6c9eb45684a5468536bc55379a2af0f45ffa5d756e4e4964532737e1836" dependencies = [ "alloy-eips", - "alloy-primitives 0.7.6", + "alloy-primitives", "alloy-rlp", "alloy-serde", "c-kzg", @@ -137,10 +136,10 @@ dependencies = [ "alloy-dyn-abi", "alloy-json-abi", "alloy-network", - "alloy-primitives 0.7.6", + "alloy-primitives", "alloy-provider", "alloy-rpc-types-eth", - "alloy-sol-types 0.7.6", + "alloy-sol-types", "alloy-transport", "futures", "futures-util", @@ -155,8 +154,8 @@ checksum = "5af3faff14c12c8b11037e0a093dd157c3702becb8435577a2408534d0758315" dependencies = [ "alloy-dyn-abi", "alloy-json-abi", - "alloy-primitives 0.7.6", - "alloy-sol-types 0.7.6", + "alloy-primitives", + "alloy-sol-types", ] [[package]] @@ -166,9 +165,9 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "cb6e6436a9530f25010d13653e206fab4c9feddacf21a54de8d7311b275bc56b" dependencies = [ "alloy-json-abi", - "alloy-primitives 0.7.6", + "alloy-primitives", "alloy-sol-type-parser", - "alloy-sol-types 0.7.6", + "alloy-sol-types", "const-hex", "itoa", "serde", @@ -182,7 +181,7 @@ version = "0.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "aa4b0fc6a572ef2eebda0a31a5e393d451abda703fec917c75d9615d8c978cf2" dependencies = [ - "alloy-primitives 0.7.6", + "alloy-primitives", "alloy-rlp", "alloy-serde", "c-kzg", @@ -197,7 +196,7 @@ version = "0.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "48450f9c6f0821c1eee00ed912942492ed4f11dd69532825833de23ecc7a2256" dependencies = [ - "alloy-primitives 0.7.6", + "alloy-primitives", "alloy-serde", "serde", ] @@ -208,7 +207,7 @@ version = "0.7.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "aaeaccd50238126e3a0ff9387c7c568837726ad4f4e399b528ca88104d6c25ef" dependencies = [ - "alloy-primitives 0.7.6", + "alloy-primitives", "alloy-sol-type-parser", "serde", "serde_json", @@ -220,7 +219,7 @@ version = "0.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d484c2a934d0a4d86f8ad4db8113cb1d607707a6c54f6e78f4f1b4451b47aa70" dependencies = [ - "alloy-primitives 0.7.6", + "alloy-primitives", "serde", "serde_json", "thiserror", @@ -236,39 +235,17 @@ dependencies = [ "alloy-consensus", "alloy-eips", "alloy-json-rpc", - "alloy-primitives 0.7.6", + "alloy-primitives", "alloy-rpc-types-eth", "alloy-serde", "alloy-signer", - "alloy-sol-types 0.7.6", + "alloy-sol-types", "async-trait", "auto_impl", "futures-utils-wasm", "thiserror", ] -[[package]] -name = "alloy-primitives" -version = "0.3.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e416903084d3392ebd32d94735c395d6709415b76c7728e594d3f996f2b03e65" -dependencies = [ - "alloy-rlp", - "arbitrary", - "bytes", - "cfg-if 1.0.0", - "const-hex", - "derive_arbitrary", - "derive_more", - "hex-literal", - "itoa", - "proptest", - "proptest-derive", - "ruint", - "serde", - "tiny-keccak", -] - [[package]] name = "alloy-primitives" version = "0.7.6" @@ -276,16 +253,20 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f783611babedbbe90db3478c120fb5f5daacceffc210b39adc0af4fe0da70bad" dependencies = [ "alloy-rlp", + "arbitrary", "bytes", "cfg-if 1.0.0", "const-hex", + "derive_arbitrary", "derive_more", + "ethereum_ssz", "getrandom", "hex-literal", "itoa", "k256", "keccak-asm", "proptest", + "proptest-derive", "rand", "ruint", "serde", @@ -303,7 +284,7 @@ dependencies = [ "alloy-eips", "alloy-json-rpc", "alloy-network", - "alloy-primitives 0.7.6", + "alloy-primitives", "alloy-rpc-client", "alloy-rpc-types-eth", "alloy-transport", @@ -341,8 +322,8 @@ version = "0.3.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d83524c1f6162fcb5b0decf775498a125066c86dda6066ed609531b0e912f85a" dependencies = [ - "proc-macro2 1.0.86", - "quote 1.0.36", + "proc-macro2", + "quote", "syn 2.0.68", ] @@ -385,10 +366,10 @@ checksum = "13bd7aa9ff9e67f1ba7ee0dd8cebfc95831d1649b0e4eeefae940dc3681079fa" dependencies = [ "alloy-consensus", "alloy-eips", - "alloy-primitives 0.7.6", + "alloy-primitives", "alloy-rlp", "alloy-serde", - "alloy-sol-types 0.7.6", + "alloy-sol-types", "itertools 0.13.0", "serde", "serde_json", @@ -401,7 +382,7 @@ version = "0.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8913f9e825068d77c516188c221c44f78fd814fce8effe550a783295a2757d19" dependencies = [ - "alloy-primitives 0.7.6", + "alloy-primitives", "serde", "serde_json", ] @@ -412,7 +393,7 @@ version = "0.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f740e13eb4c6a0e4d0e49738f1e86f31ad2d7ef93be499539f492805000f7237" dependencies = [ - "alloy-primitives 0.7.6", + "alloy-primitives", "async-trait", "auto_impl", "elliptic-curve", @@ -428,7 +409,7 @@ checksum = "87db68d926887393a1d0f9c43833b44446ea29d603291e7b20e5d115f31aa4e3" dependencies = [ "alloy-consensus", "alloy-network", - "alloy-primitives 0.7.6", + "alloy-primitives", "alloy-signer", "async-trait", "elliptic-curve", @@ -438,21 +419,6 @@ dependencies = [ "thiserror", ] -[[package]] -name = "alloy-sol-macro" -version = "0.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a74ceeffdacf9dd0910404d743d07273776fd17b85f9cb17b49a97e5c6055ce9" -dependencies = [ - "dunce", - "heck 0.4.1", - "proc-macro2 1.0.86", - "quote 1.0.36", - "syn 2.0.68", - "syn-solidity 0.3.1", - "tiny-keccak", -] - [[package]] name = "alloy-sol-macro" version = "0.7.6" @@ -462,8 +428,8 @@ dependencies = [ "alloy-sol-macro-expander", "alloy-sol-macro-input", "proc-macro-error", - "proc-macro2 1.0.86", - "quote 1.0.36", + "proc-macro2", + "quote", "syn 2.0.68", ] @@ -476,13 +442,13 @@ dependencies = [ "alloy-json-abi", "alloy-sol-macro-input", "const-hex", - "heck 0.5.0", + "heck", "indexmap 2.2.6", "proc-macro-error", - "proc-macro2 1.0.86", - "quote 1.0.36", + "proc-macro2", + "quote", "syn 2.0.68", - "syn-solidity 0.7.6", + "syn-solidity", "tiny-keccak", ] @@ -495,12 +461,12 @@ dependencies = [ "alloy-json-abi", "const-hex", "dunce", - "heck 0.5.0", - "proc-macro2 1.0.86", - "quote 1.0.36", + "heck", + "proc-macro2", + "quote", "serde_json", "syn 2.0.68", - "syn-solidity 0.7.6", + "syn-solidity", ] [[package]] @@ -512,17 +478,6 @@ dependencies = [ "winnow 0.6.13", ] -[[package]] -name = "alloy-sol-types" -version = "0.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d5f347cb6bb307b3802ec455ef43ce00f5e590e0ceca3d2f3b070f5ee367e235" -dependencies = [ - "alloy-primitives 0.3.3", - "alloy-sol-macro 0.3.1", - "const-hex", -] - [[package]] name = "alloy-sol-types" version = "0.7.6" @@ -530,8 +485,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a49042c6d3b66a9fe6b2b5a8bf0d39fc2ae1ee0310a2a26ffedd79fb097878dd" dependencies = [ "alloy-json-abi", - "alloy-primitives 0.7.6", - "alloy-sol-macro 0.7.6", + "alloy-primitives", + "alloy-sol-macro", "const-hex", "serde", ] @@ -668,7 +623,7 @@ version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "db02d390bf6643fb404d3d22d31aee1c4bc4459600aef9113833d17e786c6e44" dependencies = [ - "quote 1.0.36", + "quote", "syn 1.0.109", ] @@ -678,7 +633,7 @@ version = "0.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3ed4aa4fe255d0bc6d79373f7e31d2ea147bcf486cba1be5ba7ea85abdb92348" dependencies = [ - "quote 1.0.36", + "quote", "syn 1.0.109", ] @@ -690,7 +645,7 @@ checksum = "db2fd794a08ccb318058009eefdf15bcaaaaf6f8161eb3345f907222bac38b20" dependencies = [ "num-bigint", "num-traits", - "quote 1.0.36", + "quote", "syn 1.0.109", ] @@ -702,8 +657,8 @@ checksum = "7abe79b0e4288889c4574159ab790824d0033b9fdcb2a112a3182fac2e514565" dependencies = [ "num-bigint", "num-traits", - "proc-macro2 1.0.86", - "quote 1.0.36", + "proc-macro2", + "quote", "syn 1.0.109", ] @@ -771,8 +726,8 @@ version = "0.3.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "16e62a023e7c117e27523144c5d2459f4397fcc3cab0085af8e2224f643a0193" dependencies = [ - "proc-macro2 1.0.86", - "quote 1.0.36", + "proc-macro2", + "quote", "syn 2.0.68", ] @@ -782,8 +737,8 @@ version = "0.1.81" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6e0c28dcc82d7c8ead5cb13beb15405b57b8546e93215673ff8ca0349a028107" dependencies = [ - "proc-macro2 1.0.86", - "quote 1.0.36", + "proc-macro2", + "quote", "syn 2.0.68", ] @@ -793,8 +748,8 @@ version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3c87f3f15e7794432337fc718554eaa4dc8f04c9677a950ffe366f20a162ae42" dependencies = [ - "proc-macro2 1.0.86", - "quote 1.0.36", + "proc-macro2", + "quote", "syn 2.0.68", ] @@ -841,7 +796,7 @@ checksum = "8c3c1a368f70d6cf7302d78f8f7093da241fb8e8807c05cc9e51a125895a6d5b" name = "basic-example" version = "0.0.0" dependencies = [ - "alloy-primitives 0.3.3", + "alloy-primitives", "mini-alloc", "openzeppelin-stylus", "stylus-proc", @@ -853,7 +808,7 @@ name = "basic-example-script" version = "0.0.0" dependencies = [ "alloy", - "alloy-primitives 0.3.3", + "alloy-primitives", "basic-example", "koba", "tokio", @@ -864,7 +819,7 @@ name = "benches" version = "0.0.0" dependencies = [ "alloy", - "alloy-primitives 0.3.3", + "alloy-primitives", "e2e", "eyre", "keccak-const", @@ -983,8 +938,8 @@ version = "0.6.12" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3db406d29fbcd95542e92559bed4d8ad92636d1ca8b3b72ede10b4bcc010e659" dependencies = [ - "proc-macro2 1.0.86", - "quote 1.0.36", + "proc-macro2", + "quote", "syn 1.0.109", ] @@ -1079,9 +1034,9 @@ version = "4.5.8" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2bac35c6dafb060fd4d275d9a4ffae97917c13a6327903a8be2153cd964f7085" dependencies = [ - "heck 0.5.0", - "proc-macro2 1.0.86", - "quote 1.0.36", + "heck", + "proc-macro2", + "quote", "syn 2.0.68", ] @@ -1310,7 +1265,7 @@ name = "cryptography-example" version = "0.0.0" dependencies = [ "alloy", - "alloy-primitives 0.3.3", + "alloy-primitives", "e2e", "eyre", "mini-alloc", @@ -1347,8 +1302,8 @@ checksum = "622687fe0bac72a04e5599029151f5796111b90f1baaa9b544d807a5e31cd120" dependencies = [ "fnv", "ident_case", - "proc-macro2 1.0.86", - "quote 1.0.36", + "proc-macro2", + "quote", "syn 2.0.68", ] @@ -1359,7 +1314,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "733cabb43482b1a1b53eee8583c2b9e8684d592215ea83efd305dd31bc2f0178" dependencies = [ "darling_core", - "quote 1.0.36", + "quote", "syn 2.0.68", ] @@ -1392,8 +1347,8 @@ version = "2.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "fcc3dd5e9e9c0b295d6e1e4d811fb6f157d5ffd784b8d202fc62eac8035a770b" dependencies = [ - "proc-macro2 1.0.86", - "quote 1.0.36", + "proc-macro2", + "quote", "syn 1.0.109", ] @@ -1403,8 +1358,8 @@ version = "1.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "67e77553c4162a157adbf834ebae5b415acbecbeafc7a74b0e886657506a7611" dependencies = [ - "proc-macro2 1.0.86", - "quote 1.0.36", + "proc-macro2", + "quote", "syn 2.0.68", ] @@ -1415,8 +1370,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5f33878137e4dafd7fa914ad4e259e18a4e8e532b9617a2d0150262bf53abfce" dependencies = [ "convert_case 0.4.0", - "proc-macro2 1.0.86", - "quote 1.0.36", + "proc-macro2", + "quote", "rustc_version 0.4.0", "syn 2.0.68", ] @@ -1466,8 +1421,8 @@ dependencies = [ name = "e2e-proc" version = "0.1.0" dependencies = [ - "proc-macro2 1.0.86", - "quote 1.0.36", + "proc-macro2", + "quote", "syn 2.0.68", ] @@ -1525,8 +1480,8 @@ version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c134c37760b27a871ba422106eedbb8247da973a09e82558bf26d619c882b159" dependencies = [ - "proc-macro2 1.0.86", - "quote 1.0.36", + "proc-macro2", + "quote", "syn 1.0.109", ] @@ -1546,8 +1501,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e08b6c6ab82d70f08844964ba10c7babb716de2ecaeab9be5717918a5177d3af" dependencies = [ "darling", - "proc-macro2 1.0.86", - "quote 1.0.36", + "proc-macro2", + "quote", "syn 2.0.68", ] @@ -1562,7 +1517,7 @@ name = "erc20-example" version = "0.0.0" dependencies = [ "alloy", - "alloy-primitives 0.3.3", + "alloy-primitives", "e2e", "eyre", "mini-alloc", @@ -1577,7 +1532,7 @@ name = "erc20-permit-example" version = "0.0.0" dependencies = [ "alloy", - "alloy-primitives 0.3.3", + "alloy-primitives", "e2e", "eyre", "mini-alloc", @@ -1592,8 +1547,8 @@ name = "erc721-consecutive-example" version = "0.0.0" dependencies = [ "alloy", - "alloy-primitives 0.3.3", - "alloy-sol-types 0.3.1", + "alloy-primitives", + "alloy-sol-types", "e2e", "eyre", "mini-alloc", @@ -1609,7 +1564,7 @@ name = "erc721-example" version = "0.0.0" dependencies = [ "alloy", - "alloy-primitives 0.3.3", + "alloy-primitives", "e2e", "eyre", "mini-alloc", @@ -1625,7 +1580,7 @@ name = "erc721-metadata-example" version = "0.0.0" dependencies = [ "alloy", - "alloy-primitives 0.3.3", + "alloy-primitives", "e2e", "eyre", "mini-alloc", @@ -1668,6 +1623,44 @@ dependencies = [ "uuid 0.8.2", ] +[[package]] +name = "ethbloom" +version = "0.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c22d4b5885b6aa2fe5e8b9329fb8d232bf739e434e6b87347c63bdd00c120f60" +dependencies = [ + "crunchy", + "fixed-hash", + "impl-rlp", + "impl-serde", + "tiny-keccak", +] + +[[package]] +name = "ethereum-types" +version = "0.14.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "02d215cbf040552efcbe99a38372fe80ab9d00268e20012b79fcd0f073edd8ee" +dependencies = [ + "ethbloom", + "fixed-hash", + "impl-rlp", + "impl-serde", + "primitive-types", + "uint", +] + +[[package]] +name = "ethereum_ssz" +version = "0.5.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7d3627f83d8b87b432a5fad9934b4565260722a141a2c40f371f8080adec9425" +dependencies = [ + "ethereum-types", + "itertools 0.10.5", + "smallvec", +] + [[package]] name = "eyre" version = "0.6.12" @@ -1717,6 +1710,7 @@ version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "835c052cb0c08c1acf6ffd71c022172e18723949c8282f2b9f27efbc51e64534" dependencies = [ + "arbitrary", "byteorder", "rand", "rustc-hex", @@ -1813,8 +1807,8 @@ version = "0.3.30" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "87750cf4b7a4c0625b1529e4c543c2182106e4dedc60a2a6455e00d212c489ac" dependencies = [ - "proc-macro2 1.0.86", - "quote 1.0.36", + "proc-macro2", + "quote", "syn 2.0.68", ] @@ -1938,12 +1932,6 @@ dependencies = [ "allocator-api2", ] -[[package]] -name = "heck" -version = "0.4.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "95505c38b4572b2d910cecb0281560f54b440a19336cbbcb27bf6ce6adc6f5a8" - [[package]] name = "heck" version = "0.5.0" @@ -2100,14 +2088,32 @@ dependencies = [ "parity-scale-codec", ] +[[package]] +name = "impl-rlp" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f28220f89297a075ddc7245cd538076ee98b01f2a9c23a53a4f1105d5a322808" +dependencies = [ + "rlp", +] + +[[package]] +name = "impl-serde" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ebc88fc67028ae3db0c853baa36269d398d5f45b6982f95549ff5def78c935cd" +dependencies = [ + "serde", +] + [[package]] name = "impl-trait-for-tuples" version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "11d7a9f6330b71fea57921c9b61c47ee6e84f72d394754eff6163ae67e7395eb" dependencies = [ - "proc-macro2 1.0.86", - "quote 1.0.36", + "proc-macro2", + "quote", "syn 1.0.109", ] @@ -2356,8 +2362,8 @@ checksum = "8452105ba047068f40ff7093dd1d9da90898e63dd61736462e9cdda6a90ad3c3" name = "merkle-proofs-example" version = "0.0.0" dependencies = [ - "alloy-primitives 0.3.3", - "alloy-sol-types 0.3.1", + "alloy-primitives", + "alloy-sol-types", "mini-alloc", "openzeppelin-crypto", "stylus-proc", @@ -2421,11 +2427,11 @@ dependencies = [ name = "motsu-proc" version = "0.1.0" dependencies = [ - "alloy-primitives 0.3.3", - "alloy-sol-types 0.3.1", + "alloy-primitives", + "alloy-sol-types", "motsu", - "proc-macro2 1.0.86", - "quote 1.0.36", + "proc-macro2", + "quote", "stylus-proc", "stylus-sdk", "syn 2.0.68", @@ -2502,8 +2508,8 @@ version = "0.7.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "681030a937600a36906c185595136d26abfebb4aa9c65701cefcaf8578bb982b" dependencies = [ - "proc-macro2 1.0.86", - "quote 1.0.36", + "proc-macro2", + "quote", "syn 2.0.68", ] @@ -2543,8 +2549,8 @@ version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a948666b637a0f465e8564c73e89d4dde00d72d4d473cc972f390fc3dcee7d9c" dependencies = [ - "proc-macro2 1.0.86", - "quote 1.0.36", + "proc-macro2", + "quote", "syn 2.0.68", ] @@ -2580,8 +2586,8 @@ dependencies = [ name = "openzeppelin-stylus" version = "0.1.0-rc" dependencies = [ - "alloy-primitives 0.3.3", - "alloy-sol-types 0.3.1", + "alloy-primitives", + "alloy-sol-types", "keccak-const", "mini-alloc", "motsu", @@ -2595,7 +2601,7 @@ name = "ownable-example" version = "0.0.0" dependencies = [ "alloy", - "alloy-primitives 0.3.3", + "alloy-primitives", "e2e", "eyre", "mini-alloc", @@ -2632,8 +2638,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d830939c76d294956402033aee57a6da7b438f2294eb94864c37b0569053a42c" dependencies = [ "proc-macro-crate", - "proc-macro2 1.0.86", - "quote 1.0.36", + "proc-macro2", + "quote", "syn 1.0.109", ] @@ -2707,8 +2713,8 @@ version = "1.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2f38a4412a78282e09a2cf38d195ea5420d15ba0602cb375210efbc877243965" dependencies = [ - "proc-macro2 1.0.86", - "quote 1.0.36", + "proc-macro2", + "quote", "syn 2.0.68", ] @@ -2754,6 +2760,8 @@ checksum = "0b34d9fd68ae0b74a41b21c03c2f62847aa0ffea044eee893b4c140b37e244e2" dependencies = [ "fixed-hash", "impl-codec", + "impl-rlp", + "impl-serde", "uint", ] @@ -2773,8 +2781,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "da25490ff9892aab3fcf7c36f08cfb902dd3e71ca0f9f9517bea02a73a5ce38c" dependencies = [ "proc-macro-error-attr", - "proc-macro2 1.0.86", - "quote 1.0.36", + "proc-macro2", + "quote", "syn 1.0.109", "version_check", ] @@ -2785,20 +2793,11 @@ version = "1.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a1be40180e52ecc98ad80b184934baf3d0d29f979574e439af5a55274b35f869" dependencies = [ - "proc-macro2 1.0.86", - "quote 1.0.36", + "proc-macro2", + "quote", "version_check", ] -[[package]] -name = "proc-macro2" -version = "0.4.30" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cf3d2011ab5c909338f7887f4fc896d35932e29146c12c8d01da6b22a80ba759" -dependencies = [ - "unicode-xid", -] - [[package]] name = "proc-macro2" version = "1.0.86" @@ -2830,13 +2829,13 @@ dependencies = [ [[package]] name = "proptest-derive" -version = "0.3.0" +version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "90b46295382dc76166cb7cf2bb4a97952464e4b7ed5a43e6cd34e1fec3349ddc" +checksum = "9cf16337405ca084e9c78985114633b6827711d22b9e6ef6c6c0d665eb3f0b6e" dependencies = [ - "proc-macro2 0.4.30", - "quote 0.6.13", - "syn 0.15.44", + "proc-macro2", + "quote", + "syn 1.0.109", ] [[package]] @@ -2854,8 +2853,8 @@ version = "0.1.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "16b845dbfca988fa33db069c0e230574d15a3088f147a87b64c7589eb662c9ac" dependencies = [ - "proc-macro2 1.0.86", - "quote 1.0.36", + "proc-macro2", + "quote", "syn 1.0.109", ] @@ -2865,22 +2864,13 @@ version = "1.2.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a1d01941d82fa2ab50be1e79e6714289dd7cde78eba4c074bc5a4374f650dfe0" -[[package]] -name = "quote" -version = "0.6.13" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6ce23b6b870e8f94f81fb0a363d65d86675884b34a09043c81e5562f11c1f8e1" -dependencies = [ - "proc-macro2 0.4.30", -] - [[package]] name = "quote" version = "1.0.36" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0fa76aaf39101c457836aec0ce2316dbdc3ab723cdda1c6bd4e6ad4208acaca7" dependencies = [ - "proc-macro2 1.0.86", + "proc-macro2", ] [[package]] @@ -3093,8 +3083,8 @@ version = "0.7.44" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a7dddfff8de25e6f62b9d64e6e432bf1c6736c57d20323e15ee10435fbda7c65" dependencies = [ - "proc-macro2 1.0.86", - "quote 1.0.36", + "proc-macro2", + "quote", "syn 1.0.109", ] @@ -3351,8 +3341,8 @@ version = "1.0.203" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "500cbc0ebeb6f46627f50f3f5811ccf6bf00643be300b4c3eabc0ef55dc5b5ba" dependencies = [ - "proc-macro2 1.0.86", - "quote 1.0.36", + "proc-macro2", + "quote", "syn 2.0.68", ] @@ -3518,40 +3508,40 @@ version = "0.26.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4c6bee85a5a24955dc440386795aa378cd9cf82acd5f764469152d2270e581be" dependencies = [ - "heck 0.5.0", - "proc-macro2 1.0.86", - "quote 1.0.36", + "heck", + "proc-macro2", + "quote", "rustversion", "syn 2.0.68", ] [[package]] name = "stylus-proc" -version = "0.5.0" +version = "0.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9f274700c5c74abfcc9068f96564615173d8fed72ea44afd1e4404bb04478c00" +checksum = "9fd02e91dffe7b73df84a861c992494d6b72054bc9a17fe73e147e34e9a64ef3" dependencies = [ - "alloy-primitives 0.3.3", - "alloy-sol-types 0.3.1", + "alloy-primitives", + "alloy-sol-types", "cfg-if 1.0.0", "convert_case 0.6.0", "lazy_static", - "proc-macro2 1.0.86", - "quote 1.0.36", + "proc-macro2", + "quote", "regex", "sha3", "syn 1.0.109", - "syn-solidity 0.3.1", + "syn-solidity", ] [[package]] name = "stylus-sdk" -version = "0.5.0" +version = "0.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f4424e5f067b1b0922a4294efc01acaa1e36bfc7b31e6b0aed33d7221680f974" +checksum = "26042693706e29fb7e3cf3d71c99534ac97fca98b6f81ba77ab658022ab2e210" dependencies = [ - "alloy-primitives 0.3.3", - "alloy-sol-types 0.3.1", + "alloy-primitives", + "alloy-sol-types", "cfg-if 1.0.0", "derivative", "hex", @@ -3566,25 +3556,14 @@ version = "2.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "13c2bddecc57b384dee18652358fb23172facb8a2c51ccc10d74c157bdea3292" -[[package]] -name = "syn" -version = "0.15.44" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9ca4b3b69a77cbe1ffc9e198781b7acb0c7365a883670e8f1c1bc66fba79a5c5" -dependencies = [ - "proc-macro2 0.4.30", - "quote 0.6.13", - "unicode-xid", -] - [[package]] name = "syn" version = "1.0.109" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "72b64191b275b66ffe2469e8af2c1cfe3bafa67b529ead792a6d0160888b4237" dependencies = [ - "proc-macro2 1.0.86", - "quote 1.0.36", + "proc-macro2", + "quote", "unicode-ident", ] @@ -3594,22 +3573,11 @@ version = "2.0.68" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "901fa70d88b9d6c98022e23b4136f9f3e54e4662c3bc1bd1d84a42a9a0f0c1e9" dependencies = [ - "proc-macro2 1.0.86", - "quote 1.0.36", + "proc-macro2", + "quote", "unicode-ident", ] -[[package]] -name = "syn-solidity" -version = "0.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e5f995d2140b0f751dbe94365be2591edbf3d1b75dcfaeac14183abbd2ff07bd" -dependencies = [ - "proc-macro2 1.0.86", - "quote 1.0.36", - "syn 2.0.68", -] - [[package]] name = "syn-solidity" version = "0.7.6" @@ -3617,8 +3585,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8d71e19bca02c807c9faa67b5a47673ff231b6e7449b251695188522f1dc44b2" dependencies = [ "paste", - "proc-macro2 1.0.86", - "quote 1.0.36", + "proc-macro2", + "quote", "syn 2.0.68", ] @@ -3667,8 +3635,8 @@ version = "1.0.61" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "46c3384250002a6d5af4d114f2845d37b57521033f30d5c3f46c4d70e1197533" dependencies = [ - "proc-macro2 1.0.86", - "quote 1.0.36", + "proc-macro2", + "quote", "syn 2.0.68", ] @@ -3730,8 +3698,8 @@ version = "2.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5f5ae998a069d4b5aba8ee9dad856af7d520c3699e6159b185c2acd48155d39a" dependencies = [ - "proc-macro2 1.0.86", - "quote 1.0.36", + "proc-macro2", + "quote", "syn 2.0.68", ] @@ -3861,8 +3829,8 @@ version = "0.1.27" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "34704c8d6ebcbc939824180af020566b01a7c01f80641264eba0999f6c2b6be7" dependencies = [ - "proc-macro2 1.0.86", - "quote 1.0.36", + "proc-macro2", + "quote", "syn 2.0.68", ] @@ -3899,6 +3867,7 @@ version = "0.9.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "76f64bba2c53b04fcab63c01a7d7427eadc821e3bc48c34dc9ba29c501164b52" dependencies = [ + "arbitrary", "byteorder", "crunchy", "hex", @@ -3944,12 +3913,6 @@ version = "0.1.13" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0336d538f7abc86d282a4189614dfaa90810dfc2c6f6427eaf88e16311dd225d" -[[package]] -name = "unicode-xid" -version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fc72304796d0818e357ead4e000d19c9c174ab23dc11093ac919054d20a6a7fc" - [[package]] name = "url" version = "2.5.2" @@ -4044,8 +4007,8 @@ dependencies = [ "bumpalo", "log", "once_cell", - "proc-macro2 1.0.86", - "quote 1.0.36", + "proc-macro2", + "quote", "syn 2.0.68", "wasm-bindgen-shared", ] @@ -4068,8 +4031,8 @@ version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c5020cfa87c7cecefef118055d44e3c1fc122c7ec25701d528ee458a0b45f38f" dependencies = [ - "proc-macro2 1.0.86", - "quote 1.0.36", + "proc-macro2", + "quote", "syn 1.0.109", ] @@ -4091,7 +4054,7 @@ version = "0.2.92" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a1f8823de937b71b9460c0c34e25f3da88250760bec0ebac694b49997550d726" dependencies = [ - "quote 1.0.36", + "quote", "wasm-bindgen-macro-support", ] @@ -4101,8 +4064,8 @@ version = "0.2.92" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e94f17b526d0a461a191c78ea52bbce64071ed5c04c9ffe424dcb38f74171bb7" dependencies = [ - "proc-macro2 1.0.86", - "quote 1.0.36", + "proc-macro2", + "quote", "syn 2.0.68", "wasm-bindgen-backend", "wasm-bindgen-shared", @@ -4200,8 +4163,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "97901fdbaae383dbb90ea162cc3a76a9fa58ac39aec7948b4c0b9bbef9307738" dependencies = [ "proc-macro-error", - "proc-macro2 1.0.86", - "quote 1.0.36", + "proc-macro2", + "quote", "syn 1.0.109", ] @@ -4558,8 +4521,8 @@ version = "0.7.34" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "15e934569e47891f7d9411f1a451d947a60e000ab3bd24fbb970f000387d1b3b" dependencies = [ - "proc-macro2 1.0.86", - "quote 1.0.36", + "proc-macro2", + "quote", "syn 2.0.68", ] @@ -4578,7 +4541,7 @@ version = "1.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ce36e65b0d2999d2aafac989fb249189a141aee1f53c612c1f37d72631959f69" dependencies = [ - "proc-macro2 1.0.86", - "quote 1.0.36", + "proc-macro2", + "quote", "syn 2.0.68", ] diff --git a/Cargo.toml b/Cargo.toml index 5e0d14f7..f196fd18 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -60,11 +60,11 @@ all = "warn" [workspace.dependencies] # stylus-related -stylus-sdk = { version = "=0.5.0", default-features = false } -stylus-proc = { version = "=0.5.0", default-features = false } +stylus-sdk = { version = "=0.6.0", default-features = false } +stylus-proc = { version = "=0.6.0", default-features = false } mini-alloc = "0.4.2" -alloy = { version = "0.1.1", features = [ +alloy = { version = "0.1.4", features = [ "contract", "network", "providers", @@ -77,8 +77,8 @@ alloy = { version = "0.1.1", features = [ # Even though `alloy` includes `alloy-primitives` and `alloy-sol-types` we need # to keep both versions for compatibility with the Stylus SDK. Once they start # using `alloy` we can remove these. -alloy-primitives = { version = "0.3.1", default-features = false } -alloy-sol-types = { version = "0.3.1", default-features = false } +alloy-primitives = { version = "0.7.6", default-features = false } +alloy-sol-types = { version = "0.7.6", default-features = false } const-hex = { version = "1.11.1", default-features = false } eyre = "0.6.8" diff --git a/benches/Cargo.toml b/benches/Cargo.toml index c6b5c745..921de2f6 100644 --- a/benches/Cargo.toml +++ b/benches/Cargo.toml @@ -8,7 +8,7 @@ version = "0.0.0" [dependencies] openzeppelin-stylus = { path = "../contracts" } -alloy-primitives.workspace = true +alloy-primitives = { workspace = true, features = ["tiny-keccak"] } alloy.workspace = true tokio.workspace = true eyre.workspace = true diff --git a/contracts/src/access/control.rs b/contracts/src/access/control.rs index c3ca0e22..7d5a7cf5 100644 --- a/contracts/src/access/control.rs +++ b/contracts/src/access/control.rs @@ -45,7 +45,7 @@ use alloy_sol_types::sol; use stylus_proc::SolidityError; use stylus_sdk::{ evm, msg, - stylus_proc::{external, sol_storage}, + stylus_proc::{public, sol_storage}, }; sol! { @@ -115,7 +115,7 @@ sol_storage! { } } -#[external] +#[public] impl AccessControl { /// The default admin role. `[0; 32]` by default. pub const DEFAULT_ADMIN_ROLE: [u8; 32] = [0; 32]; @@ -286,9 +286,9 @@ impl AccessControl { let previous_admin_role = self.get_role_admin(role); self._roles.setter(role).admin_role.set(new_admin_role); evm::log(RoleAdminChanged { - role: *role, - previous_admin_role: *previous_admin_role, - new_admin_role: *new_admin_role, + role, + previous_admin_role, + new_admin_role, }); } @@ -311,10 +311,7 @@ impl AccessControl { ) -> Result<(), Error> { if !self.has_role(role, account) { return Err(Error::UnauthorizedAccount( - AccessControlUnauthorizedAccount { - account, - needed_role: *role, - }, + AccessControlUnauthorizedAccount { account, needed_role: role }, )); } @@ -340,11 +337,7 @@ impl AccessControl { false } else { self._roles.setter(role).has_role.insert(account, true); - evm::log(RoleGranted { - role: *role, - account, - sender: msg::sender(), - }); + evm::log(RoleGranted { role, account, sender: msg::sender() }); true } } @@ -366,11 +359,7 @@ impl AccessControl { pub fn _revoke_role(&mut self, role: B256, account: Address) -> bool { if self.has_role(role, account) { self._roles.setter(role).has_role.insert(account, false); - evm::log(RoleRevoked { - role: *role, - account, - sender: msg::sender(), - }); + evm::log(RoleRevoked { role, account, sender: msg::sender() }); true } else { false diff --git a/contracts/src/access/ownable.rs b/contracts/src/access/ownable.rs index 7c51d191..01a56369 100644 --- a/contracts/src/access/ownable.rs +++ b/contracts/src/access/ownable.rs @@ -13,7 +13,7 @@ use alloy_sol_types::sol; use stylus_proc::SolidityError; use stylus_sdk::{ evm, msg, - stylus_proc::{external, sol_storage}, + stylus_proc::{public, sol_storage}, }; sol! { @@ -54,7 +54,7 @@ sol_storage! { } } -#[external] +#[public] impl Ownable { /// Returns the address of the current owner. pub fn owner(&self) -> Address { diff --git a/contracts/src/token/erc20/extensions/capped.rs b/contracts/src/token/erc20/extensions/capped.rs index 5329038a..40fdea92 100644 --- a/contracts/src/token/erc20/extensions/capped.rs +++ b/contracts/src/token/erc20/extensions/capped.rs @@ -7,7 +7,7 @@ use alloy_primitives::U256; use alloy_sol_types::sol; -use stylus_proc::{external, sol_storage, SolidityError}; +use stylus_proc::{public, sol_storage, SolidityError}; sol! { /// Indicates an error related to the operation that failed @@ -43,7 +43,7 @@ sol_storage! { } } -#[external] +#[public] impl Capped { /// Returns the cap on the token's total supply. pub fn cap(&self) -> U256 { diff --git a/contracts/src/token/erc20/extensions/metadata.rs b/contracts/src/token/erc20/extensions/metadata.rs index f3db7420..4035f558 100644 --- a/contracts/src/token/erc20/extensions/metadata.rs +++ b/contracts/src/token/erc20/extensions/metadata.rs @@ -2,7 +2,7 @@ use alloc::string::String; -use stylus_proc::{external, sol_storage}; +use stylus_proc::{public, sol_storage}; /// Number of decimals used by default on implementors of [`Metadata`]. pub const DEFAULT_DECIMALS: u8 = 18; @@ -59,7 +59,7 @@ pub trait IErc20Metadata { // FIXME: Apply multi-level inheritance to export Metadata's functions. // With the current version of SDK it is not possible. // See https://github.com/OffchainLabs/stylus-sdk-rs/pull/120 -#[external] +#[public] impl IErc20Metadata for Erc20Metadata { fn name(&self) -> String { self._metadata.name() diff --git a/contracts/src/token/erc20/extensions/permit.rs b/contracts/src/token/erc20/extensions/permit.rs index 00537371..0e57300d 100644 --- a/contracts/src/token/erc20/extensions/permit.rs +++ b/contracts/src/token/erc20/extensions/permit.rs @@ -11,7 +11,7 @@ //! and thus is not required to hold Ether at all. use alloy_primitives::{b256, keccak256, Address, B256, U256}; use alloy_sol_types::{sol, SolType}; -use stylus_proc::{external, sol_storage, SolidityError}; +use stylus_proc::{public, sol_storage, SolidityError}; use stylus_sdk::{block, prelude::StorageType, storage::TopLevelStorage}; use crate::{ @@ -77,7 +77,7 @@ sol_storage! { /// BorrowMut)`. Should be fixed in the future by the Stylus team. unsafe impl TopLevelStorage for Erc20Permit {} -#[external] +#[public] impl Erc20Permit { /// Returns the current nonce for `owner`. /// @@ -156,7 +156,7 @@ impl Erc20Permit { return Err(ERC2612ExpiredSignature { deadline }.into()); } - let struct_hash = keccak256(StructHashTuple::encode_params(&( + let struct_hash = keccak256(StructHashTuple::abi_encode(&( *PERMIT_TYPEHASH, owner, spender, diff --git a/contracts/src/token/erc20/mod.rs b/contracts/src/token/erc20/mod.rs index 240d93bb..5f9629af 100644 --- a/contracts/src/token/erc20/mod.rs +++ b/contracts/src/token/erc20/mod.rs @@ -10,7 +10,7 @@ use stylus_proc::SolidityError; use stylus_sdk::{ call::MethodError, evm, msg, - stylus_proc::{external, sol_storage}, + stylus_proc::{public, sol_storage}, }; pub mod extensions; @@ -238,7 +238,7 @@ pub trait IErc20 { ) -> Result; } -#[external] +#[public] impl IErc20 for Erc20 { type Error = Error; diff --git a/contracts/src/token/erc721/extensions/consecutive.rs b/contracts/src/token/erc721/extensions/consecutive.rs index 51ee0cf4..35a88440 100644 --- a/contracts/src/token/erc721/extensions/consecutive.rs +++ b/contracts/src/token/erc721/extensions/consecutive.rs @@ -26,7 +26,7 @@ use alloc::vec; use alloy_primitives::{uint, Address, U256}; use alloy_sol_types::sol; -use stylus_proc::{external, sol_storage, SolidityError}; +use stylus_proc::{public, sol_storage, SolidityError}; use stylus_sdk::{abi::Bytes, evm, msg, prelude::TopLevelStorage}; use crate::{ @@ -131,7 +131,7 @@ unsafe impl TopLevelStorage for Erc721Consecutive {} // ************** ERC-721 External ************** -#[external] +#[public] impl IErc721 for Erc721Consecutive { type Error = Error; @@ -168,7 +168,7 @@ impl IErc721 for Erc721Consecutive { from, to, token_id, - &data, + data, )?) } @@ -547,7 +547,7 @@ impl Erc721Consecutive { Address::ZERO, to, token_id, - &data, + data, )?) } @@ -700,7 +700,7 @@ impl Erc721Consecutive { from, to, token_id, - &data, + data, )?) } diff --git a/contracts/src/token/erc721/extensions/enumerable.rs b/contracts/src/token/erc721/extensions/enumerable.rs index 41604064..263f676a 100644 --- a/contracts/src/token/erc721/extensions/enumerable.rs +++ b/contracts/src/token/erc721/extensions/enumerable.rs @@ -12,7 +12,7 @@ use alloy_primitives::{uint, Address, U256}; use alloy_sol_types::sol; -use stylus_proc::{external, sol_storage, SolidityError}; +use stylus_proc::{public, sol_storage, SolidityError}; use crate::token::{erc721, erc721::IErc721}; @@ -114,7 +114,7 @@ pub trait IErc721Enumerable { fn token_by_index(&self, index: U256) -> Result; } -#[external] +#[public] impl IErc721Enumerable for Erc721Enumerable { type Error = Error; diff --git a/contracts/src/token/erc721/extensions/metadata.rs b/contracts/src/token/erc721/extensions/metadata.rs index 9bb5b34a..5b315bf4 100644 --- a/contracts/src/token/erc721/extensions/metadata.rs +++ b/contracts/src/token/erc721/extensions/metadata.rs @@ -2,7 +2,7 @@ use alloc::string::String; -use stylus_proc::{external, sol_storage}; +use stylus_proc::{public, sol_storage}; use crate::utils::Metadata; @@ -44,7 +44,7 @@ pub trait IErc721Metadata { // FIXME: Apply multi-level inheritance to export Metadata's functions. // With the current version of SDK it is not possible. // See https://github.com/OffchainLabs/stylus-sdk-rs/pull/120 -#[external] +#[public] impl IErc721Metadata for Erc721Metadata { fn name(&self) -> String { self._metadata.name() diff --git a/contracts/src/token/erc721/extensions/uri_storage.rs b/contracts/src/token/erc721/extensions/uri_storage.rs index fd5ad0ba..f5afc180 100644 --- a/contracts/src/token/erc721/extensions/uri_storage.rs +++ b/contracts/src/token/erc721/extensions/uri_storage.rs @@ -5,7 +5,7 @@ use alloc::string::String; use alloy_primitives::U256; use alloy_sol_types::sol; -use stylus_proc::{external, sol_storage}; +use stylus_proc::{public, sol_storage}; use stylus_sdk::evm; sol! { @@ -48,7 +48,7 @@ impl Erc721UriStorage { } } -#[external] +#[public] impl Erc721UriStorage { /// Returns the Uniform Resource Identifier (URI) for `token_id` token. /// diff --git a/contracts/src/token/erc721/mod.rs b/contracts/src/token/erc721/mod.rs index 30fdef3d..119422f1 100644 --- a/contracts/src/token/erc721/mod.rs +++ b/contracts/src/token/erc721/mod.rs @@ -462,7 +462,7 @@ pub trait IErc721 { fn is_approved_for_all(&self, owner: Address, operator: Address) -> bool; } -#[external] +#[public] impl IErc721 for Erc721 { type Error = Error; @@ -497,7 +497,7 @@ impl IErc721 for Erc721 { data: Bytes, ) -> Result<(), Error> { self.transfer_from(from, to, token_id)?; - self._check_on_erc721_received(msg::sender(), from, to, token_id, &data) + self._check_on_erc721_received(msg::sender(), from, to, token_id, data) } fn transfer_from( @@ -814,7 +814,7 @@ impl Erc721 { Address::ZERO, to, token_id, - &data, + data, ) } @@ -955,7 +955,7 @@ impl Erc721 { data: Bytes, ) -> Result<(), Error> { self._transfer(from, to, token_id)?; - self._check_on_erc721_received(msg::sender(), from, to, token_id, &data) + self._check_on_erc721_received(msg::sender(), from, to, token_id, data) } /// Approve `to` to operate on `token_id`. @@ -1101,7 +1101,7 @@ impl Erc721 { from: Address, to: Address, token_id: U256, - data: &Bytes, + data: Bytes, ) -> Result<(), Error> { const RECEIVER_FN_SELECTOR: FixedBytes<4> = fixed_bytes!("150b7a02"); @@ -1111,9 +1111,13 @@ impl Erc721 { let receiver = IERC721Receiver::new(to); let call = Call::new_in(self); - let data = data.to_vec(); - let result = - receiver.on_erc_721_received(call, operator, from, token_id, data); + let result = receiver.on_erc_721_received( + call, + operator, + from, + token_id, + data.to_vec().into(), + ); let id = match result { Ok(id) => id, diff --git a/contracts/src/utils/cryptography/ecdsa.rs b/contracts/src/utils/cryptography/ecdsa.rs index 0bf4659a..e667393d 100644 --- a/contracts/src/utils/cryptography/ecdsa.rs +++ b/contracts/src/utils/cryptography/ecdsa.rs @@ -170,8 +170,8 @@ fn _recover( /// * `r` - `r` value from the signature. /// * `s` - `s` value from the signature. fn encode_calldata(hash: B256, v: u8, r: B256, s: B256) -> Vec { - let calldata = EcRecoverData { hash: *hash, v, r: *r, s: *s }; - EcRecoverData::encode(&calldata) + let calldata = EcRecoverData { hash, v, r, s }; + EcRecoverData::abi_encode(&calldata) } /// Validates the `s` value of a signature. @@ -207,7 +207,7 @@ fn encode_calldata(hash: B256, v: u8, r: B256, s: B256) -> Vec { fn check_if_malleable(s: &B256) -> Result<(), Error> { let s_u256 = U256::from_be_slice(s.as_slice()); if s_u256 > SIGNATURE_S_UPPER_BOUND { - return Err(ECDSAInvalidSignatureS { s: **s }.into()); + return Err(ECDSAInvalidSignatureS { s: *s }.into()); } Ok(()) } diff --git a/contracts/src/utils/cryptography/eip712.rs b/contracts/src/utils/cryptography/eip712.rs index 2dab05fd..4a13e1ab 100644 --- a/contracts/src/utils/cryptography/eip712.rs +++ b/contracts/src/utils/cryptography/eip712.rs @@ -110,7 +110,7 @@ pub trait IEip712 { /// /// * `&self` - Read access to the contract's state. fn domain_separator_v4(&self) -> B256 { - let encoded = DomainSeparatorTuple::encode(&( + let encoded = DomainSeparatorTuple::abi_encode(&( TYPE_HASH, Self::HASHED_NAME, Self::HASHED_VERSION, diff --git a/contracts/src/utils/metadata.rs b/contracts/src/utils/metadata.rs index b9ff5070..de3e83f8 100644 --- a/contracts/src/utils/metadata.rs +++ b/contracts/src/utils/metadata.rs @@ -1,7 +1,7 @@ //! Common Metadata Smart Contract. use alloc::string::String; -use stylus_proc::{external, sol_storage}; +use stylus_proc::{public, sol_storage}; sol_storage! { /// Metadata of the token. @@ -13,7 +13,7 @@ sol_storage! { } } -#[external] +#[public] impl Metadata { /// Returns the name of the token. /// diff --git a/contracts/src/utils/nonces.rs b/contracts/src/utils/nonces.rs index 6426429a..da02be73 100644 --- a/contracts/src/utils/nonces.rs +++ b/contracts/src/utils/nonces.rs @@ -4,7 +4,7 @@ use alloy_primitives::{uint, Address, U256}; use alloy_sol_types::sol; -use stylus_proc::{external, sol_storage, SolidityError}; +use stylus_proc::{public, sol_storage, SolidityError}; const ONE: U256 = uint!(1_U256); @@ -30,7 +30,7 @@ sol_storage! { } } -#[external] +#[public] impl Nonces { /// Returns the unused nonce for the given account. /// diff --git a/contracts/src/utils/pausable.rs b/contracts/src/utils/pausable.rs index d838ac60..a49aec77 100644 --- a/contracts/src/utils/pausable.rs +++ b/contracts/src/utils/pausable.rs @@ -11,7 +11,7 @@ //! only once the modifiers are put in place. use alloy_sol_types::sol; -use stylus_proc::{external, sol_storage, SolidityError}; +use stylus_proc::{public, sol_storage, SolidityError}; use stylus_sdk::{evm, msg}; sol! { @@ -57,7 +57,7 @@ sol_storage! { } } -#[external] +#[public] impl Pausable { /// Returns true if the contract is paused, and false otherwise. /// diff --git a/examples/access-control/src/lib.rs b/examples/access-control/src/lib.rs index 20dba96e..dc7e416a 100644 --- a/examples/access-control/src/lib.rs +++ b/examples/access-control/src/lib.rs @@ -8,7 +8,7 @@ use openzeppelin_stylus::{ access::control::AccessControl, token::erc20::{Erc20, IErc20}, }; -use stylus_sdk::prelude::{entrypoint, external, sol_storage}; +use stylus_sdk::prelude::{entrypoint, public, sol_storage}; sol_storage! { #[entrypoint] @@ -26,7 +26,7 @@ pub const TRANSFER_ROLE: [u8; 32] = [ 166, 190, 60, 19, 139, 159, 191, 0, 55, 82, 164, 200, 188, 232, 111, 108, ]; -#[external] +#[public] #[inherit(Erc20, AccessControl)] impl AccessControlExample { pub const TRANSFER_ROLE: [u8; 32] = TRANSFER_ROLE; diff --git a/examples/basic/token/src/lib.rs b/examples/basic/token/src/lib.rs index c237d8b6..6510b223 100644 --- a/examples/basic/token/src/lib.rs +++ b/examples/basic/token/src/lib.rs @@ -5,7 +5,7 @@ use alloc::vec::Vec; use alloy_primitives::{Address, U256}; use openzeppelin_stylus::token::erc20::{extensions::Erc20Metadata, Erc20}; -use stylus_sdk::prelude::{entrypoint, external, sol_storage}; +use stylus_sdk::prelude::{entrypoint, public, sol_storage}; sol_storage! { #[entrypoint] @@ -17,7 +17,7 @@ sol_storage! { } } -#[external] +#[public] #[inherit(Erc20, Erc20Metadata)] impl Erc20Example { pub fn mint( diff --git a/examples/ecdsa/src/lib.rs b/examples/ecdsa/src/lib.rs index 327dcdf1..7f31e621 100644 --- a/examples/ecdsa/src/lib.rs +++ b/examples/ecdsa/src/lib.rs @@ -5,14 +5,14 @@ use alloc::vec::Vec; use alloy_primitives::{Address, B256}; use openzeppelin_stylus::utils::cryptography::ecdsa; -use stylus_sdk::prelude::{entrypoint, external, sol_storage}; +use stylus_sdk::prelude::{entrypoint, public, sol_storage}; sol_storage! { #[entrypoint] struct ECDSAExample {} } -#[external] +#[public] impl ECDSAExample { pub fn recover( &mut self, diff --git a/examples/erc20-permit/src/lib.rs b/examples/erc20-permit/src/lib.rs index 599e40d3..6853704b 100644 --- a/examples/erc20-permit/src/lib.rs +++ b/examples/erc20-permit/src/lib.rs @@ -7,7 +7,7 @@ use alloy_primitives::{Address, U256}; use openzeppelin_stylus::{ token::erc20::extensions::Erc20Permit, utils::cryptography::eip712::IEip712, }; -use stylus_sdk::prelude::{entrypoint, external, sol_storage}; +use stylus_sdk::prelude::{entrypoint, public, sol_storage}; sol_storage! { #[entrypoint] @@ -24,7 +24,7 @@ impl IEip712 for Eip712 { const VERSION: &'static str = "1"; } -#[external] +#[public] #[inherit(Erc20Permit)] impl Erc20PermitExample { // Add token minting feature. diff --git a/examples/erc20/src/lib.rs b/examples/erc20/src/lib.rs index de212eef..407e87d0 100644 --- a/examples/erc20/src/lib.rs +++ b/examples/erc20/src/lib.rs @@ -11,7 +11,7 @@ use openzeppelin_stylus::{ }, utils::Pausable, }; -use stylus_sdk::prelude::{entrypoint, external, sol_storage}; +use stylus_sdk::prelude::{entrypoint, public, sol_storage}; const DECIMALS: u8 = 10; @@ -29,7 +29,7 @@ sol_storage! { } } -#[external] +#[public] #[inherit(Erc20, Erc20Metadata, Capped, Pausable)] impl Erc20Example { // Overrides the default [`Metadata::decimals`], and sets it to `10`. diff --git a/examples/erc20/tests/erc20.rs b/examples/erc20/tests/erc20.rs index 86256b43..cc82c8de 100644 --- a/examples/erc20/tests/erc20.rs +++ b/examples/erc20/tests/erc20.rs @@ -2,10 +2,9 @@ use abi::Erc20; use alloy::{ - primitives::{Address, U256}, + primitives::{uint, Address, U256}, sol, }; -use alloy_primitives::uint; use e2e::{ receipt, send, watch, Account, EventExt, Panic, PanicCode, ReceiptExt, Revert, diff --git a/examples/erc721-consecutive/src/lib.rs b/examples/erc721-consecutive/src/lib.rs index d847499e..cb14ef03 100644 --- a/examples/erc721-consecutive/src/lib.rs +++ b/examples/erc721-consecutive/src/lib.rs @@ -15,7 +15,7 @@ sol_storage! { } } -#[external] +#[public] #[inherit(Erc721Consecutive)] impl Erc721ConsecutiveExample { pub fn burn(&mut self, token_id: U256) -> Result<(), Error> { diff --git a/examples/erc721-metadata/src/lib.rs b/examples/erc721-metadata/src/lib.rs index 2dea5e55..006efa56 100644 --- a/examples/erc721-metadata/src/lib.rs +++ b/examples/erc721-metadata/src/lib.rs @@ -14,7 +14,7 @@ use openzeppelin_stylus::token::erc721::{ }, Erc721, IErc721, }; -use stylus_sdk::prelude::{entrypoint, external, sol_storage}; +use stylus_sdk::prelude::{entrypoint, public, sol_storage}; sol_storage! { #[entrypoint] @@ -28,7 +28,7 @@ sol_storage! { } } -#[external] +#[public] #[inherit(Erc721, Metadata, UriStorage)] impl Erc721MetadataExample { pub fn mint(&mut self, to: Address, token_id: U256) -> Result<(), Vec> { diff --git a/examples/erc721/src/lib.rs b/examples/erc721/src/lib.rs index fe873815..8d2a4d62 100644 --- a/examples/erc721/src/lib.rs +++ b/examples/erc721/src/lib.rs @@ -13,7 +13,7 @@ use openzeppelin_stylus::{ }; use stylus_sdk::{ abi::Bytes, - prelude::{entrypoint, external, sol_storage}, + prelude::{entrypoint, public, sol_storage}, }; sol_storage! { @@ -28,7 +28,7 @@ sol_storage! { } } -#[external] +#[public] #[inherit(Erc721, Enumerable, Pausable)] impl Erc721Example { pub fn burn(&mut self, token_id: U256) -> Result<(), Vec> { diff --git a/examples/erc721/tests/erc721.rs b/examples/erc721/tests/erc721.rs index a9356ccf..b8bf68fd 100644 --- a/examples/erc721/tests/erc721.rs +++ b/examples/erc721/tests/erc721.rs @@ -1,8 +1,7 @@ #![cfg(feature = "e2e")] use abi::Erc721; -use alloy::primitives::{fixed_bytes, Address, Bytes, U256}; -use alloy_primitives::uint; +use alloy::primitives::{fixed_bytes, uint, Address, Bytes, U256}; use e2e::{receipt, send, watch, Account, EventExt, ReceiptExt, Revert}; use mock::{receiver, receiver::ERC721ReceiverMock}; diff --git a/examples/merkle-proofs/src/lib.rs b/examples/merkle-proofs/src/lib.rs index ff466774..2fab9264 100644 --- a/examples/merkle-proofs/src/lib.rs +++ b/examples/merkle-proofs/src/lib.rs @@ -11,7 +11,7 @@ use openzeppelin_crypto::{ use stylus_proc::SolidityError; use stylus_sdk::{ alloy_sol_types::sol, - prelude::{entrypoint, external, sol_storage}, + prelude::{entrypoint, public, sol_storage}, }; #[global_allocator] @@ -61,7 +61,7 @@ sol_storage! { struct VerifierContract { } } -#[external] +#[public] impl VerifierContract { pub fn verify(&self, proof: Vec, root: B256, leaf: B256) -> bool { let proof: Vec<[u8; 32]> = proof.into_iter().map(|m| *m).collect(); diff --git a/examples/ownable/src/lib.rs b/examples/ownable/src/lib.rs index 7cad28fb..43d1aef2 100644 --- a/examples/ownable/src/lib.rs +++ b/examples/ownable/src/lib.rs @@ -8,7 +8,7 @@ use openzeppelin_stylus::{ access::ownable::Ownable, token::erc20::{Erc20, IErc20}, }; -use stylus_sdk::prelude::{entrypoint, external, sol_storage}; +use stylus_sdk::prelude::{entrypoint, public, sol_storage}; sol_storage! { #[entrypoint] @@ -20,7 +20,7 @@ sol_storage! { } } -#[external] +#[public] #[inherit(Erc20, Ownable)] impl OwnableExample { pub fn transfer( diff --git a/scripts/check-wasm.sh b/scripts/check-wasm.sh index 1f6ce078..9ec839dd 100755 --- a/scripts/check-wasm.sh +++ b/scripts/check-wasm.sh @@ -12,7 +12,7 @@ check_wasm () { echo echo "Checking contract $CONTRACT_CRATE_NAME" - cargo stylus check --wasm-file ./target/wasm32-unknown-unknown/release/"$CONTRACT_BIN_NAME" --no-verify + cargo stylus check --wasm-file ./target/wasm32-unknown-unknown/release/"$CONTRACT_BIN_NAME" } # Retrieve all alphanumeric contract's crate names in `./examples` directory.