diff --git a/boa_zksync/contract.py b/boa_zksync/contract.py index 40f5648..3d93cf4 100644 --- a/boa_zksync/contract.py +++ b/boa_zksync/contract.py @@ -33,7 +33,7 @@ class ZksyncContract(ABIContract): def __init__( self, compiler_data: ZksyncCompilerData, - name: str, + contract_name: str, functions: list[ABIFunction], *args, value=0, @@ -55,7 +55,7 @@ def __init__( self._abi = compiler_data.abi self.env = Env.get_singleton() if env is None else env self.filename = filename - self.contract_name = name + self.contract_name = contract_name # run the constructor if not skipping if skip_initcode: @@ -69,7 +69,7 @@ def __init__( # only now initialize the ABI contract super().__init__( - name=name, + name=contract_name, abi=compiler_data.abi, functions=functions, address=address, diff --git a/boa_zksync/deployer.py b/boa_zksync/deployer.py index 7f90ed2..fb6d5fa 100644 --- a/boa_zksync/deployer.py +++ b/boa_zksync/deployer.py @@ -1,6 +1,6 @@ from functools import cached_property from pathlib import Path -from typing import TYPE_CHECKING +from typing import TYPE_CHECKING, Optional from boa import Env from boa.contracts.abi.abi_contract import ABIContractFactory @@ -43,10 +43,12 @@ def _compile( def from_abi_dict(cls, abi, name="", filename=None): raise NotImplementedError("ZksyncDeployer does not support loading from ABI") - def deploy(self, *args, **kwargs) -> ZksyncContract: + def deploy( + self, *args, contract_name: Optional[str] = None, **kwargs + ) -> ZksyncContract: return ZksyncContract( self.zkvyper_data, - self._name, + contract_name or self._name, self.functions, *args, filename=self.filename, @@ -59,14 +61,16 @@ def at(self, address: Address | str) -> ZksyncContract: """ return self.deploy(override_address=Address(address), skip_initcode=True) - def deploy_as_blueprint(self, **kwargs) -> ZksyncContract: + def deploy_as_blueprint( + self, contract_name: Optional[str] = None, **kwargs + ) -> ZksyncContract: """ In zkSync, any contract can be used as a blueprint. The only difference here is that we don't need to run the constructor. """ return ZksyncBlueprint( self.zkvyper_data, - self._name, + contract_name or self._name, self.functions, filename=self.filename, **kwargs, diff --git a/pyproject.toml b/pyproject.toml index 649caf7..fcdb34a 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "titanoboa-zksync" -version = "0.2.5" +version = "0.2.6" description = "A Zksync plugin for the Titanoboa Vyper interpreter" license = { file = "LICENSE" } readme = "README.md" @@ -17,7 +17,7 @@ classifiers = [ ] dependencies = [ - "titanoboa==0.2.4", + "titanoboa==0.2.5b1" ] [project.optional-dependencies] diff --git a/tests/test_boa_loads.py b/tests/test_boa_loads.py index f8a2702..7d4dc15 100644 --- a/tests/test_boa_loads.py +++ b/tests/test_boa_loads.py @@ -126,14 +126,14 @@ def get_name_of(addr: HasName) -> String[32]: assert stack_trace == StackTrace( [ " Test an error( (file CalledContract).name() -> ['string'])", + f"{called_addr}> (file ).name() -> ['string'])", " Test an error( (file " - "CallerContract).get_name_of(address) -> ['string'])", + ").get_name_of(address) -> ['string'])", " ", " ", " Test an error( (file CallerContract).get_name_of(address) -> " + f"{caller_contract.address}> (file ).get_name_of(address) -> " "['string'])", ] )