2023-05-31 21:52:51 +03:00
|
|
|
use ethers::contract::MultiAbigen;
|
|
|
|
use glob::glob;
|
|
|
|
|
|
|
|
fn main() {
|
|
|
|
// Tell Cargo that if the given file changes, to rerun this build script.
|
2023-07-05 21:45:22 +03:00
|
|
|
println!("cargo:rerun-if-changed=build.rs");
|
|
|
|
println!("cargo:rerun-if-changed=Cargo.toml");
|
2023-05-31 21:52:51 +03:00
|
|
|
glob("./abi/*.json").unwrap().for_each(|x| {
|
|
|
|
if let Ok(x) = x {
|
2023-07-03 23:45:59 +03:00
|
|
|
println!("cargo:rerun-if-changed={}", x.display());
|
2023-05-31 21:52:51 +03:00
|
|
|
}
|
|
|
|
});
|
|
|
|
|
|
|
|
let gen = MultiAbigen::from_json_files("./abi").unwrap();
|
|
|
|
|
|
|
|
let bindings = gen.build().unwrap();
|
|
|
|
|
|
|
|
bindings.write_to_module("./src/contracts", false).unwrap();
|
|
|
|
}
|