umbracle/ethgo

ParseTopic does not support KindFixedBytes or more.

Closed this issue · 0 comments

// ParseTopic parses an individual topic
func ParseTopic(t *Type, topic web3.Hash) (interface{}, error) {
	switch t.kind {
	case KindBool:
		if bytes.Equal(topic[:], topicTrue[:]) {
			return true, nil
		} else if bytes.Equal(topic[:], topicFalse[:]) {
			return false, nil
		}
		return true, fmt.Errorf("is not a boolean")

	case KindInt, KindUInt:
		return readInteger(t, topic[:]), nil

	case KindAddress:
		return readAddr(topic[:])

        //TODO: here we should add more types, i suppose.
	//case KindFixedBytes:
		//return readFixedBytes(t, topic[:])

	default:
		return nil, fmt.Errorf("Topic parsing for type %s not supported", t.String())
	}
}