# Exchange Equation

Last updated

Last updated

Behodler 1 demonstrated the utility of omnischedule token bonding curves in creating an AMM. The bonding token, Scarcity became a medium of exchange to facilitate trading. In Behodler 2, the basic principles remain and Scarcity still plays the same role. However, computationally expensive algorithms such as square root calculations are no longer performed on chain.

The entire calculation of the bonding curve movement is left to the calling client. Behodler simply validates the calculations were correctly performed which is computationally much cheaper.

This system of Invariant Analysis is akin to the assymetry present in proof of work where calculating the correct hash is very expensive but validating is cheap. The process of trading has been simplified into the exchange equation:

Let **b*** *be the burn fee, a ratio. Let **F = 1- b**

**_f** signifies final balance of a token held in Behodler at the end of a trade.

**_i** signifies initial balance of the token.

**I** is input token*.*

**O** is for output token.

So **I_f** is the final balance of input token.

The exchange equation is then:

$√F(√I_f - √I_i) = (√O_i - √O_f)/(F)$

Because fees are levied on both Scarcity and Input in the implementation, the presence of F on both sides of the equation is not simplified.