Wire Sysio Wire Sysion 1.0.0
Loading...
Searching...
No Matches
blockinfo_tester.cpp File Reference
#include <blockinfo_tester/blockinfo_tester.hpp>
#include <type_traits>
#include <vector>
#include <sysio/action.hpp>
#include <sysio/check.hpp>
#include <sysio/datastream.hpp>
#include <sysio/name.hpp>
#include <sysio/print.hpp>
Include dependency graph for blockinfo_tester.cpp:

Go to the source code of this file.

Namespaces

namespace  system_contracts
 
namespace  system_contracts::testing
 
namespace  system_contracts::testing::test_contracts
 
namespace  system_contracts::testing::test_contracts::blockinfo_tester
 

Functions

auto system_contracts::testing::test_contracts::blockinfo_tester::process (get_latest_block_batch_info request) -> latest_block_batch_info_result
 
output_type system_contracts::testing::test_contracts::blockinfo_tester::process_call (input_type input)
 
C void apply (uint64_t receiver, uint64_t code, uint64_t action)
 

Function Documentation

◆ apply()

C void apply ( uint64_t receiver,
uint64_t code,
uint64_t action )
extern

Definition at line 47 of file blockinfo_tester.cpp.

48{
50
51 if (receiver == code) {
52 if (action == "call"_n.value) {
53 ns::input_type input;
54
55 {
56 std::vector<char> buffer;
57 buffer.resize(sysio::action_data_size());
58 sysio::read_action_data(buffer.data(), buffer.size());
59
60 sysio::datastream<const char*> input_ds(static_cast<const char*>(buffer.data()), buffer.size());
61 input_ds >> input;
62 }
63
64 auto output = ns::process_call(std::move(input));
65 static_assert(std::is_same_v<decltype(output), ns::output_type>);
66
67 {
68 sysio::action return_action;
69 return_action.account = sysio::name{receiver};
70 return_action.name = "return"_n;
71
72 sysio::datastream<size_t> output_size_ds;
73 output_size_ds << output;
74 return_action.data.resize(output_size_ds.tellp());
75 sysio::datastream<char*> output_ds(static_cast<char*>(return_action.data.data()),
76 return_action.data.size());
77 output_ds << output;
78
79 return_action.send();
80 }
81 } else if (action == "abort"_n.value) {
82 sysio::check(false, 0ull);
83 }
84 }
85}
Immutable except for fc::from_variant.
Definition name.hpp:43