Skip to content

Commit

Permalink
Fix examples and doctest (#219)
Browse files Browse the repository at this point in the history
* Move stylus-test to dev-dependencies

This change avoids compiling the test and its dependencies on the wasm
target. This was leading to a compile error because a nested dependency
required to set a explicit feature for wasm.

* Fix testing import in doctest

This happends due to a limitation of doctest. See:
rust-lang/rust#67295

* Update single call example

* Fix transfer_eth doctest

* Fix erc20 example

* Add TopLevelStorage to prelude

* Fix erc721 example
  • Loading branch information
gligneul authored Feb 5, 2025
1 parent 8c2493a commit b8af63d
Show file tree
Hide file tree
Showing 16 changed files with 165 additions and 96 deletions.
69 changes: 44 additions & 25 deletions examples/erc20/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions examples/erc20/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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" }

Expand Down
4 changes: 3 additions & 1 deletion examples/erc20/src/main.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
#![cfg_attr(not(feature = "export-abi"), no_main)]

#[cfg(feature = "export-abi")]
fn main() {
erc20::print_abi("MIT-OR-APACHE-2.0", "pragma solidity ^0.8.23;");
}
}
69 changes: 44 additions & 25 deletions examples/erc721/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions examples/erc721/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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" }

Expand Down
Loading

0 comments on commit b8af63d

Please sign in to comment.