Behodler AMM
v2 Smart Contracts
Behodler AMM orchestrates trades using an omnischedule bonding curve.The name is inspired by the Beholder of D&D, a monster with multiple arms ending in eyes peering in all directions.
The Behodler is a smart contract that can see the prices of all tokens simultaneously without need for composition or delay. The hodl part of Behodler refers to the fact that with every trade, the liquidity of the respective token held by Behodler increases.
Behodler v1 demonstrated the utility of omnischedule token bonding curves in creating an AMM. The bonding token, Scarcity (SCX) became a medium of exchange to facilitate trading. In Behodler v2, 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 and O is for output token.
Therefore, 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.

Smart Contracts:

Contract
Description
Behodler
Behodler AMM orchestrates trades using an omni schedule bonding curve
Lachesis
Lachesis, one of the three Moirai, the inflexible, decides which tokens are active within Behodler.
Scarcity
Scarcity is the bonding curve token that underpins Behodler functionality. SCX burns on transfer and also exacts a fee outside of Behodler.
WETH10
Wrapped Ethereum implementation
Copy link