Struct foundry_config::Config

source ·
pub struct Config {
Show 78 fields pub profile: Profile, pub src: PathBuf, pub test: PathBuf, pub script: PathBuf, pub out: PathBuf, pub libs: Vec<PathBuf>, pub remappings: Vec<RelativeRemapping>, pub auto_detect_remappings: bool, pub libraries: Vec<String>, pub cache: bool, pub cache_path: PathBuf, pub broadcast: PathBuf, pub allow_paths: Vec<PathBuf>, pub include_paths: Vec<PathBuf>, pub force: bool, pub evm_version: EvmVersion, pub gas_reports: Vec<String>, pub gas_reports_ignore: Vec<String>, pub solc: Option<SolcReq>, pub auto_detect_solc: bool, pub offline: bool, pub optimizer: bool, pub optimizer_runs: usize, pub optimizer_details: Option<OptimizerDetails>, pub model_checker: Option<ModelCheckerSettings>, pub verbosity: u8, pub eth_rpc_url: Option<String>, pub eth_rpc_jwt: Option<String>, pub etherscan_api_key: Option<String>, pub etherscan: EtherscanConfigs, pub ignored_error_codes: Vec<SolidityErrorCode>, pub deny_warnings: bool, pub test_pattern: Option<RegexWrapper>, pub test_pattern_inverse: Option<RegexWrapper>, pub contract_pattern: Option<RegexWrapper>, pub contract_pattern_inverse: Option<RegexWrapper>, pub path_pattern: Option<Glob>, pub path_pattern_inverse: Option<Glob>, pub fuzz: FuzzConfig, pub invariant: InvariantConfig, pub ffi: bool, pub sender: Address, pub tx_origin: Address, pub initial_balance: U256, pub block_number: u64, pub fork_block_number: Option<u64>, pub chain_id: Option<Chain>, pub gas_limit: GasLimit, pub code_size_limit: Option<usize>, pub gas_price: Option<u64>, pub block_base_fee_per_gas: u64, pub block_coinbase: Address, pub block_timestamp: u64, pub block_difficulty: u64, pub block_prevrandao: H256, pub block_gas_limit: Option<GasLimit>, pub memory_limit: u64, pub extra_output: Vec<ContractOutputSelection>, pub extra_output_files: Vec<ContractOutputSelection>, pub names: bool, pub sizes: bool, pub via_ir: bool, pub rpc_storage_caching: StorageCachingConfig, pub no_storage_caching: bool, pub no_rpc_rate_limit: bool, pub rpc_endpoints: RpcEndpoints, pub use_literal_content: bool, pub bytecode_hash: BytecodeHash, pub cbor_metadata: bool, pub revert_strings: Option<RevertStrings>, pub sparse_mode: bool, pub build_info: bool, pub build_info_path: Option<PathBuf>, pub fmt: FormatterConfig, pub doc: DocConfig, pub fs_permissions: FsPermissions, pub cancun: bool, pub __warnings: Vec<Warning>, /* private fields */
}
Expand description

Foundry configuration

Defaults

All configuration values have a default, documented in the fields section below. Config::default() returns the default values for the default profile while Config::with_root() returns the values based on the given directory. Config::load() starts with the default profile and merges various providers into the config, same for Config::load_with_root(), but there the default values are determined by Config::with_root()

Provider Details

Config is a Figment Provider with the following characteristics:

  • Profile

    The profile is set to the value of the profile field.

  • Metadata

    This provider is named Foundry Config. It does not specify a Source and uses default interpolation.

  • Data

    The data emitted by this provider are the keys and values corresponding to the fields and values of the structure. The dictionary is emitted to the “default” meta-profile.

Note that these behaviors differ from those of Config::figment().

Fields§

§profile: Profile

The selected profile. (default: default default)

Note: This field is never serialized nor deserialized. When a Config is merged into a Figment as a Provider, this profile is selected on the Figment. When a Config is extracted, this field is set to the extracting Figment’s selected Profile.

§src: PathBuf

path of the source contracts dir, like src or contracts

§test: PathBuf

path of the test dir

§script: PathBuf

path of the script dir

§out: PathBuf

path to where artifacts shut be written to

§libs: Vec<PathBuf>

all library folders to include, lib, node_modules

§remappings: Vec<RelativeRemapping>

Remappings to use for this repo

§auto_detect_remappings: bool

Whether to autodetect remappings by scanning the libs folders recursively

§libraries: Vec<String>

library addresses to link

§cache: bool

whether to enable cache

§cache_path: PathBuf

where the cache is stored if enabled

§broadcast: PathBuf

where the broadcast logs are stored

§allow_paths: Vec<PathBuf>

additional solc allow paths for --allow-paths

§include_paths: Vec<PathBuf>

additional solc include paths for --include-path

§force: bool

whether to force a project.clean()

§evm_version: EvmVersion

evm version to use

§gas_reports: Vec<String>

list of contracts to report gas of

§gas_reports_ignore: Vec<String>

list of contracts to ignore for gas reports

§solc: Option<SolcReq>

The Solc instance to use if any.

This takes precedence over auto_detect_solc, if a version is set then this overrides auto-detection.

Note for backwards compatibility reasons this also accepts solc_version from the toml file, see [BackwardsCompatProvider]

§auto_detect_solc: bool

whether to autodetect the solc compiler version to use

§offline: bool

Offline mode, if set, network access (downloading solc) is disallowed.

Relationship with auto_detect_solc:

  • if auto_detect_solc = true and offline = true, the required solc version(s) will be auto detected but if the solc version is not installed, it will not try to install it
