11// Standard library for Tolk (LGPL licence).
22// It contains common functions that are available out of the box, the user doesn't have to import anything.
33// More specific functions are required to be imported explicitly, like "@stdlib/tvm-dicts".
4- tolk 0.8
4+ tolk 0.9
55
66/**
77 Tuple manipulation primitives.
@@ -139,7 +139,7 @@ fun getMyOriginalBalance(): int
139139/// `int` — balance in nanotoncoins;
140140/// `cell` — a dictionary with 32-bit keys representing the balance of "extra currencies".
141141@pure
142- fun getMyOriginalBalanceWithExtraCurrencies(): [int, cell]
142+ fun getMyOriginalBalanceWithExtraCurrencies(): [int, cell? ]
143143 asm "BALANCE";
144144
145145/// Returns the logical time of the current transaction.
@@ -154,7 +154,7 @@ fun getCurrentBlockLogicalTime(): int
154154
155155/// Returns the value of the global configuration parameter with integer index `i` as a `cell` or `null` value.
156156@pure
157- fun getBlockchainConfigParam(x: int): cell
157+ fun getBlockchainConfigParam(x: int): cell?
158158 asm "CONFIGOPTPARAM";
159159
160160/// Returns the persistent contract storage cell. It can be parsed or modified with slice and builder primitives later.
@@ -291,7 +291,7 @@ fun calculateSliceSizeStrict(s: slice, maxCells: int): (int, int, int)
291291/// otherwise the returned value is one plus the maximum of depths of cells referred to from [c].
292292/// If [c] is a `null` instead of a cell, returns zero.
293293@pure
294- fun getCellDepth(c: cell): int
294+ fun getCellDepth(c: cell? ): int
295295 asm "CDEPTH";
296296
297297/// Returns the depth of `slice` [s].
@@ -417,12 +417,12 @@ fun getLastBits(self: slice, len: int): slice
417417/// Loads a dictionary (TL HashMapE structure, represented as TVM cell) from a slice.
418418/// Returns `null` if `nothing` constructor is used.
419419@pure
420- fun loadDict(mutate self: slice): cell
420+ fun loadDict(mutate self: slice): cell?
421421 asm( -> 1 0) "LDDICT";
422422
423423/// Preloads a dictionary (cell) from a slice.
424424@pure
425- fun preloadDict(self: slice): cell
425+ fun preloadDict(self: slice): cell?
426426 asm "PLDDICT";
427427
428428/// Loads a dictionary as [loadDict], but returns only the remainder of the slice.
@@ -433,12 +433,12 @@ fun skipDict(mutate self: slice): self
433433/// Loads (Maybe ^Cell) from a slice.
434434/// In other words, loads 1 bit: if it's true, loads the first ref, otherwise returns `null`.
435435@pure
436- fun loadMaybeRef(mutate self: slice): cell
436+ fun loadMaybeRef(mutate self: slice): cell?
437437 asm( -> 1 0) "LDOPTREF";
438438
439439/// Preloads (Maybe ^Cell) from a slice.
440440@pure
441- fun preloadMaybeRef(self: slice): cell
441+ fun preloadMaybeRef(self: slice): cell?
442442 asm "PLDOPTREF";
443443
444444/// Loads (Maybe ^Cell), but returns only the remainder of the slice.
@@ -497,13 +497,13 @@ fun storeBool(mutate self: builder, x: bool): self
497497/// Stores dictionary (represented by TVM `cell` or `null`) into a builder.
498498/// In other words, stores a `1`-bit and a reference to [c] if [c] is not `null` and `0`-bit otherwise.
499499@pure
500- fun storeDict(mutate self: builder, c: cell): self
500+ fun storeDict(mutate self: builder, c: cell? ): self
501501 asm(c self) "STDICT";
502502
503503/// Stores (Maybe ^Cell) into a builder.
504504/// In other words, if cell is `null`, store '0' bit; otherwise, store '1' and a ref to [c].
505505@pure
506- fun storeMaybeRef(mutate self: builder, c: cell): self
506+ fun storeMaybeRef(mutate self: builder, c: cell? ): self
507507 asm(c self) "STOPTREF";
508508
509509/// Concatenates two builders.
@@ -661,7 +661,7 @@ fun reserveToncoinsOnBalance(nanoTonCoins: int, reserveMode: int): void
661661
662662/// Similar to [reserveToncoinsOnBalance], but also accepts a dictionary extraAmount (represented by a cell or null)
663663/// with extra currencies. In this way currencies other than Toncoin can be reserved.
664- fun reserveExtraCurrenciesOnBalance(nanoTonCoins: int, extraAmount: cell, reserveMode: int): void
664+ fun reserveExtraCurrenciesOnBalance(nanoTonCoins: int, extraAmount: cell? , reserveMode: int): void
665665 asm "RAWRESERVEX";
666666
667667
0 commit comments