1.0.2 • Published 5 months ago

boncurs v1.0.2

Weekly downloads
-
License
MIT
Repository
github
Last release
5 months ago

!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
  • Boncurs Curve

Installation

Hardhat (npm)

$ npm install boncurs

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);
    }
}

Learn More

Visit the documentation site: Docs

Tools for working with the library: Boncurs Bonding Curve Tools

License

The MIT License (MIT)

1.0.2

5 months ago

1.0.1

6 months ago

1.0.0

6 months ago