§optimizer: bool

Whether to activate optimizer

§optimizer_runs: usize

Sets the optimizer runs

§optimizer_details: Option<OptimizerDetails>

Switch optimizer components on or off in detail. The “enabled” switch above provides two defaults which can be tweaked here. If “details” is given, “enabled” can be omitted.

§model_checker: Option<ModelCheckerSettings>

Model checker settings.

§verbosity: u8

verbosity to use

§eth_rpc_url: Option<String>

url of the rpc server that should be used for any rpc calls

§eth_rpc_jwt: Option<String>

JWT secret that should be used for any rpc calls

§etherscan_api_key: Option<String>

etherscan API key, or alias for an EtherscanConfig in etherscan table

§etherscan: EtherscanConfigs

Multiple etherscan api configs and their aliases

§ignored_error_codes: Vec<SolidityErrorCode>

list of solidity error codes to always silence in the compiler output

§deny_warnings: bool

When true, compiler warnings are treated as errors

§test_pattern: Option<RegexWrapper>

Only run test functions matching the specified regex pattern.

§test_pattern_inverse: Option<RegexWrapper>

Only run test functions that do not match the specified regex pattern.

§contract_pattern: Option<RegexWrapper>

Only run tests in contracts matching the specified regex pattern.

§contract_pattern_inverse: Option<RegexWrapper>

Only run tests in contracts that do not match the specified regex pattern.

§path_pattern: Option<Glob>

Only run tests in source files matching the specified glob pattern.

§path_pattern_inverse: Option<Glob>

Only run tests in source files that do not match the specified glob pattern.

§fuzz: FuzzConfig

Configuration for fuzz testing

§invariant: InvariantConfig

Configuration for invariant testing

§ffi: bool

Whether to allow ffi cheatcodes in test

§sender: Address

The address which will be executing all tests

§tx_origin: Address

The tx.origin value during EVM execution

§initial_balance: U256

the initial balance of each deployed test contract

§block_number: u64

the block.number value during EVM execution

§fork_block_number: Option<u64>

pins the block number for the state fork

§chain_id: Option<Chain>

The chain id to use

§gas_limit: GasLimit

Block gas limit

§code_size_limit: Option<usize>

EIP-170: Contract code size limit in bytes. Useful to increase this because of tests.

§gas_price: Option<u64>

tx.gasprice value during EVM execution“

This is an Option, so we can determine in fork mode whether to use the config’s gas price (if set by user) or the remote client’s gas price

§block_base_fee_per_gas: u64

the base fee in a block

§block_coinbase: Address

the block.coinbase value during EVM execution

§block_timestamp: u64

the block.timestamp value during EVM execution

§block_difficulty: u64

the block.difficulty value during EVM execution

§block_prevrandao: H256

Before merge the block.max_hash after merge it is block.prevrandao

§block_gas_limit: Option<GasLimit>

the block.gaslimit value during EVM execution

§memory_limit: u64

The memory limit of the EVM (32 MB by default)

§extra_output: Vec<ContractOutputSelection>

Additional output selection for all contracts such as “ir”, “devdoc”, “storageLayout”, etc. See Solc Compiler Api

The following values are always set because they’re required by forge

§extra_output_files: Vec<ContractOutputSelection>

If set , a separate json file will be emitted for every contract depending on the selection, eg. extra_output_files = ["metadata"] will create a metadata.json for each contract in the project. See Contract Metadata

The difference between extra_output = ["metadata"] and extra_output_files = ["metadata"] is that the former will include the contract’s metadata in the contract’s json artifact, whereas the latter will emit the output selection as separate files.

§names: bool

Print the names of the compiled contracts

§sizes: bool

Print the sizes of the compiled contracts

§via_ir: bool

If set to true, changes compilation pipeline to go through the Yul intermediate representation.

§rpc_storage_caching: StorageCachingConfig

RPC storage caching settings determines what chains and endpoints to cache

§no_storage_caching: bool

Disables storage caching entirely. This overrides any settings made in rpc_storage_caching

§no_rpc_rate_limit: bool

Disables rate limiting entirely. This overrides any settings made in compute_units_per_second

§rpc_endpoints: RpcEndpoints

Multiple rpc endpoints and their aliases

§use_literal_content: bool

Whether to store the referenced sources in the metadata as literal data.

§bytecode_hash: BytecodeHash

Whether to include the metadata hash.

The metadata hash is machine dependent. By default, this is set to BytecodeHash::None to allow for deterministic code, See: https://docs.soliditylang.org/en/latest/metadata.html

§cbor_metadata: bool

Whether to append the metadata hash to the bytecode.

If this is false and the bytecode_hash option above is not None solc will issue a warning.

§revert_strings: Option<RevertStrings>

How to treat revert (and require) reason strings.

§sparse_mode: bool

Whether to compile in sparse mode

If this option is enabled, only the required contracts/files will be selected to be included in solc’s output selection, see also OutputSelection

§build_info: bool

Whether to emit additional build info files

If set to true, ethers-solc will generate additional build info json files for every new build, containing the CompilerInput and CompilerOutput

§build_info_path: Option<PathBuf>

The path to the build-info directory that contains the build info json files.

§fmt: FormatterConfig

Configuration for forge fmt

§doc: DocConfig

Configuration for forge doc

§fs_permissions: FsPermissions

Configures the permissions of cheat codes that touch the file system.

This includes what operations can be executed (read, write)

§cancun: bool

Temporary config to enable SpecId::CANCUN

