Skip to content
This repository was archived by the owner on Jan 25, 2019. It is now read-only.
Open
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
16 changes: 16 additions & 0 deletions libexec/seth/seth-verify
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#!/usr/bin/env bash
### seth-verify -- verify a tx target and calldata
### Usage: seth verify <tx> <target> <calldata>
###
### Verify that <tx> hash in the blockchain corresponds to a transaction
### sent to address <target> with <calldata>
### Returns true or false (and fails)
set -e
[[ $# -ge 3 ]] || seth --fail-usage "$0"
tx=$(seth tx "$1")
input=$(seth --field input <<<"$tx")
to=$(seth --field to <<<"$tx")
calldata=$(seth calldata "${@:3}")
[[ $2 == $to ]] && [[ $calldata == $input ]] && exec echo true
echo false
exit 1