[][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(mut self: Self, version: EvmVersion) -> Self[src]

Sets the EVM version for compilation

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

Sets the optimizer runs (default = 200)

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

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

Auto Trait Implementations

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> Conv for T

impl<T> FmtForward for T

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

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

impl<T> Pipe for T

impl<T> PipeAsRef for T

impl<T> PipeBorrow for T

impl<T> PipeDeref for T

impl<T> PipeRef for T

impl<T> Same<T> for T

type Output = T

Should always be Self

impl<T> Tap for T

impl<T, U> TapAsRef<U> for T where
    U: ?Sized

impl<T, U> TapBorrow<U> for T where
    U: ?Sized

impl<T> TapDeref for T

impl<T> TryConv for T

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>,