Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: update boa #29

Merged
merged 3 commits into from
Oct 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions boa_zksync/contract.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ class ZksyncContract(ABIContract):
def __init__(
self,
compiler_data: ZksyncCompilerData,
name: str,
contract_name: str,
functions: list[ABIFunction],
*args,
value=0,
Expand All @@ -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:
Expand All @@ -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,
Expand Down
14 changes: 9 additions & 5 deletions boa_zksync/deployer.py
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -43,10 +43,12 @@ def _compile(
def from_abi_dict(cls, abi, name="<anonymous contract>", 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,
Expand All @@ -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,
Expand Down
4 changes: 2 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -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"
Expand All @@ -17,7 +17,7 @@ classifiers = [
]

dependencies = [
"titanoboa==0.2.4",
"titanoboa==0.2.5b1"
]

[project.optional-dependencies]
Expand Down
6 changes: 3 additions & 3 deletions tests/test_boa_loads.py
Original file line number Diff line number Diff line change
Expand Up @@ -126,14 +126,14 @@ def get_name_of(addr: HasName) -> String[32]:
assert stack_trace == StackTrace(
[
" Test an error(<CalledContract interface at "
f"{called_addr}> (file CalledContract).name() -> ['string'])",
f"{called_addr}> (file <unknown>).name() -> ['string'])",
" Test an error(<CallerContract interface at "
f"{caller_contract.address}> (file "
"CallerContract).get_name_of(address) -> ['string'])",
"<unknown>).get_name_of(address) -> ['string'])",
" <Unknown contract 0x0000000000000000000000000000000000008009>",
" <Unknown contract 0x0000000000000000000000000000000000008002>",
" Test an error(<CallerContract interface at "
f"{caller_contract.address}> (file CallerContract).get_name_of(address) -> "
f"{caller_contract.address}> (file <unknown>).get_name_of(address) -> "
"['string'])",
]
)
Expand Down