fix: support array of structs in abi.decode

pull/2459/head
alpharush 6 months ago committed by GitHub
parent 4645ba54cb
commit 08d631f6c9
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 4
      slither/visitors/slithir/expression_to_slithir.py

@ -448,12 +448,12 @@ class ExpressionToSlithIR(ExpressionVisitor):
right = get(expression.expression_right)
operation: Operation
# Left can be a type for abi.decode(var, uint[2])
if isinstance(left, (Type, Contract, Enum)):
if isinstance(left, (Type, Contract, Enum, Structure)):
# Nested type are not yet supported by abi.decode, so the assumption
# Is that the right variable must be a constant
assert isinstance(right, Constant)
# Case for abi.decode(var, I[2]) where I is an interface/contract or an enum
if isinstance(left, (Contract, Enum)):
if isinstance(left, (Contract, Enum, Structure)):
left = UserDefinedType(left)
t = ArrayType(left, int(right.value))
set_val(expression, t)

Loading…
Cancel
Save