SwayLang Profile Banner
Sway Profile
Sway

@SwayLang

Followers
136K
Following
930
Media
201
Statuses
909

Sway is a Rust-based, domain specific language for writing smart contracts, created by @fuel_network.

Joined November 2021
Don't wanna be here? Send us removal request.
@SwayLang
Sway
1 year
Sway is a language purpose-built for blockchains. It combines the best of Solidity and Rust, providing a full suite of tools for creating secure, high-performance Dapps. 🧵.
58
173
597
@SwayLang
Sway
12 hours
Sway brings clarity to smart contracts, so you spend less time debugging and more time building 🌴.
0
0
4
@SwayLang
Sway
1 day
RT @fuel_network: The coolest CLOB will be on @o2dotapp and it will be: . ⚡️Privacy-enabled.⚡️Focused on spot (first).⚡️Expanding to perps,….
0
4
0
@SwayLang
Sway
1 day
RT @fuel_network: build without compromise ⛽️.
0
5
0
@SwayLang
Sway
1 day
Use cases? Think gas-optimized workflows, multicall setups, and custom logic offloaded from contracts. More in the docs 📘.
0
0
2
@SwayLang
Sway
1 day
Here’s what a simple script looks like in Sway 👇
Tweet media one
2
0
3
@SwayLang
Sway
1 day
🛠 Key properties of a script:. ➡️ Can call contracts, but can't be called.➡️ Doesn’t store state or own assets.➡️ Reads state temporarily during execution.➡️ Great for batching multiple actions in a single transaction.
1
0
1
@SwayLang
Sway
1 day
What are Scripts in Sway? 🌴. They’re one-shot programs that live only for the duration of a transaction perfect for bundling logic without persistent state. Let’s explore what makes them powerful 🧵.
2
0
8
@SwayLang
Sway
3 days
📚 Below are additional resources. The Sway standard library is a great reference for more complex examples on how to build a library, and the full FuelVM instruction set includes most of the instructions you’d find in the EVM plus more!. ➡️ Sway standard library examples:.
0
0
3
@SwayLang
Sway
3 days
Want to return multiple values? You can modify a tuple within the assembly block:
Tweet media one
1
0
2
@SwayLang
Sway
3 days
🔍 Understanding the asm Block:. This simply uses the add instruction to add one to register r1 and stores the result in register r2, then returns it. The return register is specified at the end, after all assembly instructions. It consists of the register name and optional.
1
0
1
@SwayLang
Sway
3 days
Here's how it looks in Sway:
Tweet media one
1
0
1
@SwayLang
Sway
3 days
✅ Just like Solidity, Sway also has assembly blocks:. But the main user facing form is asm {}
Tweet media one
1
0
1
@SwayLang
Sway
3 days
🔧 Why use Assembly?. ➡️ Gas Optimization: Writing logic directly in asm blocks reduces gas costs by avoiding high-level abstractions. ➡️ Low-Level Control: Direct access to FuelVM instruction set perfect for library authors or power users who need custom memory management or.
1
0
1
@SwayLang
Sway
3 days
Assembly in Sway is optional, but it's there when you need to squeeze out every bit of performance and take direct control of the FuelVM. Let's break it down 🧵.
2
1
7
@SwayLang
Sway
3 days
Advantages over Solidity.✅ Explicit, strong typing for keys and values. ✅ Clear, compiler-enforced storage read/write annotations. Learn more:.
0
0
0
@SwayLang
Sway
3 days
Nested StorageMaps:
Tweet media one
1
0
0
@SwayLang
Sway
3 days
Multi-Key & Nested Maps. Tuples as keys:
Tweet media one
1
0
0
@SwayLang
Sway
3 days
Reading Values. Safe reads with built-in fallback handling through Option<V>.
Tweet media one
1
0
0
@SwayLang
Sway
3 days
Inserting Values. Explicitly annotate functions with #[storage(write)] for storage modifications.
Tweet media one
1
0
0
@SwayLang
Sway
3 days
Declaration & Initialization. No extra imports or explicit mutability needed, storage variables are inherently mutable.
Tweet media one
1
0
0