Skip to content

Commit

Permalink
Merge pull request openethereum#18 from paritytech/clone
Browse files Browse the repository at this point in the history
Make Contract Cloneable and Debugable
  • Loading branch information
debris authored Mar 23, 2017
2 parents 89c8dc9 + 1ec2bd8 commit 706dd40
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 5 deletions.
2 changes: 1 addition & 1 deletion ethabi/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "ethabi"
version = "1.0.0"
version = "1.0.1"
authors = ["debris <marek.kotewicz@gmail.com>"]
homepage = "https://github.com/ethcore/ethabi"
license = "MIT"
Expand Down
1 change: 1 addition & 0 deletions ethabi/src/contract.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ use event::Event;
use error::Error;

/// API building calls to contracts ABI.
#[derive(Clone, Debug)]
pub struct Contract {
interface: Interface,
}
Expand Down
6 changes: 3 additions & 3 deletions ethabi/src/spec/interface.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ use serde_json;
use super::{Operation, Constructor, Function, Event, Error};

/// Contract interface.
#[derive(Debug, PartialEq, Deserialize)]
#[derive(Clone, Debug, PartialEq, Deserialize)]
pub struct Interface(Vec<Operation>);

impl Interface {
Expand All @@ -22,7 +22,7 @@ impl Interface {
}

/// Returns specification of contract function.
pub fn function(&self, name: String) -> Option<Function> {
pub fn function(&self, name: String) -> Option<Function> {
self.0.iter()
.filter_map(Operation::function)
.find(|f| f.name == name)
Expand Down Expand Up @@ -68,7 +68,7 @@ mod tests {
"name":"foo",
"outputs": []
}]"#;

let deserialized: Interface = serde_json::from_str(s).unwrap();

assert_eq!(deserialized, Interface(vec![
Expand Down
2 changes: 1 addition & 1 deletion ethabi/src/spec/operation.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ use serde_json::value::from_value;
use super::{Function, Event, Constructor};

/// Operation type.
#[derive(Debug, PartialEq)]
#[derive(Clone, Debug, PartialEq)]
pub enum Operation {
/// Contract constructor.
Constructor(Constructor),
Expand Down

0 comments on commit 706dd40

Please sign in to comment.