diff --git a/docs/02-basic/01-introduction/message-queue.md b/docs/02-basic/01-introduction/message-queue.md index 27123b7..28382e7 100644 --- a/docs/02-basic/01-introduction/message-queue.md +++ b/docs/02-basic/01-introduction/message-queue.md @@ -7,7 +7,7 @@ hide_table_of_contents: true The message queue is a core component of the Vara network. It is a data structure that stores messages sent between actors. Messages are stored in the queue until their criteria have been met, at which point they are dequeued and processed by dedicated smart contracts. -Actually, the message queue is a first-in, first-out (FIFO) data structure implemented on top of the blockchain database. In addition to payload each message entry stores additional information such as target program address, gas limit (if provided), processing entry point (we will learn about entry points [later](../02-program-basics/program-structure.md)), token amount to be transferred, and so on. +Actually, the message queue is a first-in, first-out (FIFO) data structure implemented on top of the blockchain database. In addition to payload each message entry stores additional information such as target program address, gas limit (if provided), processing entry point (entry points will be discussed [later](../02-program-basics/program-structure.md)), token amount to be transferred, and so on. ## How does the message queue work? diff --git a/docs/02-basic/02-program-basics/building.md b/docs/02-basic/02-program-basics/building.md index cf4580a..92bb74e 100644 --- a/docs/02-basic/02-program-basics/building.md +++ b/docs/02-basic/02-program-basics/building.md @@ -5,7 +5,7 @@ hide_table_of_contents: true # Building -We recommend using the [`gear-wasm-builder`](https://docs.gear.rs/gear_wasm_builder/) crate in a custom build script `build.rs`. +It is recommended to use the [`gear-wasm-builder`](https://docs.gear.rs/gear_wasm_builder/) crate in a custom build script `build.rs`. Add it to the `[build-dependencies]` section in the `Cargo.toml` file: @@ -22,4 +22,4 @@ fn main() { } ``` -You can find built Wasm files in the `target/wasm32-unknown-unknown/release` directory. +The build Wasm files can be found in the `target/wasm32-unknown-unknown/release` directory. diff --git a/docs/02-basic/02-program-basics/program-structure.md b/docs/02-basic/02-program-basics/program-structure.md index fcb89df..343eed5 100644 --- a/docs/02-basic/02-program-basics/program-structure.md +++ b/docs/02-basic/02-program-basics/program-structure.md @@ -39,9 +39,9 @@ extern "C" fn handle() { } ``` -In this function, we are to define the main business logic of our program. For example, we can check the incoming message and perform some actions depending on the message type. Also, we can send a message to another program. Finally, we can send a reply to the message that was received by the program. +In this function, the main business logic of the program is defined. For example, the incoming message is checked, and actions are performed depending on the message type. Additionally, a message can be sent to another program, and a reply can be sent to the message received by the program. -And the third most important function is `handle_reply()`. It is called when the program receives a reply to the message that was sent by the program. For example, we can check the reply and perform some actions depending on the reply type. +And the third most important function is `handle_reply()`. It is called when the program receives a reply to the message that was sent by the program. For example, the reply can be checked, and actions can be performed depending on the reply type. ```rust #[no_mangle] @@ -69,7 +69,7 @@ Also, there is no need to define the `handle_signal()` function if the program d There are a lot of imported functions that can be used by the Gear smart contract. They are called API functions. These functions are provided by the runtime that executes the Gear smart contract. The most convenient way to use these functions is to use the Gear standard library called [`gstd`](https://docs.gear.rs/gstd/). It is a set of high-level functions that are implemented on top of the low-level API functions. -We will explore part of these functions in the next chapters. For now, let's look at the most important API functions. +Some of these functions will be discussed in the following chapters. For now, let's look at the most important API functions. - `msg::load_bytes()` — loads the payload of the message as a byte vector; - `msg::send_bytes()` — sends a message to a program or user; diff --git a/docs/02-basic/03-additional-features/access-state.md b/docs/02-basic/03-additional-features/access-state.md index 8227ecf..cc50844 100644 --- a/docs/02-basic/03-additional-features/access-state.md +++ b/docs/02-basic/03-additional-features/access-state.md @@ -32,7 +32,7 @@ extern "C" fn state() { } ``` -Additionally, you can handle incoming payload and return only the necessary part of the state. For example, you can return only the selected wallet: +Additionally, incoming payloads can be handled, returning only the necessary part of the state. For example, only the selected wallet can be returned: ```rust #[no_mangle] @@ -53,11 +53,13 @@ The data returned by the `state()` function can be converted to any convenient r ## Custom program to read the state -Additionally, you can create your own program to read the state. This wrapper will allow you to implement custom functions for the client side, not depending on the main program. +Additionally, a custom program can be created to read the state. This wrapper allows for the implementation of custom functions on the client side, independent of the main program. -This has a number of advantages, for example, you will always be able to read the state even if the program changes (as long as the incoming or outgoing types have not changed). Or you are creating a service based on an already existing program and you need some of your own functions to get your own chanks of data from the state. +This has a number of advantages, for example, the state can always be read even if the program changes (as long as the incoming or outgoing types have not changed). Alternatively, when building a service based on an existing program, the need for custom functions arises to retrieve specific data chunks from the state. -To do this, we need to create an independent program and describe the necessary functions inside the `metawasm` trait. For example: +This approach offers several advantages. For example, the state can always be read, even if the program undergoes changes (provided that the incoming or outgoing types remain unchanged). Alternatively, when building a service based on an existing program, the need for custom functions arises to retrieve specific data chunks from the state. + +To do this, it is necessary to create an independent program and describe the necessary functions inside the `metawasm` trait. For example: ```rust // ... @@ -101,7 +103,7 @@ pub mod metafns { } ``` -To build `*.meta.wasm`, the following `build.rs` file in the root of your project is required: +To build `*.meta.wasm`, the following `build.rs` file in the project root is required: ```rust fn main() { diff --git a/docs/02-basic/03-additional-features/metadata.md b/docs/02-basic/03-additional-features/metadata.md index f80b8ae..b37027a 100644 --- a/docs/02-basic/03-additional-features/metadata.md +++ b/docs/02-basic/03-additional-features/metadata.md @@ -30,7 +30,7 @@ impl Metadata for ProgramMetadata { } ``` -As we can see, metadata enables you to determine the expected data at the input/output for the contract at each endpoint. Where: +As can be seen, metadata enables the determination of the expected data at the input/output for the contract at each endpoint. Where: - [`Init`](https://docs.gear.rs/gmeta/trait.Metadata.html#associatedtype.Init) — describes incoming/outgoing types for `init()` function. - [`Handle`](https://docs.gear.rs/gmeta/trait.Metadata.html#associatedtype.Handle) — describes incoming/outgoing types for `handle()` function. @@ -41,7 +41,7 @@ As we can see, metadata enables you to determine the expected data at the input/ ## Generate metadata -To generate metadata, the following `build.rs` file in the root of your project folder is required: +To generate metadata, the following `build.rs` file in the root of the project folder is required: ```rust // build.rs diff --git a/docs/02-basic/04-usage/upload-program.md b/docs/02-basic/04-usage/upload-program.md index 8744dc3..596e269 100644 --- a/docs/02-basic/04-usage/upload-program.md +++ b/docs/02-basic/04-usage/upload-program.md @@ -5,7 +5,7 @@ hide_table_of_contents: true # Upload Program -1. When your account balance is sufficient, click the Upload program and navigate to the `.opt.wasm` file we have pointed to above. +1. When your account balance is sufficient, click the Upload program and navigate to the `.opt.wasm` that was specified above. ![Upload program button](../img/04/upload.png) diff --git a/docs/02-basic/05-testing/using-gtest.md b/docs/02-basic/05-testing/using-gtest.md index df188be..8ac4e08 100644 --- a/docs/02-basic/05-testing/using-gtest.md +++ b/docs/02-basic/05-testing/using-gtest.md @@ -7,7 +7,7 @@ hide_table_of_contents: true `gtest` simulates a real network by providing mockups of the user, program, balances, mailbox, etc. Since it does not include parts of the actual blockchain, it is fast and lightweight. But being a model of the blockchain network, `gtest` cannot be a complete reflection of the latter. -As we said earlier, `gtest` is excellent for unit and integration testing. It is also helpful for debugging Program on Vara logic. Nothing other than the Rust compiler is required for running tests based on `gtest`. It is predictable and robust when used in continuous integration. +As stated earlier, `gtest` is excellent for unit and integration testing. It is also helpful for debugging Program on Vara logic. Nothing other than the Rust compiler is required for running tests based on `gtest`. It is predictable and robust when used in continuous integration. ## Import `gtest` lib diff --git a/docs/02-basic/06-homework/assignment.md b/docs/02-basic/06-homework/assignment.md index 32f89ae..50b0a40 100644 --- a/docs/02-basic/06-homework/assignment.md +++ b/docs/02-basic/06-homework/assignment.md @@ -16,7 +16,7 @@ In this homework you are to write the Pebbles Game. The games rules are the foll ## Project Structure -We will create two crates: `pebbles-game` for the program and `pebbles-game-io` for data structures. +It is necessary to make two crates: `pebbles-game` for the program and `pebbles-game-io` for data structures. The directory structure should be the following: @@ -57,7 +57,7 @@ scale-info = { version = "2", default-features = false } Let's explore types used. -- We are to pass some initial information when initializing the game. For example, we are to set the pebbles count ($N$), maximum pebbles to be removed per turn ($K$), difficulty level. +- When initialising the game, it is necessary to pass some initial information. For example, the number of pebbles ($N$), maximum pebbles to be removed per turn ($K$), difficulty level. ```rust title="io/src/lib.rs" #[derive(Debug, Default, Clone, Encode, Decode, TypeInfo)] @@ -75,7 +75,7 @@ Let's explore types used. } ``` -- We will send actions message for every **User's** move and receive some event from the program. The action can be a turn with some count of pebbles to be removed or the give up. Also, there is a restart action than resets the game state . +- It needs to send actions message for every **User's** move and receive some event from the program. The action can be a turn with some count of pebbles to be removed or the give up. Also, there is a restart action than resets the game state . ```rust title="io/src/lib.rs" #[derive(Debug, Clone, Encode, Decode, TypeInfo)] @@ -121,7 +121,7 @@ Let's explore types used. } ``` -And finally we are to define metadata to be used by [IDEA](https://idea.gear-tech.io/programs?node=wss%3A%2F%2Ftestnet.vara.network) portal. +Finally, the metadata to be used by the [IDEA](https://idea.gear-tech.io/programs?node=wss%3A%2F%2Ftestnet.vara.network) portal. ```rust title="io/src/lib.rs" impl Metadata for PebblesMetadata {