A problem with parsing the commentaries
Парсинг комментариев
For some reason I can't parse commentary that I receive in a transaction. This commentary is specified when sending ton coins from a wallet to a smart contract.
Here is the code of the contract:
```func
int balance() inline_ref method_id {
return get_balance().pair_first();
}
(int) load_data() inline {
var ds = get_data().begin_parse();
return (ds~load_uint(8));
}
int test() method_id {
var (test) = load_data();
return test;
}
() recv_internal (int msg_value, cell in_msg_full, slice in_msg) impure {
int op = in_msg~load_uint(32);
if (op == 0) {
int kek = in_msg~load_uint(8);
set_data(begin_cell().store_uint(kek, 8).end_cell());
}
}
```
When I call the `test`getter I always get 0. I know about the unicode encoding, I've tried to load different size from in_msg.
What can cause the problem?
Добрый день!
Не понимаю почему не получается распарсить комментарий, который приходит в транзакции
Комментарий указаывается при отправке граммов с кошелька на смартконтракт.
Прикладываю код смартконтракта:
```
int balance() inline_ref method_id {
return get_balance().pair_first();
}
(int) load_data() inline {
var ds = get_data().begin_parse();
return (ds~load_uint(8));
}
int test() method_id {
var (test) = load_data();
return test;
}
() recv_internal (int msg_value, cell in_msg_full, slice in_msg) impure {
int op = in_msg~load_uint(32);
if (op == 0) {
int kek = in_msg~load_uint(8);
set_data(begin_cell().store_uint(kek, 8).end_cell());
}
}
```
Вызывая геттер test, всегда получаю 0.
про кодирование unicode знаю, пробовал разный размер грузить из in_msg.
Буду благодарен за помощь
#
Парсинг комментариев
Добрый день!
Не понимаю почему не получается распарсить комментарий, который приходит в транзакции
Комментарий указаывается при отправке граммов с кошелька на смартконтракт.
Прикладываю код смартконтракта:
```
int balance() inline_ref method_id {
return get_balance().pair_first();
}
(int) load_data() inline {
var ds = get_data().begin_parse();
return (ds~load_uint(8));
}
int test() method_id {
var (test) = load_data();
return test;
}
() recv_internal (int msg_value, cell in_msg_full, slice in_msg) impure {
int op = in_msg~load_uint(32);
if (op == 0) {
int kek = in_msg~load_uint(8);
set_data(begin_cell().store_uint(kek, 8).end_cell());
}
}
```
Вызывая геттер test, всегда получаю 0.
про кодирование unicode знаю, пробовал разный размер грузить из in_msg.
Буду благодарен за помощь