https://github.com/foundry-rs/foundry/issues/5782 Should be removed once EvmVersion Cancun is supported by solc

§__warnings: Vec<Warning>

Warnings gathered when loading the Config. See WarningsProvider for more information

Implementations§

source§

impl Config

source

pub const DEFAULT_PROFILE: Profile = _

The default profile: “default”

source

pub const HARDHAT_PROFILE: Profile = _

The hardhat profile: “hardhat”

source

pub const PROFILE_SECTION: &'static str = "profile"

TOML section for profiles

source

pub const STANDALONE_SECTIONS: &'static [&'static str] = _

Standalone sections in the config which get integrated into the selected profile

source

pub const FILE_NAME: &'static str = "foundry.toml"

File name of config toml file

source

pub const FOUNDRY_DIR_NAME: &'static str = ".foundry"

The name of the directory foundry reserves for itself under the user’s home directory: ~

source

pub const DEFAULT_SENDER: H160 = _

Default address for tx.origin

0x1804c8AB1F12E6bbf3894d4083f33e07309d1f38

source

pub fn load() -> Self

Returns the current Config

See Config::figment

source

pub fn load_with_root(root: impl Into<PathBuf>) -> Self

Returns the current Config

See Config::figment_with_root

source

pub fn from_provider<T: Provider>(provider: T) -> Self

Extract a Config from provider, panicking if extraction fails.

Panics

If extraction fails, prints an error message indicating the failure and panics. For a version that doesn’t panic, use Config::try_from().

Example
use foundry_config::Config;
use figment::providers::{Toml, Format, Env};

// Use foundry's default `Figment`, but allow values from `other.toml`
// to supersede its values.
let figment = Config::figment()
    .merge(Toml::file("other.toml").nested());

let config = Config::from_provider(figment);
source

pub fn try_from<T: Provider>(provider: T) -> Result<Self, ExtractConfigError>

Attempts to extract a Config from provider, returning the result.

Example
use foundry_config::Config;
use figment::providers::{Toml, Format, Env};

// Use foundry's default `Figment`, but allow values from `other.toml`
// to supersede its values.
let figment = Config::figment()
    .merge(Toml::file("other.toml").nested());

let config = Config::try_from(figment);
source

pub fn canonic(self) -> Self

The config supports relative paths and tracks the root path separately see Config::with_root

This joins all relative paths with the current root and attempts to make them canonic

source

pub fn canonic_at(self, root: impl Into<PathBuf>) -> Self

Joins all relative paths with the given root so that paths that are defined as:

[profile.default]
src = "src"
out = "./out"
libs = ["lib", "/var/lib"]

Will be made canonic with the given root:

[profile.default]
src = "<root>/src"
out = "<root>/out"
libs = ["<root>/lib", "/var/lib"]
source

pub fn sanitized(self) -> Self

Returns a sanitized version of the Config where are paths are set correctly and potential duplicates are resolved

See Self::canonic

source

pub fn sanitize_remappings(&mut self)

Cleans up any duplicate Remapping and sorts them

On windows this will convert any \ in the remapping path into a /

source

pub fn install_lib_dir(&self) -> &Path

Returns the directory in which dependencies should be installed

Returns the first dir from libs that is not node_modules or lib if libs is empty

source

pub fn project(&self) -> Result<Project, SolcError>

Serves as the entrypoint for obtaining the project.

Returns the Project configured with all solc and path related values.

Note: this also cleans Project::cleanup the workspace if force is set to true.

Example
use foundry_config::Config;
let config = Config::load_with_root(".").sanitized();
let project = config.project();
source

pub fn ephemeral_no_artifacts_project(&self) -> Result<Project, SolcError>

Same as Self::project() but sets configures the project to not emit artifacts and ignore cache, caching causes no output until https://github.com/gakonst/ethers-rs/issues/727

source

pub fn evm_spec_id(&self) -> SpecId

Returns the SpecId derived from the configured EvmVersion

source

pub fn is_auto_detect(&self) -> bool

Returns whether the compiler version should be auto-detected

Returns false if solc_version is explicitly set, otherwise returns the value of auto_detect_solc

source

pub fn enable_caching(&self, endpoint: &str, chain_id: impl Into<u64>) -> bool

Whether caching should be enabled for the given chain id

source

pub fn project_paths(&self) -> ProjectPathsConfig

Returns the ProjectPathsConfig sub set of the config.

NOTE: this uses the paths as they are and does not modify them, see [Self::sanitized]

Example
use foundry_config::Config;
let config = Config::load_with_root(".").sanitized();
let paths = config.project_paths();
source

pub fn get_all_remappings(&self) -> Vec<Remapping>

Returns all configured [Remappings]

Note: this will add an additional <src>/=<src path> remapping here, see Self::get_source_dir_remapping()

So that

import "./math/math.sol";
import "contracts/tokens/token.sol";

in contracts/contract.sol are resolved to

contracts/tokens/token.sol
contracts/math/math.sol
source

pub fn get_rpc_jwt_secret( &self ) -> Result<Option<Cow<'_, str>>, UnresolvedEnvVarError>

Returns the configured rpc jwt secret

Returns:

  • The jwt secret, if configured
Example
 
use foundry_config::Config;
    let config = Config::with_root("./");
    let rpc_jwt = config.get_rpc_jwt_secret().unwrap().unwrap();
source

pub fn get_rpc_url(&self) -> Option<Result<Cow<'_, str>, UnresolvedEnvVarError>>

Returns the configured rpc url

Returns:

  • the matching, resolved url of rpc_endpoints if eth_rpc_url is an alias
  • the eth_rpc_url as-is if it isn’t an alias
