Skip to content

Commit

Permalink
feat: optimism integration
Browse files Browse the repository at this point in the history
  • Loading branch information
antazoey committed Jul 26, 2024
1 parent bbf676b commit 2327534
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 0 deletions.
3 changes: 3 additions & 0 deletions ape_foundry/provider.py
Original file line number Diff line number Diff line change
Expand Up @@ -447,6 +447,9 @@ def build_command(self) -> list[str]:
if self.settings.disable_block_gas_limit:
cmd.append("--disable-block-gas-limit")

if self.network.ecosystem.name in ("optimism", "base"):
cmd.append("--optimism")

return cmd

def set_balance(self, account: AddressType, amount: Union[int, float, str, bytes]):
Expand Down
1 change: 1 addition & 0 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
"hypothesis>=6.2.0,<7.0", # Strategy-based fuzzer
"ape-alchemy", # For running fork tests
"ape-polygon", # For running polygon fork tests
"ape-optimism", # For Optimism integration tests
],
"lint": [
"black>=24.4.2,<25", # Auto-formatter and linter
Expand Down
9 changes: 9 additions & 0 deletions tests/test_provider.py
Original file line number Diff line number Diff line change
Expand Up @@ -467,3 +467,12 @@ def test_initial_balance(accounts):
# just showing we were able to increase it.
acct = accounts[9]
assert convert("10_000 ETH", int) < acct.balance <= convert("100_000 ETH", int)


def test_optimism(networks):
with networks.optimism.local.use_provider(
"foundry", provider_settings={"port": 9545}
) as provider:
assert provider.is_connected
cmd = provider.build_command()
assert "--optimism" in cmd

0 comments on commit 2327534

Please sign in to comment.