Expand description
Support for compiling [foundry_compilers::Project]
Re-exportsยง
use crate::TestFunctionExt;๐use crate::external_compiler::ExternalCompilation;๐use crate::external_compiler::is_builtin_compiler_source;๐use crate::fs::canonicalize_path;๐use crate::preprocessor::DynamicTestLinkingPreprocessor;๐use crate::shell;๐use crate::term::SpinnerReporter;๐use alloy_json_abi::JsonAbi;๐use comfy_table::Cell;๐use comfy_table::Color;๐use comfy_table::Table;๐use comfy_table::presets::ASCII_FULL;๐use comfy_table::presets::ASCII_MARKDOWN;๐use eyre::OptionExt;๐use eyre::Result;๐use foundry_block_explorers::contract::Metadata;๐use foundry_compilers::Artifact;๐use foundry_compilers::Project;๐use foundry_compilers::ProjectBuilder;๐use foundry_compilers::ProjectCompileOutput;๐use foundry_compilers::ProjectPathsConfig;๐use foundry_compilers::SolcConfig;๐use foundry_compilers::artifacts::BytecodeObject;๐use foundry_compilers::artifacts::Contract;๐use foundry_compilers::artifacts::Error as SolcError;๐use foundry_compilers::artifacts::Severity;๐use foundry_compilers::artifacts::Source;๐use foundry_compilers::artifacts::output_selection::OutputSelection;๐use foundry_compilers::artifacts::remappings::Remapping;๐use foundry_compilers::compilers::CompilationError;๐use foundry_compilers::compilers::Compiler;๐use foundry_compilers::compilers::solc::Solc;๐use foundry_compilers::compilers::solc::SolcCompiler;๐use foundry_compilers::info::ContractInfo as CompilerContractInfo;๐use foundry_compilers::multi::MultiCompiler;๐use foundry_compilers::multi::MultiCompilerError;๐use foundry_compilers::multi::MultiCompilerSettings;๐use foundry_compilers::project::Preprocessor;๐use foundry_compilers::report::BasicStdoutReporter;๐use foundry_compilers::report::NoReporter;๐use foundry_compilers::report::Report;๐use foundry_compilers::solc::SolcSettings;๐use foundry_config::Config;๐use num_format::Locale;๐use num_format::ToFormattedString;๐use revm::primitives::eip170;๐use revm::primitives::eip3860;๐use revm::primitives::hardfork::SpecId;๐use solar::ast::Arena;๐use solar::ast::ContractKind;๐use solar::ast::ItemKind;๐use solar::interface::Session;๐use solar::interface::source_map::FileName;๐use solar::parse::Parser;๐use std::any::Any;๐use std::collections::BTreeMap;๐use std::collections::BTreeSet;๐use std::collections::HashMap;๐use std::collections::HashSet;๐use std::fmt::Display;๐use std::io::IsTerminal;๐use std::path::Component;๐use std::path::Path;๐use std::path::PathBuf;๐use std::str::FromStr;๐use std::sync::Arc;๐use std::time::Instant;๐
Structsยง
- Contract
Info - How big the contract is and whether it is a dev contract where size limits can be neglected
- Contract
Size Limits - Runtime and initcode byte-size limits for compiled contract size reports.
- Project
Compiler - Builder type to configure how to compile a project.
- Size
Report - Contracts with info about their size
Enumsยง
- Path
OrContract Info - Container type for parsing contract identifiers from CLI.
Constantsยง
- AMSTERDAM_
CONTRACT_ ๐INITCODE_ SIZE_ LIMIT - AMSTERDAM_
CONTRACT_ ๐RUNTIME_ SIZE_ LIMIT - CONTRACT_
INITCODE_ ๐SIZE_ LIMIT - CONTRACT_
INITCODE_ ๐SIZE_ WARN_ THRESHOLD - CONTRACT_
RUNTIME_ ๐SIZE_ LIMIT - CONTRACT_
RUNTIME_ ๐SIZE_ WARN_ THRESHOLD
Functionsยง
- add_
storage_ layout_ output - Adds
storageLayoutto the compiler output selection for the given project. - collect_
libraries ๐ - Parses each source file with solar and returns the library names declared in it.
- compile_
abi_ project - Compiles the project requesting only ABI output.
- compile_
abi_ project_ cached - Acquires ABI output with compiler-owned persistence separate from normal artifacts.
- compile_
target - Compiles target file path.
- compile_
target_ abi - Compiles the target contract requesting only ABI output and returns its ABI.
- contract_
size ๐ - Returns the deployed or init size of the contract.
- dynamic_
test_ ๐linking_ failure - Recognizes only solc code-generation failures that DTLโs source rewrites can introduce. Unrelated errors (including other languages) must not trigger a retry.
- etherscan_
project - Creates a [Project] from an Etherscan source.
- linked_
libraries_ ๐error - Describes the Solidity library dependencies in creation or runtime bytecode, if any.
- push_
linked_ ๐libraries_ error - Appends a linked-library policy error to solc or multi-compiler diagnostics.
- sanitize_
relative_ ๐path - Normalizes an untrusted path relative to the source root, discarding leading separators, drive prefixes, and parent components that would escape that root.
- scaled_
threshold ๐ - with_
compilation_ reporter - Configures the reporter and runs the given closure.
- with_
compilation_ ๐reporter_ and_ settings
Type Aliasesยง
- Analysis
- A Solar compiler instance, to grant syntactic and semantic analysis capabilities.