foundry_compilers_core

Module utils

Source
Expand description

Utility functions

Constants§

Statics§

Functions§

  • Canonicalize the path, platform-agnostic.
  • Returns the same path config but with canonicalized paths.
  • Given the regex and the target string, find all occurrences of named groups within the string.
  • Finds the common ancestor of both paths
  • Find the common ancestor, if any, between the given paths
  • Create a regex that matches any library or contract name inside a file
  • Creates the parent directory of the file and all its ancestors if it does not exist.
  • Attempts to find a file with different case that exists next to the non_existing file
  • Returns the right subpath in a dir
  • Returns all path parts from any solidity import statement in a string, import "./contracts/Contract.sol"; -> "./contracts/Contract.sol".
  • Returns the solidity version pragma from the given input: pragma solidity ^0.5.2; => ^0.5.2
  • Reads the list of Solc versions that have been installed in the machine.
  • Attempts to determine if the given source is a local, relative import.
  • Returns the 36 char (deprecated) fully qualified name placeholder
  • 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.
  • Returns the library hash placeholder as $hex(library_hash(name))$
  • Returns a normalized Solidity file path for the given import path based on the specified directory.
  • Move a range by a specified offset
  • Reads the json file and deserialize it into the provided type.
  • Tries to find an absolute import like src/interfaces/IConfig.sol in cwd, moving up the path until the root is reached.
  • 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.
  • Same as source_files but only returns files acceptable by Solc compiler.
  • Returns a list of unique paths to all folders under root that contain at least one solidity file (*.sol).
  • 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.
  • 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
  • Returns the source name for the given source path, the ancestors of the root path.
  • Strips root from source and returns the relative path.
  • Strips root from source and returns the relative path.
  • Writes serializes the provided value to JSON and writes it to a file.