Behodler Series #2

How Behodler swap dapp and SCX work behind the scene ?

Crypto Cheat Sheet
5 min readDec 16, 2021

Let’s explore the theory of the swaps and the liquidity token SCX to understand how Behodler fulfill its aims. If you have not yet, please first read the first part here : https://pao10.medium.com/behodler-series-a8f6e2b8cf1

Also, this article will use some concepts about constant product AMM like Uniswap. If you’re not sure about how those work, you can jump on this quick read : https://pao10.medium.com/understanding-constant-product-amm-theory-af3368183728

Token Bonding Curve (TBC) and Scarcity token (SCX) Properties

Behodler swap dapp doesn’t follow the same path as double-sided constant product AMM. Instead, Behodler leverages TBC through its token scarcity (SCX) which represents the liquidity of the dex. What does that mean?

Token Bonding Curve

Basically each token listed on the dex has its own reserve. For ex. there are currently 12 341 DAI in the DAI pool, 5.9 ETH in the ETH pool… When you swap ANY token A for ANY token B, you are going to add your token A to the corresponding reserve A and get some token from the corresponding reserve B. So the difference with Uniswap is you don’t need to use pairs anymore. You can input any token listed and get the one you want directly. Hence the adjective single-sided. How can you calculate how much token you will get in return?

“A token bonding curve is a contract that mints an output token in response to receiving an input token.” Justin Goro

SCX is what you get when you add liquidity to the DEX (when you add tokens to one of the pools). One could say that SCX is the money for liquidity. The token bonding curve determines how much SCX you will get in relation to the number of token A you input and the current position on the bonding curve representing A, which is the current liquidity of A or the number of SCX already minted by the bonding curve of pool A. So the more important the number of token A in the pool A, the further you are on the curve.

You could use any function for your TBC: squared, linear, log… Each point on the function represent the amount of SCX minted for an amount of token provided.

Behodler uses a function in the shape of log2. This curve rises very quickly at the beginning and then becomes always more flat. What does it mean ? For the same amount input, you will get a lot more SCX if you are early in the pool than if you are late. All token listed in Behodler follow the same rule. Another way to see it would be : At the beginning, the liquidity is highly needed so the protocol will pay you more for your liquidity. As the liquidity grows, it is less needed and you will earn less SCX when you provide it.

What about swaps? If you swap token A for token B it will be like adding liquidity to pool A and retrieving liquidity from pool B. The amount of token you will get will be determined by the liquidity of pool A already there and the amount of liquidity of pool B. To sum up, the place where pool A is on the curve relative to pool B. Because of some properties of log, you can price an asset A relative to asset B in Behodler (integrated oracle). If the pool of A has X token and the pool of B has Y token the price of A in B is Y/X.

SCX Token

One very important feature of SCX is how it is minted and how it is burnt. SCX is only minted when you add liquidity to behodler. It’s the only way you can get new SCX tokens. When you withdraw liquidity from Behodler, so when you swap your SCX for another token, all the SCX you give back is burnt.

On other exchanges than Behodler, SCX is a fee on transfer (FOT) token. Any time you make a transaction with it, 2% is taken. 0,5% is burnt and 1,5% goes to a reward pool that could be used in an efficient way in the future. Why would you burn SCX on transfer? Let’s imagine you mint 10 SCX putting 100 units of token A on Behodler.

So to get back your 100 units of token, you need to put back your 10 SCX in Behodler. What if after some trades on Uniswap, 5% of those SCX has been burnt ? There’s now only 9.5 SCX available. So you can only get back a part of the 100 units of token input at the beginning. The rest is forever « trapped » in Behodler creating a permanent liquidity sink for swaps and any SCX burn feeds this sink.

SCX can be seen as an index of the current liquidity on the DEX. The more liquidity per token there is, the more expensive SCX will be and vice versa. This also means that, because of perpetual liquidity, SCX can’t reach 0$ in value, and its floor will rise as perpetual liquidity rises. The more SCX burns (without redeeming liquidity) the more the floor rises and the more expensive is SCX.

Some benefits of Behodler vs Uniswap

Gas-efficient smart contract

Because of the way it is designed the smart contract that allows you to swap token in Behodler request less amount of gas for a majority of swaps than in Uniswap. To be precise, the contract is slightly more gas efficient (some percentage) vs direct pair swapping on Uniswap and is a lot more gas efficient (~40%) vs token to token not paired on Uniswap (or similar DEXes).

Listing LP tokens

Behodler can list LP tokens from Uniswap or sushi. Minting LP token on those DEXes is particularly expensive gas wise (double approve + add liquidity function). Listing those tokens, Behodler gives you the ability to swap them directly for another token, saving huge gas fees. And even better, you can transfer your liquidity from Uniswap to Sushi in just one swap (Uni LP token to Sushi LP token) which can be very interesting for farming purposes.

No impermanent loss

If we define impermanent loss as the fact of losing value providing liquidity compared to just holding, the problem in Behodler is changed. Now you lose value, if SCX price goes down. When enough tokens (let’s say ~100) will be listed on Behodler and enough liquidity per token will be added, impermanent loss should not exist anymore on Behodler. Indeed let’s imagine the level of liquidity per token is 100 and you provided liquidity for token A to get some SCX. Now some swaps happen between two tokens, and the level of liquidity is now 95 on token A. Because of arbitrage, this level will come back to 100 almost directly after and you will still get the same amount of tokens you provided. But features will also incentivize people to provide more liquidity which should boost SCX price.

Single sided = more flexibility

To provide liquidity you only need to have one token which is less restrictive.

Ethereum sink

By trapping some liquidity permanently, Behodler benefits the entire Ethereum ecosystem which needs a sink to support its price and the interest of mining: if some ETH are locked in, the circulating supply goes down and the price of ETH goes up.

This was the second part of the series on the Behodler ecosystem. We haven’t seen yet how the ecosystem plans to list more token to swap. For a deep dive to its staking and listing dapp Limbo, head over to the third part : https://pao10.medium.com/behodler-series-3-10db0ff73e3b

Thanks for reading !

--

--

Crypto Cheat Sheet

Prendre du temps pour lire et comprendre fait gagner du temps