examples: Update example host with usage of evmc::literals

This commit is contained in:
Paweł Bylica 2019-07-22 17:30:42 +02:00
parent c358c4a024
commit 8e5056aef0
No known key found for this signature in database
GPG Key ID: 7A0C037434FE77EF
1 changed files with 6 additions and 5 deletions

View File

@ -12,6 +12,8 @@
#include <map>
using namespace evmc::literals;
struct account
{
evmc::uint256be balance = {};
@ -108,12 +110,11 @@ public:
evmc_bytes32 get_block_hash(int64_t number) noexcept final
{
int64_t current_block_number = get_tx_context().block_number;
const int64_t current_block_number = get_tx_context().block_number;
auto example_block_hash = evmc::bytes32{};
if (number < current_block_number && number >= current_block_number - 256)
example_block_hash = evmc::bytes32{{{1, 1, 1, 1}}};
return example_block_hash;
return (number < current_block_number && number >= current_block_number - 256) ?
0xb10c8a5fb10c8a5fb10c8a5fb10c8a5fb10c8a5fb10c8a5fb10c8a5fb10c8a5f_b32 :
0_b32;
}
void emit_log(const evmc_address& addr,