ethabi_next/
lib.rs

1// Copyright 2015-2020 Parity Technologies
2//
3// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
4// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
5// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
6// option. This file may not be copied, modified, or distributed
7// except according to those terms.
8
9//! Ethereum ABI encoding decoding library.
10
11#![allow(clippy::module_inception)]
12#![warn(missing_docs)]
13
14mod constructor;
15mod contract;
16mod decoder;
17mod encoder;
18mod errors;
19mod event;
20mod event_param;
21mod filter;
22mod function;
23mod log;
24mod operation;
25mod param;
26pub mod param_type;
27mod signature;
28mod state_mutability;
29pub mod token;
30mod tuple_param;
31mod util;
32
33#[cfg(test)]
34mod tests;
35
36pub use crate::{
37	constructor::Constructor,
38	contract::{Contract, Events, Functions},
39	decoder::decode,
40	encoder::encode,
41	errors::{Error, Result},
42	event::Event,
43	event_param::EventParam,
44	filter::{RawTopicFilter, Topic, TopicFilter},
45	function::Function,
46	log::{Log, LogFilter, LogParam, ParseLog, RawLog},
47	param::Param,
48	param_type::ParamType,
49	state_mutability::StateMutability,
50	token::Token,
51	tuple_param::TupleParam,
52};
53
54/// ABI word.
55pub type Word = [u8; 32];
56
57/// ABI address.
58pub type Address = ethereum_types::Address;
59
60/// ABI fixed bytes.
61pub type FixedBytes = Vec<u8>;
62
63/// ABI bytes.
64pub type Bytes = Vec<u8>;
65
66/// ABI signed integer.
67pub type Int = ethereum_types::U256;
68
69/// ABI unsigned integer.
70pub type Uint = ethereum_types::U256;
71
72/// Commonly used FixedBytes of size 32
73pub type Hash = ethereum_types::H256;
74
75/// Contract functions generated by ethabi-derive
76pub trait FunctionOutputDecoder {
77	/// Output types of the contract function
78	type Output;
79
80	/// Decodes the given bytes output for the contract function
81	fn decode(&self, _: &[u8]) -> Result<Self::Output>;
82}