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