Overview • Installation • Usage • Learn More • Contributing • License • Docs
Warning
These contracts have not been audited and are not intended for production. Use at your own risk.
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
$ npm install boncurs
$ forge install dustinstacy/boncurs
Add @boncurs/=lib/boncurs/
in remappings.txt.
Once installed, you can use the contracts in the library by importing them:
pragma solidity ^0.8.28;
import {BoncursCurve} from "boncurs/experimental/BoncursCurve.sol";
// Couple with a token contract for ideal use case
contract ExampleImplementation is BoncursCurve {
// Track the scalingFactor, initialCost, supply, and reserverBalance using desired method
uint32 private immutable i_scalingFactor;
uint256 private immutable i_initialCost;
uint256 private supply;
uint256 private reserveBalance;
function exampleFunc(uint256 amount) public returns (uint256 examplePurchaseReturn) {
// Call library functions to use pricing calculations
examplePurchaseReturn = getPurchaseCost(supply, reserveBalance, initialCost, scalingFactor, amount);
}
}
Introducing the Boncurs Bonding Curve Library: Medium
Visit the documentation site: Docs
Tools for working with the library: Boncurs Bonding Curve Tools
Interested in contirbuting? Check out the current issues or submit your own idea.
Follow these steps:
- Fork it!
- Create your feature branch:
git checkout -b my-new-feature
- Commit your changes:
git commit -m 'Add some feature'
- Push to the branch:
git push origin my-new-feature
- Submit a pull request
The MIT License (MIT)