-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #547 from eosnetworkfoundation/elmato/yield-plus-i…
…ntegration Add read-only transaction execution support to EVM contract
- Loading branch information
Showing
15 changed files
with
503 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
46 changes: 46 additions & 0 deletions
46
contract/tests/contracts/evm_read_callback/evm_read_callback.abi
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
{ | ||
"____comment": "This file was generated with eosio-abigen. DO NOT EDIT ", | ||
"version": "eosio::abi/1.2", | ||
"types": [], | ||
"structs": [ | ||
{ | ||
"name": "callback", | ||
"base": "", | ||
"fields": [ | ||
{ | ||
"name": "output", | ||
"type": "exec_output" | ||
} | ||
] | ||
}, | ||
{ | ||
"name": "exec_output", | ||
"base": "", | ||
"fields": [ | ||
{ | ||
"name": "status", | ||
"type": "int32" | ||
}, | ||
{ | ||
"name": "data", | ||
"type": "bytes" | ||
}, | ||
{ | ||
"name": "context", | ||
"type": "bytes?" | ||
} | ||
] | ||
} | ||
], | ||
"actions": [ | ||
{ | ||
"name": "callback", | ||
"type": "callback", | ||
"ricardian_contract": "" | ||
} | ||
], | ||
"tables": [], | ||
"ricardian_clauses": [], | ||
"variants": [], | ||
"action_results": [] | ||
} |
8 changes: 8 additions & 0 deletions
8
contract/tests/contracts/evm_read_callback/evm_read_callback.cpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
#include "evm_read_callback.hpp" | ||
ACTION evm_read_callback::callback( const exec_output& output ) { | ||
output_table outputs(get_self(), get_self().value); | ||
outputs.emplace(get_self(), [&](auto& row){ | ||
row.id = outputs.available_primary_key(); | ||
row.output = output; | ||
}); | ||
} |
33 changes: 33 additions & 0 deletions
33
contract/tests/contracts/evm_read_callback/evm_read_callback.hpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
#include <eosio/eosio.hpp> | ||
using namespace eosio; | ||
|
||
typedef std::vector<uint8_t> bytes; | ||
|
||
struct exec_output { | ||
int32_t status; | ||
bytes data; | ||
std::optional<bytes> context; | ||
|
||
EOSLIB_SERIALIZE(exec_output, (status)(data)(context)); | ||
}; | ||
|
||
struct exec_output_row { | ||
uint64_t id; | ||
exec_output output; | ||
|
||
uint64_t primary_key()const { | ||
return id; | ||
} | ||
|
||
|
||
EOSLIB_SERIALIZE(exec_output_row, (id)(output)); | ||
}; | ||
|
||
typedef multi_index<"output"_n, exec_output_row> output_table; | ||
|
||
CONTRACT evm_read_callback : public contract { | ||
public: | ||
using contract::contract; | ||
|
||
ACTION callback( const exec_output& output ); | ||
}; |
Binary file not shown.
Oops, something went wrong.