Skip to content

Commit

Permalink
fix: support array of structs in abi.decode
Browse files Browse the repository at this point in the history
  • Loading branch information
0xalpharush authored May 15, 2024
1 parent 4645ba5 commit 08d631f
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions slither/visitors/slithir/expression_to_slithir.py
Original file line number Diff line number Diff line change
Expand Up @@ -448,12 +448,12 @@ def _post_index_access(self, expression: IndexAccess) -> None:
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)
Expand Down

0 comments on commit 08d631f

Please sign in to comment.