Skip to content
This repository has been archived by the owner on Oct 19, 2024. It is now read-only.

Commit

Permalink
fix: remove depdendency on curl
Browse files Browse the repository at this point in the history
  • Loading branch information
gakonst committed May 1, 2021
1 parent cda92c9 commit 763eea5
Show file tree
Hide file tree
Showing 4 changed files with 60 additions and 107 deletions.
73 changes: 18 additions & 55 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion ethers-contract/ethers-contract-abigen/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,14 @@ keywords = ["ethereum", "web3", "celo", "ethers"]
ethers-core = { version = "0.2.2", path = "../../ethers-core" }

anyhow = "1.0.37"
curl = "0.4"
Inflector = "0.11"
proc-macro2 = "1.0"
quote = "1.0"
syn = "1.0.12"
url = "2.1"
serde_json = "1.0.61"
hex = { version = "0.4.2", default-features = false, features = ["std"] }
reqwest = { version = "0.11.3", features = ["blocking"] }

[package.metadata.docs.rs]
all-features = true
Expand Down
17 changes: 2 additions & 15 deletions ethers-contract/ethers-contract-abigen/src/util.rs
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
use ethers_core::types::Address;

use anyhow::{anyhow, Result};
use curl::easy::Easy;
use inflector::Inflector;
use proc_macro2::{Ident, Literal, Span, TokenStream};
use quote::quote;
use syn::Ident as SynIdent;
use reqwest::Client;

/// Expands a identifier string into an token.
pub fn ident(name: &str) -> Ident {
Expand Down Expand Up @@ -56,20 +56,7 @@ where

/// Perform an HTTP GET request and return the contents of the response.
pub fn http_get(url: &str) -> Result<String> {
let mut buffer = Vec::new();
let mut handle = Easy::new();
handle.url(url)?;
{
let mut transfer = handle.transfer();
transfer.write_function(|data| {
buffer.extend_from_slice(data);
Ok(data.len())
})?;
transfer.perform()?;
}

let buffer = String::from_utf8(buffer)?;
Ok(buffer)
Ok(reqwest::blocking::get(url)?.text()?)
}

#[cfg(test)]
Expand Down
75 changes: 39 additions & 36 deletions ethers/tests/major_contracts.rs
Original file line number Diff line number Diff line change
@@ -1,37 +1,40 @@
// // This test exists to ensure that the abigen macro works "reasonably" well with popular contracts
// use ethers::contract::abigen;
//
// abigen!(
// KeepBonding,
// "etherscan:0x7137701e90C6a80B0dA36922cd83942b32A8fc95"
// );
// abigen!(cDAI, "etherscan:0x5d3a536E4D6DbD6114cc1Ead35777bAB948E3643");
// abigen!(
// Comptroller,
// "etherscan:0x3d9819210a31b4961b30ef54be2aed79b9c9cd3b"
// );
//
// // https://github.com/vyperlang/vyper/issues/1931
// // abigen!(
// // Curve,
// // "etherscan:0xa2b47e3d5c44877cca798226b7b8118f9bfb7a56"
// // );
// abigen!(
// UmaAdmin,
// "etherscan:0x4E6CCB1dA3C7844887F9A5aF4e8450d9fd90317A"
// );
//
// // e.g. aave's `initialize` methods exist multiple times, so we should rename it
// abigen!(
// AavePoolCore,
// "etherscan:0x3dfd23a6c5e8bbcfc9581d2e864a68feb6a076d3",
// methods {
// initialize(address,bytes) as initialize_proxy;
// }
// );
//
// // The DyDxLimitOrders contract uses Abi Encoder v2 with nested tuples
// abigen!(
// DyDxLimitOrders,
// "etherscan:0xDEf136D9884528e1EB302f39457af0E4d3AD24EB"
// );
use ethers::contract::abigen;

abigen!(
KeepBonding,
"etherscan:0x7137701e90C6a80B0dA36922cd83942b32A8fc95"
);

abigen!(cDAI, "etherscan:0x5d3a536E4D6DbD6114cc1Ead35777bAB948E3643");

abigen!(
Comptroller,
"etherscan:0x3d9819210a31b4961b30ef54be2aed79b9c9cd3b"
);

// https://github.com/vyperlang/vyper/issues/1931
abigen!(
Curve,
"etherscan:0xa2b47e3d5c44877cca798226b7b8118f9bfb7a56"
);

abigen!(
UmaAdmin,
"etherscan:0x4E6CCB1dA3C7844887F9A5aF4e8450d9fd90317A"
);

// e.g. aave's `initialize` methods exist multiple times, so we should rename it
abigen!(
AavePoolCore,
"etherscan:0x3dfd23a6c5e8bbcfc9581d2e864a68feb6a076d3",
methods {
initialize(address,bytes) as initialize_proxy;
}
);

// The DyDxLimitOrders contract uses Abi Encoder v2 with nested tuples
abigen!(
DyDxLimitOrders,
"etherscan:0xDEf136D9884528e1EB302f39457af0E4d3AD24EB"
);

0 comments on commit 763eea5

Please sign in to comment.