1
1
// Standard library for Tolk (LGPL licence).
2
2
// It contains common functions that are available out of the box, the user doesn't have to import anything.
3
3
// More specific functions are required to be imported explicitly, like "@stdlib/tvm-dicts".
4
- tolk 0.8
4
+ tolk 0.9
5
5
6
6
/**
7
7
Tuple manipulation primitives.
@@ -139,7 +139,7 @@ fun getMyOriginalBalance(): int
139
139
/// `int` — balance in nanotoncoins;
140
140
/// `cell` — a dictionary with 32-bit keys representing the balance of "extra currencies".
141
141
@pure
142
- fun getMyOriginalBalanceWithExtraCurrencies(): [int, cell]
142
+ fun getMyOriginalBalanceWithExtraCurrencies(): [int, cell? ]
143
143
asm "BALANCE";
144
144
145
145
/// Returns the logical time of the current transaction.
@@ -154,7 +154,7 @@ fun getCurrentBlockLogicalTime(): int
154
154
155
155
/// Returns the value of the global configuration parameter with integer index `i` as a `cell` or `null` value.
156
156
@pure
157
- fun getBlockchainConfigParam(x: int): cell
157
+ fun getBlockchainConfigParam(x: int): cell?
158
158
asm "CONFIGOPTPARAM";
159
159
160
160
/// 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)
291
291
/// otherwise the returned value is one plus the maximum of depths of cells referred to from [c].
292
292
/// If [c] is a `null` instead of a cell, returns zero.
293
293
@pure
294
- fun getCellDepth(c: cell): int
294
+ fun getCellDepth(c: cell? ): int
295
295
asm "CDEPTH";
296
296
297
297
/// Returns the depth of `slice` [s].
@@ -417,12 +417,12 @@ fun getLastBits(self: slice, len: int): slice
417
417
/// Loads a dictionary (TL HashMapE structure, represented as TVM cell) from a slice.
418
418
/// Returns `null` if `nothing` constructor is used.
419
419
@pure
420
- fun loadDict(mutate self: slice): cell
420
+ fun loadDict(mutate self: slice): cell?
421
421
asm( -> 1 0) "LDDICT";
422
422
423
423
/// Preloads a dictionary (cell) from a slice.
424
424
@pure
425
- fun preloadDict(self: slice): cell
425
+ fun preloadDict(self: slice): cell?
426
426
asm "PLDDICT";
427
427
428
428
/// Loads a dictionary as [loadDict], but returns only the remainder of the slice.
@@ -433,12 +433,12 @@ fun skipDict(mutate self: slice): self
433
433
/// Loads (Maybe ^Cell) from a slice.
434
434
/// In other words, loads 1 bit: if it's true, loads the first ref, otherwise returns `null`.
435
435
@pure
436
- fun loadMaybeRef(mutate self: slice): cell
436
+ fun loadMaybeRef(mutate self: slice): cell?
437
437
asm( -> 1 0) "LDOPTREF";
438
438
439
439
/// Preloads (Maybe ^Cell) from a slice.
440
440
@pure
441
- fun preloadMaybeRef(self: slice): cell
441
+ fun preloadMaybeRef(self: slice): cell?
442
442
asm "PLDOPTREF";
443
443
444
444
/// Loads (Maybe ^Cell), but returns only the remainder of the slice.
@@ -497,13 +497,13 @@ fun storeBool(mutate self: builder, x: bool): self
497
497
/// Stores dictionary (represented by TVM `cell` or `null`) into a builder.
498
498
/// In other words, stores a `1`-bit and a reference to [c] if [c] is not `null` and `0`-bit otherwise.
499
499
@pure
500
- fun storeDict(mutate self: builder, c: cell): self
500
+ fun storeDict(mutate self: builder, c: cell? ): self
501
501
asm(c self) "STDICT";
502
502
503
503
/// Stores (Maybe ^Cell) into a builder.
504
504
/// In other words, if cell is `null`, store '0' bit; otherwise, store '1' and a ref to [c].
505
505
@pure
506
- fun storeMaybeRef(mutate self: builder, c: cell): self
506
+ fun storeMaybeRef(mutate self: builder, c: cell? ): self
507
507
asm(c self) "STOPTREF";
508
508
509
509
/// Concatenates two builders.
@@ -661,7 +661,7 @@ fun reserveToncoinsOnBalance(nanoTonCoins: int, reserveMode: int): void
661
661
662
662
/// Similar to [reserveToncoinsOnBalance], but also accepts a dictionary extraAmount (represented by a cell or null)
663
663
/// 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
665
665
asm "RAWRESERVEX";
666
666
667
667
0 commit comments