Skip to main content

eth-balancer

eth-balancer is a python wrapper built ontop the web3py library to interact with Balancer solidity contracts on a public or private ethereum blockchain.

The library defines a python function for each function defined by the solidity contracts in python, adding type hints for the arguments and return values. This makes it easier to call the contracts' function by enabling IDE features such as auto-completion.

Installation

You can install the eth-balancer package using pip:

python -m pip install eth-balancer

Getting started

Here is how to deploy and use the Balancer v1 BFactory solidity contract using this library:

# First, you need a connection to an ethereum node.
# Here, we are using a local node created with ganache-cli for instance.

from web3 import Web3, HTTPProvider
url = "http://127.0.0.1:8545"
w3 = Web3(HTTPProvider(url))

# We can deploy the factory as follows:

from eth_balancer.v1.core import BFactory, BPool

receipt = BFactory.deploy(w3).waitForReceipt()
factory = receipt.contract

# Alternatively, we can connect to a deployed instance:

factory_address = '0x9424B1412450D0f8Fc2255FAf6046b98213B76Bd'
factory = BFactory(w3, address=factory_address)

# All the functions defined by the solidity contract are available.
# Here is how to send a transaction to the newBPool function

receipt = factory.functions.newBPool().waitForReceipt()

# You can parse the event emitted by the function as follows:

events = receipt.events.LOG_NEW_POOL()
pool_address = events[0]["args"]["pool"]

# Here is how to make an eth-call 

return_value = factory.functions.isBPool(pool_address).call()
print(f"isBPool({pool_address}) returned {return_value}")

# And here is how to create a BPool object using the newly created address

pool = BPool(w3, pool_address)

Documentation

For each solidity contract defined by Balancer, this package contains a python class with the same name and its methods also have the same name as the solidity one. This makes it easy to find the class and method you are looking for. Refer to Balancer documentation to learn how to interact with the contracts.

Metadata

Release files for eth-balancer 0.0.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for eth-balancer 0.0.2
File Size Uploaded Provenance Actions
eth-balancer-0.0.2.tar.gz 3.1 kB Without provenance Details for eth-balancer-0.0.2.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for eth-balancer 0.0.2
File Interpreter ABI Platform Actions
eth_balancer-0.0.2-py3-none-any.whl Python 3 none any Details for eth_balancer-0.0.2-py3-none-any.whl

Total release size: 18.4 kB

Release files / eth-balancer-0.0.2.tar.gz

Download URL eth-balancer-0.0.2.tar.gz
Size 3.1 kB
Tags Source
SHA-256 checksum
How to use checksums
d544bafefa63a16e1472a33cde9e30db65ae92225dfb66028f26ce5e35505a5e
BLAKE2b-256 checksum
How to use checksums
5a56bb6e47e963e63b08bd44451830598cafbe639f9f9c9317f7793a43bfeaf1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/52.0.0.post20210125 requests-toolbelt/0.9.1 tqdm/4.56.2 CPython/3.9.1

Release files / eth_balancer-0.0.2-py3-none-any.whl

Download URL eth_balancer-0.0.2-py3-none-any.whl
Size 15.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
05bf3f05af1a423b01c9592c722c96bf914f94b39cb8bbae45c63f5c97c3aabf
BLAKE2b-256 checksum
How to use checksums
934f540568aec16489bbbc8ba094bbbcbd9118853053c3de6c55412a7bb6d99e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/52.0.0.post20210125 requests-toolbelt/0.9.1 tqdm/4.56.2 CPython/3.9.1

Security for eth-balancer 0.0.2

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.0.2 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page