Skip to content

Commit

Permalink
Merge branch 'ton-community:main' into func_debug_primitives
Browse files Browse the repository at this point in the history
  • Loading branch information
coolroman authored May 6, 2024
2 parents c6488c0 + 506ea8b commit 460bb42
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 8 deletions.
2 changes: 1 addition & 1 deletion docs/develop/dapps/apis/sdk.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ There are different ways to connect to blockchain:
|[TonTools](https://github.com/yungwine/TonTools)|via RPC ([Orbs](https://www.orbs.com/ton-access/) / [Toncenter](https://toncenter.com/api/v2/) / etc)|TonTools is a high-level OOP library for Python, which can be used to interact with TON Blockchain.|
|[tonpy](https://github.com/disintar/tonpy)|Native ADNL| Python package that provides data structures and API to interact with TON blockchain. |
|[tvm_valuetypes](https://github.com/toncenter/tvm_valuetypes)|*offchain-only*| library is collection of utilits for handling TVM types. |
|[pytvm](https://github.com/yungwine/pytvm) | *offchain*, Tonlib | Python TVM emulator using bindings to C++ standard emulator |
|[pytvm](https://github.com/yungwine/pytvm) | *offchain* | Python TVM emulator using bindings to C++ standard emulator |


### C#
Expand Down
32 changes: 25 additions & 7 deletions docs/develop/func/stdlib.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -475,20 +475,38 @@ Similar to `raw_reserve` but also accepts a dictionary `extra_amount` (represent

Sends a raw message contained in `msg`, which should contain a correctly serialized object Message X, with the only exception that the source address is allowed to have a dummy value `addr_none` (to be automatically replaced with the current smart contract address), and `ihr_fee`, `fwd_fee`, `created_lt` and `created_at` fields can have arbitrary values (to be rewritten with correct values during the action phase of the current transaction). The integer parameter `mode` contains the flags.

There are currently 3 Modes and 3 Flags for messages. You can combine a single mode with several (maybe none) flags to get a required `mode`. Combination simply means getting sum of their values. A table with descriptions of Modes and Flags is given below.
There are currently 3 Modes and 4 Flags for messages. You can combine a single mode with several (maybe none) flags to get a required `mode`. Combination simply means getting sum of their values. A table with descriptions of Modes and Flags is given below.

| Mode | Description |
| :---- | :--------------------------------------------------------------------------------------------------------------------- |
| `0` | Ordinary message |
| `64` | Carry all the remaining value of the inbound message in addition to the value initially indicated in the new message |
| `128` | Carry all the remaining balance of the current smart contract instead of the value originally indicated in the message |

| Flag | Description |
| :---- | :-------------------------------------------------------------------------------------------- |
| `+1` | Pay transfer fees separately from the message value |
| `+2` | Ignore any errors arising while processing this message during the action phase |
| `+16` | In the case of action fail - bounce transaction. No effect if `+2` is used. |
| `+32` | Current account must be destroyed if its resulting balance is zero (often used with Mode 128) |
| Flag | Description |
| :---- | :---------------------------------------------------------------------------------------------------------------- |
| `+1` | Pay transfer fees separately from the message value |
| `+2` | Ignore some errors arising while processing this message during the action phase (check note below) |
| `+16` | In the case of action fail - bounce transaction. No effect if `+2` is used. |
| `+32` | Current account must be destroyed if its resulting balance is zero (often used with Mode 128) |

:::info +2 flag
Note that `+2` flag ignore only following errors arising while processing message during the action phase:
1. Not enough Toncoins:
- Not enough value to transfer with the message (all of the inbound message value has been consumed).
- Not enough funds to process a message.
- Not enough value attached to the message to pay forwarding fees.
- Not enough extra currency to send with the message.
- Not enough funds to pay for an outbound external message.
2. Message is too large (check [Message size](/develop/smart-contracts/messages#message-size) for more).
3. The message has too big Merkle depth.

However, it does not ignore errors in the following scenarios:
1. The message has an invalid format.
2. The message mode includes both 64 and 128 mods.
3. The outbound message has invalid libraries in StateInit.
4. The external message is not ordinary or includes +16 or +32 flag or both.
:::

For example, if you want to send a regular message and pay transfer fees separately, use the Mode `0` and Flag `+1` to get `mode = 1`. If you want to send the whole contract balance and destroy it immidiately, use the Mode `128` and Flag `+32` to get `mode = 160`.

Expand Down

0 comments on commit 460bb42

Please sign in to comment.