Skip to content

Commit

Permalink
refactor: method share fix
Browse files Browse the repository at this point in the history
  • Loading branch information
antazoey committed Aug 2, 2024
1 parent 6ddb7a6 commit 81d1c89
Showing 1 changed file with 7 additions and 11 deletions.
18 changes: 7 additions & 11 deletions src/ape/contracts/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -255,16 +255,20 @@ def decode_input(self, calldata: bytes) -> tuple[str, dict[str, Any]]:

raise err


class ContractCallHandler(ContractMethodHandler):
def __call__(self, *args, **kwargs) -> Any:
def _validate_is_contract(self):
if not self.contract.is_contract:
raise ContractNotFoundError(
self.contract.address,
self.provider.network.explorer is not None,
self.provider.network_choice,
)


class ContractCallHandler(ContractMethodHandler):
def __call__(self, *args, **kwargs) -> Any:
if not self.contract.is_contract:
self._validate_is_contract()

selected_abi = _select_method_abi(self.abis, args)
arguments = self.conversion_manager.convert_method_args(selected_abi, args)

Expand Down Expand Up @@ -436,14 +440,6 @@ def _as_transaction(self, *args) -> ContractTransaction:
address=self.contract.address,
)

def _validate_is_contract(self):
if not self.contract.is_contract:
raise ContractNotFoundError(
self.contract.address,
self.provider.network.explorer is not None,
self.provider.network_choice,
)


class ContractEvent(BaseInterfaceModel):
"""
Expand Down

0 comments on commit 81d1c89

Please sign in to comment.