Skip to main content

resolve_solc_binary

Function resolve_solc_binary 

Source
pub async fn resolve_solc_binary(
    config: &FoundryConfig,
    file_source: Option<&str>,
    client: Option<&Client>,
) -> PathBuf
Expand description

Resolve the path to the solc binary.

Resolution order:

  1. Parse pragma solidity from the source file.
    • Exact pragma (=0.7.6): always use the file’s version — foundry.toml cannot override an exact pragma without breaking compilation.
    • Wildcard pragma (^0.8.0, >=0.8.0, >=0.6.2 <0.9.0): if foundry.toml specifies a solc version that satisfies the constraint, use it. Otherwise pick the latest matching installed version.
  2. If no pragma, use the foundry.toml solc version if set.
  3. If no match is installed, auto-install via svm install.
  4. Fall back to whatever solc is on $PATH.