From be18272dc60843cc3f7ab5f8bd7b804bad128108 Mon Sep 17 00:00:00 2001 From: Fabco Date: Mon, 15 Jul 2024 11:13:45 +0200 Subject: [PATCH] remove useless comments arithmetic contract --- contracts/arithmetic.fc | 22 ++++++---------------- 1 file changed, 6 insertions(+), 16 deletions(-) diff --git a/contracts/arithmetic.fc b/contracts/arithmetic.fc index 22bf967..de85208 100644 --- a/contracts/arithmetic.fc +++ b/contracts/arithmetic.fc @@ -5,12 +5,8 @@ const op::decrease = "op::decrease"c; ;;0xe78525c4 const op::multiply = "op::multiply"c; ;;0x6f6bc17a ;; storage variables - -;; id is required to be able to create different instances of counters -;; since addresses in TON depend on the initial state of the contract global int ctx_counter; -;; load_data populates storage variables using stored data () load_data() impure { var ds = get_data().begin_parse(); @@ -19,7 +15,6 @@ global int ctx_counter; ds.end_parse(); } -;; save_data stores storage variables as a cell into persistent storage () save_data() impure { set_data( begin_cell() @@ -28,22 +23,21 @@ global int ctx_counter; ); } -;; recv_internal is the main function of the contract and is called when it receives a message from other contracts () recv_internal(int my_balance, int msg_value, cell in_msg_full, slice in_msg_body) impure { - if (in_msg_body.slice_empty?()) { ;; ignore all empty messages + if (in_msg_body.slice_empty?()) { return (); } slice cs = in_msg_full.begin_parse(); int flags = cs~load_uint(4); - if (flags & 1) { ;; ignore all bounced messages + if (flags & 1) { return (); } - load_data(); ;; here we populate the storage variables + load_data(); - int op = in_msg_body~load_uint(32); ;; by convention, the first 32 bits of incoming message is the op - int query_id = in_msg_body~load_uint(64); ;; also by convention, the next 64 bits contain the "query id", although this is not always the case + int op = in_msg_body~load_uint(32); + int query_id = in_msg_body~load_uint(64); if (op == op::increase) { int increase_by = in_msg_body~load_uint(32); @@ -64,13 +58,9 @@ global int ctx_counter; return (); } - throw(0xffff); ;; if the message contains an op that is not known to this contract, we throw + throw(0xffff); } -;; get methods are a means to conveniently read contract data using, for example, HTTP APIs -;; they are marked with method_id -;; note that unlike in many other smart contract VMs, get methods cannot be called by other contracts - int get_counter() method_id { load_data(); return ctx_counter;