Skip to content
This repository has been archived by the owner on May 2, 2024. It is now read-only.

Python and WASM bindings for the Hyperdrive Rust SDK.

License

Notifications You must be signed in to change notification settings

delvtech/hyperdrive-bindings

Repository files navigation

license: Apache 2.0 DELV - Terms of Service

⚠️ Deprecated ⚠️

The Python bindings have been moved to hyperdrive-rs and the WASM bindings have been moved to hyperdrive-frontend.

Hyperdrive-bindings

Hyperdrive is an automated market maker that enables fixed-rate markets to be built on top of arbitrary yield sources.

This repo contains hyperdrivepy and hyperdrive-wasm, which are Rust-powered Python and WASM packages for simulating the Hyperdrive AMM.

Hyperdrivepy install

Hyperdrivepy can be installed via pip: python -m pip install hyperdrivepy

For a local installation, this repo must include a simulation link to the hyperdrive-rust source code. From the hyperdrive-bindings project root, run:

git clone [email protected]:delvtech/hyperdrive.git ../hyperdrive
ln -s ../hyperdrive hyperdrive

To install the Python package hyperdrivepy, which wraps hyperdrive-rs, you need to:

  • setup a Python venv that is running Python 3.10
  • from inside the environment, run pip install crates/hyperdrivepy
  • test the installation by running pip install --upgrade -r requirements-dev.txt && pytest

[optional] To build the package wheel locally, you can navigate to the package folder and use setup.py:

  • cd crates/hyperdrivepy
  • python setup.py bdist_wheel This will make the distribution ready (e.g. a tar.gz file and a .whl file in the dist directory) for your platform. To build for more platforms, we use cbuildwheel in our GitHub CI.

Build Types

PoolInfo and PoolConfig are passed into many of the functions. These are built from the Hyperdrive abi json with pypechain. From the hyperdrive-bindings project root, run:

pip install --upgrade -r requirements-dev.txt
pypechain --line-length 120 --output-dir crates/hyperdrivepy/python/hyperdrivepy/pypechain_types hyperdrive/out/IHyperdrive.sol/

Disclaimer

This project is a work-in-progress. The language used in this code and documentation is not intended to, and does not, have any particular financial, legal, or regulatory significance.


Copyright © 2024 DELV

Licensed under the Apache License, Version 2.0 (the "OSS License").

By accessing or using this code, you signify that you have read, understand and agree to be bound by and to comply with the OSS License and DELV's Terms of Service. If you do not agree to those terms, you are prohibited from accessing or using this code.

Unless required by applicable law or agreed to in writing, software distributed under the OSS License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the OSS License and the DELV Terms of Service for the specific language governing permissions and limitations.