FuelLabs/sway

GitHub: FuelLabs/sway

Sway 是 FuelLabs 推出的、受 Rust 启发的区块链智能合约编程语言,旨在为 Fuel 生态提供可靠高效的合约开发体验。

Stars: 61569 | Forks: 5415

# Sway [![build](https://static.pigsec.cn/wp-content/uploads/repos/cas/39/39faa54be350a1dab8afd3b2fb8c1c83e4d9cff84abfef2374d19a18053687c4.svg)](https://github.com/FuelLabs/sway/actions/workflows/ci.yml) [![crates.io](https://img.shields.io/crates/v/forc?label=latest)](https://crates.io/crates/forc) [![docs](https://docs.rs/forc/badge.svg)](https://docs.rs/forc/) [![twitter](https://img.shields.io/twitter/follow/SwayLang)](https://x.com/SwayLang) [![discord](https://img.shields.io/badge/chat%20on-discord-orange?&logo=discord&logoColor=ffffff&color=7389D8&labelColor=6A7EC2)](https://discord.gg/xfpK4Pe) Sway 是一门专为 [Fuel](https://docs.fuel.network/docs/intro/what-is-fuel/) 区块链开发的语言。它深受 Rust 的启发,旨在为区块链生态系统带来现代语言的开发体验和卓越性能。 ## 文档 有关用户文档(包括安装 release 版本),请参阅 Sway Book:。 有关 Sway 标准库文档,请参阅: 此外,也可以查阅 Sway 编程语言的技术参考手册: ## 从源码构建 本节适用于开发 Sway 编译器和工具链。若要开发合约或使用 Sway,请参阅上述文档部分。 ### 依赖 Sway 使用 Rust 编写。首先,请按照 的说明安装 Rust 工具链。然后将你的 Rust 工具链配置为使用 Rust `stable`: ``` rustup default stable ``` 如果之前没有配置过,请将以下行添加到 `~/.profile` 中,并重启 shell 会话,从而将 Cargo 的 bin 目录添加到你的 `PATH` 中。 ``` export PATH="${HOME}/.cargo/bin:${PATH}" ``` ### 构建 Forc 克隆仓库并构建 Sway 工具链: ``` git clone git@github.com:FuelLabs/sway.git cd sway cargo build ``` 确认 Sway 工具链已成功构建: ``` cargo run --bin forc -- --help ``` ## 所有其他脚本/命令 如需运行所有其他脚本和命令,请使用 https://github.com/casey/just: ``` > just --list Available recipes: [automation] update-contract-ids update-fuel-dependencies [benchmark] benchmark benchmark-tests collect-gas-usage [build] build-highlightjs build-prism generate-sway-lib-std [ci] ci-check install-ci-check [test] test-forc-fmt-check-panic ```
标签:Rust, Web3, 区块链, 可视化界面, 智能合约, 编程语言, 编译器, 网络流量审计, 通知系统