From bd1e8ea041b94f4ea95ba2b35a6b0f11e992ec44 Mon Sep 17 00:00:00 2001 From: Paul Razvan Berg Date: Mon, 13 May 2024 10:41:49 +0100 Subject: [PATCH 01/44] docs: fix typos in README (#86) --- README.md | 16 ++++++++-------- SRCs/src-20.md | 4 ++-- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/README.md b/README.md index 0e5ea80..3c04803 100644 --- a/README.md +++ b/README.md @@ -22,9 +22,9 @@ ## Overview -The purpose of this repository is to contain standards for the Sway Language which users can import and use. +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. +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! @@ -66,7 +66,7 @@ To import a standard the following should be added to the project's `Forc.toml` standards = { git = "https://github.com/FuelLabs/sway-standards", tag = "v0.5.0" } ``` -> **NOTE:** +> **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: @@ -87,7 +87,7 @@ Minimal example implementations for every standard can be found in the [`example #### SRC-20; Native Asset Standard Examples -##### - [Single Native Assset](./examples/src20-native-asset/single_asset/src/single_asset.sw) +##### - [Single Native Asset](./examples/src20-native-asset/single_asset/src/single_asset.sw) Example 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. @@ -119,15 +119,15 @@ Example of the SRC-5 implementation where a contract has an owner set at compile ##### [Multi Asset Vault](./examples/src6-vault/multi_asset_vault/) -A basic implementation of the vault standard that supports any number of sub vaults being created for every AssetId. +A basic implementation of the vault standard that supports any number of sub vaults being created for every `AssetId`. ##### [Single Asset Vault](./examples/src6-vault/single_asset_vault/) -A basic implementation of the vault standard demonstrating how to restrict deposits and withdrawals to a single AssetId. +A basic implementation of the vault standard demonstrating how to restrict deposits and withdrawals to a single `AssetId`. ##### [Single Asset Single Sub Vault](./examples/src6-vault/single_asset_single_sub_vault/) -A basic implementation of the vault standard demonstrating how to restrict deposits and withdrawals to a single AssetId, and to a single Sub vault. +A basic implementation of the vault standard demonstrating how to restrict deposits and withdrawals to a single `AssetId`, and to a single Sub vault. #### SRC-7; Arbitrary Asset Metadata Standard Examples @@ -147,7 +147,7 @@ Example of the SRC-12 implementation where contract deployments contain configur ##### [Without Configurables](./examples/src12-contract-factory/without_configurables/src/without_configurables.sw) -Example of the SRC-12 implementation where all contract deployments are identitcal and thus have the same bytecode and root. +Example of the SRC-12 implementation where all contract deployments are identical and thus have the same bytecode and root. > **Note** > All standards currently use `forc v0.56.0`. diff --git a/SRCs/src-20.md b/SRCs/src-20.md index 49bcdbb..6d3e1f8 100644 --- a/SRCs/src-20.md +++ b/SRCs/src-20.md @@ -11,13 +11,13 @@ The following standard allows for the implementation of a standard API for [Nati # Motivation -A standard interface for [Native Assets](https://docs.fuel.network/docs/sway/blockchain-development/native_assets) on Fuel allows external applications to interact with the native asset, whether that be decentralized exchanges, wallets, or Fuel's [Scripts](https://docs.fuel.network/docs/sway/sway-program-types/scripts/) and [Predicates](https://docs.fuel.network/docs/sway/sway-program-types/predicates/). +A standard interface for [Native Assets](https://docs.fuel.network/docs/sway/blockchain-development/native_assets) on Fuel allows external applications to interact with the native asset, whether that be decentralized exchanges, wallets, or Fuel's [Scripts](https://docs.fuel.network/docs/sway/sway-program-types/scripts/) and [Predicates](https://docs.fuel.network/docs/sway/sway-program-types/predicates/). # Prior Art The SRC-20 Native Asset Standard naming pays homage to the [ERC-20 Token Standard](https://eips.ethereum.org/EIPS/eip-20) seen on Ethereum. While there is functionality we may use as a reference, it is noted that Fuel's [Native Assets](https://docs.fuel.network/docs/sway/blockchain-development/native_assets) are fundamentally different than Ethereum's tokens. -There has been a discussion of the Fungile Token Standard on the [Fuel Forum](https://forum.fuel.network/). This discussion can be found [here](https://forum.fuel.network/t/src-20-fungible-token-standard/186). +There has been a discussion of the Fungible Token Standard on the [Fuel Forum](https://forum.fuel.network/). This discussion can be found [here](https://forum.fuel.network/t/src-20-fungible-token-standard/186). There has also been a Fungible Token Standard and Non-Fungible Token Standard implementations added to the [Sway-Libs](https://github.com/FuelLabs/sway-libs) repository before the creation of the [Sway-Standards](https://github.com/FuelLabs/sway-standards) repository. The introduction of this standard in the [Sway-Standards](https://github.com/FuelLabs/sway-standards) repository will deprecate the Sway-Libs Fungible Token Standard. From c89a7003991153504a39dc3903f69dcda4607db5 Mon Sep 17 00:00:00 2001 From: SwayStar123 Date: Tue, 14 May 2024 20:07:42 +0530 Subject: [PATCH 02/44] change vault_sub_id back to sub_id --- SRCs/src-3.md | 16 ++++++++-------- standards/src/src3.sw | 14 +++++++------- 2 files changed, 15 insertions(+), 15 deletions(-) diff --git a/SRCs/src-3.md b/SRCs/src-3.md index 5c97d0d..f7e7c58 100644 --- a/SRCs/src-3.md +++ b/SRCs/src-3.md @@ -16,27 +16,27 @@ Minting and burning were initially added to the [SRC-20](./src-20.md) standard. The following functions MUST be implemented to follow the SRC-3 standard: -### `fn mint(recipient: Identity, vault_sub_id: SubId, amount: u64)` +### `fn mint(recipient: Identity, sub_id: SubId, amount: u64)` -This function MUST mint `amount` coins with sub-identifier `vault_sub_id` and transfer them to the `recipient`. +This function MUST mint `amount` coins with sub-identifier `sub_id` and transfer them to the `recipient`. This function MAY contain arbitrary conditions for minting, and revert if those conditions are not met. ##### Arguments * `recipient` - The `Identity` to which the newly minted asset is transferred to. -* `vault_sub_id` - The sub-identifier of the asset to mint. +* `sub_id` - The sub-identifier of the asset to mint. * `amount` - The quantity of coins to mint. -### `fn burn(vault_sub_id: SubId, amount: u64)` +### `fn burn(sub_id: SubId, amount: u64)` -This function MUST burn `amount` coins with the sub-identifier `vault_sub_id` and MUST ensure the `AssetId` of the asset is the sha-256 hash of `(ContractId, SubId)` for the implementing contract. +This function MUST burn `amount` coins with the sub-identifier `sub_id` and MUST ensure the `AssetId` of the asset is the sha-256 hash of `(ContractId, SubId)` for the implementing contract. This function MUST ensure at least `amount` coins have been transferred to the implementing contract. This function MUST update the total supply defined in the [SRC-20](./src-20.md) standard. This function MAY contain arbitrary conditions for burning, and revert if those conditions are not met. ##### Arguments -* `vault_sub_id` - The sub-identifier of the asset to burn. +* `sub_id` - The sub-identifier of the asset to burn. * `amount` - The quantity of coins to burn. # Rationale @@ -57,10 +57,10 @@ The burn function may also introduce a security consideration if the total suppl ```rust abi MySRC3Asset { #[storage(read, write)] - fn mint(recipient: Identity, vault_sub_id: SubId, amount: u64); + fn mint(recipient: Identity, sub_id: SubId, amount: u64); #[payable] #[storage(read, write)] - fn burn(vault_sub_id: SubId, amount: u64); + fn burn(sub_id: SubId, amount: u64); } ``` diff --git a/standards/src/src3.sw b/standards/src/src3.sw index eb52e00..8fede48 100644 --- a/standards/src/src3.sw +++ b/standards/src/src3.sw @@ -1,12 +1,12 @@ library; abi SRC3 { - /// Mints new assets using the `vault_sub_id` sub-identifier. + /// Mints new assets using the `sub_id` sub-identifier. /// /// # Arguments /// /// * `recipient`: [Identity] - The user to which the newly minted asset is transferred to. - /// * `vault_sub_id`: [SubId] - The sub-identifier of the newly minted asset. + /// * `sub_id`: [SubId] - The sub-identifier of the newly minted asset. /// * `amount`: [u64] - The quantity of coins to mint. /// /// # Examples @@ -20,18 +20,18 @@ abi SRC3 { /// } /// ``` #[storage(read, write)] - fn mint(recipient: Identity, vault_sub_id: SubId, amount: u64); + fn mint(recipient: Identity, sub_id: SubId, amount: u64); - /// Burns assets sent with the given `vault_sub_id`. + /// Burns assets sent with the given `sub_id`. /// /// # Additional Information /// /// NOTE: The sha-256 hash of `(ContractId, SubId)` must match the `AssetId` where `ContractId` is the id of - /// the implementing contract and `SubId` is the given `vault_sub_id` argument. + /// the implementing contract and `SubId` is the given `sub_id` argument. /// /// # Arguments /// - /// * `vault_sub_id`: [SubId] - The sub-identifier of the asset to burn. + /// * `sub_id`: [SubId] - The sub-identifier of the asset to burn. /// * `amount`: [u64] - The quantity of coins to burn. /// /// # Examples @@ -50,5 +50,5 @@ abi SRC3 { /// ``` #[payable] #[storage(read, write)] - fn burn(vault_sub_id: SubId, amount: u64); + fn burn(sub_id: SubId, amount: u64); } From b1d6aaeb80acf6172c8c8d97a3ac9d6454cddd4c Mon Sep 17 00:00:00 2001 From: Paul Razvan Berg Date: Mon, 20 May 2024 04:36:33 +0100 Subject: [PATCH 03/44] docs: improve SRC-20 (#88) --- SRCs/src-20.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/SRCs/src-20.md b/SRCs/src-20.md index 6d3e1f8..c68ed9c 100644 --- a/SRCs/src-20.md +++ b/SRCs/src-20.md @@ -47,7 +47,7 @@ This function must return the symbol of the asset, such as “ETH”. This funct This function must return the number of decimals the asset uses - e.g. 8, which means to divide the coin amount by 100000000 to get its user representation. This function MUST return `Some` for any assets minted by the contract. -## Non-Fungible Asset Restrictions +## Non-Fungible Asset Restrictions Non-Fungible Tokens (NFT) or Non-Fungible Assets on Fuel are Native Assets and thus follow the same standard as Fungible Native Assets with some restrictions. For a Native Asset on Fuel to be deemed an NFT, the following must be applied: @@ -56,9 +56,9 @@ Non-Fungible Tokens (NFT) or Non-Fungible Assets on Fuel are Native Assets and t # Rationale -As the SRC-20 Native Asset Standard leverages Native Assets on Fuel, we do not require the implementation of certain functions such as transfer or approval. This is done directly within the FuelVM and there is no smart contract that requires updating of balances. As Fuel is UTXO based, any transfer events may be indexed on transaction receipts. +As the SRC-20 Native Asset Standard leverages Native Assets on Fuel, we do not require the implementation of certain functions such as transfer or approval. This is done directly within the FuelVM and there is no smart contract that requires updating of balances. As Fuel is UTXO based, any transfer events may be indexed on transaction receipts. -Following this, we have omitted the inclusion of any transfer functions or events. The provided specification outlines only the required functions and events to implement fully functional native assets on the Fuel Network. Additional functionality and properties may be added as needed. +Following this, we have omitted the inclusion of any transfer functions or events. The provided specification outlines only the functions necessary to implement fully functional native assets on the Fuel Network. Additional functionality and properties may be added as needed. # Backwards Compatibility @@ -87,7 +87,7 @@ abi MyAsset { # Example Implementation -## [Single Native Assset](../examples/src20-native-asset/multi_asset/src/multi_asset.sw) +## [Single Native Asset](../examples/src20-native-asset/multi_asset/src/multi_asset.sw) Example 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. From ace74e0859b87a074f88b7457d4b21e1e371c868 Mon Sep 17 00:00:00 2001 From: Paul Razvan Berg Date: Mon, 20 May 2024 04:36:56 +0100 Subject: [PATCH 04/44] docs: improve SRC-3 (#85) --- README.md | 2 +- SRCs/src-3.md | 18 +++++++++--------- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/README.md b/README.md index 3c04803..6ae3f02 100644 --- a/README.md +++ b/README.md @@ -36,7 +36,7 @@ If you don't find what you're looking for, feel free to create an issue and prop ### Native Assets - [SRC-20; Native Asset Standard](./SRCs/src-20.md) defines the implementation of a standard API for [Native Assets](https://docs.fuel.network/docs/sway/blockchain-development/native_assets) using the Sway Language. -- [SRC-3; Mint and Burn](./SRCs/src-3.md) is used to enable mint and burn functionality for Native Assets. +- [SRC-3; Mint and Burn](./SRCs/src-3.md) is used to enable mint and burn functionality for fungible assets. - [SRC-7; Arbitrary Asset Metadata Standard](./SRCs/src-7.md) is used to store metadata for [Native Assets](https://docs.fuel.network/docs/sway/blockchain-development/native_assets). - [SRC-9; Metadata Keys Standard](./SRCs/src-9.md) 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. - [SRC-6; Vault Standard](./SRCs/src-6.md) defines the implementation of a standard API for asset vaults developed in Sway. diff --git a/SRCs/src-3.md b/SRCs/src-3.md index 5c97d0d..0b9cb78 100644 --- a/SRCs/src-3.md +++ b/SRCs/src-3.md @@ -1,6 +1,6 @@ # Abstract -The following standard enables the minting and burning of native assets for any fungible assets within the Sway Language. It seeks to define mint and burn functions defined separately from the [SRC-20](./src-20.md) standard. Any contract that implements the SRC-3 standard MUST implement the [SRC-20](./src-20.md) standard. +The following standard enables the minting and burning of native assets for any fungible assets within the Sway Language. It seeks to define mint and burn functions defined separately from the [SRC-20](./src-20.md) standard. # Motivation @@ -16,27 +16,27 @@ Minting and burning were initially added to the [SRC-20](./src-20.md) standard. The following functions MUST be implemented to follow the SRC-3 standard: -### `fn mint(recipient: Identity, vault_sub_id: SubId, amount: u64)` +### `fn mint(recipient: Identity, sub_id: SubId, amount: u64)` -This function MUST mint `amount` coins with sub-identifier `vault_sub_id` and transfer them to the `recipient`. +This function MUST mint `amount` coins with sub-identifier `sub_id` and transfer them to the `recipient`. This function MAY contain arbitrary conditions for minting, and revert if those conditions are not met. ##### Arguments * `recipient` - The `Identity` to which the newly minted asset is transferred to. -* `vault_sub_id` - The sub-identifier of the asset to mint. +* `sub_id` - The sub-identifier of the asset to mint. * `amount` - The quantity of coins to mint. -### `fn burn(vault_sub_id: SubId, amount: u64)` +### `fn burn(sub_id: SubId, amount: u64)` -This function MUST burn `amount` coins with the sub-identifier `vault_sub_id` and MUST ensure the `AssetId` of the asset is the sha-256 hash of `(ContractId, SubId)` for the implementing contract. +This function MUST burn `amount` coins with the sub-identifier `sub_id` and MUST ensure the `AssetId` of the asset is the sha-256 hash of `(ContractId, SubId)` for the implementing contract. This function MUST ensure at least `amount` coins have been transferred to the implementing contract. This function MUST update the total supply defined in the [SRC-20](./src-20.md) standard. This function MAY contain arbitrary conditions for burning, and revert if those conditions are not met. ##### Arguments -* `vault_sub_id` - The sub-identifier of the asset to burn. +* `sub_id` - The sub-identifier of the asset to burn. * `amount` - The quantity of coins to burn. # Rationale @@ -57,10 +57,10 @@ The burn function may also introduce a security consideration if the total suppl ```rust abi MySRC3Asset { #[storage(read, write)] - fn mint(recipient: Identity, vault_sub_id: SubId, amount: u64); + fn mint(recipient: Identity, sub_id: SubId, amount: u64); #[payable] #[storage(read, write)] - fn burn(vault_sub_id: SubId, amount: u64); + fn burn(sub_id: SubId, amount: u64); } ``` From 8a42be3ff247328b3dcf783b68e53f5962f44bdd Mon Sep 17 00:00:00 2001 From: IGI-111 Date: Tue, 21 May 2024 17:12:07 +0400 Subject: [PATCH 05/44] Update to latest Sway Transform abusive usage of configurables into constants to support latest version of Sway that uses encoded configurables. --- .github/workflows/ci.yaml | 4 +- .../hardcoded-information/src/main.sw | 65 +++++++++---------- .../variable-information/src/main.sw | 56 ++++++++-------- .../src/initialized_example.sw | 6 +- 4 files changed, 63 insertions(+), 68 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index ea85bbe..b3d1995 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -15,8 +15,8 @@ concurrency: env: CARGO_TERM_COLOR: always REGISTRY: ghcr.io - RUST_VERSION: 1.75.0 - FORC_VERSION: 0.56.0 + RUST_VERSION: 1.76.0 + FORC_VERSION: 0.59.0 CORE_VERSION: 0.24.2 PATH_TO_SCRIPTS: .github/scripts diff --git a/examples/src11-security-information/hardcoded-information/src/main.sw b/examples/src11-security-information/hardcoded-information/src/main.sw index 13e1178..fcabcae 100644 --- a/examples/src11-security-information/hardcoded-information/src/main.sw +++ b/examples/src11-security-information/hardcoded-information/src/main.sw @@ -4,25 +4,24 @@ use standards::src11::{SecurityInformation, SRC11}; use std::{string::String, vec::Vec,}; -configurable { - /// The name of the project - NAME: str[7] = __to_str_array("Example"), - /// The URL of the project - PROJECT_URL: str[19] = __to_str_array("https://example.com"), - /// The contact information of the project - CONTACT1: str[25] = __to_str_array("email:example@example.com"), - CONTACT2: str[41] = __to_str_array("link:https://example.com/security_contact"), - CONTACT3: str[20] = __to_str_array("discord:example#1234"), - /// The security policy of the project - POLICY: str[35] = __to_str_array("https://example.com/security_policy"), - /// The preferred languages of the project - PREFERRED_LANGUAGES1: str[2] = __to_str_array("en"), - PREFERRED_LANGUAGES2: str[2] = __to_str_array("ja"), - PREFERRED_LANGUAGES3: str[2] = __to_str_array("zh"), - PREFERRED_LANGUAGES4: str[2] = __to_str_array("hi"), - /// The encryption key of the project - ENCRYPTION: str[751] = __to_str_array( - "-----BEGIN PGP PUBLIC KEY BLOCK----- +/// The name of the project +const NAME: str[7] = __to_str_array("Example"); +/// The URL of the project +const PROJECT_URL: str[19] = __to_str_array("https://example.com"); +/// The contact information of the project +const CONTACT1: str[25] = __to_str_array("email:example@example.com"); +const CONTACT2: str[41] = __to_str_array("link:https://example.com/security_contact"); +const CONTACT3: str[20] = __to_str_array("discord:example#1234"); +/// The security policy of the project +const POLICY: str[35] = __to_str_array("https://example.com/security_policy"); +/// The preferred languages of the project +const PREFERRED_LANGUAGES1: str[2] = __to_str_array("en"); +const PREFERRED_LANGUAGES2: str[2] = __to_str_array("ja"); +const PREFERRED_LANGUAGES3: str[2] = __to_str_array("zh"); +const PREFERRED_LANGUAGES4: str[2] = __to_str_array("hi"); +/// The encryption key of the project +const ENCRYPTION: str[751] = __to_str_array( + "-----BEGIN PGP PUBLIC KEY BLOCK----- Comment: Alice's OpenPGP certificate Comment: https://www.ietf.org/id/draft-bre-openpgp-samples-01.html @@ -37,20 +36,20 @@ DAAKCRDyMVUMT0fjjlnQAQDFHUs6TIcxrNTtEZFjUFm1M0PJ1Dng/cDW4xN80fsn 0QEA22Kr7VkCjeAEC08VSTeV+QFsmz55/lntWkwYWhmvOgE= =iIGO -----END PGP PUBLIC KEY BLOCK-----", - ), - /// The URL of the project's source code - SOURCE_CODE: str[31] = __to_str_array("https://github.com/example/test"), - /// The release identifier of this build - SOURCE_RELEASE: str[6] = __to_str_array("v1.0.0"), - /// The revision identifier of this build - SOURCE_REVISION: str[12] = __to_str_array("a1b2c3d4e5f6"), - /// The URL of the project's auditors - AUDITORS: str[28] = __to_str_array("https://example.com/auditors"), - /// The URL of the project's acknowledgements - ACKNOWLEDGEMENTS: str[36] = __to_str_array("https://example.com/acknowledgements"), - /// The URL of the project's additional information - ADDITIONAL_INFORMATION: str[42] = __to_str_array("https://example.com/additional_information"), -} +); +/// The URL of the project's source code +const SOURCE_CODE: str[31] = __to_str_array("https://github.com/example/test"); +/// The release identifier of this build +const SOURCE_RELEASE: str[6] = __to_str_array("v1.0.0"); +/// The revision identifier of this build +const SOURCE_REVISION: str[12] = __to_str_array("a1b2c3d4e5f6"); +/// The URL of the project's auditors +const AUDITORS: str[28] = __to_str_array("https://example.com/auditors"); +/// The URL of the project's acknowledgements +const ACKNOWLEDGEMENTS: str[36] = __to_str_array("https://example.com/acknowledgements"); +/// The URL of the project's additional information +const ADDITIONAL_INFORMATION: str[42] = __to_str_array("https://example.com/additional_information"); + impl SRC11 for Contract { #[storage(read)] fn security_information() -> SecurityInformation { diff --git a/examples/src11-security-information/variable-information/src/main.sw b/examples/src11-security-information/variable-information/src/main.sw index a3e078b..b2d3f88 100644 --- a/examples/src11-security-information/variable-information/src/main.sw +++ b/examples/src11-security-information/variable-information/src/main.sw @@ -4,21 +4,20 @@ use standards::src11::{SecurityInformation, SRC11}; use std::{storage::{storage_string::*, storage_vec::*,}, string::String, vec::Vec,}; -configurable { - /// The name of the project - NAME: str[7] = __to_str_array("Example"), - /// The URL of the project - PROJECT_URL: str[19] = __to_str_array("https://example.com"), - /// The security policy of the project - POLICY: str[35] = __to_str_array("https://example.com/security_policy"), - /// The preferred languages of the project - PREFERRED_LANGUAGES1: str[2] = __to_str_array("en"), - PREFERRED_LANGUAGES2: str[2] = __to_str_array("ja"), - PREFERRED_LANGUAGES3: str[2] = __to_str_array("zh"), - PREFERRED_LANGUAGES4: str[2] = __to_str_array("hi"), - /// The encryption key of the project - ENCRYPTION: str[751] = __to_str_array( - "-----BEGIN PGP PUBLIC KEY BLOCK----- +/// The name of the project +const NAME: str[7] = __to_str_array("Example"); +/// The URL of the project +const PROJECT_URL: str[19] = __to_str_array("https://example.com"); +/// The security policy of the project +const POLICY: str[35] = __to_str_array("https://example.com/security_policy"); +/// The preferred languages of the project +const PREFERRED_LANGUAGES1: str[2] = __to_str_array("en"); +const PREFERRED_LANGUAGES2: str[2] = __to_str_array("ja"); +const PREFERRED_LANGUAGES3: str[2] = __to_str_array("zh"); +const PREFERRED_LANGUAGES4: str[2] = __to_str_array("hi"); +/// The encryption key of the project +const ENCRYPTION: str[751] = __to_str_array( + "-----BEGIN PGP PUBLIC KEY BLOCK----- Comment: Alice's OpenPGP certificate Comment: https://www.ietf.org/id/draft-bre-openpgp-samples-01.html @@ -33,20 +32,19 @@ DAAKCRDyMVUMT0fjjlnQAQDFHUs6TIcxrNTtEZFjUFm1M0PJ1Dng/cDW4xN80fsn 0QEA22Kr7VkCjeAEC08VSTeV+QFsmz55/lntWkwYWhmvOgE= =iIGO -----END PGP PUBLIC KEY BLOCK-----", - ), - /// The URL of the project's source code - SOURCE_CODE: str[31] = __to_str_array("https://github.com/example/test"), - /// The release identifier of this build - SOURCE_RELEASE: str[6] = __to_str_array("v1.0.0"), - /// The revision identifier of this build - SOURCE_REVISION: str[12] = __to_str_array("a1b2c3d4e5f6"), - /// The URL of the project's auditors - AUDITORS: str[28] = __to_str_array("https://example.com/auditors"), - /// The URL of the project's acknowledgements - ACKNOWLEDGEMENTS: str[36] = __to_str_array("https://example.com/acknowledgements"), - /// The URL of the project's additional information - ADDITIONAL_INFORMATION: str[42] = __to_str_array("https://example.com/additional_information"), -} +); +/// The URL of the project's source code +const SOURCE_CODE: str[31] = __to_str_array("https://github.com/example/test"); +/// The release identifier of this build +const SOURCE_RELEASE: str[6] = __to_str_array("v1.0.0"); +/// The revision identifier of this build +const SOURCE_REVISION: str[12] = __to_str_array("a1b2c3d4e5f6"); +/// The URL of the project's auditors +const AUDITORS: str[28] = __to_str_array("https://example.com/auditors"); +/// The URL of the project's acknowledgements +const ACKNOWLEDGEMENTS: str[36] = __to_str_array("https://example.com/acknowledgements"); +/// The URL of the project's additional information +const ADDITIONAL_INFORMATION: str[42] = __to_str_array("https://example.com/additional_information"); storage { /// The contact information for the security contact. diff --git a/examples/src5-ownership/initialized_example/src/initialized_example.sw b/examples/src5-ownership/initialized_example/src/initialized_example.sw index dae9f36..ee71143 100644 --- a/examples/src5-ownership/initialized_example/src/initialized_example.sw +++ b/examples/src5-ownership/initialized_example/src/initialized_example.sw @@ -3,10 +3,8 @@ contract; use standards::src5::{SRC5, State}; use std::constants::ZERO_B256; -configurable { - /// The owner of this contract at deployment. - INITIAL_OWNER: Identity = Identity::Address(Address::from(ZERO_B256)), -} +/// The owner of this contract at deployment. +const INITIAL_OWNER: Identity = Identity::Address(Address::from(ZERO_B256)); storage { /// The owner in storage. From 78038586adce592a5a0ce132d1998d96534b6d33 Mon Sep 17 00:00:00 2001 From: IGI-111 Date: Wed, 22 May 2024 12:49:55 +0400 Subject: [PATCH 06/44] Update README.md --- README.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 3c04803..62f4ede 100644 --- a/README.md +++ b/README.md @@ -9,8 +9,8 @@ - - + + @@ -150,7 +150,7 @@ Example of the SRC-12 implementation where contract deployments contain configur Example of the SRC-12 implementation where all contract deployments are identical and thus have the same bytecode and root. > **Note** -> All standards currently use `forc v0.56.0`. +> All standards currently use `forc v0.59.0`. Closes #\ + +## Checklist + +- [ ] I have linked to any relevant issues. +- [ ] I have commented my code, particularly in hard-to-understand areas. +- [ ] I have updated the documentation where relevant (API docs, the reference, and the Sway book). + - [ ] If my change requires substantial documentation changes, I have [requested support from the DevRel team](https://github.com/FuelLabs/devrel-requests/issues/new/choose) +- [ ] I have added tests that prove my fix is effective or that my feature works. +- [ ] I have added (or requested a maintainer to add) the necessary `Breaking*` or `New Feature` labels where relevant. +- [ ] I have done my best to ensure that my PR adheres to [the Fuel Labs Code Review Standards](https://github.com/FuelLabs/rfcs/blob/master/text/code-standards/external-contributors.md). +- [ ] I have requested a review from the relevant team or maintainers. From d9c30baf1cb6c2b58c9cb50c070cd3d1fd62f3e4 Mon Sep 17 00:00:00 2001 From: K1-R1 <77465250+K1-R1@users.noreply.github.com> Date: Thu, 30 May 2024 09:51:57 +0100 Subject: [PATCH 19/44] Update README.md --- README.md | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/README.md b/README.md index c6dc532..c89ae99 100644 --- a/README.md +++ b/README.md @@ -48,6 +48,7 @@ If you don't find what you're looking for, feel free to create an issue and prop ### Contracts - [SRC-12; Contract Factory](./SRCs/src-12.md) defines the implementation of a standard API for contract factories. +- [SRC-14; Simple Upgradable Proxies](./SRCs/src-14.md) defines the implementation of a standard API for simple upgradable proxies. ### Bridge @@ -149,6 +150,16 @@ Example of the SRC-12 implementation where contract deployments contain configur Example of the SRC-12 implementation where all contract deployments are identical and thus have the same bytecode and root. +#### SRC-14; Simple Upgradable Proxies Standard Examples + +##### [Minimal](./examples/src14-simple-proxy/minimal/src/minimal.sw) + +Example of a minimal SRC-14 implementation with no access control. + +##### [Owned Proxy](./examples/src14-simple-proxy/owned/src/owned.sw) + +Example of a SRC-14 implementation that also implements [SRC-5](https://github.com/FuelLabs/sway-standards/blob/master/SRCs/src-5.md). + > **Note** > All standards currently use `forc v0.59.0`. From b670eb6bcaf40a2d831f1e2923d9f5e179bfed71 Mon Sep 17 00:00:00 2001 From: bitzoic Date: Thu, 30 May 2024 21:11:32 +0800 Subject: [PATCH 20/44] Fix README for release --- README.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index c6dc532..1b62f12 100644 --- a/README.md +++ b/README.md @@ -9,8 +9,8 @@ - - + + @@ -150,7 +150,7 @@ Example of the SRC-12 implementation where contract deployments contain configur Example of the SRC-12 implementation where all contract deployments are identical and thus have the same bytecode and root. > **Note** -> All standards currently use `forc v0.59.0`. +> All standards currently use `forc v0.60.0`. +##### `caller`: `Identity` The `caller` field MUST represent the Identity which called the withdraw function. -##### - `receiver`: `Identity` +##### `receiver`: `Identity` The `receiver` field MUST represent the Identity which received the withdrawn assets. -##### - `underlying_asset`: `AssetId` +##### `underlying_asset`: `AssetId` -The `underlying_asset` field MUST represent the AssetId of the asset that was withdrawn. +The `underlying_asset` field MUST represent the `AssetId` of the asset that was withdrawn. -##### - `vault_sub_id`: `SubId` +##### `vault_sub_id`: `SubId` The `vault_sub_id` field MUST represent the SubId of the vault from which was withdrawn. -##### - `withdrawn_amount`: `u64` +##### `withdrawn_amount`: `u64` The `withdrawn_amount` field MUST represent the `u64` amount of coins withdrawn. -##### - `burned_shares`: `u64` +##### `burned_shares`: `u64` The `burned_shares` field MUST represent the `u64` amount of shares burned. @@ -137,7 +138,7 @@ The ABI discussed covers the known use cases of asset vaults while allowing safe ## Backwards Compatibility -This standard is fully compatible with the [SRC-20 standard](./src-20.md). +This standard is fully compatible with the [SRC-20 standard](./src-20-native-asset.md). ## Security Considerations @@ -170,7 +171,7 @@ abi SRC6 { ### Multi Asset Vault -A basic implementation of the vault standard that supports any number of sub vaults being created for every AssetId. +A basic implementation of the vault standard that supports any number of sub vaults being created for every `AssetId`. ```sway {{#include ../examples/src6-vault/multi_asset_vault/src/main.sw}} @@ -178,7 +179,7 @@ A basic implementation of the vault standard that supports any number of sub vau ### Single Asset Vault -A basic implementation of the vault standard demonstrating how to restrict deposits and withdrawals to a single AssetId. +A basic implementation of the vault standard demonstrating how to restrict deposits and withdrawals to a single `AssetId`. ```sway {{#include ../examples/src6-vault/single_asset_vault/src/main.sw}} @@ -186,7 +187,7 @@ A basic implementation of the vault standard demonstrating how to restrict depos ## Single Asset Single Sub Vault -A basic implementation of the vault standard demonstrating how to restrict deposits and withdrawals to a single AssetId, and to a single Sub vault. +A basic implementation of the vault standard demonstrating how to restrict deposits and withdrawals to a single `AssetId`, and to a single Sub vault. ```sway {{#include ../examples/src6-vault/single_asset_single_sub_vault/src/main.sw}} diff --git a/docs/src-7-asset-metadata.md b/docs/src/src-7-asset-metadata.md similarity index 92% rename from docs/src-7-asset-metadata.md rename to docs/src/src-7-asset-metadata.md index cdba678..4e6654a 100644 --- a/docs/src-7-asset-metadata.md +++ b/docs/src/src-7-asset-metadata.md @@ -1,6 +1,6 @@ # SRC-7: Arbitrary Native Asset Metadata -The following standard attempts to define the retrieval of on-chain arbitrary metadata for any [Native Asset](https://docs.fuel.network/docs/sway/blockchain-development/native_assets). Any contract that implements the SRC-7 standard MUST implement the [SRC-20](./src-20.md) standard. +The following standard attempts to define the retrieval of on-chain arbitrary metadata for any [Native Asset](https://docs.fuel.network/docs/sway/blockchain-development/native_assets). Any contract that implements the SRC-7 standard MUST implement the [SRC-20](./src-20-native-asset.md) standard. ## Motivation @@ -10,7 +10,7 @@ The SRC-7 standard seeks to enable data-rich assets on the Fuel Network while ma The use of generic metadata was originally found in the Sway-Lib's [NFT Library](https://github.com/FuelLabs/sway-libs/tree/v0.12.0/libs/nft) which did not use Fuel's [Native Assets](https://docs.fuel.network/docs/sway/blockchain-development/native_assets). This library has since been deprecated. -A previous definition for a metadata standard was written in the original edit of the now defunct [SRC-721](https://github.com/FuelLabs/sway-standards/issues/2). This has since been replaced with the [SRC-20](./src-20.md) standard as `SubId` was introduced to enable multiple assets to be minted from a single contract. +A previous definition for a metadata standard was written in the original edit of the now defunct [SRC-721](https://github.com/FuelLabs/sway-standards/issues/2). This has since been replaced with the [SRC-20](./src-20-native-asset.md) standard as `SubId` was introduced to enable multiple assets to be minted from a single contract. The standard takes inspiration from [ENS's public resolver](https://docs.ens.domains/contract-api-reference/publicresolver) with the use of a `String` as the key. This should enable human-readable keys to help minimize errors and enable the standardization of certain keys, such as "image" as opposed to an `enum` or `u64` representation of keys. @@ -50,7 +50,7 @@ The SRC-7 standard should allow for data-rich assets to interact with one anothe ## Backwards Compatibility -This standard is compatible with Fuel's [Native Assets](https://docs.fuel.network/docs/sway/blockchain-development/native_assets) and the [SRC-20](./src-20.md) standard. It also maintains compatibility with existing standards in other ecosystems. +This standard is compatible with Fuel's [Native Assets](https://docs.fuel.network/docs/sway/blockchain-development/native_assets) and the [SRC-20](./src-20-native-asset.md) standard. It also maintains compatibility with existing standards in other ecosystems. ## Security Considerations @@ -75,7 +75,7 @@ Example of the SRC-7 implementation where metadata exists for only a single asse {{#include ../examples/src7-metadata/single_asset/src/single_asset.sw}} ``` -### Mutli Native Asset +### Multi Native Asset Example of the SRC-7 implementation where metadata exists for multiple assets with differing `SubId` values. diff --git a/docs/src-8-bridged-asset.md b/docs/src/src-8-bridged-asset.md similarity index 93% rename from docs/src-8-bridged-asset.md rename to docs/src/src-8-bridged-asset.md index de85ef0..d703626 100644 --- a/docs/src-8-bridged-asset.md +++ b/docs/src/src-8-bridged-asset.md @@ -1,6 +1,6 @@ # SRC-8: Bridged Asset -The following standard attempts to define the retrieval of relevant on-chain metadata for any bridged [Native Assets](https://docs.fuel.network/docs/sway/blockchain-development/native_assets). Any contract that implements the SRC-8 standard MUST implement the [SRC-7](./src-7.md) and [SRC-20](./src-20.md) standards. +The following standard attempts to define the retrieval of relevant on-chain metadata for any bridged [Native Assets](https://docs.fuel.network/docs/sway/blockchain-development/native_assets). Any contract that implements the SRC-8 standard MUST implement the [SRC-7](./src-7-asset-metadata.md) and [SRC-20](./src-20-native-asset.md) standards. ## Motivation @@ -8,7 +8,7 @@ The SRC-8 standard seeks to enable relevant data for bridged assets on the Fuel ## Prior Art -The use of generic metadata for [Native Assets](https://docs.fuel.network/docs/sway/blockchain-development/native_assets) is defined in the [SRC-7](./src-7.md) standard. This standard integrates into the existing [SRC-7](./src-7.md) standard. +The use of generic metadata for [Native Assets](https://docs.fuel.network/docs/sway/blockchain-development/native_assets) is defined in the [SRC-7](./src-7-asset-metadata.md) standard. This standard integrates into the existing [SRC-7](./src-7-asset-metadata.md) standard. ## Specification @@ -48,7 +48,7 @@ The SRC-8 standard should allow for data on any bridged assets on the Fuel Netwo ## Backwards Compatibility -This standard is compatible with Fuel's [Native Assets](https://docs.fuel.network/docs/sway/blockchain-development/native_assets), the [SRC-20](./src-20.md) standard, and the [SRC-7](./src-7.md) standard. +This standard is compatible with Fuel's [Native Assets](https://docs.fuel.network/docs/sway/blockchain-development/native_assets), the [SRC-20](./src-20-native-asset.md) standard, and the [SRC-7](./src-7-asset-metadata.md) standard. The standard is also compatible with both tokens and NFTs native to other ecosystems by introducing a token ID element of the original chain. diff --git a/docs/src-9-metadata-keys.md b/docs/src/src-9-metadata-keys.md similarity index 96% rename from docs/src-9-metadata-keys.md rename to docs/src/src-9-metadata-keys.md index 7882cd3..9558b3c 100644 --- a/docs/src-9-metadata-keys.md +++ b/docs/src/src-9-metadata-keys.md @@ -1,6 +1,6 @@ # SRC-9: Native Asset -The following standard attempts to define the keys of relevant on-chain metadata for any [Native Assets](https://docs.fuel.network/docs/sway/blockchain-development/native_assets). Any contract that implements the SRC-9 standard MUST implement the [SRC-7](./src-7.md) and [SRC-20](./src-20.md) standards. This is a living standard where revisions may be made as the ecosystem evolves. +The following standard attempts to define the keys of relevant on-chain metadata for any [Native Assets](https://docs.fuel.network/docs/sway/blockchain-development/native_assets). Any contract that implements the SRC-9 standard MUST implement the [SRC-7](./src-7-asset-metadata.md) and [SRC-20](./src-20-native-asset.md) standards. This is a living standard where revisions may be made as the ecosystem evolves. ## Motivation @@ -8,7 +8,7 @@ The SRC-9 standard seeks to enable relevant data for assets on the Fuel Network. ## Prior Art -The use of generic metadata for [Native Assets](https://docs.fuel.network/docs/sway/blockchain-development/native_assets) is defined in the [SRC-7](./src-7.md) standard. This standard integrates into the existing [SRC-7](./src-7.md) standard. +The use of generic metadata for [Native Assets](https://docs.fuel.network/docs/sway/blockchain-development/native_assets) is defined in the [SRC-7](./src-7-asset-metadata.md) standard. This standard integrates into the existing [SRC-7](./src-7-asset-metadata.md) standard. ## Specification @@ -349,7 +349,7 @@ The SRC-9 standard should allow for standardized keys for metadata on the Fuel N ## Backwards Compatibility -This standard is compatible with Fuel's [Native Assets](https://docs.fuel.network/docs/sway/blockchain-development/native_assets), the [SRC-20](./src-20.md) standard, and the [SRC-7](./src-7.md) standard. +This standard is compatible with Fuel's [Native Assets](https://docs.fuel.network/docs/sway/blockchain-development/native_assets), the [SRC-20](./src-20-native-asset.md) standard, and the [SRC-7](./src-7-asset-metadata.md) standard. ## Security Considerations From caf246d073f206999237b7d0febb9fbdf9953981 Mon Sep 17 00:00:00 2001 From: sarahschwartz <58856580+sarahschwartz@users.noreply.github.com> Date: Thu, 30 May 2024 15:05:49 -0600 Subject: [PATCH 23/44] fixes --- docs/spell-check-custom-words.txt | 3 ++- docs/src/src-13-soulbound-address.md | 2 +- docs/src/src-6-vault.md | 25 ++++++++++++------------- 3 files changed, 15 insertions(+), 15 deletions(-) diff --git a/docs/spell-check-custom-words.txt b/docs/spell-check-custom-words.txt index 8d09d7e..e85a196 100644 --- a/docs/spell-check-custom-words.txt +++ b/docs/spell-check-custom-words.txt @@ -259,4 +259,5 @@ WAV OGA glTF GLB -Uninitalized \ No newline at end of file +Uninitalized +upgradeability \ No newline at end of file diff --git a/docs/src/src-13-soulbound-address.md b/docs/src/src-13-soulbound-address.md index 197476e..5a7b89c 100644 --- a/docs/src/src-13-soulbound-address.md +++ b/docs/src/src-13-soulbound-address.md @@ -52,7 +52,7 @@ fn main() -> bool { The *Soulbound Address* is the *Soulbound Address Predicate*'s predicate address. A predicate's address(the bytecode root) is defined [here](https://github.com/FuelLabs/fuel-specs/blob/master/src/identifiers/predicate-id.md). -The *Soulbound Address* may be computed from the *Soulbound Address Predicate*'s bytecode both on-chain or off-chain. For off-chain computation, please refer to the fuels-rs [predicate docs](https://docs.fuel.network/docs/fuels-rs/predicates/). For on-chain computation, please refer to Sway-Lib's [Bytecode Library](https://github.com/FuelLabs/sway-libs/tree/master/libs/bytecode). +The *Soulbound Address* may be computed from the *Soulbound Address Predicate*'s bytecode both on-chain or off-chain. For off-chain computation, please refer to the fuels-rs [predicate docs](https://docs.fuel.network/docs/fuels-rs/predicates/). For on-chain computation, please refer to Sway-Lib's [Bytecode Library](https://docs.fuel.network/docs/sway-libs/bytecode/). ## Rationale diff --git a/docs/src/src-6-vault.md b/docs/src/src-6-vault.md index cd90d84..f2ad23f 100644 --- a/docs/src/src-6-vault.md +++ b/docs/src/src-6-vault.md @@ -75,27 +75,27 @@ The `Deposit` struct MUST be logged whenever new shares are minted via the `depo The `Deposit` log SHALL have the following fields. -##### `caller`: `Identity` +**`caller`: `Identity`** The `caller` field MUST represent the `Identity` which called the deposit function. -##### `receiver`: `Identity` +**`receiver`: `Identity`** The `receiver` field MUST represent the `Identity` which received the vault shares. -##### `underlying_asset`: `AssetId` +**`underlying_asset`: `AssetId`** The `underlying_asset` field MUST represent the `AssetId` of the asset which was deposited into the vault. -##### `vault_sub_id`: `SubId` +**`vault_sub_id`: `SubId`** The `vault_sub_id` field MUST represent the `SubId` of the vault which was deposited into. -##### `deposited_amount`: `u64` +**`deposited_amount`: `u64`** The `deposited_amount` field MUST represent the `u64` amount of assets deposited into the vault. -##### `minted_shares`: `u64` +**`minted_shares`: `u64`** The `minted_shares` field MUST represent the `u64` amount of shares minted. @@ -107,28 +107,27 @@ The `Withdraw` struct MUST be logged whenever shares are redeemed for assets via The `Withdraw` log SHALL have the following fields. - -##### `caller`: `Identity` +**`caller`: `Identity`** The `caller` field MUST represent the Identity which called the withdraw function. -##### `receiver`: `Identity` +**`receiver`: `Identity`** The `receiver` field MUST represent the Identity which received the withdrawn assets. -##### `underlying_asset`: `AssetId` +**`underlying_asset`: `AssetId`** The `underlying_asset` field MUST represent the `AssetId` of the asset that was withdrawn. -##### `vault_sub_id`: `SubId` +**`vault_sub_id`: `SubId`** The `vault_sub_id` field MUST represent the SubId of the vault from which was withdrawn. -##### `withdrawn_amount`: `u64` +**`withdrawn_amount`: `u64`** The `withdrawn_amount` field MUST represent the `u64` amount of coins withdrawn. -##### `burned_shares`: `u64` +**`burned_shares`: `u64`** The `burned_shares` field MUST represent the `u64` amount of shares burned. From 11c0a788b7502faa5fe85ced2b44ecb92513339a Mon Sep 17 00:00:00 2001 From: sarahschwartz <58856580+sarahschwartz@users.noreply.github.com> Date: Thu, 30 May 2024 15:57:38 -0600 Subject: [PATCH 24/44] rename files --- README.md | 20 ++++++------- docs/src/SUMMARY.md | 26 ++++++++--------- ...et-metadata.md => asset-metadata-src-7.md} | 6 ++-- ...ridged-asset.md => bridged-asset-src-8.md} | 6 ++-- ...-factory.md => contract-factory-src-12.md} | 0 docs/src/index.md | 28 +++++++++---------- ...ation.md => inline-documentation-src-2.md} | 0 ...etadata-keys.md => metadata-keys-src-9.md} | 6 ++-- ...urning.md => minting-and-burning-src-3.md} | 14 +++++----- ...native-asset.md => native-asset-src-20.md} | 0 ...tive-bridge.md => native-bridge-src-10.md} | 4 +-- ...{src-5-ownership.md => ownership-src-5.md} | 0 ...tion.md => security-information-src-11.md} | 0 ...d => simple-upgradeable-proxies-src-14.md} | 4 +-- ...address.md => soulbound-address-src-13.md} | 2 +- docs/src/{src-6-vault.md => vault-src-6.md} | 4 +-- 16 files changed, 60 insertions(+), 60 deletions(-) rename docs/src/{src-7-asset-metadata.md => asset-metadata-src-7.md} (96%) rename docs/src/{src-8-bridged-asset.md => bridged-asset-src-8.md} (93%) rename docs/src/{src-12-contract-factory.md => contract-factory-src-12.md} (100%) rename docs/src/{src-2-inline-documentation.md => inline-documentation-src-2.md} (100%) rename docs/src/{src-9-metadata-keys.md => metadata-keys-src-9.md} (97%) rename docs/src/{src-3-minting-and-burning.md => minting-and-burning-src-3.md} (85%) rename docs/src/{src-20-native-asset.md => native-asset-src-20.md} (100%) rename docs/src/{src-10-native-bridge.md => native-bridge-src-10.md} (97%) rename docs/src/{src-5-ownership.md => ownership-src-5.md} (100%) rename docs/src/{src-11-security-information.md => security-information-src-11.md} (100%) rename docs/src/{src-14-simple-upgradeable-proxies.md => simple-upgradeable-proxies-src-14.md} (97%) rename docs/src/{src-13-soulbound-address.md => soulbound-address-src-13.md} (98%) rename docs/src/{src-6-vault.md => vault-src-6.md} (98%) diff --git a/README.md b/README.md index 1da1fa3..b844d7e 100644 --- a/README.md +++ b/README.md @@ -35,28 +35,28 @@ If you don't find what you're looking for, feel free to create an issue and prop ### Native Assets -- [SRC-20; Native Asset Standard](./docs/src/src-20-native-asset.md) defines the implementation of a standard API for [Native Assets](https://docs.fuel.network/docs/sway/blockchain-development/native_assets) using the Sway Language. -- [SRC-3; Mint and Burn](./docs/src/src-3-minting-and-burning.md) is used to enable mint and burn functionality for fungible assets. -- [SRC-7; Arbitrary Asset Metadata Standard](./docs/src/src-7-asset-metadata.md) is used to store metadata for [Native Assets](https://docs.fuel.network/docs/sway/blockchain-development/native_assets). -- [SRC-9; Metadata Keys Standard](./docs/src/src-9-metadata-keys.md) 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. -- [SRC-6; Vault Standard](./docs/src/src-6-vault.md) defines the implementation of a standard API for asset vaults developed in Sway. +- [SRC-20; Native Asset Standard](./docs/src/native-asset-src-20.md) defines the implementation of a standard API for [Native Assets](https://docs.fuel.network/docs/sway/blockchain-development/native_assets) using the Sway Language. +- [SRC-3; Mint and Burn](./docs/src/minting-and-burning-src-3.md) is used to enable mint and burn functionality for fungible assets. +- [SRC-7; Arbitrary Asset Metadata Standard](./docs/src/asset-metadata-src-7.md) is used to store metadata for [Native Assets](https://docs.fuel.network/docs/sway/blockchain-development/native_assets). +- [SRC-9; Metadata Keys Standard](./docs/src/metadata-keys-src-9.md) 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. +- [SRC-6; Vault Standard](./docs/src/vault-src-6.md) defines the implementation of a standard API for asset vaults developed in Sway. ### Access Control -- [SRC-5; Ownership Standard](./docs/src/src-5-ownership.md) is used to restrict function calls to admin users in contracts. +- [SRC-5; Ownership Standard](./docs/src/ownership-src-5.md) is used to restrict function calls to admin users in contracts. ### Contracts -- [SRC-12; Contract Factory](./docs/src/src-12-contract-factory.md) defines the implementation of a standard API for contract factories. +- [SRC-12; Contract Factory](./docs/src/contract-factory-src-12.md) defines the implementation of a standard API for contract factories. ### Bridge -- [SRC-8; Bridged Asset](./docs/src/src-8-bridged-asset.md) defines the metadata required for an asset bridged to the Fuel Network. -- [SRC-10; Native Bridge Standard](./docs/src/src-10-native-bridge.md) defines the standard API for the Native Bridge between the Fuel Chain and the canonical base chain. +- [SRC-8; Bridged Asset](./docs/src/bridged-asset-src-8.md) defines the metadata required for an asset bridged to the Fuel Network. +- [SRC-10; Native Bridge Standard](./docs/src/native-bridge-src-10.md) defines the standard API for the Native Bridge between the Fuel Chain and the canonical base chain. ### Documentation -- [SRC-2; Inline Documentation](./docs/src/src-2-inline-documentation.md) defines how to document your Sway files. +- [SRC-2; Inline Documentation](./docs/src/inline-documentation-src-2.md) defines how to document your Sway files. ## Using a standard diff --git a/docs/src/SUMMARY.md b/docs/src/SUMMARY.md index da0c2b7..38b195e 100644 --- a/docs/src/SUMMARY.md +++ b/docs/src/SUMMARY.md @@ -2,16 +2,16 @@ [Sway Standards](./index.md) -- [SRC-2: Inline Documentation](./src-2-inline-documentation.md) -- [SRC-3: Minting and Burning](./src-3-minting-and-burning.md) -- [SRC-5: Ownership](./src-5-ownership.md) -- [SRC-6: Vault](./src-6-vault.md) -- [SRC-7: Asset Metadata](./src-7-asset-metadata.md) -- [SRC-8: Bridged Asset](./src-8-bridged-asset.md) -- [SRC-9: Metadata Keys](./src-9-metadata-keys.md) -- [SRC-10: Native Bridge](./src-10-native-bridge.md) -- [SRC-11: Security Information](./src-11-security-information.md) -- [SRC-12: Contract Factory](./src-12-contract-factory.md) -- [SRC-13: Soulbound Address](./src-13-soulbound-address.md) -- [SRC-14: Simple Upgradeable Contract](./src-14-simple-upgradeable-proxies.md) -- [SRC-20: Native Asset](./src-20-native-asset.md) +- [SRC-2: Inline Documentation](./inline-documentation-src-2.md) +- [SRC-3: Minting and Burning](./minting-and-burning-src-3.md) +- [SRC-5: Ownership](./ownership-src-5.md) +- [SRC-6: Vault](./vault-src-6.md) +- [SRC-7: Asset Metadata](./asset-metadata-src-7.md) +- [SRC-8: Bridged Asset](./bridged-asset-src-8.md) +- [SRC-9: Metadata Keys](./metadata-keys-src-9.md) +- [SRC-10: Native Bridge](./native-bridge-src-10.md) +- [SRC-11: Security Information](./security-information-src-11.md) +- [SRC-12: Contract Factory](./contract-factory-src-12.md) +- [SRC-13: Soulbound Address](./soulbound-address-src-13.md) +- [SRC-14: Simple Upgradeable Contract](./simple-upgradeable-proxies-src-14.md) +- [SRC-20: Native Asset](./native-asset-src-20.md) diff --git a/docs/src/src-7-asset-metadata.md b/docs/src/asset-metadata-src-7.md similarity index 96% rename from docs/src/src-7-asset-metadata.md rename to docs/src/asset-metadata-src-7.md index 4e6654a..2987d07 100644 --- a/docs/src/src-7-asset-metadata.md +++ b/docs/src/asset-metadata-src-7.md @@ -1,6 +1,6 @@ # SRC-7: Arbitrary Native Asset Metadata -The following standard attempts to define the retrieval of on-chain arbitrary metadata for any [Native Asset](https://docs.fuel.network/docs/sway/blockchain-development/native_assets). Any contract that implements the SRC-7 standard MUST implement the [SRC-20](./src-20-native-asset.md) standard. +The following standard attempts to define the retrieval of on-chain arbitrary metadata for any [Native Asset](https://docs.fuel.network/docs/sway/blockchain-development/native_assets). Any contract that implements the SRC-7 standard MUST implement the [SRC-20](./native-asset-src-20.md) standard. ## Motivation @@ -10,7 +10,7 @@ The SRC-7 standard seeks to enable data-rich assets on the Fuel Network while ma The use of generic metadata was originally found in the Sway-Lib's [NFT Library](https://github.com/FuelLabs/sway-libs/tree/v0.12.0/libs/nft) which did not use Fuel's [Native Assets](https://docs.fuel.network/docs/sway/blockchain-development/native_assets). This library has since been deprecated. -A previous definition for a metadata standard was written in the original edit of the now defunct [SRC-721](https://github.com/FuelLabs/sway-standards/issues/2). This has since been replaced with the [SRC-20](./src-20-native-asset.md) standard as `SubId` was introduced to enable multiple assets to be minted from a single contract. +A previous definition for a metadata standard was written in the original edit of the now defunct [SRC-721](https://github.com/FuelLabs/sway-standards/issues/2). This has since been replaced with the [SRC-20](./native-asset-src-20.md) standard as `SubId` was introduced to enable multiple assets to be minted from a single contract. The standard takes inspiration from [ENS's public resolver](https://docs.ens.domains/contract-api-reference/publicresolver) with the use of a `String` as the key. This should enable human-readable keys to help minimize errors and enable the standardization of certain keys, such as "image" as opposed to an `enum` or `u64` representation of keys. @@ -50,7 +50,7 @@ The SRC-7 standard should allow for data-rich assets to interact with one anothe ## Backwards Compatibility -This standard is compatible with Fuel's [Native Assets](https://docs.fuel.network/docs/sway/blockchain-development/native_assets) and the [SRC-20](./src-20-native-asset.md) standard. It also maintains compatibility with existing standards in other ecosystems. +This standard is compatible with Fuel's [Native Assets](https://docs.fuel.network/docs/sway/blockchain-development/native_assets) and the [SRC-20](./native-asset-src-20.md) standard. It also maintains compatibility with existing standards in other ecosystems. ## Security Considerations diff --git a/docs/src/src-8-bridged-asset.md b/docs/src/bridged-asset-src-8.md similarity index 93% rename from docs/src/src-8-bridged-asset.md rename to docs/src/bridged-asset-src-8.md index d703626..0cd5b57 100644 --- a/docs/src/src-8-bridged-asset.md +++ b/docs/src/bridged-asset-src-8.md @@ -1,6 +1,6 @@ # SRC-8: Bridged Asset -The following standard attempts to define the retrieval of relevant on-chain metadata for any bridged [Native Assets](https://docs.fuel.network/docs/sway/blockchain-development/native_assets). Any contract that implements the SRC-8 standard MUST implement the [SRC-7](./src-7-asset-metadata.md) and [SRC-20](./src-20-native-asset.md) standards. +The following standard attempts to define the retrieval of relevant on-chain metadata for any bridged [Native Assets](https://docs.fuel.network/docs/sway/blockchain-development/native_assets). Any contract that implements the SRC-8 standard MUST implement the [SRC-7](./asset-metadata-src-7.md) and [SRC-20](./native-asset-src-20.md) standards. ## Motivation @@ -8,7 +8,7 @@ The SRC-8 standard seeks to enable relevant data for bridged assets on the Fuel ## Prior Art -The use of generic metadata for [Native Assets](https://docs.fuel.network/docs/sway/blockchain-development/native_assets) is defined in the [SRC-7](./src-7-asset-metadata.md) standard. This standard integrates into the existing [SRC-7](./src-7-asset-metadata.md) standard. +The use of generic metadata for [Native Assets](https://docs.fuel.network/docs/sway/blockchain-development/native_assets) is defined in the [SRC-7](./asset-metadata-src-7.md) standard. This standard integrates into the existing [SRC-7](./asset-metadata-src-7.md) standard. ## Specification @@ -48,7 +48,7 @@ The SRC-8 standard should allow for data on any bridged assets on the Fuel Netwo ## Backwards Compatibility -This standard is compatible with Fuel's [Native Assets](https://docs.fuel.network/docs/sway/blockchain-development/native_assets), the [SRC-20](./src-20-native-asset.md) standard, and the [SRC-7](./src-7-asset-metadata.md) standard. +This standard is compatible with Fuel's [Native Assets](https://docs.fuel.network/docs/sway/blockchain-development/native_assets), the [SRC-20](./native-asset-src-20.md) standard, and the [SRC-7](./asset-metadata-src-7.md) standard. The standard is also compatible with both tokens and NFTs native to other ecosystems by introducing a token ID element of the original chain. diff --git a/docs/src/src-12-contract-factory.md b/docs/src/contract-factory-src-12.md similarity index 100% rename from docs/src/src-12-contract-factory.md rename to docs/src/contract-factory-src-12.md diff --git a/docs/src/index.md b/docs/src/index.md index 32c2f24..ff3276f 100644 --- a/docs/src/index.md +++ b/docs/src/index.md @@ -14,7 +14,7 @@ If you don't find what you're looking for, feel free to create an issue and prop To import a standard the following should be added to the project's `Forc.toml` file under `[dependencies]` with the most recent release: ```toml -standards = { git = "https://github.com/FuelLabs/sway-standards", tag = "v0.4.4" } +standards = { git = "https://github.com/FuelLabs/sway-standards", tag = "v0.5.0" } ``` > **NOTE:** @@ -36,28 +36,28 @@ use standards::src20::SRC20; ### Native Assets -- [SRC-20; Native Asset Standard](./src-20-native-asset.md) defines the implementation of a standard API for [Native Assets](https://docs.fuel.network/docs/sway/blockchain-development/native_assets) using the Sway Language. -- [SRC-3; Mint and Burn](./src-3-minting-and-burning.md) is used to enable mint and burn functionality for fungible assets. -- [SRC-7; Arbitrary Asset Metadata Standard](./src-7-asset-metadata.md) is used to store metadata for [Native Assets](https://docs.fuel.network/docs/sway/blockchain-development/native_assets). -- [SRC-9; Metadata Keys Standard](./src-9-metadata-keys.md) 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. -- [SRC-6; Vault Standard](./src-6-vault.md) defines the implementation of a standard API for asset vaults developed in Sway. -- [SRC-13; Soulbound Address](./src-13-soulbound-address.md) defines the implementation of a soulbound address. +- [SRC-20; Native Asset Standard](./native-asset-src-20.md) defines the implementation of a standard API for [Native Assets](https://docs.fuel.network/docs/sway/blockchain-development/native_assets) using the Sway Language. +- [SRC-3; Mint and Burn](./minting-and-burning-src-3.md) is used to enable mint and burn functionality for fungible assets. +- [SRC-7; Arbitrary Asset Metadata Standard](./asset-metadata-src-7.md) is used to store metadata for [Native Assets](https://docs.fuel.network/docs/sway/blockchain-development/native_assets). +- [SRC-9; Metadata Keys Standard](./metadata-keys-src-9.md) 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. +- [SRC-6; Vault Standard](./vault-src-6.md) defines the implementation of a standard API for asset vaults developed in Sway. +- [SRC-13; Soulbound Address](./soulbound-address-src-13.md) defines the implementation of a soulbound address. ### Security and Access Control -- [SRC-5; Ownership Standard](./src-5-ownership.md) is used to restrict function calls to admin users in contracts. -- [SRC-11; Security Information Standard](./src-11-security-information.md) is used to make communication information readily available in the case white hat hackers find a vulnerability in a contract. +- [SRC-5; Ownership Standard](./ownership-src-5.md) is used to restrict function calls to admin users in contracts. +- [SRC-11; Security Information Standard](./security-information-src-11.md) is used to make communication information readily available in the case white hat hackers find a vulnerability in a contract. ### Contracts -- [SRC-12; Contract Factory](./src-12-contract-factory.md) defines the implementation of a standard API for contract factories. -- [SRC-14; Simple Upgradeable Proxies](./src-14-simple-upgradeable-proxies.md) defines the implementation of an upgradeable proxy contract. +- [SRC-12; Contract Factory](./contract-factory-src-12.md) defines the implementation of a standard API for contract factories. +- [SRC-14; Simple Upgradeable Proxies](./simple-upgradeable-proxies-src-14.md) defines the implementation of an upgradeable proxy contract. ### Bridge -- [SRC-8; Bridged Asset](./src-8-bridged-asset.md) defines the metadata required for an asset bridged to the Fuel Network. -- [SRC-10; Native Bridge Standard](./src-10-native-bridge.md) defines the standard API for the Native Bridge between the Fuel Chain and the canonical base chain. +- [SRC-8; Bridged Asset](./bridged-asset-src-8.md) defines the metadata required for an asset bridged to the Fuel Network. +- [SRC-10; Native Bridge Standard](./native-bridge-src-10.md) defines the standard API for the Native Bridge between the Fuel Chain and the canonical base chain. ### Documentation -- [SRC-2; Inline Documentation](./src-2-inline-documentation.md) defines how to document your Sway files. +- [SRC-2; Inline Documentation](./inline-documentation-src-2.md) defines how to document your Sway files. diff --git a/docs/src/src-2-inline-documentation.md b/docs/src/inline-documentation-src-2.md similarity index 100% rename from docs/src/src-2-inline-documentation.md rename to docs/src/inline-documentation-src-2.md diff --git a/docs/src/src-9-metadata-keys.md b/docs/src/metadata-keys-src-9.md similarity index 97% rename from docs/src/src-9-metadata-keys.md rename to docs/src/metadata-keys-src-9.md index 9558b3c..92827d7 100644 --- a/docs/src/src-9-metadata-keys.md +++ b/docs/src/metadata-keys-src-9.md @@ -1,6 +1,6 @@ # SRC-9: Native Asset -The following standard attempts to define the keys of relevant on-chain metadata for any [Native Assets](https://docs.fuel.network/docs/sway/blockchain-development/native_assets). Any contract that implements the SRC-9 standard MUST implement the [SRC-7](./src-7-asset-metadata.md) and [SRC-20](./src-20-native-asset.md) standards. This is a living standard where revisions may be made as the ecosystem evolves. +The following standard attempts to define the keys of relevant on-chain metadata for any [Native Assets](https://docs.fuel.network/docs/sway/blockchain-development/native_assets). Any contract that implements the SRC-9 standard MUST implement the [SRC-7](./asset-metadata-src-7.md) and [SRC-20](./native-asset-src-20.md) standards. This is a living standard where revisions may be made as the ecosystem evolves. ## Motivation @@ -8,7 +8,7 @@ The SRC-9 standard seeks to enable relevant data for assets on the Fuel Network. ## Prior Art -The use of generic metadata for [Native Assets](https://docs.fuel.network/docs/sway/blockchain-development/native_assets) is defined in the [SRC-7](./src-7-asset-metadata.md) standard. This standard integrates into the existing [SRC-7](./src-7-asset-metadata.md) standard. +The use of generic metadata for [Native Assets](https://docs.fuel.network/docs/sway/blockchain-development/native_assets) is defined in the [SRC-7](./asset-metadata-src-7.md) standard. This standard integrates into the existing [SRC-7](./asset-metadata-src-7.md) standard. ## Specification @@ -349,7 +349,7 @@ The SRC-9 standard should allow for standardized keys for metadata on the Fuel N ## Backwards Compatibility -This standard is compatible with Fuel's [Native Assets](https://docs.fuel.network/docs/sway/blockchain-development/native_assets), the [SRC-20](./src-20-native-asset.md) standard, and the [SRC-7](./src-7-asset-metadata.md) standard. +This standard is compatible with Fuel's [Native Assets](https://docs.fuel.network/docs/sway/blockchain-development/native_assets), the [SRC-20](./native-asset-src-20.md) standard, and the [SRC-7](./asset-metadata-src-7.md) standard. ## Security Considerations diff --git a/docs/src/src-3-minting-and-burning.md b/docs/src/minting-and-burning-src-3.md similarity index 85% rename from docs/src/src-3-minting-and-burning.md rename to docs/src/minting-and-burning-src-3.md index 53fd352..2e075f6 100644 --- a/docs/src/src-3-minting-and-burning.md +++ b/docs/src/minting-and-burning-src-3.md @@ -1,14 +1,14 @@ # SRC-3: Minting and Burning Native Assets -The following standard enables the minting and burning of native assets for any fungible assets within the Sway Language. It seeks to define mint and burn functions defined separately from the [SRC-20](./src-20-native-asset.md) standard. +The following standard enables the minting and burning of native assets for any fungible assets within the Sway Language. It seeks to define mint and burn functions defined separately from the [SRC-20](./native-asset-src-20.md) standard. ## Motivation -The intent of this standard is to separate the extensions of minting and burning from the [SRC-20](./src-20-native-asset.md) standard. +The intent of this standard is to separate the extensions of minting and burning from the [SRC-20](./native-asset-src-20.md) standard. ## Prior Art -Minting and burning were initially added to the [SRC-20](./src-20-native-asset.md) standard. +Minting and burning were initially added to the [SRC-20](./native-asset-src-20.md) standard. ## Specification @@ -31,7 +31,7 @@ This function MAY contain arbitrary conditions for minting, and revert if those This function MUST burn `amount` coins with the sub-identifier `sub_id` and MUST ensure the `AssetId` of the asset is the sha-256 hash of `(ContractId, SubId)` for the implementing contract. This function MUST ensure at least `amount` coins have been transferred to the implementing contract. -This function MUST update the total supply defined in the [SRC-20](./src-20-native-asset.md) standard. +This function MUST update the total supply defined in the [SRC-20](./native-asset-src-20.md) standard. This function MAY contain arbitrary conditions for burning, and revert if those conditions are not met. ##### Burn Arguments @@ -41,16 +41,16 @@ This function MAY contain arbitrary conditions for burning, and revert if those ## Rationale -This standard has been added to enable compatibility between applications and allow minting and burning native assets per use case. This standard has been separated from the [SRC-20](./src-20-native-asset.md) standard to allow for the minting and burning for all fungible assets, irrelevant of whether they are [Native Assets](https://docs.fuel.network/docs/sway/blockchain-development/native_assets) or not. +This standard has been added to enable compatibility between applications and allow minting and burning native assets per use case. This standard has been separated from the [SRC-20](./native-asset-src-20.md) standard to allow for the minting and burning for all fungible assets, irrelevant of whether they are [Native Assets](https://docs.fuel.network/docs/sway/blockchain-development/native_assets) or not. ## Backwards Compatibility -This standard is compatible with Fuel's [Native Assets](https://docs.fuel.network/docs/sway/blockchain-development/native_assets) ensuring its compatibility with the [SRC-20](./src-20-native-asset.md) standard. +This standard is compatible with Fuel's [Native Assets](https://docs.fuel.network/docs/sway/blockchain-development/native_assets) ensuring its compatibility with the [SRC-20](./native-asset-src-20.md) standard. ## Security Considerations This standard may introduce security considerations if no checks are implemented to ensure the calling of the `mint()` function is deemed valid or permitted. Checks are highly encouraged. -The burn function may also introduce a security consideration if the total supply within the [SRC-20](./src-20-native-asset.md) standard is not modified. +The burn function may also introduce a security consideration if the total supply within the [SRC-20](./native-asset-src-20.md) standard is not modified. ## Example ABI diff --git a/docs/src/src-20-native-asset.md b/docs/src/native-asset-src-20.md similarity index 100% rename from docs/src/src-20-native-asset.md rename to docs/src/native-asset-src-20.md diff --git a/docs/src/src-10-native-bridge.md b/docs/src/native-bridge-src-10.md similarity index 97% rename from docs/src/src-10-native-bridge.md rename to docs/src/native-bridge-src-10.md index 421ee99..2f2bef1 100644 --- a/docs/src/src-10-native-bridge.md +++ b/docs/src/native-bridge-src-10.md @@ -23,7 +23,7 @@ The following functions MUST be implemented to follow the SRC-10; Native Bridge The `process_message()` function accepts incoming deposit messages from the canonical chain and issues the corresponding bridged asset. - This function MUST parse a message at the given `message_index` index. -- This function SHALL mint an asset that follows the [SRC-8; Bridged Asset Standard](./src-8-bridged-asset.md). +- This function SHALL mint an asset that follows the [SRC-8; Bridged Asset Standard](./bridged-asset-src-8.md). - This function SHALL issue a refund if there is an error in the bridging process. ### - `fn withdraw(to_address: b256)` @@ -148,7 +148,7 @@ pub struct MetadataMessage { ## Required Standards -Any contract that implements the SRC-10; Native Bridge Standard MUST implement the [SRC-8; Bridged Asset Standard](./src-8-bridged-asset.md) for all bridged assets. +Any contract that implements the SRC-10; Native Bridge Standard MUST implement the [SRC-8; Bridged Asset Standard](./bridged-asset-src-8.md) for all bridged assets. ## Rationale diff --git a/docs/src/src-5-ownership.md b/docs/src/ownership-src-5.md similarity index 100% rename from docs/src/src-5-ownership.md rename to docs/src/ownership-src-5.md diff --git a/docs/src/src-11-security-information.md b/docs/src/security-information-src-11.md similarity index 100% rename from docs/src/src-11-security-information.md rename to docs/src/security-information-src-11.md diff --git a/docs/src/src-14-simple-upgradeable-proxies.md b/docs/src/simple-upgradeable-proxies-src-14.md similarity index 97% rename from docs/src/src-14-simple-upgradeable-proxies.md rename to docs/src/simple-upgradeable-proxies-src-14.md index da23549..7333980 100644 --- a/docs/src/src-14-simple-upgradeable-proxies.md +++ b/docs/src/simple-upgradeable-proxies-src-14.md @@ -57,7 +57,7 @@ As it is the first attempt to standardize proxy implementation, we do not consid ## Security Considerations Permissioning proxy target changes is the primary consideration here. -This standard is not opinionated about means of achieving this, use of [SRC-5](./src-5-ownership.md) is recommended. +This standard is not opinionated about means of achieving this, use of [SRC-5](./ownership-src-5.md) is recommended. ## Example ABI @@ -80,7 +80,7 @@ Example of a minimal SRC-14 implementation with no access control. ### Owned Proxy -Example of a SRC-14 implementation that also implements [SRC-5](./src-5-ownership.md). +Example of a SRC-14 implementation that also implements [SRC-5](./ownership-src-5.md). ```sway {{#include ../examples/examples/src14-simple-proxy/owned/src/owned.sw}} diff --git a/docs/src/src-13-soulbound-address.md b/docs/src/soulbound-address-src-13.md similarity index 98% rename from docs/src/src-13-soulbound-address.md rename to docs/src/soulbound-address-src-13.md index 5a7b89c..a006817 100644 --- a/docs/src/src-13-soulbound-address.md +++ b/docs/src/soulbound-address-src-13.md @@ -60,7 +60,7 @@ On the Fuel Network, the process for sending any [Native Assets](https://docs.fu ## Backwards Compatibility -This standard is compatible with Fuel's [Native Assets](https://docs.fuel.network/docs/sway/blockchain-development/native_assets) and the [SRC-20](./src-20-native-asset.md) standard. +This standard is compatible with Fuel's [Native Assets](https://docs.fuel.network/docs/sway/blockchain-development/native_assets) and the [SRC-20](./native-asset-src-20.md) standard. ## Security Considerations diff --git a/docs/src/src-6-vault.md b/docs/src/vault-src-6.md similarity index 98% rename from docs/src/src-6-vault.md rename to docs/src/vault-src-6.md index f2ad23f..fc0b9db 100644 --- a/docs/src/src-6-vault.md +++ b/docs/src/vault-src-6.md @@ -1,6 +1,6 @@ # SRC-6: Vault -The following standard allows for the implementation of a standard API for asset vaults such as yield-bearing asset vaults or asset wrappers. This standard is an optional add-on to the [SRC-20](./src-20-native-asset.md) standard. +The following standard allows for the implementation of a standard API for asset vaults such as yield-bearing asset vaults or asset wrappers. This standard is an optional add-on to the [SRC-20](./native-asset-src-20.md) standard. ## Motivation @@ -137,7 +137,7 @@ The ABI discussed covers the known use cases of asset vaults while allowing safe ## Backwards Compatibility -This standard is fully compatible with the [SRC-20 standard](./src-20-native-asset.md). +This standard is fully compatible with the [SRC-20 standard](./native-asset-src-20.md). ## Security Considerations From 84e77763d2c3ff0896ffec2623aea812feae00be Mon Sep 17 00:00:00 2001 From: sarahschwartz <58856580+sarahschwartz@users.noreply.github.com> Date: Fri, 31 May 2024 11:42:24 -0600 Subject: [PATCH 25/44] undo last commit --- README.md | 20 ++++++------- docs/src/SUMMARY.md | 26 ++++++++--------- docs/src/index.md | 28 +++++++++---------- ...idge-src-10.md => src-10-native-bridge.md} | 4 +-- ...c-11.md => src-11-security-information.md} | 0 ...y-src-12.md => src-12-contract-factory.md} | 0 ...-src-13.md => src-13-soulbound-address.md} | 2 +- ...d => src-14-simple-upgradeable-proxies.md} | 4 +-- ...src-2.md => src-2-inline-documentation.md} | 0 ...asset-src-20.md => src-20-native-asset.md} | 0 ...-src-3.md => src-3-minting-and-burning.md} | 14 +++++----- ...{ownership-src-5.md => src-5-ownership.md} | 0 docs/src/{vault-src-6.md => src-6-vault.md} | 4 +-- ...adata-src-7.md => src-7-asset-metadata.md} | 6 ++-- ...-asset-src-8.md => src-8-bridged-asset.md} | 6 ++-- ...a-keys-src-9.md => src-9-metadata-keys.md} | 6 ++-- 16 files changed, 60 insertions(+), 60 deletions(-) rename docs/src/{native-bridge-src-10.md => src-10-native-bridge.md} (97%) rename docs/src/{security-information-src-11.md => src-11-security-information.md} (100%) rename docs/src/{contract-factory-src-12.md => src-12-contract-factory.md} (100%) rename docs/src/{soulbound-address-src-13.md => src-13-soulbound-address.md} (98%) rename docs/src/{simple-upgradeable-proxies-src-14.md => src-14-simple-upgradeable-proxies.md} (97%) rename docs/src/{inline-documentation-src-2.md => src-2-inline-documentation.md} (100%) rename docs/src/{native-asset-src-20.md => src-20-native-asset.md} (100%) rename docs/src/{minting-and-burning-src-3.md => src-3-minting-and-burning.md} (85%) rename docs/src/{ownership-src-5.md => src-5-ownership.md} (100%) rename docs/src/{vault-src-6.md => src-6-vault.md} (98%) rename docs/src/{asset-metadata-src-7.md => src-7-asset-metadata.md} (96%) rename docs/src/{bridged-asset-src-8.md => src-8-bridged-asset.md} (93%) rename docs/src/{metadata-keys-src-9.md => src-9-metadata-keys.md} (97%) diff --git a/README.md b/README.md index b844d7e..1da1fa3 100644 --- a/README.md +++ b/README.md @@ -35,28 +35,28 @@ If you don't find what you're looking for, feel free to create an issue and prop ### Native Assets -- [SRC-20; Native Asset Standard](./docs/src/native-asset-src-20.md) defines the implementation of a standard API for [Native Assets](https://docs.fuel.network/docs/sway/blockchain-development/native_assets) using the Sway Language. -- [SRC-3; Mint and Burn](./docs/src/minting-and-burning-src-3.md) is used to enable mint and burn functionality for fungible assets. -- [SRC-7; Arbitrary Asset Metadata Standard](./docs/src/asset-metadata-src-7.md) is used to store metadata for [Native Assets](https://docs.fuel.network/docs/sway/blockchain-development/native_assets). -- [SRC-9; Metadata Keys Standard](./docs/src/metadata-keys-src-9.md) 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. -- [SRC-6; Vault Standard](./docs/src/vault-src-6.md) defines the implementation of a standard API for asset vaults developed in Sway. +- [SRC-20; Native Asset Standard](./docs/src/src-20-native-asset.md) defines the implementation of a standard API for [Native Assets](https://docs.fuel.network/docs/sway/blockchain-development/native_assets) using the Sway Language. +- [SRC-3; Mint and Burn](./docs/src/src-3-minting-and-burning.md) is used to enable mint and burn functionality for fungible assets. +- [SRC-7; Arbitrary Asset Metadata Standard](./docs/src/src-7-asset-metadata.md) is used to store metadata for [Native Assets](https://docs.fuel.network/docs/sway/blockchain-development/native_assets). +- [SRC-9; Metadata Keys Standard](./docs/src/src-9-metadata-keys.md) 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. +- [SRC-6; Vault Standard](./docs/src/src-6-vault.md) defines the implementation of a standard API for asset vaults developed in Sway. ### Access Control -- [SRC-5; Ownership Standard](./docs/src/ownership-src-5.md) is used to restrict function calls to admin users in contracts. +- [SRC-5; Ownership Standard](./docs/src/src-5-ownership.md) is used to restrict function calls to admin users in contracts. ### Contracts -- [SRC-12; Contract Factory](./docs/src/contract-factory-src-12.md) defines the implementation of a standard API for contract factories. +- [SRC-12; Contract Factory](./docs/src/src-12-contract-factory.md) defines the implementation of a standard API for contract factories. ### Bridge -- [SRC-8; Bridged Asset](./docs/src/bridged-asset-src-8.md) defines the metadata required for an asset bridged to the Fuel Network. -- [SRC-10; Native Bridge Standard](./docs/src/native-bridge-src-10.md) defines the standard API for the Native Bridge between the Fuel Chain and the canonical base chain. +- [SRC-8; Bridged Asset](./docs/src/src-8-bridged-asset.md) defines the metadata required for an asset bridged to the Fuel Network. +- [SRC-10; Native Bridge Standard](./docs/src/src-10-native-bridge.md) defines the standard API for the Native Bridge between the Fuel Chain and the canonical base chain. ### Documentation -- [SRC-2; Inline Documentation](./docs/src/inline-documentation-src-2.md) defines how to document your Sway files. +- [SRC-2; Inline Documentation](./docs/src/src-2-inline-documentation.md) defines how to document your Sway files. ## Using a standard diff --git a/docs/src/SUMMARY.md b/docs/src/SUMMARY.md index 38b195e..da0c2b7 100644 --- a/docs/src/SUMMARY.md +++ b/docs/src/SUMMARY.md @@ -2,16 +2,16 @@ [Sway Standards](./index.md) -- [SRC-2: Inline Documentation](./inline-documentation-src-2.md) -- [SRC-3: Minting and Burning](./minting-and-burning-src-3.md) -- [SRC-5: Ownership](./ownership-src-5.md) -- [SRC-6: Vault](./vault-src-6.md) -- [SRC-7: Asset Metadata](./asset-metadata-src-7.md) -- [SRC-8: Bridged Asset](./bridged-asset-src-8.md) -- [SRC-9: Metadata Keys](./metadata-keys-src-9.md) -- [SRC-10: Native Bridge](./native-bridge-src-10.md) -- [SRC-11: Security Information](./security-information-src-11.md) -- [SRC-12: Contract Factory](./contract-factory-src-12.md) -- [SRC-13: Soulbound Address](./soulbound-address-src-13.md) -- [SRC-14: Simple Upgradeable Contract](./simple-upgradeable-proxies-src-14.md) -- [SRC-20: Native Asset](./native-asset-src-20.md) +- [SRC-2: Inline Documentation](./src-2-inline-documentation.md) +- [SRC-3: Minting and Burning](./src-3-minting-and-burning.md) +- [SRC-5: Ownership](./src-5-ownership.md) +- [SRC-6: Vault](./src-6-vault.md) +- [SRC-7: Asset Metadata](./src-7-asset-metadata.md) +- [SRC-8: Bridged Asset](./src-8-bridged-asset.md) +- [SRC-9: Metadata Keys](./src-9-metadata-keys.md) +- [SRC-10: Native Bridge](./src-10-native-bridge.md) +- [SRC-11: Security Information](./src-11-security-information.md) +- [SRC-12: Contract Factory](./src-12-contract-factory.md) +- [SRC-13: Soulbound Address](./src-13-soulbound-address.md) +- [SRC-14: Simple Upgradeable Contract](./src-14-simple-upgradeable-proxies.md) +- [SRC-20: Native Asset](./src-20-native-asset.md) diff --git a/docs/src/index.md b/docs/src/index.md index ff3276f..32c2f24 100644 --- a/docs/src/index.md +++ b/docs/src/index.md @@ -14,7 +14,7 @@ If you don't find what you're looking for, feel free to create an issue and prop To import a standard the following should be added to the project's `Forc.toml` file under `[dependencies]` with the most recent release: ```toml -standards = { git = "https://github.com/FuelLabs/sway-standards", tag = "v0.5.0" } +standards = { git = "https://github.com/FuelLabs/sway-standards", tag = "v0.4.4" } ``` > **NOTE:** @@ -36,28 +36,28 @@ use standards::src20::SRC20; ### Native Assets -- [SRC-20; Native Asset Standard](./native-asset-src-20.md) defines the implementation of a standard API for [Native Assets](https://docs.fuel.network/docs/sway/blockchain-development/native_assets) using the Sway Language. -- [SRC-3; Mint and Burn](./minting-and-burning-src-3.md) is used to enable mint and burn functionality for fungible assets. -- [SRC-7; Arbitrary Asset Metadata Standard](./asset-metadata-src-7.md) is used to store metadata for [Native Assets](https://docs.fuel.network/docs/sway/blockchain-development/native_assets). -- [SRC-9; Metadata Keys Standard](./metadata-keys-src-9.md) 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. -- [SRC-6; Vault Standard](./vault-src-6.md) defines the implementation of a standard API for asset vaults developed in Sway. -- [SRC-13; Soulbound Address](./soulbound-address-src-13.md) defines the implementation of a soulbound address. +- [SRC-20; Native Asset Standard](./src-20-native-asset.md) defines the implementation of a standard API for [Native Assets](https://docs.fuel.network/docs/sway/blockchain-development/native_assets) using the Sway Language. +- [SRC-3; Mint and Burn](./src-3-minting-and-burning.md) is used to enable mint and burn functionality for fungible assets. +- [SRC-7; Arbitrary Asset Metadata Standard](./src-7-asset-metadata.md) is used to store metadata for [Native Assets](https://docs.fuel.network/docs/sway/blockchain-development/native_assets). +- [SRC-9; Metadata Keys Standard](./src-9-metadata-keys.md) 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. +- [SRC-6; Vault Standard](./src-6-vault.md) defines the implementation of a standard API for asset vaults developed in Sway. +- [SRC-13; Soulbound Address](./src-13-soulbound-address.md) defines the implementation of a soulbound address. ### Security and Access Control -- [SRC-5; Ownership Standard](./ownership-src-5.md) is used to restrict function calls to admin users in contracts. -- [SRC-11; Security Information Standard](./security-information-src-11.md) is used to make communication information readily available in the case white hat hackers find a vulnerability in a contract. +- [SRC-5; Ownership Standard](./src-5-ownership.md) is used to restrict function calls to admin users in contracts. +- [SRC-11; Security Information Standard](./src-11-security-information.md) is used to make communication information readily available in the case white hat hackers find a vulnerability in a contract. ### Contracts -- [SRC-12; Contract Factory](./contract-factory-src-12.md) defines the implementation of a standard API for contract factories. -- [SRC-14; Simple Upgradeable Proxies](./simple-upgradeable-proxies-src-14.md) defines the implementation of an upgradeable proxy contract. +- [SRC-12; Contract Factory](./src-12-contract-factory.md) defines the implementation of a standard API for contract factories. +- [SRC-14; Simple Upgradeable Proxies](./src-14-simple-upgradeable-proxies.md) defines the implementation of an upgradeable proxy contract. ### Bridge -- [SRC-8; Bridged Asset](./bridged-asset-src-8.md) defines the metadata required for an asset bridged to the Fuel Network. -- [SRC-10; Native Bridge Standard](./native-bridge-src-10.md) defines the standard API for the Native Bridge between the Fuel Chain and the canonical base chain. +- [SRC-8; Bridged Asset](./src-8-bridged-asset.md) defines the metadata required for an asset bridged to the Fuel Network. +- [SRC-10; Native Bridge Standard](./src-10-native-bridge.md) defines the standard API for the Native Bridge between the Fuel Chain and the canonical base chain. ### Documentation -- [SRC-2; Inline Documentation](./inline-documentation-src-2.md) defines how to document your Sway files. +- [SRC-2; Inline Documentation](./src-2-inline-documentation.md) defines how to document your Sway files. diff --git a/docs/src/native-bridge-src-10.md b/docs/src/src-10-native-bridge.md similarity index 97% rename from docs/src/native-bridge-src-10.md rename to docs/src/src-10-native-bridge.md index 2f2bef1..421ee99 100644 --- a/docs/src/native-bridge-src-10.md +++ b/docs/src/src-10-native-bridge.md @@ -23,7 +23,7 @@ The following functions MUST be implemented to follow the SRC-10; Native Bridge The `process_message()` function accepts incoming deposit messages from the canonical chain and issues the corresponding bridged asset. - This function MUST parse a message at the given `message_index` index. -- This function SHALL mint an asset that follows the [SRC-8; Bridged Asset Standard](./bridged-asset-src-8.md). +- This function SHALL mint an asset that follows the [SRC-8; Bridged Asset Standard](./src-8-bridged-asset.md). - This function SHALL issue a refund if there is an error in the bridging process. ### - `fn withdraw(to_address: b256)` @@ -148,7 +148,7 @@ pub struct MetadataMessage { ## Required Standards -Any contract that implements the SRC-10; Native Bridge Standard MUST implement the [SRC-8; Bridged Asset Standard](./bridged-asset-src-8.md) for all bridged assets. +Any contract that implements the SRC-10; Native Bridge Standard MUST implement the [SRC-8; Bridged Asset Standard](./src-8-bridged-asset.md) for all bridged assets. ## Rationale diff --git a/docs/src/security-information-src-11.md b/docs/src/src-11-security-information.md similarity index 100% rename from docs/src/security-information-src-11.md rename to docs/src/src-11-security-information.md diff --git a/docs/src/contract-factory-src-12.md b/docs/src/src-12-contract-factory.md similarity index 100% rename from docs/src/contract-factory-src-12.md rename to docs/src/src-12-contract-factory.md diff --git a/docs/src/soulbound-address-src-13.md b/docs/src/src-13-soulbound-address.md similarity index 98% rename from docs/src/soulbound-address-src-13.md rename to docs/src/src-13-soulbound-address.md index a006817..5a7b89c 100644 --- a/docs/src/soulbound-address-src-13.md +++ b/docs/src/src-13-soulbound-address.md @@ -60,7 +60,7 @@ On the Fuel Network, the process for sending any [Native Assets](https://docs.fu ## Backwards Compatibility -This standard is compatible with Fuel's [Native Assets](https://docs.fuel.network/docs/sway/blockchain-development/native_assets) and the [SRC-20](./native-asset-src-20.md) standard. +This standard is compatible with Fuel's [Native Assets](https://docs.fuel.network/docs/sway/blockchain-development/native_assets) and the [SRC-20](./src-20-native-asset.md) standard. ## Security Considerations diff --git a/docs/src/simple-upgradeable-proxies-src-14.md b/docs/src/src-14-simple-upgradeable-proxies.md similarity index 97% rename from docs/src/simple-upgradeable-proxies-src-14.md rename to docs/src/src-14-simple-upgradeable-proxies.md index 7333980..da23549 100644 --- a/docs/src/simple-upgradeable-proxies-src-14.md +++ b/docs/src/src-14-simple-upgradeable-proxies.md @@ -57,7 +57,7 @@ As it is the first attempt to standardize proxy implementation, we do not consid ## Security Considerations Permissioning proxy target changes is the primary consideration here. -This standard is not opinionated about means of achieving this, use of [SRC-5](./ownership-src-5.md) is recommended. +This standard is not opinionated about means of achieving this, use of [SRC-5](./src-5-ownership.md) is recommended. ## Example ABI @@ -80,7 +80,7 @@ Example of a minimal SRC-14 implementation with no access control. ### Owned Proxy -Example of a SRC-14 implementation that also implements [SRC-5](./ownership-src-5.md). +Example of a SRC-14 implementation that also implements [SRC-5](./src-5-ownership.md). ```sway {{#include ../examples/examples/src14-simple-proxy/owned/src/owned.sw}} diff --git a/docs/src/inline-documentation-src-2.md b/docs/src/src-2-inline-documentation.md similarity index 100% rename from docs/src/inline-documentation-src-2.md rename to docs/src/src-2-inline-documentation.md diff --git a/docs/src/native-asset-src-20.md b/docs/src/src-20-native-asset.md similarity index 100% rename from docs/src/native-asset-src-20.md rename to docs/src/src-20-native-asset.md diff --git a/docs/src/minting-and-burning-src-3.md b/docs/src/src-3-minting-and-burning.md similarity index 85% rename from docs/src/minting-and-burning-src-3.md rename to docs/src/src-3-minting-and-burning.md index 2e075f6..53fd352 100644 --- a/docs/src/minting-and-burning-src-3.md +++ b/docs/src/src-3-minting-and-burning.md @@ -1,14 +1,14 @@ # SRC-3: Minting and Burning Native Assets -The following standard enables the minting and burning of native assets for any fungible assets within the Sway Language. It seeks to define mint and burn functions defined separately from the [SRC-20](./native-asset-src-20.md) standard. +The following standard enables the minting and burning of native assets for any fungible assets within the Sway Language. It seeks to define mint and burn functions defined separately from the [SRC-20](./src-20-native-asset.md) standard. ## Motivation -The intent of this standard is to separate the extensions of minting and burning from the [SRC-20](./native-asset-src-20.md) standard. +The intent of this standard is to separate the extensions of minting and burning from the [SRC-20](./src-20-native-asset.md) standard. ## Prior Art -Minting and burning were initially added to the [SRC-20](./native-asset-src-20.md) standard. +Minting and burning were initially added to the [SRC-20](./src-20-native-asset.md) standard. ## Specification @@ -31,7 +31,7 @@ This function MAY contain arbitrary conditions for minting, and revert if those This function MUST burn `amount` coins with the sub-identifier `sub_id` and MUST ensure the `AssetId` of the asset is the sha-256 hash of `(ContractId, SubId)` for the implementing contract. This function MUST ensure at least `amount` coins have been transferred to the implementing contract. -This function MUST update the total supply defined in the [SRC-20](./native-asset-src-20.md) standard. +This function MUST update the total supply defined in the [SRC-20](./src-20-native-asset.md) standard. This function MAY contain arbitrary conditions for burning, and revert if those conditions are not met. ##### Burn Arguments @@ -41,16 +41,16 @@ This function MAY contain arbitrary conditions for burning, and revert if those ## Rationale -This standard has been added to enable compatibility between applications and allow minting and burning native assets per use case. This standard has been separated from the [SRC-20](./native-asset-src-20.md) standard to allow for the minting and burning for all fungible assets, irrelevant of whether they are [Native Assets](https://docs.fuel.network/docs/sway/blockchain-development/native_assets) or not. +This standard has been added to enable compatibility between applications and allow minting and burning native assets per use case. This standard has been separated from the [SRC-20](./src-20-native-asset.md) standard to allow for the minting and burning for all fungible assets, irrelevant of whether they are [Native Assets](https://docs.fuel.network/docs/sway/blockchain-development/native_assets) or not. ## Backwards Compatibility -This standard is compatible with Fuel's [Native Assets](https://docs.fuel.network/docs/sway/blockchain-development/native_assets) ensuring its compatibility with the [SRC-20](./native-asset-src-20.md) standard. +This standard is compatible with Fuel's [Native Assets](https://docs.fuel.network/docs/sway/blockchain-development/native_assets) ensuring its compatibility with the [SRC-20](./src-20-native-asset.md) standard. ## Security Considerations This standard may introduce security considerations if no checks are implemented to ensure the calling of the `mint()` function is deemed valid or permitted. Checks are highly encouraged. -The burn function may also introduce a security consideration if the total supply within the [SRC-20](./native-asset-src-20.md) standard is not modified. +The burn function may also introduce a security consideration if the total supply within the [SRC-20](./src-20-native-asset.md) standard is not modified. ## Example ABI diff --git a/docs/src/ownership-src-5.md b/docs/src/src-5-ownership.md similarity index 100% rename from docs/src/ownership-src-5.md rename to docs/src/src-5-ownership.md diff --git a/docs/src/vault-src-6.md b/docs/src/src-6-vault.md similarity index 98% rename from docs/src/vault-src-6.md rename to docs/src/src-6-vault.md index fc0b9db..f2ad23f 100644 --- a/docs/src/vault-src-6.md +++ b/docs/src/src-6-vault.md @@ -1,6 +1,6 @@ # SRC-6: Vault -The following standard allows for the implementation of a standard API for asset vaults such as yield-bearing asset vaults or asset wrappers. This standard is an optional add-on to the [SRC-20](./native-asset-src-20.md) standard. +The following standard allows for the implementation of a standard API for asset vaults such as yield-bearing asset vaults or asset wrappers. This standard is an optional add-on to the [SRC-20](./src-20-native-asset.md) standard. ## Motivation @@ -137,7 +137,7 @@ The ABI discussed covers the known use cases of asset vaults while allowing safe ## Backwards Compatibility -This standard is fully compatible with the [SRC-20 standard](./native-asset-src-20.md). +This standard is fully compatible with the [SRC-20 standard](./src-20-native-asset.md). ## Security Considerations diff --git a/docs/src/asset-metadata-src-7.md b/docs/src/src-7-asset-metadata.md similarity index 96% rename from docs/src/asset-metadata-src-7.md rename to docs/src/src-7-asset-metadata.md index 2987d07..4e6654a 100644 --- a/docs/src/asset-metadata-src-7.md +++ b/docs/src/src-7-asset-metadata.md @@ -1,6 +1,6 @@ # SRC-7: Arbitrary Native Asset Metadata -The following standard attempts to define the retrieval of on-chain arbitrary metadata for any [Native Asset](https://docs.fuel.network/docs/sway/blockchain-development/native_assets). Any contract that implements the SRC-7 standard MUST implement the [SRC-20](./native-asset-src-20.md) standard. +The following standard attempts to define the retrieval of on-chain arbitrary metadata for any [Native Asset](https://docs.fuel.network/docs/sway/blockchain-development/native_assets). Any contract that implements the SRC-7 standard MUST implement the [SRC-20](./src-20-native-asset.md) standard. ## Motivation @@ -10,7 +10,7 @@ The SRC-7 standard seeks to enable data-rich assets on the Fuel Network while ma The use of generic metadata was originally found in the Sway-Lib's [NFT Library](https://github.com/FuelLabs/sway-libs/tree/v0.12.0/libs/nft) which did not use Fuel's [Native Assets](https://docs.fuel.network/docs/sway/blockchain-development/native_assets). This library has since been deprecated. -A previous definition for a metadata standard was written in the original edit of the now defunct [SRC-721](https://github.com/FuelLabs/sway-standards/issues/2). This has since been replaced with the [SRC-20](./native-asset-src-20.md) standard as `SubId` was introduced to enable multiple assets to be minted from a single contract. +A previous definition for a metadata standard was written in the original edit of the now defunct [SRC-721](https://github.com/FuelLabs/sway-standards/issues/2). This has since been replaced with the [SRC-20](./src-20-native-asset.md) standard as `SubId` was introduced to enable multiple assets to be minted from a single contract. The standard takes inspiration from [ENS's public resolver](https://docs.ens.domains/contract-api-reference/publicresolver) with the use of a `String` as the key. This should enable human-readable keys to help minimize errors and enable the standardization of certain keys, such as "image" as opposed to an `enum` or `u64` representation of keys. @@ -50,7 +50,7 @@ The SRC-7 standard should allow for data-rich assets to interact with one anothe ## Backwards Compatibility -This standard is compatible with Fuel's [Native Assets](https://docs.fuel.network/docs/sway/blockchain-development/native_assets) and the [SRC-20](./native-asset-src-20.md) standard. It also maintains compatibility with existing standards in other ecosystems. +This standard is compatible with Fuel's [Native Assets](https://docs.fuel.network/docs/sway/blockchain-development/native_assets) and the [SRC-20](./src-20-native-asset.md) standard. It also maintains compatibility with existing standards in other ecosystems. ## Security Considerations diff --git a/docs/src/bridged-asset-src-8.md b/docs/src/src-8-bridged-asset.md similarity index 93% rename from docs/src/bridged-asset-src-8.md rename to docs/src/src-8-bridged-asset.md index 0cd5b57..d703626 100644 --- a/docs/src/bridged-asset-src-8.md +++ b/docs/src/src-8-bridged-asset.md @@ -1,6 +1,6 @@ # SRC-8: Bridged Asset -The following standard attempts to define the retrieval of relevant on-chain metadata for any bridged [Native Assets](https://docs.fuel.network/docs/sway/blockchain-development/native_assets). Any contract that implements the SRC-8 standard MUST implement the [SRC-7](./asset-metadata-src-7.md) and [SRC-20](./native-asset-src-20.md) standards. +The following standard attempts to define the retrieval of relevant on-chain metadata for any bridged [Native Assets](https://docs.fuel.network/docs/sway/blockchain-development/native_assets). Any contract that implements the SRC-8 standard MUST implement the [SRC-7](./src-7-asset-metadata.md) and [SRC-20](./src-20-native-asset.md) standards. ## Motivation @@ -8,7 +8,7 @@ The SRC-8 standard seeks to enable relevant data for bridged assets on the Fuel ## Prior Art -The use of generic metadata for [Native Assets](https://docs.fuel.network/docs/sway/blockchain-development/native_assets) is defined in the [SRC-7](./asset-metadata-src-7.md) standard. This standard integrates into the existing [SRC-7](./asset-metadata-src-7.md) standard. +The use of generic metadata for [Native Assets](https://docs.fuel.network/docs/sway/blockchain-development/native_assets) is defined in the [SRC-7](./src-7-asset-metadata.md) standard. This standard integrates into the existing [SRC-7](./src-7-asset-metadata.md) standard. ## Specification @@ -48,7 +48,7 @@ The SRC-8 standard should allow for data on any bridged assets on the Fuel Netwo ## Backwards Compatibility -This standard is compatible with Fuel's [Native Assets](https://docs.fuel.network/docs/sway/blockchain-development/native_assets), the [SRC-20](./native-asset-src-20.md) standard, and the [SRC-7](./asset-metadata-src-7.md) standard. +This standard is compatible with Fuel's [Native Assets](https://docs.fuel.network/docs/sway/blockchain-development/native_assets), the [SRC-20](./src-20-native-asset.md) standard, and the [SRC-7](./src-7-asset-metadata.md) standard. The standard is also compatible with both tokens and NFTs native to other ecosystems by introducing a token ID element of the original chain. diff --git a/docs/src/metadata-keys-src-9.md b/docs/src/src-9-metadata-keys.md similarity index 97% rename from docs/src/metadata-keys-src-9.md rename to docs/src/src-9-metadata-keys.md index 92827d7..9558b3c 100644 --- a/docs/src/metadata-keys-src-9.md +++ b/docs/src/src-9-metadata-keys.md @@ -1,6 +1,6 @@ # SRC-9: Native Asset -The following standard attempts to define the keys of relevant on-chain metadata for any [Native Assets](https://docs.fuel.network/docs/sway/blockchain-development/native_assets). Any contract that implements the SRC-9 standard MUST implement the [SRC-7](./asset-metadata-src-7.md) and [SRC-20](./native-asset-src-20.md) standards. This is a living standard where revisions may be made as the ecosystem evolves. +The following standard attempts to define the keys of relevant on-chain metadata for any [Native Assets](https://docs.fuel.network/docs/sway/blockchain-development/native_assets). Any contract that implements the SRC-9 standard MUST implement the [SRC-7](./src-7-asset-metadata.md) and [SRC-20](./src-20-native-asset.md) standards. This is a living standard where revisions may be made as the ecosystem evolves. ## Motivation @@ -8,7 +8,7 @@ The SRC-9 standard seeks to enable relevant data for assets on the Fuel Network. ## Prior Art -The use of generic metadata for [Native Assets](https://docs.fuel.network/docs/sway/blockchain-development/native_assets) is defined in the [SRC-7](./asset-metadata-src-7.md) standard. This standard integrates into the existing [SRC-7](./asset-metadata-src-7.md) standard. +The use of generic metadata for [Native Assets](https://docs.fuel.network/docs/sway/blockchain-development/native_assets) is defined in the [SRC-7](./src-7-asset-metadata.md) standard. This standard integrates into the existing [SRC-7](./src-7-asset-metadata.md) standard. ## Specification @@ -349,7 +349,7 @@ The SRC-9 standard should allow for standardized keys for metadata on the Fuel N ## Backwards Compatibility -This standard is compatible with Fuel's [Native Assets](https://docs.fuel.network/docs/sway/blockchain-development/native_assets), the [SRC-20](./native-asset-src-20.md) standard, and the [SRC-7](./asset-metadata-src-7.md) standard. +This standard is compatible with Fuel's [Native Assets](https://docs.fuel.network/docs/sway/blockchain-development/native_assets), the [SRC-20](./src-20-native-asset.md) standard, and the [SRC-7](./src-7-asset-metadata.md) standard. ## Security Considerations From b6cbfde6e62f4ce3816cbe477be7e47cc2d32336 Mon Sep 17 00:00:00 2001 From: sarahschwartz <58856580+sarahschwartz@users.noreply.github.com> Date: Fri, 31 May 2024 11:42:43 -0600 Subject: [PATCH 26/44] fix --- docs/src/index.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/src/index.md b/docs/src/index.md index 32c2f24..749fd37 100644 --- a/docs/src/index.md +++ b/docs/src/index.md @@ -14,7 +14,7 @@ If you don't find what you're looking for, feel free to create an issue and prop To import a standard the following should be added to the project's `Forc.toml` file under `[dependencies]` with the most recent release: ```toml -standards = { git = "https://github.com/FuelLabs/sway-standards", tag = "v0.4.4" } +standards = { git = "https://github.com/FuelLabs/sway-standards", tag = "v0.5.0" } ``` > **NOTE:** From cc9c431109278998262b7680b51047a6f4a560f1 Mon Sep 17 00:00:00 2001 From: sarahschwartz <58856580+sarahschwartz@users.noreply.github.com> Date: Fri, 31 May 2024 12:30:21 -0600 Subject: [PATCH 27/44] remove dashes --- docs/src/src-10-native-bridge.md | 20 ++++++++++---------- docs/src/src-5-ownership.md | 8 ++++---- docs/src/src-7-asset-metadata.md | 8 ++++---- docs/src/src-8-bridged-asset.md | 8 ++++---- 4 files changed, 22 insertions(+), 22 deletions(-) diff --git a/docs/src/src-10-native-bridge.md b/docs/src/src-10-native-bridge.md index 421ee99..fa07ecb 100644 --- a/docs/src/src-10-native-bridge.md +++ b/docs/src/src-10-native-bridge.md @@ -18,7 +18,7 @@ The following functions MUST be implemented to follow the SRC-10; Native Bridge ## Required Functions -### - `fn process_message(message_index: u64)` +### `fn process_message(message_index: u64)` The `process_message()` function accepts incoming deposit messages from the canonical chain and issues the corresponding bridged asset. @@ -26,7 +26,7 @@ The `process_message()` function accepts incoming deposit messages from the cano - This function SHALL mint an asset that follows the [SRC-8; Bridged Asset Standard](./src-8-bridged-asset.md). - This function SHALL issue a refund if there is an error in the bridging process. -### - `fn withdraw(to_address: b256)` +### `fn withdraw(to_address: b256)` The `withdraw()` function accepts and burns a bridged Native Asset on Fuel and sends a message to the bridge contract on the canonical chain to release the originally deposited tokens to the `to_address` address. @@ -34,7 +34,7 @@ The `withdraw()` function accepts and burns a bridged Native Asset on Fuel and s - This function MUST ensure the asset's `AssetId` sent in the transaction matches a bridged asset. - This function SHALL burn all coins sent in the transaction. -### - `fn claim_refund(to_address: b256, token_address: b256, token_id: b256, gateway_contract: b256)` +### `fn claim_refund(to_address: b256, token_address: b256, token_id: b256, gateway_contract: b256)` The `claim_refund()` function is called if something goes wrong in the bridging process and an error occurs. It sends a message to the `gateway_contract` contract on the canonical chain to release the `token_address` token with token id `token_id` to the `to_address` address. @@ -73,31 +73,31 @@ pub enum DepositType { The following describes a struct that encapsulates various deposit message metadata to a single type. There MUST be the following fields in the `DepositMessage` struct: -#### - amount: `u256` +#### amount: `u256` The `amount` field MUST represent the number of tokens. -#### - from: `b256` +#### from: `b256` The `from` field MUST represent the bridging user’s address on the canonical chain. -#### - to: `Identity` +#### to: `Identity` The `to` field MUST represent the bridging target destination `Address` or `ContractId` on the Fuel Chain. -#### - token_address: `b256` +#### token_address: `b256` The `token_address` field MUST represent the bridged token's address on the canonical chain. -#### - token_id: `b256` +#### token_id: `b256` The `token_id` field MUST represent the token's ID on the canonical chain. The `b256::zero()` MUST be used if this is a fungible token and no token ID exists. -#### - decimals: `u8` +#### decimals: `u8` The `decimals` field MUST represent the bridged token's decimals on the canonical chain. -#### - deposit_type: `DepositType` +#### deposit_type: `DepositType` The `deposit_type` field MUST represent the type of bridge deposit made on the canonical chain. diff --git a/docs/src/src-5-ownership.md b/docs/src/src-5-ownership.md index c8c6ae3..4cea7a3 100644 --- a/docs/src/src-5-ownership.md +++ b/docs/src/src-5-ownership.md @@ -18,15 +18,15 @@ Ownership libraries exist for other ecosystems such as OpenZeppelin's [Ownership There SHALL be 3 states for any library implementing an ownership module in the following order: -#### - `Uninitialized` +#### `Uninitialized` The `Uninitialized` state SHALL be set as the initial state if no owner or admin is set. The `Uninitialized` state MUST be used when an owner or admin MAY be set in the future. -#### - `Initialized` +#### `Initialized` The `Initialized` state SHALL be set as the state if an owner or admin is set with an associated `Identity` type. -#### - `Revoked` +#### `Revoked` The `Revoked` state SHALL be set when there is no owner or admin and there SHALL NOT be one set in the future. @@ -52,7 +52,7 @@ This function SHALL return the current state of ownership for the contract where There SHALL be error handling. -#### - `NotOwner` +#### `NotOwner` This error MUST be emitted when `only_owner()` reverts. diff --git a/docs/src/src-7-asset-metadata.md b/docs/src/src-7-asset-metadata.md index 4e6654a..0dcb7df 100644 --- a/docs/src/src-7-asset-metadata.md +++ b/docs/src/src-7-asset-metadata.md @@ -22,19 +22,19 @@ We also take a look at existing common metadata practices such as [OpenSea's Met The following describes an enum that wraps various metadata types into a single return type. There SHALL be the following variants in the `Metadata` enum: -#### - `B256` +#### `B256` The `B256` variant SHALL be used when the stored metadata for the corresponding `AssetId` and `Sting` key pair is of the `b256` type. -#### - `Bytes` +#### `Bytes` The `Bytes` variant SHALL be used when the stored metadata for the corresponding `AssetId` and `String` key pair is of the `Bytes` type. The `Bytes` variant should be used when storing custom data such as but not limited to structs and enums. -#### - `Int` +#### `Int` The `Int` variant SHALL be used when the stored metadata for the corresponding `AssetId` and `Sting` key pair is of the `u64` type. -#### - `String` +#### `String` The `String` variant SHALL be used when the stored metadata for the corresponding `AssetId` and `String` key pair is of the `String` type. The `String` variant MUST be used when a URI is required but MAY contain any arbitrary `String` data. diff --git a/docs/src/src-8-bridged-asset.md b/docs/src/src-8-bridged-asset.md index d703626..5409998 100644 --- a/docs/src/src-8-bridged-asset.md +++ b/docs/src/src-8-bridged-asset.md @@ -26,19 +26,19 @@ Any bridged assets MUST use the name and symbol of the asset on the chain where ### SRC-7 Metadata -#### - `bridged:chain` +#### `bridged:chain` The key `bridged:chain` SHALL return an `String` variant of the chain ID where the asset was originally minted. -#### - `bridged:address` +#### `bridged:address` The key `bridged:address` SHALL return a `B256` variant of the asset's address on the chain where the asset was originally minted. Native assets of a chain that do not have an address such as Ether on Ethereum SHALL use `b256::zero()`. -#### - `bridged:id` +#### `bridged:id` The key `bridged:id` MAY return a `B256` variant of the asset's ID such as an NFT's ID on the chain where the asset was originally minted. IF there is no ID, `None` SHALL be returned. -#### - `bridged:decimals` +#### `bridged:decimals` The key `bridged:decimals` MAY return an `Int` variant of the asset's decimals on the chain where the asset was originally minted. IF there are no decimals, `None` SHALL be returned. From 29cb1dd31c8f544017544daedb49a546690db01e Mon Sep 17 00:00:00 2001 From: sarahschwartz <58856580+sarahschwartz@users.noreply.github.com> Date: Fri, 31 May 2024 12:39:49 -0600 Subject: [PATCH 28/44] fix lint --- docs/src/src-10-native-bridge.md | 50 ++++++++++++++++---------------- docs/src/src-6-vault.md | 4 +-- 2 files changed, 27 insertions(+), 27 deletions(-) diff --git a/docs/src/src-10-native-bridge.md b/docs/src/src-10-native-bridge.md index fa07ecb..2348b20 100644 --- a/docs/src/src-10-native-bridge.md +++ b/docs/src/src-10-native-bridge.md @@ -16,9 +16,9 @@ The following standard takes reference from the [`FungibleBridge`](https://githu The following functions MUST be implemented to follow the SRC-10; Native Bridge Standard: -## Required Functions +### Required Functions -### `fn process_message(message_index: u64)` +**`fn process_message(message_index: u64)`** The `process_message()` function accepts incoming deposit messages from the canonical chain and issues the corresponding bridged asset. @@ -26,7 +26,7 @@ The `process_message()` function accepts incoming deposit messages from the cano - This function SHALL mint an asset that follows the [SRC-8; Bridged Asset Standard](./src-8-bridged-asset.md). - This function SHALL issue a refund if there is an error in the bridging process. -### `fn withdraw(to_address: b256)` +**`fn withdraw(to_address: b256)`** The `withdraw()` function accepts and burns a bridged Native Asset on Fuel and sends a message to the bridge contract on the canonical chain to release the originally deposited tokens to the `to_address` address. @@ -34,32 +34,32 @@ The `withdraw()` function accepts and burns a bridged Native Asset on Fuel and s - This function MUST ensure the asset's `AssetId` sent in the transaction matches a bridged asset. - This function SHALL burn all coins sent in the transaction. -### `fn claim_refund(to_address: b256, token_address: b256, token_id: b256, gateway_contract: b256)` +**`fn claim_refund(to_address: b256, token_address: b256, token_id: b256, gateway_contract: b256)`** The `claim_refund()` function is called if something goes wrong in the bridging process and an error occurs. It sends a message to the `gateway_contract` contract on the canonical chain to release the `token_address` token with token id `token_id` to the `to_address` address. - This function SHALL send a message to the `gateway_contract` contract to release the `token_address` token with id `token_id` to the `to_address` address on the canonical chain. - This function MUST ensure a refund was issued. -## Required Data Types +### Required Data Types -### `DepositType` +#### `DepositType` The `DepositType` enum describes whether the bridged deposit is made to a address, contract, or contract and contains additional metadata. There MUST be the following variants in the `DepositType` enum: -#### `Address`: `()` +**`Address`: `()`** The `Address` variant MUST represent when the deposit is made to an address on the Fuel chain. -#### `Contract`: `()` +**`Contract`: `()`** The `Contract` variant MUST represent when the deposit is made to an contract on the Fuel chain. -#### `ContractWithData`: `()` +**`ContractWithData`: `()`** The `ContractWithData` variant MUST represent when the deposit is made to an contract and contains additional metadata for the Fuel chain. -#### Example +##### Example Deposit Type ```sway pub enum DepositType { @@ -69,39 +69,39 @@ pub enum DepositType { } ``` -### `DepositMessage` +#### `DepositMessage` The following describes a struct that encapsulates various deposit message metadata to a single type. There MUST be the following fields in the `DepositMessage` struct: -#### amount: `u256` +**`amount`: `u256`** The `amount` field MUST represent the number of tokens. -#### from: `b256` +**`from`: `b256`** The `from` field MUST represent the bridging user’s address on the canonical chain. -#### to: `Identity` +**`to`: `Identity`** The `to` field MUST represent the bridging target destination `Address` or `ContractId` on the Fuel Chain. -#### token_address: `b256` +**`token_address`: `b256`** The `token_address` field MUST represent the bridged token's address on the canonical chain. -#### token_id: `b256` +**`token_id`: `b256`** The `token_id` field MUST represent the token's ID on the canonical chain. The `b256::zero()` MUST be used if this is a fungible token and no token ID exists. -#### decimals: `u8` +**`decimals`: `u8`** The `decimals` field MUST represent the bridged token's decimals on the canonical chain. -#### deposit_type: `DepositType` +**`deposit_type`: `DepositType`** The `deposit_type` field MUST represent the type of bridge deposit made on the canonical chain. -#### Example Deposit Message +##### Example Deposit Message ```sway pub struct DepositMessage { @@ -115,27 +115,27 @@ pub struct DepositMessage { } ``` -### `MetadataMessage` +#### `MetadataMessage` The following describes a struct that encapsulates the metadata of token on the canonical chain to a single type. There MUST be the following fields in the `MetadataMessage` struct: -#### token_address: `b256` +**`token_address`: `b256`** The `token_address` field MUST represent the bridged token's address on the canonical chain. -#### token_id: `b256` +**`token_id`: `b256`** The `token_id` field MUST represent the token's ID on the canonical chain. The `b256::zero()` MUST be used if this is a fungible token and no token ID exists. -#### name: `String` +**`name`: `String`** The `name` field MUST represent the bridged token's name field on the canonical chain. -#### symbol: `String` +**`symbol`: `String`** The `symbol` field MUST represent the bridged token's symbol field on the canonical chain. -### Example Metadata Message +##### Example Metadata Message ```sway pub struct MetadataMessage { diff --git a/docs/src/src-6-vault.md b/docs/src/src-6-vault.md index f2ad23f..04ac75f 100644 --- a/docs/src/src-6-vault.md +++ b/docs/src/src-6-vault.md @@ -12,11 +12,11 @@ Asset vaults have been thoroughly explored on Ethereum and with [EIP 4626](https ## Specification -## Required public functions +### Required public functions The following functions MUST be implemented to follow the SRC-6 standard. Any contract that implements the SRC-6 standard MUST implement the SRC-20 standard. -### `fn deposit(receiver: Identity, vault_sub_id: SubId) -> u64` +#### `fn deposit(receiver: Identity, vault_sub_id: SubId) -> u64` This function takes the `receiver` Identity and the SubId `vault_sub_id` of the sub-vault as an argument and returns the amount of shares minted to the `receiver`. From f341dc2a9442f47c7767b48d7dfcd22afb224fc1 Mon Sep 17 00:00:00 2001 From: sarahschwartz <58856580+sarahschwartz@users.noreply.github.com> Date: Fri, 31 May 2024 12:48:46 -0600 Subject: [PATCH 29/44] fix examples --- docs/src/src-14-simple-upgradeable-proxies.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/src/src-14-simple-upgradeable-proxies.md b/docs/src/src-14-simple-upgradeable-proxies.md index da23549..8118efa 100644 --- a/docs/src/src-14-simple-upgradeable-proxies.md +++ b/docs/src/src-14-simple-upgradeable-proxies.md @@ -75,7 +75,7 @@ abi SRC14 { Example of a minimal SRC-14 implementation with no access control. ```sway -{{#include ../examples/examples/src14-simple-proxy/owned/src/minimal.sw}} +{{#include ../../examples/src14-simple-proxy/owned/src/minimal.sw}} ``` ### Owned Proxy @@ -83,5 +83,5 @@ Example of a minimal SRC-14 implementation with no access control. Example of a SRC-14 implementation that also implements [SRC-5](./src-5-ownership.md). ```sway -{{#include ../examples/examples/src14-simple-proxy/owned/src/owned.sw}} +{{#include ../../examples/src14-simple-proxy/owned/src/owned.sw}} ``` From f76e3a7e62d10495e8483c0a7097658c20dc8703 Mon Sep 17 00:00:00 2001 From: sarahschwartz <58856580+sarahschwartz@users.noreply.github.com> Date: Fri, 31 May 2024 12:51:04 -0600 Subject: [PATCH 30/44] fix --- docs/src/src-14-simple-upgradeable-proxies.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/src/src-14-simple-upgradeable-proxies.md b/docs/src/src-14-simple-upgradeable-proxies.md index 8118efa..1448f99 100644 --- a/docs/src/src-14-simple-upgradeable-proxies.md +++ b/docs/src/src-14-simple-upgradeable-proxies.md @@ -75,7 +75,7 @@ abi SRC14 { Example of a minimal SRC-14 implementation with no access control. ```sway -{{#include ../../examples/src14-simple-proxy/owned/src/minimal.sw}} +{{#include ../../examples/src14-simple-proxy/minimal/src/minimal.sw}} ``` ### Owned Proxy From ea376ae7a9e156244d706dc44ed08c0471681d76 Mon Sep 17 00:00:00 2001 From: sarahschwartz <58856580+sarahschwartz@users.noreply.github.com> Date: Fri, 31 May 2024 13:49:30 -0600 Subject: [PATCH 31/44] add version for docs-hub --- Cargo.toml | 4 ++++ 1 file changed, 4 insertions(+) create mode 100644 Cargo.toml diff --git a/Cargo.toml b/Cargo.toml new file mode 100644 index 0000000..e76a377 --- /dev/null +++ b/Cargo.toml @@ -0,0 +1,4 @@ +[package] +name = "sway-standards" +version = "0.5.0" +edition = "2021" From 3f6f73ce0cd960e5e66788d26dc297665c173289 Mon Sep 17 00:00:00 2001 From: sarahschwartz <58856580+sarahschwartz@users.noreply.github.com> Date: Tue, 4 Jun 2024 07:51:55 -0600 Subject: [PATCH 32/44] fix link --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index d0804b1..ce99888 100644 --- a/README.md +++ b/README.md @@ -48,7 +48,7 @@ If you don't find what you're looking for, feel free to create an issue and prop ### Contracts - [SRC-12; Contract Factory](./docs/src/src-12-contract-factory.md) defines the implementation of a standard API for contract factories. -- [SRC-14; Simple Upgradable Proxies](./SRCs/src-14.md) defines the implementation of a standard API for simple upgradable proxies. +- [SRC-14; Simple Upgradable Proxies](./SRCs/src-14-simple-upgradeable-proxies.md) defines the implementation of a standard API for simple upgradable proxies. ### Bridge From 0360d560076e9ee8cd1a8dd5b20f8c04bbb8f27b Mon Sep 17 00:00:00 2001 From: sarahschwartz <58856580+sarahschwartz@users.noreply.github.com> Date: Tue, 4 Jun 2024 08:01:21 -0600 Subject: [PATCH 33/44] fix link --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index ce99888..8f3d595 100644 --- a/README.md +++ b/README.md @@ -48,7 +48,7 @@ If you don't find what you're looking for, feel free to create an issue and prop ### Contracts - [SRC-12; Contract Factory](./docs/src/src-12-contract-factory.md) defines the implementation of a standard API for contract factories. -- [SRC-14; Simple Upgradable Proxies](./SRCs/src-14-simple-upgradeable-proxies.md) defines the implementation of a standard API for simple upgradable proxies. +- [SRC-14; Simple Upgradable Proxies](./docs/src/src-14-simple-upgradeable-proxies.md) defines the implementation of a standard API for simple upgradable proxies. ### Bridge From 5c85027f279f5377fba706c260021c45fb280ab5 Mon Sep 17 00:00:00 2001 From: Cameron Carstens Date: Tue, 11 Jun 2024 12:43:45 +0800 Subject: [PATCH 34/44] Add empty CHANGELOG.md (#104) * Add empty changelog * Remove duplicate breaking section from CHANGELOG.md * Fix CI * Fix broken links in README --- .github/PULL_REQUEST_TEMPLATE.md | 1 + CHANGELOG.md | 30 ++++++++++++++++++++++++++++++ README.md | 2 +- 3 files changed, 32 insertions(+), 1 deletion(-) create mode 100644 CHANGELOG.md diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md index 5b25f97..b2cba48 100644 --- a/.github/PULL_REQUEST_TEMPLATE.md +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -35,3 +35,4 @@ Closes #\ - [ ] I have added (or requested a maintainer to add) the necessary `Breaking*` or `New Feature` labels where relevant. - [ ] I have done my best to ensure that my PR adheres to [the Fuel Labs Code Review Standards](https://github.com/FuelLabs/rfcs/blob/master/text/code-standards/external-contributors.md). - [ ] I have requested a review from the relevant team or maintainers. +- [ ] I have updated the changelog to reflect the changes on this PR. diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 0000000..1055233 --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,30 @@ +# Change Log + +All notable changes to this project will be documented in this file. + +The format is based on [Keep a Changelog](http://keepachangelog.com/) +and this project adheres to [Semantic Versioning](http://semver.org/). + +## [Unreleased] - yyyy-mm-dd + +Description of the upcoming release here. + +### Added + +- Something new here 1 +- Something new here 2 + +### Changed + +- Something changed here 1 +- Something changed here 2 + +### Fixed + +- Some fix here 1 +- Some fix here 2 + +#### Breaking + +- Some breaking change here 1 +- Some breaking change here 2 diff --git a/README.md b/README.md index 8f3d595..a7e0ead 100644 --- a/README.md +++ b/README.md @@ -158,7 +158,7 @@ Example of a minimal SRC-14 implementation with no access control. ##### [Owned Proxy](./examples/src14-simple-proxy/owned/src/owned.sw) -Example of a SRC-14 implementation that also implements [SRC-5](https://github.com/FuelLabs/sway-standards/blob/master/SRCs/src-5.md). +Example of a SRC-14 implementation that also implements [SRC-5](https://github.com/FuelLabs/sway-standards/blob/master/docs/src/src-5-ownership.md). > **Note** > All standards currently use `forc v0.60.0`. From ce75649bc0df71c55e6f2005bd95073c558ee66f Mon Sep 17 00:00:00 2001 From: bitzoic Date: Tue, 11 Jun 2024 13:51:23 +0800 Subject: [PATCH 35/44] Add proxy_owner() to SRC14 standard --- docs/src/src-14-simple-upgradeable-proxies.md | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/docs/src/src-14-simple-upgradeable-proxies.md b/docs/src/src-14-simple-upgradeable-proxies.md index 7c75338..abacde5 100644 --- a/docs/src/src-14-simple-upgradeable-proxies.md +++ b/docs/src/src-14-simple-upgradeable-proxies.md @@ -41,6 +41,14 @@ The following functions MUST be implemented by a proxy contract to follow the SR If a valid call is made to this function it MUST change the target address of the proxy to `new_target`. This method SHOULD implement access controls such that the target can only be changed by a user that possesses the right permissions (typically the proxy owner). +### Optional Public Functions + +The following functions are RECOMMENDED to be implemented by a proxy contract to follow the SRC-14 standard: + +#### `fn proxy_owner() -> State;` + +This function SHALL return the current state of ownership for the proxy contract where the `State` is either `Uninitialized`, `Initialized`, or `Revoked`. `State` is defined in the [SRC-5; Ownership Standard](./src-5-ownership.md). + ## Rationale This standard is meant to provide simple upgradeability, it is deliberately minimalistic and does not provide the level of functionality of diamonds. @@ -57,15 +65,20 @@ As it is the first attempt to standardize proxy implementation, we do not consid ## Security Considerations Permissioning proxy target changes is the primary consideration here. -This standard is not opinionated about means of achieving this, use of [SRC-5](./src-5-ownership.md) is recommended. +Use of the [SRC-5; Ownership Standard](./src-5-ownership.md) is discouraged. If both the target and proxy contracts implement the [SRC-5](./src-5-ownership.md) standard, the `owner()` function in the target contract is unreachable through the proxy contract. Use of the `proxy_owner()` function in the proxy contract should be used instead. ## Example ABI ```sway abi SRC14 { - #[storage(write)] + #[storage(read, write)] fn set_proxy_target(new_target: ContractId); } + +abi SRC14Extension { + #[storage(read)] + fn proxy_owner() -> State; +} ``` ## Example Implementation @@ -80,7 +93,7 @@ Example of a minimal SRC-14 implementation with no access control. ### Owned Proxy -Example of a SRC-14 implementation that also implements [SRC-5](./src-5-ownership.md). +Example of a SRC-14 implementation that also implements `proxy_owner()`. ```sway {{#include ../../examples/src14-simple-proxy/owned/src/owned.sw}} From 95350eec0d4a2cad605c2840735c51f724eb5de8 Mon Sep 17 00:00:00 2001 From: bitzoic Date: Tue, 11 Jun 2024 13:51:41 +0800 Subject: [PATCH 36/44] Update standard and examples --- .../src14-simple-proxy/minimal/src/minimal.sw | 5 ++-- .../src14-simple-proxy/owned/src/owned.sw | 25 +++++++++--------- standards/src/src14.sw | 26 ++++++++++++++++++- 3 files changed, 39 insertions(+), 17 deletions(-) diff --git a/examples/src14-simple-proxy/minimal/src/minimal.sw b/examples/src14-simple-proxy/minimal/src/minimal.sw index 89b490d..0df0ece 100644 --- a/examples/src14-simple-proxy/minimal/src/minimal.sw +++ b/examples/src14-simple-proxy/minimal/src/minimal.sw @@ -1,18 +1,17 @@ contract; use std::execution::run_external; -use std::constants::ZERO_B256; use standards::src14::SRC14; // use sha256("storage_SRC14") as base to avoid collisions #[namespace(SRC14)] storage { // target is at sha256("storage_SRC14_0") - target: ContractId = ContractId::from(ZERO_B256), + target: ContractId = ContractId::zero(), } impl SRC14 for Contract { - #[storage(write)] + #[storage(read, write)] fn set_proxy_target(new_target: ContractId) { storage.target.write(new_target); } diff --git a/examples/src14-simple-proxy/owned/src/owned.sw b/examples/src14-simple-proxy/owned/src/owned.sw index bbba63a..2c81c26 100644 --- a/examples/src14-simple-proxy/owned/src/owned.sw +++ b/examples/src14-simple-proxy/owned/src/owned.sw @@ -1,36 +1,35 @@ contract; use std::execution::run_external; -use std::constants::ZERO_B256; -use standards::src5::{AccessError, SRC5, State}; -use standards::src14::SRC14; +use standards::src5::{AccessError, State}; +use standards::src14::{SRC14, SRC14Extension}; /// The owner of this contract at deployment. -const INITIAL_OWNER: Identity = Identity::Address(Address::from(ZERO_B256)); +const INITIAL_OWNER: Identity = Identity::Address(Address::zero()); // use sha256("storage_SRC14") as base to avoid collisions #[namespace(SRC14)] storage { // target is at sha256("storage_SRC14_0") - target: ContractId = ContractId::from(ZERO_B256), + target: ContractId = ContractId::zero(), owner: State = State::Initialized(INITIAL_OWNER), } -impl SRC5 for Contract { - #[storage(read)] - fn owner() -> State { - storage.owner.read() - } -} - impl SRC14 for Contract { - #[storage(write)] + #[storage(read, write)] fn set_proxy_target(new_target: ContractId) { only_owner(); storage.target.write(new_target); } } +impl SRC14Extension for Contract { + #[storage(read)] + fn proxy_owner() -> State { + storage.owner.read() + } +} + #[fallback] #[storage(read)] fn fallback() { diff --git a/standards/src/src14.sw b/standards/src/src14.sw index 0ee667e..f9d1456 100644 --- a/standards/src/src14.sw +++ b/standards/src/src14.sw @@ -1,5 +1,7 @@ library; +use ::src5::State; + abi SRC14 { /// Change the target address of a proxy contract. /// @@ -18,10 +20,32 @@ abi SRC14 { /// contract_abi.set_proxy_target(new_target); /// } /// ``` - #[storage(write)] + #[storage(read, write)] fn set_proxy_target(new_target: ContractId); } +abi SRC14Extension { + /// Returns the owner of the proxy contract. + /// + /// # Returns + /// + /// * [State] - Represents the state of ownership for this contract. + /// + /// # Examples + /// + /// ```sway + /// fn foo() { + /// match owner() { + /// State::Uninitalized => log("The ownership is uninitalized"), + /// State::Initialized(owner) => log("The ownership is initalized"), + /// State::Revoked => log("The ownership is revoked"), + /// } + /// } + /// ``` + #[storage(read)] + fn proxy_owner() -> State; +} + /// The standard storage slot to store proxy target address. /// /// Value is `sha256("storage_SRC14_0")`. From b89966cd26d6f322356c46c8eeeb84c266c99beb Mon Sep 17 00:00:00 2001 From: bitzoic Date: Tue, 11 Jun 2024 14:03:59 +0800 Subject: [PATCH 37/44] Udpate CHANGELOG --- CHANGELOG.md | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 1055233..fb0981e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -16,8 +16,7 @@ Description of the upcoming release here. ### Changed -- Something changed here 1 -- Something changed here 2 +- [#107](https://github.com/FuelLabs/sway-standards/pull/107) Add `proxy_owner()` function to the SRC-14 standard. ### Fixed From 5a6f46ea78bdb8ee06ec3781fe7dad02337d0764 Mon Sep 17 00:00:00 2001 From: bitzoic Date: Tue, 11 Jun 2024 14:21:29 +0800 Subject: [PATCH 38/44] Update CHANGELOG 2 --- CHANGELOG.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index fb0981e..dbc5aad 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,17 +11,17 @@ Description of the upcoming release here. ### Added -- Something new here 1 +- [#107](https://github.com/FuelLabs/sway-standards/pull/107) Adds the `proxy_owner()` function to the SRC-14 standard. - Something new here 2 ### Changed -- [#107](https://github.com/FuelLabs/sway-standards/pull/107) Add `proxy_owner()` function to the SRC-14 standard. +- Something changed here 1 +- Something changed here 2 ### Fixed -- Some fix here 1 -- Some fix here 2 +- [#107](https://github.com/FuelLabs/sway-standards/pull/107) resolves the conflict when SRC-5's `owner()` function is used in both the proxy and target contract in the SRC-14 standard. #### Breaking From 2206de75bdb5fcabfc90d33dab17878a4d7efe2f Mon Sep 17 00:00:00 2001 From: Cameron Carstens Date: Fri, 14 Jun 2024 11:50:56 +0800 Subject: [PATCH 39/44] Update codeowner for new team name (#105) --- .github/CODEOWNERS | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index a4abb26..8f5e101 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -1 +1 @@ -* @FuelLabs/application-dev +* @FuelLabs/swayex From 3e74fcd53fb7d88bba926895add477ae191d6922 Mon Sep 17 00:00:00 2001 From: Cameron Carstens Date: Tue, 18 Jun 2024 11:28:13 +0800 Subject: [PATCH 40/44] SRC14 add `proxy_target()` (#110) * Add proxy_target() to standard * Add proxy_target to SRC14 abi * Add proxy_target() to examples * Update CHANGELOG with SRC14 add proxy_target() PR --- CHANGELOG.md | 13 ++++++++++-- docs/src/src-14-simple-upgradeable-proxies.md | 8 ++++++- .../src14-simple-proxy/minimal/src/minimal.sw | 5 +++++ .../src14-simple-proxy/owned/src/owned.sw | 5 +++++ standards/src/src14.sw | 21 ++++++++++++++++++- 5 files changed, 48 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index dbc5aad..db5ee1d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,6 +12,7 @@ Description of the upcoming release here. ### Added - [#107](https://github.com/FuelLabs/sway-standards/pull/107) Adds the `proxy_owner()` function to the SRC-14 standard. +- [#110](https://github.com/FuelLabs/sway-standards/pull/110) Adds the `proxy_target()` function to the SRC-14 standard. - Something new here 2 ### Changed @@ -25,5 +26,13 @@ Description of the upcoming release here. #### Breaking -- Some breaking change here 1 -- Some breaking change here 2 +- [#110](https://github.com/FuelLabs/sway-standards/pull/110) Breaks the `SRC14` abi by adding the `proxy_target()` function. This will need to be added to any SRC14 implementation. The new abi is as follows: + +```sway +abi SRC14 { + #[storage(read, write)] + fn set_proxy_target(new_target: ContractId); + #[storage(read)] + fn proxy_target() -> Option; +} +``` diff --git a/docs/src/src-14-simple-upgradeable-proxies.md b/docs/src/src-14-simple-upgradeable-proxies.md index abacde5..a15e504 100644 --- a/docs/src/src-14-simple-upgradeable-proxies.md +++ b/docs/src/src-14-simple-upgradeable-proxies.md @@ -38,9 +38,13 @@ The following functions MUST be implemented by a proxy contract to follow the SR #### `fn set_proxy_target(new_target: ContractId);` -If a valid call is made to this function it MUST change the target address of the proxy to `new_target`. +If a valid call is made to this function it MUST change the target contract of the proxy to `new_target`. This method SHOULD implement access controls such that the target can only be changed by a user that possesses the right permissions (typically the proxy owner). +#### `fn proxy_target() -> Option;` + +This function MUST return the target contract of the proxy as `Some`. If no proxy is set then `None` MUST be returned. + ### Optional Public Functions The following functions are RECOMMENDED to be implemented by a proxy contract to follow the SRC-14 standard: @@ -73,6 +77,8 @@ Use of the [SRC-5; Ownership Standard](./src-5-ownership.md) is discouraged. If abi SRC14 { #[storage(read, write)] fn set_proxy_target(new_target: ContractId); + #[storage(read)] + fn proxy_target() -> Option; } abi SRC14Extension { diff --git a/examples/src14-simple-proxy/minimal/src/minimal.sw b/examples/src14-simple-proxy/minimal/src/minimal.sw index 0df0ece..939e60f 100644 --- a/examples/src14-simple-proxy/minimal/src/minimal.sw +++ b/examples/src14-simple-proxy/minimal/src/minimal.sw @@ -15,6 +15,11 @@ impl SRC14 for Contract { fn set_proxy_target(new_target: ContractId) { storage.target.write(new_target); } + + #[storage(read)] + fn proxy_target() -> Option { + storage.target.try_read() + } } #[fallback] diff --git a/examples/src14-simple-proxy/owned/src/owned.sw b/examples/src14-simple-proxy/owned/src/owned.sw index 2c81c26..2d89e74 100644 --- a/examples/src14-simple-proxy/owned/src/owned.sw +++ b/examples/src14-simple-proxy/owned/src/owned.sw @@ -21,6 +21,11 @@ impl SRC14 for Contract { only_owner(); storage.target.write(new_target); } + + #[storage(read)] + fn proxy_target() -> Option { + storage.target.try_read() + } } impl SRC14Extension for Contract { diff --git a/standards/src/src14.sw b/standards/src/src14.sw index f9d1456..51d00e5 100644 --- a/standards/src/src14.sw +++ b/standards/src/src14.sw @@ -3,7 +3,7 @@ library; use ::src5::State; abi SRC14 { - /// Change the target address of a proxy contract. + /// Change the target contract of a proxy contract. /// /// # Arguments /// @@ -22,6 +22,25 @@ abi SRC14 { /// ``` #[storage(read, write)] fn set_proxy_target(new_target: ContractId); + + /// Returns the target contract of a proxy contract. + /// + /// # Returns + /// + /// * [Option] - The new proxy contract to which all fallback calls will be passed or `None`. + /// + /// # Examples + /// + /// ```sway + /// use src14::SRC14; + /// + /// fn foo(contract_id: ContractId) { + /// let contract_abi = abi(SRC14, contract_id.bits()); + /// let target_contract: Option = contract_abi.proxy_target(); + /// } + /// ``` + #[storage(read)] + fn proxy_target() -> Option; } abi SRC14Extension { From 1bab9033f83fb1b692ac80e686a91f5001b3ddea Mon Sep 17 00:00:00 2001 From: wangshouh Date: Thu, 20 Jun 2024 00:29:21 +0800 Subject: [PATCH 41/44] Fix examples code --- standards/src/src3.sw | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/standards/src/src3.sw b/standards/src/src3.sw index f8c42b8..faeb870 100644 --- a/standards/src/src3.sw +++ b/standards/src/src3.sw @@ -15,7 +15,7 @@ abi SRC3 { /// use src3::SRC3; /// /// fn foo(contract_id: ContractId) { - /// let contract_abi = abi(SR3, contract); + /// let contract_abi = abi(SRC3, contract); /// contract_abi.mint(Identity::ContractId(contract_id), SubId::zero(), 100); /// } /// ``` @@ -40,7 +40,7 @@ abi SRC3 { /// use src3::SRC3; /// /// fn foo(contract_id: ContractId, asset_id: AssetId) { - /// let contract_abi = abi(SR3, contract_id); + /// let contract_abi = abi(SRC3, contract_id); /// contract_abi { /// gas: 10000, /// coins: 100, From a168279abd08267779899566c40704ebef99304f Mon Sep 17 00:00:00 2001 From: Cameron Carstens Date: Thu, 20 Jun 2024 16:04:58 +0800 Subject: [PATCH 42/44] Update links to use docs hub (#106) * Update README with docs hub links * Update links in docs --- README.md | 25 +++++++++++++------------ docs/src/src-2-inline-documentation.md | 2 +- docs/src/src-5-ownership.md | 2 +- 3 files changed, 15 insertions(+), 14 deletions(-) diff --git a/README.md b/README.md index a7e0ead..e289509 100644 --- a/README.md +++ b/README.md @@ -35,29 +35,30 @@ If you don't find what you're looking for, feel free to create an issue and prop ### Native Assets -- [SRC-20; Native Asset Standard](./docs/src/src-20-native-asset.md) defines the implementation of a standard API for [Native Assets](https://docs.fuel.network/docs/sway/blockchain-development/native_assets) using the Sway Language. -- [SRC-3; Mint and Burn](./docs/src/src-3-minting-and-burning.md) is used to enable mint and burn functionality for fungible assets. -- [SRC-7; Arbitrary Asset Metadata Standard](./docs/src/src-7-asset-metadata.md) is used to store metadata for [Native Assets](https://docs.fuel.network/docs/sway/blockchain-development/native_assets). -- [SRC-9; Metadata Keys Standard](./docs/src/src-9-metadata-keys.md) 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. -- [SRC-6; Vault Standard](./docs/src/src-6-vault.md) defines the implementation of a standard API for asset vaults developed in Sway. +- [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. +- [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. +- [SRC-7; Arbitrary 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). +- [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. +- [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. +- [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. ### Access Control -- [SRC-5; Ownership Standard](./docs/src/src-5-ownership.md) is used to restrict function calls to admin users in contracts. +- [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. ### Contracts -- [SRC-12; Contract Factory](./docs/src/src-12-contract-factory.md) defines the implementation of a standard API for contract factories. -- [SRC-14; Simple Upgradable Proxies](./docs/src/src-14-simple-upgradeable-proxies.md) defines the implementation of a standard API for simple upgradable proxies. +- [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. +- [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. ### Bridge -- [SRC-8; Bridged Asset](./docs/src/src-8-bridged-asset.md) defines the metadata required for an asset bridged to the Fuel Network. -- [SRC-10; Native Bridge Standard](./docs/src/src-10-native-bridge.md) defines the standard API for the Native Bridge between the Fuel Chain and the canonical base chain. +- [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. +- [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. ### Documentation -- [SRC-2; Inline Documentation](./docs/src/src-2-inline-documentation.md) defines how to document your Sway files. +- [SRC-2; Inline Documentation](https://docs.fuel.network/docs/sway-standards/src-2-inline-documentation/) defines how to document your Sway files. ## Using a standard @@ -158,7 +159,7 @@ Example of a minimal SRC-14 implementation with no access control. ##### [Owned Proxy](./examples/src14-simple-proxy/owned/src/owned.sw) -Example of a SRC-14 implementation that also implements [SRC-5](https://github.com/FuelLabs/sway-standards/blob/master/docs/src/src-5-ownership.md). +Example of a SRC-14 implementation that also implements [SRC-5](https://docs.fuel.network/docs/sway-standards/src-5-ownership/). > **Note** > All standards currently use `forc v0.60.0`. diff --git a/docs/src/src-2-inline-documentation.md b/docs/src/src-2-inline-documentation.md index 83e7f78..247bfa3 100644 --- a/docs/src/src-2-inline-documentation.md +++ b/docs/src/src-2-inline-documentation.md @@ -8,7 +8,7 @@ The standard seeks to provide a better developer experience using Fuel's tooling ## Prior Art -A number of pre-existing functions in the [sway standard library](https://github.com/FuelLabs/sway/tree/master/sway-lib-std), [sway-applications](https://github.com/FuelLabs/sway-applications), and [sway-libs](https://github.com/FuelLabs/sway-libs) repositories have inline documentation. The inline documentation for these is already compatible with Fuel's VS Code extension. These however do not all follow the same structure and outline. +A number of pre-existing functions in the [sway standard library](https://fuellabs.github.io/sway/master/std/), [sway-applications](https://github.com/FuelLabs/sway-applications), and [sway-libs](https://docs.fuel.network/docs/sway-libs/) repositories have inline documentation. The inline documentation for these is already compatible with Fuel's VS Code extension. These however do not all follow the same structure and outline. ## Specification diff --git a/docs/src/src-5-ownership.md b/docs/src/src-5-ownership.md index 4cea7a3..3ce9c8d 100644 --- a/docs/src/src-5-ownership.md +++ b/docs/src/src-5-ownership.md @@ -8,7 +8,7 @@ The standard seeks to provide a method for restricting access to particular user ## Prior Art -The [sway-libs](https://github.com/FuelLabs/sway-libs) repository contains a pre-existing Ownership library. +The [sway-libs](https://docs.fuel.network/docs/sway-libs/ownership/) repository contains a pre-existing Ownership library. Ownership libraries exist for other ecosystems such as OpenZeppelin's [Ownership library](https://docs.openzeppelin.com/contracts/2.x/api/ownership). From 38c02ae46bde6de32df72eac20b1ab390999f766 Mon Sep 17 00:00:00 2001 From: Cameron Carstens Date: Wed, 26 Jun 2024 10:51:57 +0800 Subject: [PATCH 43/44] Prepare for release v0.5.1 (#108) * Prepare for release v0.5.1 * Fix CI issues * Add newline to changelog * CHANGELOG updates from PR review * Update changelog * Include #106 changes in CHANGELOG * Remove date from CHANGELOG * Add #112 to CHANGELOG * Remove trailing spaces --- CHANGELOG.md | 13 ++++++++----- README.md | 2 +- docs/src/index.md | 2 +- 3 files changed, 10 insertions(+), 7 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index db5ee1d..c6492fb 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,24 +5,27 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](http://keepachangelog.com/) and this project adheres to [Semantic Versioning](http://semver.org/). -## [Unreleased] - yyyy-mm-dd +## [Version 0.5.1] Description of the upcoming release here. ### Added -- [#107](https://github.com/FuelLabs/sway-standards/pull/107) Adds the `proxy_owner()` function to the SRC-14 standard. +- [#107](https://github.com/FuelLabs/sway-standards/pull/107): Adds the `proxy_owner()` function to the SRC-14 standard. +- [#104](https://github.com/FuelLabs/sway-standards/pull/104): Adds the CHANGELOG.md file to Sway-Standards. - [#110](https://github.com/FuelLabs/sway-standards/pull/110) Adds the `proxy_target()` function to the SRC-14 standard. -- Something new here 2 +- [#103](https://github.com/FuelLabs/sway-standards/pull/103): Adds Sway-Standards to the [docs hub](https://docs.fuel.network/docs/sway-standards/). ### Changed -- Something changed here 1 -- Something changed here 2 +- [#103](https://github.com/FuelLabs/sway-standards/pull/103) Removes standards in the `./SRC` folder in favor of `./docs`. +- [#106](https://github.com/FuelLabs/sway-standards/pull/106) Updates links from the Sway Book to Docs Hub. ### Fixed - [#107](https://github.com/FuelLabs/sway-standards/pull/107) resolves the conflict when SRC-5's `owner()` function is used in both the proxy and target contract in the SRC-14 standard. +- [#99](https://github.com/FuelLabs/sway-standards/pull/99) Fixes links and typos in the SRC-14 standard. +- [#112](https://github.com/FuelLabs/sway-standards/pull/112) Fixes inline documentation code in the SRC-3 standard. #### Breaking diff --git a/README.md b/README.md index e289509..ff0a73b 100644 --- a/README.md +++ b/README.md @@ -65,7 +65,7 @@ If you don't find what you're looking for, feel free to create an issue and prop To import a standard the following should be added to the project's `Forc.toml` file under `[dependencies]` with the most recent release: ```toml -standards = { git = "https://github.com/FuelLabs/sway-standards", tag = "v0.5.0" } +standards = { git = "https://github.com/FuelLabs/sway-standards", tag = "v0.5.1" } ``` > **NOTE:** diff --git a/docs/src/index.md b/docs/src/index.md index 749fd37..ca8efad 100644 --- a/docs/src/index.md +++ b/docs/src/index.md @@ -14,7 +14,7 @@ If you don't find what you're looking for, feel free to create an issue and prop To import a standard the following should be added to the project's `Forc.toml` file under `[dependencies]` with the most recent release: ```toml -standards = { git = "https://github.com/FuelLabs/sway-standards", tag = "v0.5.0" } +standards = { git = "https://github.com/FuelLabs/sway-standards", tag = "v0.5.1" } ``` > **NOTE:** From af9b3a9a2428ca863b455a1cb9ea3d68c22e1f61 Mon Sep 17 00:00:00 2001 From: bitzoic Date: Wed, 26 Jun 2024 11:03:04 +0800 Subject: [PATCH 44/44] Fix merge conflicts --- standards/src/src14.sw | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/standards/src/src14.sw b/standards/src/src14.sw index 9c46bcf..51d00e5 100644 --- a/standards/src/src14.sw +++ b/standards/src/src14.sw @@ -1,7 +1,9 @@ library; +use ::src5::State; + abi SRC14 { - /// Change the target address of a proxy contract. + /// Change the target contract of a proxy contract. /// /// # Arguments ///