Skip to content

Commit

Permalink
Merge pull request #1783 from OffchainLabs/stylus-add-multi-inheritan…
Browse files Browse the repository at this point in the history
…ce-warning

Add warning about Stylus not supporting contract multi-inheritance yet
  • Loading branch information
anegg0 authored Oct 31, 2024
2 parents bc850a2 + c8a3d54 commit bdccdee
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 2 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
:::info

Stylus doesn't support contract multi-inheritance yet.

:::
1 change: 1 addition & 0 deletions arbitrum-docs/stylus/reference/overview.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import PublicPreviewBannerPartial from '../../partials/_public-preview-banner-pa

<PublicPreviewBannerPartial />


This section provides an in-depth overview of the features provided by the [Stylus Rust SDK](https://github.com/OffchainLabs/stylus-sdk-rs). For information about deploying Rust smart contracts, see the `cargo stylus` [CLI Tool](https://github.com/OffchainLabs/cargo-stylus). For a conceptual introduction to Stylus, see [Stylus: A Gentle Introduction](../stylus-gentle-introduction.md). To deploy your first Stylus smart contract using Rust, refer to the [Quickstart](../stylus-quickstart.md).

The Stylus Rust SDK is built on top of [Alloy](https://www.paradigm.xyz/2023/06/alloy), a collection of crates empowering the Rust Ethereum ecosystem. Because the SDK uses the same [Rust primitives for Ethereum types](https://docs.rs/alloy-primitives/latest/alloy_primitives/), Stylus is compatible with existing Rust libraries.
Expand Down
6 changes: 6 additions & 0 deletions arbitrum-docs/stylus/reference/rust-sdk-guide.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ target_audience: Developers using the Stylus Rust SDK to write and deploy smart

import PublicPreviewBannerPartial from '../../partials/_public-preview-banner-partial.mdx';

import StylusNoMultiInheritanceBannerPartial from '../partials/_stylus-no-multi-inheritance-banner-partial.mdx'

<PublicPreviewBannerPartial />

This document provides information about advanced features included in the [Stylus Rust SDK](https://github.com/OffchainLabs/stylus-sdk-rs), that are not described in the previous pages. For information about deploying Rust smart contracts, see the `cargo stylus` [CLI Tool](https://github.com/OffchainLabs/cargo-stylus). For a conceptual introduction to Stylus, see [Stylus: A Gentle Introduction](../stylus-gentle-introduction.md). To deploy your first Stylus smart contract using Rust, refer to the [Quickstart](../stylus-quickstart.md).
Expand Down Expand Up @@ -272,6 +274,10 @@ The [`#[entrypoint]`][entrypoint] macro will automatically implement the [`TopLe

### Inheritance, `#[inherit]`, and `#[borrow]`.



<StylusNoMultiInheritanceBannerPartial />

Composition in Rust follows that of Solidity. Types that implement [`Router`][Router], the trait that [`#[public]`][public] provides, can be connected via inheritance.

```rust
Expand Down
4 changes: 2 additions & 2 deletions website/src/scripts/stylusByExampleDocsHandler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ function copyFiles(source, target) {

// Adjust the file path
const firstCodeBlock = `\`\`\`rust`;
const admonition = `
const admonitionNotForProduction = `
import NotForProductionBannerPartial from '../partials/_not-for-production-banner-partial.mdx';
<NotForProductionBannerPartial />
Expand All @@ -146,7 +146,7 @@ function addAdmonitionOneLineAboveFirstCodeBlock(content) {
// Find the position two lines before firstCodeBlock
const lines = content.substring(0, index).split('\n');
const insertLineIndex = lines.length - 2;
lines.splice(insertLineIndex, 0, admonition);
lines.splice(insertLineIndex, 0, admonitionNotForProduction);

const newText = lines.join('\n') + content.substring(index);
return newText;
Expand Down

0 comments on commit bdccdee

Please sign in to comment.