Boncurs Bonding Curve Library
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:
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
License
The MIT License (MIT)
Last updated