tuweni / org.apache.tuweni.evm / TransactionalEVMHostContext / setStorage

setStorage

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

Set storage function.

This function is used by a VM to update the given account storage entry. The VM MUST make sure that the account exists. This requirement is only a formality because VM implementations only modify storage of the account of the current execution context (i.e. referenced by evmc_message::destination).

Parameters

address - The address of the account.

key - The index of the storage entry.

value - The value to be stored.

Return
The effect on the storage item: The value of a storage item has been left unchanged: 0 -> 0 and X -> X. EVMC_STORAGE_UNCHANGED = 0, The value of a storage item has been modified: X -> Y. EVMC_STORAGE_MODIFIED = 1, A storage item has been modified after being modified before: X -> Y -> Z. EVMC_STORAGE_MODIFIED_AGAIN = 2, A new storage item has been added: 0 -> X. EVMC_STORAGE_ADDED = 3, A storage item has been deleted: X -> 0. EVMC_STORAGE_DELETED = 4