2024-03-24 13:00:54 +00:00
|
|
|
use std::process::Command;
|
|
|
|
|
|
|
|
use ethers_contract::Abigen;
|
|
|
|
|
2022-07-16 21:45:41 +00:00
|
|
|
fn main() {
|
2024-03-24 13:00:54 +00:00
|
|
|
println!("cargo:rerun-if-changed=contracts/*");
|
|
|
|
println!("cargo:rerun-if-changed=artifacts/*");
|
|
|
|
|
|
|
|
for line in String::from_utf8(Command::new("solc").args(["--version"]).output().unwrap().stdout)
|
|
|
|
.unwrap()
|
|
|
|
.lines()
|
|
|
|
{
|
|
|
|
if let Some(version) = line.strip_prefix("Version: ") {
|
|
|
|
let version = version.split('+').next().unwrap();
|
|
|
|
assert_eq!(version, "0.8.25");
|
|
|
|
}
|
|
|
|
}
|
2022-07-16 21:45:41 +00:00
|
|
|
|
2023-11-12 09:34:45 +00:00
|
|
|
#[rustfmt::skip]
|
|
|
|
let args = [
|
|
|
|
"--base-path", ".",
|
|
|
|
"-o", "./artifacts", "--overwrite",
|
|
|
|
"--bin", "--abi",
|
|
|
|
"--optimize",
|
2024-03-24 13:00:54 +00:00
|
|
|
"./contracts/Schnorr.sol", "./contracts/Router.sol",
|
2023-11-12 09:34:45 +00:00
|
|
|
];
|
2024-03-24 13:00:54 +00:00
|
|
|
assert!(Command::new("solc").args(args).status().unwrap().success());
|
|
|
|
|
|
|
|
Abigen::new("Schnorr", "./artifacts/Schnorr.abi")
|
|
|
|
.unwrap()
|
|
|
|
.generate()
|
|
|
|
.unwrap()
|
|
|
|
.write_to_file("./src/abi/schnorr.rs")
|
|
|
|
.unwrap();
|
2023-11-12 09:34:45 +00:00
|
|
|
|
2024-03-24 13:00:54 +00:00
|
|
|
Abigen::new("Router", "./artifacts/Router.abi")
|
|
|
|
.unwrap()
|
|
|
|
.generate()
|
|
|
|
.unwrap()
|
|
|
|
.write_to_file("./src/abi/router.rs")
|
|
|
|
.unwrap();
|
2022-07-16 21:45:41 +00:00
|
|
|
}
|