If there are two numbers, like 1100 and 0011, what is the easiest way to "concatenate" them (not adding, but merging into a single number containing all the ...
one year ago
When you implement flow control in your program and you have a loop, sometimes you need to let the execution path out of that loop while its condition is not...
one year ago
Some programming languages let assign a variable the result of a logical expression. In FunC that could look like this: int enough? = (s.slice_bits() >= flag...
one year ago
Suppose I have a slice that contains a string and I want to read it char by char. How do I do it? --- > This question was imported from Telegram Chat: https:...
In TON software development, everything is a cell. Every cell can reference up to 4 other cells, creating a parent-child relationship. What if I have a speci...
Programming languages often use 0 for "false" and -1 for "true". It works that way in FunC, too. But what about all the other numbers? Do they have a boolean...
one year ago
FunC standard library includes Lisp-style lists. TON documentation describes them and their basic functionality like adding an element to the beginning of a ...
one year ago
Hi guys, how can I sign a Cell with ton-crypto, or ton-core or in someway, that later can be correctly verified by check_signature or check_data_signature fr...
According to the documentation, we find the commit() FunC code described as follows: Commits the current state of registers c4 (“persistent data”) and c5 (“a...
one year ago
here is my FunC code: C-like forall X -> int is_null (X x) asm "ISNULL"; forall X -> (tuple, ()) push_back (tuple tail, X head) asm "CONS"; forall X -> (tupl...
Hi there guys, how can I make an in place replacement of the bytes in a cell? For example, if I have a cell like, begin_cell().store_uint(val, 8).end_cell(),...
In Blueprint, we will need to write the Wrapper functions ourselves. More importantly, when we code the op code in our FunC code, we need to decode the strin...
Is there a conventional way to concatenate two strings using FunC? --- > This question was imported from Telegram Chat: https://t.me/tondev/130472
one year ago
I remember there was a function equal_slices in stdlib for comparing two slices, but now at compilation time I get an error saying such a function does not e...
In modular arithmetic there is such a thing as modular multiplication. Does it have a built-in support in FunC? --- > This question was imported from Telegra...
one year ago
I found a strange behavior in func bitwise operation. I don't understand why. slice slice0 = begin_cell().store_coins(123).end_cell().begin_parse(); int resu...
If there are two dicts and one of them is bigger than other, would the operations like insert require more gas for the bigger one, or would the gas fees be t...
In FunC, if you apply the letter c to a string literal (writing it as "string"c), the crc32 check value of the string is calculated and used instead of the s...
one year ago
I use Visual Studio Code with the "FunC Language Support" extension by Whales Corp. This setup is convenient and often helps with the autocompletion in FunC....
In FunC there is a function run_ticktock called in ticktock transactions of special smart contracts. But can such smart contracts work on a basechain, or is ...
There are different approaches to division: * using floating-point numbers (so 23 / 4 = 5.75) * mathematical rounding (23 / 4 = 6 since it's the closest inte...
one year ago
In the following API link, the server gets the list of items of a collection. https://tonapi.io/v2/nfts/collections/0%3A80d78a35f955a14b679faa887ff4cd5bfc0f4...
How do you define multiple cells in the storage of a contract? clike const data = beginCell() .storeUint(someVar, 64) .storeMaybeSlice() .endCell(); In other...
one year ago
how can I calculate the gas price for get/set operations to Hashmap? https://docs.ton.org/learn/tvm-instructions/instructions for these operations the gas pr...
Case 1: () recv_internal(int my_balance, int msg_value, cell in_msg_full, slice in_msg_body) impure { slice cs = in_msg_full.begin_parse(); int flags = cs~lo...
one year ago
In the Ston.fi core contract GitHub repository (https://github.com/ston-fi/dex-core), there is a line of FunC code as shown below: force_chain(WORKCHAIN, sen...
one year ago
Both FunC and Tact languages can be used for developing on TON. But from what I see, tutorials, questions and other resources are currently focused mostly on...
Hello, I'm considering to move my projects from another blockchain to TON but I still don't understand how to handle the asynchronous part. One of my project...
Suppose we check for two conditions at the same time: if( (a == b) & (b == c) ). If a is not equal to b, that makes the first condition false. And that means...
one year ago