Skip to content

Commit

Permalink
fix: "stealing" of ABIFunction.contract in factory deployment
Browse files Browse the repository at this point in the history
  • Loading branch information
charles-cooper committed Jul 18, 2024
1 parent d852828 commit ec47efb
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 1 deletion.
2 changes: 1 addition & 1 deletion boa/contracts/abi/abi_contract.py
Original file line number Diff line number Diff line change
Expand Up @@ -341,7 +341,7 @@ def __init__(self, name: str, abi: list[dict], filename: Optional[str] = None):
def abi(self):
return self._abi

@cached_property
@property
def functions(self):
return [
ABIFunction(item, self._name)
Expand Down
19 changes: 19 additions & 0 deletions tests/unitary/contracts/abi/test_abi.py
Original file line number Diff line number Diff line change
Expand Up @@ -237,3 +237,22 @@ def test_abi_invalid_components():
_ = contract.test.argument_types

assert "Components found in non-tuple type uint256" == str(exc_info.value)

def test_abi_factory_multi_deploy():
code = """
foo: public(uint256)
@external
def __init__(x: uint256):
self.foo = x
"""
contract = boa.loads(code, 5)
contract2 = boa.loads(code, 6)
factory = ABIContractFactory.from_abi_dict(contract.abi)

wrapper = factory.at(contract.address)
wrapper2 = factory.at(contract2.address)

assert wrapper.foo() == 5
assert wrapper2.foo() == 6

0 comments on commit ec47efb

Please sign in to comment.