Skip to content

Commit

Permalink
remove useless comments arithmetic contract
Browse files Browse the repository at this point in the history
  • Loading branch information
fabcotech committed Jul 15, 2024
1 parent 80a34cd commit be18272
Showing 1 changed file with 6 additions and 16 deletions.
22 changes: 6 additions & 16 deletions contracts/arithmetic.fc
Original file line number Diff line number Diff line change
Expand Up @@ -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();

Expand All @@ -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()
Expand All @@ -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);
Expand All @@ -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;
Expand Down

0 comments on commit be18272

Please sign in to comment.