mirror of
https://github.com/serai-dex/serai.git
synced 2025-12-08 12:19:24 +00:00
OUT_DIR > artifacts
This commit is contained in:
2
Cargo.lock
generated
2
Cargo.lock
generated
@@ -1320,7 +1320,7 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "build-solidity-contracts"
|
name = "build-solidity-contracts"
|
||||||
version = "0.1.0"
|
version = "0.1.1"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "bumpalo"
|
name = "bumpalo"
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "build-solidity-contracts"
|
name = "build-solidity-contracts"
|
||||||
version = "0.1.0"
|
version = "0.1.1"
|
||||||
description = "A helper function to build Solidity contracts"
|
description = "A helper function to build Solidity contracts"
|
||||||
license = "MIT"
|
license = "MIT"
|
||||||
repository = "https://github.com/serai-dex/serai/tree/develop/networks/ethereum/build-contracts"
|
repository = "https://github.com/serai-dex/serai/tree/develop/networks/ethereum/build-contracts"
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
|
|
||||||
use std::{path::PathBuf, fs, process::Command};
|
use std::{path::PathBuf, fs, process::Command};
|
||||||
|
|
||||||
/// Build contracts placed in `contracts/`, outputting to `artifacts/`.
|
/// Build contracts from the specified path, outputting the artifacts to the specified path.
|
||||||
///
|
///
|
||||||
/// Requires solc 0.8.25.
|
/// Requires solc 0.8.25.
|
||||||
pub fn build(contracts_path: &str, artifacts_path: &str) -> Result<(), String> {
|
pub fn build(contracts_path: &str, artifacts_path: &str) -> Result<(), String> {
|
||||||
@@ -33,7 +33,7 @@ pub fn build(contracts_path: &str, artifacts_path: &str) -> Result<(), String> {
|
|||||||
#[rustfmt::skip]
|
#[rustfmt::skip]
|
||||||
let args = [
|
let args = [
|
||||||
"--base-path", ".",
|
"--base-path", ".",
|
||||||
"-o", "./artifacts", "--overwrite",
|
"-o", artifacts_path, "--overwrite",
|
||||||
"--bin", "--bin-runtime", "--abi",
|
"--bin", "--bin-runtime", "--abi",
|
||||||
"--via-ir", "--optimize",
|
"--via-ir", "--optimize",
|
||||||
"--no-color",
|
"--no-color",
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ license = "AGPL-3.0-only"
|
|||||||
repository = "https://github.com/serai-dex/serai/tree/develop/networks/ethereum/schnorr"
|
repository = "https://github.com/serai-dex/serai/tree/develop/networks/ethereum/schnorr"
|
||||||
authors = ["Luke Parker <lukeparker5132@gmail.com>", "Elizabeth Binks <elizabethjbinks@gmail.com>"]
|
authors = ["Luke Parker <lukeparker5132@gmail.com>", "Elizabeth Binks <elizabethjbinks@gmail.com>"]
|
||||||
edition = "2021"
|
edition = "2021"
|
||||||
rust-version = "1.79"
|
rust-version = "1.81"
|
||||||
|
|
||||||
[package.metadata.docs.rs]
|
[package.metadata.docs.rs]
|
||||||
all-features = true
|
all-features = true
|
||||||
|
|||||||
@@ -1,3 +1,9 @@
|
|||||||
|
use std::{env, fs};
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
build_solidity_contracts::build("contracts", "artifacts").unwrap();
|
let artifacts_path = env::var("OUT_DIR").unwrap().to_string() + "/ethereum-schnorr-contract";
|
||||||
|
if !fs::exists(&artifacts_path).unwrap() {
|
||||||
|
fs::create_dir(&artifacts_path).unwrap();
|
||||||
|
}
|
||||||
|
build_solidity_contracts::build("contracts", &artifacts_path).unwrap();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,7 +4,8 @@
|
|||||||
#![allow(non_snake_case)]
|
#![allow(non_snake_case)]
|
||||||
|
|
||||||
/// The initialization bytecode of the Schnorr library.
|
/// The initialization bytecode of the Schnorr library.
|
||||||
pub const INIT_BYTECODE: &str = include_str!("../artifacts/Schnorr.bin");
|
pub const INIT_BYTECODE: &str =
|
||||||
|
include_str!(concat!(env!("OUT_DIR"), "/ethereum-schnorr-contract/Schnorr.bin"));
|
||||||
|
|
||||||
mod public_key;
|
mod public_key;
|
||||||
pub use public_key::PublicKey;
|
pub use public_key::PublicKey;
|
||||||
|
|||||||
@@ -17,11 +17,11 @@ use alloy_node_bindings::{Anvil, AnvilInstance};
|
|||||||
|
|
||||||
use crate::{PublicKey, Signature};
|
use crate::{PublicKey, Signature};
|
||||||
|
|
||||||
#[allow(warnings)]
|
#[expect(warnings)]
|
||||||
#[allow(needless_pass_by_value)]
|
#[expect(needless_pass_by_value)]
|
||||||
#[allow(clippy::all)]
|
#[expect(clippy::all)]
|
||||||
#[allow(clippy::ignored_unit_patterns)]
|
#[expect(clippy::ignored_unit_patterns)]
|
||||||
#[allow(clippy::redundant_closure_for_method_calls)]
|
#[expect(clippy::redundant_closure_for_method_calls)]
|
||||||
mod abi {
|
mod abi {
|
||||||
alloy_sol_types::sol!("contracts/tests/Schnorr.sol");
|
alloy_sol_types::sol!("contracts/tests/Schnorr.sol");
|
||||||
pub(crate) use TestSchnorr::*;
|
pub(crate) use TestSchnorr::*;
|
||||||
@@ -40,7 +40,14 @@ async fn setup_test() -> (AnvilInstance, Arc<RootProvider<SimpleRequest>>, Addre
|
|||||||
let _: () = provider
|
let _: () = provider
|
||||||
.raw_request(
|
.raw_request(
|
||||||
"anvil_setCode".into(),
|
"anvil_setCode".into(),
|
||||||
[address.to_string(), include_str!("../artifacts/TestSchnorr.bin-runtime").to_string()],
|
[
|
||||||
|
address.to_string(),
|
||||||
|
include_str!(concat!(
|
||||||
|
env!("OUT_DIR"),
|
||||||
|
"/ethereum-schnorr-contract/TestSchnorr.bin-runtime"
|
||||||
|
))
|
||||||
|
.to_string(),
|
||||||
|
],
|
||||||
)
|
)
|
||||||
.await
|
.await
|
||||||
.unwrap();
|
.unwrap();
|
||||||
|
|||||||
Reference in New Issue
Block a user