fix FixedBytesTy

This commit is contained in:
Jeff Wentworth 2019-11-12 21:05:02 +09:00
parent 9d81eaa8b2
commit d94234d5f9

View file

@ -228,7 +228,9 @@ func parseTopicsIntoMap(out map[string]interface{}, fields abi.Arguments, topics
case abi.HashTy: case abi.HashTy:
out[arg.Name] = topics[0] out[arg.Name] = topics[0]
case abi.FixedBytesTy: case abi.FixedBytesTy:
out[arg.Name] = topics[0][:] array := reflect.New(arg.Type.Type).Elem()
reflect.Copy(array, reflect.ValueOf(topics[0][:arg.Type.Size]))
out[arg.Name] = array.Interface()
case abi.StringTy, abi.BytesTy, abi.SliceTy, abi.ArrayTy: case abi.StringTy, abi.BytesTy, abi.SliceTy, abi.ArrayTy:
// Array types (including strings and bytes) have their keccak256 hashes stored in the topic- not a hash // Array types (including strings and bytes) have their keccak256 hashes stored in the topic- not a hash
// whose bytes can be decoded to the actual value- so the best we can do is retrieve that hash // whose bytes can be decoded to the actual value- so the best we can do is retrieve that hash