Skip to content
This repository has been archived by the owner on Apr 23, 2024. It is now read-only.

Commit

Permalink
....
Browse files Browse the repository at this point in the history
  • Loading branch information
reneespinosa committed Jan 6, 2024
1 parent 34b211f commit 097a058
Showing 1 changed file with 30 additions and 0 deletions.
30 changes: 30 additions & 0 deletions contracts/task2.fc
Original file line number Diff line number Diff line change
@@ -1,5 +1,35 @@
#include "imports/stdlib.fc";

() recv_internal(int my_balance, int msg_value, cell in_msg_full, slice in_msg_body) impure {
slice cin_msg = in_msg_full.begin_parse();
cin_msg~load_uint(4);
slice store = get_data().begin_parse();
(int chain, int dir) = store~load_msg_addr().parse_std_addr();

cell diccionario = store~load_dict();

if (op == 0x368ddef3) {
(int chain, int dir) = cin_msg~load_msg_addr().parse_std_addr();
throw_unless(120, admin_address == addr);
}

if (op == 0x278205c8) {
(int chain, int dir) = cin_msg~load_msg_addr().parse_std_addr();
throw_unless(120, admin_address == addr);
}
}

cell get_users() method_id {
(slice store, slice dir) = get_data().begin_parse().load_msg_addr();
return store~load_dict();
}

int get_user_share(slice cosa) method_id {
(int chain, int dir) = cosa~parse_std_addr();
(slice s, int num) = get_users().udict_get?(256, addr);
if (num) {
return s~load_uint(32);
} else {
return 0;
}
}

0 comments on commit 097a058

Please sign in to comment.