Skip to content

Commit

Permalink
WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
novusnota committed Nov 20, 2024
1 parent f79f799 commit beab730
Show file tree
Hide file tree
Showing 5 changed files with 251 additions and 115 deletions.
68 changes: 67 additions & 1 deletion docs/src/content/docs/ref/core-advanced.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,66 @@ Various niche, dangerous or unstable features which can produce unexpected resul

:::

## gasConsumed

<Badge text="Available since Tact 1.5" variant="tip" size="medium"/><p/>

```tact
fun gasConsumed(): Int;
```

Returns the [nanoToncoins](/book/integers#nanotoncoin) [`Int{:tact}`][int] amount of gas consumed by [TVM][tvm] in the current transaction so far. The resulting value includes the cost of calling this function.

Usage example:

```tact
let gas: Int = gasConsumed();
```

:::note[Useful links:]

[Gas in TON Docs](https://docs.ton.org/v3/documentation/smart-contracts/transaction-fees/fees#gas)

:::

## myStorageDue

<Badge text="Available since Tact 1.5" variant="tip" size="medium"/><p/>

```tact
fun myStorageDue(): Int;
```

Returns the [nanoToncoins](/book/integers#nanotoncoin) [`Int{:tact}`][int] amount of accumulated storage fee debt. The storage fees are usually deducted from the incoming message value prior to calculation of the new contract balance.

Usage example:

```tact
let debt: Int = myStorageDue();
```

:::note[Useful links:]

[Storage fee in TON Docs](https://docs.ton.org/v3/documentation/smart-contracts/transaction-fees/fees-low-level#storage-fee)

:::

## getStorageFee

TODO: rewrite the draft

## getComputeFee

TODO: rewrite the draft

## getSimpleComputeFee

TODO: rewrite the draft

## Context.readForwardFee

```tact
extends fun readForwardFee(self: Context): Int
extends fun readForwardFee(self: Context): Int;
```

Extension function for the [`Context{:tact}`](/ref/core-common#context).
Expand All @@ -29,6 +85,14 @@ Usage example:
let fwdFee: Int = context().readForwardFee();
```

## getForwardFee

TODO: rewrite the draft

## getOriginalFwdFee

TODO: rewrite the draft

## getConfigParam

```tact
Expand Down Expand Up @@ -334,3 +398,5 @@ parsedVarAddr.address.loadUint(123); // 345
[int]: /book/integers
[slice]: /book/cells#slices
[s]: /book/structs-and-messages#structs

[tvm]: https://docs.ton.org/learn/tvm-instructions/tvm-overview
18 changes: 18 additions & 0 deletions docs/src/content/docs/ref/core-cells.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -209,6 +209,24 @@ let fizz: Builder = b.storeBit(true); // writes 1
let buzz: Builder = b.storeBit(false); // writes 0
```

## Builder.storeBuilder

```tact
extends fun storeBuilder(self: Builder, cell: Builder): Builder;
```

Extension function for the [`Builder{:tact}`][builder].

Appends all data from a [`Builder{:tact}`][builder] `cell` to the copy of the [`Builder{:tact}`][builder]. Returns that copy.

Usage example:

```tact
let b: Builder = beginCell().storeCoins(42);
let fizz: Builder = beginCell().storeBuilder(b);
b.endCell() == fizz.endCell(); // true
```

## Builder.storeSlice

```tact
Expand Down
Loading

0 comments on commit beab730

Please sign in to comment.