Unanswered
For the short answer, yes. Smart contracts are written in FunC, then compiled into Fift, and deployed on the blockchain. They can later be interacted with using either Fift or a wrapper SDK.
On the other hand, there are always 4 arguments on stack when recv_internal
is called.
By declaring recv_internal with less than 4 arguments you force FunC to ignore most deep variables (they still will be there, but your code will be unaware for the whole TVM execution).
here are the example for recv_internal
in the latest tutorial built by community:
() recv_internal(int msg_value, cell in_msg, slice in_msg_body) impure { ;; well known function signature
if (in_msg_body.slice_empty?()) { ;; check if incoming message is empty (with no body)
return (); ;; return successfully and accept an empty message
}
int op = in_msg_body~load_uint(32); ;; parse the operation type encoded in the beginning of msg body
var (counter) = load_data(); ;; call our read utility function to load values from storage
if (op == 1) { ;; handle op #1 = increment
save_data(counter + 1); ;; call our write utility function to persist values to storage
}
}
You can catch more in here: https://ton.org/docs/learn/tvm-instructions/tvm-overview#initialization-of-tvm
For the deeper understanding, you can check Ch4.4 in Whitepaper
https://ton.org/tblkch.pdf
359 Views
0
Answers
2 years ago
2 years ago