Friends of funC language subcategory C language? Are there any Persian-language training? Is language hard to learn? I don't have any background and I don't know the programming language is it appropriate to start a language?

Jun 6, 2022, 7:51 AM
Apart from the official documentation, I haven't found training material yet. I feel so difficult.
Jun 6, 2022, 7:54 AM
Even the English sources are weak.
Jun 6, 2022, 7:54 AM
i couldnt agree more
Jun 6, 2022, 7:55 AM
😬
Jun 6, 2022, 7:56 AM
If you are just starting to learn programming, TON is probably not for you. I would suggest more convenient ways.
Jun 6, 2022, 8:13 AM
How to understand asm "21 PUSHINT"
Jun 6, 2022, 8:46 AM
Like "return 21;"
Jun 6, 2022, 8:51 AM
got it. just like const op = 21;
Jun 6, 2022, 8:51 AM
yeah, but more optimized
Jun 6, 2022, 8:52 AM
I looked at the documentation, but still don't understand what flags are. And why do &1? What does 1 stand for?
Jun 6, 2022, 8:55 AM
https://ton.org/docs/#/smart-contracts/messages?id=message-layout
It's 1 if flag bounced is turned on.
Jun 6, 2022, 8:57 AM
means least significant bit is true. For these flags it is "bounced" bit
Jun 6, 2022, 8:58 AM
So the first four bits represent whether the rebound bit, return 0 or 1
1 means true , &1 means only optimized writing
right?
Jun 6, 2022, 9:02 AM
😐
Jun 6, 2022, 9:02 AM
🧐
Jun 6, 2022, 9:04 AM
Oh, sorry for confusing.
I meant that int op::mint() asm "21 PUSHINT"; is more optimized than
int op::mint() { return 21; }
Jun 6, 2022, 9:07 AM
Each bit of those 4 has its own meaning. we need only the last one. & is something like bitwise comparison with some mask. 1 here is because we need the last bit. 2 would mean the second least and 4 the third an 8 the fourth.
Though I never used such an obscure syntax, so I might be wrong here
Jun 6, 2022, 9:13 AM
Jun 6, 2022, 9:16 AM
You don't have to read 6 bytes.
Jun 6, 2022, 9:18 AM
This is from the documentation, so I don't quite understand
Jun 6, 2022, 9:21 AM
Last 2 bytes mean "null address".
Jun 6, 2022, 9:21 AM
You are reading flags from in_msg_full, while other params are read from in_msg_body
Jun 6, 2022, 9:21 AM
First bit is for tag, always 0. Second is for ihr, then bounceable, then bounced bit and the last two are for blank source address
Jun 6, 2022, 9:22 AM
This example contains more information:
var msg = begin_cell()
.store_uint(0, 1) ;; tag
.store_uint(1, 1) ;; ihr_disabled
.store_uint(1, 1) ;; allow bounces
.store_uint(0, 1) ;; not bounced itself
.store_slice(source)
.store_slice(destination)
;; serialize CurrencyCollection (see below)
.store_coins(amount)
.store_dict(extra_currencies)
.store_coins(0) ;; ihr_fee
.store_coins(fwd_value) ;; fwd_fee
.store_uint(cur_lt(), 64) ;; lt of transaction
.store_uint(now(), 32) ;; unixtime of transaction
.store_uint(0, 1) ;; no init-field flag (Maybe)
.store_uint(0, 1) ;; inplace message body flag (Either)
.store_slice(msg_body)
.end_cell();
Jun 6, 2022, 9:23 AM
got it thank u bro. so flags === 0110 , so flags & 1 === false
yep.
Jun 6, 2022, 9:24 AM
need to learn to understand block.tlb
Jun 6, 2022, 9:25 AM
I completely agree but it may be too complicated in the beginning.
Anyway, I highly recommend to read this paragraph: https://ton.org/docs/#/smart-contracts/messages?id=message-layout
Jun 6, 2022, 9:31 AM
How Contract B interacts with Contract A. That is how to pass data to Contract A
Jun 6, 2022, 9:32 AM
Contracts may interact between each other with messages.
Jun 6, 2022, 9:33 AM
yep i know. But how to pass the message to Contract A?
Jun 6, 2022, 9:34 AM
var msg = begin_cell()
.store_uint(0x10, 6)
.store_slice(contract_a_address)
.store_coins(msg_value)
.store_uint(0, 1 + 4 + 4 + 64 + 32 + 1 + 1)
.store_uint(my_op_code(), 32)
.store_uint(my_query_id, 64)
;; my custom data

send_raw_message(msg.end_cell(), 1);
Jun 6, 2022, 9:37 AM
I seem to understand. Through the store_slice method, a message is sent, and then the message is received in the recv_internal() of the Contract A contract.
Jun 6, 2022, 9:43 AM
Exactly.
Jun 6, 2022, 9:51 AM
got it. thank u bro,
So this in_msg_full is used to receive the delivered message?
Jun 6, 2022, 10:39 AM
full contains an entire message (with all flags and other metadata), in_msg_body contains only message body (in this case. it starts with my_op_code()).
Jun 6, 2022, 10:46 AM
clear. thanks so much bro.
Jun 7, 2022, 1:17 AM

© 2024 Draquery.com All rights reserved.