generated from ApeWorX/project-template
-
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into chore/dust-off
- Loading branch information
Showing
19 changed files
with
2,109 additions
and
64 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,20 @@ | ||
# Add module top-level imports here | ||
from ape import plugins | ||
|
||
|
||
@plugins.register(plugins.Config) | ||
def config_class(): | ||
from ape_titanoboa.config import BoaConfig | ||
|
||
return BoaConfig | ||
|
||
|
||
@plugins.register(plugins.ProviderPlugin) | ||
def providers(): | ||
from evmchains import PUBLIC_CHAIN_META | ||
|
||
from ape_titanoboa.provider import ForkTitanoboaProvider, TitanoboaProvider | ||
|
||
for ecosystem, networks in PUBLIC_CHAIN_META.items(): | ||
yield ecosystem, "local", TitanoboaProvider | ||
for network in networks: | ||
yield ecosystem, f"{network}-fork", ForkTitanoboaProvider |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
from typing import Literal, Optional, Union | ||
|
||
from ape.api.config import PluginConfig | ||
from ape.types import BlockID | ||
|
||
# TODO: https://github.com/ApeWorX/ape/issues/2454 is resolved, | ||
# can use `ape.utils.testing.DEFAULT_TEST_CHAIN_ID`, but for | ||
# now we want this to be the same as ape-foundry's default. | ||
DEFAULT_TEST_CHAIN_ID = 31337 | ||
ForkBlockIdentifier = Union[BlockID, Literal["safe"]] | ||
|
||
|
||
class BoaForkConfig(PluginConfig): | ||
""" | ||
Configure forked networks. | ||
""" | ||
|
||
upstream_provider: Optional[str] = None | ||
""" | ||
The value to use, such as plugin name or URL, for the | ||
upstream network. Defaults to the default provider | ||
for that network. | ||
""" | ||
|
||
block_identifier: ForkBlockIdentifier = "safe" | ||
""" | ||
The block ID, such as block number of hash, to fork from (recommended). | ||
Defaults to the literal "safe" (same as boa). | ||
""" | ||
|
||
|
||
class BoaConfig(PluginConfig): | ||
""" | ||
Configure the titanoboa plugin. | ||
""" | ||
|
||
chain_id: int = DEFAULT_TEST_CHAIN_ID | ||
""" | ||
Change the chain ID for your development "chain". | ||
""" | ||
|
||
fork: dict[str, dict[str, BoaForkConfig]] = {} | ||
""" | ||
Maps ecosystem name -> network name -> fork configuration (e.g. block number). | ||
""" |
Oops, something went wrong.