Example
 
use foundry_config::Config;
    let config = Config::with_root("./");
    let rpc_url = config.get_rpc_url().unwrap().unwrap();
source

pub fn get_rpc_url_with_alias( &self, maybe_alias: &str ) -> Option<Result<Cow<'_, str>, UnresolvedEnvVarError>>

Resolves the given alias to a matching rpc url

Returns:

  • the matching, resolved url of rpc_endpoints if maybe_alias is an alias
  • None otherwise
Example
 
use foundry_config::Config;
    let config = Config::with_root("./");
    let rpc_url = config.get_rpc_url_with_alias("mainnet").unwrap().unwrap();
source

pub fn get_rpc_url_or<'a>( &'a self, fallback: impl Into<Cow<'a, str>> ) -> Result<Cow<'_, str>, UnresolvedEnvVarError>

Returns the configured rpc, or the fallback url

Example
 
use foundry_config::Config;
    let config = Config::with_root("./");
    let rpc_url = config.get_rpc_url_or("http://localhost:8545").unwrap();
source

pub fn get_rpc_url_or_localhost_http( &self ) -> Result<Cow<'_, str>, UnresolvedEnvVarError>

Returns the configured rpc or "http://localhost:8545" if no eth_rpc_url is set

Example
 
use foundry_config::Config;
    let config = Config::with_root("./");
    let rpc_url = config.get_rpc_url_or_localhost_http().unwrap();
source

pub fn get_etherscan_config( &self ) -> Option<Result<ResolvedEtherscanConfig, EtherscanConfigError>>

Returns the EtherscanConfig to use, if any

Returns

  • the matching ResolvedEtherscanConfig of the etherscan table if etherscan_api_key is an alias
  • the Mainnet ResolvedEtherscanConfig if etherscan_api_key is set, None otherwise
Example
 
use foundry_config::Config;
    let config = Config::with_root("./");
    let etherscan_config = config.get_etherscan_config().unwrap().unwrap();
    let client = etherscan_config.into_client().unwrap();
source

pub fn get_etherscan_config_with_chain( &self, chain: Option<impl Into<Chain>> ) -> Result<Option<ResolvedEtherscanConfig>, EtherscanConfigError>

Same as Self::get_etherscan_config() but optionally updates the config with the given chain, and etherscan_api_key

If not matching alias was found, then this will try to find the first entry in the table with a matching chain id. If an etherscan_api_key is already set it will take precedence over the chain’s entry in the table.

source

pub fn get_etherscan_api_key( &self, chain: Option<impl Into<Chain>> ) -> Option<String>

Helper function to just get the API key

source

pub fn get_source_dir_remapping(&self) -> Option<Remapping>

Returns the remapping for the project’s src directory

Note: this will add an additional <src>/=<src path> remapping here so imports that look like import {Foo} from "src/Foo.sol"; are properly resolved.

This is due the fact that solc’s VFS resolves direct imports that start with the source directory’s name.

source

pub fn get_test_dir_remapping(&self) -> Option<Remapping>

Returns the remapping for the project’s test directory, but only if it exists

source

pub fn get_script_dir_remapping(&self) -> Option<Remapping>

Returns the remapping for the project’s script directory, but only if it exists

source

pub fn optimizer(&self) -> Optimizer

Returns the Optimizer based on the configured settings

source

pub fn configured_artifacts_handler(&self) -> ConfigurableArtifacts

returns the ethers_solc::ConfigurableArtifacts for this config, that includes the extra_output fields

source

pub fn parsed_libraries(&self) -> Result<Libraries, SolcError>

Parses all libraries in the form of <file>:<lib>:<addr>

source

pub fn solc_settings(&self) -> Result<Settings, SolcError>

Returns the configured solc Settings that includes:

  • all libraries
  • the optimizer (including details, if configured)
  • evm version
source

pub fn figment() -> Figment

Returns the default figment

The default figment reads from the following sources, in ascending priority order:

  1. Config::default() (see defaults)
  2. foundry.toml or filename in FOUNDRY_CONFIG environment variable
  3. FOUNDRY_ prefixed environment variables

The profile selected is the value set in the FOUNDRY_PROFILE environment variable. If it is not set, it defaults to default.

Example
use foundry_config::Config;
use serde::Deserialize;

let my_config = Config::figment().extract::<Config>();
source

pub fn figment_with_root(root: impl Into<PathBuf>) -> Figment

Returns the default figment enhanced with additional context extracted from the provided root, like remappings and directories.

Example
use foundry_config::Config;
use serde::Deserialize;

let my_config = Config::figment_with_root(".").extract::<Config>();
source

pub fn with_root(root: impl Into<PathBuf>) -> Self

Creates a new Config that adds additional context extracted from the provided root.

Example
use foundry_config::Config;
let my_config = Config::with_root(".");
source

pub fn hardhat() -> Self

Returns the default config but with hardhat paths

source

pub fn dapptools() -> Self

Returns the default config that uses dapptools style paths

source

pub fn into_basic(self) -> BasicConfig

Extracts a basic subset of the config, used for initialisations.

Example
use foundry_config::Config;
let my_config = Config::with_root(".").into_basic();
source

pub fn update_at<F>(root: impl Into<PathBuf>, f: F) -> Result<()>where F: FnOnce(&Config, &mut Document) -> bool,

Updates the foundry.toml file for the given root based on the provided closure.

Note: the closure will only be invoked if the foundry.toml file exists, See Self::get_config_path() and if the closure returns true.

