Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

StateChanges

Git Source

Inherits: Credible

Title: StateChanges

Helper contract for converting state changes from bytes32 arrays to typed arrays

Inherits from Credible to access the PhEvm interface

Functions

getStateChangesUint

Converts state changes for a slot to uint256 array

function getStateChangesUint(address contractAddress, bytes32 slot) internal view returns (uint256[] memory);

Parameters

NameTypeDescription
contractAddressaddressThe address of the contract to get state changes from
slotbytes32The storage slot to get state changes for

Returns

NameTypeDescription
<none>uint256[]Array of state changes as uint256 values

getStateChangesAddress

Converts state changes for a slot to address array

function getStateChangesAddress(address contractAddress, bytes32 slot) internal view returns (address[] memory);

Parameters

NameTypeDescription
contractAddressaddressThe address of the contract to get state changes from
slotbytes32The storage slot to get state changes for

Returns

NameTypeDescription
<none>address[]Array of state changes as address values

getStateChangesBool

Converts state changes for a slot to boolean array

function getStateChangesBool(address contractAddress, bytes32 slot) internal view returns (bool[] memory);

Parameters

NameTypeDescription
contractAddressaddressThe address of the contract to get state changes from
slotbytes32The storage slot to get state changes for

Returns

NameTypeDescription
<none>bool[]Array of state changes as boolean values

getStateChangesBytes32

Gets raw state changes as bytes32 array

function getStateChangesBytes32(address contractAddress, bytes32 slot) internal view returns (bytes32[] memory);

Parameters

NameTypeDescription
contractAddressaddressThe address of the contract to get state changes from
slotbytes32The storage slot to get state changes for

Returns

NameTypeDescription
<none>bytes32[]Array of state changes as bytes32 values

getSlotMapping

Calculates the storage slot for a mapping with a given key and offset

function getSlotMapping(bytes32 slot, uint256 key, uint256 offset) private pure returns (bytes32);

Parameters

NameTypeDescription
slotbytes32The base storage slot of the mapping
keyuint256The key in the mapping
offsetuint256Additional offset to add to the calculated slot

Returns

NameTypeDescription
<none>bytes32The storage slot for the mapping entry

getStateChangesUint

Gets uint256 state changes for a mapping entry

function getStateChangesUint(address contractAddress, bytes32 slot, uint256 key)
    internal
    view
    returns (uint256[] memory);

Parameters

NameTypeDescription
contractAddressaddressThe contract address
slotbytes32The mapping's slot
keyuint256The mapping key

Returns

NameTypeDescription
<none>uint256[]Array of state changes as uint256 values

getStateChangesAddress

Gets address state changes for a mapping entry

function getStateChangesAddress(address contractAddress, bytes32 slot, uint256 key)
    internal
    view
    returns (address[] memory);

Parameters

NameTypeDescription
contractAddressaddressThe contract address
slotbytes32The mapping's slot
keyuint256The mapping key

Returns

NameTypeDescription
<none>address[]Array of state changes as address values

getStateChangesBool

Gets boolean state changes for a mapping entry

function getStateChangesBool(address contractAddress, bytes32 slot, uint256 key)
    internal
    view
    returns (bool[] memory);

Parameters

NameTypeDescription
contractAddressaddressThe contract address
slotbytes32The mapping's slot
keyuint256The mapping key

Returns

NameTypeDescription
<none>bool[]Array of state changes as boolean values

getStateChangesBytes32

Gets bytes32 state changes for a mapping entry

function getStateChangesBytes32(address contractAddress, bytes32 slot, uint256 key)
    internal
    view
    returns (bytes32[] memory);

Parameters

NameTypeDescription
contractAddressaddressThe contract address
slotbytes32The mapping's slot
keyuint256The mapping key

Returns

NameTypeDescription
<none>bytes32[]Array of state changes as bytes32 values

getStateChangesUint

Gets uint256 state changes for a mapping entry with offset

function getStateChangesUint(address contractAddress, bytes32 slot, uint256 key, uint256 slotOffset)
    internal
    view
    returns (uint256[] memory);

Parameters

NameTypeDescription
contractAddressaddressThe contract address
slotbytes32The mapping's slot
keyuint256The mapping key
slotOffsetuint256Additional offset to add to the slot

Returns

NameTypeDescription
<none>uint256[]Array of state changes as uint256 values

getStateChangesAddress

Gets address state changes for a mapping entry with offset

function getStateChangesAddress(address contractAddress, bytes32 slot, uint256 key, uint256 slotOffset)
    internal
    view
    returns (address[] memory);

Parameters

NameTypeDescription
contractAddressaddressThe contract address
slotbytes32The mapping's slot
keyuint256The mapping key
slotOffsetuint256Additional offset to add to the slot

Returns

NameTypeDescription
<none>address[]Array of state changes as address values

getStateChangesBool

Gets boolean state changes for a mapping entry with offset

function getStateChangesBool(address contractAddress, bytes32 slot, uint256 key, uint256 slotOffset)
    internal
    view
    returns (bool[] memory);

Parameters

NameTypeDescription
contractAddressaddressThe contract address
slotbytes32The mapping's slot
keyuint256The mapping key
slotOffsetuint256Additional offset to add to the slot

Returns

NameTypeDescription
<none>bool[]Array of state changes as boolean values

getStateChangesBytes32

Gets bytes32 state changes for a mapping entry with offset

function getStateChangesBytes32(address contractAddress, bytes32 slot, uint256 key, uint256 slotOffset)
    internal
    view
    returns (bytes32[] memory);

Parameters

NameTypeDescription
contractAddressaddressThe contract address
slotbytes32The mapping's slot
keyuint256The mapping key
slotOffsetuint256Additional offset to add to the slot

Returns

NameTypeDescription
<none>bytes32[]Array of state changes as bytes32 values