From a36179a4d79d28fc4afdb22ccd573620e70f474b Mon Sep 17 00:00:00 2001 From: Marcos Henrich Date: Mon, 17 Jun 2024 16:03:51 +0100 Subject: [PATCH] Fixes docs. --- docs/book/src/forc/plugins/forc_client/index.md | 2 +- docs/reference/src/code/language/annotations/src/main.sw | 4 ++-- .../code/operations/storage/storage_in_keyword/src/main.sw | 5 ++--- .../src/documentation/operations/storage/in-keyword.md | 5 +++-- .../src/documentation/operations/storage/namespace.md | 2 ++ 5 files changed, 10 insertions(+), 8 deletions(-) diff --git a/docs/book/src/forc/plugins/forc_client/index.md b/docs/book/src/forc/plugins/forc_client/index.md index ce9ca27d64e..9c044221f47 100644 --- a/docs/book/src/forc/plugins/forc_client/index.md +++ b/docs/book/src/forc/plugins/forc_client/index.md @@ -74,7 +74,7 @@ Another alternative is the `--target` option, which provides useful aliases to a forc-deploy --target beta-3 ``` -Since deploying and running projects on the testnet cost gas, you will need coins to pay for them. You can get some using the [testnet faucet](https://faucet-beta-4.fuel.network/). +Since deploying and running projects on the testnet cost gas, you will need coins to pay for them. You can get some using the [testnet faucet](https://faucet-testnet.fuel.network/). ## Deployment Artifacts diff --git a/docs/reference/src/code/language/annotations/src/main.sw b/docs/reference/src/code/language/annotations/src/main.sw index a8423b89fdf..959c11eef41 100644 --- a/docs/reference/src/code/language/annotations/src/main.sw +++ b/docs/reference/src/code/language/annotations/src/main.sw @@ -22,7 +22,7 @@ fn read() { #[storage(write)] // ANCHOR_END: write fn write() { - storage.var.write(storage::my_storage_namespace.var.read() + 1); + storage::my_storage_namespace.var.write(storage::my_storage_namespace.var.read() + 1); } // ANCHOR: read_write @@ -30,7 +30,7 @@ fn write() { // ANCHOR_END: read_write fn read_write() { let var = storage::my_storage_namespace.var.read(); - storage.var.write(var + 1); + storage::my_storage_namespace.var.write(var + 1); } fn example() { diff --git a/docs/reference/src/code/operations/storage/storage_in_keyword/src/main.sw b/docs/reference/src/code/operations/storage/storage_in_keyword/src/main.sw index 8ec2e1d9352..069fd43de30 100644 --- a/docs/reference/src/code/operations/storage/storage_in_keyword/src/main.sw +++ b/docs/reference/src/code/operations/storage/storage_in_keyword/src/main.sw @@ -22,14 +22,13 @@ enum Role { NoAccess: (), } -// based on sha256("storage.current_owners") -const HASH_KEY: b256 = 0x84f905e3f560d70fbfab9ffcd92198998ce6f936e3d45f8fcb16b00f6a6a8d7e; +const HASH_KEY: b256 = 0x7616e5793ef977b22465f0c843bcad56155c4369245f347bcc8a61edb08b7645; // ANCHOR_END: data_structures // ANCHOR: initialization storage { // ANCHOR: in_keyword - new_current_owners in HASH_KEY: u64 = 0, + current_owners in HASH_KEY: u64 = 0, // ANCHOR_END: in_keyword explicit_declaration: Owner = Owner { maximum_owners: 10, diff --git a/docs/reference/src/documentation/operations/storage/in-keyword.md b/docs/reference/src/documentation/operations/storage/in-keyword.md index a105b042019..4713d231fd8 100644 --- a/docs/reference/src/documentation/operations/storage/in-keyword.md +++ b/docs/reference/src/documentation/operations/storage/in-keyword.md @@ -5,9 +5,10 @@ The `in` keyword can be used within a storage variable to override the position ## Example -The `in` keword and position value are used as follows: +The `in` keyword and position value are used as follows: + ```sway {{#include ../../../../code/operations/storage/storage_in_keyword/src/main.sw:in_keyword}} ``` -The code above will force the storage of the variable into the position `HASH_KEY` which is set to `0x84f905e3f560d70fbfab9ffcd92198998ce6f936e3d45f8fcb16b00f6a6a8d7e` calculated from `sha256("storage.current_owners")` instead of the position that would be calculated from the variable name `sha256("storage.new_current_owners")` which would be `0x7616e5793ef977b22465f0c843bcad56155c4369245f347bcc8a61edb08b7645` +The code above will force the storage of the variable into the position `HASH_KEY` which is set to `0x7616e5793ef977b22465f0c843bcad56155c4369245f347bcc8a61edb08b7645` instead of the position that would be calculated from the variable name `sha256("storage.current_owners")` which would be `0x84f905e3f560d70fbfab9ffcd92198998ce6f936e3d45f8fcb16b00f6a6a8d7e` diff --git a/docs/reference/src/documentation/operations/storage/namespace.md b/docs/reference/src/documentation/operations/storage/namespace.md index 0046c04d214..03ce10866bc 100644 --- a/docs/reference/src/documentation/operations/storage/namespace.md +++ b/docs/reference/src/documentation/operations/storage/namespace.md @@ -8,11 +8,13 @@ The hash calculations determining the position of variables in a block with name ## Example A namespace can be declared as follows: + ```sway {{#include ../../../../code/language/annotations/src/main.sw:storage_namespace}} ``` A variable inside a namespace can be accessed as follows: + ```sway {{#include ../../../../code/language/annotations/src/main.sw:storage_namespace_access}} ```