Jojosephstar / sway-standards

SRC Standards set for the Sway language

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Sway Standards logo

Overview

The purpose of this 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 Sway is a language under heavy development therefore the standards may not be the most ergonomic. Over time they should receive updates / improvements in order to demonstrate how Sway can be used in real use cases.

Standards

Using 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:

standard = { git = "https://github.com/FuelLabs/sway-standards", tag = "v0.1.0" }

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

use standard::<standard_abi>;

For example, to import the SRC-20 Token Standard use the following statement:

use src20::SRC20;

Note All standards currently use forc v0.44.0.

Note The key words “MUST”, “MUST NOT”, “REQUIRED”, “SHALL”, “SHALL NOT”, “SHOULD”, “SHOULD NOT”, “RECOMMENDED”, “MAY”, and “OPTIONAL” in these documents are to be interpreted as described in RFC 2119: https://www.ietf.org/rfc/rfc2119.txt

About

SRC Standards set for the Sway language

License:Apache License 2.0


Languages

Language:Rust 100.0%