Struct ethers_core::utils::Solc[][src]

pub struct Solc {
    pub paths: Vec<String>,
    pub optimizer: usize,
    pub evm_version: EvmVersion,
    pub allowed_paths: Vec<PathBuf>,
}
Expand description

Solidity Compiler Bindings

Assumes that solc is installed and available in the caller’s $PATH. Any calls will panic otherwise.

By default, it uses 200 optimizer runs and Istanbul as the EVM version

Examples

use ethers::utils::Solc;

// Give it a glob
let contracts = Solc::new("./contracts/*")
    .optimizer(200)
    .build()?;

// this will return None if the specified contract did not exist in the compiled
// files
let contract = contracts.get("SimpleStorage").expect("contract not found");

Fields

paths: Vec<String>

The path where contracts will be read from

optimizer: usize

Number of runs

evm_version: EvmVersion

Evm Version

allowed_paths: Vec<PathBuf>

Paths for importing other libraries

Implementations

Instantiates the Solc builder for the provided paths

Gets the ABI for the contracts

Builds the contracts and returns a hashmap for each named contract

Returns the output of solc --version

Panics

If solc is not in the user’s $PATH

Sets the EVM version for compilation

Sets the optimizer runs (default = 200)

Sets the allowed paths for using files from outside the same directory

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

Performs the conversion.

Should always be Self

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.