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

bugfixes + tonlib update

This commit is contained in:
ton 2020-04-30 15:04:47 +04:00
parent 2f81361a02
commit eecf05ca59
35 changed files with 734 additions and 193 deletions

View file

@ -817,7 +817,7 @@ cap_name#ff name:Text = SmcCapability;
//
chan_config$_ init_timeout:uint32 close_timeout:uint32 a_key:bits256 b_key:bits256
a_addr:^MsgAddressInt b_addr:^MsgAddressInt channel_id:uint64 = ChanConfig;
a_addr:^MsgAddressInt b_addr:^MsgAddressInt channel_id:uint64 min_A_extra:Grams = ChanConfig;
chan_state_init$000 signed_A:Bool signed_B:Bool min_A:Grams min_B:Grams expire_at:uint32 A:Grams B:Grams = ChanState;
chan_state_close$001 signed_A:Bool signed_B:Bool promise_A:Grams promise_B:Grams expire_at:uint32 A:Grams B:Grams = ChanState;
@ -829,8 +829,12 @@ chan_signed_promise#_ sig:(Maybe ^bits512) promise:ChanPromise = ChanSignedPromi
chan_msg_init#27317822 inc_A:Grams inc_B:Grams min_A:Grams min_B:Grams channel_id:uint64 = ChanMsg;
chan_msg_close#f28ae183 extra_A:Grams extra_B:Grams promise:ChanSignedPromise = ChanMsg;
chan_msg_timeout#43278a28 = ChanMsg;
chan_msg_payout#37fe7810 = ChanMsg;
chan_signed_msg$_ sig_A:(Maybe ^bits512) sig_B:(Maybe ^bits512) msg:ChanMsg = ChanSignedMsg;
chan_op_cmd#912838d1 msg:ChanSignedMsg = ChanOp;
chan_data$_ config:^ChanConfig state:^ChanState = ChanData;

View file

@ -61,8 +61,8 @@
#include "mc-config.h"
#if defined(_INTERNAL_COMPILE) || defined(_TONLIB_COMPILE)
# define WITH_TONLIB
# include "tonlib/keys/Mnemonic.h"
#define WITH_TONLIB
#include "tonlib/keys/Mnemonic.h"
#endif
#define PDO(__op) \
@ -271,6 +271,10 @@ td::RefInt256 create_smartcontract(td::RefInt256 smc_addr, Ref<vm::Cell> code, R
PDO(sgn(balance) >= 0);
THRERR("balance cannot be negative");
if (!mode) {
if (verbosity > 2) {
std::cerr << "StateInit used for computing address: ";
block::gen::t_StateInit.print_ref(std::cerr, state_init);
}
return smc_addr; // compute address only
}
auto it = smart_contracts.find(addr);
@ -651,6 +655,10 @@ void interpret_sub_extra_currencies(vm::Stack& stack) {
stack.push_bool(ok);
}
void interpret_allocated_balance(vm::Stack& stack) {
stack.push_int(total_smc_balance);
}
#ifdef WITH_TONLIB
void interpret_mnemonic_to_privkey(vm::Stack& stack, int mode) {
td::SecureString str{td::Slice{stack.pop_string()}};
@ -689,6 +697,7 @@ void init_words_custom(fift::Dictionary& d) {
d.def_stack_word("isWorkchainDescr? ", interpret_is_workchain_descr);
d.def_stack_word("CC+? ", interpret_add_extra_currencies);
d.def_stack_word("CC-? ", interpret_sub_extra_currencies);
d.def_stack_word("allocated-balance ", interpret_allocated_balance);
#ifdef WITH_TONLIB
d.def_stack_word("mnemo>priv ", std::bind(interpret_mnemonic_to_privkey, _1, 0));
d.def_stack_word("mnemo>pub ", std::bind(interpret_mnemonic_to_privkey, _1, 1));