ape-titanoboa: Titanoboa integration
Project description
Quick Start
Use Titanoboa as a provider in Ape.
Dependencies
- python3 version 3.9 or greater, python3-dev
Installation
via pip
You can install the latest release via pip:
pip install ape-titanoboa
via setuptools
You can clone the repository and use setuptools for the most up-to-date version:
git clone https://github.com/ApeWorX/ape-titanoboa.git
cd ape-titanoboa
python3 setup.py install
Quick Usage
Use titanoboa as your development or simulation provider (testing).
For example, run your project's tests using the --network flag and boa as the name of the provider:
ape test --network ethereum:local:boa
Boa works the same as other Ape testing providers such as ape-foundry or the Ethereum tester that comes with ape-test by default.
Fork Mode
You can for networks using ape-titanoba to simulate actions.
For example, let's say you are in a console session with mainnet:
ape console --network ethereum:mainnet:alchemy
Fork mainnet into boa to run simulations:
from ape import Contract, accounts, networks
with networks.fork():
# Reference a contract from Ethereum mainnet in your fork.
contract = Contract("0x388C818CA8B9251b393131C08a736A67ccB19297")
# Impersonate any relevant accounts needed for the simulation.
owner = accounts["0xdb65702a9b26f8a643a31a4c84b9392589e03d7c"]
# Attempt to call methods on the contract using the impersonated accounts.
contract.recoverERC20("0xae7ab96520DE3A18E5e111B5EaAb095312D7fE84", 10, sender=owner)
You can also connect to a forked-network directly using the --network flag:
ape console --network ethereum:mainnet-fork:boa
Or in Python:
from ape import chain, networks
with networks.ethereum.mainnet_fork.use_provider("boa"):
print(chain.provider.chain_id)
Development
This project is in development and should be considered a beta. Things might not be in their final state and breaking changes may occur. Comments, questions, criticisms and pull requests are welcomed.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file ape_titanoboa-0.8.0a1.tar.gz.
File metadata
- Download URL: ape_titanoboa-0.8.0a1.tar.gz
- Upload date:
- Size: 32.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.0.1 CPython/3.10.16
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
73b6e780788c204ad3630b084b0fa7ca7d639cb20638bcb72084ea2ba2153512
|
|
| MD5 |
10720950dea3c2bedc4d31adfe74b24a
|
|
| BLAKE2b-256 |
e004b87de1c128d8ea96c1d3cbbae790aa2d02d218db68258d518977a2cb622d
|
File details
Details for the file ape_titanoboa-0.8.0a1-py3-none-any.whl.
File metadata
- Download URL: ape_titanoboa-0.8.0a1-py3-none-any.whl
- Upload date:
- Size: 17.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.0.1 CPython/3.10.16
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3bb242146dcc836faf644a81ad63ecaba36aa1e8242816ae4658403ebe793c07
|
|
| MD5 |
23330b065a6b29f3ac87e15068dd0126
|
|
| BLAKE2b-256 |
4fc478a9351178b30abb2dac3c985249828dd7e0e9c53bcbb59122b4a26403c4
|