Skip to content

Commit

Permalink
Extract regex
Browse files Browse the repository at this point in the history
  • Loading branch information
DanielSchiavini committed Sep 23, 2024
1 parent 8b778dd commit eb4518f
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions boa/contracts/vvm/vvm_contract.py
Original file line number Diff line number Diff line change
Expand Up @@ -246,13 +246,14 @@ class VVMStorageVariable(_VVMInternal):
It will temporarily change the bytecode at the contract's address.
"""

_hashmap_regex = re.compile(r"^HashMap\[([^[]+), (.+)]$")

def __init__(self, name, spec, contract):
value_type = spec["type"]
inputs = []
regex = re.compile(r"^HashMap\[([^[]+), (.+)]$")

while value_type.startswith("HashMap"):
key_type, value_type = regex.match(value_type).groups()
key_type, value_type = self._hashmap_regex.match(value_type).groups()
inputs.append({"name": f"key{len(inputs)}", "type": key_type})

abi = {
Expand Down

0 comments on commit eb4518f

Please sign in to comment.