Skip to main content Module clone Copy item path Source use super::init::InitArgs ; π use super::install::DependencyInstallOpts ; π use alloy_primitives::Address ; π use alloy_primitives::Bytes ; π use alloy_primitives::ChainId ; π use alloy_primitives::TxHash ; π use clap::Parser; π use clap::ValueEnum; π use clap::ValueHint; π use eyre::Result ; π use forge_verify::sourcify::SOURCIFY_URL ; π use foundry_block_explorers::Client; π use foundry_block_explorers::contract::ContractCreationData; π use foundry_block_explorers::contract::ContractMetadata; π use foundry_block_explorers::contract::Metadata; π use foundry_block_explorers::contract::SourceCodeEntry; π use foundry_block_explorers::contract::SourceCodeMetadata; π use foundry_block_explorers::errors::EtherscanError; π use foundry_cli::opts::EtherscanOpts ; π use foundry_cli::utils::Git ; π use foundry_cli::utils::LoadConfig ; π use foundry_common::compile::ProjectCompiler ; π use foundry_common::fs ; π use foundry_common::fs::canonicalize_path ; π use foundry_compilers::ProjectCompileOutput; π use foundry_compilers::ProjectPathsConfig; π use foundry_compilers::artifacts::ConfigurableContractArtifact; π use foundry_compilers::artifacts::Settings; π use foundry_compilers::artifacts::StorageLayout; π use foundry_compilers::artifacts::output_selection::ContractOutputSelection; π use foundry_compilers::artifacts::output_selection::OutputSelection; π use foundry_compilers::artifacts::remappings::RelativeRemapping; π use foundry_compilers::artifacts::remappings::Remapping; π use foundry_compilers::compilers::solc::Solc; π use foundry_config::Chain; π use foundry_config::Config ; π use path_slash::PathExt; π use reqwest::StatusCode; π use serde::Deserialize ; π use serde::Deserialize ; π use std::collections::BTreeMap ; π use std::collections::HashMap ; π use std::fs::read_dir ; π use std::path::Component ; π use std::path::Path ; π use std::path::PathBuf ; π use std::time::Duration ; π use tracing::trace; π use url::Url ; π CloneArgs CLI arguments for forge clone. CloneMetadata CloneMetadata stores the metadata that are not included by foundry.toml but necessary for a
cloned contract. The metadata can be serialized to a metadata file in the cloned project root. SourcifyClient π SourcifyClient is a client for interacting with Sourcify API. SourcifyCompilation π SourcifyContractData π SourcifyDeployment π SourcifyErrorResponse π SourcifySourceFile π SourceExplorer Source explorer type for forge clone. SourcifyContractResponse π Sourcify API response for contract files. ExplorerClient π ExplorerClient is a trait that defines the methods to interact with block explorers.
It is defined as a wrapper of the foundry_block_explorers::Client to allow mocking. compile_project Compile the project in the root directory, and return the compilation result. dump_sources π Dump the contract sources to the root directory.
The sources are dumped to the src directory.
IO errors may be returned.
A list of remappings is returned ensure_source_entrypoint π Ensure sources moved into lib remain buildable from the projectβs src directory. find_main_contract Find the artifact of the contract with the specified name.
This function returns the path to the source file and the artifact. source_import π Return a namespaced import for a source path that is safe to embed in Solidity. update_config_by_metadata π Update the configuration file with the metadata.
This function will update the configuration file with the metadata from the contract.
It will update the following fields: