Skip to content

Commit d2831b0

Browse files
committed
navigation
1 parent ae69708 commit d2831b0

File tree

1 file changed

+9
-19
lines changed

1 file changed

+9
-19
lines changed

docs/v3/guidelines/quick-start/developing-smart-contracts/tact-folder/tact-storage-and-get-methods.mdx

Lines changed: 9 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -12,22 +12,12 @@ For more details, refer to the [Tact documentation](https://docs.tact-lang.org/#
1212

1313
Let's create and modify our smart contract following standard steps described in the previous [Blueprint SDK overview](/v3/guidelines/quick-start/developing-smart-contracts/blueprint-sdk-overview/) section.
1414

15-
## Step 1: creating and modifying Tact contract
15+
## Step 1: edit smart contract code
1616

17-
First, let's set up the environment for the Tact smart contract. To do that, you need a parent folder of your future project and run the following command:
1817

19-
```bash
20-
npm create ton@latest
21-
```
22-
23-
This will run interactive script for creating project template, you can enter anything you want, but if you want to have same paths as this guide choose the following:
24-
1. Project name: `Example`.
25-
2. First created contract name: `CounterInternal`.
26-
3. Choose the project template: A **simple counter contract** on `Tact`.
27-
28-
At the top of the generated contract file: `counter_internal.tact`, you may see a message definition:
18+
At the top of the generated contract file: `hello_world.tact`, you may see a message definition:
2919

30-
```tact title="/contracts/counter_internal.tact"
20+
```tact title="/contracts/hello_world.tact"
3121
message Add {
3222
queryId: Int as uint64;
3323
amount: Int as uint32;
@@ -36,7 +26,7 @@ message Add {
3626

3727
A message is a basic structure for communication between contracts. Tact automatically serializes and deserializes messages into cells. To ensure that opcodes will be the same during message structure changes, it may be added like below:
3828

39-
```tact title="/contracts/counter_internal.tact"
29+
```tact title="/contracts/hello_world.tact"
4030
message(0x7e8764ef) Add {
4131
queryId: Int as uint64;
4232
amount: Int as uint32;
@@ -125,7 +115,7 @@ Tact also provides handy ways to share same logic through [traits](https://docs.
125115
import "@stdlib/ownable";
126116
127117
// Ownable trait introduced here
128-
contract CounterInternal with Ownable {
118+
contract HelloWorld with Ownable {
129119
130120
...
131121
@@ -226,23 +216,23 @@ Expected output should look like this:
226216
"hex": "b5ee9c7241020e010001cd00021eff00208e8130e1f4a413f4bcf2c80b010604f401d072d721d200d200fa4021103450666f04f86102f862ed44d0d200019ad31fd31ffa4055206c139d810101d700fa405902d1017001e204925f04e002d70d1ff2e0822182107e8764efba8fab31d33fd31f596c215023db3c03a0884130f84201706ddb3cc87f01ca0055205023cb1fcb1f01cf16c9ed54e001020305040012f8425210c705f2e084001800000000436173686261636b01788210946a98b6ba8eadd33f0131c8018210aff90f5758cb1fcb3fc913f84201706ddb3cc87f01ca0055205023cb1fcb1f01cf16c9ed54e05f04f2c0820500a06d6d226eb3995b206ef2d0806f22019132e21024700304804250231036552212c8cf8580ca00cf8440ce01fa028069cf40025c6e016eb0935bcf819d58cf8680cf8480f400f400cf81e2f400c901fb000202710709014dbe28ef6a268690000cd698fe98ffd202a903609cec08080eb807d202c816880b800f16d9e3618c08000220020378e00a0c014caa18ed44d0d200019ad31fd31ffa4055206c139d810101d700fa405902d1017001e2db3c6c310b000221014ca990ed44d0d200019ad31fd31ffa4055206c139d810101d700fa405902d1017001e2db3c6c310d000222bbeaff01"
227217
}
228218

229-
✅ Wrote compilation artifact to build/CounterInternal.compiled.json
219+
✅ Wrote compilation artifact to build/HelloWorld.compiled.json
230220
```
231221

232222
## Step 2: update wrapper
233223

234224
[Wrappers](https://docs.tact-lang.org/book/compile/#wrap-ts) facilitate contract interaction from TypeScript. Unlike in FunC or Tolk, they are generated automatically during the build process:
235225

236226
```typescript title="/wrappers/HelloWorld.ts"
237-
export * from '../build/CounterInternal/tact_CounterInternal';
227+
export * from '../build/HelloWorld/tact_HelloWorld';
238228
```
239229

240230
## Step 3: updating tests
241231

242232
Now let's ensure that our smart contract code fails when we try to send `add` message from non-owner:
243-
- Create `CounterInternal` with some owner.
233+
- Create `HelloWorld` with some owner.
244234
- Create another smart contract that will have different address - `nonOwner`.
245-
- Try to send an internal message to `CounterInternal` and enusre that it fails with expected `exitCode` and counter field remains the same.
235+
- Try to send an internal message to `HelloWorld` and enusre that it fails with expected `exitCode` and counter field remains the same.
246236

247237
Implementation of test should look like this:
248238

0 commit comments

Comments
 (0)