fix(human-readable-abi): allow functions without output args (#477)

This commit is contained in:
Georgios Konstantopoulos 2021-09-29 17:28:30 +03:00 committed by GitHub
parent 5693b7019e
commit a9157e1543
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 5 additions and 4 deletions

View File

@ -251,10 +251,9 @@ impl AbiParser {
.ok_or_else(|| format_err!("Expected input args parentheses at `{}`", s))?;
let (input_args_modifiers, output_args) = match input.rsplit_once('(') {
Some((first, second)) => Ok((first, Some(second))),
None if shorthand => Err(format_err!("Expected output args parentheses at `{}`", s)),
None => Ok((input, None)),
}?;
Some((first, second)) => (first, Some(second)),
None => (input, None),
};
let mut input_args_modifiers_iter = input_args_modifiers
.trim_end()
@ -645,6 +644,8 @@ mod tests {
"foo(address[] memory, bytes memory)(bytes memory)",
"bar(uint256[] memory x)()",
"bar()()",
"bar(uint256)",
"bar()",
]
.iter()
.for_each(|x| {