Skip to content

Commit 924ccb8

Browse files
authored
Update prepare-your-first-contract.md
Fix typos
1 parent a94524d commit 924ccb8

File tree

1 file changed

+30
-30
lines changed

1 file changed

+30
-30
lines changed

content/md/en/docs/tutorials/smart-contracts/prepare-your-first-contract.md

Lines changed: 30 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ description: Build and test a simple smart contract using the ink! smart contrac
44
keywords:
55
---
66

7-
As you learned in [Blockchain basics](/main-docs/learn/blockchain-basics/) decentralized applications are most often written as **smart contracts**.
7+
As you learned in [Blockchain basics](/main-docs/learn/blockchain-basics/), decentralized applications are most often written as **smart contracts**.
88

99
Although Substrate is primarily a framework and toolkit for building custom blockchains, it can also provide a platform
1010
for smart contracts.
@@ -17,7 +17,7 @@ In this tutorial, you'll explore using ink! as a programming language for writin
1717

1818
Before you begin, verify the following:
1919

20-
- You have good internet connection and access to a shell terminal on your local computer.
20+
- You have a good internet connection and access to a shell terminal on your local computer.
2121

2222
- You are generally familiar with software development and using command-line interfaces.
2323

@@ -35,7 +35,7 @@ By completing this tutorial, you will accomplish the following objectives:
3535

3636
- Deploy a smart contract on a local Substrate node.
3737

38-
- Interact with a smart contract using the `cargo-contract` CLI
38+
- Interact with a smart contract using the `cargo-contract` CLI.
3939

4040
## Update your Rust environment
4141

@@ -65,7 +65,7 @@ To update your development environment:
6565

6666
## Install `cargo-contract` CLI Tool
6767

68-
`cargo-contract` is a command-line tool which you will use to build, deploy, and interact with your ink! contracts.
68+
`cargo-contract` is a command-line tool that you will use to build, deploy, and interact with your ink! contracts.
6969

7070
Note that in addition to Rust, installing `cargo-contract` requires a C++ compiler that supports C++17.
7171

@@ -169,23 +169,23 @@ To explore the default project files:
169169

170170
1. Open a terminal shell on your computer, if needed.
171171

172-
1. Change to project folder for the `flipper` smart contract, if needed:
172+
1. Change to the project folder for the `flipper` smart contract, if needed:
173173

174174
1. Open the `Cargo.toml` file in a text editor and review the dependencies for the contract.
175175

176176
1. Open the `lib.rs` file in a text editor and review the macros, constructors, and functions defined for the contract.
177177

178178
- The `#[ink::contract]` macro defines the entry point for your smart contract logic.
179-
- The `#[ink(storage)` macro defines a structure to stores a single boolean value for the contract.
180-
- The `new` and `default` functions initialize the boolean value to false.
181-
- There's a `#[ink(message)` macro with a `flip` function to change the state of the data stored for the contract.
182-
- There's a `#[ink(message)` macro with a `get` function to get the current state of the data stored for the contract.
179+
- The `#[ink(storage)]` macro defines a structure to store a single Boolean value for the contract.
180+
- The `new` and `default` functions initialize the Boolean value to false.
181+
- There's a `#[ink(message)]` macro with a `flip` function to change the state of the data stored for the contract.
182+
- There's a `#[ink(message)]` macro with a `get` function to get the current state of the data stored for the contract.
183183

184184
### Test the default contract
185185

186186
At the bottom of the `lib.rs` source code file, there are simple test cases to verify the functionality of the contract.
187187
These are annotated using the `#[ink(test)]` macro. You can test whether this code is functioning as expected using the
188-
**offchain test environment**.
188+
**off-chain test environment**.
189189

190190
To test the contract:
191191

