Skip to content

Commit

Permalink
lint
Browse files Browse the repository at this point in the history
  • Loading branch information
DanielSchiavini committed Oct 9, 2024
1 parent ec6c089 commit 590c368
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 14 deletions.
4 changes: 1 addition & 3 deletions boa_zksync/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,7 @@ def set_zksync_browser_env(*args, **kwargs):
boa.set_zksync_browser_env = set_zksync_browser_env


def verify(
contract: ZksyncContract, verifier=None, **kwargs
) -> VerificationResult:
def verify(contract: ZksyncContract, verifier=None, **kwargs) -> VerificationResult:
verifier = verifier or get_verifier()
return verifier.verify(
address=contract.address,
Expand Down
7 changes: 2 additions & 5 deletions boa_zksync/compile.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,7 @@ def compile_zksync(
compiler_args = compiler_args or []

result = _run_zkvyper(
"--vyper", vyper_path,
"-f", "combined_json",
*compiler_args,
"--", filename,
"--vyper", vyper_path, "-f", "combined_json", *compiler_args, "--", filename
)
output = json.loads(result)

Expand All @@ -39,7 +36,7 @@ def compile_zksync(
_get_zkvyper_version(),
compiler_args,
bytecode,
**compile_output
**compile_output,
)


Expand Down
4 changes: 3 additions & 1 deletion boa_zksync/contract.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,9 @@ def __init__(
self.env.register_contract(address, self)

def _run_init(self, *args, value=0, override_address=None, gas=None):
self.constructor_calldata = self._ctor.prepare_calldata(*args) if self._ctor else b""
self.constructor_calldata = (
self._ctor.prepare_calldata(*args) if self._ctor else b""
)
address, bytecode = self.env.deploy_code(
override_address=override_address,
gas=gas,
Expand Down
8 changes: 5 additions & 3 deletions boa_zksync/verifiers.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
from boa.util.abi import Address
from boa.verifiers import VerificationResult

DEFAULT_ZKSYNC_EXPLORER_URI = "https://zksync2-mainnet-explorer.zksync.io",
DEFAULT_ZKSYNC_EXPLORER_URI = "https://zksync2-mainnet-explorer.zksync.io"


@dataclass
Expand Down Expand Up @@ -50,13 +50,15 @@ def verify(
url = f"{self.uri}/contract_verification"
body = {
"contractAddress": address,
"sourceCode": {name: asset["content"] for name, asset in solc_json["sources"].items()},
"sourceCode": {
name: asset["content"] for name, asset in solc_json["sources"].items()
},
"codeFormat": "vyper-multi-file",
"contractName": contract_name,
"compilerVyperVersion": solc_json["compiler_version"],
"compilerZkvyperVersion": solc_json["zkvyper_version"],
"constructorArguments": f"0x{constructor_calldata.hex()}",
"optimizationUsed": True, # hardcoded in hardhat for some reason: https://github.com/matter-labs/hardhat-zksync/blob/187722e/packages/hardhat-zksync-verify-vyper/src/task-actions.ts#L110
"optimizationUsed": True, # hardcoded in hardhat for some reason: https://github.com/matter-labs/hardhat-zksync/blob/187722e/packages/hardhat-zksync-verify-vyper/src/task-actions.ts#L110 # noqa: E501
}

response = requests.post(url, json=body)
Expand Down
8 changes: 6 additions & 2 deletions tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,12 @@
from boa_zksync.deployer import ZksyncDeployer

STARTING_SUPPLY = 100
ZKSYNC_SEPOLIA_RPC_URL = os.getenv("ZKSYNC_SEPOLIA_RPC_URL", "https://sepolia.era.zksync.dev")
ZKSYNC_SEPOLIA_EXPLORER_URL = os.getenv("ZKSYNC_SEPOLIA_EXPLORER_URL", "https://explorer.sepolia.era.zksync.dev")
ZKSYNC_SEPOLIA_RPC_URL = os.getenv(
"ZKSYNC_SEPOLIA_RPC_URL", "https://sepolia.era.zksync.dev"
)
ZKSYNC_SEPOLIA_EXPLORER_URL = os.getenv(
"ZKSYNC_SEPOLIA_EXPLORER_URL", "https://explorer.sepolia.era.zksync.dev"
)


@pytest.fixture(scope="module")
Expand Down
1 change: 1 addition & 0 deletions tests/test_sepolia.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ def test_fork_rpc(zksync_sepolia_fork):
@pytest.mark.ignore_isolation
def test_real_deploy_and_verify(zksync_sepolia_env):
from tests.data import Counter

contract = Counter.deploy()
verify = boa_zksync.verify(contract)
verify.wait_for_verification()
Expand Down

0 comments on commit 590c368

Please sign in to comment.