Open
Conversation
`hevm abiencode` now accepts solidity interface definitions:
hevm abiencode --abi "f(bool b, uint x, Data(bytes[], string))"
New commands `hevm normalise` and `hevm selector` to give the canonical
signature and signature hash for a given --abi.
New command `hevm abidecode`, allowing for decoding of e.g. function calldata or returndata, given an ABI.
New command `hevm abi` to generate ABI json from a Solidity fragment.
Works with functions, events and errors.
Examples:
seth abi "f(bool)"
seth abi "function hello()"
seth abi "event SomeEvent(bool x, string indexed s)"
seth abi "error SomeError(string)"
Member
Author
|
CI failing because I broke The current Here we should probably have instead: |
MrChico
reviewed
Dec 2, 2021
| in | ||
| if (abiSelector == dataSelector) then | ||
| pack $ show values | ||
| pack $ intercalate "\n" (show <$> V.toList values) |
Member
There was a problem hiding this comment.
Suggested change
| pack $ intercalate "\n" (show <$> V.toList values) | |
| pack $ unlines (show <$> V.toList values) |
and sim
MrChico
reviewed
Dec 7, 2021
| Right (Nothing, Just event, _) -> render (JSON.toJSON event) | ||
| Right (Nothing, Nothing, Just err) -> render (JSON.toJSON err) | ||
| where | ||
| render = decodeUtf8 . Lazy.toStrict . encoder |
Member
There was a problem hiding this comment.
Suggested change
| render = decodeUtf8 . Lazy.toStrict . encoder | |
| render :: ToJSON a => a -> Text | |
| render = decodeUtf8 . Lazy.toStrict . encoder |
ish
MrChico
reviewed
Dec 7, 2021
MrChico
reviewed
Dec 7, 2021
MrChico
reviewed
Dec 7, 2021
| makeArray t "" = AbiArrayDynamicType t | ||
| makeArray t s = AbiArrayType (read s) t | ||
|
|
||
| parseBasicType :: ReadP AbiType |
Member
There was a problem hiding this comment.
this would be nice to have in ABI.hs next to the show instance for AbiType. We can also easily quickcheck the roundtrip
Member
|
lgtm |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Nearly complete. Fixes #861.
(...)ortuple(...)orWhatever(...)--abiargument for hevm now accepts solidity fragments as well as jsonhevm abi-> output json for a given solidity fragment (functions, events and errors)hevm normalise-> canonical signature for a given abihevm selector-> signature hash for a given abi (cc @mds1)hevm abidecode-> decode calldata and/or returndata given an abiNote:
hevm abidecode, and therefore the results ofseth call, will be quoted with"...". Previously string results were unquotedhevm abidecodeare now wrapped in[...]. Previously the output was just comma separated elements.uint[][] [[1, 2], [3, 4]]was output as1, 2, 3, 4. This is now fixed.seth abi-encodewas renamed toseth --abi-encodefor consistency with--abi-decodeand now outputs the full calldata including signature.Todo:
seth --decode-eventsto use hevm