Merge pull request #38 from vulcanize/unpack_update

update parseTopicsIntoMap to handle indexed strings
This commit is contained in:
Ian Norden 2019-03-13 08:40:37 -05:00 committed by GitHub
commit 2ac682afa8
2 changed files with 12 additions and 1 deletions

View File

@ -40,7 +40,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.com/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`.

View File

@ -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:
}