Skip to content

Conversation

@anegg0
Copy link
Contributor

@anegg0 anegg0 commented Nov 14, 2025

WIP PR:

  • Content restructuring
  • Update content to stylus-sdk-rs v0.1

The proposed temporary structure is the following:

  • Gentle Introduction
  • Stylus SDK (Rust)
  1. Getting Started
    1. Installation
    2. Hello World
    3. Hello, Cargo Stylus
  2. First App Example (Counter or Vending Machine)
  3. Structure of a Stylus contract
    1. Project layout
    2. Variables
    3. Functions
    4. Modules
    5. Importing packages
    6. Events
    7. Errors
  4. Data Types
    1. Primitives (include Sol & Rust primitives where applicable)
      1. Boolean
      2. Integers
      3. Address (include AddressVM traits from types module)
      4. String
        1. Literals
        2. Hex
    2. Compound types
      1. Tuple
      2. Struct
      3. Array
      4. Vector
      5. Bytes
      6. FixedBytes
    3. Storage
      1. Bool
      2. Uint
      3. Address
      4. Struct
      5. Array
      6. Map
      7. String
      8. Bytes
      9. FixedBytes
    4. Conversions Between Types
  5. Global variables and functions
    1. block
    2. contract
    3. crypto
    4. evm
    5. msg
    6. tx
    7. debug
  6. Contracts
    1. Calling other contracts
      1. Call
      2. Raw call
      3. Delegate call
      4. Static call
      5. sol_interface
    2. Sending ETH
    3. Factory deploy
    4. Function modifiers
    5. Inheritance (temporary)
    6. Constructors (coming soon)
  7. Writing tests (coming soon)
  8. Advanced
    1. Solidity differences
    2. Recommended packages
    3. Minimal entrypoint contracts
    4. Hostio exports
  9. FAQs
  • Using the CLI
    • Check and deploy
    • Verify contracts
    • Exporting ABI
    • Debugging with replay
    • Optimizing WASM binary size
    • Deploying non-Rust WASM contracts
  • VM Concepts
    • WebAssembly
    • EVM differences
      • Size limits
      • Ink and gas
      • Memory and compute
    • Activation
    • Caching strategy
  • Stylus by Example (external link)
  • Rust crate docs (external link)
  • Source code repository (external link)

Add lint:markdown:fix to the format script to automatically fix
markdown linting issues when running yarn format. This ensures
markdown files are both formatted (prettier) and linted (markdownlint)
in one command.

The new format workflow:
1. Format docs with prettier
2. Format app files with prettier
3. Auto-fix markdown linting issues
4. Verify all files pass prettier check
@vercel
Copy link

vercel bot commented Nov 14, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Preview Updated (UTC)
arbitrum-docs Ready Ready Preview Nov 22, 2025 2:19am

@joshuacolvin0 joshuacolvin0 changed the title Stylus v0.1 Stylus v0.10 Nov 20, 2025
Add detailed documentation for all Stylus SDK primitive types including:
- Boolean (bool) with usage examples and Solidity mappings
- Unsigned integers (u8-u128, U256, Uint<BITS, LIMBS>)
- Signed integers (i8-i128, I256, Signed<BITS, LIMBS>)
- Address type with constants and validation examples
- String type with literal and formatting examples
- Bytes types (dynamic Bytes and fixed FixedBytes<N>)
- Hex literal usage examples
- Complete type mapping tables for all primitives
- Best practices for each primitive type
- Type conversion examples

Each section includes:
- Practical code examples
- Solidity type mappings
- Storage size information
- ABI signature details
- Common usage patterns
Add detailed documentation for all Stylus SDK compound types including:
- Tuples with destructuring and pattern matching examples
- Structs using sol! macro with AbiType derivation
- Nested structs for complex data structures
- Fixed-size arrays with iteration and operations
- Vectors (dynamic arrays) with filter, map, and fold operations
- Bytes types (dynamic Bytes and fixed FixedBytes<N>)
- Complete type mapping tables for all compound types
- Best practices for each compound type
- Type conversion helpers and iterator patterns
- Common patterns (batch operations, pagination)

