This is an application for providing liquidity between a token and an underlying asset, inspired by the pricing algorithm in the Bancor Whitepaper. While Bancor uses ERC20 tokens, this application focuses on the Simple Leger Protocol for creating tokens on the Bitcoin Cash (BCH) network.
The idea is simple: This program has its own BCH public address. If you send BCH to the address, the program will send you tokens. If you send tokens to that address, the program will send you BCH. The app functions as an automated market-maker, providing perfect liquidity for the token. The exchange rate is determined by the price formula.
The price formula used in this program was inspired by the Bancor whitepaper, but those equations were ultimately thrown out and similar equations created. Experiments are preserved here in the spreadsheet, and the graphs and values used for the PSF token can be viewed in the PSF Business Plan.
git clone https://github.com/Permissionless-Software-Foundation/token-liquidity
cd token-liquidity
npm install
cp env .env
npm test
- Customize the
env
file and rename it to.env
. This file will set the environment variables needed to customize the app to your own wallet and token. - Create a wallet-main.json file. You can generate one with this example script. It should look like this:
{
"mnemonic": "staff gentle brain electric blouse rigid boring manage hunt skull pride shy",
"cashAddress": "bitcoincash:qraaz6nft8nged5kwxh6rd0d9d3n7ngezgvckq3pt8",
"WIF": "KwKZ99vEszXDRsTdfRds81fCrrVvekjvNhtYFjpAhpsMZRBtnYG2",
"slpAddress": "simpleledger:qraaz6nft8nged5kwxh6rd0d9d3n7ngezgqramyp4e",
"legacyAddress": "1PxVUc79ZQTCoanNRWKRwU8koFwHfHHAKn"
}