# Advanced Bonding Curves

In our previous examples of bonding curves, we have assumed that no base tokens enter the reserves and no target tokens are burned without taking from the reserves. What if we want to set a relationship between the target supply and reserves that always holds, even in these situations?

This situation is called a Sponsored Burn, which you can read more about here

## Invariant Pricing

Let's take an example bonding curve with price, $P$ dictated by:

We can define $R$, the amount of `Base`

tokens stored in the reserves as the area under the curve up to the current supply:

Therefore, taking the indefinite integral, we can say the reserves are

Now, what happens when we inject `Base`

tokens into the Reserves?

This causes all holders to see an increase in value of the token. Our formula above does not account for this possibility in pricing. So how do we support this model?

Given the `Reserve`

function

We say that the `Reserve`

is always proportional to the `Supply`

in a relationship that should never change.

Holding this invariant proportion, if we increase the reserve by some amount $\Delta R$, the increase in supply $\Delta S$ should maintain this formula:

##### Solving Equations

We will not walk through solving the following equations, as we solved them with the aid of computers

Solving for $S$, we can say that given some amount of the base token of the curve $R$, the target tokens we get back should be

Likewise, solving for R, we can say our price for some amount of target tokens S is

Worth noting is that both of these equations fail for R = 0 or S = 0. When this is true, we revert to the base pricing formula of

Where c is a constant that will help set the slope of the initial curve, and thus the initial price.

## Changing Curves

The above math has one interesting property. We can define a curve in terms of a price relation, current `Reserve`

, and current `Supply`

. This means that, without changing tokens, we can change the shape of our curve. The new invariant will be satisfied for the new curve, and any future purchases or sales will need to follow the new invariant.

## Royalties that go back to Holders

A powerful model that comes from this feature is having a way to reward all token holders. A simple way to see this at work is to put a 5% buy and sell royalty in terms of the `Base`

token that goes back into the `Reserve`

.

This setup allows holders to improve their position via transaction fees, encouraging circulation of the token.