pub struct ContractVerifier { /* private fields */ }Expand description
Handles on-chain contract verification via explorer APIs and RPC bytecode matching.
Implementations§
Source§impl ContractVerifier
impl ContractVerifier
Sourcepub fn new(chain: &str, api_key: Option<String>) -> Self
pub fn new(chain: &str, api_key: Option<String>) -> Self
Create a new verifier for the given chain.
api_key — optional explorer API key. Reads the chain-specific env var when empty.
Sourcepub fn forge_verify(
&self,
address: &str,
contract_name: &str,
chain: &str,
constructor_args: Option<&str>,
) -> VerificationResult
pub fn forge_verify( &self, address: &str, contract_name: &str, chain: &str, constructor_args: Option<&str>, ) -> VerificationResult
Verify a contract using forge verify-contract.
This delegates to Foundry’s built-in Etherscan integration.
Sourcepub fn verify_bytecode_match(
&self,
address: &str,
contract_name: &str,
rpc_url: &str,
) -> VerificationResult
pub fn verify_bytecode_match( &self, address: &str, contract_name: &str, rpc_url: &str, ) -> VerificationResult
Compare locally compiled bytecode with on-chain bytecode via RPC.
This method:
- Runs
forge buildto compile the contract - Extracts the deployed bytecode from
out/ - Calls
eth_getCodevia RPC - Compares the two (stripping metadata hash)
Sourcepub fn forge_available(&self) -> bool
pub fn forge_available(&self) -> bool
Check whether the forge CLI is available on the system.
Delegates to the free function forge_available().
Auto Trait Implementations§
impl Freeze for ContractVerifier
impl RefUnwindSafe for ContractVerifier
impl Send for ContractVerifier
impl Sync for ContractVerifier
impl Unpin for ContractVerifier
impl UnsafeUnpin for ContractVerifier
impl UnwindSafe for ContractVerifier
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
impl<A, B, T> HttpServerConnExec<A, B> for Twhere
B: Body,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more