Skip to content

Commit

Permalink
Bump ethabi to v11.0.0 (#326)
Browse files Browse the repository at this point in the history
* Update ethabi requirement from 9.0.0 to 11.0.0

Updates the requirements on [ethabi](https://github.com/paritytech/ethabi) to permit the latest version.
- [Release notes](https://github.com/paritytech/ethabi/releases)
- [Changelog](https://github.com/paritytech/ethabi/blob/master/CHANGELOG.md)
- [Commits](paritytech/ethabi@v9.0.0...v11.0.0)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>

* update ethabi error API

Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com>
Co-authored-by: Tomasz Drwięga <tomusdrw@users.noreply.github.com>
  • Loading branch information
3 people committed Feb 5, 2020
1 parent 07b960a commit db9b799
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
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

0 comments on commit db9b799

Please sign in to comment.