source

pub fn update<F>(&self, f: F) -> Result<()>where F: FnOnce(&mut Document) -> bool,

Updates the foundry.toml file this Config ias based on with the provided closure.

Note: the closure will only be invoked if the foundry.toml file exists, See Self::get_config_path() and if the closure returns true

source

pub fn update_libs(&self) -> Result<()>

Sets the libs entry inside a foundry.toml file but only if it exists

Errors

An error if the foundry.toml could not be parsed.

source

pub fn to_string_pretty(&self) -> Result<String, Error>

Serialize the config type as a String of TOML.

This serializes to a table with the name of the profile

[profile.default]
src = "src"
out = "out"
libs = ["lib"]
# ...
source

pub fn get_config_path(&self) -> PathBuf

Returns the path to the foundry.toml of this Config

source

pub fn selected_profile() -> Profile

Returns the selected profile

If the FOUNDRY_PROFILE env variable is not set, this returns the DEFAULT_PROFILE

source

pub fn foundry_dir_toml() -> Option<PathBuf>

Returns the path to foundry’s global toml file that’s stored at ~/.foundry/foundry.toml

source

pub fn foundry_dir() -> Option<PathBuf>

Returns the path to foundry’s config dir ~/.foundry/

source

pub fn foundry_cache_dir() -> Option<PathBuf>

Returns the path to foundry’s cache dir ~/.foundry/cache

source

pub fn foundry_rpc_cache_dir() -> Option<PathBuf>

Returns the path to foundry rpc cache dir ~/.foundry/cache/rpc

source

pub fn foundry_chain_cache_dir(chain_id: impl Into<Chain>) -> Option<PathBuf>

Returns the path to foundry chain’s cache dir ~/.foundry/cache/rpc/<chain>

source

pub fn foundry_etherscan_cache_dir() -> Option<PathBuf>

Returns the path to foundry’s etherscan cache dir ~/.foundry/cache/etherscan

source

pub fn foundry_keystores_dir() -> Option<PathBuf>

Returns the path to foundry’s keystores dir ~/.foundry/keystores

source

pub fn foundry_etherscan_chain_cache_dir( chain_id: impl Into<Chain> ) -> Option<PathBuf>

Returns the path to foundry’s etherscan cache dir for chain_id ~/.foundry/cache/etherscan/<chain>

source

pub fn foundry_block_cache_dir( chain_id: impl Into<Chain>, block: u64 ) -> Option<PathBuf>

