The purpose of the Sway Standards repository 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!
Note All standards currently use
forc v0.61.0
.
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.5.2" }
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;