@@ -244,7 +244,7 @@ To build the WebAssembly for this smart contract:
244244
- flipper.json (the contract's metadata)
245245
```
246246

247-
The `.contract` file includes both the business logic and metadata. This is the file that tooling (e.g UIs) expect
247+
The `.contract` file includes both the business logic and metadata. This is the file that tooling (e.g. UIs) expects
248248
when you want to deploy your contract on-chain.
249249

250250
The `.json` file describes all the interfaces that you can use to interact with this contract. This file
@@ -261,7 +261,7 @@ To build the WebAssembly for this smart contract:
261261

262262
## Start the Substrate Contracts Node
263263

264-
If you have [successfully installed the `substrate-contracts-node`](/tutorials/smart-contracts/prepare-your-first-contract/#install-the-substrate-contracts-node),
264+
If you have [successfully installed the `substrate-contracts-node`](/tutorials/smart-contracts/prepare-your-first-contract/#install-the-substrate-contracts-node),
265265
it's time to start a local node.
266266

267267
1. Start the contracts node in local development mode by running the following command:
@@ -351,17 +351,17 @@ Substrate chain.
351351
Some notes about the command:
352352
- The `instantiate` command will do both the `upload` and `instantiate` steps for you.
353353

354-
- We need to specify the contract constructor to use, which in this case is `new()`
354+
- You need to specify the contract constructor to use, which in this case is `new()`.
355355

356-
- We need to specify the argument to the constructor, which in this case is `false`
356+
- You need to specify the argument to the constructor, which in this case is `false`.
357357

358-
- We need to specify the account uploading and instantiating the contract, which in this case is the default
359-
development account of `//Alice`
358+
- You need to specify the account uploading and instantiating the contract, which in this case is the default
359+
development account of `//Alice`.
360360

361-
- During development we may want to upload the instantiate the same contract multiple times, so we specify a `salt`
361+
- During development, you may want to upload and instantiate the same contract multiple times, so you specify a `salt`
362362
using the current time. Note that this is optional.
363363

364-
After running the command confirming that we're happy with the gas estimatation we should see something like this:
364+
After running the command and confirming that you're happy with the gas estimation, you should see something like this:
365365

366366
```text
367367
Dry-running new (skip with --skip-dry-run)
@@ -397,29 +397,29 @@ We can not only `upload` and `instantiate` contracts using `cargo-contract`, we
397397

398398
### `get()` Message
399399

400-
When we initialized the contract we set the initial value of the `flipper` to `false`. We can confirm this by calling
400+
When we initialized the contract, we set the initial value of the `flipper` to `false`. We can confirm this by calling
401401
the `get()` message.
402402

403-
Since we are only reading from the blockchain state (we're not writing any new data) we can use the `--dry-run` flag to
403+
Since we are only reading from the blockchain state (we're not writing any new data), we can use the `--dry-run` flag to
404404
avoid submitting an extrinsic.
405405

406406
```bash
407407
cargo contract call --contract $INSTANTIATED_CONTRACT_ADDRESS --message get --suri //Alice --dry-run
408408
```
409409

410410
Some notes about the command:
411-
- The address of the contract we want to call had to be specified using the `--contract` flag
411+
- The address of the contract we want to call had to be specified using the `--contract` flag.
412412

413-
- This can be found in the output logs of the `cargo contract instantiate` command
413+
- This address can be found in the output logs of the `cargo contract instantiate` command.
414414

415-
- We need to specify the contract message to use, which in this case is `get()`
415+
- We need to specify the contract message to use, which in this case is `get()`.
416416

417-
- We need to specify the account callling the contract, which in this case is the default development account of
418-
`//Alice`
417+
- We need to specify the account calling the contract, which in this case is the default development account of
418+
`//Alice`.
419419

420-
- We specify `--dry-run` to avoid submitting an extrinsic on-chain
420+
- We specify `--dry-run` to avoid submitting an extrinsic on-chain.
421421

422-
After running the command should see something like this:
422+
After running the command, you should see something like this:
423423

424424
```text
425425
Result Success!
@@ -433,18 +433,18 @@ We're interested in the `value` here, which is `false` as expected.
433433

434434
The `flip()` message changes the storage value from `false` to `true` and vice versa.
435435

436-
To call the `flip()` message we will need to submit an extrinsic on-chain because we are altering the state of the
436+
To call the `flip()` message, we will need to submit an extrinsic on-chain because we are altering the state of the
437437
blockchain.
438438

439-
To do this we can use the following command:
439+
To do this, we can use the following command:
440440

441441
```bash
442442
cargo contract call --contract $INSTANTIATED_CONTRACT_ADDRESS --message flip --suri //Alice
443443
```
444444

445445
Notice that we changed the message to `flip` and removed the `--dry-run` flag.
446446

447-
After running we expect to see something like:
447+
After running, we expect to see something like this:
448448

449449
```text
450450
Dry-running flip (skip with --skip-dry-run)

0 commit comments

Comments
 (0)