-
-
Notifications
You must be signed in to change notification settings - Fork 144
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
c0420d6
commit 440de79
Showing
222 changed files
with
35,979 additions
and
160 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
# Sphinx build info version 1 | ||
# This file hashes the configuration used when building these files. When it is not found, a full rebuild will be done. | ||
config: b353fec97cfa26793b44c7358f0e922a | ||
config: 6831f6818b24f880ce6c5e3aa0702b33 | ||
tags: 645f666f9bcd5a90fca523b33c5a78b7 |
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
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 |
---|---|---|
@@ -0,0 +1,81 @@ | ||
# Forking Networks | ||
|
||
You can fork live networks in Ape. | ||
To do so, ensure you are using a provider plugin with forking features. | ||
Some options are: | ||
|
||
1. [ApeWorX/ape-foundry](https://github.com/ApeWorX/ape-foundry) | ||
2. [ApeWorX/ape-hardhat](https://github.com/ApeWorX/ape-hardhat) | ||
|
||
You can install one of these plugins by doing: | ||
|
||
```shell | ||
ape plugins install <foundry|hardhat> | ||
``` | ||
|
||
Ensure you have also configured your upstream network (the network you are forking). | ||
For example, if forking `ethereum:mainnet` and using `alchemy`, set `alchemy` as the default mainnet provider: | ||
|
||
```yaml | ||
ethereum: | ||
mainnet: | ||
default_provider: alchemy | ||
``` | ||
|
||
Now, you can start and connect to your forked-network: | ||
|
||
```yaml | ||
ape console --network ethereum:mainnet-fork:foundry | ||
``` | ||
|
||
Learn more about setting up networks in the [the networks guide](./networks.html). | ||
|
||
## Forking Plugin Networks | ||
|
||
You can also fork L2 plugin networks. | ||
For example, to fork a network such as Optimism, install the `ape-optimism` plugin: | ||
|
||
```shell | ||
ape plugins install optimism | ||
``` | ||
|
||
Then, just like you did for `ethereum`, configure `optimism`'s default mainnet provider: | ||
|
||
```yaml | ||
optimism: | ||
mainnet: | ||
default_provider: alchemy | ||
``` | ||
|
||
Now, you can start and connect to your forked-network: | ||
|
||
```yaml | ||
ape console --network optimism:mainnet-fork:foundry | ||
``` | ||
|
||
## Configure Default | ||
|
||
If you want to change the default network from `local` to your forked network, add the following config: | ||
|
||
```yaml | ||
<ecosystem-name>: | ||
default_network: <network-name>_fork | ||
``` | ||
|
||
Where `ecosystem-name` is the ecosystem containing the network and `network-name` is the network you are forking. | ||
|
||
## Forked Context | ||
|
||
If you are already connected to a live network wish to temporarily fork it, use the [fork() context manager](../methoddocs/managers.html#ape.managers.networks.NetworkManager.fork): | ||
|
||
```python | ||
from ape import networks | ||
|
||
def main(): | ||
with networks.ethereum.mainnet.use_provider("alchemy") as alchemy: | ||
print(alchemy.name) | ||
with networks.fork(provider_name="foundry") as foundry: | ||
print(foundry.name) | ||
``` | ||
|
||
Learn more about the fork context manager [here](./networks.html#forked-context). |
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
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
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
Oops, something went wrong.