diff --git a/Cargo.lock b/Cargo.lock index b1b938168..a99a4c309 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -542,9 +542,10 @@ dependencies = [ [[package]] name = "ethabi" -version = "2.0.0" +version = "4.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ + "error-chain 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)", "rustc-hex 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", "serde 1.0.15 (registry+https://github.com/rust-lang/crates.io-index)", "serde_derive 1.0.15 (registry+https://github.com/rust-lang/crates.io-index)", @@ -829,7 +830,6 @@ name = "ethcore-secretstore" version = "1.0.0" dependencies = [ "byteorder 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", - "ethabi 2.0.0 (registry+https://github.com/rust-lang/crates.io-index)", "ethcore 1.9.0", "ethcore-bigint 0.1.3", "ethcore-bytes 0.1.0", @@ -1813,7 +1813,7 @@ dependencies = [ name = "native-contract-generator" version = "0.1.0" dependencies = [ - "ethabi 2.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "ethabi 4.0.1 (registry+https://github.com/rust-lang/crates.io-index)", "heck 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -1822,7 +1822,7 @@ name = "native-contracts" version = "0.1.0" dependencies = [ "byteorder 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", - "ethabi 2.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "ethabi 4.0.1 (registry+https://github.com/rust-lang/crates.io-index)", "ethcore-bigint 0.1.3", "futures 0.1.16 (registry+https://github.com/rust-lang/crates.io-index)", "native-contract-generator 0.1.0", @@ -2199,7 +2199,7 @@ dependencies = [ name = "parity-hash-fetch" version = "1.9.0" dependencies = [ - "ethabi 2.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "ethabi 4.0.1 (registry+https://github.com/rust-lang/crates.io-index)", "ethcore-bigint 0.1.3", "ethcore-bytes 0.1.0", "ethcore-util 1.9.0", @@ -2385,7 +2385,7 @@ dependencies = [ name = "parity-updater" version = "1.9.0" dependencies = [ - "ethabi 2.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "ethabi 4.0.1 (registry+https://github.com/rust-lang/crates.io-index)", "ethcore 1.9.0", "ethcore-bigint 0.1.3", "ethcore-bytes 0.1.0", @@ -3709,7 +3709,7 @@ dependencies = [ "checksum error-chain 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ff511d5dc435d703f4971bc399647c9bc38e20cb41452e3b9feb4765419ed3f3" "checksum error-chain 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)" = "bd5c82c815138e278b8dcdeffc49f27ea6ffb528403e9dea4194f2e3dd40b143" "checksum eth-secp256k1 0.5.6 (git+https://github.com/paritytech/rust-secp256k1)" = "" -"checksum ethabi 2.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "0c3d62319ee0f35abf20afe8859dd2668195912614346447bb2dee9fb8da7c62" +"checksum ethabi 4.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "c819a3adef0413a2519cbd9a19a35dd1c20c7a0110705beaba8aa4aa87eda95f" "checksum fdlimit 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "b1ee15a7050e5580b3712877157068ea713b245b080ff302ae2ca973cfcd9baa" "checksum flate2 0.2.20 (registry+https://github.com/rust-lang/crates.io-index)" = "e6234dd4468ae5d1e2dbb06fe2b058696fdc50a339c68a393aefbf00bc81e423" "checksum fnv 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)" = "6cc484842f1e2884faf56f529f960cc12ad8c71ce96cc7abba0a067c98fee344" diff --git a/ethcore/native_contracts/Cargo.toml b/ethcore/native_contracts/Cargo.toml index 2f91a4848..2cc88fcdc 100644 --- a/ethcore/native_contracts/Cargo.toml +++ b/ethcore/native_contracts/Cargo.toml @@ -6,7 +6,7 @@ authors = ["Parity Technologies "] build = "build.rs" [dependencies] -ethabi = "2.0" +ethabi = "4.0" futures = "0.1" byteorder = "1.0" ethcore-bigint = { path = "../../util/bigint" } diff --git a/ethcore/native_contracts/generator/Cargo.toml b/ethcore/native_contracts/generator/Cargo.toml index a599e756e..243a5f597 100644 --- a/ethcore/native_contracts/generator/Cargo.toml +++ b/ethcore/native_contracts/generator/Cargo.toml @@ -5,5 +5,5 @@ version = "0.1.0" authors = ["Parity Technologies "] [dependencies] -ethabi = "2.0" +ethabi = "4.0" heck = "0.2" diff --git a/ethcore/native_contracts/generator/src/lib.rs b/ethcore/native_contracts/generator/src/lib.rs index 458947313..a8848503e 100644 --- a/ethcore/native_contracts/generator/src/lib.rs +++ b/ethcore/native_contracts/generator/src/lib.rs @@ -21,18 +21,17 @@ //! due to missing crates or name collisions. This will change when //! it can be ported to a procedural macro. -use ethabi::Contract; -use ethabi::spec::{Interface, ParamType, Error as AbiError}; -use heck::SnakeCase; - extern crate ethabi; extern crate heck; +use ethabi::{Contract, ParamType}; +use heck::SnakeCase; + /// Errors in generation. #[derive(Debug)] pub enum Error { /// Bad ABI. - Abi(AbiError), + Abi(ethabi::Error), /// Unsupported parameter type in given function. UnsupportedType(String, ParamType), } @@ -41,13 +40,13 @@ pub enum Error { /// a struct which can be used to call it. // TODO: make this a proc macro when that's possible. pub fn generate_module(struct_name: &str, abi: &str) -> Result { - let contract = Contract::new(Interface::load(abi.as_bytes()).map_err(Error::Abi)?); + let contract = Contract::load(abi.as_bytes()).map_err(Error::Abi)?; let functions = generate_functions(&contract)?; Ok(format!(r##" use byteorder::{{BigEndian, ByteOrder}}; use futures::{{future, Future, IntoFuture}}; -use ethabi::{{Contract, Interface, Token, Event}}; +use ethabi::{{Contract, Token, Event}}; use bigint; type BoxFuture = Box + Send>; @@ -66,8 +65,8 @@ impl {name} {{ /// Create a new instance of `{name}` with an address. /// Calls can be made, given a callback for dispatching calls asynchronously. pub fn new(address: bigint::prelude::H160) -> Self {{ - let contract = Contract::new(Interface::load(ABI.as_bytes()) - .expect("ABI checked at generation-time; qed")); + let contract = Contract::load(ABI.as_bytes()) + .expect("ABI checked at generation-time; qed"); {name} {{ contract: contract, address: address, @@ -92,16 +91,16 @@ impl {name} {{ fn generate_functions(contract: &Contract) -> Result { let mut functions = String::new(); for function in contract.functions() { - let name = function.name(); + let name = &function.name; let snake_name = name.to_snake_case(); - let inputs = function.input_params(); - let outputs = function.output_params(); + let inputs: Vec<_> = function.inputs.iter().map(|i| i.kind.clone()).collect(); + let outputs: Vec<_> = function.outputs.iter().map(|i| i.kind.clone()).collect(); let (input_params, to_tokens) = input_params_codegen(&inputs) - .map_err(|bad_type| Error::UnsupportedType(name.into(), bad_type))?; + .map_err(|bad_type| Error::UnsupportedType(name.clone(), bad_type))?; let (output_type, decode_outputs) = output_params_codegen(&outputs) - .map_err(|bad_type| Error::UnsupportedType(name.into(), bad_type))?; + .map_err(|bad_type| Error::UnsupportedType(name.clone(), bad_type))?; functions.push_str(&format!(r##" /// Call the function "{abi_name}" on the contract. @@ -115,17 +114,17 @@ pub fn {snake_name}(&self, call: F, {params}) -> BoxFuture<{output_type}, U::Future: Send + 'static {{ let function = self.contract.function(r#"{abi_name}"#) - .expect("function existence checked at compile-time; qed"); + .expect("function existence checked at compile-time; qed").clone(); let call_addr = self.address; - let call_future = match function.encode_call({to_tokens}) {{ + let call_future = match function.encode_input(&{to_tokens}) {{ Ok(call_data) => (call)(call_addr, call_data), Err(e) => return Box::new(future::err(format!("Error encoding call: {{:?}}", e))), }}; Box::new(call_future .into_future() - .and_then(move |out| function.decode_output(out).map_err(|e| format!("{{:?}}", e))) + .and_then(move |out| function.decode_output(&out).map_err(|e| format!("{{:?}}", e))) .map(Vec::into_iter) .and_then(|mut outputs| {decode_outputs})) }} @@ -325,7 +324,7 @@ fn detokenize(name: &str, output_type: ParamType) -> String { #[cfg(test)] mod tests { - use ethabi::spec::ParamType; + use ethabi::ParamType; #[test] fn input_types() { diff --git a/ethcore/src/engines/validator_set/safe_contract.rs b/ethcore/src/engines/validator_set/safe_contract.rs index d0ada79ec..695f2a658 100644 --- a/ethcore/src/engines/validator_set/safe_contract.rs +++ b/ethcore/src/engines/validator_set/safe_contract.rs @@ -276,7 +276,7 @@ impl ValidatorSafeContract { .filter(move |l| check_log(l)) .filter_map(|log| { let topics = log.topics.iter().map(|x| x.0.clone()).collect(); - event.decode_log(topics, log.data.clone()).ok() + event.parse_log((topics, log.data.clone()).into()).ok() }); match decoded_events.next() { @@ -285,7 +285,7 @@ impl ValidatorSafeContract { // decode log manually until the native contract generator is // good enough to do it for us. - let validators_token = &matched_event[1].value; + let validators_token = &matched_event.params[1].value; let validators = validators_token.clone().to_array() .and_then(|a| a.into_iter() diff --git a/hash-fetch/Cargo.toml b/hash-fetch/Cargo.toml index c52f1e232..7b0e8b7cd 100644 --- a/hash-fetch/Cargo.toml +++ b/hash-fetch/Cargo.toml @@ -22,5 +22,5 @@ native-contracts = { path = "../ethcore/native_contracts" } hash = { path = "../util/hash" } [dev-dependencies] -ethabi = "2.0" +ethabi = "4.0" parking_lot = "0.4" diff --git a/hash-fetch/src/urlhint.rs b/hash-fetch/src/urlhint.rs index e19860e32..0670266df 100644 --- a/hash-fetch/src/urlhint.rs +++ b/hash-fetch/src/urlhint.rs @@ -265,8 +265,8 @@ pub mod tests { // given let registrar = FakeRegistrar::new(); let resolve_result = { - use ethabi::{Encoder, Token}; - Encoder::encode(vec![Token::String(String::new()), Token::FixedBytes(vec![0; 20]), Token::Address([0; 20])]) + use ethabi::{encode, Token}; + encode(&[Token::String(String::new()), Token::FixedBytes(vec![0; 20]), Token::Address([0; 20])]) }; registrar.responses.lock()[1] = Ok(resolve_result); diff --git a/secret_store/Cargo.toml b/secret_store/Cargo.toml index 3e98c62e7..5d6b2687f 100644 --- a/secret_store/Cargo.toml +++ b/secret_store/Cargo.toml @@ -26,7 +26,6 @@ tokio-io = "0.1.0" tokio-service = "0.1" tokio-proto = "0.1" url = "1.0" -ethabi = "2.0" ethcore = { path = "../ethcore" } ethcore-bytes = { path = "../util/bytes" } ethcore-devtools = { path = "../devtools" } diff --git a/secret_store/src/lib.rs b/secret_store/src/lib.rs index 6aa3bd708..070c737f9 100644 --- a/secret_store/src/lib.rs +++ b/secret_store/src/lib.rs @@ -36,7 +36,6 @@ extern crate tokio_service; extern crate tokio_proto; extern crate url; -extern crate ethabi; extern crate ethcore; extern crate ethcore_devtools as devtools; extern crate ethcore_bytes as bytes; diff --git a/updater/Cargo.toml b/updater/Cargo.toml index 9897bf7d0..9d981440d 100644 --- a/updater/Cargo.toml +++ b/updater/Cargo.toml @@ -11,7 +11,7 @@ ethcore-ipc-codegen = { path = "../ipc/codegen" } [dependencies] log = "0.3" -ethabi = "2.0" +ethabi = "4.0" target_info = "0.1" ethcore = { path = "../ethcore" } ethsync = { path = "../sync" } diff --git a/updater/src/operations.rs b/updater/src/operations.rs index 4ec53331c..b9bb01bd7 100644 --- a/updater/src/operations.rs +++ b/updater/src/operations.rs @@ -15,7 +15,7 @@ pub struct Operations { impl Operations { pub fn new(address: util::Address, do_call: F) -> Self where F: Fn(util::Address, Vec) -> Result, String> + Send + Sync + 'static { Operations { - contract: ethabi::Contract::new(ethabi::Interface::load(b"[{\"constant\":false,\"inputs\":[{\"name\":\"_client\",\"type\":\"bytes32\"},{\"name\":\"_newOwner\",\"type\":\"address\"}],\"name\":\"resetClientOwner\",\"outputs\":[],\"payable\":false,\"type\":\"function\"},{\"constant\":true,\"inputs\":[{\"name\":\"_client\",\"type\":\"bytes32\"},{\"name\":\"_release\",\"type\":\"bytes32\"}],\"name\":\"isLatest\",\"outputs\":[{\"name\":\"\",\"type\":\"bool\"}],\"payable\":false,\"type\":\"function\"},{\"constant\":false,\"inputs\":[{\"name\":\"_txid\",\"type\":\"bytes32\"}],\"name\":\"rejectTransaction\",\"outputs\":[],\"payable\":false,\"type\":\"function\"},{\"constant\":false,\"inputs\":[{\"name\":\"_newOwner\",\"type\":\"address\"}],\"name\":\"setOwner\",\"outputs\":[],\"payable\":false,\"type\":\"function\"},{\"constant\":false,\"inputs\":[{\"name\":\"_number\",\"type\":\"uint32\"},{\"name\":\"_name\",\"type\":\"bytes32\"},{\"name\":\"_hard\",\"type\":\"bool\"},{\"name\":\"_spec\",\"type\":\"bytes32\"}],\"name\":\"proposeFork\",\"outputs\":[],\"payable\":false,\"type\":\"function\"},{\"constant\":false,\"inputs\":[{\"name\":\"_client\",\"type\":\"bytes32\"}],\"name\":\"removeClient\",\"outputs\":[],\"payable\":false,\"type\":\"function\"},{\"constant\":true,\"inputs\":[{\"name\":\"_client\",\"type\":\"bytes32\"},{\"name\":\"_release\",\"type\":\"bytes32\"}],\"name\":\"release\",\"outputs\":[{\"name\":\"o_forkBlock\",\"type\":\"uint32\"},{\"name\":\"o_track\",\"type\":\"uint8\"},{\"name\":\"o_semver\",\"type\":\"uint24\"},{\"name\":\"o_critical\",\"type\":\"bool\"}],\"payable\":false,\"type\":\"function\"},{\"constant\":true,\"inputs\":[{\"name\":\"_client\",\"type\":\"bytes32\"},{\"name\":\"_checksum\",\"type\":\"bytes32\"}],\"name\":\"build\",\"outputs\":[{\"name\":\"o_release\",\"type\":\"bytes32\"},{\"name\":\"o_platform\",\"type\":\"bytes32\"}],\"payable\":false,\"type\":\"function\"},{\"constant\":false,\"inputs\":[],\"name\":\"rejectFork\",\"outputs\":[],\"payable\":false,\"type\":\"function\"},{\"constant\":true,\"inputs\":[{\"name\":\"\",\"type\":\"bytes32\"}],\"name\":\"client\",\"outputs\":[{\"name\":\"owner\",\"type\":\"address\"},{\"name\":\"required\",\"type\":\"bool\"}],\"payable\":false,\"type\":\"function\"},{\"constant\":false,\"inputs\":[{\"name\":\"_newOwner\",\"type\":\"address\"}],\"name\":\"setClientOwner\",\"outputs\":[],\"payable\":false,\"type\":\"function\"},{\"constant\":true,\"inputs\":[{\"name\":\"\",\"type\":\"uint32\"}],\"name\":\"fork\",\"outputs\":[{\"name\":\"name\",\"type\":\"bytes32\"},{\"name\":\"spec\",\"type\":\"bytes32\"},{\"name\":\"hard\",\"type\":\"bool\"},{\"name\":\"ratified\",\"type\":\"bool\"},{\"name\":\"requiredCount\",\"type\":\"uint256\"}],\"payable\":false,\"type\":\"function\"},{\"constant\":false,\"inputs\":[{\"name\":\"_release\",\"type\":\"bytes32\"},{\"name\":\"_platform\",\"type\":\"bytes32\"},{\"name\":\"_checksum\",\"type\":\"bytes32\"}],\"name\":\"addChecksum\",\"outputs\":[],\"payable\":false,\"type\":\"function\"},{\"constant\":false,\"inputs\":[{\"name\":\"_txid\",\"type\":\"bytes32\"}],\"name\":\"confirmTransaction\",\"outputs\":[{\"name\":\"txSuccess\",\"type\":\"uint256\"}],\"payable\":false,\"type\":\"function\"},{\"constant\":true,\"inputs\":[{\"name\":\"\",\"type\":\"bytes32\"}],\"name\":\"proxy\",\"outputs\":[{\"name\":\"requiredCount\",\"type\":\"uint256\"},{\"name\":\"to\",\"type\":\"address\"},{\"name\":\"data\",\"type\":\"bytes\"},{\"name\":\"value\",\"type\":\"uint256\"},{\"name\":\"gas\",\"type\":\"uint256\"}],\"payable\":false,\"type\":\"function\"},{\"constant\":false,\"inputs\":[{\"name\":\"_client\",\"type\":\"bytes32\"},{\"name\":\"_owner\",\"type\":\"address\"}],\"name\":\"addClient\",\"outputs\":[],\"payable\":false,\"type\":\"function\"},{\"constant\":true,\"inputs\":[{\"name\":\"\",\"type\":\"address\"}],\"name\":\"clientOwner\",\"outputs\":[{\"name\":\"\",\"type\":\"bytes32\"}],\"payable\":false,\"type\":\"function\"},{\"constant\":false,\"inputs\":[{\"name\":\"_txid\",\"type\":\"bytes32\"},{\"name\":\"_to\",\"type\":\"address\"},{\"name\":\"_data\",\"type\":\"bytes\"},{\"name\":\"_value\",\"type\":\"uint256\"},{\"name\":\"_gas\",\"type\":\"uint256\"}],\"name\":\"proposeTransaction\",\"outputs\":[{\"name\":\"txSuccess\",\"type\":\"uint256\"}],\"payable\":false,\"type\":\"function\"},{\"constant\":true,\"inputs\":[],\"name\":\"grandOwner\",\"outputs\":[{\"name\":\"\",\"type\":\"address\"}],\"payable\":false,\"type\":\"function\"},{\"constant\":false,\"inputs\":[{\"name\":\"_release\",\"type\":\"bytes32\"},{\"name\":\"_forkBlock\",\"type\":\"uint32\"},{\"name\":\"_track\",\"type\":\"uint8\"},{\"name\":\"_semver\",\"type\":\"uint24\"},{\"name\":\"_critical\",\"type\":\"bool\"}],\"name\":\"addRelease\",\"outputs\":[],\"payable\":false,\"type\":\"function\"},{\"constant\":false,\"inputs\":[],\"name\":\"acceptFork\",\"outputs\":[],\"payable\":false,\"type\":\"function\"},{\"constant\":true,\"inputs\":[],\"name\":\"clientsRequired\",\"outputs\":[{\"name\":\"\",\"type\":\"uint32\"}],\"payable\":false,\"type\":\"function\"},{\"constant\":true,\"inputs\":[{\"name\":\"_client\",\"type\":\"bytes32\"},{\"name\":\"_release\",\"type\":\"bytes32\"}],\"name\":\"track\",\"outputs\":[{\"name\":\"\",\"type\":\"uint8\"}],\"payable\":false,\"type\":\"function\"},{\"constant\":false,\"inputs\":[{\"name\":\"_client\",\"type\":\"bytes32\"},{\"name\":\"_r\",\"type\":\"bool\"}],\"name\":\"setClientRequired\",\"outputs\":[],\"payable\":false,\"type\":\"function\"},{\"constant\":true,\"inputs\":[],\"name\":\"latestFork\",\"outputs\":[{\"name\":\"\",\"type\":\"uint32\"}],\"payable\":false,\"type\":\"function\"},{\"constant\":true,\"inputs\":[{\"name\":\"_client\",\"type\":\"bytes32\"},{\"name\":\"_track\",\"type\":\"uint8\"}],\"name\":\"latestInTrack\",\"outputs\":[{\"name\":\"\",\"type\":\"bytes32\"}],\"payable\":false,\"type\":\"function\"},{\"constant\":true,\"inputs\":[{\"name\":\"_client\",\"type\":\"bytes32\"},{\"name\":\"_release\",\"type\":\"bytes32\"},{\"name\":\"_platform\",\"type\":\"bytes32\"}],\"name\":\"checksum\",\"outputs\":[{\"name\":\"\",\"type\":\"bytes32\"}],\"payable\":false,\"type\":\"function\"},{\"constant\":true,\"inputs\":[],\"name\":\"proposedFork\",\"outputs\":[{\"name\":\"\",\"type\":\"uint32\"}],\"payable\":false,\"type\":\"function\"}]").expect("JSON is autogenerated; qed")), + contract: ethabi::Contract::load(b"[{\"constant\":false,\"inputs\":[{\"name\":\"_client\",\"type\":\"bytes32\"},{\"name\":\"_newOwner\",\"type\":\"address\"}],\"name\":\"resetClientOwner\",\"outputs\":[],\"payable\":false,\"type\":\"function\"},{\"constant\":true,\"inputs\":[{\"name\":\"_client\",\"type\":\"bytes32\"},{\"name\":\"_release\",\"type\":\"bytes32\"}],\"name\":\"isLatest\",\"outputs\":[{\"name\":\"\",\"type\":\"bool\"}],\"payable\":false,\"type\":\"function\"},{\"constant\":false,\"inputs\":[{\"name\":\"_txid\",\"type\":\"bytes32\"}],\"name\":\"rejectTransaction\",\"outputs\":[],\"payable\":false,\"type\":\"function\"},{\"constant\":false,\"inputs\":[{\"name\":\"_newOwner\",\"type\":\"address\"}],\"name\":\"setOwner\",\"outputs\":[],\"payable\":false,\"type\":\"function\"},{\"constant\":false,\"inputs\":[{\"name\":\"_number\",\"type\":\"uint32\"},{\"name\":\"_name\",\"type\":\"bytes32\"},{\"name\":\"_hard\",\"type\":\"bool\"},{\"name\":\"_spec\",\"type\":\"bytes32\"}],\"name\":\"proposeFork\",\"outputs\":[],\"payable\":false,\"type\":\"function\"},{\"constant\":false,\"inputs\":[{\"name\":\"_client\",\"type\":\"bytes32\"}],\"name\":\"removeClient\",\"outputs\":[],\"payable\":false,\"type\":\"function\"},{\"constant\":true,\"inputs\":[{\"name\":\"_client\",\"type\":\"bytes32\"},{\"name\":\"_release\",\"type\":\"bytes32\"}],\"name\":\"release\",\"outputs\":[{\"name\":\"o_forkBlock\",\"type\":\"uint32\"},{\"name\":\"o_track\",\"type\":\"uint8\"},{\"name\":\"o_semver\",\"type\":\"uint24\"},{\"name\":\"o_critical\",\"type\":\"bool\"}],\"payable\":false,\"type\":\"function\"},{\"constant\":true,\"inputs\":[{\"name\":\"_client\",\"type\":\"bytes32\"},{\"name\":\"_checksum\",\"type\":\"bytes32\"}],\"name\":\"build\",\"outputs\":[{\"name\":\"o_release\",\"type\":\"bytes32\"},{\"name\":\"o_platform\",\"type\":\"bytes32\"}],\"payable\":false,\"type\":\"function\"},{\"constant\":false,\"inputs\":[],\"name\":\"rejectFork\",\"outputs\":[],\"payable\":false,\"type\":\"function\"},{\"constant\":true,\"inputs\":[{\"name\":\"\",\"type\":\"bytes32\"}],\"name\":\"client\",\"outputs\":[{\"name\":\"owner\",\"type\":\"address\"},{\"name\":\"required\",\"type\":\"bool\"}],\"payable\":false,\"type\":\"function\"},{\"constant\":false,\"inputs\":[{\"name\":\"_newOwner\",\"type\":\"address\"}],\"name\":\"setClientOwner\",\"outputs\":[],\"payable\":false,\"type\":\"function\"},{\"constant\":true,\"inputs\":[{\"name\":\"\",\"type\":\"uint32\"}],\"name\":\"fork\",\"outputs\":[{\"name\":\"name\",\"type\":\"bytes32\"},{\"name\":\"spec\",\"type\":\"bytes32\"},{\"name\":\"hard\",\"type\":\"bool\"},{\"name\":\"ratified\",\"type\":\"bool\"},{\"name\":\"requiredCount\",\"type\":\"uint256\"}],\"payable\":false,\"type\":\"function\"},{\"constant\":false,\"inputs\":[{\"name\":\"_release\",\"type\":\"bytes32\"},{\"name\":\"_platform\",\"type\":\"bytes32\"},{\"name\":\"_checksum\",\"type\":\"bytes32\"}],\"name\":\"addChecksum\",\"outputs\":[],\"payable\":false,\"type\":\"function\"},{\"constant\":false,\"inputs\":[{\"name\":\"_txid\",\"type\":\"bytes32\"}],\"name\":\"confirmTransaction\",\"outputs\":[{\"name\":\"txSuccess\",\"type\":\"uint256\"}],\"payable\":false,\"type\":\"function\"},{\"constant\":true,\"inputs\":[{\"name\":\"\",\"type\":\"bytes32\"}],\"name\":\"proxy\",\"outputs\":[{\"name\":\"requiredCount\",\"type\":\"uint256\"},{\"name\":\"to\",\"type\":\"address\"},{\"name\":\"data\",\"type\":\"bytes\"},{\"name\":\"value\",\"type\":\"uint256\"},{\"name\":\"gas\",\"type\":\"uint256\"}],\"payable\":false,\"type\":\"function\"},{\"constant\":false,\"inputs\":[{\"name\":\"_client\",\"type\":\"bytes32\"},{\"name\":\"_owner\",\"type\":\"address\"}],\"name\":\"addClient\",\"outputs\":[],\"payable\":false,\"type\":\"function\"},{\"constant\":true,\"inputs\":[{\"name\":\"\",\"type\":\"address\"}],\"name\":\"clientOwner\",\"outputs\":[{\"name\":\"\",\"type\":\"bytes32\"}],\"payable\":false,\"type\":\"function\"},{\"constant\":false,\"inputs\":[{\"name\":\"_txid\",\"type\":\"bytes32\"},{\"name\":\"_to\",\"type\":\"address\"},{\"name\":\"_data\",\"type\":\"bytes\"},{\"name\":\"_value\",\"type\":\"uint256\"},{\"name\":\"_gas\",\"type\":\"uint256\"}],\"name\":\"proposeTransaction\",\"outputs\":[{\"name\":\"txSuccess\",\"type\":\"uint256\"}],\"payable\":false,\"type\":\"function\"},{\"constant\":true,\"inputs\":[],\"name\":\"grandOwner\",\"outputs\":[{\"name\":\"\",\"type\":\"address\"}],\"payable\":false,\"type\":\"function\"},{\"constant\":false,\"inputs\":[{\"name\":\"_release\",\"type\":\"bytes32\"},{\"name\":\"_forkBlock\",\"type\":\"uint32\"},{\"name\":\"_track\",\"type\":\"uint8\"},{\"name\":\"_semver\",\"type\":\"uint24\"},{\"name\":\"_critical\",\"type\":\"bool\"}],\"name\":\"addRelease\",\"outputs\":[],\"payable\":false,\"type\":\"function\"},{\"constant\":false,\"inputs\":[],\"name\":\"acceptFork\",\"outputs\":[],\"payable\":false,\"type\":\"function\"},{\"constant\":true,\"inputs\":[],\"name\":\"clientsRequired\",\"outputs\":[{\"name\":\"\",\"type\":\"uint32\"}],\"payable\":false,\"type\":\"function\"},{\"constant\":true,\"inputs\":[{\"name\":\"_client\",\"type\":\"bytes32\"},{\"name\":\"_release\",\"type\":\"bytes32\"}],\"name\":\"track\",\"outputs\":[{\"name\":\"\",\"type\":\"uint8\"}],\"payable\":false,\"type\":\"function\"},{\"constant\":false,\"inputs\":[{\"name\":\"_client\",\"type\":\"bytes32\"},{\"name\":\"_r\",\"type\":\"bool\"}],\"name\":\"setClientRequired\",\"outputs\":[],\"payable\":false,\"type\":\"function\"},{\"constant\":true,\"inputs\":[],\"name\":\"latestFork\",\"outputs\":[{\"name\":\"\",\"type\":\"uint32\"}],\"payable\":false,\"type\":\"function\"},{\"constant\":true,\"inputs\":[{\"name\":\"_client\",\"type\":\"bytes32\"},{\"name\":\"_track\",\"type\":\"uint8\"}],\"name\":\"latestInTrack\",\"outputs\":[{\"name\":\"\",\"type\":\"bytes32\"}],\"payable\":false,\"type\":\"function\"},{\"constant\":true,\"inputs\":[{\"name\":\"_client\",\"type\":\"bytes32\"},{\"name\":\"_release\",\"type\":\"bytes32\"},{\"name\":\"_platform\",\"type\":\"bytes32\"}],\"name\":\"checksum\",\"outputs\":[{\"name\":\"\",\"type\":\"bytes32\"}],\"payable\":false,\"type\":\"function\"},{\"constant\":true,\"inputs\":[],\"name\":\"proposedFork\",\"outputs\":[{\"name\":\"\",\"type\":\"uint32\"}],\"payable\":false,\"type\":\"function\"}]" as &[u8]).expect("JSON is autogenerated; qed"), address: address, do_call: Box::new(do_call), } @@ -26,10 +26,10 @@ impl Operations { #[allow(dead_code)] pub fn reset_client_owner(&self, _client: &str, _new_owner: &util::Address) -> Result<(), String> { let call = self.contract.function("resetClientOwner".into()).map_err(Self::as_string)?; - let data = call.encode_call( + let data = call.encode_input(& vec![ethabi::Token::FixedBytes(_client.as_bytes().to_owned()), ethabi::Token::Address(_new_owner.clone().0)] ).map_err(Self::as_string)?; - call.decode_output((self.do_call)(self.address.clone(), data)?).map_err(Self::as_string)?; + call.decode_output(&(self.do_call)(self.address.clone(), data)?).map_err(Self::as_string)?; Ok(()) } @@ -38,10 +38,10 @@ impl Operations { #[allow(dead_code)] pub fn is_latest(&self, _client: &str, _release: &bigint::hash::H256) -> Result { let call = self.contract.function("isLatest".into()).map_err(Self::as_string)?; - let data = call.encode_call( + let data = call.encode_input(& vec![ethabi::Token::FixedBytes(_client.as_bytes().to_owned()), ethabi::Token::FixedBytes(_release.as_ref().to_owned())] ).map_err(Self::as_string)?; - let output = call.decode_output((self.do_call)(self.address.clone(), data)?).map_err(Self::as_string)?; + let output = call.decode_output(&(self.do_call)(self.address.clone(), data)?).map_err(Self::as_string)?; let mut result = output.into_iter().rev().collect::>(); Ok(({ let r = result.pop().ok_or("Invalid return arity")?; let r = r.to_bool().ok_or("Invalid type returned")?; r })) } @@ -50,10 +50,10 @@ impl Operations { #[allow(dead_code)] pub fn reject_transaction(&self, _txid: &bigint::hash::H256) -> Result<(), String> { let call = self.contract.function("rejectTransaction".into()).map_err(Self::as_string)?; - let data = call.encode_call( + let data = call.encode_input(& vec![ethabi::Token::FixedBytes(_txid.as_ref().to_owned())] ).map_err(Self::as_string)?; - call.decode_output((self.do_call)(self.address.clone(), data)?).map_err(Self::as_string)?; + call.decode_output(&(self.do_call)(self.address.clone(), data)?).map_err(Self::as_string)?; Ok(()) } @@ -62,10 +62,10 @@ impl Operations { #[allow(dead_code)] pub fn set_owner(&self, _new_owner: &util::Address) -> Result<(), String> { let call = self.contract.function("setOwner".into()).map_err(Self::as_string)?; - let data = call.encode_call( + let data = call.encode_input(& vec![ethabi::Token::Address(_new_owner.clone().0)] ).map_err(Self::as_string)?; - call.decode_output((self.do_call)(self.address.clone(), data)?).map_err(Self::as_string)?; + call.decode_output(&(self.do_call)(self.address.clone(), data)?).map_err(Self::as_string)?; Ok(()) } @@ -74,10 +74,10 @@ impl Operations { #[allow(dead_code)] pub fn propose_fork(&self, _number: u32, _name: &bigint::hash::H256, _hard: bool, _spec: &bigint::hash::H256) -> Result<(), String> { let call = self.contract.function("proposeFork".into()).map_err(Self::as_string)?; - let data = call.encode_call( + let data = call.encode_input(& vec![ethabi::Token::Uint({ let mut r = [0u8; 32]; bigint::prelude::U256::from(_number as u64).to_big_endian(&mut r); r }), ethabi::Token::FixedBytes(_name.as_ref().to_owned()), ethabi::Token::Bool(_hard), ethabi::Token::FixedBytes(_spec.as_ref().to_owned())] ).map_err(Self::as_string)?; - call.decode_output((self.do_call)(self.address.clone(), data)?).map_err(Self::as_string)?; + call.decode_output(&(self.do_call)(self.address.clone(), data)?).map_err(Self::as_string)?; Ok(()) } @@ -86,10 +86,10 @@ impl Operations { #[allow(dead_code)] pub fn remove_client(&self, _client: &str) -> Result<(), String> { let call = self.contract.function("removeClient".into()).map_err(Self::as_string)?; - let data = call.encode_call( + let data = call.encode_input(& vec![ethabi::Token::FixedBytes(_client.as_bytes().to_owned())] ).map_err(Self::as_string)?; - call.decode_output((self.do_call)(self.address.clone(), data)?).map_err(Self::as_string)?; + call.decode_output(&(self.do_call)(self.address.clone(), data)?).map_err(Self::as_string)?; Ok(()) } @@ -98,10 +98,10 @@ impl Operations { #[allow(dead_code)] pub fn release(&self, _client: &str, _release: &bigint::hash::H256) -> Result<(u32, u8, u32, bool), String> { let call = self.contract.function("release".into()).map_err(Self::as_string)?; - let data = call.encode_call( + let data = call.encode_input(& vec![ethabi::Token::FixedBytes(_client.as_bytes().to_owned()), ethabi::Token::FixedBytes(_release.as_ref().to_owned())] ).map_err(Self::as_string)?; - let output = call.decode_output((self.do_call)(self.address.clone(), data)?).map_err(Self::as_string)?; + let output = call.decode_output(&(self.do_call)(self.address.clone(), data)?).map_err(Self::as_string)?; let mut result = output.into_iter().rev().collect::>(); Ok(({ let r = result.pop().ok_or("Invalid return arity")?; let r = r.to_uint().ok_or("Invalid type returned")?; bigint::prelude::U256::from(r.as_ref()).as_u64() as u32 }, { let r = result.pop().ok_or("Invalid return arity")?; let r = r.to_uint().ok_or("Invalid type returned")?; bigint::prelude::U256::from(r.as_ref()).as_u64() as u8 }, { let r = result.pop().ok_or("Invalid return arity")?; let r = r.to_uint().ok_or("Invalid type returned")?; bigint::prelude::U256::from(r.as_ref()).as_u64() as u32 }, { let r = result.pop().ok_or("Invalid return arity")?; let r = r.to_bool().ok_or("Invalid type returned")?; r })) } @@ -110,10 +110,10 @@ impl Operations { #[allow(dead_code)] pub fn build(&self, _client: &str, _checksum: &bigint::hash::H256) -> Result<(bigint::hash::H256, bigint::hash::H256), String> { let call = self.contract.function("build".into()).map_err(Self::as_string)?; - let data = call.encode_call( + let data = call.encode_input(& vec![ethabi::Token::FixedBytes(_client.as_bytes().to_owned()), ethabi::Token::FixedBytes(_checksum.as_ref().to_owned())] ).map_err(Self::as_string)?; - let output = call.decode_output((self.do_call)(self.address.clone(), data)?).map_err(Self::as_string)?; + let output = call.decode_output(&(self.do_call)(self.address.clone(), data)?).map_err(Self::as_string)?; let mut result = output.into_iter().rev().collect::>(); Ok(({ let r = result.pop().ok_or("Invalid return arity")?; let r = r.to_fixed_bytes().ok_or("Invalid type returned")?; bigint::hash::H256::from_slice(r.as_ref()) }, { let r = result.pop().ok_or("Invalid return arity")?; let r = r.to_fixed_bytes().ok_or("Invalid type returned")?; bigint::hash::H256::from_slice(r.as_ref()) })) } @@ -122,10 +122,10 @@ impl Operations { #[allow(dead_code)] pub fn reject_fork(&self) -> Result<(), String> { let call = self.contract.function("rejectFork".into()).map_err(Self::as_string)?; - let data = call.encode_call( + let data = call.encode_input(& vec![] ).map_err(Self::as_string)?; - call.decode_output((self.do_call)(self.address.clone(), data)?).map_err(Self::as_string)?; + call.decode_output(&(self.do_call)(self.address.clone(), data)?).map_err(Self::as_string)?; Ok(()) } @@ -134,10 +134,10 @@ impl Operations { #[allow(dead_code)] pub fn client(&self, _1: &bigint::hash::H256) -> Result<(util::Address, bool), String> { let call = self.contract.function("client".into()).map_err(Self::as_string)?; - let data = call.encode_call( + let data = call.encode_input(& vec![ethabi::Token::FixedBytes(_1.as_ref().to_owned())] ).map_err(Self::as_string)?; - let output = call.decode_output((self.do_call)(self.address.clone(), data)?).map_err(Self::as_string)?; + let output = call.decode_output(&(self.do_call)(self.address.clone(), data)?).map_err(Self::as_string)?; let mut result = output.into_iter().rev().collect::>(); Ok(({ let r = result.pop().ok_or("Invalid return arity")?; let r = r.to_address().ok_or("Invalid type returned")?; util::Address::from(r) }, { let r = result.pop().ok_or("Invalid return arity")?; let r = r.to_bool().ok_or("Invalid type returned")?; r })) } @@ -146,10 +146,10 @@ impl Operations { #[allow(dead_code)] pub fn set_client_owner(&self, _new_owner: &util::Address) -> Result<(), String> { let call = self.contract.function("setClientOwner".into()).map_err(Self::as_string)?; - let data = call.encode_call( + let data = call.encode_input(& vec![ethabi::Token::Address(_new_owner.clone().0)] ).map_err(Self::as_string)?; - call.decode_output((self.do_call)(self.address.clone(), data)?).map_err(Self::as_string)?; + call.decode_output(&(self.do_call)(self.address.clone(), data)?).map_err(Self::as_string)?; Ok(()) } @@ -158,10 +158,10 @@ impl Operations { #[allow(dead_code)] pub fn fork(&self, _1: u32) -> Result<(bigint::hash::H256, bigint::hash::H256, bool, bool, bigint::prelude::U256), String> { let call = self.contract.function("fork".into()).map_err(Self::as_string)?; - let data = call.encode_call( + let data = call.encode_input(& vec![ethabi::Token::Uint({ let mut r = [0u8; 32]; bigint::prelude::U256::from(_1 as u64).to_big_endian(&mut r); r })] ).map_err(Self::as_string)?; - let output = call.decode_output((self.do_call)(self.address.clone(), data)?).map_err(Self::as_string)?; + let output = call.decode_output(&(self.do_call)(self.address.clone(), data)?).map_err(Self::as_string)?; let mut result = output.into_iter().rev().collect::>(); Ok(({ let r = result.pop().ok_or("Invalid return arity")?; let r = r.to_fixed_bytes().ok_or("Invalid type returned")?; bigint::hash::H256::from_slice(r.as_ref()) }, { let r = result.pop().ok_or("Invalid return arity")?; let r = r.to_fixed_bytes().ok_or("Invalid type returned")?; bigint::hash::H256::from_slice(r.as_ref()) }, { let r = result.pop().ok_or("Invalid return arity")?; let r = r.to_bool().ok_or("Invalid type returned")?; r }, { let r = result.pop().ok_or("Invalid return arity")?; let r = r.to_bool().ok_or("Invalid type returned")?; r }, { let r = result.pop().ok_or("Invalid return arity")?; let r = r.to_uint().ok_or("Invalid type returned")?; bigint::prelude::U256::from(r.as_ref()) })) } @@ -170,10 +170,10 @@ impl Operations { #[allow(dead_code)] pub fn add_checksum(&self, _release: &bigint::hash::H256, _platform: &str, _checksum: &bigint::hash::H256) -> Result<(), String> { let call = self.contract.function("addChecksum".into()).map_err(Self::as_string)?; - let data = call.encode_call( + let data = call.encode_input(& vec![ethabi::Token::FixedBytes(_release.as_ref().to_owned()), ethabi::Token::FixedBytes(_platform.as_bytes().to_owned()), ethabi::Token::FixedBytes(_checksum.as_ref().to_owned())] ).map_err(Self::as_string)?; - call.decode_output((self.do_call)(self.address.clone(), data)?).map_err(Self::as_string)?; + call.decode_output(&(self.do_call)(self.address.clone(), data)?).map_err(Self::as_string)?; Ok(()) } @@ -182,10 +182,10 @@ impl Operations { #[allow(dead_code)] pub fn confirm_transaction(&self, _txid: &bigint::hash::H256) -> Result { let call = self.contract.function("confirmTransaction".into()).map_err(Self::as_string)?; - let data = call.encode_call( + let data = call.encode_input(& vec![ethabi::Token::FixedBytes(_txid.as_ref().to_owned())] ).map_err(Self::as_string)?; - let output = call.decode_output((self.do_call)(self.address.clone(), data)?).map_err(Self::as_string)?; + let output = call.decode_output(&(self.do_call)(self.address.clone(), data)?).map_err(Self::as_string)?; let mut result = output.into_iter().rev().collect::>(); Ok(({ let r = result.pop().ok_or("Invalid return arity")?; let r = r.to_uint().ok_or("Invalid type returned")?; bigint::prelude::U256::from(r.as_ref()) })) } @@ -194,10 +194,10 @@ impl Operations { #[allow(dead_code)] pub fn proxy(&self, _1: &bigint::hash::H256) -> Result<(bigint::prelude::U256, util::Address, Vec, bigint::prelude::U256, bigint::prelude::U256), String> { let call = self.contract.function("proxy".into()).map_err(Self::as_string)?; - let data = call.encode_call( + let data = call.encode_input(& vec![ethabi::Token::FixedBytes(_1.as_ref().to_owned())] ).map_err(Self::as_string)?; - let output = call.decode_output((self.do_call)(self.address.clone(), data)?).map_err(Self::as_string)?; + let output = call.decode_output(&(self.do_call)(self.address.clone(), data)?).map_err(Self::as_string)?; let mut result = output.into_iter().rev().collect::>(); Ok(({ let r = result.pop().ok_or("Invalid return arity")?; let r = r.to_uint().ok_or("Invalid type returned")?; bigint::prelude::U256::from(r.as_ref()) }, { let r = result.pop().ok_or("Invalid return arity")?; let r = r.to_address().ok_or("Invalid type returned")?; util::Address::from(r) }, { let r = result.pop().ok_or("Invalid return arity")?; let r = r.to_bytes().ok_or("Invalid type returned")?; r }, { let r = result.pop().ok_or("Invalid return arity")?; let r = r.to_uint().ok_or("Invalid type returned")?; bigint::prelude::U256::from(r.as_ref()) }, { let r = result.pop().ok_or("Invalid return arity")?; let r = r.to_uint().ok_or("Invalid type returned")?; bigint::prelude::U256::from(r.as_ref()) })) } @@ -206,10 +206,10 @@ impl Operations { #[allow(dead_code)] pub fn add_client(&self, _client: &str, _owner: &util::Address) -> Result<(), String> { let call = self.contract.function("addClient".into()).map_err(Self::as_string)?; - let data = call.encode_call( + let data = call.encode_input(& vec![ethabi::Token::FixedBytes(_client.as_bytes().to_owned()), ethabi::Token::Address(_owner.clone().0)] ).map_err(Self::as_string)?; - call.decode_output((self.do_call)(self.address.clone(), data)?).map_err(Self::as_string)?; + call.decode_output(&(self.do_call)(self.address.clone(), data)?).map_err(Self::as_string)?; Ok(()) } @@ -218,10 +218,10 @@ impl Operations { #[allow(dead_code)] pub fn client_owner(&self, _1: &util::Address) -> Result { let call = self.contract.function("clientOwner".into()).map_err(Self::as_string)?; - let data = call.encode_call( + let data = call.encode_input(& vec![ethabi::Token::Address(_1.clone().0)] ).map_err(Self::as_string)?; - let output = call.decode_output((self.do_call)(self.address.clone(), data)?).map_err(Self::as_string)?; + let output = call.decode_output(&(self.do_call)(self.address.clone(), data)?).map_err(Self::as_string)?; let mut result = output.into_iter().rev().collect::>(); Ok(({ let r = result.pop().ok_or("Invalid return arity")?; let r = r.to_fixed_bytes().ok_or("Invalid type returned")?; bigint::hash::H256::from_slice(r.as_ref()) })) } @@ -230,10 +230,10 @@ impl Operations { #[allow(dead_code)] pub fn propose_transaction(&self, _txid: &bigint::hash::H256, _to: &util::Address, _data: &[u8], _value: bigint::prelude::U256, _gas: bigint::prelude::U256) -> Result { let call = self.contract.function("proposeTransaction".into()).map_err(Self::as_string)?; - let data = call.encode_call( + let data = call.encode_input(& vec![ethabi::Token::FixedBytes(_txid.as_ref().to_owned()), ethabi::Token::Address(_to.clone().0), ethabi::Token::Bytes(_data.to_owned()), ethabi::Token::Uint({ let mut r = [0u8; 32]; _value.to_big_endian(&mut r); r }), ethabi::Token::Uint({ let mut r = [0u8; 32]; _gas.to_big_endian(&mut r); r })] ).map_err(Self::as_string)?; - let output = call.decode_output((self.do_call)(self.address.clone(), data)?).map_err(Self::as_string)?; + let output = call.decode_output(&(self.do_call)(self.address.clone(), data)?).map_err(Self::as_string)?; let mut result = output.into_iter().rev().collect::>(); Ok(({ let r = result.pop().ok_or("Invalid return arity")?; let r = r.to_uint().ok_or("Invalid type returned")?; bigint::prelude::U256::from(r.as_ref()) })) } @@ -242,10 +242,10 @@ impl Operations { #[allow(dead_code)] pub fn grand_owner(&self) -> Result { let call = self.contract.function("grandOwner".into()).map_err(Self::as_string)?; - let data = call.encode_call( + let data = call.encode_input(& vec![] ).map_err(Self::as_string)?; - let output = call.decode_output((self.do_call)(self.address.clone(), data)?).map_err(Self::as_string)?; + let output = call.decode_output(&&(self.do_call)(self.address.clone(), data)?).map_err(Self::as_string)?; let mut result = output.into_iter().rev().collect::>(); Ok(({ let r = result.pop().ok_or("Invalid return arity")?; let r = r.to_address().ok_or("Invalid type returned")?; util::Address::from(r) })) } @@ -254,10 +254,10 @@ impl Operations { #[allow(dead_code)] pub fn add_release(&self, _release: &bigint::hash::H256, _fork_block: u32, _track: u8, _semver: u32, _critical: bool) -> Result<(), String> { let call = self.contract.function("addRelease".into()).map_err(Self::as_string)?; - let data = call.encode_call( + let data = call.encode_input(& vec![ethabi::Token::FixedBytes(_release.as_ref().to_owned()), ethabi::Token::Uint({ let mut r = [0u8; 32]; bigint::prelude::U256::from(_fork_block as u64).to_big_endian(&mut r); r }), ethabi::Token::Uint({ let mut r = [0u8; 32]; bigint::prelude::U256::from(_track as u64).to_big_endian(&mut r); r }), ethabi::Token::Uint({ let mut r = [0u8; 32]; bigint::prelude::U256::from(_semver as u64).to_big_endian(&mut r); r }), ethabi::Token::Bool(_critical)] ).map_err(Self::as_string)?; - call.decode_output((self.do_call)(self.address.clone(), data)?).map_err(Self::as_string)?; + call.decode_output(&(self.do_call)(self.address.clone(), data)?).map_err(Self::as_string)?; Ok(()) } @@ -266,10 +266,10 @@ impl Operations { #[allow(dead_code)] pub fn accept_fork(&self) -> Result<(), String> { let call = self.contract.function("acceptFork".into()).map_err(Self::as_string)?; - let data = call.encode_call( + let data = call.encode_input(& vec![] ).map_err(Self::as_string)?; - call.decode_output((self.do_call)(self.address.clone(), data)?).map_err(Self::as_string)?; + call.decode_output(&(self.do_call)(self.address.clone(), data)?).map_err(Self::as_string)?; Ok(()) } @@ -278,10 +278,10 @@ impl Operations { #[allow(dead_code)] pub fn clients_required(&self) -> Result { let call = self.contract.function("clientsRequired".into()).map_err(Self::as_string)?; - let data = call.encode_call( + let data = call.encode_input(& vec![] ).map_err(Self::as_string)?; - let output = call.decode_output((self.do_call)(self.address.clone(), data)?).map_err(Self::as_string)?; + let output = call.decode_output(&(self.do_call)(self.address.clone(), data)?).map_err(Self::as_string)?; let mut result = output.into_iter().rev().collect::>(); Ok(({ let r = result.pop().ok_or("Invalid return arity")?; let r = r.to_uint().ok_or("Invalid type returned")?; bigint::prelude::U256::from(r.as_ref()).as_u64() as u32 })) } @@ -290,10 +290,10 @@ impl Operations { #[allow(dead_code)] pub fn track(&self, _client: &str, _release: &bigint::hash::H256) -> Result { let call = self.contract.function("track".into()).map_err(Self::as_string)?; - let data = call.encode_call( + let data = call.encode_input(& vec![ethabi::Token::FixedBytes(_client.as_bytes().to_owned()), ethabi::Token::FixedBytes(_release.as_ref().to_owned())] ).map_err(Self::as_string)?; - let output = call.decode_output((self.do_call)(self.address.clone(), data)?).map_err(Self::as_string)?; + let output = call.decode_output(&(self.do_call)(self.address.clone(), data)?).map_err(Self::as_string)?; let mut result = output.into_iter().rev().collect::>(); Ok(({ let r = result.pop().ok_or("Invalid return arity")?; let r = r.to_uint().ok_or("Invalid type returned")?; bigint::prelude::U256::from(r.as_ref()).as_u64() as u8 })) } @@ -302,10 +302,10 @@ impl Operations { #[allow(dead_code)] pub fn set_client_required(&self, _client: &str, _r: bool) -> Result<(), String> { let call = self.contract.function("setClientRequired".into()).map_err(Self::as_string)?; - let data = call.encode_call( + let data = call.encode_input(& vec![ethabi::Token::FixedBytes(_client.as_bytes().to_owned()), ethabi::Token::Bool(_r)] ).map_err(Self::as_string)?; - call.decode_output((self.do_call)(self.address.clone(), data)?).map_err(Self::as_string)?; + call.decode_output(&(self.do_call)(self.address.clone(), data)?).map_err(Self::as_string)?; Ok(()) } @@ -314,10 +314,8 @@ impl Operations { #[allow(dead_code)] pub fn latest_fork(&self) -> Result { let call = self.contract.function("latestFork".into()).map_err(Self::as_string)?; - let data = call.encode_call( - vec![] - ).map_err(Self::as_string)?; - let output = call.decode_output((self.do_call)(self.address.clone(), data)?).map_err(Self::as_string)?; + let data = call.encode_input(&[]).map_err(Self::as_string)?; + let output = call.decode_output(&(self.do_call)(self.address.clone(), data)?).map_err(Self::as_string)?; let mut result = output.into_iter().rev().collect::>(); Ok(({ let r = result.pop().ok_or("Invalid return arity")?; let r = r.to_uint().ok_or("Invalid type returned")?; bigint::prelude::U256::from(r.as_ref()).as_u64() as u32 })) } @@ -326,10 +324,10 @@ impl Operations { #[allow(dead_code)] pub fn latest_in_track(&self, _client: &str, _track: u8) -> Result { let call = self.contract.function("latestInTrack".into()).map_err(Self::as_string)?; - let data = call.encode_call( - vec![ethabi::Token::FixedBytes(_client.as_bytes().to_owned()), ethabi::Token::Uint({ let mut r = [0u8; 32]; bigint::prelude::U256::from(_track as u64).to_big_endian(&mut r); r })] + let data = call.encode_input(& + &vec![ethabi::Token::FixedBytes(_client.as_bytes().to_owned()), ethabi::Token::Uint({ let mut r = [0u8; 32]; bigint::prelude::U256::from(_track as u64).to_big_endian(&mut r); r })] ).map_err(Self::as_string)?; - let output = call.decode_output((self.do_call)(self.address.clone(), data)?).map_err(Self::as_string)?; + let output = call.decode_output(&(self.do_call)(self.address.clone(), data)?).map_err(Self::as_string)?; let mut result = output.into_iter().rev().collect::>(); Ok(({ let r = result.pop().ok_or("Invalid return arity")?; let r = r.to_fixed_bytes().ok_or("Invalid type returned")?; bigint::hash::H256::from_slice(r.as_ref()) })) } @@ -338,10 +336,10 @@ impl Operations { #[allow(dead_code)] pub fn checksum(&self, _client: &str, _release: &bigint::hash::H256, _platform: &str) -> Result { let call = self.contract.function("checksum".into()).map_err(Self::as_string)?; - let data = call.encode_call( + let data = call.encode_input(& vec![ethabi::Token::FixedBytes(_client.as_bytes().to_owned()), ethabi::Token::FixedBytes(_release.as_ref().to_owned()), ethabi::Token::FixedBytes(_platform.as_bytes().to_owned())] ).map_err(Self::as_string)?; - let output = call.decode_output((self.do_call)(self.address.clone(), data)?).map_err(Self::as_string)?; + let output = call.decode_output(&(self.do_call)(self.address.clone(), data)?).map_err(Self::as_string)?; let mut result = output.into_iter().rev().collect::>(); Ok(({ let r = result.pop().ok_or("Invalid return arity")?; let r = r.to_fixed_bytes().ok_or("Invalid type returned")?; bigint::hash::H256::from_slice(r.as_ref()) })) } @@ -350,10 +348,8 @@ impl Operations { #[allow(dead_code)] pub fn proposed_fork(&self) -> Result { let call = self.contract.function("proposedFork".into()).map_err(Self::as_string)?; - let data = call.encode_call( - vec![] - ).map_err(Self::as_string)?; - let output = call.decode_output((self.do_call)(self.address.clone(), data)?).map_err(Self::as_string)?; + let data = call.encode_input(&[]).map_err(Self::as_string)?; + let output = call.decode_output(&(self.do_call)(self.address.clone(), data)?).map_err(Self::as_string)?; let mut result = output.into_iter().rev().collect::>(); Ok(({ let r = result.pop().ok_or("Invalid return arity")?; let r = r.to_uint().ok_or("Invalid type returned")?; bigint::prelude::U256::from(r.as_ref()).as_u64() as u32 })) }