Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bump ethabi to v11.0.0 #326

Merged
merged 3 commits into from Feb 5, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion Cargo.toml
Expand Up @@ -13,7 +13,7 @@ edition = "2018"

[dependencies]
arrayvec = "0.5.0"
ethabi = "9.0.0"
ethabi = "11.0.0"
ethereum-types = "0.8.0"
futures = "0.1.26"
jsonrpc-core = "14.0.0"
Expand Down
10 changes: 5 additions & 5 deletions src/contract/deploy.rs
Expand Up @@ -113,21 +113,21 @@ impl<T: Transport> Builder<T> {

for (lib, address) in self.linker {
if lib.len() > 38 {
return Err(
ethabi::ErrorKind::Msg(String::from("The library name should be under 39 characters.")).into(),
);
return Err(ethabi::Error::Other(
"The library name should be under 39 characters.".into(),
));
}
let replace = format!("__{:_<38}", lib); // This makes the required width 38 characters and will pad with `_` to match it.
let address: String = address.as_ref().to_hex();
code_hex = code_hex.replacen(&replace, &address, 1);
}
code_hex = code_hex.replace("\"", "").replace("0x", ""); // This is to fix truffle + serde_json redundant `"` and `0x`
let code = code_hex.from_hex().map_err(ethabi::ErrorKind::Hex)?;
let code = code_hex.from_hex().map_err(ethabi::Error::Hex)?;

let params = params.into_tokens();
let data = match (abi.constructor(), params.is_empty()) {
(None, false) => {
return Err(ethabi::ErrorKind::Msg("Constructor is not defined in the ABI.".into()).into());
return Err(ethabi::Error::Other("Constructor is not defined in the ABI.".into()));
}
(None, true) => code,
(Some(constructor), _) => constructor.encode_input(code, &params)?,
Expand Down