bb3a2fd27c
* release(core): 0.6.0 * release(providers): 0.6.0 * release(contract-abigen): 0.6.0 * release(contract-derive): 0.6.0 * release(derive-eip712): 0.2.0 * release(ethers-solc): 0.1.0 * release(contract): 0.6.0 * release(etherscan): 0.2.0 * release(signers): 0.6.0 * release(middleware): 0.6.0 * chore: update dev deps * refactor(core): move docs to readme * refactor(contract): move docs to readme * refactor(providers): move docs to readme * chore: bump ethers cargo toml * refactor(signers): move docs to readme * refactor(middleware): move docs to readme * fix(ethers): adjust re-exports to allow searching internal packages * docs: fix broken links we cannot use relative crate imports because the readmes are also imported by the parent crate * alias readmes to be accessible to ethers crate |
||
---|---|---|
.. | ||
src | ||
test-data | ||
tests | ||
Cargo.toml | ||
README.md |
README.md
ethers-solc
Utilities for working with native solc
and compiling projects.
To also compile contracts during cargo build
(so that ethers abigen!
can pull in updated abi automatically) you can configure a ethers_solc::Project
in your build.rs
file
First add ethers-solc
to your cargo build-dependencies.
Once you compiled the project, you can configure cargo change detection with rerun_if_sources_changed
, so that cargo will execute the build.rs
file if a contract in the sources directory has changed
[build-dependencies]
ethers-solc = { git = "https://github.com/gakonst/ethers-rs" }
use ethers_solc::{Project, ProjectPathsConfig};
fn main() {
// configure the project with all its paths, solc, cache etc.
let project = Project::builder()
.paths(ProjectPathsConfig::hardhat(env!("CARGO_MANIFEST_DIR")).unwrap())
.build()
.unwrap();
let output = project.compile().unwrap();
// Tell Cargo that if a source file changes, to rerun this build script.
project.rerun_if_sources_changed();
}