Module utils

Source
Expand description

Utility functions

Constants§

BERLIN_SOLC
Berlin support https://blog.soliditylang.org/2021/06/10/solidity-0.8.5-release-announcement/
BYZANTIUM_SOLC
Support for configuring the EVM version https://blog.soliditylang.org/2018/03/08/solidity-0.4.21-release-announcement/
CANCUN_SOLC
Cancun support https://soliditylang.org/blog/2024/01/26/solidity-0.8.24-release-announcement/
CONSTANTINOPLE_SOLC
Bug fix for configuring the EVM version with Constantinople https://blog.soliditylang.org/2018/03/08/solidity-0.4.21-release-announcement/
ISTANBUL_SOLC
Istanbul support https://blog.soliditylang.org/2019/12/09/solidity-0.5.14-release-announcement/
LONDON_SOLC
London support https://blog.soliditylang.org/2021/08/11/solidity-0.8.7-release-announcement/
OSAKA_SOLC
Osaka support https://soliditylang.org/blog/2025/03/12/solidity-0.8.29-release-announcement
PARIS_SOLC
Paris support https://blog.soliditylang.org/2023/02/01/solidity-0.8.18-release-announcement/
PETERSBURG_SOLC
Petersburg support https://blog.soliditylang.org/2019/03/05/solidity-0.5.5-release-announcement/
PRAGUE_SOLC
Prague support https://soliditylang.org/blog/2024/09/04/solidity-0.8.27-release-announcement
SHANGHAI_SOLC
Shanghai support https://blog.soliditylang.org/2023/05/10/solidity-0.8.20-release-announcement/
SOLC_EXTENSIONS
Extensions acceptable by solc compiler.

Statics§

SUPPORTS_BASE_PATH
SUPPORTS_INCLUDE_PATH

Functions§

canonicalize
Canonicalize the path, platform-agnostic.
canonicalized
Returns the same path config but with canonicalized paths.
common_ancestor
Finds the common ancestor of both paths
common_ancestor_all
Find the common ancestor, if any, between the given paths
create_parent_dir_all
Creates the parent directory of the file and all its ancestors if it does not exist.
find_fave_or_alt_path
Returns the right subpath in a dir
is_local_source_name
Attempts to determine if the given source is a local, relative import.
library_fully_qualified_placeholder
Returns the 36 char (deprecated) fully qualified name placeholder
library_hash
Returns the library placeholder for the given name The placeholder is a 34 character prefix of the hex encoding of the keccak256 hash of the fully qualified library name.
library_hash_placeholder
Returns the library hash placeholder as $hex(library_hash(name))$
normalize_solidity_import_path
Returns a normalized Solidity file path for the given import path based on the specified directory.
range_by_offset
Move a range by a specified offset
read_json_file
Reads the json file and deserialize it into the provided type.
resolve_absolute_library
Tries to find an absolute import like src/interfaces/IConfig.sol in cwd, moving up the path until the root is reached.
resolve_library
Returns the path to the library if the source path is in fact determined to be a library path, and it exists. Note: this does not handle relative imports or remappings.
source_name
Returns the source name for the given source path, the ancestors of the root path.
strip_prefix
Strips root from source and returns the relative path.
strip_prefix_owned
Strips root from source and returns the relative path.
write_json_file
Writes serializes the provided value to JSON and writes it to a file.