Language
Reference
Advanced

Advanced

Dangerous or unstable features meant to be used by advanced users only.

readForwardFee

extends fun readForwardFee(self: Context): Int 

Read and computes forward fee from Context and return it as Int value in nanoToncoins.

throw

fun throw(code: Int);

Throw exception with error code equal code.

nativeThrowWhen

fun nativeThrowWhen(code: Int, condition: Bool);

Throw exception with error code equal code when condition equal True.

nativeThrowUnless

fun nativeThrowUnless(code: Int, condition: Bool);

Throw exception with error code equal code when condition equal False.

getConfigParam

fun getConfigParam(id: Int): Cell?;

Loads network configuration parameter from the blockchain.

nativeRandomize

fun nativeRandomize(x: Int);

Randomizes the random number generator with the specified seed.

nativeRandomizeLt

fun nativeRandomizeLt();

Randomizes the random number generator with the current logical time.

nativePrepareRandom

fun nativePrepareRandom();

This function prepares random number generator by calling nativeRandomizeLt once and called internally by random and randomInt functions.

nativeRandom

fun nativeRandom(): Int;

You shouldn't use this function directly, use random and randomInt functions instead. This function generates 256-bit random number just like randomInt function, but random generator is not initialized by nativePrepareRandom function.

nativeRandomInterval

fun nativeRandomInterval(max: Int): Int;

You shouldn't use this function directly, use random and randomInt functions instead. This function generates random number in the range from 0 to max. This call doesn't prepare initialization by nativePrepareRandom function.

nativeReserve

fun nativeReserve(amount: Int, mode: Int);

Calls native raw_reserve function with specified amount and mode.

The raw_reserve() is a function that creates an output action to reserve a specific amount of nanotoncoins from the remaining balance of the account. It has the following signature:

raw_reserve(int amount, int mode) impure asm "RAWRESERVE";

The function takes two arguments:

amount: The number of nanotoncoins to reserve. mode: Determines the reservation behavior. mode can have the following values:

0: Reserve exactly amount nanotoncoins. 1 or 3: Reserve all but amount nanotoncoins. 2: Reserve at most amount nanotoncoins. Additionally, mode can have the following flags:

+2: If the specified amount cannot be reserved, reserve the remaining balance instead of failing. +4: Increase amount by the original balance of the current account (before the compute phase), including all extra currencies. +8: Negate the amount before performing further actions. raw_reserve() is roughly equivalent to creating an outbound message carrying amount nanotoncoins (or b - amount nanotoncoins, where b is the remaining balance) to oneself. This ensures that subsequent output actions cannot spend more money than the remainder.

Currently, amount must be a non-negative integer, and mode must be in the range 0..15.