susyabi/
lib.rs

1//! Sophon ABI encoding decoding library.
2
3#![warn(missing_docs)]
4
5extern crate rustc_hex as hex;
6extern crate serde;
7extern crate serde_json;
8extern crate tiny_keccak;
9
10#[macro_use]
11extern crate serde_derive;
12
13#[macro_use]
14extern crate error_chain;
15
16#[cfg(test)]
17#[macro_use]
18extern crate hex_literal;
19
20extern crate s_types;
21
22pub mod param_type;
23pub mod token;
24mod constructor;
25mod contract;
26mod decoder;
27mod encoder;
28mod errors;
29mod event;
30mod event_param;
31mod filter;
32mod function;
33mod log;
34mod operation;
35mod param;
36mod signature;
37mod util;
38
39pub use param_type::ParamType;
40pub use constructor::Constructor;
41pub use contract::{Contract, Functions, Events};
42pub use token::Token;
43pub use errors::{Error, ErrorKind, Result, ResultExt};
44pub use encoder::encode;
45pub use decoder::decode;
46pub use filter::{Topic, TopicFilter, RawTopicFilter};
47pub use function::Function;
48pub use param::Param;
49pub use log::{Log, RawLog, LogParam, ParseLog, LogFilter};
50pub use event::Event;
51pub use event_param::EventParam;
52
53/// ABI address.
54pub type Address = s_types::Address;
55
56/// ABI fixed bytes.
57pub type FixedBytes = Vec<u8>;
58
59/// ABI bytes.
60pub type Bytes = Vec<u8>;
61
62/// ABI signed integer.
63pub type Int = s_types::U256;
64
65/// ABI unsigned integer.
66pub type Uint = s_types::U256;
67
68/// Commonly used FixedBytes of size 32
69pub type Hash = s_types::H256;
70
71/// Contract functions generated by susyabi-derive
72pub trait FunctionOutputDecoder {
73	/// Output types of the contract function
74	type Output;
75
76	/// Decodes the given bytes output for the contract function
77	fn decode(&self, &[u8]) -> Result<Self::Output>;
78}