dapptools
                                
                                 dapptools copied to clipboard
                                
                                    dapptools copied to clipboard
                            
                            
                            
                        Hevm abi encode
Nearly complete. Fixes #861.
- tuple types are now supported in arguments, as (...)ortuple(...)orWhatever(...)
- the --abiargument for hevm now accepts solidity fragments as well as json
- hevm abi-> output json for a given solidity fragment (functions, events and errors)
- hevm normalise-> canonical signature for a given abi
- hevm selector-> signature hash for a given abi (cc @mds1)
- hevm abidecode-> decode calldata and/or returndata given an abi
Note:
- Strings output from hevm abidecode, and therefore the results ofseth call, will be quoted with"...". Previously string results were unquoted
- Similarly, Arrays output from hevm abidecodeare now wrapped in[...]. Previously the output was just comma separated elements.
- Multi-dimensional array output was broken before, e.g. uint[][] [[1, 2], [3, 4]]was output as1, 2, 3, 4. This is now fixed.
- The new seth abi-encodewas renamed toseth --abi-encodefor consistency with--abi-decodeand now outputs the full calldata including signature.
Todo:
- [ ] consider event encode / decode (kind of annoying because of indexed args), which would allow seth --decode-eventsto use hevm
- [ ] maybe SolidityAbi.hs should be part of an existing file (created to speed up compile times)
- [ ] changelog
- [ ] there was an existing simple parser for AbiTypes in Solidity.hs, which uses MegaParsec. I didn't touch this to avoid breaking something. The parser here uses ReadP, but there is duplicated functionality. Potentially the two could be combined.
CI failing because I broke seth --abi-decode by parenthesising the output on a single line.
The current --abi-decode is broken though:
$ seth --abi-decode "f()(bool[][],uint)" 0x000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000a0000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000000
true,true,true,false
1
Here we should probably have instead:
[[true, true], [true, false]]
1
lgtm