mirror of
https://github.com/ton-blockchain/ton
synced 2025-03-09 15:40:10 +00:00
updated vm
- updated func/fift - additional checks in block validator - docs - tunnel prototype in ADNL
This commit is contained in:
parent
ba76f1404e
commit
54c7a4dcc3
50 changed files with 972 additions and 300 deletions
|
@ -14,7 +14,7 @@
|
|||
You should have received a copy of the GNU Lesser General Public License
|
||||
along with TON Blockchain Library. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
Copyright 2017-2019 Telegram Systems LLP
|
||||
Copyright 2017-2020 Telegram Systems LLP
|
||||
*/
|
||||
#include "GenericAccount.h"
|
||||
|
||||
|
@ -96,4 +96,19 @@ td::Ref<vm::Cell> GenericAccount::create_ext_message(const block::StdAddress& ad
|
|||
|
||||
return res;
|
||||
}
|
||||
td::Result<td::Ed25519::PublicKey> GenericAccount::get_public_key(const SmartContract& sc) {
|
||||
auto answer = sc.run_get_method("get_public_key");
|
||||
if (!answer.success) {
|
||||
return td::Status::Error("get_public_key failed");
|
||||
}
|
||||
auto do_get_public_key = [&]() -> td::Result<td::Ed25519::PublicKey> {
|
||||
auto key = answer.stack.write().pop_int_finite();
|
||||
td::SecureString bytes(32);
|
||||
if (!key->export_bytes(bytes.as_mutable_slice().ubegin(), bytes.size(), false)) {
|
||||
return td::Status::Error("get_public_key failed");
|
||||
}
|
||||
return td::Ed25519::PublicKey(std::move(bytes));
|
||||
};
|
||||
return TRY_VM(do_get_public_key());
|
||||
}
|
||||
} // namespace ton
|
||||
|
|
|
@ -14,11 +14,14 @@
|
|||
You should have received a copy of the GNU Lesser General Public License
|
||||
along with TON Blockchain Library. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
Copyright 2017-2019 Telegram Systems LLP
|
||||
Copyright 2017-2020 Telegram Systems LLP
|
||||
*/
|
||||
#pragma once
|
||||
#include "vm/cells.h"
|
||||
#include "block/block.h"
|
||||
#include "Ed25519.h"
|
||||
#include "SmartContract.h"
|
||||
|
||||
namespace ton {
|
||||
class GenericAccount {
|
||||
public:
|
||||
|
@ -27,5 +30,7 @@ class GenericAccount {
|
|||
static td::Ref<vm::Cell> create_ext_message(const block::StdAddress& address, td::Ref<vm::Cell> new_state,
|
||||
td::Ref<vm::Cell> body) noexcept;
|
||||
static void store_int_message(vm::CellBuilder& cb, const block::StdAddress& dest_address, td::int64 gramms);
|
||||
|
||||
static td::Result<td::Ed25519::PublicKey> get_public_key(const SmartContract& sc);
|
||||
};
|
||||
} // namespace ton
|
||||
|
|
|
@ -26,7 +26,7 @@
|
|||
#include "vm/cells/CellString.h"
|
||||
|
||||
namespace ton {
|
||||
class HighloadWallet : ton::SmartContract, public WalletInterface {
|
||||
class HighloadWallet : public ton::SmartContract, public WalletInterface {
|
||||
public:
|
||||
explicit HighloadWallet(State state) : ton::SmartContract(std::move(state)) {
|
||||
}
|
||||
|
|
|
@ -26,7 +26,7 @@
|
|||
#include "vm/cells/CellString.h"
|
||||
|
||||
namespace ton {
|
||||
class HighloadWalletV2 : ton::SmartContract, public WalletInterface {
|
||||
class HighloadWalletV2 : public ton::SmartContract, public WalletInterface {
|
||||
public:
|
||||
explicit HighloadWalletV2(State state) : ton::SmartContract(std::move(state)) {
|
||||
}
|
||||
|
|
|
@ -26,7 +26,7 @@
|
|||
#include "vm/cells/CellString.h"
|
||||
|
||||
namespace ton {
|
||||
class Wallet : ton::SmartContract, public WalletInterface {
|
||||
class Wallet : public ton::SmartContract, public WalletInterface {
|
||||
public:
|
||||
explicit Wallet(State state) : ton::SmartContract(std::move(state)) {
|
||||
}
|
||||
|
|
|
@ -45,7 +45,7 @@ class WalletInterface {
|
|||
virtual td::Result<td::Ref<vm::Cell>> make_a_gift_message(const td::Ed25519::PrivateKey &private_key,
|
||||
td::uint32 valid_until, td::Span<Gift> gifts) const = 0;
|
||||
virtual td::Result<td::Ed25519::PublicKey> get_public_key() const {
|
||||
return td::Status::Error("TODO");
|
||||
return td::Status::Error("Unsupported");
|
||||
}
|
||||
|
||||
td::Result<td::Ref<vm::Cell>> get_init_message(const td::Ed25519::PrivateKey &private_key,
|
||||
|
|
|
@ -26,7 +26,7 @@
|
|||
#include "vm/cells/CellString.h"
|
||||
|
||||
namespace ton {
|
||||
class WalletV3 : ton::SmartContract, public WalletInterface {
|
||||
class WalletV3 : public ton::SmartContract, public WalletInterface {
|
||||
public:
|
||||
explicit WalletV3(State state) : ton::SmartContract(std::move(state)) {
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue