Skip to content

Instantly share code, notes, and snippets.

@Datswishty
Created December 6, 2022 12:47
Show Gist options
  • Save Datswishty/736040793a5c12b14d1deb2a74392cb9 to your computer and use it in GitHub Desktop.
Save Datswishty/736040793a5c12b14d1deb2a74392cb9 to your computer and use it in GitHub Desktop.
#include "stdlib.fc";
() recv_internal(slice in_msg_body) impure {
throw_if(35,in_msg_body.slice_bits() < 32);
int n = in_msg_body~load_uint(32);
slice ds = get_data().begin_parse();
int total = ds~load_uint(64);
total += n;
set_data(begin_cell().store_uint(total, 64).end_cell());
}
;; testable
int get_total() method_id {
slice ds = get_data().begin_parse();
int total = ds~load_uint(64);
return total;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment