Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Print bytes32 values as hex #1117

Draft
wants to merge 3 commits into
base: master
Choose a base branch
from
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions lib/Echidna/ABI.hs
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import Data.List (intercalate)
import Data.List.NonEmpty (NonEmpty)
import Data.List.NonEmpty qualified as NE
import Data.Maybe (fromMaybe, catMaybes)
import Text.Printf (printf)
import Data.Text (Text)
import Data.Text qualified as T
import Data.Text.Encoding (encodeUtf8)
Expand Down Expand Up @@ -71,6 +72,7 @@ ppAbiValue = \case
AbiInt _ n -> show n
AbiAddress n -> "0x" <> showHex n ""
AbiBool b -> if b then "true" else "false"
AbiBytes 32 b -> "0x" <> BS.foldr ((<>) . printf "%02x") "" b
AbiBytes _ b -> show b
AbiBytesDynamic b -> show b
AbiString s -> show s
Expand Down
Loading