mirror of
https://github.com/serai-dex/serai.git
synced 2024-12-26 13:39:37 +00:00
26230377b0
This ensures Router implements most of IRouterWithoutCollisions. It solely leaves us to confirm Router implements the extensions defined in IRouter.
39 lines
1 KiB
Rust
39 lines
1 KiB
Rust
use std::{env, fs};
|
|
|
|
use alloy_sol_macro_input::SolInputKind;
|
|
|
|
fn write(sol: syn_solidity::File, file: &str) {
|
|
let sol = alloy_sol_macro_expander::expand::expand(sol).unwrap();
|
|
fs::write(file, sol.to_string()).unwrap();
|
|
}
|
|
|
|
fn sol(sol_files: &[&str], file: &str) {
|
|
let mut sol = String::new();
|
|
for sol_file in sol_files {
|
|
sol += &fs::read_to_string(sol_file).unwrap();
|
|
}
|
|
let SolInputKind::Sol(sol) = syn::parse_str(&sol).unwrap() else {
|
|
panic!("parsed .sols file wasn't SolInputKind::Sol");
|
|
};
|
|
write(sol, file);
|
|
}
|
|
|
|
fn main() {
|
|
let artifacts_path =
|
|
env::var("OUT_DIR").unwrap().to_string() + "/serai-processor-ethereum-router";
|
|
|
|
if !fs::exists(&artifacts_path).unwrap() {
|
|
fs::create_dir(&artifacts_path).unwrap();
|
|
}
|
|
|
|
// This cannot be handled with the sol! macro. The Router requires an import
|
|
// https://github.com/alloy-rs/core/issues/602
|
|
sol(
|
|
&[
|
|
"../../../networks/ethereum/schnorr/contracts/Schnorr.sol",
|
|
"contracts/IRouter.sol",
|
|
"contracts/Router.sol",
|
|
],
|
|
&(artifacts_path + "/router.rs"),
|
|
);
|
|
}
|