Skip to content

MagRelo/bonding-curve

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

658 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

🏗 scaffold-eth - 📈 Bonding Curve

Discover how you can get started with Bonding Curve

Table of Contents
  1. About The Branch
  2. Getting Started
    • Installation
    • Introduction
  3. Branch UI Walkthrough
  4. Contact

About The Branch

This branch is entitled to showcase how you can get started integrating/using Bonding Curve which makes use of the Bancor's Bonding Curve Formula.

Getting Started

Installation

Let's start our environment for tinkering and exploring how NFT auction would work.

  1. Clone the repo first
git clone -b bonding-curve https://github.com/austintgriffith/scaffold-eth.git bonding-curve
cd bonding-curve
  1. Install dependencies
yarn install
  1. Spin up local chain
yarn chain
  1. Deploy Contracts
yarn deploy
  1. Start React frontend
yarn start

Introduction

What is a Bonding Curve ?

download

A Bonding curve is a mathematical curve that defines a relationship between price and token supply, basically as a the supply of a token increases the it's price increases as well hece the price of nth token will be less than n+1th token and so on.

So in a nutshell

token price = (supply)^2

Mechanism

During the deployment when the Smile Contract get's deployed there is small 0.0001 eth to set the reserve amount which is required as per the Bancor Formula.

Further on as user lock in eth they get 😃 Tokens minted and the price increases with the supply and vice-versa if the user burns the token.

Price Sensitivity

As mentioned below Purchase Return is basically the number of 😃 Tokens you get when you lock in your ETH, now this and Sale Return depend on mainly on reserve ratio

which mainly in mathmatical terms is:

Reserve Ratio = Reserve Token Balance / (Bonding Curve/Continuous Token Supply x Bonding Curve/Continuous Token Price)

qYnG26I

The diagram above shows some examples of bonding curves with different Reserve Ratios. In the bottom-left curve with a 10% Reserve Ratio, the price curve grow more aggressively with increasing supply. A Reserve Ratio higher than 10% would flatten towards the linear top-right shape as it approaches 50%.

Currently the reserve ratio is set to 30 %

Mathmatical Formula

  • Purchase Return The Amount of SMILE (😃) Token’s you get after you lock in eth is calculated as:
Purchase Return = SMILE Token Supply * ((1 + ReserveTokensReceived / ReserveTokenBalance) ^ (ReserveRatio) - 1)

  • Sale Return The locked in eth you get back based on the amount of SMILE (😃) token's you choose to burn and the current price at that point it is calculated as:
Sale Return = ReserveTokenBalance * (1 - (1 - SMILE Token Received / SMILE Token Supply) ^ (1 / (ReserveRatio)))**

Branch UI Walkthrough

Firstly, get us some funds using local faucet.

mint

Mint the 😃 tokens by selecting the amount of eth you want to lock-in.

burn

Burn a specific no of 😃 tokens

transfer

Transfer your 😃 tokens to someone else

Contact

Join the telegram support chat 💬 to ask questions and find others building with 🏗 scaffold-eth!

About

test for bonding curve

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors