Boncurs
  • Boncurs Bonding Curve Library
    • Exponential Curves
      • ExpCurve
        • BancorFormula
      • ExpTokenBasedCurve
        • ExpTokenBasedFormula
    • Linear Curves
      • LinCurve
        • LinFormula
      • LinTokenBasedCurve
        • LinTokenBasedFormula
    • Boncurs Curve
      • BoncursCurve
        • BoncursFormula
Powered by GitBook
On this page

Boncurs Bonding Curve Library

NextExponential Curves

Last updated 6 months ago

CtrlK
  • Overview
  • Installation
  • Usage
  • Tools
  • License

Overview • Installation • Usage • Tools • License


WARNING: These contracts have not been audited and are not intended for production. Use at your own risk.

Overview

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


Current available curves:

  • Exponential

  • Linear

  • Exponential Token Based

  • Linear Token Based

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:

// 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

License

The MIT License (MIT)

Boncurs Curve