 |
Ethereum
PoC-8
The C++ Implementation of Ethereum
|
Go to the documentation of this file.
30 #include <evmc/evmc.h>
31 #include <evmc/helpers.h>
33 #include <boost/optional.hpp>
66 m_bytes(
std::move(_bytes))
82 return std::move(m_bytes);
112 class LastBlockHashesFace;
146 m_headerInfo(_current),
152 EnvInfo(_current, _lh, _gasUsed)
209 unsigned _depth,
bool _isCreate,
bool _staticCall);
283 return reinterpret_cast<evmc_address const&
>(_addr);
288 return reinterpret_cast<evmc_uint256be const&
>(_h);
293 return fromBigEndian<u256>(_n.bytes);
298 return reinterpret_cast<Address const&
>(_addr);
std::function< void(uint64_t, uint64_t, Instruction, bigint, bigint, bigint, VMFace const *, ExtVMFace const *)> OnOpFunc
EnvInfo(BlockHeader const &_current, LastBlockHashesFace const &_lh, u256 const &_gasUsed)
u256 salt
Values used in new address construction by CREATE2.
virtual void suicide(Address)
Suicide the associated contract and give proceeds to the given address.
owning_bytes_ref()=default
SubState sub
Sub-band VM state (suicides, refund counter, logs).
BlockHeader const & header() const
virtual u256 balance(Address)
Read address's balance.
int64_t refunds
Refund counter for storage changes.
h256 codeHash
SHA3 hash of the executing code.
Address const & author() const
owning_bytes_ref(bytes &&_bytes, size_t _begin, size_t _size)
u256 fromEvmC(evmc_uint256be const &_n)
owning_bytes_ref(owning_bytes_ref &&)=default
EVM Virtual Machine interface.
Interface and null implementation of the class for specifying VM externalities.
virtual void log(h256s &&_topics, bytesConstRef _data)
Revert any changes made (by any of the other calls).
CallResult(evmc_status_code status, owning_bytes_ref &&output)
evmc_address toEvmC(Address const &_addr)
virtual CreateResult create(u256, u256 &, bytesConstRef, Instruction, u256, OnOpFunc const &)=0
Create a new (contract) account.
virtual u256 store(u256)
Read storage location.
u256 const & difficulty() const
virtual bool exists(Address)
Does the account exist?
virtual void setStore(u256, u256)
Write a value in storage.
Address myAddress
Address associated with executing code (a contract, or contract-to-be).
bytes code
Current code that is executing.
u256 gasPrice
Price of gas (that we already paid).
bool isCreate
Is this a CREATE call?
std::vector< h256 > h256s
ExtVMFace(EnvInfo const &_envInfo, Address _myAddress, Address _caller, Address _origin, u256 _value, u256 _gasPrice, bytesConstRef _data, bytes _code, h256 const &_codeHash, unsigned _depth, bool _isCreate, bool _staticCall)
Full constructor.
u256 const & gasUsed() const
unsigned depth
Depth of the present call.
std::vector< LogEntry > LogEntries
bool staticCall
Throw on state changing.
std::vector< byte > bytes
int64_t timestamp() const
LastBlockHashesFace const & lastHashes() const
ExtVMFace & operator=(ExtVMFace const &)=delete
bytes && takeBytes()
Moves the bytes vector out of here. The object cannot be used any more.
virtual h256 blockHash(u256 _number)=0
Hash of a block if within the last 256 blocks, or h256() otherwise.
owning_bytes_ref & operator=(owning_bytes_ref const &)=delete
owning_bytes_ref(owning_bytes_ref const &)=delete
u256 value
Value (in Wei) that was passed to this address.
std::set< Address > suicides
Any accounts that have suicided.
virtual ~ExtVMFace()=default
virtual h256 codeHashAt(Address)
Instruction
Virtual machine bytecode instruction.
void retarget(byte const *_d, size_t _s)
boost::multiprecision::number< boost::multiprecision::cpp_int_backend<> > bigint
Address caller
Address which sent the message (either equal to origin or a contract).
SubState & operator+=(SubState const &_s)
ExtVMFace(ExtVMFace const &)=delete
u256 const & gasLimit() const
virtual EVMSchedule const & evmSchedule() const
Return the EVM gas-price schedule for this execution context.
virtual CallResult call(CallParameters &)=0
Make a new message call.
std::vector< unsigned char > toBytes() const
virtual bytes const & codeAt(Address)
Read address's code.
boost::multiprecision::number< boost::multiprecision::cpp_int_backend< 256, 256, boost::multiprecision::unsigned_magnitude, boost::multiprecision::unchecked, void > > u256
bytesConstRef data
Current input data.
owning_bytes_ref & operator=(owning_bytes_ref &&)=default
EnvInfo const & envInfo() const
Get the execution environment information.
virtual size_t codeSizeAt(Address)
CreateResult(evmc_status_code status, owning_bytes_ref &&output, h160 const &address)
Interface for getting a list of recent block hashes @threadsafe.
CallParameters(Address _senderAddress, Address _codeAddress, Address _receiveAddress, u256 _valueTransfer, u256 _apparentValue, u256 _gas, bytesConstRef _data, OnOpFunc _onOpFunc)
virtual u256 originalStorageValue(u256 const &)
Read original storage value (before modifications in the current transaction).
EnvInfo(BlockHeader const &_current, LastBlockHashesFace const &_lh, u256 const &_gasUsed, u256 const &_gasLimit)
Address origin
Original transactor.