Documentation Index
Fetch the complete documentation index at: https://companyname-a7d5b98e-pr-1003-gas-tolk.mintlify.app/llms.txt
Use this file to discover all available pages before exploring further.
Initialization of cc, cp, and gas limits
-
The original
cc, current continuation, is initialized using the cell slice created from the code section of the smart contract. If the account is frozen or uninitialized, the code must be provided in the init field of the incoming message.
-
The
cp, current TVM codepage, is set to the default value of 0.
-
The gas limit values are initialized based on the results of the credit phase.
Registers initialization
-
c0: Quit — extraordinary continuation which terminates TVM with exit code 0.
-
c1: Quit — extraordinary continuation which terminates TVM with exit code 1. Both exit codes 0 and 1 are considered successful terminations of TVM.
-
c2: ExcQuit — extraordinary continuation which terminates TVM with an exception. In this case, the exit code is an exception number.
-
c3: root cell of code currently executing in TVM.
-
c4: root cell of account data.
-
c5: empty cell.
-
c7: Tuple[Tuple[0x076ef1ea, 0, 0, ...]].
Stack
The contents of the stack depend on the event that triggered the transaction:
The top of the stack is always the function selector, an integer that identifies the event that caused the transaction.
The following function selectors are defined:
| ID | Name | Description |
|---|
| 0 | onInternalMessage | Received an internal message |
| -1 | onExternalMessage | Received an external message |
| -2 | onRunTickTock | Received a tick-tock event |
| -3 | onSplitPrepare | Received a split prepare event (unimplemented yet) |
| -4 | onSplitInstall | Received a split install event (unimplemented yet) |
Get methods can have arbitrary IDs and should not overlap with the ones listed above.
External/internal message
| Index | Name | Type | Description |
|---|
s0 | Function selector | Integer | -1 for external messages, 0 for internal messages. |
s1 | Message body | Slice | This is an arbitrary payload of a message, which can be used for text comments (when sending TONs from one wallet to another) or for smart contract commands. |
s2 | Message | Cell | Cell containing message metadata (sender, receiver, amount) as well as message body. |
s3 | Message value | Integer | Amount of received nanotons (0 for externals). |
s4 | Contract balance | Integer | Current account balance in nanotons. |
Tick‑tock
| Index | Name | Type | Description |
|---|
s0 | Function selector | Integer | -2 for tick-tock transactions. |
s1 | Tick or tock? | Integer | 0 for tick transactions, -1 for tock transactions. |
s2 | Account address | Integer | 256-bit raw account address (without workchain). |
s3 | Contract | Integer | Current account balance in nanotons. |
Split/merge events
These events are not implemented yet. Possible stack layout for split/merge events is described in TON Blockchain whitepaper. However, it is subject to change.