Module utils

Module utils 

Source
Expand description

Uncategorised utilities.

Statics§

BYTECODE_PLACEHOLDER_RE 🔒

Functions§

block_on
Block on a future using the current tokio runtime on the current thread.
block_on_handle
Block on a future using the current tokio runtime on the current thread with the given handle.
erc7201
Computes the storage slot as specified by ERC-7201, using the erc7201 formula ID.
find_metadata_start
Utility function to find the start of the metadata in the bytecode. This assumes that the metadata is at the end of the bytecode.
flatten
Flattens the given target of the project. Falls back to the old flattening implementation if the target cannot be compiled successfully. This would be the case if the target has invalid syntax. (e.g. Solang)
ignore_metadata_hash
Utility function to ignore metadata hash of the given bytecode. This assumes that the metadata is at the end of the bytecode.
strip_bytecode_placeholders
Strips all $xxx$ placeholders from the bytecode if it’s an unlinked bytecode. by replacing them with 20 zero bytes. This is useful for matching bytecodes to a contract source, and for the source map, in which the actual address of the placeholder isn’t important.