Common
List of a basic functions that are available in all smart contracts.
context
fun context(): Context;Return Struct Context, that consists of
| Field | Type | Description |
|---|---|---|
| bounced | Bool | Bounced (opens in a new tab) flag of incoming message |
| sender | Address | Address of sender |
| value | Int | Amount of nanoToncoins in message |
| raw | Slice | Slice reminder of message |
require
fun require(condition: Bool, error: String);Checks condition and throws an exception with error message if condition is false.
now
fun now(): IntReturns current unixtime
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.
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
fun contractAddressExt(chain: Int, code: Cell, data: Cell): Address;Computes smart contract's Address based on its workchain id chain, code, data.