Support 1.2.16 distinctBase compilation error
This commit is contained in:
parent
0adf56c65b
commit
ae2d33aacd
|
@ -34,6 +34,14 @@ func decode*[E: Event](decoder: var AbiDecoder, _: type E): ?!E =
|
||||||
decoder.finishTuple()
|
decoder.finishTuple()
|
||||||
success event
|
success event
|
||||||
|
|
||||||
|
func isSupported(T: type): bool =
|
||||||
|
var supported = T is ValueType or
|
||||||
|
T is SmallByteArray
|
||||||
|
when compiles (T.distinctBase):
|
||||||
|
supported = supported or T.distinctBase is ValueType or
|
||||||
|
T.distinctBase is SmallByteArray
|
||||||
|
return supported
|
||||||
|
|
||||||
func decode*[E: Event](_: type E, data: seq[byte], topics: seq[Topic]): ?!E =
|
func decode*[E: Event](_: type E, data: seq[byte], topics: seq[Topic]): ?!E =
|
||||||
var event = ?Abidecoder.decode(data, E)
|
var event = ?Abidecoder.decode(data, E)
|
||||||
var i = 1
|
var i = 1
|
||||||
|
@ -41,10 +49,7 @@ func decode*[E: Event](_: type E, data: seq[byte], topics: seq[Topic]): ?!E =
|
||||||
if field.hasCustomPragma(indexed):
|
if field.hasCustomPragma(indexed):
|
||||||
if i >= topics.len:
|
if i >= topics.len:
|
||||||
return failure "indexed event parameter not found"
|
return failure "indexed event parameter not found"
|
||||||
if typeof(field) is ValueType or
|
if typeof(field).isSupported:
|
||||||
typeof(field) is SmallByteArray or
|
|
||||||
typeof(field).distinctBase is ValueType or
|
|
||||||
typeof(field).distinctBase is SmallByteArray:
|
|
||||||
field = ?AbiDecoder.decode(@(topics[i]), typeof(field))
|
field = ?AbiDecoder.decode(@(topics[i]), typeof(field))
|
||||||
inc i
|
inc i
|
||||||
success event
|
success event
|
||||||
|
|
Loading…
Reference in New Issue