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

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

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

impl Solc[src]

pub fn new(path: &str) -> Self[src]

Instantiates the Solc builder for the provided paths

pub fn build_raw(
    self
) -> Result<HashMap<String, CompiledContractStr>, SolcError>
[src]

Gets the ABI for the contracts

pub fn build(self) -> Result<HashMap<String, CompiledContract>, SolcError>[src]

Builds the contracts and returns a hashmap for each named contract

pub fn version() -> String[src]

Returns the output of solc --version

Panics

If solc is not in the user's $PATH

pub fn evm_version(self, version: EvmVersion) -> Self[src]

Sets the EVM version for compilation

pub fn optimizer(self, runs: usize) -> Self[src]

Sets the optimizer runs (default = 200)

pub fn allowed_paths(self, paths: Vec<PathBuf>) -> Self[src]

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

Auto Trait Implementations

impl RefUnwindSafe for Solc

impl Send for Solc

impl Sync for Solc

impl Unpin for Solc

impl UnwindSafe for Solc

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> Same<T> for T

type Output = T

Should always be Self

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.

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