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§
- RE_
CONTRACT_ NAMES - A regex that matches the contract names in a Solidity file.
- RE_
SOL_ IMPORT - A regex that matches the import path and identifier of a solidity import statement with the named groups “path”, “id”.
- RE_
SOL_ IMPORT_ ALIAS - A regex that matches an alias within an import statement
- RE_
SOL_ PRAGMA_ VERSION - A regex that matches the version part of a solidity pragma
as follows:
pragma solidity ^0.5.2;
=>^0.5.2
statement with the named group “version”. - RE_
SOL_ SDPX_ LICENSE_ IDENTIFIER - A regex that matches the SDPX license identifier statement with the named group “license”.
- RE_
THREE_ OR_ MORE_ NEWLINES - A regex used to remove extra lines in flatenned files
- RE_
TWO_ OR_ MORE_ SPACES - A regex used to remove extra lines in flatenned files
- RE_
VYPER_ VERSION - A regex that matches version pragma in a Vyper
- SUPPORTS_
BASE_ PATH - SUPPORTS_
INCLUDE_ PATH
Functions§
- canonicalize
- Canonicalize the path, platform-agnostic.
- canonicalized
- Returns the same path config but with canonicalized paths.
- capture_
outer_ and_ inner - Given the regex and the target string, find all occurrences of named groups within the string.
- common_
ancestor - Finds the common ancestor of both paths
- common_
ancestor_ all - Find the common ancestor, if any, between the given paths
- create_
contract_ or_ lib_ name_ regex - Create a regex that matches any library or contract name inside a file
- create_
parent_ dir_ all - Creates the parent directory of the
file
and all its ancestors if it does not exist. - find_
case_ sensitive_ existing_ file - Attempts to find a file with different case that exists next to the
non_existing
file - find_
fave_ or_ alt_ path - Returns the right subpath in a dir
- find_
import_ paths - Returns all path parts from any solidity import statement in a string,
import "./contracts/Contract.sol";
->"./contracts/Contract.sol"
. - find_
version_ pragma - Returns the solidity version pragma from the given input:
pragma solidity ^0.5.2;
=>^0.5.2
- installed_
versions - Reads the list of Solc versions that have been installed in the machine.
- 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
incwd
, moving up the path until theroot
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.
- sol_
source_ files - Same as source_files but only returns files acceptable by Solc compiler.
- solidity_
dirs - Returns a list of unique paths to all folders under
root
that contain at least one solidity file (*.sol
). - source_
files - Returns a list of absolute paths to all the solidity files under the root, or the file itself, if the path is a solidity file.
- source_
files_ iter - Returns an iterator that yields all solidity/yul files funder under the given root path or the
root
itself, if it is a sol/yul file - source_
name - Returns the source name for the given source path, the ancestors of the root path.
- strip_
prefix - Strips
root
fromsource
and returns the relative path. - strip_
prefix_ owned - Strips
root
fromsource
and returns the relative path. - unique_
hash - A non-cryptographic hash function for creating unique identifiers.
- unique_
hash_ many - A non-cryptographic hash function for creating unique identifiers.
- write_
json_ file - Writes serializes the provided value to JSON and writes it to a file.