Each section includes:
- Practical code examples from SDK examples
- Solidity type mappings
- ABI signature details
- Memory and gas efficiency considerations
- Complete working examples with nested structures
- Iterator and functional programming patterns
Add detailed documentation for all Stylus SDK storage types including:
- Storage overview and EVM State Trie interoperability
- Storage primitives (StorageBool, StorageUint, StorageAddress, FixedBytes)
- Integer update operations (wrapping and checked)
- Storage collections (StorageVec, StorageArray, StorageMap)
- StorageString and StorageBytes for dynamic data
- Storage structs with nested structures
- Complete type mapping tables
- Storage patterns (initialization, counter, access control, registry)
- Best practices for storage operations
- Storage slots and layout explanation
- Complete working token example

Each section includes:
- Practical code examples from SDK examples
- Method signatures and usage patterns
- Solidity equivalents and mappings
- Gas optimization guidance
- Common design patterns
- Best practices for efficient storage use
Add comprehensive documentation for Stylus contracts covering:

- Contract basics and minimal contract structure
- Storage definition with sol_storage! and #[storage]
- #[entrypoint] macro and TopLevelStorage trait
- #[public] macro for exposing methods
- State mutability inference (view, write, pure)
- Constructor with #[constructor] attribute
- Method attributes: #[payable], #[receive], #[fallback], #[selector]
- Trait-based contract composition with #[implements]
- Accessing VM context via self.vm()
- Events definition and emission with sol! macro
- External contract calls with sol_interface!
- Call configurations (view, mutating, payable, gas)
- Low-level calls (call, static_call, RawCall)
- Error handling with SolidityError
- Complete ERC-20 example demonstrating all features
- Best practices for state mutability, validation, errors, events, access control, gas optimization, CEI pattern, and type-safe interfaces

All code examples are based on actual SDK implementation from stylus-sdk-rs repository.
Add comprehensive documentation for global variables and functions accessible via self.vm() in Stylus contracts:

- Message context: msg_sender(), msg_value(), msg_reentrant()
- Transaction context: tx_origin(), tx_gas_price(), tx_ink_price()
- Block context: block_number(), block_timestamp(), block_basefee(), block_coinbase(), block_gas_limit()
- Chain context: chain_id()
- Account information: contract_address(), balance(), code(), code_size(), code_hash()
- Gas and metering: evm_gas_left(), evm_ink_left(), ink_to_gas(), gas_to_ink()
- Cryptographic functions: crypto::keccak(), native_keccak256()
- Event logging: log(), raw_log()
- Storage operations: storage_load_bytes32(), flush_cache()
- Memory management: pay_for_memory_grow()

Each section includes:
- Method signatures
- Solidity equivalents
- Practical code examples
- Important notes and caveats
- Arbitrum-specific behavior details

Complete example contract demonstrating usage of all major VM methods, plus a summary table of all available methods.

All code examples based on actual SDK implementation from stylus-sdk-rs repository.
Add comprehensive documentation for minimal entrypoint contracts covering:
- ArbResult type and its usage in contract methods
- user_entrypoint function structure and generated code
- Router trait implementation and routing logic
- TopLevelStorage trait and safety requirements
- Step-by-step guide to building contracts without macros
- Function selector computation and implementation
- Complete working minimal contract example
- Comparison with high-level macro approach
- Advanced use cases and debugging tips

Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
anegg0 and others added 2 commits November 21, 2025 18:06
Add comprehensive documentation for Stylus contract activation covering:
- Two-step deployment and activation process
- WASM compilation and processing pipeline
- Deployment bytecode structure and EVM initcode
- Activation fee calculation and configuration
- ArbWasm precompile interface and functions
- cargo-stylus CLI commands and workflows
- Constructor support and arguments
- Contract lifecycle and expiration management
- Code reuse optimization via codehash
- Multi-contract deployment patterns
- Programmatic deployment examples
- Troubleshooting common activation errors
- Best practices for production deployment

Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

slop starter Generated draft to start from

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants