Icon HelpCircleForumIcon Link

⌘K

Icon HelpCircleForumIcon Link
Sway Standards

Icon LinkSway Standards

The purpose of the Sway Standards repository Icon Link is to contain standards for the Sway Language which users can import and use.

Standards in this repository may be in various stages of development. Use of draft standards and feedback on the proposed standards is encouraged. To use a draft, search for a standard using the appropriate GitHub label and implement the standard ABI into your contract.

If you don't find what you're looking for, feel free to create an issue and propose a new standard!

Icon InfoCircle

Note All standards currently use forc v0.63.3.

Icon LinkUsing a standard

To import a standard the following should be added to the project's Forc.toml file under [dependencies] with the most recent release:

standards = { git = "https://github.com/FuelLabs/sway-standards", tag = "v0.6.1" }
Icon InfoCircle

NOTE: Be sure to set the tag to the latest release.

You may then import your desired standard in your Sway Smart Contract as so:

use standards::<standard>::<standard_abi>;

For example, to import the SRC-20 Native Asset Standard use the following statement in your Sway Smart Contract file:

use standards::src20::SRC20;

Icon LinkStandards

Icon LinkNative Assets

Icon LinkSecurity and Access Control

Icon LinkContracts

Icon LinkBridge

Icon LinkDocumentation