1. The Sway Programming Language
  2. 1. Introduction
    1. 1.1. Installation
    2. 1.2. Sway Quickstart
    3. 1.3. The Fuel Toolchain
    4. 1.4. A Forc Project
    5. 1.5. Standard Library
  3. 2. Examples
    1. 2.1. Counter
    2. 2.2. Subcurrency
    3. 2.3. FizzBuzz
    4. 2.4. Wallet Smart Contract
  4. 3. Program Types
    1. 3.1. Contracts
    2. 3.2. Libraries
    3. 3.3. Scripts
    4. 3.4. Predicates
  5. 4. Sway Language Basics
    1. 4.1. Variables
    2. 4.2. Built-in Types
    3. 4.3. Commonly Used Library Types
    4. 4.4. Blockchain Types
    5. 4.5. Functions
    6. 4.6. Structs, Tuples, and Enums
    7. 4.7. Methods and Associated Functions
    8. 4.8. Constants
    9. 4.9. Comments and Logging
    10. 4.10. Control Flow
  6. 5. Blockchain Development with Sway
    1. 5.1. Hashing and Cryptography
    2. 5.2. Contract Storage
    3. 5.3. Function Purity
    4. 5.4. Identifiers
    5. 5.5. Native Assets
    6. 5.6. Access Control
    7. 5.7. Calling Contracts
  7. 6. Advanced Concepts
    1. 6.1. Advanced Types
    2. 6.2. Generic Types
    3. 6.3. Traits
    4. 6.4. Generics and Trait Constraints
    5. 6.5. Assembly
  8. 7. Common Collections
    1. 7.1. Vectors on the Heap
    2. 7.2. Storage Vectors
    3. 7.3. Storage Maps
  9. 8. Testing
    1. 8.1. Unit Testing
    2. 8.2. Testing with Rust
  10. 9. Application Frontend
    1. 9.1. TypeScript SDK
  11. 10. Sway Reference
    1. 10.1. Compiler Intrinsics
    2. 10.2. Attributes
    3. 10.3. Style Guide
    4. 10.4. Known Issues and Workarounds
    5. 10.5. Differences From Solidity
    6. 10.6. Differences From Rust
    7. 10.7. Contributing To Sway
  12. 11. Forc Reference
    1. 11.1. Manifest Reference
    2. 11.2. Workspaces
    3. 11.3. Dependencies
    4. 11.4. Commands
      1. 11.4.1. forc addr2line
      2. 11.4.2. forc build
      3. 11.4.3. forc check
      4. 11.4.4. forc clean
      5. 11.4.5. forc completions
      6. 11.4.6. forc contract-id
      7. 11.4.7. forc init
      8. 11.4.8. forc new
      9. 11.4.9. forc parse-bytecode
      10. 11.4.10. forc plugins
      11. 11.4.11. forc predicate-root
      12. 11.4.12. forc test
      13. 11.4.13. forc update
      14. 11.4.14. forc template
    5. 11.5. Plugins
      1. 11.5.1. forc client
        1. 11.5.1.1. forc deploy
        2. 11.5.1.2. forc run
        3. 11.5.1.3. forc submit
      2. 11.5.2. forc doc
      3. 11.5.3. forc explore
      4. 11.5.4. forc fmt
      5. 11.5.5. forc lsp

The Sway Programming Language

Advanced Concepts

Advanced concepts.

  • Advanced Types
  • Generic Types
  • Traits
  • Generics and Trait Constraints
  • Assembly