1
0
Fork 0
mirror of https://github.com/ton-blockchain/ton synced 2025-02-12 11:12:16 +00:00

Add extra currencies to c7 in tonlib runGetMethod

This commit is contained in:
SpyCheese 2025-01-13 17:39:56 +03:00
parent 46d4e12b4c
commit dc2f0dad81
3 changed files with 28 additions and 19 deletions

View file

@ -149,16 +149,17 @@ td::Ref<vm::Tuple> prepare_vm_c7(SmartContract::Args args, td::Ref<vm::Cell> cod
}
std::vector<vm::StackEntry> tuple = {
td::make_refint(0x076ef1ea), // [ magic:0x076ef1ea
td::make_refint(0), // actions:Integer
td::make_refint(0), // msgs_sent:Integer
td::make_refint(now), // unixtime:Integer
td::make_refint(0), //TODO: // block_lt:Integer
td::make_refint(0), //TODO: // trans_lt:Integer
std::move(rand_seed_int), // rand_seed:Integer
block::CurrencyCollection(args.balance).as_vm_tuple(), // balance_remaining:[Integer (Maybe Cell)]
vm::load_cell_slice_ref(address), // myself:MsgAddressInt
vm::StackEntry::maybe(config) // vm::StackEntry::maybe(td::Ref<vm::Cell>())
td::make_refint(0x076ef1ea), // [ magic:0x076ef1ea
td::make_refint(0), // actions:Integer
td::make_refint(0), // msgs_sent:Integer
td::make_refint(now), // unixtime:Integer
td::make_refint(0), // block_lt:Integer (TODO)
td::make_refint(0), // trans_lt:Integer (TODO)
std::move(rand_seed_int), // rand_seed:Integer
block::CurrencyCollection(args.balance, args.extra_currencies)
.as_vm_tuple(), // balance_remaining:[Integer (Maybe Cell)]
vm::load_cell_slice_ref(address), // myself:MsgAddressInt
vm::StackEntry::maybe(config) // vm::StackEntry::maybe(td::Ref<vm::Cell>())
};
if (args.config && args.config.value()->get_global_version() >= 4) {
tuple.push_back(vm::StackEntry::maybe(code)); // code:Cell

View file

@ -64,6 +64,7 @@ class SmartContract : public td::CntObject {
bool ignore_chksig{false};
td::uint64 amount{0};
td::uint64 balance{0};
td::Ref<vm::Cell> extra_currencies;
int vm_log_verbosity_level{0};
bool debug_enabled{false};
@ -121,6 +122,10 @@ class SmartContract : public td::CntObject {
this->balance = balance;
return std::move(*this);
}
Args&& set_extra_currencies(td::Ref<vm::Cell> extra_currencies) {
this->extra_currencies = std::move(extra_currencies);
return std::move(*this);
}
Args&& set_address(block::StdAddress address) {
this->address = address;
return std::move(*this);

View file

@ -1050,15 +1050,17 @@ class Query {
}
vm::GasLimits gas_limits = compute_gas_limits(td::make_refint(raw_.source->get_balance()), gas_limits_prices);
auto res = smc.write().send_external_message(raw_.message_body, ton::SmartContract::Args()
.set_limits(gas_limits)
.set_balance(raw_.source->get_balance())
.set_now(raw_.source->get_sync_time())
.set_ignore_chksig(ignore_chksig)
.set_address(raw_.source->get_address())
.set_config(cfg)
.set_prev_blocks_info(state.prev_blocks_info)
.set_libraries(libraries));
auto res = smc.write().send_external_message(raw_.message_body,
ton::SmartContract::Args()
.set_limits(gas_limits)
.set_balance(raw_.source->get_balance())
.set_extra_currencies(raw_.source->get_extra_currencies())
.set_now(raw_.source->get_sync_time())
.set_ignore_chksig(ignore_chksig)
.set_address(raw_.source->get_address())
.set_config(cfg)
.set_prev_blocks_info(state.prev_blocks_info)
.set_libraries(libraries));
td::int64 fwd_fee = 0;
if (res.success) {
LOG(DEBUG) << "output actions:\n"
@ -4790,6 +4792,7 @@ td::Status TonlibClient::do_request(const tonlib_api::smc_runGetMethod& request,
}
args.set_stack(std::move(stack));
args.set_balance(it->second->get_balance());
args.set_extra_currencies(it->second->get_extra_currencies());
args.set_now(it->second->get_sync_time());
args.set_address(it->second->get_address());