You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* order
* func-tolk flow
* tact flow
* navigation
* minor
* minor
* minor
* test
* test
* getting started
* read-write-to-the-network-sections
* buttons
* minor
* minor
* check
* check
A more complex example of traversing transactions graph may be found [here](https://docs.ton.org/v3/guidelines/dapps/asset-processing/payments-processing/#retrieve-incomingoutgoing-transactions).
328
328
:::
329
329
330
+
## Next step
331
+
332
+
Now that you’ve learned how to read data from TON Blockchain, it’s time to explore how to **write data to the network**.
Navigate to [Tonviewer](https://testnet.tonviewer.com/) and paste your address into the search bar. You should see an NFT transfer with the *'Hello from NFT!'* comment.
211
212
213
+
## Next step
214
+
215
+
Now that you’ve learned how to write data to TON Blockchain, it’s time to move on to the next stage—**developing your smart contracts**. You’ll first need to **set up your development environment** with the necessary tools and libraries to do that.
This folder contains your smart contract source code written in one of the available programming languages used for TON Blockchain smart contract development.
55
56
56
-
### `/wrappers`
57
+
### `/scripts`
57
58
58
-
To interact with your smart contract off-chain, you need to serialize and deserialize messages sent to it. `Wrapper` classes are developed to mirror your smart contract implementation, making its functionality simple to use.
59
+
The `scripts` directory contains `TypeScript` files that help you deploy and interact with your smart contracts on-chain using previously implemented wrappers.
59
60
60
61
### `/tests`
61
62
62
63
This directory contains test files for your smart contracts. Testing contracts directly on the TON network is not the best option because deployment requires some amount of time and may lead to losing funds. This testing playground allows you to execute multiple smart contracts and even send messages between them in your **"local network"**. Tests are crucial for ensuring your smart contracts behave as expected before deployment to the network.
63
64
64
-
### `/scripts`
65
+
### `/wrappers`
66
+
67
+
To interact with your smart contract off-chain, you need to serialize and deserialize messages sent to it. `Wrapper` classes are developed to mirror your smart contract implementation, making its functionality simple to use.
65
68
66
-
The `scripts` directory contains `TypeScript` files that help you deploy and interact with your smart contracts on-chain using previously implemented wrappers.
67
69
68
70
## Development flow
69
71
@@ -101,4 +103,14 @@ Also, you can always generate the same structure for another smart contract if,
101
103
npx blueprint create PascalCase # Don't forget to name the contract in PascalCase
102
104
```
103
105
106
+
## Next step
107
+
108
+
Now you’re all set — it's time to start writing smart contracts. We’ll begin with the basics: **storage** and **get methods**.
Copy file name to clipboardExpand all lines: docs/v3/guidelines/quick-start/developing-smart-contracts/func-tolk-folder/deploying-to-network.mdx
+6-22
Original file line number
Diff line number
Diff line change
@@ -26,11 +26,11 @@ This makes it possible to calculate the future wallet smart contract address.
26
26
27
27
### Magic storage member
28
28
29
-
In previous steps, we deliberately didn't explain the purpose of `ctxID` and `ID` stored in our smart contract's state and why they remained untouched in all the smart contract functionality. Now, their purpose should start to become clearer.
29
+
In previous steps, we deliberately didn't explain the purpose of `ctx_id` and `ID` stored in our smart contract's state and why they remained untouched in all the smart contract functionality. Now, their purpose should start to become clearer.
30
30
31
31
Since we can't deploy a smart contract with the same `state_init`, the only way to provide the same initial code and **"same"** initial data is to create a separate field in it, ensuring additional uniqueness. This, in the case of a wallet, gives you the opportunity to have the same key pair for several wallet smart contracts.
32
32
33
-
### One to rule them all
33
+
{/*### One to rule them all
34
34
35
35
If you've already considered that the `ID` field is a must-have for any smart contract, there is another opportunity that could change your mind. Let's examine the previously developed `CounterInternal` smart contract's init section:
36
36
@@ -47,19 +47,19 @@ If we remove the `id` field from its initial storage, we can ensure that **only
47
47
:::info Tokens
48
48
This mechanism plays a crucial role in [Jetton Processing](/v3/guidelines/dapps/asset-processing/jettons/). Each non-native (jetton) token requires its own `Jetton Wallet` for a particular owner and, therefore, provides a calculable address for it, creating a **star scheme** with the basic wallet in the center.
49
49
:::
50
-
50
+
*/}
51
51
## Implementation
52
52
53
-
Now that our smart contracts are fully tested, we are ready to deploy them to TON. In `Blueprint SDK`, this process is the same for both `Mainnet` and `Testnet` and for any of the presented languages in the guide: `FunC`, `Tact`, or `Tolk`.
53
+
Now that our smart contracts are fully tested, we are ready to deploy them to TON. In `Blueprint SDK`, this process is the same for both `Mainnet` and `Testnet` and for any of the presented languages in the guide: `FunC` or `Tolk`.
54
54
55
55
### Step 1: update the deployment script
56
56
57
57
Deployment scripts rely on the same wrappers that you have used in testing scripts. We will use one common script to deploy both of the previously deployed smart contracts. Update `deployHelloWorld.ts` with this code:
@@ -182,7 +183,7 @@ By combining both of these patterns, you can achieve a comprehensive description
182
183
183
184
`External messages` are your only way of toggling smart contract logic from outside the blockchain. Usually, there is no need for implementation of them in smart contracts because, in most cases, you don't want external entry points to be accessible to anyone except you. If this is all the functionality that you want from the external section, the standard way is to delegate this responsibility to a separate actor - [wallet](v3/documentation/smart-contracts/contracts-specs/wallet-contracts#basic-wallets/), which is practically the main reason they were designed for.
184
185
185
-
Developing external endpoints includes several standard [approaches](/v3/documentation/smart-contracts/message-management/external-messages/) and [security measures](/v3/guidelines/smart-contracts/security/overview/) that might be overwhelming at this point. Therefore, in this guide, we will implement incrementing the previously added `ctxCounterExt` number and add a send message to our `Tact` contract.
186
+
Developing external endpoints includes several standard [approaches](/v3/documentation/smart-contracts/message-management/external-messages/) and [security measures](/v3/guidelines/smart-contracts/security/overview/) that might be overwhelming at this point. Therefore, in this guide, we will implement incrementing the previously added `ctx_counter_ext` number.
186
187
187
188
:::danger
188
189
This implementation is **unsafe** and may lead to losing your contract funds. Don't deploy it to `Mainnet`, especially with a high smart contract balance.
@@ -259,7 +260,7 @@ fun onExternalMessage(inMsg: slice) {
259
260
</TabItem>
260
261
</Tabs>
261
262
262
-
This function, upon receiving an external message, will increment our `ctxCounterExt` and also send an internal message to the specified address with the `increase` operation, which we will use to increment the counter on our `CounterInternal` smart contract.
263
+
This function, upon receiving an external message, will increment our `ctx_counter_ext` and also send an internal message to the specified address with the `increase` operation.
263
264
264
265
Verify that the smart contract code is correct by running:
265
266
@@ -308,13 +309,13 @@ async sendExternalIncrease(
308
309
309
310
### Step 3: update test
310
311
311
-
Update the test to ensure that the `HelloWorld` contract received the external message, sent an internal message to the `CounterInternal` contract, and both updated their counters:
312
+
Update the test to ensure that the `HelloWorld` contract received the external message, and updated its counters:
This test describes the common transaction flow of any `multi-contract` system:
412
-
1. Send an external message to toggle the smart contract logic from outside the blockchain.
382
+
{/*This test describes the common transaction flow of any `multi-contract` system:
383
+
1. Send an external message to toggle the smart contract logic outside the blockchain.
413
384
2. Trigger one or more internal messages to be sent to other contracts.
414
385
3. Upon receiving an internal message, change the contract state and repeat **step 2** if required.
415
386
416
387
Since the resulting sequence of transactions might be overwhelming for understanding, it's a good practice to create a `sequence diagram` describing your system. Here is an example of our case:
0 commit comments