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.0a1.tar.gz (32.7 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.0a1-py3-none-any.whl (17.4 kB view details)

Uploaded Python 3

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

Hashes for ape_titanoboa-0.8.0a1.tar.gz
Algorithm Hash digest
SHA256 73b6e780788c204ad3630b084b0fa7ca7d639cb20638bcb72084ea2ba2153512
MD5 10720950dea3c2bedc4d31adfe74b24a
BLAKE2b-256 e004b87de1c128d8ea96c1d3cbbae790aa2d02d218db68258d518977a2cb622d

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ape_titanoboa-0.8.0a1-py3-none-any.whl
Algorithm Hash digest
SHA256 3bb242146dcc836faf644a81ad63ecaba36aa1e8242816ae4658403ebe793c07
MD5 23330b065a6b29f3ac87e15068dd0126
BLAKE2b-256 4fc478a9351178b30abb2dac3c985249828dd7e0e9c53bcbb59122b4a26403c4

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