https://wallet.fuel.network/docs/install/
https://github.com/FuelLabs/fuelup
rustup install stable
rustup update
rustup default stable
fuelup toolchain install latest
fuelup toolchain install beta-3
fuelup default beta-3
fuelup show
# switch
fuelup default latest
fuelup self update
# generate test
cargo generate --init fuellabs/sway templates/sway-test-rs --name counter
forc new counter_contract
# compile
forc build
# format
forc fmt
# node
fuel-core run --db-type in-memory
# deploy
forc deploy --unsigned
-
no inheritance, no constructor, global memory, native assets, no for loop, utxo
-
sway lib
-
default values
-
Program types overview
-
Basic
- variables (immutable,
mut
, type annotations) - built-in
- primitive types (
u64
,bool
,str[]
,b256
) - compound type (tuple, struct, array)
- primitive types (
- blockchain types (
Address
,ContractId
andIdentity
) - functions (return outputs,
ref mut
) - structs
- tuples
- enums
- constants
- configurable constants
- std lib types - option
- std lib types - result
- control flow
- if
- match
- while loop
- logging
- test in sway
- variables (immutable,
-
Blockchain
- msg_sender (ownership)
- base asset (wallet)
- native support for assets (wrapped token)
- events
- storage map (simple, nested)
- vector (storage, heap) (nft)
- hash
- crypto signature (air drop)
- calling contracts (multi sig)
- call
- low level call
- function purity
- identifier (address and contract id)
-
Advanced
- methods
- generics
- traits
- assembly
-
Program types
- contracts
- libraries
- scripts
- predicates
- counter (storage)
- ownership (Identity type, msg_sender, configurable, Option, Error, imports)
- wallet (native assets, identity, access control, payable, output variables)
- wrapped token (contract_id, msg_asset_id, mint, burn, transfer)
- nft (log, nested storage map, private funcs, constant)
- airdrop (sway-libs, events, multi abi, multi contracts, storage map, sha256, test events)
- call (multiple contracts, call, low level call, calling other contracts (Rust SDK), fn_selector!)
- multi-sig (multi token, vec on heap, multi abi, loop, storage vec, events, low_level_call, hash, recover sig)
- otc (predicate, gtf)
TODO:
- assert, require, revert
- otc (predicate)
- bridge?
- clamm?
- liquidity book - amm
- uniswap v3 amm?
- escrow
- auction
- queue (generics)
- reentrancy guard?