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