diff --git a/Cargo.lock b/Cargo.lock index 3825f9168..88fae27a0 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -47,11 +47,24 @@ name = "cfg-if" version = "0.1.6" source = "registry+https://github.com/rust-lang/crates.io-index" +[[package]] +name = "cloudabi" +version = "0.0.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "bitflags 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "crunchy" version = "0.1.6" source = "registry+https://github.com/rust-lang/crates.io-index" +[[package]] +name = "crunchy" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" + [[package]] name = "docopt" version = "1.0.2" @@ -79,10 +92,10 @@ dependencies = [ [[package]] name = "ethabi" -version = "6.1.0" +version = "7.0.0" dependencies = [ "error-chain 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)", - "ethereum-types 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", + "ethereum-types 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)", "hex-literal 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", "rustc-hex 2.0.1 (registry+https://github.com/rust-lang/crates.io-index)", "serde 1.0.78 (registry+https://github.com/rust-lang/crates.io-index)", @@ -93,11 +106,11 @@ dependencies = [ [[package]] name = "ethabi-cli" -version = "6.0.0" +version = "7.0.0" dependencies = [ "docopt 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", "error-chain 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)", - "ethabi 6.1.0", + "ethabi 7.0.0", "rustc-hex 2.0.1 (registry+https://github.com/rust-lang/crates.io-index)", "serde 1.0.78 (registry+https://github.com/rust-lang/crates.io-index)", "serde_derive 1.0.78 (registry+https://github.com/rust-lang/crates.io-index)", @@ -105,13 +118,13 @@ dependencies = [ [[package]] name = "ethabi-contract" -version = "6.0.0" +version = "7.0.0" [[package]] name = "ethabi-derive" -version = "6.0.2" +version = "7.0.0" dependencies = [ - "ethabi 6.1.0", + "ethabi 7.0.0", "heck 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "proc-macro2 0.4.19 (registry+https://github.com/rust-lang/crates.io-index)", "quote 0.6.8 (registry+https://github.com/rust-lang/crates.io-index)", @@ -122,41 +135,41 @@ dependencies = [ name = "ethabi-tests" version = "0.1.0" dependencies = [ - "ethabi 6.1.0", - "ethabi-contract 6.0.0", - "ethabi-derive 6.0.2", + "ethabi 7.0.0", + "ethabi-contract 7.0.0", + "ethabi-derive 7.0.0", "hex-literal 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", "rustc-hex 2.0.1 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "ethbloom" -version = "0.5.0" +version = "0.6.2" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "crunchy 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", - "ethereum-types-serialize 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", - "fixed-hash 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)", + "crunchy 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", + "ethereum-types-serialize 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", + "fixed-hash 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "serde 1.0.78 (registry+https://github.com/rust-lang/crates.io-index)", "tiny-keccak 1.4.1 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "ethereum-types" -version = "0.4.0" +version = "0.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "crunchy 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", - "ethbloom 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)", - "ethereum-types-serialize 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", - "fixed-hash 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)", + "crunchy 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", + "ethbloom 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)", + "ethereum-types-serialize 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", + "fixed-hash 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "serde 1.0.78 (registry+https://github.com/rust-lang/crates.io-index)", - "uint 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)", + "uint 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "ethereum-types-serialize" -version = "0.2.1" +version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "serde 1.0.78 (registry+https://github.com/rust-lang/crates.io-index)", @@ -164,27 +177,19 @@ dependencies = [ [[package]] name = "fixed-hash" -version = "0.2.5" +version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ + "byteorder 1.2.2 (registry+https://github.com/rust-lang/crates.io-index)", "heapsize 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.40 (registry+https://github.com/rust-lang/crates.io-index)", - "rand 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", + "rand 0.5.6 (registry+https://github.com/rust-lang/crates.io-index)", "rustc-hex 2.0.1 (registry+https://github.com/rust-lang/crates.io-index)", + "static_assertions 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] -name = "fuchsia-zircon" -version = "0.3.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "bitflags 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)", - "fuchsia-zircon-sys 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "fuchsia-zircon-sys" -version = "0.3.3" +name = "fuchsia-cprng" +version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] @@ -281,14 +286,29 @@ dependencies = [ [[package]] name = "rand" -version = "0.4.2" +version = "0.5.6" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "fuchsia-zircon 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", + "cloudabi 0.0.3 (registry+https://github.com/rust-lang/crates.io-index)", + "fuchsia-cprng 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.40 (registry+https://github.com/rust-lang/crates.io-index)", + "rand_core 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", "winapi 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "rand_core" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "rand_core 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "rand_core" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" + [[package]] name = "regex" version = "1.0.5" @@ -345,6 +365,11 @@ dependencies = [ "serde 1.0.78 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "static_assertions" +version = "0.2.5" +source = "registry+https://github.com/rust-lang/crates.io-index" + [[package]] name = "strsim" version = "0.7.0" @@ -383,11 +408,11 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "uint" -version = "0.4.1" +version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "byteorder 1.2.2 (registry+https://github.com/rust-lang/crates.io-index)", - "crunchy 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", + "crunchy 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", "heapsize 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", "rustc-hex 2.0.1 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -439,16 +464,17 @@ source = "registry+https://github.com/rust-lang/crates.io-index" "checksum byteorder 1.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "73b5bdfe7ee3ad0b99c9801d58807a9dbc9e09196365b0203853b99889ab3c87" "checksum cc 1.0.9 (registry+https://github.com/rust-lang/crates.io-index)" = "2b4911e4bdcb4100c7680e7e854ff38e23f1b34d4d9e079efae3da2801341ffc" "checksum cfg-if 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)" = "082bb9b28e00d3c9d39cc03e64ce4cea0f1bb9b3fde493f0cbc008472d22bdf4" +"checksum cloudabi 0.0.3 (registry+https://github.com/rust-lang/crates.io-index)" = "ddfc5b9aa5d4507acaf872de71051dfd0e309860e88966e1051e462a077aac4f" "checksum crunchy 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)" = "a2f4a431c5c9f662e1200b7c7f02c34e91361150e382089a8f2dec3ba680cbda" +"checksum crunchy 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "c240f247c278fa08a6d4820a6a222bfc6e0d999e51ba67be94f44c905b2161f2" "checksum docopt 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "db2906c2579b5b7207fc1e328796a9a8835dc44e22dbe8e460b1d636f9a7b225" "checksum dtoa 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)" = "09c3753c3db574d215cba4ea76018483895d7bff25a31b49ba45db21c48e50ab" "checksum error-chain 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)" = "07e791d3be96241c77c43846b665ef1384606da2cd2a48730abe606a12906e02" -"checksum ethbloom 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)" = "1a93a43ce2e9f09071449da36bfa7a1b20b950ee344b6904ff23de493b03b386" -"checksum ethereum-types 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "35b3c5a18bc5e73a32a110ac743ec04b02bbbcd3b71d3118d40a6113d509378a" -"checksum ethereum-types-serialize 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "4ac59a21a9ce98e188f3dace9eb67a6c4a3c67ec7fbc7218cb827852679dc002" -"checksum fixed-hash 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)" = "7afe6ce860afb14422711595a7b26ada9ed7de2f43c0b2ab79d09ee196287273" -"checksum fuchsia-zircon 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "2e9763c69ebaae630ba35f74888db465e49e259ba1bc0eda7d06f4a067615d82" -"checksum fuchsia-zircon-sys 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "3dcaa9ae7725d12cdb85b3ad99a434db70b468c09ded17e012d86b5c1010f7a7" +"checksum ethbloom 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)" = "779ebef70385607b3d547ac506e07d882c516663d0f326156efcd14a96a85a0a" +"checksum ethereum-types 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)" = "b054df51e53f253837ea422681215b42823c02824bde982699d0dceecf6165a1" +"checksum ethereum-types-serialize 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "1873d77b32bc1891a79dad925f2acbc318ee942b38b9110f9dbc5fbeffcea350" +"checksum fixed-hash 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "a557e80084b05c32b455963ff565a9de6f2866da023d6671705c6aff6f65e01c" +"checksum fuchsia-cprng 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "a06f77d526c1a601b7c4cdd98f54b5eaabffc14d5f2f0296febdc7f357c6d3ba" "checksum heapsize 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)" = "1679e6ea370dee694f91f1dc469bf94cf8f52051d147aec3e1f9497c6fc22461" "checksum heck 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ea04fa3ead4e05e51a7c806fc07271fdbde4e246a6c6d1efd52e72230b771b82" "checksum hex-literal 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "4da5f0e01bd8a71a224a4eedecaacfcabda388dbb7a80faf04d3514287572d95" @@ -462,7 +488,9 @@ source = "registry+https://github.com/rust-lang/crates.io-index" "checksum proc-macro-hack-impl 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "d5cb6f960ad471404618e9817c0e5d10b1ae74cfdf01fab89ea0641fe7fb2892" "checksum proc-macro2 0.4.19 (registry+https://github.com/rust-lang/crates.io-index)" = "ffe022fb8c8bd254524b0b3305906c1921fa37a84a644e29079a9e62200c3901" "checksum quote 0.6.8 (registry+https://github.com/rust-lang/crates.io-index)" = "dd636425967c33af890042c483632d33fa7a18f19ad1d7ea72e8998c6ef8dea5" -"checksum rand 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)" = "eba5f8cb59cc50ed56be8880a5c7b496bfd9bd26394e176bc67884094145c2c5" +"checksum rand 0.5.6 (registry+https://github.com/rust-lang/crates.io-index)" = "c618c47cd3ebd209790115ab837de41425723956ad3ce2e6a7f09890947cacb9" +"checksum rand_core 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "7a6fdeb83b075e8266dcc8762c22776f6877a63111121f5f8c7411e5be7eed4b" +"checksum rand_core 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "d0e7a549d590831370895ab7ba4ea0c1b6b011d106b5ff2da6eee112615e6dc0" "checksum regex 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)" = "2069749032ea3ec200ca51e4a31df41759190a88edca0d2d86ee8bedf7073341" "checksum regex-syntax 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)" = "747ba3b235651f6e2f67dfa8bcdcd073ddb7c243cb21c442fc12395dfcac212d" "checksum rustc-demangle 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)" = "11fb43a206a04116ffd7cfcf9bcb941f8eb6cc7ff667272246b0a1c74259a3cb" @@ -470,12 +498,13 @@ source = "registry+https://github.com/rust-lang/crates.io-index" "checksum serde 1.0.78 (registry+https://github.com/rust-lang/crates.io-index)" = "92ec94e2754699adddbbc4f555791bd3acc2a2f5574cba16c93a4a9cf4a04415" "checksum serde_derive 1.0.78 (registry+https://github.com/rust-lang/crates.io-index)" = "0fb622d85245add5327d4f08b2d24fd51fa5d35fe1bba19ee79a1f211e9ac0ff" "checksum serde_json 1.0.13 (registry+https://github.com/rust-lang/crates.io-index)" = "5c508584d9913df116b91505eec55610a2f5b16e9ed793c46e4d0152872b3e74" +"checksum static_assertions 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)" = "c19be23126415861cb3a23e501d34a708f7f9b2183c5252d690941c2e69199d5" "checksum strsim 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "bb4f380125926a99e52bc279241539c018323fab05ad6368b56f93d9369ff550" "checksum syn 0.15.4 (registry+https://github.com/rust-lang/crates.io-index)" = "9056ebe7f2d6a38bc63171816fd1d3430da5a43896de21676dc5c0a4b8274a11" "checksum thread_local 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)" = "c6b53e329000edc2b34dbe8545fd20e55a333362d0a321909685a19bd28c3f1b" "checksum tiny-keccak 1.4.1 (registry+https://github.com/rust-lang/crates.io-index)" = "58911ed5eb275a8fd2f1f0418ed360a42f59329864b64e1e95377a9024498c01" "checksum ucd-util 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "fd2be2d6639d0f8fe6cdda291ad456e23629558d466e2789d2c3e9892bda285d" -"checksum uint 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)" = "754ba11732b9161b94c41798e5197e5e75388d012f760c42adb5000353e98646" +"checksum uint 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)" = "082df6964410f6aa929a61ddfafc997e4f32c62c22490e439ac351cec827f436" "checksum unicode-segmentation 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "a8083c594e02b8ae1654ae26f0ade5158b119bd88ad0e8227a5d8fcd72407946" "checksum unicode-xid 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "fc72304796d0818e357ead4e000d19c9c174ab23dc11093ac919054d20a6a7fc" "checksum utf8-ranges 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "796f7e48bef87609f7ade7e06495a87d5cd06c7866e6a5cbfceffc558a243737" diff --git a/cli/Cargo.toml b/cli/Cargo.toml index 65117dadb..d72b41f0b 100644 --- a/cli/Cargo.toml +++ b/cli/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "ethabi-cli" -version = "6.0.0" +version = "7.0.0" authors = ["Parity Technologies "] keywords = ["ethereum", "eth", "abi", "solidity", "cli"] description = "Easy to use cli for conversion of ethereum contract calls to bytecode." @@ -12,7 +12,7 @@ rustc-hex = "2.0" serde = "1.0" serde_derive = "1.0" docopt = "1.0" -ethabi = { version = "6.0", path = "../ethabi" } +ethabi = { version = "7.0", path = "../ethabi" } error-chain = { version = "0.12.0", default-features = false } [features] diff --git a/contract/Cargo.toml b/contract/Cargo.toml index f293c9fa8..a5dde2e38 100644 --- a/contract/Cargo.toml +++ b/contract/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "ethabi-contract" -version = "6.0.0" +version = "7.0.0" authors = ["Parity Technologies "] homepage = "https://github.com/paritytech/ethabi" license = "MIT/Apache-2.0" diff --git a/derive/Cargo.toml b/derive/Cargo.toml index 7ba37e9ec..6939ea5af 100644 --- a/derive/Cargo.toml +++ b/derive/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "ethabi-derive" -version = "6.0.2" +version = "7.0.0" authors = ["Parity Technologies "] homepage = "https://github.com/paritytech/ethabi" license = "MIT/Apache-2.0" @@ -11,7 +11,7 @@ description = "Easy to use conversion of ethereum contract calls to bytecode." proc-macro = true [dependencies] -ethabi = { path = "../ethabi", version = "6.0" } +ethabi = { path = "../ethabi", version = "7.0" } heck = "0.3" syn = "0.15" quote = "0.6" diff --git a/derive/src/lib.rs b/derive/src/lib.rs index d4c761ccc..966787f41 100644 --- a/derive/src/lib.rs +++ b/derive/src/lib.rs @@ -177,7 +177,7 @@ fn to_token(name: &proc_macro2::TokenStream, kind: &ParamType) -> proc_macro2::T match *kind { ParamType::Address => quote! { ethabi::Token::Address(#name) }, ParamType::Bytes => quote! { ethabi::Token::Bytes(#name) }, - ParamType::FixedBytes(_) => quote! { ethabi::Token::FixedBytes(#name.to_vec()) }, + ParamType::FixedBytes(_) => quote! { ethabi::Token::FixedBytes(#name.as_ref().to_vec()) }, ParamType::Int(_) => quote! { ethabi::Token::Int(#name) }, ParamType::Uint(_) => quote! { ethabi::Token::Uint(#name) }, ParamType::Bool => quote! { ethabi::Token::Bool(#name) }, diff --git a/ethabi/Cargo.toml b/ethabi/Cargo.toml index fd1ab4343..997aeb6c9 100644 --- a/ethabi/Cargo.toml +++ b/ethabi/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "ethabi" -version = "6.1.0" +version = "7.0.0" authors = ["Parity Technologies "] homepage = "https://github.com/paritytech/ethabi" license = "MIT/Apache-2.0" @@ -14,7 +14,7 @@ serde_json = "1.0" serde_derive = "1.0" tiny-keccak = "1.4" error-chain = { version = "0.12", default-features = false } -ethereum-types = "0.4" +ethereum-types = "0.5.2" [dev-dependencies] hex-literal = "0.1.1" diff --git a/ethabi/src/encoder.rs b/ethabi/src/encoder.rs index b667674ce..2b9bb74a0 100644 --- a/ethabi/src/encoder.rs +++ b/ethabi/src/encoder.rs @@ -1,7 +1,7 @@ //! ABI encoder. use util::pad_u32; -use {Token, Hash, Bytes}; +use {Token, Bytes}; fn pad_bytes(bytes: &[u8]) -> Vec<[u8; 32]> { let mut result = vec![pad_u32(bytes.len() as u32)]; @@ -133,14 +133,14 @@ fn encode_token(token: &Token) -> Mediate { match *token { Token::Address(ref address) => { let mut padded = [0u8; 32]; - padded[12..].copy_from_slice(address); + padded[12..].copy_from_slice(address.as_ref()); Mediate::Raw(vec![padded]) }, Token::Bytes(ref bytes) => Mediate::Prefixed(pad_bytes(bytes)), Token::String(ref s) => Mediate::Prefixed(pad_bytes(s.as_bytes())), Token::FixedBytes(ref bytes) => Mediate::Raw(pad_fixed_bytes(bytes)), - Token::Int(ref int) => Mediate::Raw(vec![Hash::from(int).0]), - Token::Uint(ref uint) => Mediate::Raw(vec![Hash::from(uint).0]), + Token::Int(int) => Mediate::Raw(vec![int.into()]), + Token::Uint(uint) => Mediate::Raw(vec![uint.into()]), Token::Bool(b) => { let mut value = [0u8; 32]; if b { diff --git a/ethabi/src/event.rs b/ethabi/src/event.rs index d9fb4cfbe..8d22e8b73 100644 --- a/ethabi/src/event.rs +++ b/ethabi/src/event.rs @@ -129,7 +129,7 @@ impl Event { let flat_topics = topics.into_iter() .skip(to_skip) - .flat_map(|t| t.to_vec()) + .flat_map(|t| t.as_ref().to_vec()) .collect::>(); let topic_tokens = try!(decode(&topic_types, &flat_topics)); @@ -208,8 +208,8 @@ mod tests { let log = RawLog { topics: vec![ long_signature("foo", &[ParamType::Int(256), ParamType::Int(256), ParamType::Address, ParamType::Address]), - "0000000000000000000000000000000000000000000000000000000000000002".into(), - "0000000000000000000000001111111111111111111111111111111111111111".into(), + "0000000000000000000000000000000000000000000000000000000000000002".parse().unwrap(), + "0000000000000000000000001111111111111111111111111111111111111111".parse().unwrap(), ], data: ("".to_owned() + @@ -221,8 +221,8 @@ mod tests { assert_eq!(result, Log { params: vec![ ("a".to_owned(), Token::Int("0000000000000000000000000000000000000000000000000000000000000003".into())), ("b".to_owned(), Token::Int("0000000000000000000000000000000000000000000000000000000000000002".into())), - ("c".to_owned(), Token::Address("2222222222222222222222222222222222222222".into())), - ("d".to_owned(), Token::Address("1111111111111111111111111111111111111111".into())), + ("c".to_owned(), Token::Address("2222222222222222222222222222222222222222".parse().unwrap())), + ("d".to_owned(), Token::Address("1111111111111111111111111111111111111111".parse().unwrap())), ].into_iter().map(|(name, value)| LogParam { name, value }).collect::>()}); } } diff --git a/ethabi/src/filter.rs b/ethabi/src/filter.rs index d436d1cb0..c46f5a52b 100644 --- a/ethabi/src/filter.rs +++ b/ethabi/src/filter.rs @@ -1,7 +1,6 @@ use std::ops; use serde::{Serialize, Serializer}; use serde_json::Value; -use hex::ToHex; use {Hash, Token}; /// Raw topic filter. @@ -109,12 +108,12 @@ impl Serialize for Topic { Topic::Any => Value::Null, Topic::OneOf(ref vec) => { let v = vec.iter() - .map(|h| format!("0x{}", h.to_hex::())) + .map(|h| format!("0x{:x}", h)) .map(Value::String) .collect(); Value::Array(v) }, - Topic::This(ref hash) => Value::String(format!("0x{}", hash.to_hex::())), + Topic::This(ref hash) => Value::String(format!("0x{:x}", hash)), }; value.serialize(serializer) } @@ -144,7 +143,7 @@ mod tests { use Hash; fn hash(s: &'static str) -> Hash { - s.into() + s.parse().unwrap() } #[test]