Skip to content
This repository has been archived by the owner on Oct 19, 2024. It is now read-only.

Commit

Permalink
feat: add struct parsing support for human readable ABI (#226)
Browse files Browse the repository at this point in the history
* refactor: extract error module and use error macros

* feat: add solidity struct parser

* refactor: add AbiParse and support struct parsing

* test: add more struct parsing tests
  • Loading branch information
mattsse authored Mar 15, 2021
1 parent e9e26f5 commit cf8e239
Show file tree
Hide file tree
Showing 4 changed files with 1,030 additions and 280 deletions.
25 changes: 25 additions & 0 deletions ethers-core/src/abi/error.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
//! Boilerplate error definitions.
use thiserror::Error;

/// A type alias for std's Result with the Error as our error type.
pub type Result<T, E = ParseError> = std::result::Result<T, E>;

#[derive(Error, Debug)]
pub enum ParseError {
#[error("{0}")]
Message(String),
#[error(transparent)]
ParseError(#[from] super::Error),
}

macro_rules! _format_err {
($($tt:tt)*) => {
$crate::abi::ParseError::Message(format!($($tt)*))
};
}
pub(crate) use _format_err as format_err;

macro_rules! _bail {
($($tt:tt)*) => { return Err($crate::abi::error::format_err!($($tt)*)) };
}
pub(crate) use _bail as bail;
Loading

0 comments on commit cf8e239

Please sign in to comment.