Skip to content

Commit

Permalink
Merge pull request #75 from webb-tools/shady/remove-fixed-deposit-anchor
Browse files Browse the repository at this point in the history
  • Loading branch information
shekohex authored Aug 1, 2022
2 parents bdd3cf0 + d433569 commit 7bf0553
Show file tree
Hide file tree
Showing 25 changed files with 6,782 additions and 5,853 deletions.
1,657 changes: 1,077 additions & 580 deletions Cargo.lock

Large diffs are not rendered by default.

11 changes: 4 additions & 7 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ members = [".", "proposals"]

[package]
name = "webb"
version = "0.4.4"
version = "0.5.0"
edition = "2021"
authors = ["Webb Developers"]
license = "GPL-3.0"
Expand All @@ -24,11 +24,8 @@ async-trait = "0.1"
rand = { version = "0.8", default-features = false, features = ["getrandom"] }
thiserror = "1.0.26"
hex = { version = "0.4", default-features = false }

# EVM crates.
ethers = { version = "0.6.0", default-features = false, optional = true, features = ["legacy", "rustls"] }
# Used by ethers (but we need it to be vendored with the lib).
openssl = { version = "0.10", features = ["vendored"], optional = true }
ethers = { version = "0.17.0", default-features = false, optional = true, features = ["legacy", "rustls", "abigen"] }
serde = { version = "1", default-features = false, features = ["derive"] }
serde_json = { version = "1", optional = true }

Expand All @@ -40,7 +37,7 @@ sp-keyring = "6.0.0"
[build-dependencies]
serde_json = "1"
tempfile = "3.2"
ethers = { version = "0.6.0", default-features = false, optional = true, features = ["legacy"] }
ethers = { version = "0.17.0", default-features = false, optional = true, features = ["legacy", "abigen"] }
syn = { version = "1.0.80", optional = true }
scale = { package = "parity-scale-codec", version = "3", default-features = false, optional = true }
frame-metadata = { version = "15.0.0", optional = true, features = ["v14", "std"] }
Expand All @@ -50,7 +47,7 @@ subxt-codegen = { version = "0.22.0", optional = true }
default = ["substrate-runtime", "evm-runtime"]
# Main features.
substrate-runtime = ["subxt", "scale", "scale-info"]
evm-runtime = ["ethers", "serde_json", "openssl"]
evm-runtime = ["ethers", "serde_json"]
# Tests
integration-tests = []
# Build
Expand Down
41 changes: 11 additions & 30 deletions build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,8 @@ use std::error::Error;

#[cfg(feature = "generate-contracts")]
mod evm {
use std::io::Write;

use ethers::contract::Abigen;
use tempfile::NamedTempFile;

use super::*;
use ethers::contract::Abigen;

fn parse_and_write_abigen(
path: &str,
Expand All @@ -17,12 +13,7 @@ mod evm {
println!("cargo:rerun-if-changed=./{}", path);
println!("cargo:rerun-if-changed=./{}", out);

let contract_file = std::fs::read_to_string(path)?;
let raw: serde_json::Value = serde_json::from_str(&contract_file)?;
let abi = serde_json::to_vec(&raw["abi"])?;
let mut abi_file = NamedTempFile::new()?;
abi_file.write_all(&abi)?;
Abigen::new(contract_name, abi_file.path().to_string_lossy())?
Abigen::new(contract_name, path)?
.add_event_derive("serde::Serialize")
.add_event_derive("serde::Deserialize")
.rustfmt(false) // don't use rustfmt for now.
Expand All @@ -39,14 +30,6 @@ mod evm {
)
}

pub fn build_protocol_solidity_anchor() -> Result<(), Box<dyn Error>> {
parse_and_write_abigen(
"contracts/protocol-solidity/FixedDepositAnchor.json",
"src/evm/contract/protocol_solidity/fixed_deposit_anchor.rs",
"FixedDepositAnchorContract",
)
}

pub fn build_protocol_solidity_vanchor() -> Result<(), Box<dyn Error>> {
parse_and_write_abigen(
"contracts/protocol-solidity/VAnchor.json",
Expand All @@ -64,15 +47,6 @@ mod evm {
)
}

pub fn build_protocol_solidity_anchor_proxy() -> Result<(), Box<dyn Error>>
{
parse_and_write_abigen(
"contracts/protocol-solidity/AnchorProxy.json",
"src/evm/contract/protocol_solidity/anchor_proxy.rs",
"AnchorProxyContract",
)
}

pub fn build_protocol_solidity_signature_bridge(
) -> Result<(), Box<dyn Error>> {
parse_and_write_abigen(
Expand All @@ -91,6 +65,14 @@ mod evm {
)
}

pub fn build_protocol_solidity_token_wrapper() -> Result<(), Box<dyn Error>>
{
parse_and_write_abigen(
"contracts/protocol-solidity/TokenWrapper.json",
"src/evm/contract/protocol_solidity/token_wrapper.rs",
"TokenWrapperContract",
)
}
pub fn build_protocol_solidity_treasury() -> Result<(), Box<dyn Error>> {
parse_and_write_abigen(
"contracts/protocol-solidity/Treasury.json",
Expand Down Expand Up @@ -191,11 +173,10 @@ fn main() -> Result<(), Box<dyn Error>> {
#[cfg(feature = "generate-contracts")]
{
evm::build_protocol_solidity_anchor_base()?;
evm::build_protocol_solidity_anchor()?;
evm::build_protocol_solidity_vanchor()?;
evm::build_protocol_solidity_anchor_proxy()?;
evm::build_protocol_solidity_anchor_handler()?;
evm::build_protocol_solidity_signature_bridge()?;
evm::build_protocol_solidity_token_wrapper()?;
evm::build_protocol_solidity_governed_token_wrapper()?;
evm::build_protocol_solidity_token_wrapper_handler()?;
evm::build_protocol_solidity_treasury()?;
Expand Down
23 changes: 2 additions & 21 deletions contracts/protocol-solidity/AnchorHandler.json

Large diffs are not rendered by default.

277 changes: 0 additions & 277 deletions contracts/protocol-solidity/AnchorProxy.json

This file was deleted.

Loading

0 comments on commit 7bf0553

Please sign in to comment.