repo stringlengths 6 65 | file_url stringlengths 81 311 | file_path stringlengths 6 227 | content stringlengths 0 32.8k | language stringclasses 1
value | license stringclasses 7
values | commit_sha stringlengths 40 40 | retrieved_at stringdate 2026-01-04 15:31:58 2026-01-04 20:25:31 | truncated bool 2
classes |
|---|---|---|---|---|---|---|---|---|
foundry-rs/foundry | https://github.com/foundry-rs/foundry/blob/271c34d2550474a8ded7fbeedff398b920a96689/crates/cheatcodes/src/script.rs | crates/cheatcodes/src/script.rs | //! Implementations of [`Scripting`](spec::Group::Scripting) cheatcodes.
use crate::{Cheatcode, CheatsCtxt, Result, Vm::*, evm::journaled_account};
use alloy_consensus::{SidecarBuilder, SimpleCoder};
use alloy_primitives::{Address, B256, U256, Uint};
use alloy_rpc_types::Authorization;
use alloy_signer::SignerSync;
us... | rust | Apache-2.0 | 271c34d2550474a8ded7fbeedff398b920a96689 | 2026-01-04T15:43:23.630446Z | false |
foundry-rs/foundry | https://github.com/foundry-rs/foundry/blob/271c34d2550474a8ded7fbeedff398b920a96689/crates/cheatcodes/src/inspector.rs | crates/cheatcodes/src/inspector.rs | //! Cheatcode EVM inspector.
use crate::{
CheatsConfig, CheatsCtxt, DynCheatcode, Error, Result,
Vm::{self, AccountAccess},
evm::{
DealRecord, GasRecord, RecordAccess, journaled_account,
mock::{MockCallDataContext, MockCallReturnData},
prank::Prank,
},
inspector::utils::Comm... | rust | Apache-2.0 | 271c34d2550474a8ded7fbeedff398b920a96689 | 2026-01-04T15:43:23.630446Z | true |
foundry-rs/foundry | https://github.com/foundry-rs/foundry/blob/271c34d2550474a8ded7fbeedff398b920a96689/crates/cheatcodes/src/crypto.rs | crates/cheatcodes/src/crypto.rs | //! Implementations of [`Crypto`](spec::Group::Crypto) Cheatcodes.
use crate::{Cheatcode, Cheatcodes, Result, Vm::*};
use alloy_primitives::{Address, B256, U256, keccak256};
use alloy_signer::{Signer, SignerSync};
use alloy_signer_local::{
LocalSigner, MnemonicBuilder, PrivateKeySigner,
coins_bip39::{
... | rust | Apache-2.0 | 271c34d2550474a8ded7fbeedff398b920a96689 | 2026-01-04T15:43:23.630446Z | false |
foundry-rs/foundry | https://github.com/foundry-rs/foundry/blob/271c34d2550474a8ded7fbeedff398b920a96689/crates/cheatcodes/src/toml.rs | crates/cheatcodes/src/toml.rs | //! Implementations of [`Toml`](spec::Group::Toml) cheatcodes.
use crate::{
Cheatcode, Cheatcodes, Result,
Vm::*,
json::{
check_json_key_exists, parse_json, parse_json_coerce, parse_json_keys, resolve_type,
upsert_json_value,
},
};
use alloy_dyn_abi::DynSolType;
use alloy_sol_types::Sol... | rust | Apache-2.0 | 271c34d2550474a8ded7fbeedff398b920a96689 | 2026-01-04T15:43:23.630446Z | false |
foundry-rs/foundry | https://github.com/foundry-rs/foundry/blob/271c34d2550474a8ded7fbeedff398b920a96689/crates/cheatcodes/src/evm/mapping.rs | crates/cheatcodes/src/evm/mapping.rs | use crate::{Cheatcode, Cheatcodes, Result, Vm::*};
use alloy_primitives::{Address, B256};
use alloy_sol_types::SolValue;
use foundry_common::mapping_slots::MappingSlots;
impl Cheatcode for startMappingRecordingCall {
fn apply(&self, state: &mut Cheatcodes) -> Result {
let Self {} = self;
state.mapp... | rust | Apache-2.0 | 271c34d2550474a8ded7fbeedff398b920a96689 | 2026-01-04T15:43:23.630446Z | false |
foundry-rs/foundry | https://github.com/foundry-rs/foundry/blob/271c34d2550474a8ded7fbeedff398b920a96689/crates/cheatcodes/src/evm/record_debug_step.rs | crates/cheatcodes/src/evm/record_debug_step.rs | use alloy_primitives::{Bytes, U256};
use foundry_evm_traces::CallTraceArena;
use revm::{bytecode::opcode::OpCode, interpreter::InstructionResult};
use foundry_evm_core::buffer::{BufferKind, get_buffer_accesses};
use revm_inspectors::tracing::types::{
CallTraceNode, CallTraceStep, RecordedMemory, TraceMemberOrder,... | rust | Apache-2.0 | 271c34d2550474a8ded7fbeedff398b920a96689 | 2026-01-04T15:43:23.630446Z | false |
foundry-rs/foundry | https://github.com/foundry-rs/foundry/blob/271c34d2550474a8ded7fbeedff398b920a96689/crates/cheatcodes/src/evm/prank.rs | crates/cheatcodes/src/evm/prank.rs | use crate::{Cheatcode, CheatsCtxt, Result, Vm::*, evm::journaled_account};
use alloy_primitives::Address;
use revm::context::JournalTr;
/// Prank information.
#[derive(Clone, Copy, Debug, Default)]
pub struct Prank {
/// Address of the contract that initiated the prank
pub prank_caller: Address,
/// Addres... | rust | Apache-2.0 | 271c34d2550474a8ded7fbeedff398b920a96689 | 2026-01-04T15:43:23.630446Z | false |
foundry-rs/foundry | https://github.com/foundry-rs/foundry/blob/271c34d2550474a8ded7fbeedff398b920a96689/crates/cheatcodes/src/evm/mock.rs | crates/cheatcodes/src/evm/mock.rs | use crate::{Cheatcode, Cheatcodes, CheatsCtxt, Result, Vm::*};
use alloy_primitives::{Address, Bytes, U256};
use revm::{bytecode::Bytecode, context::JournalTr, interpreter::InstructionResult};
use std::{cmp::Ordering, collections::VecDeque};
/// Mocked call data.
#[derive(Clone, Debug, Default, PartialEq, Eq, Hash)]
p... | rust | Apache-2.0 | 271c34d2550474a8ded7fbeedff398b920a96689 | 2026-01-04T15:43:23.630446Z | false |
foundry-rs/foundry | https://github.com/foundry-rs/foundry/blob/271c34d2550474a8ded7fbeedff398b920a96689/crates/cheatcodes/src/evm/fork.rs | crates/cheatcodes/src/evm/fork.rs | use crate::{
Cheatcode, Cheatcodes, CheatcodesExecutor, CheatsCtxt, DatabaseExt, Result, Vm::*,
json::json_value_to_token,
};
use alloy_dyn_abi::DynSolValue;
use alloy_primitives::{B256, U256};
use alloy_provider::Provider;
use alloy_rpc_types::Filter;
use alloy_sol_types::SolValue;
use foundry_common::provider... | rust | Apache-2.0 | 271c34d2550474a8ded7fbeedff398b920a96689 | 2026-01-04T15:43:23.630446Z | false |
foundry-rs/foundry | https://github.com/foundry-rs/foundry/blob/271c34d2550474a8ded7fbeedff398b920a96689/crates/cheatcodes/src/test/assert.rs | crates/cheatcodes/src/test/assert.rs | use crate::{CheatcodesExecutor, CheatsCtxt, Result, Vm::*};
use alloy_primitives::{I256, U256, U512};
use foundry_evm_core::{
abi::console::{format_units_int, format_units_uint},
backend::GLOBAL_FAIL_SLOT,
constants::CHEATCODE_ADDRESS,
};
use itertools::Itertools;
use revm::context::JournalTr;
use std::{bor... | rust | Apache-2.0 | 271c34d2550474a8ded7fbeedff398b920a96689 | 2026-01-04T15:43:23.630446Z | false |
foundry-rs/foundry | https://github.com/foundry-rs/foundry/blob/271c34d2550474a8ded7fbeedff398b920a96689/crates/cheatcodes/src/test/revert_handlers.rs | crates/cheatcodes/src/test/revert_handlers.rs | use crate::{Error, Result};
use alloy_dyn_abi::{DynSolValue, ErrorExt};
use alloy_primitives::{Address, Bytes, address, hex};
use alloy_sol_types::{SolError, SolValue};
use foundry_common::{ContractsByArtifact, abi::get_error};
use foundry_evm_core::decode::RevertDecoder;
use revm::interpreter::{InstructionResult, retu... | rust | Apache-2.0 | 271c34d2550474a8ded7fbeedff398b920a96689 | 2026-01-04T15:43:23.630446Z | false |
foundry-rs/foundry | https://github.com/foundry-rs/foundry/blob/271c34d2550474a8ded7fbeedff398b920a96689/crates/cheatcodes/src/test/expect.rs | crates/cheatcodes/src/test/expect.rs | use std::{
collections::VecDeque,
fmt::{self, Display},
};
use crate::{Cheatcode, Cheatcodes, CheatsCtxt, Error, Result, Vm::*};
use alloy_dyn_abi::{DynSolValue, EventExt};
use alloy_json_abi::Event;
use alloy_primitives::{
Address, Bytes, LogData as RawLog, U256, hex,
map::{AddressHashMap, HashMap, ha... | rust | Apache-2.0 | 271c34d2550474a8ded7fbeedff398b920a96689 | 2026-01-04T15:43:23.630446Z | true |
foundry-rs/foundry | https://github.com/foundry-rs/foundry/blob/271c34d2550474a8ded7fbeedff398b920a96689/crates/cheatcodes/src/test/assume.rs | crates/cheatcodes/src/test/assume.rs | use crate::{Cheatcode, Cheatcodes, CheatsCtxt, Error, Result};
use alloy_primitives::Address;
use foundry_evm_core::constants::MAGIC_ASSUME;
use spec::Vm::{
PotentialRevert, assumeCall, assumeNoRevert_0Call, assumeNoRevert_1Call, assumeNoRevert_2Call,
};
use std::fmt::Debug;
#[derive(Clone, Debug)]
pub struct Assu... | rust | Apache-2.0 | 271c34d2550474a8ded7fbeedff398b920a96689 | 2026-01-04T15:43:23.630446Z | false |
foundry-rs/foundry | https://github.com/foundry-rs/foundry/blob/271c34d2550474a8ded7fbeedff398b920a96689/crates/cheatcodes/src/inspector/analysis.rs | crates/cheatcodes/src/inspector/analysis.rs | //! Cheatcode information, extracted from the syntactic and semantic analysis of the sources.
use foundry_common::fmt::{StructDefinitions, TypeDefMap};
use solar::sema::{self, Compiler, Gcx, hir};
use std::sync::{Arc, OnceLock};
use thiserror::Error;
/// Represents a failure in one of the lazy analysis steps.
#[deriv... | rust | Apache-2.0 | 271c34d2550474a8ded7fbeedff398b920a96689 | 2026-01-04T15:43:23.630446Z | false |
foundry-rs/foundry | https://github.com/foundry-rs/foundry/blob/271c34d2550474a8ded7fbeedff398b920a96689/crates/cheatcodes/src/inspector/utils.rs | crates/cheatcodes/src/inspector/utils.rs | use super::Ecx;
use crate::inspector::Cheatcodes;
use alloy_primitives::{Address, Bytes, U256};
use revm::interpreter::{CreateInputs, CreateScheme};
/// Common behaviour of legacy and EOF create inputs.
pub(crate) trait CommonCreateInput {
fn caller(&self) -> Address;
fn gas_limit(&self) -> u64;
fn value(&... | rust | Apache-2.0 | 271c34d2550474a8ded7fbeedff398b920a96689 | 2026-01-04T15:43:23.630446Z | false |
foundry-rs/foundry | https://github.com/foundry-rs/foundry/blob/271c34d2550474a8ded7fbeedff398b920a96689/crates/cheatcodes/spec/src/vm.rs | crates/cheatcodes/spec/src/vm.rs | // We don't document function parameters individually so we can't enable `missing_docs` for this
// module. Instead, we emit custom diagnostics in `#[derive(Cheatcode)]`.
#![allow(missing_docs)]
use super::*;
use crate::Vm::ForgeContext;
use alloy_sol_types::sol;
use foundry_macros::Cheatcode;
sol! {
// Cheatcodes ar... | rust | Apache-2.0 | 271c34d2550474a8ded7fbeedff398b920a96689 | 2026-01-04T15:43:23.630446Z | true |
foundry-rs/foundry | https://github.com/foundry-rs/foundry/blob/271c34d2550474a8ded7fbeedff398b920a96689/crates/cheatcodes/spec/src/lib.rs | crates/cheatcodes/spec/src/lib.rs | //! Cheatcode specification for Foundry.
#![cfg_attr(not(test), warn(unused_crate_dependencies))]
#![cfg_attr(docsrs, feature(doc_cfg))]
use serde::{Deserialize, Serialize};
use std::{borrow::Cow, fmt};
mod cheatcode;
pub use cheatcode::{Cheatcode, CheatcodeDef, Group, Safety, Status};
mod function;
pub use functio... | rust | Apache-2.0 | 271c34d2550474a8ded7fbeedff398b920a96689 | 2026-01-04T15:43:23.630446Z | false |
foundry-rs/foundry | https://github.com/foundry-rs/foundry/blob/271c34d2550474a8ded7fbeedff398b920a96689/crates/cheatcodes/spec/src/items.rs | crates/cheatcodes/spec/src/items.rs | use serde::{Deserialize, Serialize};
use std::{borrow::Cow, fmt};
/// A Solidity custom error.
#[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]
#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
#[serde(rename_all = "camelCase")]
pub struct Error<'a> {
/// The name of the ... | rust | Apache-2.0 | 271c34d2550474a8ded7fbeedff398b920a96689 | 2026-01-04T15:43:23.630446Z | false |
foundry-rs/foundry | https://github.com/foundry-rs/foundry/blob/271c34d2550474a8ded7fbeedff398b920a96689/crates/cheatcodes/spec/src/function.rs | crates/cheatcodes/spec/src/function.rs | use serde::{Deserialize, Serialize};
use std::fmt;
/// Solidity function.
#[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]
#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
#[serde(rename_all = "camelCase")]
#[non_exhaustive]
pub struct Function<'a> {
/// The function's u... | rust | Apache-2.0 | 271c34d2550474a8ded7fbeedff398b920a96689 | 2026-01-04T15:43:23.630446Z | false |
foundry-rs/foundry | https://github.com/foundry-rs/foundry/blob/271c34d2550474a8ded7fbeedff398b920a96689/crates/cheatcodes/spec/src/cheatcode.rs | crates/cheatcodes/spec/src/cheatcode.rs | use super::Function;
use alloy_sol_types::SolCall;
use serde::{Deserialize, Serialize};
/// Cheatcode definition trait. Implemented by all [`Vm`](crate::Vm) functions.
pub trait CheatcodeDef: std::fmt::Debug + Clone + SolCall {
/// The static cheatcode definition.
const CHEATCODE: &'static Cheatcode<'static>;
... | rust | Apache-2.0 | 271c34d2550474a8ded7fbeedff398b920a96689 | 2026-01-04T15:43:23.630446Z | false |
foundry-rs/foundry | https://github.com/foundry-rs/foundry/blob/271c34d2550474a8ded7fbeedff398b920a96689/crates/primitives/src/lib.rs | crates/primitives/src/lib.rs | //! Foundry primitives
mod network;
mod transaction;
pub use network::*;
pub use transaction::*;
| rust | Apache-2.0 | 271c34d2550474a8ded7fbeedff398b920a96689 | 2026-01-04T15:43:23.630446Z | false |
foundry-rs/foundry | https://github.com/foundry-rs/foundry/blob/271c34d2550474a8ded7fbeedff398b920a96689/crates/primitives/src/transaction/envelope.rs | crates/primitives/src/transaction/envelope.rs | use alloy_consensus::{
Sealed, Signed, TransactionEnvelope, TxEip1559, TxEip2930, TxEnvelope, TxLegacy, TxType,
Typed2718,
crypto::RecoveryError,
transaction::{
TxEip7702,
eip4844::{TxEip4844Variant, TxEip4844WithSidecar},
},
};
use alloy_evm::FromRecoveredTx;
use alloy_network::{Any... | rust | Apache-2.0 | 271c34d2550474a8ded7fbeedff398b920a96689 | 2026-01-04T15:43:23.630446Z | false |
foundry-rs/foundry | https://github.com/foundry-rs/foundry/blob/271c34d2550474a8ded7fbeedff398b920a96689/crates/primitives/src/transaction/receipt.rs | crates/primitives/src/transaction/receipt.rs | use alloy_consensus::{
Eip658Value, Receipt, ReceiptEnvelope, ReceiptWithBloom, TxReceipt, Typed2718,
};
use alloy_network::eip2718::{
Decodable2718, EIP1559_TX_TYPE_ID, EIP2930_TX_TYPE_ID, EIP4844_TX_TYPE_ID, EIP7702_TX_TYPE_ID,
Eip2718Error, Encodable2718, LEGACY_TX_TYPE_ID,
};
use alloy_primitives::{Bloo... | rust | Apache-2.0 | 271c34d2550474a8ded7fbeedff398b920a96689 | 2026-01-04T15:43:23.630446Z | false |
foundry-rs/foundry | https://github.com/foundry-rs/foundry/blob/271c34d2550474a8ded7fbeedff398b920a96689/crates/primitives/src/transaction/mod.rs | crates/primitives/src/transaction/mod.rs | mod envelope;
mod receipt;
mod request;
pub use envelope::{FoundryTxEnvelope, FoundryTxType, FoundryTypedTx};
pub use receipt::FoundryReceiptEnvelope;
pub use request::{FoundryTransactionRequest, get_deposit_tx_parts};
| rust | Apache-2.0 | 271c34d2550474a8ded7fbeedff398b920a96689 | 2026-01-04T15:43:23.630446Z | false |
foundry-rs/foundry | https://github.com/foundry-rs/foundry/blob/271c34d2550474a8ded7fbeedff398b920a96689/crates/primitives/src/transaction/request.rs | crates/primitives/src/transaction/request.rs | use alloy_consensus::EthereumTypedTransaction;
use alloy_network::{
BuildResult, NetworkWallet, TransactionBuilder, TransactionBuilder4844, TransactionBuilderError,
};
use alloy_primitives::{Address, B256, ChainId, TxKind, U256};
use alloy_rpc_types::{AccessList, TransactionInputKind, TransactionRequest};
use alloy... | rust | Apache-2.0 | 271c34d2550474a8ded7fbeedff398b920a96689 | 2026-01-04T15:43:23.630446Z | false |
foundry-rs/foundry | https://github.com/foundry-rs/foundry/blob/271c34d2550474a8ded7fbeedff398b920a96689/crates/primitives/src/network/receipt.rs | crates/primitives/src/network/receipt.rs | use alloy_consensus::{Receipt, TxReceipt};
use alloy_network::{AnyReceiptEnvelope, AnyTransactionReceipt, ReceiptResponse};
use alloy_primitives::{Address, B256, BlockHash, TxHash, U64};
use alloy_rpc_types::{ConversionError, Log, TransactionReceipt};
use alloy_serde::WithOtherFields;
use derive_more::AsRef;
use op_all... | rust | Apache-2.0 | 271c34d2550474a8ded7fbeedff398b920a96689 | 2026-01-04T15:43:23.630446Z | false |
foundry-rs/foundry | https://github.com/foundry-rs/foundry/blob/271c34d2550474a8ded7fbeedff398b920a96689/crates/primitives/src/network/mod.rs | crates/primitives/src/network/mod.rs | use alloy_network::Network;
mod receipt;
pub use receipt::*;
/// Foundry network type.
///
/// This network type supports Foundry-specific transaction types, including
/// op-stack deposit transactions, alongside standard Ethereum transaction types.
///
/// Note: This is a basic implementation ("for now") that provi... | rust | Apache-2.0 | 271c34d2550474a8ded7fbeedff398b920a96689 | 2026-01-04T15:43:23.630446Z | false |
foundry-rs/foundry | https://github.com/foundry-rs/foundry/blob/271c34d2550474a8ded7fbeedff398b920a96689/crates/common/build.rs | crates/common/build.rs | #![expect(clippy::disallowed_macros)]
use chrono::DateTime;
use std::{error::Error, path::PathBuf};
use vergen::EmitBuilder;
fn main() -> Result<(), Box<dyn Error>> {
println!("cargo:rerun-if-changed=build.rs");
EmitBuilder::builder()
.build_date()
.build_timestamp()
.git_describe(fal... | rust | Apache-2.0 | 271c34d2550474a8ded7fbeedff398b920a96689 | 2026-01-04T15:43:23.630446Z | false |
foundry-rs/foundry | https://github.com/foundry-rs/foundry/blob/271c34d2550474a8ded7fbeedff398b920a96689/crates/common/src/lib.rs | crates/common/src/lib.rs | //! # foundry-common
//!
//! Common utilities for building and using foundry's tools.
#![cfg_attr(not(test), warn(unused_crate_dependencies))]
#![cfg_attr(docsrs, feature(doc_cfg))]
#[expect(unused_extern_crates)] // Used by `ConsoleFmt`.
extern crate self as foundry_common;
#[macro_use]
extern crate tracing;
#[mac... | rust | Apache-2.0 | 271c34d2550474a8ded7fbeedff398b920a96689 | 2026-01-04T15:43:23.630446Z | false |
foundry-rs/foundry | https://github.com/foundry-rs/foundry/blob/271c34d2550474a8ded7fbeedff398b920a96689/crates/common/src/slot_identifier.rs | crates/common/src/slot_identifier.rs | //! Storage slot identification and decoding utilities for Solidity storage layouts.
//!
//! This module provides functionality to identify and decode storage slots based on
//! Solidity storage layout information from the compiler.
use crate::mapping_slots::MappingSlots;
use alloy_dyn_abi::{DynSolType, DynSolValue};
... | rust | Apache-2.0 | 271c34d2550474a8ded7fbeedff398b920a96689 | 2026-01-04T15:43:23.630446Z | true |
foundry-rs/foundry | https://github.com/foundry-rs/foundry/blob/271c34d2550474a8ded7fbeedff398b920a96689/crates/common/src/version.rs | crates/common/src/version.rs | //! Foundry version information.
/// The SemVer compatible version information for Foundry.
pub const SEMVER_VERSION: &str = env!("FOUNDRY_SEMVER_VERSION");
/// The short version message information for the Foundry CLI.
pub const SHORT_VERSION: &str = env!("FOUNDRY_SHORT_VERSION");
/// The long version message infor... | rust | Apache-2.0 | 271c34d2550474a8ded7fbeedff398b920a96689 | 2026-01-04T15:43:23.630446Z | false |
foundry-rs/foundry | https://github.com/foundry-rs/foundry/blob/271c34d2550474a8ded7fbeedff398b920a96689/crates/common/src/calc.rs | crates/common/src/calc.rs | //! Commonly used calculations.
/// Returns the mean of the slice.
pub fn mean(values: &[u64]) -> u64 {
if values.is_empty() {
return 0;
}
(values.iter().map(|x| *x as u128).sum::<u128>() / values.len() as u128) as u64
}
/// Returns the median of a _sorted_ slice.
pub fn median_sorted(values: &[u... | rust | Apache-2.0 | 271c34d2550474a8ded7fbeedff398b920a96689 | 2026-01-04T15:43:23.630446Z | false |
foundry-rs/foundry | https://github.com/foundry-rs/foundry/blob/271c34d2550474a8ded7fbeedff398b920a96689/crates/common/src/transactions.rs | crates/common/src/transactions.rs | //! Wrappers for transactions.
use alloy_consensus::{Transaction, TxEnvelope, transaction::SignerRecoverable};
use alloy_eips::eip7702::SignedAuthorization;
use alloy_network::AnyTransactionReceipt;
use alloy_primitives::{Address, Bytes, TxKind, U256};
use alloy_provider::{
Provider,
network::{AnyNetwork, Rece... | rust | Apache-2.0 | 271c34d2550474a8ded7fbeedff398b920a96689 | 2026-01-04T15:43:23.630446Z | false |
foundry-rs/foundry | https://github.com/foundry-rs/foundry/blob/271c34d2550474a8ded7fbeedff398b920a96689/crates/common/src/compile.rs | crates/common/src/compile.rs | //! Support for compiling [foundry_compilers::Project]
use crate::{
TestFunctionExt, preprocessor::DynamicTestLinkingPreprocessor, shell, term::SpinnerReporter,
};
use comfy_table::{Cell, Color, Table, modifiers::UTF8_ROUND_CORNERS, presets::ASCII_MARKDOWN};
use eyre::Result;
use foundry_block_explorers::contract:... | rust | Apache-2.0 | 271c34d2550474a8ded7fbeedff398b920a96689 | 2026-01-04T15:43:23.630446Z | false |
foundry-rs/foundry | https://github.com/foundry-rs/foundry/blob/271c34d2550474a8ded7fbeedff398b920a96689/crates/common/src/fs.rs | crates/common/src/fs.rs | //! Contains various `std::fs` wrapper functions that also contain the target path in their errors.
use crate::errors::FsPathError;
use flate2::{Compression, read::GzDecoder, write::GzEncoder};
use serde::{Serialize, de::DeserializeOwned};
use std::{
fs::{self, File},
io::{BufReader, BufWriter, Read, Seek, See... | rust | Apache-2.0 | 271c34d2550474a8ded7fbeedff398b920a96689 | 2026-01-04T15:43:23.630446Z | false |
foundry-rs/foundry | https://github.com/foundry-rs/foundry/blob/271c34d2550474a8ded7fbeedff398b920a96689/crates/common/src/abi.rs | crates/common/src/abi.rs | //! ABI related helper functions.
use alloy_chains::Chain;
use alloy_dyn_abi::{DynSolType, DynSolValue, FunctionExt, JsonAbiExt};
use alloy_json_abi::{Error, Event, Function, Param};
use alloy_primitives::{Address, LogData, hex};
use eyre::{Context, ContextCompat, Result};
use foundry_block_explorers::{Client, contrac... | rust | Apache-2.0 | 271c34d2550474a8ded7fbeedff398b920a96689 | 2026-01-04T15:43:23.630446Z | false |
foundry-rs/foundry | https://github.com/foundry-rs/foundry/blob/271c34d2550474a8ded7fbeedff398b920a96689/crates/common/src/selectors.rs | crates/common/src/selectors.rs | //! Support for handling/identifying selectors.
#![allow(missing_docs)]
use crate::{abi::abi_decode_calldata, provider::runtime_transport::RuntimeTransportBuilder};
use alloy_json_abi::JsonAbi;
use alloy_primitives::{B256, Selector, map::HashMap};
use eyre::Context;
use itertools::Itertools;
use serde::{Deserialize, ... | rust | Apache-2.0 | 271c34d2550474a8ded7fbeedff398b920a96689 | 2026-01-04T15:43:23.630446Z | false |
foundry-rs/foundry | https://github.com/foundry-rs/foundry/blob/271c34d2550474a8ded7fbeedff398b920a96689/crates/common/src/contracts.rs | crates/common/src/contracts.rs | //! Commonly used contract types and functions.
use crate::{compile::PathOrContractInfo, find_metadata_start, strip_bytecode_placeholders};
use alloy_dyn_abi::JsonAbiExt;
use alloy_json_abi::{Event, Function, JsonAbi};
use alloy_primitives::{Address, B256, Bytes, Selector, hex};
use eyre::{OptionExt, Result};
use foun... | rust | Apache-2.0 | 271c34d2550474a8ded7fbeedff398b920a96689 | 2026-01-04T15:43:23.630446Z | false |
foundry-rs/foundry | https://github.com/foundry-rs/foundry/blob/271c34d2550474a8ded7fbeedff398b920a96689/crates/common/src/utils.rs | crates/common/src/utils.rs | //! Uncategorised utilities.
use alloy_primitives::{B256, Bytes, U256, hex, keccak256};
use foundry_compilers::{
Project,
artifacts::{BytecodeObject, SolcLanguage},
error::SolcError,
flatten::{Flattener, FlattenerError},
};
use regex::Regex;
use std::{path::Path, sync::LazyLock};
static BYTECODE_PLACE... | rust | Apache-2.0 | 271c34d2550474a8ded7fbeedff398b920a96689 | 2026-01-04T15:43:23.630446Z | false |
foundry-rs/foundry | https://github.com/foundry-rs/foundry/blob/271c34d2550474a8ded7fbeedff398b920a96689/crates/common/src/mapping_slots.rs | crates/common/src/mapping_slots.rs | use alloy_primitives::{
B256, U256, keccak256,
map::{AddressHashMap, B256HashMap},
};
use revm::{
bytecode::opcode,
interpreter::{Interpreter, interpreter_types::Jumps},
};
/// Recorded mapping slots.
#[derive(Clone, Debug, Default)]
pub struct MappingSlots {
/// Holds mapping parent (slots => slot... | rust | Apache-2.0 | 271c34d2550474a8ded7fbeedff398b920a96689 | 2026-01-04T15:43:23.630446Z | false |
foundry-rs/foundry | https://github.com/foundry-rs/foundry/blob/271c34d2550474a8ded7fbeedff398b920a96689/crates/common/src/constants.rs | crates/common/src/constants.rs | //! Commonly used constants.
use alloy_eips::Typed2718;
use alloy_network::AnyTxEnvelope;
use alloy_primitives::{Address, B256, Signature, address};
use std::time::Duration;
/// The dev chain-id, inherited from hardhat
pub const DEV_CHAIN_ID: u64 = 31337;
/// The first four bytes of the call data for a function call... | rust | Apache-2.0 | 271c34d2550474a8ded7fbeedff398b920a96689 | 2026-01-04T15:43:23.630446Z | false |
foundry-rs/foundry | https://github.com/foundry-rs/foundry/blob/271c34d2550474a8ded7fbeedff398b920a96689/crates/common/src/serde_helpers.rs | crates/common/src/serde_helpers.rs | //! Misc Serde helpers for foundry crates.
use alloy_primitives::U256;
use serde::{Deserialize, Deserializer, de};
use std::str::FromStr;
/// Helper type to parse both `u64` and `U256`
#[derive(Copy, Clone, Deserialize)]
#[serde(untagged)]
pub enum Numeric {
/// A [U256] value.
U256(U256),
/// A `u64` val... | rust | Apache-2.0 | 271c34d2550474a8ded7fbeedff398b920a96689 | 2026-01-04T15:43:23.630446Z | false |
foundry-rs/foundry | https://github.com/foundry-rs/foundry/blob/271c34d2550474a8ded7fbeedff398b920a96689/crates/common/src/traits.rs | crates/common/src/traits.rs | //! Commonly used traits.
use alloy_json_abi::Function;
use alloy_primitives::Bytes;
use alloy_sol_types::SolError;
use std::{fmt, path::Path};
/// Test filter.
pub trait TestFilter: Send + Sync {
/// Returns whether the test should be included.
fn matches_test(&self, test_signature: &str) -> bool;
/// R... | rust | Apache-2.0 | 271c34d2550474a8ded7fbeedff398b920a96689 | 2026-01-04T15:43:23.630446Z | false |
foundry-rs/foundry | https://github.com/foundry-rs/foundry/blob/271c34d2550474a8ded7fbeedff398b920a96689/crates/common/src/retry.rs | crates/common/src/retry.rs | //! Retry utilities.
use eyre::{Error, Report, Result};
use std::time::Duration;
/// Error type for Retry.
#[derive(Debug, thiserror::Error)]
pub enum RetryError<E = Report> {
/// Continues operation without decrementing retries.
Continue(E),
/// Keeps retrying operation.
Retry(E),
/// Stops retry... | rust | Apache-2.0 | 271c34d2550474a8ded7fbeedff398b920a96689 | 2026-01-04T15:43:23.630446Z | false |
foundry-rs/foundry | https://github.com/foundry-rs/foundry/blob/271c34d2550474a8ded7fbeedff398b920a96689/crates/common/src/term.rs | crates/common/src/term.rs | //! terminal utils
use foundry_compilers::{
artifacts::remappings::Remapping,
report::{self, BasicStdoutReporter, Reporter},
};
use itertools::Itertools;
use semver::Version;
use std::{
io,
io::{IsTerminal, prelude::*},
path::{Path, PathBuf},
sync::{
LazyLock,
mpsc::{self, TryRec... | rust | Apache-2.0 | 271c34d2550474a8ded7fbeedff398b920a96689 | 2026-01-04T15:43:23.630446Z | false |
foundry-rs/foundry | https://github.com/foundry-rs/foundry/blob/271c34d2550474a8ded7fbeedff398b920a96689/crates/common/src/iter.rs | crates/common/src/iter.rs | use std::iter::Peekable;
pub struct Delimited<I: Iterator> {
is_first: bool,
iter: Peekable<I>,
}
pub trait IterDelimited: Iterator + Sized {
fn delimited(self) -> Delimited<Self> {
Delimited { is_first: true, iter: self.peekable() }
}
}
impl<I: Iterator> IterDelimited for I {}
pub struct It... | rust | Apache-2.0 | 271c34d2550474a8ded7fbeedff398b920a96689 | 2026-01-04T15:43:23.630446Z | false |
foundry-rs/foundry | https://github.com/foundry-rs/foundry/blob/271c34d2550474a8ded7fbeedff398b920a96689/crates/common/src/errors/fs.rs | crates/common/src/errors/fs.rs | use std::{
io,
path::{Path, PathBuf},
};
/// Various error variants for `fs` operations that serve as an addition to the io::Error which
/// does not provide any information about the path.
#[derive(Debug, thiserror::Error)]
#[expect(missing_docs)]
pub enum FsPathError {
/// Provides additional path contex... | rust | Apache-2.0 | 271c34d2550474a8ded7fbeedff398b920a96689 | 2026-01-04T15:43:23.630446Z | false |
foundry-rs/foundry | https://github.com/foundry-rs/foundry/blob/271c34d2550474a8ded7fbeedff398b920a96689/crates/common/src/errors/mod.rs | crates/common/src/errors/mod.rs | //! Commonly used errors
mod fs;
pub use fs::FsPathError;
mod private {
use eyre::Chain;
use std::error::Error;
pub trait ErrorChain {
fn chain(&self) -> Chain<'_>;
}
impl ErrorChain for dyn Error + 'static {
fn chain(&self) -> Chain<'_> {
Chain::new(self)
}
... | rust | Apache-2.0 | 271c34d2550474a8ded7fbeedff398b920a96689 | 2026-01-04T15:43:23.630446Z | false |
foundry-rs/foundry | https://github.com/foundry-rs/foundry/blob/271c34d2550474a8ded7fbeedff398b920a96689/crates/common/src/preprocessor/deps.rs | crates/common/src/preprocessor/deps.rs | use super::{
data::{ContractData, PreprocessorData},
span_to_range,
};
use foundry_compilers::Updates;
use itertools::Itertools;
use solar::sema::{
Gcx, Hir,
hir::{CallArgs, ContractId, Expr, ExprKind, NamedArg, Stmt, StmtKind, TypeKind, Visit},
interface::{SourceMap, data_structures::Never, source_... | rust | Apache-2.0 | 271c34d2550474a8ded7fbeedff398b920a96689 | 2026-01-04T15:43:23.630446Z | false |
foundry-rs/foundry | https://github.com/foundry-rs/foundry/blob/271c34d2550474a8ded7fbeedff398b920a96689/crates/common/src/preprocessor/mod.rs | crates/common/src/preprocessor/mod.rs | use crate::errors::convert_solar_errors;
use foundry_compilers::{
Compiler, ProjectPathsConfig, SourceParser, apply_updates,
artifacts::SolcLanguage,
error::Result,
multi::{MultiCompiler, MultiCompilerInput, MultiCompilerLanguage},
project::Preprocessor,
solc::{SolcCompiler, SolcVersionedInput},... | rust | Apache-2.0 | 271c34d2550474a8ded7fbeedff398b920a96689 | 2026-01-04T15:43:23.630446Z | false |
foundry-rs/foundry | https://github.com/foundry-rs/foundry/blob/271c34d2550474a8ded7fbeedff398b920a96689/crates/common/src/preprocessor/data.rs | crates/common/src/preprocessor/data.rs | use super::span_to_range;
use foundry_compilers::artifacts::{Source, Sources};
use path_slash::PathExt;
use solar::sema::{
Gcx,
hir::{Contract, ContractId},
interface::source_map::FileName,
};
use std::{
collections::{BTreeMap, HashSet},
path::{Path, PathBuf},
};
/// Keeps data about project contra... | rust | Apache-2.0 | 271c34d2550474a8ded7fbeedff398b920a96689 | 2026-01-04T15:43:23.630446Z | false |
foundry-rs/foundry | https://github.com/foundry-rs/foundry/blob/271c34d2550474a8ded7fbeedff398b920a96689/crates/common/src/provider/runtime_transport.rs | crates/common/src/provider/runtime_transport.rs | //! Runtime transport that connects on first request, which can take either of an HTTP,
//! WebSocket, or IPC transport. Retries are handled by a client layer (e.g.,
//! `RetryBackoffLayer`) when used.
use crate::{DEFAULT_USER_AGENT, REQUEST_TIMEOUT};
use alloy_json_rpc::{RequestPacket, ResponsePacket};
use alloy_pubs... | rust | Apache-2.0 | 271c34d2550474a8ded7fbeedff398b920a96689 | 2026-01-04T15:43:23.630446Z | false |
foundry-rs/foundry | https://github.com/foundry-rs/foundry/blob/271c34d2550474a8ded7fbeedff398b920a96689/crates/common/src/provider/mod.rs | crates/common/src/provider/mod.rs | //! Provider-related instantiation and usage utilities.
pub mod runtime_transport;
use crate::{
ALCHEMY_FREE_TIER_CUPS, REQUEST_TIMEOUT, provider::runtime_transport::RuntimeTransportBuilder,
};
use alloy_chains::NamedChain;
use alloy_provider::{
Identity, ProviderBuilder as AlloyProviderBuilder, RootProvider,... | rust | Apache-2.0 | 271c34d2550474a8ded7fbeedff398b920a96689 | 2026-01-04T15:43:23.630446Z | false |
foundry-rs/foundry | https://github.com/foundry-rs/foundry/blob/271c34d2550474a8ded7fbeedff398b920a96689/crates/common/src/comments/mod.rs | crates/common/src/comments/mod.rs | use crate::iter::IterDelimited;
use solar::parse::{
ast::{CommentKind, Span},
interface::{BytePos, CharPos, SourceMap, source_map::SourceFile},
lexer::token::RawTokenKind as TokenKind,
};
use std::fmt;
mod comment;
pub use comment::{Comment, CommentStyle};
pub mod inline_config;
pub const DISABLE_START: ... | rust | Apache-2.0 | 271c34d2550474a8ded7fbeedff398b920a96689 | 2026-01-04T15:43:23.630446Z | false |
foundry-rs/foundry | https://github.com/foundry-rs/foundry/blob/271c34d2550474a8ded7fbeedff398b920a96689/crates/common/src/comments/inline_config.rs | crates/common/src/comments/inline_config.rs | use solar::{
interface::{BytePos, RelativeBytePos, SourceMap, Span},
parse::ast::{self, Visit},
};
use std::{
collections::{HashMap, hash_map::Entry},
hash::Hash,
ops::ControlFlow,
};
/// A disabled formatting range.
#[derive(Debug, Clone, Copy)]
struct DisabledRange<T = BytePos> {
/// Start po... | rust | Apache-2.0 | 271c34d2550474a8ded7fbeedff398b920a96689 | 2026-01-04T15:43:23.630446Z | false |
foundry-rs/foundry | https://github.com/foundry-rs/foundry/blob/271c34d2550474a8ded7fbeedff398b920a96689/crates/common/src/comments/comment.rs | crates/common/src/comments/comment.rs | //! Modified from [`rustc_ast::util::comments`](https://github.com/rust-lang/rust/blob/07d3fd1d9b9c1f07475b96a9d168564bf528db68/compiler/rustc_ast/src/util/comments.rs).
use solar::parse::{
ast::{CommentKind, Span},
interface::BytePos,
};
#[derive(Clone, Copy, PartialEq, Debug)]
pub enum CommentStyle {
//... | rust | Apache-2.0 | 271c34d2550474a8ded7fbeedff398b920a96689 | 2026-01-04T15:43:23.630446Z | false |
foundry-rs/foundry | https://github.com/foundry-rs/foundry/blob/271c34d2550474a8ded7fbeedff398b920a96689/crates/common/src/io/stdin.rs | crates/common/src/io/stdin.rs | //! Utility functions for reading from [`stdin`](std::io::stdin).
use eyre::Result;
use std::{
error::Error as StdError,
io::{self, BufRead, Read},
str::FromStr,
};
/// Unwraps the given `Option<T>` or [reads stdin into a String](read) and parses it as `T`.
pub fn unwrap<T>(value: Option<T>, read_line: bo... | rust | Apache-2.0 | 271c34d2550474a8ded7fbeedff398b920a96689 | 2026-01-04T15:43:23.630446Z | false |
foundry-rs/foundry | https://github.com/foundry-rs/foundry/blob/271c34d2550474a8ded7fbeedff398b920a96689/crates/common/src/io/shell.rs | crates/common/src/io/shell.rs | //! Utility functions for writing to [`stdout`](std::io::stdout) and [`stderr`](std::io::stderr).
//!
//! Originally from [cargo](https://github.com/rust-lang/cargo/blob/35814255a1dbaeca9219fae81d37a8190050092c/src/cargo/core/shell.rs).
use super::style::*;
use anstream::AutoStream;
use anstyle::Style;
use clap::Value... | rust | Apache-2.0 | 271c34d2550474a8ded7fbeedff398b920a96689 | 2026-01-04T15:43:23.630446Z | false |
foundry-rs/foundry | https://github.com/foundry-rs/foundry/blob/271c34d2550474a8ded7fbeedff398b920a96689/crates/common/src/io/macros.rs | crates/common/src/io/macros.rs | /// Prints a message to [`stdout`][std::io::stdout] and reads a line from stdin into a String.
///
/// Returns `Result<T>`, so sometimes `T` must be explicitly specified, like in `str::parse`.
///
/// # Examples
///
/// ```no_run
/// use foundry_common::prompt;
///
/// let response: String = prompt!("Would you like to ... | rust | Apache-2.0 | 271c34d2550474a8ded7fbeedff398b920a96689 | 2026-01-04T15:43:23.630446Z | false |
foundry-rs/foundry | https://github.com/foundry-rs/foundry/blob/271c34d2550474a8ded7fbeedff398b920a96689/crates/common/src/io/mod.rs | crates/common/src/io/mod.rs | //! Utilities for working with standard input, output, and error.
#[macro_use]
mod macros;
pub mod shell;
pub mod stdin;
pub mod style;
#[doc(no_inline)]
pub use shell::Shell;
| rust | Apache-2.0 | 271c34d2550474a8ded7fbeedff398b920a96689 | 2026-01-04T15:43:23.630446Z | false |
foundry-rs/foundry | https://github.com/foundry-rs/foundry/blob/271c34d2550474a8ded7fbeedff398b920a96689/crates/common/src/io/style.rs | crates/common/src/io/style.rs | #![allow(missing_docs)]
use anstyle::*;
pub const ERROR: Style = AnsiColor::Red.on_default().effects(Effects::BOLD);
pub const WARN: Style = AnsiColor::Yellow.on_default().effects(Effects::BOLD);
| rust | Apache-2.0 | 271c34d2550474a8ded7fbeedff398b920a96689 | 2026-01-04T15:43:23.630446Z | false |
foundry-rs/foundry | https://github.com/foundry-rs/foundry/blob/271c34d2550474a8ded7fbeedff398b920a96689/crates/common/fmt/src/dynamic.rs | crates/common/fmt/src/dynamic.rs | use super::{format_int_exp, format_uint_exp};
use alloy_dyn_abi::{DynSolType, DynSolValue};
use alloy_primitives::hex;
use eyre::Result;
use serde_json::{Map, Value};
use std::{
collections::{BTreeMap, HashMap},
fmt,
};
/// [`DynSolValue`] formatter.
struct DynValueFormatter {
raw: bool,
}
impl DynValueFo... | rust | Apache-2.0 | 271c34d2550474a8ded7fbeedff398b920a96689 | 2026-01-04T15:43:23.630446Z | false |
foundry-rs/foundry | https://github.com/foundry-rs/foundry/blob/271c34d2550474a8ded7fbeedff398b920a96689/crates/common/fmt/src/lib.rs | crates/common/fmt/src/lib.rs | //! Helpers for formatting Ethereum types.
#![cfg_attr(not(test), warn(unused_crate_dependencies))]
mod console;
pub use console::{ConsoleFmt, FormatSpec, console_format};
mod dynamic;
pub use dynamic::{
StructDefinitions, TypeDefMap, format_token, format_token_raw, format_tokens,
format_tokens_raw, parse_to... | rust | Apache-2.0 | 271c34d2550474a8ded7fbeedff398b920a96689 | 2026-01-04T15:43:23.630446Z | false |
foundry-rs/foundry | https://github.com/foundry-rs/foundry/blob/271c34d2550474a8ded7fbeedff398b920a96689/crates/common/fmt/src/ui.rs | crates/common/fmt/src/ui.rs | //! Helper trait and functions to format Ethereum types.
use alloy_consensus::{
Eip658Value, Receipt, ReceiptWithBloom, Transaction as TxTrait, TxEnvelope, TxType, Typed2718,
};
use alloy_network::{
AnyHeader, AnyReceiptEnvelope, AnyRpcBlock, AnyRpcTransaction, AnyTransactionReceipt,
AnyTxEnvelope, Receipt... | rust | Apache-2.0 | 271c34d2550474a8ded7fbeedff398b920a96689 | 2026-01-04T15:43:23.630446Z | true |
foundry-rs/foundry | https://github.com/foundry-rs/foundry/blob/271c34d2550474a8ded7fbeedff398b920a96689/crates/common/fmt/src/console.rs | crates/common/fmt/src/console.rs | use super::UIfmt;
use alloy_primitives::{Address, Bytes, FixedBytes, I256, U256};
use std::fmt::{self, Write};
/// A piece is a portion of the format string which represents the next part to emit.
#[derive(Clone, Debug, PartialEq, Eq)]
pub enum Piece<'a> {
/// A literal string which should directly be emitted.
... | rust | Apache-2.0 | 271c34d2550474a8ded7fbeedff398b920a96689 | 2026-01-04T15:43:23.630446Z | false |
foundry-rs/foundry | https://github.com/foundry-rs/foundry/blob/271c34d2550474a8ded7fbeedff398b920a96689/crates/common/fmt/src/exp.rs | crates/common/fmt/src/exp.rs | use alloy_primitives::{I256, Sign, U256};
use yansi::Paint;
/// Returns the number expressed as a string in exponential notation
/// with the given precision (number of significant figures),
/// optionally removing trailing zeros from the mantissa.
///
/// Examples:
///
/// ```text
/// precision = 4, trim_end_zeroes =... | rust | Apache-2.0 | 271c34d2550474a8ded7fbeedff398b920a96689 | 2026-01-04T15:43:23.630446Z | false |
foundry-rs/foundry | https://github.com/foundry-rs/foundry/blob/271c34d2550474a8ded7fbeedff398b920a96689/crates/linking/src/lib.rs | crates/linking/src/lib.rs | //! # foundry-linking
//!
//! EVM bytecode linker.
#![cfg_attr(not(test), warn(unused_crate_dependencies))]
#![cfg_attr(docsrs, feature(doc_cfg))]
use alloy_primitives::{Address, B256, Bytes};
use foundry_compilers::{
Artifact, ArtifactId,
artifacts::{CompactBytecode, CompactContractBytecodeCow, Libraries},
... | rust | Apache-2.0 | 271c34d2550474a8ded7fbeedff398b920a96689 | 2026-01-04T15:43:23.630446Z | false |
foundry-rs/foundry | https://github.com/foundry-rs/foundry/blob/271c34d2550474a8ded7fbeedff398b920a96689/crates/test-utils/src/lib.rs | crates/test-utils/src/lib.rs | //! # foundry-test-utils
//!
//! Internal Foundry testing utilities.
#![cfg_attr(not(test), warn(unused_crate_dependencies))]
#![cfg_attr(docsrs, feature(doc_cfg))]
// Shouldn't use sh_* macros here, as they don't get captured by the test runner.
#![allow(clippy::disallowed_macros)]
#[macro_use]
extern crate tracing;... | rust | Apache-2.0 | 271c34d2550474a8ded7fbeedff398b920a96689 | 2026-01-04T15:43:23.630446Z | false |
foundry-rs/foundry | https://github.com/foundry-rs/foundry/blob/271c34d2550474a8ded7fbeedff398b920a96689/crates/test-utils/src/ext.rs | crates/test-utils/src/ext.rs | use crate::prj::{TestCommand, TestProject, clone_remote, setup_forge};
use foundry_compilers::PathStyle;
use std::process::Command;
/// External test builder
#[derive(Clone, Debug)]
#[must_use = "ExtTester does nothing unless you `run` it"]
pub struct ExtTester {
pub org: &'static str,
pub name: &'static str,
... | rust | Apache-2.0 | 271c34d2550474a8ded7fbeedff398b920a96689 | 2026-01-04T15:43:23.630446Z | false |
foundry-rs/foundry | https://github.com/foundry-rs/foundry/blob/271c34d2550474a8ded7fbeedff398b920a96689/crates/test-utils/src/prj.rs | crates/test-utils/src/prj.rs | use crate::{init_tracing, rpc::rpc_endpoints};
use eyre::{Result, WrapErr};
use foundry_compilers::{
ArtifactOutput, ConfigurableArtifacts, PathStyle, ProjectPathsConfig,
artifacts::Contract,
cache::CompilerCache,
compilers::multi::MultiCompiler,
project_util::{TempProject, copy_dir},
solc::Solc... | rust | Apache-2.0 | 271c34d2550474a8ded7fbeedff398b920a96689 | 2026-01-04T15:43:23.630446Z | false |
foundry-rs/foundry | https://github.com/foundry-rs/foundry/blob/271c34d2550474a8ded7fbeedff398b920a96689/crates/test-utils/src/filter.rs | crates/test-utils/src/filter.rs | use foundry_common::TestFilter;
use regex::Regex;
use std::path::Path;
#[derive(Clone, Debug)]
pub struct Filter {
test_regex: Regex,
contract_regex: Regex,
path_regex: Regex,
exclude_tests: Option<Regex>,
exclude_contracts: Option<Regex>,
exclude_paths: Option<Regex>,
}
impl Filter {
pub ... | rust | Apache-2.0 | 271c34d2550474a8ded7fbeedff398b920a96689 | 2026-01-04T15:43:23.630446Z | false |
foundry-rs/foundry | https://github.com/foundry-rs/foundry/blob/271c34d2550474a8ded7fbeedff398b920a96689/crates/test-utils/src/util.rs | crates/test-utils/src/util.rs | use foundry_compilers::{
Project, ProjectCompileOutput, Vyper, project_util::copy_dir, utils::RuntimeOrHandle,
};
use foundry_config::Config;
use std::{
env,
fs::{self, File},
io::{IsTerminal, Read, Seek, Write},
path::{Path, PathBuf},
process::Command,
sync::LazyLock,
};
pub use crate::{ex... | rust | Apache-2.0 | 271c34d2550474a8ded7fbeedff398b920a96689 | 2026-01-04T15:43:23.630446Z | false |
foundry-rs/foundry | https://github.com/foundry-rs/foundry/blob/271c34d2550474a8ded7fbeedff398b920a96689/crates/test-utils/src/macros.rs | crates/test-utils/src/macros.rs | /// A macro to generate a new integration test case
///
/// The `forgetest!` macro's first argument is the name of the test, the second argument is a
/// closure to configure and execute the test. The `TestProject` provides utility functions to setup
/// the project's workspace. The `TestCommand` is a wrapper around th... | rust | Apache-2.0 | 271c34d2550474a8ded7fbeedff398b920a96689 | 2026-01-04T15:43:23.630446Z | false |
foundry-rs/foundry | https://github.com/foundry-rs/foundry/blob/271c34d2550474a8ded7fbeedff398b920a96689/crates/test-utils/src/rpc.rs | crates/test-utils/src/rpc.rs | //! RPC API keys utilities.
use foundry_config::{
NamedChain::{
self, Arbitrum, Base, BinanceSmartChainTestnet, Celo, Mainnet, Optimism, Polygon, Sepolia,
},
RpcEndpointUrl, RpcEndpoints,
};
use rand::seq::SliceRandom;
use std::{
env,
sync::{
LazyLock,
atomic::{AtomicUsize, ... | rust | Apache-2.0 | 271c34d2550474a8ded7fbeedff398b920a96689 | 2026-01-04T15:43:23.630446Z | false |
foundry-rs/foundry | https://github.com/foundry-rs/foundry/blob/271c34d2550474a8ded7fbeedff398b920a96689/crates/test-utils/src/script.rs | crates/test-utils/src/script.rs | use crate::{TestCommand, init_tracing, util::lossy_string};
use alloy_primitives::{Address, address};
use alloy_provider::Provider;
use eyre::Result;
use foundry_common::provider::{RetryProvider, get_http_provider};
use std::{
collections::BTreeMap,
fs,
path::{Path, PathBuf},
};
const BROADCAST_TEST_PATH: ... | rust | Apache-2.0 | 271c34d2550474a8ded7fbeedff398b920a96689 | 2026-01-04T15:43:23.630446Z | false |
foundry-rs/foundry | https://github.com/foundry-rs/foundry/blob/271c34d2550474a8ded7fbeedff398b920a96689/crates/test-utils/src/ui_runner.rs | crates/test-utils/src/ui_runner.rs | use std::path::Path;
use ui_test::{
spanned::Spanned,
status_emitter::{Gha, StatusEmitter},
};
/// Test runner based on `ui_test`. Adapted from `https://github.com/paradigmxyz/solar/blob/main/tools/tester/src/lib.rs`.
pub fn run_tests<'a>(cmd: &str, cmd_path: &'a Path, testdata: &'a Path) -> eyre::Result<()> {... | rust | Apache-2.0 | 271c34d2550474a8ded7fbeedff398b920a96689 | 2026-01-04T15:43:23.630446Z | false |
foundry-rs/foundry | https://github.com/foundry-rs/foundry/blob/271c34d2550474a8ded7fbeedff398b920a96689/crates/test-utils/src/fd_lock.rs | crates/test-utils/src/fd_lock.rs | //! File locking utilities.
use crate::util::pretty_err;
use std::{
fs::{File, OpenOptions},
path::Path,
};
pub use fd_lock::*;
/// Creates a new lock file at the given path.
pub fn new_lock(lock_path: impl AsRef<Path>) -> RwLock<File> {
fn new_lock(lock_path: &Path) -> RwLock<File> {
let lock_fi... | rust | Apache-2.0 | 271c34d2550474a8ded7fbeedff398b920a96689 | 2026-01-04T15:43:23.630446Z | false |
foundry-rs/foundry | https://github.com/foundry-rs/foundry/blob/271c34d2550474a8ded7fbeedff398b920a96689/crates/script/src/sequence.rs | crates/script/src/sequence.rs | use crate::multi_sequence::MultiChainSequence;
use eyre::Result;
use forge_script_sequence::{ScriptSequence, TransactionWithMetadata};
use foundry_cli::utils::Git;
use foundry_common::fmt::UIfmt;
use foundry_compilers::ArtifactId;
use foundry_config::Config;
use std::{
fmt::{Error, Write},
path::Path,
};
/// F... | rust | Apache-2.0 | 271c34d2550474a8ded7fbeedff398b920a96689 | 2026-01-04T15:43:23.630446Z | false |
foundry-rs/foundry | https://github.com/foundry-rs/foundry/blob/271c34d2550474a8ded7fbeedff398b920a96689/crates/script/src/lib.rs | crates/script/src/lib.rs | //! # foundry-script
//!
//! Smart contract scripting.
#![cfg_attr(not(test), warn(unused_crate_dependencies))]
#![cfg_attr(docsrs, feature(doc_cfg))]
#[macro_use]
extern crate foundry_common;
#[macro_use]
extern crate tracing;
use crate::runner::ScriptRunner;
use alloy_json_abi::{Function, JsonAbi};
use alloy_prim... | rust | Apache-2.0 | 271c34d2550474a8ded7fbeedff398b920a96689 | 2026-01-04T15:43:23.630446Z | false |
foundry-rs/foundry | https://github.com/foundry-rs/foundry/blob/271c34d2550474a8ded7fbeedff398b920a96689/crates/script/src/runner.rs | crates/script/src/runner.rs | use super::{ScriptConfig, ScriptResult};
use crate::build::ScriptPredeployLibraries;
use alloy_eips::eip7702::SignedAuthorization;
use alloy_primitives::{Address, Bytes, TxKind, U256};
use alloy_rpc_types::TransactionRequest;
use eyre::Result;
use foundry_cheatcodes::BroadcastableTransaction;
use foundry_config::Config... | rust | Apache-2.0 | 271c34d2550474a8ded7fbeedff398b920a96689 | 2026-01-04T15:43:23.630446Z | false |
foundry-rs/foundry | https://github.com/foundry-rs/foundry/blob/271c34d2550474a8ded7fbeedff398b920a96689/crates/script/src/execute.rs | crates/script/src/execute.rs | use super::{JsonResult, NestedValue, ScriptResult, runner::ScriptRunner};
use crate::{
ScriptArgs, ScriptConfig,
build::{CompiledState, LinkedBuildData},
simulate::PreSimulationState,
};
use alloy_dyn_abi::FunctionExt;
use alloy_json_abi::{Function, InternalType, JsonAbi};
use alloy_primitives::{
Addres... | rust | Apache-2.0 | 271c34d2550474a8ded7fbeedff398b920a96689 | 2026-01-04T15:43:23.630446Z | false |
foundry-rs/foundry | https://github.com/foundry-rs/foundry/blob/271c34d2550474a8ded7fbeedff398b920a96689/crates/script/src/broadcast.rs | crates/script/src/broadcast.rs | use std::{cmp::Ordering, sync::Arc, time::Duration};
use alloy_chains::{Chain, NamedChain};
use alloy_consensus::TxEnvelope;
use alloy_eips::{BlockId, eip2718::Encodable2718};
use alloy_network::{AnyNetwork, EthereumWallet, TransactionBuilder};
use alloy_primitives::{
Address, TxHash,
map::{AddressHashMap, Add... | rust | Apache-2.0 | 271c34d2550474a8ded7fbeedff398b920a96689 | 2026-01-04T15:43:23.630446Z | false |
foundry-rs/foundry | https://github.com/foundry-rs/foundry/blob/271c34d2550474a8ded7fbeedff398b920a96689/crates/script/src/build.rs | crates/script/src/build.rs | use crate::{
ScriptArgs, ScriptConfig, broadcast::BundledState, execute::LinkedState,
multi_sequence::MultiChainSequence, sequence::ScriptSequenceKind,
};
use alloy_primitives::{B256, Bytes};
use alloy_provider::Provider;
use eyre::{OptionExt, Result};
use forge_script_sequence::ScriptSequence;
use foundry_chea... | rust | Apache-2.0 | 271c34d2550474a8ded7fbeedff398b920a96689 | 2026-01-04T15:43:23.630446Z | false |
foundry-rs/foundry | https://github.com/foundry-rs/foundry/blob/271c34d2550474a8ded7fbeedff398b920a96689/crates/script/src/verify.rs | crates/script/src/verify.rs | use crate::{
ScriptArgs, ScriptConfig,
build::LinkedBuildData,
sequence::{ScriptSequenceKind, get_commit_hash},
};
use alloy_primitives::{Address, hex};
use eyre::{Result, eyre};
use forge_script_sequence::{AdditionalContract, ScriptSequence};
use forge_verify::{RetryArgs, VerifierArgs, VerifyArgs, provider... | rust | Apache-2.0 | 271c34d2550474a8ded7fbeedff398b920a96689 | 2026-01-04T15:43:23.630446Z | false |
foundry-rs/foundry | https://github.com/foundry-rs/foundry/blob/271c34d2550474a8ded7fbeedff398b920a96689/crates/script/src/progress.rs | crates/script/src/progress.rs | use crate::receipts::{PendingReceiptError, TxStatus, check_tx_status, format_receipt};
use alloy_chains::Chain;
use alloy_primitives::{
B256,
map::{B256HashMap, HashMap},
};
use eyre::Result;
use forge_script_sequence::ScriptSequence;
use foundry_cli::utils::init_progress;
use foundry_common::{provider::RetryPr... | rust | Apache-2.0 | 271c34d2550474a8ded7fbeedff398b920a96689 | 2026-01-04T15:43:23.630446Z | false |
foundry-rs/foundry | https://github.com/foundry-rs/foundry/blob/271c34d2550474a8ded7fbeedff398b920a96689/crates/script/src/simulate.rs | crates/script/src/simulate.rs | use super::{
multi_sequence::MultiChainSequence, providers::ProvidersManager, runner::ScriptRunner,
sequence::ScriptSequenceKind, transaction::ScriptTransactionBuilder,
};
use crate::{
ScriptArgs, ScriptConfig, ScriptResult,
broadcast::{BundledState, estimate_gas},
build::LinkedBuildData,
execut... | rust | Apache-2.0 | 271c34d2550474a8ded7fbeedff398b920a96689 | 2026-01-04T15:43:23.630446Z | false |
foundry-rs/foundry | https://github.com/foundry-rs/foundry/blob/271c34d2550474a8ded7fbeedff398b920a96689/crates/script/src/receipts.rs | crates/script/src/receipts.rs | use alloy_chains::{Chain, NamedChain};
use alloy_network::AnyTransactionReceipt;
use alloy_primitives::{TxHash, U256, utils::format_units};
use alloy_provider::{PendingTransactionBuilder, PendingTransactionError, Provider, WatchTxError};
use eyre::{Result, eyre};
use foundry_common::{provider::RetryProvider, retry, ret... | rust | Apache-2.0 | 271c34d2550474a8ded7fbeedff398b920a96689 | 2026-01-04T15:43:23.630446Z | false |
foundry-rs/foundry | https://github.com/foundry-rs/foundry/blob/271c34d2550474a8ded7fbeedff398b920a96689/crates/script/src/providers.rs | crates/script/src/providers.rs | use alloy_primitives::map::{HashMap, hash_map::Entry};
use alloy_provider::{Provider, utils::Eip1559Estimation};
use eyre::{Result, WrapErr};
use foundry_common::provider::{RetryProvider, get_http_provider};
use foundry_config::Chain;
use std::{ops::Deref, sync::Arc};
/// Contains a map of RPC urls to single instances... | rust | Apache-2.0 | 271c34d2550474a8ded7fbeedff398b920a96689 | 2026-01-04T15:43:23.630446Z | false |
foundry-rs/foundry | https://github.com/foundry-rs/foundry/blob/271c34d2550474a8ded7fbeedff398b920a96689/crates/script/src/transaction.rs | crates/script/src/transaction.rs | use super::ScriptResult;
use crate::build::LinkedBuildData;
use alloy_dyn_abi::JsonAbiExt;
use alloy_primitives::{Address, B256, TxKind, hex};
use eyre::Result;
use forge_script_sequence::TransactionWithMetadata;
use foundry_common::{ContractData, SELECTOR_LEN, TransactionMaybeSigned, fmt::format_token_raw};
use foundr... | rust | Apache-2.0 | 271c34d2550474a8ded7fbeedff398b920a96689 | 2026-01-04T15:43:23.630446Z | false |
foundry-rs/foundry | https://github.com/foundry-rs/foundry/blob/271c34d2550474a8ded7fbeedff398b920a96689/crates/script/src/multi_sequence.rs | crates/script/src/multi_sequence.rs | use eyre::{ContextCompat, Result, WrapErr};
use forge_script_sequence::{
DRY_RUN_DIR, ScriptSequence, SensitiveScriptSequence, now, sig_to_file_name,
};
use foundry_common::{fs, shell};
use foundry_compilers::ArtifactId;
use foundry_config::Config;
use serde::{Deserialize, Serialize};
use std::{
io::{BufWriter,... | rust | Apache-2.0 | 271c34d2550474a8ded7fbeedff398b920a96689 | 2026-01-04T15:43:23.630446Z | false |
foundry-rs/foundry | https://github.com/foundry-rs/foundry/blob/271c34d2550474a8ded7fbeedff398b920a96689/crates/sol-macro-gen/src/lib.rs | crates/sol-macro-gen/src/lib.rs | //! This crate contains the logic for Rust bindings generating from Solidity contracts
#![cfg_attr(not(test), warn(unused_crate_dependencies))]
pub mod sol_macro_gen;
pub use sol_macro_gen::*;
| rust | Apache-2.0 | 271c34d2550474a8ded7fbeedff398b920a96689 | 2026-01-04T15:43:23.630446Z | false |
foundry-rs/foundry | https://github.com/foundry-rs/foundry/blob/271c34d2550474a8ded7fbeedff398b920a96689/crates/sol-macro-gen/src/sol_macro_gen.rs | crates/sol-macro-gen/src/sol_macro_gen.rs | //! SolMacroGen and MultiSolMacroGen
//!
//! This type encapsulates the logic for expansion of a Rust TokenStream from Solidity tokens. It
//! uses the `expand` method from `alloy_sol_macro_expander` underneath.
//!
//! It holds info such as `path` to the ABI file, `name` of the file and the rust binding being
//! gene... | rust | Apache-2.0 | 271c34d2550474a8ded7fbeedff398b920a96689 | 2026-01-04T15:43:23.630446Z | false |
foundry-rs/foundry | https://github.com/foundry-rs/foundry/blob/271c34d2550474a8ded7fbeedff398b920a96689/crates/fmt/src/lib.rs | crates/fmt/src/lib.rs | #![doc = include_str!("../README.md")]
#![cfg_attr(not(test), warn(unused_crate_dependencies))]
#![cfg_attr(docsrs, feature(doc_cfg))]
const DEBUG: bool = false || option_env!("FMT_DEBUG").is_some();
const DEBUG_INDENT: bool = false || option_env!("FMT_DEBUG").is_some();
use foundry_common::comments::{
Comment, C... | rust | Apache-2.0 | 271c34d2550474a8ded7fbeedff398b920a96689 | 2026-01-04T15:43:23.630446Z | false |
foundry-rs/foundry | https://github.com/foundry-rs/foundry/blob/271c34d2550474a8ded7fbeedff398b920a96689/crates/fmt/src/pp/helpers.rs | crates/fmt/src/pp/helpers.rs | use super::{Printer, Token};
use std::borrow::Cow;
impl Printer {
pub fn word_space(&mut self, w: impl Into<Cow<'static, str>>) {
self.word(w);
self.space();
}
/// Adds a new hardbreak if not at the beginning of the line.
/// If there was a buffered break token, replaces it (ensures ha... | rust | Apache-2.0 | 271c34d2550474a8ded7fbeedff398b920a96689 | 2026-01-04T15:43:23.630446Z | false |
foundry-rs/foundry | https://github.com/foundry-rs/foundry/blob/271c34d2550474a8ded7fbeedff398b920a96689/crates/fmt/src/pp/convenience.rs | crates/fmt/src/pp/convenience.rs | use super::{BeginToken, BreakToken, Breaks, IndentStyle, Printer, SIZE_INFINITY, Token};
use std::borrow::Cow;
impl Printer {
/// "raw box"
pub fn rbox(&mut self, indent: isize, breaks: Breaks) {
self.scan_begin(BeginToken { indent: IndentStyle::Block { offset: indent }, breaks });
}
/// Incon... | rust | Apache-2.0 | 271c34d2550474a8ded7fbeedff398b920a96689 | 2026-01-04T15:43:23.630446Z | false |
foundry-rs/foundry | https://github.com/foundry-rs/foundry/blob/271c34d2550474a8ded7fbeedff398b920a96689/crates/fmt/src/pp/ring.rs | crates/fmt/src/pp/ring.rs | use std::{
collections::VecDeque,
ops::{Index, IndexMut, Range},
};
#[derive(Debug)]
pub(crate) struct RingBuffer<T> {
data: VecDeque<T>,
// Abstract index of data[0] in the infinitely sized queue.
offset: usize,
}
impl<T> RingBuffer<T> {
pub(crate) fn new() -> Self {
Self { data: VecD... | rust | Apache-2.0 | 271c34d2550474a8ded7fbeedff398b920a96689 | 2026-01-04T15:43:23.630446Z | false |
foundry-rs/foundry | https://github.com/foundry-rs/foundry/blob/271c34d2550474a8ded7fbeedff398b920a96689/crates/fmt/src/pp/mod.rs | crates/fmt/src/pp/mod.rs | //! Adapted from [`rustc_ast_pretty`](https://github.com/rust-lang/rust/blob/07d3fd1d9b9c1f07475b96a9d168564bf528db68/compiler/rustc_ast_pretty/src/pp.rs)
//! and [`prettyplease`](https://github.com/dtolnay/prettyplease/blob/8eb8c14649aea32e810732bd4d64fe519e6b752a/src/algorithm.rs).
use crate::{DEBUG, DEBUG_INDENT};
... | rust | Apache-2.0 | 271c34d2550474a8ded7fbeedff398b920a96689 | 2026-01-04T15:43:23.630446Z | false |
foundry-rs/foundry | https://github.com/foundry-rs/foundry/blob/271c34d2550474a8ded7fbeedff398b920a96689/crates/fmt/src/state/sol.rs | crates/fmt/src/state/sol.rs | #![allow(clippy::too_many_arguments)]
use super::{
CommentConfig, Separator, State,
common::{BlockFormat, ListFormat},
};
use crate::{
pp::SIZE_INFINITY,
state::{CallContext, common::LitExt},
};
use foundry_common::{comments::Comment, iter::IterDelimited};
use foundry_config::fmt::{self as config, Mult... | rust | Apache-2.0 | 271c34d2550474a8ded7fbeedff398b920a96689 | 2026-01-04T15:43:23.630446Z | true |
foundry-rs/foundry | https://github.com/foundry-rs/foundry/blob/271c34d2550474a8ded7fbeedff398b920a96689/crates/fmt/src/state/mod.rs | crates/fmt/src/state/mod.rs | #![allow(clippy::too_many_arguments)]
use crate::{
FormatterConfig, InlineConfig,
pp::{self, BreakToken, SIZE_INFINITY, Token},
state::sol::BinOpGroup,
};
use foundry_common::{
comments::{Comment, CommentStyle, Comments, estimate_line_width, line_with_tabs},
iter::IterDelimited,
};
use foundry_confi... | rust | Apache-2.0 | 271c34d2550474a8ded7fbeedff398b920a96689 | 2026-01-04T15:43:23.630446Z | true |
foundry-rs/foundry | https://github.com/foundry-rs/foundry/blob/271c34d2550474a8ded7fbeedff398b920a96689/crates/fmt/src/state/common.rs | crates/fmt/src/state/common.rs | use super::{CommentConfig, Separator, State};
use crate::pp::{BreakToken, Printer, SIZE_INFINITY};
use foundry_common::iter::IterDelimited;
use foundry_config::fmt as config;
use itertools::{Either, Itertools};
use solar::parse::{
Cursor,
ast::{self, Span},
interface::BytePos,
};
use std::{borrow::Cow, fmt:... | rust | Apache-2.0 | 271c34d2550474a8ded7fbeedff398b920a96689 | 2026-01-04T15:43:23.630446Z | true |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.