Crates.io | hyperdrive-math |
lib.rs | hyperdrive-math |
version | 0.18.1 |
source | src |
created_at | 2024-07-03 19:59:26.952282 |
updated_at | 2024-10-08 21:13:10.023053 |
description | API for simulating Hyperdrive smart contract transactions. |
homepage | https://hyperdrive.box/ |
repository | https://github.com/delvtech/hyperdrive-rs |
max_upload_size | |
id | 1290959 |
size | 458,281 |
Hyperdrive is an automated market maker that enables fixed-rate markets to be built on top of arbitrary yield sources. Hyperdrive provides several novel features for fixed-rate AMMs including:
Hyperdrive-rs is a Rust library that mirrors the functionality of the Hyperdrive Solidity smart contracts. Hyperdrive-rs includes differential testing against smart contracts for implemented functions, which demonstrates parity between the two implementations. This is a work-in-progress and not all Hyperdrive features are present.
Python bindings for this library can be accessed via hyperdrivepy
or see agent0 for Python applications that utilize hyperdrivepy
.
Typescript bindings for this library can be found here.
The Hyperdrive docs include documentation on how to use Hyperdrive to source and provide liquidity, documentation for developers seeking to use Hyperdrive programatically, and documentation for developers that want to integrate Hyperdrive with a yield source.
The Hyperdrive Whitepaper describes the technical details underlying how Hyperdrive mints terms on demand, enables LPs to provide everlasting liquidity, and explains how the AMM's pricing model works.
This repository makes use of foundry to build and test smart contracts against the Rust implementation. If you haven't already, you will need to Install forge.
hyperdrive-rs
is composed of three published packages:
You can install them for production runs via cargo add [package]
, or add it to your cargo.toml
.
If you'd like to set up a development environment, clone the repo and build with make
:
make build
When the hyperdrive-wrappers crate is built,
it will clone the Hyperdrive
repository and generate type-safe Rust
bindings using ethers-rs. You can modify
the version of the Hyperdrive contracts that are built against by updating the
git ref in the
hyperdrive.version
file.
To build against an existing local Hyperdrive repository instead, you can
symlink the local repository to the hyperdrive-wrappers
directory:
ln -s <path-to-local-hyperdrive-clone> crates/hyperdrive-wrappers
And then in the .env file in hyperdrive-wrappers, add:
LOCAL_DEVELOPMENT=true
To prevent hyperdrive-wrappers from rebuilding automatically, add the following to the same .env:
BUILD_DISABLED=true
This is useful during development since running tests in hyperdrive-math will retrigger builds, which slows down development and testing considerably. Also, certain IDE's like vscode will over-eagerly rebuild the wrappers so turning off the build can be useful when there are no changes to the solidity files in hyperdrive.
make test
make lint
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.