OffchainLabs / awesome-stylus

A curated list of Arbitrum Stylus code examples, libraries and resources

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Awesome Stylus

A curated list of Arbitrum Stylus code examples, libraries, projects and resources.

Guides

Videos

Tools

  • Stylus Playground - An online playground for building, compiling and testing Stylus smart contracts
  • Zig Stylus - Zig SDK for Stylus smart contracts
  • stylus-toolkit - A toolkit of Stylus primitives and examples of their usage
  • Stylus Suite - Manage your Stylus projects with this Vs Code extension. Call cargo stylus methods with simple user interface, use pre defined snippets, chat with Stylus GPT and many more

Libraries

  • Inkmate - Gas-efficient smart contracts written in Rust, including ERC20 and ERC721
  • Rustmate - Blazing fast, modern, and optimized Rust building blocks for smart contract development using Stylus
  • OpenStylus - Modular and gas-optimized smart contract libraries and frameworks for Stylus smart contract development

Examples

Further examples (created using an older cargo-stylus version and an older stylus-sdk version)

⚠️ IMPORTANT: These examples were created using an older version of cargo-stylus (v0.1.x or v0.2.x), and with an older stylus-sdk version (< v0.5.0) and might not be compatible with recent versions of cargo-stylus without making some modifications to the source code.

Examples built with cargo-stylus v0.1.x

How to make this code compatible with cargo-stylus v0.3.x and stylus-sdk v0.5.0

When trying to use the latest version of cargo stylus on a project created first on cs v0.1.x you might run into this error:

error: no library targets found in package `your-package-name`

Here are some tips for making this code compatible with the latest version:

  • Use lib.rs instead of main.rs for the main logic of your program
  • Add also a [lib] target to your Cargo.toml file if you don't have one
  • Update the stylus-sdk version used to v0.5.0
  • Modify the function names from camelCase to snake_case

Examples built with cargo-stylus v0.2.x

  • Zk-sunade [cs v0.2.x] - An optimized , handwritten implementation of Groth16 using Arbitrum Stylus
  • Stylus Proxy [cs v0.2.x] - An example contract for implementing minimal proxy pattern in Stylus
  • Stylus AssemblyScript Example [cs v0.2.x] - Sieve of Erathosthenes implemented with AssemblyScript

How to make this code compatible with cargo-stylus v0.3.x and stylus-sdk v0.5.0

When trying to use the latest version of cargo stylus on a project created first on cs v0.2.x you might run into this error:

missing import pay_for_memory_grow

To make the code compatible with the latest version, you might need to update the stylus-sdk version used to v0.5.0

About

A curated list of Arbitrum Stylus code examples, libraries and resources

License:MIT License