1
0
Fork 0
mirror of https://github.com/ton-blockchain/ton synced 2025-03-09 15:40:10 +00:00

updated smartcontract code

updated lite-client and configuration smartcontract
updated tonlib code
This commit is contained in:
ton 2019-09-16 12:06:04 +04:00
parent 8e5bd938aa
commit bce33f588a
46 changed files with 677 additions and 299 deletions

View file

@ -50,6 +50,7 @@
#include "td/utils/port/Stat.h"
#include "td/utils/Timer.h"
#include "td/utils/tl_helpers.h"
#include "td/utils/crypto.h"
#include <ctime>
@ -704,6 +705,10 @@ void interpret_int_to_bytes(vm::Stack& stack, bool sgnd, bool lsb) {
stack.push_bytes(std::string{(char*)buffer, sz});
}
void interpret_string_to_bytes(vm::Stack& stack) {
stack.push_bytes(stack.pop_string());
}
void interpret_bytes_hash(vm::Stack& stack) {
std::string str = stack.pop_bytes();
unsigned char buffer[32];
@ -1306,6 +1311,21 @@ void interpret_ed25519_chksign(vm::Stack& stack) {
stack.push_bool(res.is_ok());
}
void interpret_crc16(vm::Stack& stack) {
std::string str = stack.pop_bytes();
stack.push_smallint(td::crc16(td::Slice{str}));
}
void interpret_crc32(vm::Stack& stack) {
std::string str = stack.pop_bytes();
stack.push_smallint(td::crc32(td::Slice{str}));
}
void interpret_crc32c(vm::Stack& stack) {
std::string str = stack.pop_bytes();
stack.push_smallint(td::crc32c(td::Slice{str}));
}
// vm dictionaries
void interpret_dict_new(vm::Stack& stack) {
stack.push({});
@ -2427,6 +2447,7 @@ void init_words_common(Dictionary& d) {
d.def_stack_word("B>Li@ ", std::bind(interpret_bytes_fetch_int, _1, 0x11));
d.def_stack_word("B>Lu@+ ", std::bind(interpret_bytes_fetch_int, _1, 0x12));
d.def_stack_word("B>Li@+ ", std::bind(interpret_bytes_fetch_int, _1, 0x13));
d.def_stack_word("$>B ", interpret_string_to_bytes);
d.def_stack_word("Bhash ", interpret_bytes_hash);
// cell manipulation (create, write and modify cells)
d.def_stack_word("<b ", interpret_empty);
@ -2493,6 +2514,9 @@ void init_words_common(Dictionary& d) {
d.def_stack_word("ed25519_sign ", interpret_ed25519_sign);
d.def_stack_word("ed25519_chksign ", interpret_ed25519_chksign);
d.def_stack_word("ed25519_sign_uint ", interpret_ed25519_sign_uint);
d.def_stack_word("crc16 ", interpret_crc16);
d.def_stack_word("crc32 ", interpret_crc32);
d.def_stack_word("crc32c ", interpret_crc32c);
// vm dictionaries
d.def_stack_word("dictnew ", interpret_dict_new);
d.def_stack_word("dict>s ", interpret_dict_to_slice);