update parseTopicsIntoMap to handle strings

This commit is contained in:
Ian Norden 2019-03-08 12:35:50 -06:00
parent 8bd397e2eb
commit ac93139863
2 changed files with 12 additions and 1 deletions

View File

@ -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`. 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`. 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] out[arg.Name] = topics[0]
case abi.BytesTy, abi.FixedBytesTy: case abi.BytesTy, abi.FixedBytesTy:
out[arg.Name] = topics[0][:] 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: default:
} }