# Boncurs Bonding Curve Library

&#x20;[![](https://img.shields.io/npm/v/boncurs)](https://www.npmjs.com/package/boncurs) ![](https://img.shields.io/badge/License-MIT-brightgreen)

[Overview](#overview) • [Installation](#installation) • [Usage](#usage) • [Tools](#tools) • [License](#license)

***

{% hint style="danger" %}
WARNING: These contracts have not been audited and are not intended for production. Use at your own risk.
{% endhint %}

## Overview

**A smart contract bonding curve library.** For use with fungible and non-fungible token projects.

***

Current available curves:

* [Exponential](/boncurs/boncurs-bonding-curve-library/exponential-curves.md)
* [Linear](/boncurs/boncurs-bonding-curve-library/linear-curves.md)
* [Exponential Token Based](/boncurs/boncurs-bonding-curve-library/exponential-curves.md)
* [Linear Token Based](/boncurs/boncurs-bonding-curve-library/linear-curves.md)
* [Boncurs Curve](/boncurs/boncurs-bonding-curve-library/boncurs-curve.md)

## Installation

#### Hardhat (npm)

```
$ npm install boncurs
```

#### Foundry (git)

```
$ forge install dustinstacy/boncurs
```

Add `@boncurs/=lib/boncurs/` in `remappings.txt.`

## Usage

Once installed, you can use the contracts in the library by importing them:

```solidity
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.20;

import {ExpCurve} from "@boncurs/contracts/exponential/ExpCurve.sol";

// Couple with a token contract for ideal use case
contract ExampleImplementation is ExpCurve {
    // Track the reserve ratio, reserve balance, and supply using desired method
    uint32 private reserveRatio;
    uint256 private reserveBalance;
    uint256 private supply;

    function exampleFunc(uint256 depositAmount) public {
        // Call library methods to use pricing calculations
        uint256 examplePurchaseReturn = getPurchaseReturn(supply, reserveBalance, reserveRatio, depositAmount);
    }
}
```

## Tools

[Boncurs Bonding Curve Tools](https://github.com/dustinstacy/boncurs-tools)

## License

The MIT License (MIT)


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://boncurs.gitbook.io/boncurs/boncurs-bonding-curve-library.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
