{"id":31923332,"url":"https://github.com/fuellabs/sway-standards","last_synced_at":"2026-02-17T07:33:19.388Z","repository":{"id":160127175,"uuid":"633959722","full_name":"FuelLabs/sway-standards","owner":"FuelLabs","description":"SRC Standards set for the Sway language","archived":false,"fork":false,"pushed_at":"2025-07-02T10:54:03.000Z","size":1465,"stargazers_count":166,"open_issues_count":10,"forks_count":51,"subscribers_count":13,"default_branch":"master","last_synced_at":"2025-07-02T11:47:43.472Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Sway","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/FuelLabs.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":".github/CODEOWNERS","security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2023-04-28T17:17:31.000Z","updated_at":"2025-07-02T10:54:07.000Z","dependencies_parsed_at":"2023-11-20T10:28:41.285Z","dependency_job_id":"e04edeca-ee91-41ab-a8df-b280c8f34e42","html_url":"https://github.com/FuelLabs/sway-standards","commit_stats":null,"previous_names":[],"tags_count":25,"template":false,"template_full_name":null,"purl":"pkg:github/FuelLabs/sway-standards","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/FuelLabs%2Fsway-standards","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/FuelLabs%2Fsway-standards/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/FuelLabs%2Fsway-standards/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/FuelLabs%2Fsway-standards/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/FuelLabs","download_url":"https://codeload.github.com/FuelLabs/sway-standards/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/FuelLabs%2Fsway-standards/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":279017229,"owners_count":26086016,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-10-13T02:00:06.723Z","response_time":61,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-10-13T23:49:28.650Z","updated_at":"2026-02-17T07:33:19.377Z","avatar_url":"https://github.com/FuelLabs.png","language":"Sway","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cp align=\"center\"\u003e\n    \u003cpicture\u003e\n        \u003csource media=\"(prefers-color-scheme: dark)\" srcset=\"assets/sway-standards-logo-dark-theme.png\"\u003e\n        \u003cimg alt=\"Sway Standards logo\" width=\"400px\" src=\"assets/sway-standards-logo-light-theme.png\"\u003e\n    \u003c/picture\u003e\n\u003c/p\u003e\n\n\u003cp align=\"center\"\u003e\n    \u003ca href=\"https://github.com/FuelLabs/sway-standards/actions/workflows/ci.yaml\" alt=\"CI\"\u003e\n        \u003cimg src=\"https://github.com/FuelLabs/sway-standards/actions/workflows/ci.yaml/badge.svg\" /\u003e\n    \u003c/a\u003e\n    \u003ca href=\"https://crates.io/crates/forc/0.70.2\" alt=\"forc\"\u003e\n        \u003cimg src=\"https://img.shields.io/badge/forc-v0.70.2-orange\" /\u003e\n    \u003c/a\u003e\n    \u003ca href=\"./LICENSE\" alt=\"forc\"\u003e\n        \u003cimg src=\"https://img.shields.io/github/license/FuelLabs/sway-standards\" /\u003e\n    \u003c/a\u003e\n    \u003ca href=\"https://discord.gg/xfpK4Pe\"\u003e\n        \u003cimg src=\"https://img.shields.io/discord/732892373507375164?color=6A7EC2\u0026logo=discord\u0026logoColor=ffffff\u0026labelColor=6A7EC2\u0026label=Discord\" /\u003e\n    \u003c/a\u003e\n\u003c/p\u003e\n\n## Overview\n\nThe purpose of this repository is to contain standards for the Sway Language which users can import and use.\n\nStandards 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.\n\nIf you don't find what you're looking for, feel free to create an issue and propose a new standard!\n\n\u003e **Note**\n\u003e 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.\n\n## Using a standard\n\nTo import any standard, a dependency should be added to the project's `Forc.toml` file under `[dependencies]`.\n\n```sway\n[dependencies]\nexample = \"0.0.0\"\n```\n\nThe standard you wish to use may be added as a dependency with the `forc add` command. For example, to import the SRC-20 Standard, use the following `forc` command:\n\n```bash\nforc add src20@0.8.0\n```\n\n\u003e **NOTE:**\n\u003e Be sure to set the tag to the latest release.\n\nYou may then import your desired standard in your Sway Smart Contract as so:\n\n```sway\nuse \u003cstandard\u003e::\u003cstandard_abi\u003e;\n```\n\nFor example, to import the SRC-20 Native Asset Standard use the following statement in your Sway Smart Contract file:\n\n```sway\nuse src20::SRC20;\n```\n\n## Standards\n\n### Native Assets\n\n- [SRC-20; Native Asset Standard](https://docs.fuel.network/docs/sway-standards/src-20-native-asset/) defines the implementation of a standard API for [Native Assets](https://docs.fuel.network/docs/sway/blockchain-development/native_assets) using the Sway Language.\n- [SRC-3; Mint and Burn](https://docs.fuel.network/docs/sway-standards/src-3-minting-and-burning/) is used to enable mint and burn functionality for fungible assets.\n- [SRC-6; Vault Standard](https://docs.fuel.network/docs/sway-standards/src-6-vault/) defines the implementation of a standard API for asset vaults developed in Sway.\n- [SRC-13; Soulbound Address](https://docs.fuel.network/docs/sway-standards/src-13-soulbound-address/) provides a predicate interface to lock [Native Assets](https://docs.fuel.network/docs/sway/blockchain-development/native_assets) as soulbound.\n\n### Onchain Data\n\n- [SRC-7; Onchain Asset Metadata Standard](https://docs.fuel.network/docs/sway-standards/src-7-asset-metadata/) is used to store metadata for [Native Assets](https://docs.fuel.network/docs/sway/blockchain-development/native_assets).\n- [SRC-9; Metadata Keys Standard](https://docs.fuel.network/docs/sway-standards/src-9-metadata-keys/) is used to store standardized metadata keys for [Native Assets](https://docs.fuel.network/docs/sway/blockchain-development/native_assets) in combination with the SRC-7 standard.\n\n### Offchain Data\n\n- [SRC-15; Offchain Asset Metadata Standard](https://docs.fuel.network/docs/sway-standards/src-15-offchain-asset-metadata/) enables arbitrary metadata that is not required by other contracts onchain, in a stateless manner for [Native Assets](https://docs.fuel.network/docs/sway/blockchain-development/native_assets).\n\u003c!-- TODO:\n- [SRC-17; Naming Verification Standard](https://docs.fuel.network/docs/sway-standards/src-17-naming-verification/) defines a naming verification standard for onchain identities using offchain data.\n--\u003e\n\n### Security and Access Control\n\n- [SRC-5; Ownership Standard](https://docs.fuel.network/docs/sway-standards/src-5-ownership/) is used to restrict function calls to admin users in contracts.\n- [SRC-11; Security Information Standard](https://docs.fuel.network/docs/sway-standards/src-11-security-information/) is used to make communication information readily available in the case white hat hackers find a vulnerability in a contract.\n\n### Contracts\n\n- [SRC-12; Contract Factory](https://docs.fuel.network/docs/sway-standards/src-12-contract-factory/) defines the implementation of a standard API for contract factories.\n- [SRC-14; Simple Upgradable Proxies](https://docs.fuel.network/docs/sway-standards/src-14-simple-upgradeable-proxies/) defines the implementation of a standard API for simple upgradable proxies.\n\n### Bridge\n\n- [SRC-8; Bridged Asset](https://docs.fuel.network/docs/sway-standards/src-8-bridged-asset/) defines the metadata required for an asset bridged to the Fuel Network.\n- [SRC-10; Native Bridge Standard](https://docs.fuel.network/docs/sway-standards/src-10-native-bridge/) defines the standard API for the Native Bridge between the Fuel Chain and the canonical base chain.\n\n### Encoding and Hashing\n\n- [SRC-16; Typed Structure Data](https://docs.fuel.network/docs/sway-standards/src-16-typed-structured-data/) standardize encoding and hashing of typed structured data.\n\n### Documentation\n\n- [SRC-2; Inline Documentation](https://docs.fuel.network/docs/sway-standards/src-2-inline-documentation/) defines how to document your Sway files.\n\n## Examples of Standards\n\nMinimal example implementations for every standard can be found in the [`examples/`](./examples/) folder.\n\n#### SRC-20; Native Asset Standard Examples\n\n##### - [Single Native Asset](./examples/src20-native-asset/single_asset/src/single_asset.sw)\n\nExample of the SRC-20 implementation where a contract contains a single asset with one `SubId`. This implementation is recommended for users that intend to deploy a single asset with their contract.\n\n##### - [Multi Native Asset](./examples/src20-native-asset/multi_asset/src/multi_asset.sw)\n\nExample of the SRC-20 implementation where a contract contains multiple assets with differing `SubId`s. This implementation is recommended for users that intend to deploy multiple assets with their contract.\n\n#### SRC-3; Mint and Burn Standard Examples\n\n##### - [Single Native Asset](./examples/src3-mint-burn/single_asset/src/single_asset.sw)\n\nExample of the SRC-3 implementation where a contract only mints a single asset with one `SubId`.\n\n##### - [Multi Native Asset](./examples/src3-mint-burn/multi_asset/src/multi_asset.sw)\n\nExample of the SRC-3 implementation where a contract mints multiple assets with differing `SubId`s.\n\n#### SRC-5; Ownership Examples\n\n##### - [Uninitialized](./examples/src5-ownership/uninitialized_example/src/uninitialized_example.sw)\n\nExample of the SRC-5 implementation where a contract does not have an owner set at compile time with the intent to set it during runtime.\n\n##### - [Initialized](./examples/src5-ownership/initialized_example/src/initialized_example.sw)\n\nExample of the SRC-5 implementation where a contract has an owner set at compile time.\n\n#### SRC-6; Vault Standard Examples\n\n##### [Multi Asset Vault](./examples/src6-vault/multi_asset_vault/)\n\nA basic implementation of the vault standard that supports any number of sub vaults being created for every `AssetId`.\n\n##### [Single Asset Vault](./examples/src6-vault/single_asset_vault/)\n\nA basic implementation of the vault standard demonstrating how to restrict deposits and withdrawals to a single `AssetId`.\n\n##### [Single Asset Single Sub Vault](./examples/src6-vault/single_asset_single_sub_vault/)\n\nA basic implementation of the vault standard demonstrating how to restrict deposits and withdrawals to a single `AssetId`, and to a single Sub vault.\n\n#### SRC-7; Arbitrary Asset Metadata Standard Examples\n\n##### - [Single Native Asset](./examples/src7-metadata/single_asset/src/single_asset.sw)\n\nExample of the SRC-7 implementation where metadata exists for only a single asset with one `SubId`.\n\n##### - [Multi Native Asset](./examples/src7-metadata/multi_asset/src/multi_asset.sw)\n\nExample of the SRC-7 implementation where metadata exists for multiple assets with differing `SubId`s.\n\n#### SRC-12; Contract Factory Standard Examples\n\n##### [With Configurables](./examples/src12-contract-factory/with_configurables/src/with_configurables.sw)\n\nExample of the SRC-12 implementation where contract deployments contain configurable values that differentiate the bytecode root from other contracts with the same bytecode.\n\n##### [Without Configurables](./examples/src12-contract-factory/without_configurables/src/without_configurables.sw)\n\nExample of the SRC-12 implementation where all contract deployments are identical and thus have the same bytecode and root.\n\n#### SRC-14; Simple Upgradable Proxies Standard Examples\n\n##### [Minimal](./examples/src14-simple-proxy/minimal/src/minimal.sw)\n\nExample of a minimal SRC-14 implementation with no access control.\n\n##### [Owned Proxy](./examples/src14-simple-proxy/owned/src/owned.sw)\n\nExample of a SRC-14 implementation that also implements [SRC-5](https://docs.fuel.network/docs/sway-standards/src-5-ownership/).\n\n\u003e **Note**\n\u003e All standards currently use `forc v0.70.2`.\n\n\u003c!-- TODO:\n## Contributing\n\nCheck out the [book](https://fuellabs.github.io/sway-libs/book/index.html) for more info!\n--\u003e\n\n\u003e **Note**\n\u003e 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\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffuellabs%2Fsway-standards","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffuellabs%2Fsway-standards","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffuellabs%2Fsway-standards/lists"}