Bonding Curve Math
We apply a constant product formula like
but with virtual ETH and virtual tokens. This is done because a constant product formula doesn't work when one reserve is 0. And as the bonding curve starts with 0 ETH (and can also finish with 0) we needed to add some virtual reserves to it. This means that the actual formula to calculate how many tokens we receive for how many ETH is following:
where T are the Tokens we receive, ( T_v ) are the virtual Tokens, ( E_v ) the virtual ETH, and E the actual input ETH (after fee deduction).
Similarily for a sell you update the forumula simply to:
In our case we start with a virtual supply of 1,073,000,000 tokens and 30 virtual ETH. The ETH and virtual ETH are multiplied with following numbers:
as
Last updated