Returns the path to the cache dir of the block on the chain `~/.foundry/cache/rpc//

source

pub fn foundry_block_cache_file( chain_id: impl Into<Chain>, block: u64 ) -> Option<PathBuf>

Returns the path to the cache file of the block on the chain ~/.foundry/cache/rpc/<chain>/<block>/storage.json

source

pub fn data_dir() -> Result<PathBuf>

Returns the path to foundry’s data directory inside the user’s data directory |Platform | Value | Example | | —–– | ———————————–– | –––––––––––––––– | | Linux | $XDG_CONFIG_HOME or $HOME/.config/foundry | /home/alice/.config/foundry| | macOS | $HOME/Library/Application Support/foundry | /Users/Alice/Library/Application Support/foundry | | Windows | {FOLDERID_RoamingAppData}/foundry | C:\Users\Alice\AppData\Roaming/foundry |

source

pub fn find_config_file() -> Option<PathBuf>

Returns the path to the foundry.toml file, the file is searched for in the current working directory and all parent directories until the root, and the first hit is used.

If this search comes up empty, then it checks if a global foundry.toml exists at ~/.foundry/foundry.tol, see Self::foundry_dir_toml()

source

pub fn clean_foundry_cache() -> Result<()>

Clears the foundry cache

source

pub fn clean_foundry_chain_cache(chain: Chain) -> Result<()>

Clears the foundry cache for chain

source

pub fn clean_foundry_block_cache(chain: Chain, block: u64) -> Result<()>

Clears the foundry cache for chain and block

source

pub fn clean_foundry_etherscan_cache() -> Result<()>

Clears the foundry etherscan cache

source

pub fn clean_foundry_etherscan_chain_cache(chain: Chain) -> Result<()>

Clears the foundry etherscan cache for chain

source

pub fn list_foundry_cache() -> Result<Cache>

List the data in the foundry cache

source

pub fn list_foundry_chain_cache(chain: Chain) -> Result<ChainCache>

List the cached data for chain

Trait Implementations§

source§

impl Clone for Config

source§

fn clone(&self) -> Config

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for Config

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl Default for Config

source§

fn default() -> Self

Returns the “default value” for a type. Read more
source§

impl<'de> Deserialize<'de> for Config

source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
source§

impl From<Config> for Figment

source§

fn from(c: Config) -> Figment

Converts to this type from the input type.
source§

impl PartialEq<Config> for Config

source§

fn eq(&self, other: &Config) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl Provider for Config

source§

fn metadata(&self) -> Metadata

Returns the Metadata for this provider, identifying itself and its configuration sources.
source§

fn data(&self) -> Result<Map<Profile, Dict>, Error>

Returns the configuration data.
source§

fn profile(&self) -> Option<Profile>

Optionally returns a profile to set on the Figment this provider is merged into. The profile is only set if self is merged.
source§

impl Serialize for Config

source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
source§

impl StructuralPartialEq for Config

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
§

impl<T> Conv for T

§

fn conv<T>(self) -> Twhere Self: Into<T>,

Converts self into T using Into<T>. Read more
§

impl<T> FmtForward for T

§

fn fmt_binary(self) -> FmtBinary<Self>where Self: Binary,

Causes self to use its Binary implementation when Debug-formatted.
§

fn fmt_display(self) -> FmtDisplay<Self>where Self: Display,

Causes self to use its Display implementation when Debug-formatted.
§

fn fmt_lower_exp(self) -> FmtLowerExp<Self>where Self: LowerExp,

Causes self to use its LowerExp implementation when Debug-formatted.
§

fn fmt_lower_hex(self) -> FmtLowerHex<Self>where Self: LowerHex,

Causes self to use its LowerHex implementation when Debug-formatted.
§

fn fmt_octal(self) -> FmtOctal<Self>where Self: Octal,

Causes self to use its Octal implementation when Debug-formatted.
§

fn fmt_pointer(self) -> FmtPointer<Self>where Self: Pointer,

Causes self to use its Pointer implementation when Debug-formatted.
§

fn fmt_upper_exp(self) -> FmtUpperExp<Self>where Self: UpperExp,

Causes self to use its UpperExp implementation when Debug-formatted.
§

fn fmt_upper_hex(self) -> FmtUpperHex<Self>where Self: UpperHex,

Causes self to use its UpperHex implementation when Debug-formatted.
§

fn fmt_list(self) -> FmtList<Self>where &'a Self: for<'a> IntoIterator,

Formats each item in a sequence. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T> Instrument for T

source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
source§

impl<T, U> Into<U> for Twhere U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

§

impl<T> Paint for Twhere T: ?Sized,

§

fn fg(&self, value: Color) -> Painted<&T>

Returns a styled value derived from self with the foreground set to value.

This method should be used rarely. Instead, prefer to use color-specific builder methods like red() and green(), which have the same functionality but are pithier.

Example

Set foreground color to white using fg():

use yansi::{Paint, Color};

painted.fg(Color::White);

Set foreground color to white using white().

use yansi::Paint;

painted.white();
§

fn primary(&self) -> Painted<&T>

Returns self with the fg() set to [Color::Primary].

Example
println!("{}", value.primary());
§

fn fixed(&self, color: u8) -> Painted<&T>

Returns self with the fg() set to [Color::Fixed].

Example
println!("{}", value.fixed(color));
§

fn rgb(&self, r: u8, g: u8, b: u8) -> Painted<&T>

Returns self with the fg() set to [Color::Rgb].

Example
println!("{}", value.rgb(r, g, b));
§

fn black(&self) -> Painted<&T>

Returns self with the fg() set to [Color::Black].

Example
println!("{}", value.black());
§

fn red(&self) -> Painted<&T>

Returns self with the fg() set to [Color::Red].

Example
println!("{}", value.red());
§

fn green(&self) -> Painted<&T>

Returns self with the fg() set to [Color::Green].

Example
println!("{}", value.green());
§

fn yellow(&self) -> Painted<&T>

Returns self with the fg() set to [Color::Yellow].

Example
println!("{}", value.yellow());
§

fn blue(&self) -> Painted<&T>

Returns self with the fg() set to [Color::Blue].

Example
println!("{}", value.blue());
§

fn magenta(&self) -> Painted<&T>

Returns self with the fg() set to [Color::Magenta].

Example
println!("{}", value.magenta());
§

fn cyan(&self) -> Painted<&T>

Returns self with the fg() set to [Color::Cyan].

Example
println!("{}", value.cyan());
§

fn white(&self) -> Painted<&T>

Returns self with the fg() set to [Color::White].

Example
println!("{}", value.white());
§

fn bright_black(&self) -> Painted<&T>

Returns self with the fg() set to [Color::BrightBlack].

Example
println!("{}", value.bright_black());
§

fn bright_red(&self) -> Painted<&T>

Returns self with the fg() set to [Color::BrightRed].

Example
println!("{}", value.bright_red());
§

fn bright_green(&self) -> Painted<&T>

Returns self with the fg() set to [Color::BrightGreen].

Example
println!("{}", value.bright_green());
§

fn bright_yellow(&self) -> Painted<&T>

Returns self with the fg() set to [Color::BrightYellow].

Example
println!("{}", value.bright_yellow());
§

fn bright_blue(&self) -> Painted<&T>

Returns self with the fg() set to [Color::BrightBlue].

Example
println!("{}", value.bright_blue());
§

fn bright_magenta(&self) -> Painted<&T>

Returns self with the fg() set to [Color::BrightMagenta].

Example
println!("{}", value.bright_magenta());
§

fn bright_cyan(&self) -> Painted<&T>

Returns self with the fg() set to [Color::BrightCyan].

Example
println!("{}", value.bright_cyan());
§

fn bright_white(&self) -> Painted<&T>

Returns self with the fg() set to [Color::BrightWhite].

Example
println!("{}", value.bright_white());
§

fn bg(&self, value: Color) -> Painted<&T>

Returns a styled value derived from self with the background set to value.

This method should be used rarely. Instead, prefer to use color-specific builder methods like on_red() and on_green(), which have the same functionality but are pithier.

Example

Set background color to red using fg():

use yansi::{Paint, Color};

painted.bg(Color::Red);

Set background color to red using on_red().

use yansi::Paint;

painted.on_red();
§

fn on_primary(&self) -> Painted<&T>

Returns self with the bg() set to [Color::Primary].

Example
println!("{}", value.on_primary());
§

fn on_fixed(&self, color: u8) -> Painted<&T>

Returns self with the bg() set to [Color::Fixed].

Example
println!("{}", value.on_fixed(color));
§

fn on_rgb(&self, r: u8, g: u8, b: u8) -> Painted<&T>

Returns self with the bg() set to [Color::Rgb].

Example
println!("{}", value.on_rgb(r, g, b));
§

fn on_black(&self) -> Painted<&T>

Returns self with the bg() set to [Color::Black].

Example
println!("{}", value.on_black());
§

fn on_red(&self) -> Painted<&T>

Returns self with the bg() set to [Color::Red].

Example
println!("{}", value.on_red());
§

fn on_green(&self) -> Painted<&T>

Returns self with the bg() set to [Color::Green].

Example
println!("{}", value.on_green());
§

fn on_yellow(&self) -> Painted<&T>

Returns self with the bg() set to [Color::Yellow].

Example
println!("{}", value.on_yellow());
§

fn on_blue(&self) -> Painted<&T>

Returns self with the bg() set to [Color::Blue].

Example
println!("{}", value.on_blue());
§

fn on_magenta(&self) -> Painted<&T>

Returns self with the bg() set to [Color::Magenta].

Example
println!("{}", value.on_magenta());
§

fn on_cyan(&self) -> Painted<&T>

Returns self with the bg() set to [Color::Cyan].

Example
println!("{}", value.on_cyan());
§

fn on_white(&self) -> Painted<&T>

Returns self with the bg() set to [Color::White].

Example
println!("{}", value.on_white());
§

fn on_bright_black(&self) -> Painted<&T>

Returns self with the bg() set to [Color::BrightBlack].

Example
println!("{}", value.on_bright_black());
§

fn on_bright_red(&self) -> Painted<&T>

Returns self with the bg() set to [Color::BrightRed].

Example
println!("{}", value.on_bright_red());
§

fn on_bright_green(&self) -> Painted<&T>

Returns self with the bg() set to [Color::BrightGreen].

Example
println!("{}", value.on_bright_green());
§

fn on_bright_yellow(&self) -> Painted<&T>

Returns self with the bg() set to [Color::BrightYellow].

Example
println!("{}", value.on_bright_yellow());
§

fn on_bright_blue(&self) -> Painted<&T>

Returns self with the bg() set to [Color::BrightBlue].

Example
println!("{}", value.on_bright_blue());
§

fn on_bright_magenta(&self) -> Painted<&T>

Returns self with the bg() set to [Color::BrightMagenta].

Example
println!("{}", value.on_bright_magenta());
§

fn on_bright_cyan(&self) -> Painted<&T>

Returns self with the bg() set to [Color::BrightCyan].

Example
println!("{}", value.on_bright_cyan());
§

fn on_bright_white(&self) -> Painted<&T>

Returns self with the bg() set to [Color::BrightWhite].

Example
println!("{}", value.on_bright_white());
§

fn attr(&self, value: Attribute) -> Painted<&T>

Enables the styling [Attribute] value.

This method should be used rarely. Instead, prefer to use attribute-specific builder methods like bold() and underline(), which have the same functionality but are pithier.

Example

Make text bold using attr():

use yansi::{Paint, Attribute};

painted.attr(Attribute::Bold);

Make text bold using using bold().

use yansi::Paint;

painted.bold();
§

fn bold(&self) -> Painted<&T>

Returns self with the attr() set to [Attribute::Bold].

Example
println!("{}", value.bold());
§

fn dim(&self) -> Painted<&T>

Returns self with the attr() set to [Attribute::Dim].

Example
println!("{}", value.dim());
§

fn italic(&self) -> Painted<&T>

Returns self with the attr() set to [Attribute::Italic].

Example
println!("{}", value.italic());
§

fn underline(&self) -> Painted<&T>

Returns self with the attr() set to [Attribute::Underline].

Example
println!("{}", value.underline());

Returns self with the attr() set to [Attribute::Blink].

Example
println!("{}", value.blink());

Returns self with the attr() set to [Attribute::RapidBlink].

Example
println!("{}", value.rapid_blink());
§

fn invert(&self) -> Painted<&T>

Returns self with the attr() set to [Attribute::Invert].

Example
println!("{}", value.invert());
§

fn conceal(&self) -> Painted<&T>

Returns self with the attr() set to [Attribute::Conceal].

Example
println!("{}", value.conceal());
§

fn strike(&self) -> Painted<&T>

Returns self with the attr() set to [Attribute::Strike].

Example
println!("{}", value.strike());
§

fn quirk(&self, value: Quirk) -> Painted<&T>

Enables the yansi [Quirk] value.

This method should be used rarely. Instead, prefer to use quirk-specific builder methods like mask() and wrap(), which have the same functionality but are pithier.

Example

Enable wrapping using .quirk():

use yansi::{Paint, Quirk};

painted.quirk(Quirk::Wrap);

Enable wrapping using wrap().

use yansi::Paint;

painted.wrap();
§

fn mask(&self) -> Painted<&T>

Returns self with the quirk() set to [Quirk::Mask].

Example
println!("{}", value.mask());
§

fn wrap(&self) -> Painted<&T>

Returns self with the quirk() set to [Quirk::Wrap].

Example
println!("{}", value.wrap());
§

fn linger(&self) -> Painted<&T>

Returns self with the quirk() set to [Quirk::Linger].

Example
println!("{}", value.linger());
§

fn clear(&self) -> Painted<&T>

Returns self with the quirk() set to [Quirk::Clear].

Example
println!("{}", value.clear());
§

fn bright(&self) -> Painted<&T>

Returns self with the quirk() set to [Quirk::Bright].

Example
println!("{}", value.bright());
§

fn on_bright(&self) -> Painted<&T>

Returns self with the quirk() set to [Quirk::OnBright].

Example
println!("{}", value.on_bright());
§

fn whenever(&self, value: Condition) -> Painted<&T>

Conditionally enable styling based on whether the [Condition] value applies. Replaces any previous condition.

See the crate level docs for more details.

Example

Enable styling painted only when both stdout and stderr are TTYs:

use yansi::{Paint, Condition};

painted.red().on_yellow().whenever(Condition::STDOUTERR_ARE_TTY);
§

fn new(self) -> Painted<Self>where Self: Sized,

Create a new [Painted] with a default [Style]. Read more
§

fn paint<S>(&self, style: S) -> Painted<&Self>where S: Into<Style>,

Apply a style wholesale to self. Any previous style is replaced. Read more
§

impl<T> Pipe for Twhere T: ?Sized,

§

fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> Rwhere Self: Sized,

Pipes by value. This is generally the method you want to use. Read more
§

fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> Rwhere R: 'a,

Borrows self and passes that borrow into the pipe function. Read more
§

fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> Rwhere R: 'a,

Mutably borrows self and passes that borrow into the pipe function. Read more
§

fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> Rwhere Self: Borrow<B>, B: 'a + ?Sized, R: 'a,

Borrows self, then passes self.borrow() into the pipe function. Read more
§

fn pipe_borrow_mut<'a, B, R>( &'a mut self, func: impl FnOnce(&'a mut B) -> R ) -> Rwhere Self: BorrowMut<B>, B: 'a + ?Sized, R: 'a,

Mutably borrows self, then passes self.borrow_mut() into the pipe function. Read more
§

fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> Rwhere Self: AsRef<U>, U: 'a + ?Sized, R: 'a,

Borrows self, then passes self.as_ref() into the pipe function.
§

fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> Rwhere Self: AsMut<U>, U: 'a + ?Sized, R: 'a,

Mutably borrows self, then passes self.as_mut() into the pipe function.
§

fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> Rwhere Self: Deref<Target = T>, T: 'a + ?Sized, R: 'a,

Borrows self, then passes self.deref() into the pipe function.
§

fn pipe_deref_mut<'a, T, R>( &'a mut self, func: impl FnOnce(&'a mut T) -> R ) -> Rwhere Self: DerefMut<Target = T> + Deref, T: 'a + ?Sized, R: 'a,

Mutably borrows self, then passes self.deref_mut() into the pipe function.
§

impl<T> Pointable for T

§

const ALIGN: usize = _

The alignment of pointer.
§

type Init = T

The type for initializers.
§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
source§

impl<T> Same<T> for T

§

type Output = T

Should always be Self
§

impl<T> Tap for T

§

fn tap(self, func: impl FnOnce(&Self)) -> Self

Immutable access to a value. Read more
§

fn tap_mut(self, func: impl FnOnce(&mut Self)) -> Self

Mutable access to a value. Read more
§

fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Selfwhere Self: Borrow<B>, B: ?Sized,

Immutable access to the Borrow<B> of a value. Read more
§

fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Selfwhere Self: BorrowMut<B>, B: ?Sized,

Mutable access to the BorrowMut<B> of a value. Read more
§

fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Selfwhere Self: AsRef<R>, R: ?Sized,

Immutable access to the AsRef<R> view of a value. Read more
§

fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Selfwhere Self: AsMut<R>, R: ?Sized,

Mutable access to the AsMut<R> view of a value. Read more
§

fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Selfwhere Self: Deref<Target = T>, T: ?Sized,

Immutable access to the Deref::Target of a value. Read more
§

fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Selfwhere Self: DerefMut<Target = T> + Deref, T: ?Sized,

Mutable access to the Deref::Target of a value. Read more
§

fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self

Calls .tap() only in debug builds, and is erased in release builds.
§

fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self

Calls .tap_mut() only in debug builds, and is erased in release builds.
§

fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Selfwhere Self: Borrow<B>, B: ?Sized,

Calls .tap_borrow() only in debug builds, and is erased in release builds.
§

fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Selfwhere Self: BorrowMut<B>, B: ?Sized,

Calls .tap_borrow_mut() only in debug builds, and is erased in release builds.
§

fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Selfwhere Self: AsRef<R>, R: ?Sized,

Calls .tap_ref() only in debug builds, and is erased in release builds.
§

fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Selfwhere Self: AsMut<R>, R: ?Sized,

Calls .tap_ref_mut() only in debug builds, and is erased in release builds.
§

fn tap_deref_dbg<T>(self, func: impl FnOnce(&T)) -> Selfwhere Self: Deref<Target = T>, T: ?Sized,

Calls .tap_deref() only in debug builds, and is erased in release builds.
§

fn tap_deref_mut_dbg<T>(self, func: impl FnOnce(&mut T)) -> Selfwhere Self: DerefMut<Target = T> + Deref, T: ?Sized,

Calls .tap_deref_mut() only in debug builds, and is erased in release builds.
source§

impl<T> ToOwned for Twhere T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
§

impl<T> TryConv for T

§

fn try_conv<T>(self) -> Result<T, Self::Error>where Self: TryInto<T>,

Attempts to convert self into T using TryInto<T>. Read more
source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<V, T> VZip<V> for Twhere V: MultiLane<T>,

§

fn vzip(self) -> V

source§

impl<T> WithSubscriber for T

source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
source§

impl<T> DeserializeOwned for Twhere T: for<'de> Deserialize<'de>,

§

impl<T> JsonSchemaMaybe for T