From ac931398633ffb33d21f43ad47d746cdb7b878fe Mon Sep 17 00:00:00 2001 From: Ian Norden Date: Fri, 8 Mar 2019 12:35:50 -0600 Subject: [PATCH] update parseTopicsIntoMap to handle strings --- README.md | 3 ++- .../ethereum/go-ethereum/accounts/abi/bind/topics.go | 10 ++++++++++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 6685af83..0e66e5ac 100644 --- a/README.md +++ b/README.md @@ -41,7 +41,8 @@ In order to install packages with `dep`, ensure you are in the project directory After `dep` finishes, dependencies should be installed within your `GOPATH` at the versions specified in `Gopkg.toml`. -Because we are working with a modified version of the go-ethereum accounts/abi package, after running `dep ensure` you will need to run `git checkout vendor/github/ethereum/go-ethereum/accounts/abi` to checkout the modified dependency +Because we are working with a modified version of the go-ethereum accounts/abi package, after running `dep ensure` you will need to run `git checkout vendor/github/ethereum/go-ethereum/accounts/abi` to checkout the modified dependency. +This is explained in greater detail [here](https://github.com/vulcanize/maker-vulcanizedb/issues/41). Lastly, ensure that `GOPATH` is defined in your shell. If necessary, `GOPATH` can be set in `~/.bashrc` or `~/.bash_profile`, depending upon your system. It can be additionally helpful to add `$GOPATH/bin` to your shell's `$PATH`. diff --git a/vendor/github.com/ethereum/go-ethereum/accounts/abi/bind/topics.go b/vendor/github.com/ethereum/go-ethereum/accounts/abi/bind/topics.go index cd84fb16..1569fae5 100644 --- a/vendor/github.com/ethereum/go-ethereum/accounts/abi/bind/topics.go +++ b/vendor/github.com/ethereum/go-ethereum/accounts/abi/bind/topics.go @@ -218,6 +218,16 @@ func parseTopicsIntoMap(out map[string]interface{}, fields abi.Arguments, topics out[arg.Name] = topics[0] case abi.BytesTy, abi.FixedBytesTy: out[arg.Name] = topics[0][:] + case abi.StringTy: + bytes := topics[0].Bytes() + var trimmedBytes []byte + for i, by := range bytes { + if by != 0 { + trimmedBytes = bytes[i:] + break + } + } + out[arg.Name] = string(trimmedBytes) default: }