tuweni / org.apache.tuweni.evm / TransactionalEVMHostContext

TransactionalEVMHostContext

class TransactionalEVMHostContext : HostContext (source)

EVM context that records changes to the world state, so they can be applied atomically.

Constructors

<init>

EVM context that records changes to the world state, so they can be applied atomically.

TransactionalEVMHostContext(repository: BlockchainRepository, ethereumVirtualMachine: EthereumVirtualMachine, depth: Int, sender: Address, destination: Address, value: Bytes, code: Bytes, gas: Gas, gasPrice: Wei, currentCoinbase: Address, currentNumber: Long, currentTimestamp: Long, currentGasLimit: Long, currentDifficulty: UInt256)

Properties

accountChanges

val accountChanges: HashMap<Address, HashMap<Bytes, Bytes32>>

accountsToDestroy

val accountsToDestroy: MutableList<Address>

balanceChanges

val balanceChanges: HashMap<Address, Wei>

code

val code: Bytes

currentCoinbase

val currentCoinbase: Address

currentDifficulty

val currentDifficulty: UInt256

currentGasLimit

val currentGasLimit: Long

currentNumber

val currentNumber: Long

currentTimestamp

val currentTimestamp: Long

depth

val depth: Int

destination

val destination: Address

ethereumVirtualMachine

val ethereumVirtualMachine: EthereumVirtualMachine

gas

val gas: Gas

logs

val logs: MutableList<Log>

repository

val repository: BlockchainRepository

sender

val sender: Address

value

val value: Bytes

warmedUpStorage

val warmedUpStorage: HashSet<Bytes>

Functions

accountExists

Check account existence function.

suspend fun accountExists(address: Address): Boolean

call

This function supports EVM calls.

suspend fun call(evmMessage: EVMMessage): EVMResult

emitLog

Log function.

fun emitLog(address: Address, data: Bytes, topics: List<Bytes32>): Unit

getBalance

Get balance function.

suspend fun getBalance(address: Address): Wei

getBlockHash

Get block hash function.

fun getBlockHash(number: Long): Bytes32fun getBlockHash(): Bytes32

getBlockNumber

fun getBlockNumber(): Long

getCode

Copy code function.

suspend fun getCode(address: Address): Bytes

getCodeHash

Get code hash function.

suspend fun getCodeHash(address: Address): Bytes32

getCodeSize

Get code size function.

suspend fun getCodeSize(address: Address): Int

getCoinbase

fun getCoinbase(): Address

getDifficulty

fun getDifficulty(): UInt256

getGasLimit

fun getGasLimit(): Long

getGasPrice

Provides the gas price of the transaction.

fun getGasPrice(): Wei

getRepositoryStorage

Get repository storage function.

suspend fun getRepositoryStorage(address: Address, keyBytes: Bytes): Bytes32

getStorage

Get storage function.

suspend fun getStorage(address: Address, key: Bytes32): Bytes32

getTxContext

Get transaction context function.

fun getTxContext(): Bytes?

increaseBalance

fun increaseBalance(address: Address, amount: Wei): Unit

selfdestruct

Selfdestruct function.

suspend fun selfdestruct(address: Address, beneficiary: Address): Unit

setBalance

suspend fun setBalance(address: Address, balance: Wei): Unit

setStorage

Set storage function.

suspend fun setStorage(address: Address, key: Bytes, value: Bytes32): Int

timestamp

Provides the timestamp of the transaction

fun timestamp(): UInt256

warmUpAccount

Returns true if the account was never used.

fun warmUpAccount(address: Address): Boolean

warmUpStorage

Returns true if the storage slot was never used.

fun warmUpStorage(address: Address, key: UInt256): Boolean