From c508b0d9ada02d01a6f15d9b238a6d9d97d50790 Mon Sep 17 00:00:00 2001 From: K1-R1 Date: Wed, 21 Aug 2024 18:26:39 +0100 Subject: [PATCH 1/7] chore: update to forc 0.63.1 --- .github/workflows/ci.yaml | 6 +++--- README.md | 8 +++---- docs/src/index.md | 2 +- .../src14-simple-proxy/minimal/src/minimal.sw | 16 +++++++++----- .../src14-simple-proxy/owned/src/owned.sw | 21 ++++++++++++------- 5 files changed, 32 insertions(+), 21 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index a133f9e..3d8b529 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -15,9 +15,9 @@ concurrency: env: CARGO_TERM_COLOR: always REGISTRY: ghcr.io - RUST_VERSION: 1.77.0 - FORC_VERSION: 0.61.0 - CORE_VERSION: 0.26.0 + RUST_VERSION: 1.80.1 + FORC_VERSION: 0.63.1 + CORE_VERSION: 0.34.0 PATH_TO_SCRIPTS: .github/scripts jobs: diff --git a/README.md b/README.md index ae45a84..bab1808 100644 --- a/README.md +++ b/README.md @@ -9,8 +9,8 @@ - - + + @@ -162,12 +162,12 @@ Example of a minimal SRC-14 implementation with no access control. 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.61.0`. +> All standards currently use `forc v0.63.1`. > **Note** diff --git a/docs/src/index.md b/docs/src/index.md index 3935ca0..f826ea6 100644 --- a/docs/src/index.md +++ b/docs/src/index.md @@ -7,7 +7,7 @@ Standards in this repository may be in various stages of development. Use of dra If you don't find what you're looking for, feel free to create an issue and propose a new standard! > **Note** -> All standards currently use `forc v0.61.0`. +> All standards currently use `forc v0.63.1`. ## Using a standard diff --git a/examples/src14-simple-proxy/minimal/src/minimal.sw b/examples/src14-simple-proxy/minimal/src/minimal.sw index 721dcac..b23600f 100644 --- a/examples/src14-simple-proxy/minimal/src/minimal.sw +++ b/examples/src14-simple-proxy/minimal/src/minimal.sw @@ -4,19 +4,25 @@ use std::execution::run_external; use standards::src14::{SRC14, SRC14_TARGET_STORAGE}; storage { - // target is at sha256("storage_SRC14_0") - target: ContractId = ContractId::zero(), + SRC14 { + /// The [ContractId] of the target contract. + /// + /// # Additional Information + /// + /// `target` is stored at sha256("storage_SRC14_0") + target in 0x7bb458adc1d118713319a5baa00a2d049dd64d2916477d2688d76970c898cd55: ContractId = ContractId::zero(), + }, } impl SRC14 for Contract { #[storage(read, write)] fn set_proxy_target(new_target: ContractId) { - storage.target.write(new_target); + storage::SRC14.target.write(new_target); } #[storage(read)] fn proxy_target() -> Option { - storage.target.try_read() + storage::SRC14.target.try_read() } } @@ -24,5 +30,5 @@ impl SRC14 for Contract { #[storage(read)] fn fallback() { // pass through any other method call to the target - run_external(storage.target.read()) + run_external(storage::SRC14.target.read()) } diff --git a/examples/src14-simple-proxy/owned/src/owned.sw b/examples/src14-simple-proxy/owned/src/owned.sw index 5e5ba6d..2d0f66c 100644 --- a/examples/src14-simple-proxy/owned/src/owned.sw +++ b/examples/src14-simple-proxy/owned/src/owned.sw @@ -8,30 +8,35 @@ use standards::src14::{SRC14, SRC14_TARGET_STORAGE, SRC14Extension}; const INITIAL_OWNER: Identity = Identity::Address(Address::zero()); storage { - proxy { - // target is at sha256("storage_SRC14_0") + SRC14 { + /// The [ContractId] of the target contract. + /// + /// # Additional Information + /// + /// `target` is stored at sha256("storage_SRC14_0") + target in 0x7bb458adc1d118713319a5baa00a2d049dd64d2916477d2688d76970c898cd55: ContractId = ContractId::zero(), + /// The [State] of the proxy owner. owner: State = State::Initialized(INITIAL_OWNER), }, - target: ContractId = ContractId::zero(), } impl SRC14 for Contract { #[storage(read, write)] fn set_proxy_target(new_target: ContractId) { only_owner(); - storage.target.write(new_target); + storage::SRC14.target.write(new_target); } #[storage(read)] fn proxy_target() -> Option { - storage.target.try_read() + storage::SRC14.target.try_read() } } impl SRC14Extension for Contract { #[storage(read)] fn proxy_owner() -> State { - storage::proxy.owner.read() + storage::SRC14.owner.read() } } @@ -39,13 +44,13 @@ impl SRC14Extension for Contract { #[storage(read)] fn fallback() { // pass through any other method call to the target - run_external(storage.target.read()) + run_external(storage::SRC14.target.read()) } #[storage(read)] fn only_owner() { require( - storage::proxy + storage::SRC14 .owner .read() == State::Initialized(msg_sender().unwrap()), AccessError::NotOwner, From e0a596a63f10a3736c2eec597a8cada94ecde067 Mon Sep 17 00:00:00 2001 From: K1-R1 Date: Wed, 21 Aug 2024 18:33:37 +0100 Subject: [PATCH 2/7] chore: updated changelog --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index a248bf6..a4e8ec4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -14,7 +14,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/). ### Changed Unreleased -- Something changed here 1 +- [#135](https://github.com/FuelLabs/sway-standards/pull/135) Updates standards, examples and CI to latest forc 0.63.1. - Something changed here 2 ### Fixed Unreleased From f32eaf979ff1022f08a7a06e047640e8d1dbf9bf Mon Sep 17 00:00:00 2001 From: K1-R1 Date: Wed, 21 Aug 2024 19:03:41 +0100 Subject: [PATCH 3/7] docs: update src14 and general typos --- README.md | 2 +- docs/src/src-10-native-bridge.md | 2 +- docs/src/src-13-soulbound-address.md | 20 +++++++++---------- docs/src/src-14-simple-upgradeable-proxies.md | 6 +++--- docs/src/src-2-inline-documentation.md | 10 +++++----- docs/src/src-3-minting-and-burning.md | 10 +++++----- docs/src/src-5-ownership.md | 2 +- docs/src/src-6-vault.md | 2 +- docs/src/src-8-bridged-asset.md | 10 +++++----- docs/src/src-9-metadata-keys.md | 2 +- 10 files changed, 33 insertions(+), 33 deletions(-) diff --git a/README.md b/README.md index bab1808..7b1bc6c 100644 --- a/README.md +++ b/README.md @@ -109,7 +109,7 @@ Example of the SRC-3 implementation where a contract mints multiple assets with #### SRC-5; Ownership Examples -##### - [Uninitalized](./examples/src5-ownership/uninitialized_example/src/uninitialized_example.sw) +##### - [Uninitialized](./examples/src5-ownership/uninitialized_example/src/uninitialized_example.sw) Example of the SRC-5 implementation where a contract does not have an owner set at compile time with the intent to set it during runtime. diff --git a/docs/src/src-10-native-bridge.md b/docs/src/src-10-native-bridge.md index 2348b20..dbc1b92 100644 --- a/docs/src/src-10-native-bridge.md +++ b/docs/src/src-10-native-bridge.md @@ -8,7 +8,7 @@ A standard interface for bridges intends to provide a safe and efficient bridge ## Prior Art -The standard is centered on Fuel’s [Bridge Architecture](https://github.com/FuelLabs/fuel-bridge/blob/main/docs/ARCHITECTURE.md). Fuel's bridge system is built on a message protocol that allows to send (and receive) messages between entities located in two different blockchains. +The standard is centred on Fuel’s [Bridge Architecture](https://github.com/FuelLabs/fuel-bridge/blob/main/docs/ARCHITECTURE.md). Fuel's bridge system is built on a message protocol that allows to send (and receive) messages between entities located in two different blockchains. The following standard takes reference from the [`FungibleBridge`](https://github.com/FuelLabs/fuel-bridge/blob/3971081850e7961d9b649edda4cad8a848ee248e/packages/fungible-token/bridge-fungible-token/src/interface.sw#L22) ABI defined in the fuel-bridge repository. diff --git a/docs/src/src-13-soulbound-address.md b/docs/src/src-13-soulbound-address.md index 5a7b89c..20a2c31 100644 --- a/docs/src/src-13-soulbound-address.md +++ b/docs/src/src-13-soulbound-address.md @@ -25,15 +25,15 @@ We must also ensure every `Address` on Fuel has its own Predicate. This can be g ### Definitions - **Soulbound Address Predicate** - The resulting predicate which owns assets on behalf of an `Address`. -- **Soulbound Address** - The computed `Address` of the *Soulbound Asset Predicate*. -- **Soulbound Asset** - Any [Native Asset](https://docs.fuel.network/docs/sway/blockchain-development/native_assets) sent to the *Soulbound Address*. +- **Soulbound Address** - The computed `Address` of the _Soulbound Asset Predicate_. +- **Soulbound Asset** - Any [Native Asset](https://docs.fuel.network/docs/sway/blockchain-development/native_assets) sent to the _Soulbound Address_. ### Soulbound Address Predicate Specification -- The *Soulbound Address Predicate* SHALL never spend the assets sent to its computed predicate `Address` or *Soulbound Address*. -- The *Soulbound Address Predicate* SHALL encode an `Address` of which it represents the soulbound address. +- The _Soulbound Address Predicate_ SHALL never spend the assets sent to its computed predicate `Address` or _Soulbound Address_. +- The _Soulbound Address Predicate_ SHALL encode an `Address` of which it represents the soulbound address. -Below we define the *Soulbound Address Predicate* where `ADDRESS` MUST be replaced with the `Address` of which the *Soulbound Address Predicate* represents. +Below we define the _Soulbound Address Predicate_ where `ADDRESS` MUST be replaced with the `Address` of which the _Soulbound Address Predicate_ represents. ```sway predicate; @@ -50,9 +50,9 @@ fn main() -> bool { ### Soulbound Address -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_ 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://docs.fuel.network/docs/sway-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 @@ -66,13 +66,13 @@ This standard is compatible with Fuel's [Native Assets](https://docs.fuel.networ This standard does not introduce any security concerns, as it does not call external contracts, nor does it define any mutations of the contract state. -It should however be noted that any Native Asset on the Fuel Network is not a Soulbound Asset until it is sent to a *Soulbound Address*. +It should however be noted that any Native Asset on the Fuel Network is not a Soulbound Asset until it is sent to a _Soulbound Address_. ## Example -The following example shows the *Soulbound Address Predicate* for the `0xe033369a522e3cd2fc19a5a705a7f119938027e8e287c0ec35b784e68dab2be6` `Address`. +The following example shows the _Soulbound Address Predicate_ for the `0xe033369a522e3cd2fc19a5a705a7f119938027e8e287c0ec35b784e68dab2be6` `Address`. -The resulting *Soulbound Address* is `0x7f28a538d06788a3d98bb72f4b41012d86abc4b0369ee5dedf56cfbaf245d609`. Any Native Assets sent to this address will become Soulbound Assets. +The resulting _Soulbound Address_ is `0x7f28a538d06788a3d98bb72f4b41012d86abc4b0369ee5dedf56cfbaf245d609`. Any Native Assets sent to this address will become Soulbound Assets. ```sway predicate; diff --git a/docs/src/src-14-simple-upgradeable-proxies.md b/docs/src/src-14-simple-upgradeable-proxies.md index a15e504..630d3f2 100644 --- a/docs/src/src-14-simple-upgradeable-proxies.md +++ b/docs/src/src-14-simple-upgradeable-proxies.md @@ -18,14 +18,14 @@ Proxy designs fall into three essential categories: This document falls in the second category. We want to standardize the implementation of simple upgradeable pass-through contracts. -The FuelVM provides an `LDC` instruction that is used by Sway's `std::execution::run_external` to provide a similar behavior to EVM's `delegatecall` and execute instructions from another contract while retaining one's own storage context. This is the intended means of implementation of this standard. +The FuelVM provides an `LDC` instruction that is used by Sway's `std::execution::run_external` to provide a similar behaviour to EVM's `delegatecall` and execute instructions from another contract while retaining one's own storage context. This is the intended means of implementation of this standard. ## Specification -### Required Behavior +### Required Behaviour The proxy contract MUST maintain the address of its target in its storage at slot `0x7bb458adc1d118713319a5baa00a2d049dd64d2916477d2688d76970c898cd55` (equivalent to `sha256("storage_SRC14_0")`). -It SHOULD base other proxy specific storage fields at `sha256("storage_SRC14")` to avoid collisions with target storage. +It SHOULD base other proxy specific storage fields in the `SRC14` namespace to avoid collisions with target storage. It MAY have its storage definition overlap with that of its target if necessary. The proxy contract MUST delegate any method call not part of its interface to the target contract. diff --git a/docs/src/src-2-inline-documentation.md b/docs/src/src-2-inline-documentation.md index 247bfa3..6a0355c 100644 --- a/docs/src/src-2-inline-documentation.md +++ b/docs/src/src-2-inline-documentation.md @@ -93,14 +93,14 @@ This section has a `h1` header. This section provides an example of the use of the function. This section is not required to follow the SRC-2 standard however encouraged for auxiliary and library functions. Example: -```sway +````sway /// # Examples /// /// ```sway /// fn foo(argument_1: b256, argument_2: b256) { /// let result = my_function(argument_1, argument_2); /// } -``` +```` ### Structs @@ -300,7 +300,7 @@ This standard will improve security by providing developers with relevant inform ### Function Example -```sway +````sway /// Ensures that the sender is the owner. /// /// # Arguments @@ -325,7 +325,7 @@ This standard will improve security by providing developers with relevant inform /// use ownable::Ownership; /// /// storage { -/// owner: Ownership = Ownership::initalized(Identity::Address(Address::zero())), +/// owner: Ownership = Ownership::initialized(Identity::Address(Address::zero())), /// } /// /// fn foo() { @@ -337,7 +337,7 @@ pub fn only_owner(self, number: u64) -> bool { require(self.owner() == State::Initialized(msg_sender().unwrap()), AccessError::NotOwner); number == 5 } -``` +```` ### Struct Examples diff --git a/docs/src/src-3-minting-and-burning.md b/docs/src/src-3-minting-and-burning.md index 53fd352..8facccd 100644 --- a/docs/src/src-3-minting-and-burning.md +++ b/docs/src/src-3-minting-and-burning.md @@ -23,9 +23,9 @@ This function MAY contain arbitrary conditions for minting, and revert if those ##### Mint Arguments -* `recipient` - The `Identity` to which the newly minted asset is transferred to. -* `sub_id` - The sub-identifier of the asset to mint. -* `amount` - The quantity of coins to mint. +- `recipient` - The `Identity` to which the newly minted asset is transferred to. +- `sub_id` - The sub-identifier of the asset to mint. +- `amount` - The quantity of coins to mint. #### `fn burn(sub_id: SubId, amount: u64)` @@ -36,8 +36,8 @@ This function MAY contain arbitrary conditions for burning, and revert if those ##### Burn Arguments -* `sub_id` - The sub-identifier of the asset to burn. -* `amount` - The quantity of coins to burn. +- `sub_id` - The sub-identifier of the asset to burn. +- `amount` - The quantity of coins to burn. ## Rationale diff --git a/docs/src/src-5-ownership.md b/docs/src/src-5-ownership.md index 3ce9c8d..2884f65 100644 --- a/docs/src/src-5-ownership.md +++ b/docs/src/src-5-ownership.md @@ -81,7 +81,7 @@ abi SRC5 { ## Example Implementation -### Uninitalized +### Uninitialized Example of the SRC-5 implementation where a contract does not have an owner set at compile time with the intent to set it during runtime. diff --git a/docs/src/src-6-vault.md b/docs/src/src-6-vault.md index 04ac75f..cd84b7f 100644 --- a/docs/src/src-6-vault.md +++ b/docs/src/src-6-vault.md @@ -157,7 +157,7 @@ abi SRC6 { #[storage(read)] fn managed_assets(underlying_asset: AssetId, vault_sub_id: SubId) -> u64; - + #[storage(read)] fn max_depositable(receiver: Identity, underlying_asset: AssetId, vault_sub_id: SubId) -> Option; diff --git a/docs/src/src-8-bridged-asset.md b/docs/src/src-8-bridged-asset.md index 5409998..dab11cc 100644 --- a/docs/src/src-8-bridged-asset.md +++ b/docs/src/src-8-bridged-asset.md @@ -88,31 +88,31 @@ impl SRC7 for Contract { impl SRC20 for Contract { fn total_assets() -> u64 { 1 - } + } fn total_supply(asset: AssetId) -> Option { - match asset { + match asset { AssetId::default() => Option::Some(1), _ => Option::None, } } fn name(asset: AssetId) -> Option { - match asset { + match asset { AssetId::default() => Option::Some(String::from_ascii_str("Name")), _ => Option::None, } } fn symbol(asset: AssetId) -> Option { - match asset { + match asset { AssetId::default() => Option::Some(String::from_ascii_str("Symbol")), _ => Option::None, } } fn decimals(asset: AssetId) -> Option { - match asset { + match asset { AssetId::default() => Option::Some(0u8), _ => Option::None, } diff --git a/docs/src/src-9-metadata-keys.md b/docs/src/src-9-metadata-keys.md index 9558b3c..cc220ca 100644 --- a/docs/src/src-9-metadata-keys.md +++ b/docs/src/src-9-metadata-keys.md @@ -135,7 +135,7 @@ The key `link:contact` SHALL return a `String` variant of the asset's project co #### `link:docs` - The key `link:docs` SHALL return a `String` variant of the asset's project documentation webpage. +The key `link:docs` SHALL return a `String` variant of the asset's project documentation webpage. #### `link:forum` From 05beae0a11b10db094ea6c45b239164f75d0d2ae Mon Sep 17 00:00:00 2001 From: bitzoic Date: Fri, 30 Aug 2024 13:41:11 +0800 Subject: [PATCH 4/7] Apply PR review comments --- docs/spell-check-custom-words.txt | 2 +- docs/src/src-10-native-bridge.md | 2 +- docs/src/src-12-contract-factory.md | 2 +- docs/src/src-14-simple-upgradeable-proxies.md | 4 ++-- docs/src/src-2-inline-documentation.md | 8 ++++---- .../uninitialized_example/src/uninitialized_example.sw | 2 +- standards/src/src14.sw | 2 +- standards/src/src5.sw | 2 +- 8 files changed, 12 insertions(+), 12 deletions(-) diff --git a/docs/spell-check-custom-words.txt b/docs/spell-check-custom-words.txt index e85a196..e4fe9c7 100644 --- a/docs/spell-check-custom-words.txt +++ b/docs/spell-check-custom-words.txt @@ -259,5 +259,5 @@ WAV OGA glTF GLB -Uninitalized +Uninitialized upgradeability \ No newline at end of file diff --git a/docs/src/src-10-native-bridge.md b/docs/src/src-10-native-bridge.md index dbc1b92..2348b20 100644 --- a/docs/src/src-10-native-bridge.md +++ b/docs/src/src-10-native-bridge.md @@ -8,7 +8,7 @@ A standard interface for bridges intends to provide a safe and efficient bridge ## Prior Art -The standard is centred on Fuel’s [Bridge Architecture](https://github.com/FuelLabs/fuel-bridge/blob/main/docs/ARCHITECTURE.md). Fuel's bridge system is built on a message protocol that allows to send (and receive) messages between entities located in two different blockchains. +The standard is centered on Fuel’s [Bridge Architecture](https://github.com/FuelLabs/fuel-bridge/blob/main/docs/ARCHITECTURE.md). Fuel's bridge system is built on a message protocol that allows to send (and receive) messages between entities located in two different blockchains. The following standard takes reference from the [`FungibleBridge`](https://github.com/FuelLabs/fuel-bridge/blob/3971081850e7961d9b649edda4cad8a848ee248e/packages/fungible-token/bridge-fungible-token/src/interface.sw#L22) ABI defined in the fuel-bridge repository. diff --git a/docs/src/src-12-contract-factory.md b/docs/src/src-12-contract-factory.md index aca899c..52c062f 100644 --- a/docs/src/src-12-contract-factory.md +++ b/docs/src/src-12-contract-factory.md @@ -62,7 +62,7 @@ There are no other standards that the SRC-12 requires compatibility. ## Security Considerations -This standard takes into consideration child contracts that are deployed with differentiating configurable values, however individual contract behaviors may be dependent on storage variables. As storage variables may change after the contract has been registered with the SRC-12 compliant contract, the standard suggests to check these values upon registration however it is not enforced. +This standard takes into consideration child contracts that are deployed with differentiating configurable values, however individual contract behaviours may be dependent on storage variables. As storage variables may change after the contract has been registered with the SRC-12 compliant contract, the standard suggests to check these values upon registration however it is not enforced. ## Example ABI diff --git a/docs/src/src-14-simple-upgradeable-proxies.md b/docs/src/src-14-simple-upgradeable-proxies.md index 630d3f2..21ee8e6 100644 --- a/docs/src/src-14-simple-upgradeable-proxies.md +++ b/docs/src/src-14-simple-upgradeable-proxies.md @@ -18,11 +18,11 @@ Proxy designs fall into three essential categories: This document falls in the second category. We want to standardize the implementation of simple upgradeable pass-through contracts. -The FuelVM provides an `LDC` instruction that is used by Sway's `std::execution::run_external` to provide a similar behaviour to EVM's `delegatecall` and execute instructions from another contract while retaining one's own storage context. This is the intended means of implementation of this standard. +The FuelVM provides an `LDC` instruction that is used by Sway's `std::execution::run_external` to provide a similar behavior to EVM's `delegatecall` and execute instructions from another contract while retaining one's own storage context. This is the intended means of implementation of this standard. ## Specification -### Required Behaviour +### Required Behavior The proxy contract MUST maintain the address of its target in its storage at slot `0x7bb458adc1d118713319a5baa00a2d049dd64d2916477d2688d76970c898cd55` (equivalent to `sha256("storage_SRC14_0")`). It SHOULD base other proxy specific storage fields in the `SRC14` namespace to avoid collisions with target storage. diff --git a/docs/src/src-2-inline-documentation.md b/docs/src/src-2-inline-documentation.md index 6a0355c..80045f3 100644 --- a/docs/src/src-2-inline-documentation.md +++ b/docs/src/src-2-inline-documentation.md @@ -93,14 +93,14 @@ This section has a `h1` header. This section provides an example of the use of the function. This section is not required to follow the SRC-2 standard however encouraged for auxiliary and library functions. Example: -````sway +```sway /// # Examples /// /// ```sway /// fn foo(argument_1: b256, argument_2: b256) { /// let result = my_function(argument_1, argument_2); /// } -```` +``` ### Structs @@ -300,7 +300,7 @@ This standard will improve security by providing developers with relevant inform ### Function Example -````sway +```sway /// Ensures that the sender is the owner. /// /// # Arguments @@ -337,7 +337,7 @@ pub fn only_owner(self, number: u64) -> bool { require(self.owner() == State::Initialized(msg_sender().unwrap()), AccessError::NotOwner); number == 5 } -```` +``` ### Struct Examples diff --git a/examples/src5-ownership/uninitialized_example/src/uninitialized_example.sw b/examples/src5-ownership/uninitialized_example/src/uninitialized_example.sw index 454f975..6811305 100644 --- a/examples/src5-ownership/uninitialized_example/src/uninitialized_example.sw +++ b/examples/src5-ownership/uninitialized_example/src/uninitialized_example.sw @@ -27,7 +27,7 @@ impl SRC5 for Contract { /// let ownership_abi = abi(contract_id, SRC_5); /// /// match ownership_abi.owner() { - /// State::Uninitalized => log("The ownership is uninitalized"), + /// State::Uninitialized => log("The ownership is uninitialized"), /// _ => log("This example will never reach this statement"), /// } /// } diff --git a/standards/src/src14.sw b/standards/src/src14.sw index 51d00e5..ec62a3c 100644 --- a/standards/src/src14.sw +++ b/standards/src/src14.sw @@ -55,7 +55,7 @@ abi SRC14Extension { /// ```sway /// fn foo() { /// match owner() { - /// State::Uninitalized => log("The ownership is uninitalized"), + /// State::Uninitialized => log("The ownership is uninitialized"), /// State::Initialized(owner) => log("The ownership is initalized"), /// State::Revoked => log("The ownership is revoked"), /// } diff --git a/standards/src/src5.sw b/standards/src/src5.sw index 5e8ce62..0cedac0 100644 --- a/standards/src/src5.sw +++ b/standards/src/src5.sw @@ -41,7 +41,7 @@ abi SRC5 { /// ```sway /// fn foo() { /// match owner() { - /// State::Uninitalized => log("The ownership is uninitalized"), + /// State::Uninitialized => log("The ownership is uninitialized"), /// State::Initialized(owner) => log("The ownership is initalized"), /// State::Revoked => log("The ownership is revoked"), /// } From 51786ede76b53b2c85423be7be72a90d53d016bc Mon Sep 17 00:00:00 2001 From: bitzoic Date: Fri, 30 Aug 2024 13:46:39 +0800 Subject: [PATCH 5/7] Fix markdown --- docs/src/src-3-minting-and-burning.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/src/src-3-minting-and-burning.md b/docs/src/src-3-minting-and-burning.md index 62a64eb..c36b177 100644 --- a/docs/src/src-3-minting-and-burning.md +++ b/docs/src/src-3-minting-and-burning.md @@ -37,8 +37,8 @@ This function MAY contain arbitrary conditions for burning, and revert if those ##### Burn Arguments -- `sub_id` - The sub-identifier of the asset to burn. -- `amount` - The quantity of coins to burn. +* `sub_id` - The sub-identifier of the asset to burn. +* `amount` - The quantity of coins to burn. ## Rationale From 9957abef688a61f40bdf52f1b35cf575464f1f1a Mon Sep 17 00:00:00 2001 From: bitzoic Date: Fri, 30 Aug 2024 13:50:29 +0800 Subject: [PATCH 6/7] Update CHANGELOG --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 2e8c499..ffac307 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -21,6 +21,7 @@ Description of the upcoming release here. ### Fixed Unreleased - [#137](https://github.com/FuelLabs/sway-standards/pull/137) Resolves warnings for SRC-6, SRC-14, and SRC-5 standard examples. +- [#136](https://github.com/FuelLabs/sway-standards/pull/136) Fixes SRC14 to recommend namespacing all non-standardized storage variables under the SRC14 namespace and general typos and markdown in docs and inline documentation. #### Breaking Unreleased From 414e305c52bab7d54c5febc557b29646abcf2533 Mon Sep 17 00:00:00 2001 From: bitzoic Date: Fri, 30 Aug 2024 13:52:04 +0800 Subject: [PATCH 7/7] Improve CHANGELOG comment --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index ffac307..49b5fbb 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -21,7 +21,7 @@ Description of the upcoming release here. ### Fixed Unreleased - [#137](https://github.com/FuelLabs/sway-standards/pull/137) Resolves warnings for SRC-6, SRC-14, and SRC-5 standard examples. -- [#136](https://github.com/FuelLabs/sway-standards/pull/136) Fixes SRC14 to recommend namespacing all non-standardized storage variables under the SRC14 namespace and general typos and markdown in docs and inline documentation. +- [#136](https://github.com/FuelLabs/sway-standards/pull/136) Fixes SRC14 to recommend namespacing all non-standardized storage variables under the SRC14 namespace, fixes typos, and improves markdown in docs and inline documentation. #### Breaking Unreleased