Language
Reference
Common

Common

List of a basic functions that are available in all smart contracts.

sender

fun sender(): Address;
⚠️

Behaviour is undefined for get methods.

Returns the address of the sender of the current message.

require

fun require(condition: Bool, error: String);

Checks condition and throws an exception with error message if condition is false.

now

fun now(): Int

Returns current Unix time

myBalance

myBalance(): Int;

Returns the remaining balance of the smart contract as Int value in NanoToncoins, where NanoToncoin = Toncoin * 10^(−9). Note that send do not update this field.

myAddress

myAddress(): Address;

Returns the internal address of the current smart contract as a Address.

newAddress

⚠️

This method throws error if chain is invalid or if trying to create address in the masterchain without masterchain enabled.

fun newAddress(chain: Int, hash: Int): Address;

Creates a new address from chain and hash values.

contractAddress

fun contractAddress(s: StateInit): Address;

Computes smart contract's Address in a workchain #0 based on its StateInit s, where s is a Struct consists of code and data Cells.

contractAddressExt

⚠️

This method throws error if chain is invalid or if trying to create address in the masterchain without masterchain enabled.

fun contractAddressExt(chain: Int, code: Cell, data: Cell): Address;

Computes smart contract's Address based on its workchain id chain, code, data.

emit

fun emit(value: Cell);

Sends a message to the outer world with the purpose of logging and analyzing it later off-chain. The message does not have a recipient and is gas-efficient compared to alternatives.

cell

fun cell("base64 boc"): Cell;

Compile-time function that embeds a Cell into the contract. The Cell is encoded in base64 format.

ton

fun ton(value: String): Int;

Compile-time function that converts ton's from human-readable format to the integer.

dump

fun dump(arg: Any);

Prints argument to the contract debug console. debug feature has to be enabled in tact.config.json.

context

fun context(): Context;

Return Struct Context, that consists of

FieldTypeDescription
bouncedBoolBounced (opens in a new tab) flag of incoming message
senderAddressAddress of sender
valueIntAmount of nanoToncoins in message
rawSliceSlice reminder of message