Remove ethers-middleware

This commit is contained in:
Luke Parker
2023-11-08 07:52:32 -05:00
parent a0a2ef22e4
commit 11f66c741d
4 changed files with 75 additions and 87 deletions

View File

@@ -1,13 +1,8 @@
use std::{sync::Arc, fs::File};
use thiserror::Error;
use eyre::{eyre, Result};
use ethers_signers::LocalWallet;
use ethers_middleware::SignerMiddleware;
use ethers_providers::{Provider, Http};
use ethers_contract::{abigen, ContractFactory};
use ethers_solc::artifacts::contract::ContractBytecode;
use ethers_contract::abigen;
use crate::crypto::ProcessedSignature;
@@ -19,21 +14,8 @@ pub enum EthereumError {
abigen!(Schnorr, "./artifacts/Schnorr.sol/Schnorr.json");
pub async fn deploy_schnorr_verifier_contract(
client: Arc<SignerMiddleware<Provider<Http>, LocalWallet>>,
) -> Result<Schnorr<SignerMiddleware<Provider<Http>, LocalWallet>>> {
let path = "./artifacts/Schnorr.sol/Schnorr.json";
let artifact: ContractBytecode = serde_json::from_reader(File::open(path).unwrap()).unwrap();
let abi = artifact.abi.unwrap();
let bin = artifact.bytecode.unwrap().object;
let factory = ContractFactory::new(abi, bin.into_bytes().unwrap(), client.clone());
let contract = factory.deploy(())?.send().await?;
let contract = Schnorr::new(contract.address(), client);
Ok(contract)
}
pub async fn call_verify(
contract: &Schnorr<SignerMiddleware<Provider<Http>, LocalWallet>>,
contract: &Schnorr<Provider<Http>>,
params: &ProcessedSignature,
) -> Result<()> {
if contract