Sway Application Examples

Developers are encouraged to reference the sway-applications repo for examples for common patterns and functionality. This repository 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.

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.
  • Automated Market Maker (AMM) is a decentralized exchange protocol that manages liquidity pools supplied by its users and determines prices algorithmically while exchanging assets.
  • Decentralized Autonomous Organization (DAO) is an organization where users get to vote on governance proposals using governance tokens.
  • 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.
  • 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.
  • 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.
  • 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.

View all of the applications here.

Please note all projects currently use forc 0.31.1, and fuel-core 0.14.1.