diff --git a/boa/contracts/vyper/vyper_contract.py b/boa/contracts/vyper/vyper_contract.py index 4a84c008..8f4a1fdc 100644 --- a/boa/contracts/vyper/vyper_contract.py +++ b/boa/contracts/vyper/vyper_contract.py @@ -144,13 +144,13 @@ class _BaseVyperContract(_BaseEVMContract): def __init__( self, compiler_data: CompilerData, + contract_name: Optional[str] = None, env: Optional[Env] = None, filename: Optional[str] = None, - contract_name: Optional[str] = None, ): - contract_name = ( - contract_name if contract_name else Path(compiler_data.contract_path).stem - ) + if contract_name is None: + contract_name = Path(compiler_data.contract_path).stem + super().__init__(contract_name, env, filename) self.compiler_data = compiler_data @@ -188,12 +188,11 @@ def __init__( env=None, override_address=None, blueprint_preamble=None, + contract_name=None, filename=None, gas=None, ): - # note slight code duplication with VyperContract ctor, - # maybe use common base class? - super().__init__(compiler_data, env, filename) + super().__init__(compiler_data, contract_name, env, filename) deploy_bytecode = generate_blueprint_bytecode( compiler_data.bytecode, blueprint_preamble @@ -519,11 +518,11 @@ def __init__( # whether to skip constructor skip_initcode=False, created_from: Address = None, + contract_name=None, filename: str = None, gas=None, - contract_name=None, ): - super().__init__(compiler_data, env, filename, contract_name) + super().__init__(compiler_data, contract_name, env, filename) self.created_from = created_from self._computation = None @@ -548,11 +547,7 @@ def __init__( addr = Address(override_address) else: addr = self._run_init( - *args, - value=value, - override_address=override_address, - gas=gas, - contract_name=contract_name, + *args, value=value, override_address=override_address, gas=gas ) self._address = addr @@ -577,9 +572,7 @@ def __init__( self.env.register_contract(self._address, self) - def _run_init( - self, *args, value=0, override_address=None, gas=None, contract_name=None - ): + def _run_init(self, *args, value=0, override_address=None, gas=None): encoded_args = b"" if self._ctor: encoded_args = self._ctor.prepare_calldata(*args) @@ -592,7 +585,6 @@ def _run_init( override_address=override_address, gas=gas, contract=self, - contract_name=contract_name, ) self._computation = computation diff --git a/boa/environment.py b/boa/environment.py index 31402a7b..52a729ec 100644 --- a/boa/environment.py +++ b/boa/environment.py @@ -212,7 +212,6 @@ def deploy( override_address: Optional[_AddressType] = None, # the calling vyper contract contract: Any = None, - contract_name: Optional[str] = None, # TODO: This isn't used ): sender = self._get_sender(sender) diff --git a/boa/network.py b/boa/network.py index e0cef6ef..23dd0dd1 100644 --- a/boa/network.py +++ b/boa/network.py @@ -361,14 +361,7 @@ def execute_code( # OVERRIDES def deploy( - self, - sender=None, - gas=None, - value=0, - bytecode=b"", - contract=None, - contract_name=None, - **kwargs, + self, sender=None, gas=None, value=0, bytecode=b"", contract=None, **kwargs ): # reset to latest block for simulation self._reset_fork() @@ -409,11 +402,7 @@ def deploy( print(f"contract deployed at {create_address}") if (deployments_db := get_deployments_db()) is not None: - contract_name = ( - contract_name - if contract_name - else getattr(contract, "contract_name", None) - ) + contract_name = getattr(contract, "contract_name", None) try: source_bundle = get_verification_bundle(contract) except Exception as e: