diff --git a/arbitrum-docs/stylus/concepts/how-it-works.md b/arbitrum-docs/stylus/concepts/how-it-works.md
new file mode 100644
index 000000000..42c37f581
--- /dev/null
+++ b/arbitrum-docs/stylus/concepts/how-it-works.md
@@ -0,0 +1,70 @@
+---
+id: how-it-works
+title: 'How Stylus works'
+sidebar_label: 'How Stylus works'
+description: 'Learn what powers Stylus'
+author: srinjoyc
+SME: srinjoyc
+user_story: As an Ethereum developer/project owner, I need to vet the Stylus.
+content_type: concept
+---
+
+There are four main steps for bringing a Stylus program to life: **coding, activation, execution, and proving**.
+
+## Coding
+
+Developers can now write smart contracts in any programming language that compiles to WASM.
+
+:::note
+Some high-level languages generate far more performant WASMs than others.
+:::
+
+Initially, there will be support for Rust, C, and C++. However, the levels of support will vary. Rust has rich language support from day one, with an open-source SDK that makes writing smart contracts in Rust as easy as possible. C and C++ are supported off the bat, enabling the deployment of existing contracts in those languages on-chain with minimal modifications.
+
+The Stylus SDK for Rust contains the smart contract development framework and language features most developers will need to use in Stylus. The SDK also makes it possible to perform all EVM-specific functionalities that smart contract developers use. Check out the [Rust SDK Guide](https://docs.arbitrum.io/stylus/rust-sdk-guide) and the [Crate Docs](https://docs.rs/stylus-sdk/latest/stylus_sdk/index.html).
+
+## Activation
+
+Stylus programs are compiled to WASM, and then lowered to assembly. Starting from a high-level language (such as Rust, C, or C++), the first compilation stage happens using the CLI provided in the Stylus SDK for Rust or any other compiler, such as Clang for C and C++. Once compiled, the WASM is posted onchain. Then, in an activation process, WASM gets lowered to a node's native machine code (such as ARM or x86).
+
+Activating a Stylus program requires a new precompile, ArbWasm. This precompile produces efficient binary code tailored to a node's native assembly. During this step, a series of middlewares ensure that user programs execute safely and are deterministically fraud-proven. Instrumentation includes gas metering, depth-checking, memory charging, and more to guarantee all WASM programs are safe for the chain to execute. Stylus contracts can be called only after activation.
+
+Gas metering is essential for certifying that computational resources are paid for. In Stylus, the unit for measuring cost is called **ink**, which is similar to Ethereum's gas but thousands of times smaller. There are two reasons why a new measurement is used: First, WASM execution is so much faster than the EVM that executing thousands of WASM opcodes could be done in the same amount of time it takes the EVM to execute one. Second, the conversion rate of ink to gas can change based on future hardware or VM improvements. For a conceptual introduction to Stylus gas and ink, see [gas and ink (Stylus)](https://docs.arbitrum.io/stylus/concepts/stylus-gas).
+
+## Execution
+
+Stylus programs execute in a fork of [Wasmer](https://wasmer.io/), the leading WebAssembly runtime, with minimal changes to optimize their codebase for blockchain-specific use cases. Wasmer executes native code much faster than Geth executes EVM bytecode, contributing to the significant gas savings that Stylus provides.
+
+EVM contracts continue to execute the same way they were before Stylus. When calling a contract, the difference between an EVM contract and a WASM program is visible via an [EOF](https://notes.ethereum.org/@ipsilon/evm-object-format-overview)-inspired contract header. From there, the contract executes using its corresponding runtime. Contracts written in Solidity and WASM languages can make cross-contract calls to each other, meaning a developer never has to consider which language the contract is in. Everything is interoperable.
+
+## Proving
+
+Nitro operates in two modes: a "happy case" where it compiles execution history to native code, and a "sad case" during validator disputes, where it compiles execution history to WASM for interactive fraud proofs on Ethereum. Stylus builds on Nitro's fraud-proving technology, allowing it to verify both execution history and WASM programs deployed by developers.
+
+Stylus is made possible by Nitro’s ability to replay and verify disputes using WASM. Validators bisect disputes until an invalid step is identified and proven on-chain through a [“one-step proof.”](/how-arbitrum-works/fraud-proofs/challenge-manager.mdx#general-bisection-protocol). This deterministic fraud-proving capability ensures the correctness of any arbitrary program compiled to WASM. The combination of WASM's and Nitro's properties enables this technological leap we call Stylus.
+
+For more details on Nitro’s architecture, refer to the [documentation](/how-arbitrum-works/inside-arbitrum-nitro.mdx) or the [Nitro whitepaper](https://github.com/OffchainLabs/nitro/blob/master/docs/Nitro-whitepaper.pdf).
+
+## Why does this matter?
+
+Stylus innovates on many levels, with the key ones described here:
+
+### One chain, many languages
+
+There are roughly 20k Solidity developers, compared to 3 million Rust developers or 12 million C developers [[1](https://slashdatahq.medium.com/state-of-the-developer-nation-23rd-edition-the-fall-of-web-frameworks-coding-languages-711525e3df3a)]. Developers can now use their preferred programming language, which is interoperable on any Arbitrum chain with Stylus. By onboarding the next million developers, scaling to the next billion users becomes possible.
+
+### A better EVM
+
+Stylus' MultiVM brings the best of both worlds. Developers still get all of the benefits of the EVM, including the ecosystem and liquidity, while getting efficiency improvements and access to existing libraries in Rust, C, and C++, all without changing anything about how the EVM works. EVM equivalence is no longer the ceiling; it's the floor.
+
+### Cheaper execution
+
+Stylus is a more efficient execution environment than the EVM, leading directly to gas savings for complex smart contracts. Computation and memory can be significantly cheaper. Deploying cryptography libraries can be done permissionlessly as custom application layer precompiles. Use cases that are impractical in the EVM are now possible in Stylus.
+
+### Opt-in reentrancy
+
+Stylus doesn't just improve on cost and speed. WASM programs are also safer. Reentrancy is a common vulnerability developers can only attempt to mitigate in Solidity. Stylus provides cheap reentrancy detection, and using the Rust SDK, reentrancy is disabled by default unless intentionally overridden.
+
+### Fully interoperable
+
+Solidity programs and WASM programs are completely composable. If working in Solidity, a developer can call a Rust program or rely on another dependency in a different language. If working in Rust, all Solidity functionalities are accessible out of the box.
diff --git a/arbitrum-docs/stylus/recommended-libraries.md b/arbitrum-docs/stylus/recommended-libraries.md
index 3ebe933dc..11f5485db 100644
--- a/arbitrum-docs/stylus/recommended-libraries.md
+++ b/arbitrum-docs/stylus/recommended-libraries.md
@@ -1,7 +1,7 @@
---
id: recommended-libraries
title: Recommended Libraries
-sidebar_label: Recommended libraries
+sidebar_label: Use Rust Crates
---
# Recommended libraries
diff --git a/arbitrum-docs/stylus/stylus-gentle-introduction.md b/arbitrum-docs/stylus/stylus-gentle-introduction.md
index 5801c448e..fa08d4dc8 100644
--- a/arbitrum-docs/stylus/stylus-gentle-introduction.md
+++ b/arbitrum-docs/stylus/stylus-gentle-introduction.md
@@ -9,119 +9,45 @@ sidebar_position: 1
# A gentle introduction: Stylus
-This introduction is for developers who want to build on Arbitrum using popular programming languages like Rust. This capability is made possible by Stylus, a new way to write EVM-compatible smart contracts using your favorite programming languages.
-
### In a nutshell:
-- Stylus lets you write smart contracts in programming languages that compile to WASM, such as **Rust, C, C++, and many others**.
-- Rich language support already exists for Rust: you can use the Stylus SDK and CLI tool to start building today.
-- Stylus smart contracts benefit from **Arbitrum's EVM equivalence** thanks to a second, coequal WASM virtual machine.
-- Solidity contracts and Stylus contracts are fully interoperable. In Solidity, you can call a Rust program and vice versa.
-- Stylus contracts are significantly faster and have lower gas fees due to the superior efficiency of WASM programs.
-- Stylus makes it viable to consume RAM on the blockchain because it can greatly optimize memory use, enabling new use cases.
+- Stylus lets you write smart contracts in programming languages that compile to WASM, such as **Rust, C, C++, and many others**, allowing you to tap into their ecosystem of libraries and tools. Rich language and tooling support already exist for Rust. You can try the SDK and CLI with the [quickstart](https://docs.arbitrum.io/stylus/stylus-quickstart).
+- Solidity contracts and Stylus contracts are fully interoperable. In Solidity, you can call a Rust program and vice versa, thanks to a second, coequal WASM virtual machine.
+- Stylus contracts offer significantly faster execution and lower gas fees for memory and compute-intensive operations, thanks to the superior efficiency of WASM programs.
### What's Stylus?
-Stylus is an upgrade to Arbitrum Nitro, the tech stack powering Arbitrum One, Arbitrum Nova, and Arbitrum Orbit chains. This upgrade adds a second, coequal virtual machine to the EVM, where EVM contracts continue to behave exactly as they would in Ethereum. We call this paradigm **MultiVM** since **everything is entirely additive.**
+Stylus is an upgrade to Arbitrum Nitro [(ArbOS 32)](https://docs.arbitrum.io/run-arbitrum-node/arbos-releases/arbos32), the tech stack powering Arbitrum One, Arbitrum Nova, and Arbitrum Orbit chains. This upgrade adds a second, coequal virtual machine to the EVM, where EVM contracts continue to behave exactly as they would in Ethereum. We call this paradigm **MultiVM** since **everything is entirely additive.**
![Stylus gives you MultiVM](./assets/stylus-multivm.jpg)
This second virtual machine executes WebAssembly (WASM) rather than EVM bytecode. WASM is a modern binary format popularized by its use in major web standards, browsers, and companies to speed up computation. WASM is built to be fast, portable, and human-readable. It has sandboxed execution environments for security and simplicity. Working with WASM is nothing new for Arbitrum chains. Ever since the [Nitro upgrade](https://medium.com/offchainlabs/arbitrum-nitro-one-small-step-for-l2-one-giant-leap-for-ethereum-bc9108047450), WASM has been a fundamental component of Arbitrum's fully functioning fraud proofs.
-With a WASM VM, any programming language that can compile to WASM is within Stylus's scope. While many popular programming languages can be compiled into WASM, some compilers are more suitable for smart contract development than others, like Rust, C, and C++. Other languages like Go, Sway, Move, and Cairo can also be supported. Languages that include their own runtimes, like Python and Javascript, are more complex for Stylus to support, although not impossible. Third-party contribution in the form of libraries for new and existing languages is welcomed!
-
-Compared to using Solidity, WASM programs are much more efficient. There are many reasons for this, including the decades of compiler development for Rust and C. WASM also has a faster runtime than the EVM, resulting in faster execution.
-
-### How is this possible?
-
-Stylus is only possible because of Arbitrum Nitro's unique fraud-proving technology. When there's a dispute on an Arbitrum network, Nitro replays the execution of the chain **in WASM.** Honest Arbitrum validators will then bisect what is being disputed until a single invalid step is identified and checked on-chain via a [“one-step proof.”](/how-arbitrum-works/fraud-proofs/challenge-manager.mdx#general-bisection-protocol)
-
-Nitro's fraud-proving enables it to prove **arbitrary WASM** in a deterministic way.
-
-Because any code logic can be proven with WASM, the correctness of **any program** compiling to WASM can also be proven. The combination of WASM's and Nitro's properties enables this technological leap we call Stylus.
-
-For a detailed overview of Nitro's technical architecture, see the [documentation](/how-arbitrum-works/inside-arbitrum-nitro.mdx) or the [Nitro whitepaper](https://github.com/OffchainLabs/nitro/blob/master/docs/Nitro-whitepaper.pdf).
-
-### Why does this matter?
-
-Stylus innovates on many levels, with the key ones described here:
-
-#### One chain, many languages
-
-There are estimated to be roughly 20k Solidity developers, compared to 3 million Rust developers or 12 million C developers [[1](https://www.slashdata.co/blog/state-of-the-developer-nation-23rd-edition-the-fall-of-web-frameworks-coding-languages-blockchain-and-more)]. Developers are now free to use their preferred programming language, all interoperable on any Arbitrum chain with Stylus. By onboarding the next million developers, scaling to the next billion users becomes possible.
-
-#### A better EVM
-
-Stylus' MultiVM brings the best of both worlds. Developers still get all of the benefits of the EVM, including the ecosystem and liquidity, while getting efficiency improvements and access to existing libraries in Rust, C, and C++, all without changing anything about how the EVM works. EVM equivalence is no longer the ceiling; it's the floor.
-
-#### Cheaper execution
-
-Stylus is a more efficient execution environment than the EVM, leading directly to gas savings for complex smart contracts. Computation and memory can be significantly cheaper. Cryptography libraries can be permissionlessly deployed as custom application layer precompiles. Use cases that are impractical in the EVM are now possible in Stylus.
-
-#### Opt-in reentrancy
-
-Stylus doesn't just improve on cost and speed. WASM programs are also safer. Reentrancy is a common vulnerability that developers can only attempt to mitigate in Solidity. Stylus provides cheap reentrancy detection, and using the Rust SDK, reentrancy is disabled by default unless intentionally overridden.
-
-#### Fully interoperable
-
-Solidity programs and WASM programs are completely composable. If working in Solidity, a developer can call a Rust program or rely on another dependency in a different language. If working in Rust, all Solidity functionalities are accessible out of the box.
-
-### How does it work?
-
-There are four main steps for bringing a Stylus contract to life: coding, activation, execution, and proving.
-
-#### Coding
-
-Developers can now write smart contracts in any programming language that compiles to WASM. Note that some high-level languages generate far more performant WASMs than others.
-
-Initially, there will be support for Rust, C, and C++. However, the levels of support will differ at first. Rust has rich language support from day one, with an open-source SDK that makes writing smart contracts in Rust as easy as possible. C and C++ are supported off the bat, too, enabling the deployment of existing contracts in those languages on-chain with minimal modifications.
-
-The Stylus SDK for Rust contains the smart contract development framework and language features most developers will need to use in Stylus. The SDK also makes it possible to perform all of the EVM-specific functionalities that smart contract developers are used to. Check out the [Rust SDK Guide](https://docs.arbitrum.io/stylus/rust-sdk-guide) and the [Crate Docs](https://docs.rs/stylus-sdk/latest/stylus_sdk/index.html).
-
-#### Activation
-
-Stylus contracts are compiled to WASM and then lowered to assembly. Starting from a high-level language (such as Rust, C, or C++), the first compilation stage happens either using the CLI provided in the Stylus SDK for Rust or any other compiler, such as Clang for C and C++. Once compiled, the WASM is posted onchain. Then, in a process called activation, WASM gets lowered to a node's native machine code (such as ARM or x86).
-
-Activating a Stylus contract requires a new precompile, ArbWasm. This precompile produces efficient binary code tailored to a node's native assembly. During this step, a series of middlewares ensure user programs can be safely executed and deterministically fraud-proven. Instrumentation includes gas metering, depth-checking, memory charging, and more to guarantee all WASM programs are safe for the chain to execute. Stylus contracts can be called only after they've been activated.
-
-Gas metering is essential for certifying that computational resources are paid for. In Stylus, the unit for measuring cost is called “ink,” similar to Ethereum's gas but thousands of times smaller. There are two reasons why a new measurement is used: First, WASM execution is so much faster than the EVM that thousands of WASM opcodes could be executed in the same time it takes the EVM to execute one. Second, the conversion rate of ink to gas can change based on future hardware or VM improvements. For a conceptual introduction to Stylus gas and ink, see [gas and ink (Stylus)](https://docs.arbitrum.io/stylus/concepts/stylus-gas).
-
-#### Execution
-
-Stylus contracts are executed in a fork of [Wasmer](https://wasmer.io/), the leading WebAssembly runtime, with minimal changes to optimize their codebase for blockchain-specific use cases. Wasmer executes native code much faster than Geth executes EVM bytecode, contributing to the significant gas savings that Stylus provides.
-
-EVM contracts continue to execute the same way they did before Stylus. When a contract is called, the difference between an EVM contract and a WASM program can be seen via an [EOF](https://notes.ethereum.org/@ipsilon/evm-object-format-overview)-inspired contract header. From there, the contract is executed using its corresponding runtime. Contracts written in Solidity and WASM languages can make cross-contract calls to each other, meaning a developer never has to consider what language the contract was written in. Everything is interoperable.
-
-#### Proving
-
-Nitro has a happy case and a sad case. Most of the time, it's in a happy case, compiling execution history to native code. In the sad case of a dispute between validators, Nitro compiles execution history to WASM to conduct interactive fraud proofs on Ethereum. Stylus is a natural extension to Nitro's fraud-proving technology, utilizing it to not only bisect execution history but also any WASM programs deployed by developers.
-
-### New use cases
-
-It's impossible to list all of the use cases Stylus enables, think about the properties of all WASM compatible languages!
-
-That said, here are some new features that are particularly exciting:
-
-- Generative art libraries that consume a bunch of RAM
-- Bringing existing games written in C++ on-chain
-- Compute-heavy AI models
-- Projects using alternative signature schemes, such as `secp256r1`, via custom precompiles
-- Optimization of Solidity-based projects for speed and cost
-
-We leave it up to you to ideate blockchain projects that were not technically feasible until now.
+With a WASM VM, any programming language compilable to WASM is within Stylus's scope. While many popular programming languages can compile into WASM, some compilers are more suitable for smart contract development than others, like Rust, C, and C++. Other languages like Go, Sway, Move, and Cairo are also supported. Languages that include their own runtimes, like Python and Javascript, are more complex for Stylus to support, although not impossible. Compared to Solidity, WASM programs are much more efficient for memory-intensive applications. There are many reasons for this, including the decades of compiler development for Rust and C. WASM also has a faster runtime than the EVM, resulting in faster execution. Third-party [contribution](#contributing) in the form of libraries for new and existing languages is welcomed!
-While many developers will be drawn to new use cases, rebuilding existing applications in Stylus will also open the door to innovation and optimization. dApps have never been faster, cheaper, or safer.
+### Use Cases
-Stylus is open to all. Much thought has been given to creating the best programming experience possible. However, the work continues. Feedback gained from developers will help drive Stylus to the next level, improving tooling, documentation, and language features. Becoming an early adopter of Stylus is the best way to familiarize oneself with its opportunities.
+While many developers will be drawn to new use cases, rebuilding existing applications in Stylus will also open the door to innovation and optimization. dApps have never been faster, cheaper, or safer. Stylus can integrate easily into existing Solidity projects by calling a Stylus contract to optimize specific parts of your dApp or building the entire dApp with Stylus. It's impossible to list all of the use cases Stylus enables; think about the properties of all WASM-compatible languages! That said, here are some particularly exciting ideas:
-If you're a developer interested in Stylus, visit the [quickstart](https://docs.arbitrum.io/stylus/stylus-quickstart), join the [Discord channel](https://discord.com/invite/arbitrum), and start building!
+- Efficient On-Chain Verification with ZK-Proofs: Enable cost-effective onchain verification
+ using zero-knowledge proving systems for privacy, interoperability, and more (see [case
+ study](https://blog.arbitrum.io/renegade-stylus-case-study/)).
+- Advanced DeFi Instruments: Power complex financial instruments and processes like custom
+ pricing curves for AMMs, synthetic assets, options, and futures with onchain computation via
+ extending current protocols (ie. Uniswap V4 hooks) or building your own.
+- High-Performance On-Chain Logic: Support memory and compute-intensive applications like
+ onchain games and generative art either by writing all of the application in Stylus or enhance
+ performance of existing Solidity contracts by optimizing specific parts.
+- **Endless Possibilities**: Enable innovative use cases such as generative art, compute-heavy
+ AI models, on-chain games, and projects utilizing advanced cryptography, unlocking the full potential
+ of resource-intensive applications on-chain.
-### Wen mainnet?
+### Getting Started
-Stylus is now live on mainnet.
+1. Utilize our [quickstart](https://docs.arbitrum.io/stylus/stylus-quickstart), [Rust SDK](https://docs.arbitrum.io/stylus/reference/overview), to help you start building.
+2. Join our Stylus Developer [Telegram](https://t.me/arbitrum_stylus) group and [Arbitrum Discord](https://discord.gg/arbitrum) for support as well as the official Arbitrum ([@Arbitrum](https://twitter.com/arbitrum)) and Arbitrum Developers ([@ArbitrumDevs](https://twitter.com/ArbitrumDevs)) X accounts for announcements.
+3. Check out the [Awesome Stylus](https://github.com/OffchainLabs/awesome-stylus) repository for various community contributed Stylus projects and tools, if you build something useful, we'd be happy to add it there.
-To keep up with the latest announcements and updates about Stylus:
+### Contributing
-- Subscribe to the [Arbitrum Node Upgrade Announcement channel on Telegram](https://t.me/arbitrumnodeupgrade)
-- Join both the `#dev-announcements` and `#node-runners` Discord channels in the [Arbitrum Discord server](https://discord.gg/arbitrum)
-- Follow the official Arbitrum ([`@Arbitrum`](https://twitter.com/arbitrum)) and Arbitrum Developers ([`@ArbitrumDevs`](https://twitter.com/ArbitrumDevs)) X accounts, formerly Twitter.
+Stylus is open to everyone, with a strong focus on delivering an exceptional programming experience. But the journey doesn't end here—developer feedback is crucial to enhancing Stylus’s tooling, documentation, and language features. By becoming an early adopter, you can explore its full potential and help shape its future. We’re actively seeking builders eager to push the limits of the EVM or develop tooling for Stylus. With over [$5M in grant funding available through the Stylus Sprint](https://blog.arbitrum.io/stylus-sprint/), now’s the time to get involved!
diff --git a/website/sidebars.js b/website/sidebars.js
index ce1ac6901..d28e48219 100644
--- a/website/sidebars.js
+++ b/website/sidebars.js
@@ -480,7 +480,7 @@ const sidebars = {
},
{
type: 'category',
- label: 'Write Stylus contracts',
+ label: 'Write Stylus Contracts',
collapsed: true,
link: {
type: 'doc',
@@ -495,17 +495,7 @@ const sidebars = {
{
type: 'doc',
id: 'stylus/stylus-quickstart',
- label: 'Quickstart (Rust)',
- },
- {
- type: 'doc',
- id: 'for-devs/dev-tools-and-resources/chain-info',
- label: 'Chain info',
- },
- {
- type: 'doc',
- label: 'Arbiscan contract verification',
- id: 'stylus/how-tos/verifying-contracts-arbiscan',
+ label: 'Quickstart',
},
{
type: 'category',
@@ -518,119 +508,140 @@ const sidebars = {
label: 'Overview',
},
...stylusByExampleDocsSidebar,
- {
- type: 'doc',
- id: 'stylus/recommended-libraries',
- label: 'Recommended libraries',
- },
{
type: 'doc',
id: 'stylus/reference/rust-sdk-guide',
label: 'Advanced features',
},
+ ],
+ },
+ {
+ type: 'category',
+ label: 'Concepts',
+ collapsed: true,
+ items: [
{
- type: 'link',
- label: 'Rust crate docs',
- href: 'https://docs.rs/stylus-sdk/latest/stylus_sdk/index.html',
+ type: 'doc',
+ id: 'stylus/concepts/how-it-works',
+ label: 'How Stylus works',
},
{
- type: 'link',
- label: 'Stylus by example',
- href: 'https://stylus-by-example.org/',
+ type: 'doc',
+ id: 'stylus/concepts/stylus-gas',
+ label: 'How Stylus uses gas',
},
],
},
{
type: 'category',
- label: 'Gas, ink and caching',
+ label: 'Tutorials',
collapsed: true,
items: [
{
- type: 'doc',
- label: 'Overview',
- id: 'stylus/concepts/stylus-gas',
+ type: 'html',
+ value:
+ '',
},
{
type: 'doc',
- id: 'stylus/reference/opcode-hostio-pricing',
- label: 'Gas and ink costs',
+ id: 'stylus/how-tos/debugging-stylus-tx',
+ label: 'Debug transactions',
},
{
type: 'doc',
id: 'stylus/concepts/stylus-cache-manager',
- label: 'Caching strategy',
+ label: 'Cache contracts',
+ },
+ {
+ type: 'doc',
+ id: 'stylus/how-tos/optimizing-binaries',
+ label: 'Optimize WASM binaries',
+ },
+ {
+ type: 'doc',
+ id: 'stylus/how-tos/verifying-contracts',
+ label: 'Verify contracts',
+ },
+ {
+ type: 'doc',
+ id: 'stylus/how-tos/verifying-contracts-arbiscan',
+ label: 'Arbiscan verification',
+ },
+ {
+ type: 'doc',
+ id: 'stylus/how-tos/adding-support-for-new-languages',
+ label: 'Using other languages',
},
],
},
{
type: 'category',
- label: 'CLI tools (cargo-stylus)',
+ label: 'Examples',
collapsed: true,
items: [
{
type: 'doc',
- label: 'Overview',
- id: 'stylus/cli-tools-overview',
+ id: 'stylus-by-example/vending_machine',
+ label: 'Vending machine',
},
{
type: 'doc',
- label: 'Optimize WASM binaries',
- id: 'stylus/how-tos/optimizing-binaries',
+ id: 'stylus-by-example/erc20',
+ label: 'ERC-20',
},
{
type: 'doc',
- label: 'Debug Stylus transactions',
- id: 'stylus/how-tos/debugging-stylus-tx',
+ id: 'stylus-by-example/erc721',
+ label: 'ERC-721',
},
{
type: 'doc',
- label: 'Verify Stylus contracts',
- id: 'stylus/how-tos/verifying-contracts',
+ id: 'stylus-by-example/multi_call',
+ label: 'Multi-Call',
},
{
type: 'link',
- label: 'cargo-stylus repository',
- href: 'https://github.com/OffchainLabs/cargo-stylus',
+ label: 'Awesome Stylus',
+ href: 'https://docs.rs/stylus-sdk/latest/stylus_sdk/index.html',
},
],
},
- {
- type: 'html',
- value:
- '',
- // q: why use an anchor html tag here?/node-running/how-tos/running-an-stylus-node
- // a: see note at end of file
- },
{
type: 'category',
- label: 'Other supported languages',
+ label: 'Reference',
collapsed: true,
- link: {
- type: 'doc',
- id: 'stylus/reference/other-language-frameworks',
- },
items: [
{
type: 'doc',
- label: 'Add a new smart contract language',
- id: 'stylus/how-tos/adding-support-for-new-languages',
+ id: 'for-devs/dev-tools-and-resources/chain-info',
+ label: 'Chain Info',
+ },
+ {
+ type: 'doc',
+ id: 'stylus/reference/opcode-hostio-pricing',
+ label: 'Gas & Ink Pricing',
+ },
+ {
+ type: 'link',
+ label: 'Cargo Stylus CLI GitHub',
+ href: 'https://github.com/OffchainLabs/cargo-stylus',
+ },
+ {
+ type: 'link',
+ label: 'Rust SDK Crate',
+ href: 'https://docs.rs/stylus-sdk/latest/stylus_sdk/index.html',
+ },
+ {
+ type: 'link',
+ label: 'Source Code Repository',
+ href: 'https://github.com/OffchainLabs/stylus',
},
],
},
{
type: 'doc',
- label: 'Troubleshooting',
id: 'stylus/troubleshooting-building-stylus',
- },
- {
- type: 'link',
- label: 'Source code repository',
- href: 'https://github.com/OffchainLabs/stylus',
- },
- {
- type: 'doc',
- label: 'Public preview',
- id: 'stylus/concepts/public-preview-expectations',
+ label: 'Troubleshooting',
},
],
},
diff --git a/website/src/scripts/stylusByExampleDocsHandler.ts b/website/src/scripts/stylusByExampleDocsHandler.ts
index c039d46ae..8c46c6736 100644
--- a/website/src/scripts/stylusByExampleDocsHandler.ts
+++ b/website/src/scripts/stylusByExampleDocsHandler.ts
@@ -21,20 +21,25 @@ const allowList = [
'bytes_in_bytes_out',
];
+const appsAllowList = ['erc20', 'erc721', 'vending_machine', 'multi_call'];
+
function load(app) {
const outputDir = path.join(app.options.getValue('out'), '../../stylus-by-example');
const sourceDir = path.join(outputDir, '../../stylus-by-example/src/app/basic_examples');
+ const sourceDirApps = path.join(outputDir, '../../stylus-by-example/src/app/applications');
app.renderer.on(RendererEvent.START, async () => {
cleanDirectory(outputDir);
});
app.renderer.on(RendererEvent.END, async () => {
- copyFiles(sourceDir, outputDir);
-
+ copyFiles(sourceDir, outputDir, allowList);
+ // only generate sidebar for basic_examples
const sidebarItems = generateSidebar(outputDir);
const sidebarConfig = { items: sidebarItems };
const sidebarPath = path.join(outputDir, 'sidebar.js');
+ // copy applications after sidebar for Rust SDK is generated
+ copyFiles(sourceDirApps, outputDir, appsAllowList);
fs.writeFileSync(
sidebarPath,
@@ -62,7 +67,7 @@ function cleanDirectory(directory) {
}
}
-function copyFiles(source, target) {
+function copyFiles(source, target, allowList) {
if (!fs.existsSync(source)) {
console.error(`Source path does not exist: ${source}`);
return;