6.1Sway程序示例 (Sway Application Examples)

Developers are encouraged to reference the sway-applications repo for examples for common patterns and functionality. This repositoryarrow-up-right contains smart contracts that are written in Sway in order to demonstrate what can be built, and offer forkable code for others to build on.

鼓励开发人员参考 sway-applications 存储库,进而获取常见模式和功能的示例。 该存储库arrow-up-right 包含用 Sway 编写的智能合约,进而演示可以构建的内容,并提供可分叉的代码供他人构建。

We have the following contracts available as a reference: 我们有以下可供参考的合约:

  • Airdrop is a token distribution program where users are able to claim tokens given a valid merkle proof. Airdrop(空投) 是一种代币分发程序,用户可以在提供有效的 merkle(默克尔) 证明的情况下领取代币。

  • Automated Market Maker (AMM) is a decentralized exchange protocol that manages liquidity pools supplied by its users and determines prices algorithmically while exchanging assets. 自动做市商 (AMM) 是一种去中心化交易协议,可管理其用户提供的流动资金池,并在交易资产时通过算法确定价格。

  • Decentralized Autonomous Organization (DAO) is an organization where users get to vote on governance proposals using governance tokens. 去中心化自治组织 (DAO) 是一个用户可以使用治理代币对治理提案进行投票的组织。

  • English Auction is an auction where users bid up the price of an asset until the bidding period has ended or a reserve has been met. English Auction(英式拍卖) 是一种拍卖,用户对资产的价格进行竞价,直到竞价期结束或达到保留价为止。

  • Escrow is a third party that keeps an asset on behalf of multiple parties. Fundraiser is a program allowing users to pledge towards a goal. 托管是代表多个主体保管资产的第三方。筹款活动是一个允许用户承诺实现目标的程序。

  • Multi-Signature Wallet is a wallet that requires multiple signatures to execute a transaction. 多重签名钱包是一种需要多重签名才能执行交易的钱包。

  • Name-Registry allows users to perform transactions with human readable names instead of addresses. Name-Registry(名称注册) 允许用户使用人类可读的名称而不是地址来执行交易

  • Non-Fungible Token (NFT) is a token contract which provides unique collectibles, identified and differentiated by token IDs, where tokens contain metadata giving them distinctive characteristics. Non-Fungible Token (NFT) 是一种代币合约,它提供独特的收藏品,由代币 ID 识别和区分,其中代币包含赋予其独特特征的元数据

  • Oracle is a smart contract that provides off-chain data to on-chain applications. OTC Swap Predicate is a predicate that can be used to propose and execute an atomic swap between two parties without requiring any on-chain state. Oracle(预言机) 是一种智能合约,可为链上应用提供链下数据。 OTC 交换谓词是一种谓词,可用于在不需要任何链上状态的情况下提出和执行两方之间的原子交换

View all of the applications herearrow-up-right. 点击此处arrow-up-right 查看所有应用。

Please note all projects currently use forc 0.31.1, and fuel-core 0.14.1. 请注意目前所有项目都使用 forc 0.31.1 和 fuel-core 0.14.1。

Last updated