Skip to main content

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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

ape_titanoboa-0.8.0a0.tar.gz (32.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

ape_titanoboa-0.8.0a0-py3-none-any.whl (17.2 kB view details)

Uploaded Python 3

File details

Details for the file ape_titanoboa-0.8.0a0.tar.gz.

File metadata

  • Download URL: ape_titanoboa-0.8.0a0.tar.gz
  • Upload date:
  • Size: 32.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.0.1 CPython/3.10.15

File hashes

Hashes for ape_titanoboa-0.8.0a0.tar.gz
Algorithm Hash digest
SHA256 0c7486cfbc0132ae3aef2c724c88e1d39fc5aea8eb7491518f031f8ebcdc8e54
MD5 2852528ef0479e4078c3ad73f41f8c60
BLAKE2b-256 6f390ecaa461fb03877fcd40b1e8af630e8bf1b8d12819d9b357536036039ac7

See more details on using hashes here.

File details

Details for the file ape_titanoboa-0.8.0a0-py3-none-any.whl.

File metadata

File hashes

Hashes for ape_titanoboa-0.8.0a0-py3-none-any.whl
Algorithm Hash digest
SHA256 86169a76f3c2addbf8b61d5e641898f6d829f8197b69b7e377929bc3042babce
MD5 4940850a22c06f721848c6e89b1394ae
BLAKE2b-256 111bfee5174c3aac7f39f2a73fac487d6e30edbb1db9765f3c85e5d02eeb2913

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page