From 2327534f9492af27929041e20bfb7d75e7d07b5f Mon Sep 17 00:00:00 2001 From: Juliya Smith Date: Fri, 26 Jul 2024 12:14:40 -0500 Subject: [PATCH] feat: optimism integration --- ape_foundry/provider.py | 3 +++ setup.py | 1 + tests/test_provider.py | 9 +++++++++ 3 files changed, 13 insertions(+) diff --git a/ape_foundry/provider.py b/ape_foundry/provider.py index a26f80c..08236fd 100644 --- a/ape_foundry/provider.py +++ b/ape_foundry/provider.py @@ -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]): diff --git a/setup.py b/setup.py index 164568b..d13ed56 100644 --- a/setup.py +++ b/setup.py @@ -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 diff --git a/tests/test_provider.py b/tests/test_provider.py index 63c4322..1308212 100644 --- a/tests/test_provider.py +++ b/tests/test_provider.py @@ -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