Search…
⌃K

# Whitepaper

Disclaimer: this is a working paper subject to future revision

## Introduction

Automated market makers (AMMs) on Ethereum are contracts that provide liquidity for token swaps while using relative levels of liquidity to establish clearing prices. For a given market, traders exhibit a demand for underlying liquidity, and trade volume relative to liquidity reflects this implicit demand. In an attempt to meet this demand, AMMs offer a share of trading revenue to providers of liquidity. Since token pairs are balanced at equilibrium, price divergence creates arbitrage opportunities to rebalance the pair. In particular, when a token price rises relative to the other token, it is swapped out in favour of the lower value token. This reduces the value composition of the token pair. For a liquidity provider, simply having held the tokens separately would have yielded a better return. This category of opportunity cost to liquidity provision is known as impermanent loss. The profit function for a liquidity provider is the gain in revenue minus the impermanent loss. For token pairs that are highly correlated such as stablecoin pairs, the impermanent loss is close to zero and the revenue is relatively high. The profit function for supplying to these pairs is then almost guaranteed to be positive. Conversely, for tokens that are not correlated with other tokens exhibit fairly high levels of impermanent loss, reducing the desirability for liquidity provision. The lower levels of liquidity then further exacerbate the situation since low liquidity pairs are volatile. If this wasn't enough, low liquidity tokens also struggle to attract trade volumes since gas prices are a fixed cost. Markets that are characterized by significant fixed costs exhibit increasing returns to scale. In other words, stablecoin pairs form a sort of monsopsony over liquidity providers. For these reasons, this paper argues that the incentives created by traditional AMMs do not properly relate to the market for liquidity and as such there is an over provision of liquidity to correlated pairs and an underprovision to tokens which are based on sound fundamentals but are otherwise uncorrelated with other tokens. In particular the price of LP tokens do not reflect the marginal price of liquidity. If they did, the stablecoin oversupply would be reduced and general returns in DeFi would rise significantly.
The corresponding journal entry for impermanent loss to a liquidity providers is a trader benefitting from an arbitrage trade. If the holder of an LP token could run a script that automatically rebalances their position by essentially abitraging the composite tokens when prices diverge, then they could internalize and reverse a great deal of impermanent loss, reversing the distortion in liquidity provision created by LP token pricing. The reason they can't is because of a phenomenon known as miner extracted value (MEV). On public, open blockchains, miners have power over how transactions are ordered for inclusion in a block. Since these transactions are transparent, miners can perform a form of front running where they can inspect the result of an incoming transaction and if the return is high, simply replace the transaction with an identical version but with their signature. For this reason, any large scale attempt to create an autorebalancing LP token would be seized upon by miners. The status quo then reflects a misallocation of capital and correcting it would require marginal liquidity pricing and MEV capture by liquidity providers. Such a correction to the liquidity provision market would result in an overall benefit to the entire DeFi economy.
Behodler is a protocol centered on an AMM aimed at creating a true market for liquidity, both by pricing liquidity correctly and be offering numerous mechanisms for users of Behodler to recapture MEV. The liquidity token, Scarcity (SCX), differs from traditional LP tokens in that it is also the medium of exchange for all swaps on Behodler. While the price of LP tokens is simply the combined price of the constituent token balance, Scarcity's price represents the marginal value (or price) of the underlying liquidity, creating the necessary incentive for liquidity providers to match demand by traders for liquidity. While Scarcity clears the market for liquidity supply and demand for a given level of liquidity on Behodler, the broader goal of Behodler is to offer a corrective mechanism for liquidity provision to all of DeFi and to do so in a way that channels a portion of this gain to traders on Behodler and holders of Scarcity. In order to achieve this, Scarcity burns on transfer. Since the price of Scarcity is determined algorithmically, burning the supply guarantees a future price rise. The majority of Scarcity burning happens on external AMMs such as Uniswap and mostly by arbitrage traders. For every trade of SCX on Uniswap, the burned portion represents a taxation on arbitrage traders and since arbitrage is dominated by miners, Scarcity burning effectively redistributes MEV from token pairs back to users of Behodler. Because MEV is the corresponding journal entry for impermanent loss on an AMM, Scarcity burning effectively offers a DeFi wide corrective mechanism to capital misallocation created by incorrectly priced LP tokens. This process of capturing MEV through regular trade of Scarcity outside of Behodler is a process known as automining and forms a key pillar in accelerating the advance of Behodler's role as a market for clearing liquidity demand and supply.
This paper charts a technical outline of all of the moving parts of Behodler, while weaving together the theory of marginal liquidity pricing and highlighting how every aspect of the protocol, including governance, is designed with the express purpose of recapturing MEV and hence correcting liquidity pricing and misallocation across DeFi.

## The Core of Behodler

While the positive externalities created by Behodler lend themselves to be exploited by downstream ecosystem dapps such as Limbo and Bonfire, the core protocol begins with the AMM. Understanding the working parts of the core assists in fleshing out the purpose of Behodler.
Behodler AMM is comprised of three main parts:
1. 1.
The BehodlerAMM/Scarcity is one contract and houses all of Behodler's tradeable liquidity. Combining Scarcity and Behodler means that no transfers of Scarcity occur within Behodler. Instead, all internal SCX operations involve minting and burning, saving on gas and ensuring that MEV is only recaptured from sources external to Behodler.
2. 2.
Lachesis, named after an ancient greek goddess of fate, is the contract that gatekeeps which tokens can be listed on Behodler. Since all liquidity is housed in one contract, Behodler is vulnerable to scam tokens which give unbounded admin minting rights. Lachesis maintains a register of trustable tokens. In the short run, governance will ensure that only legitimate tokens are listed on Behodler. In the longer run, a secondary market for legitimacy can be created to allow permissionless token listing on Behodler where untrusted tokens are bonded with the governance token which is burnt in the event of suspicious activity.
3. 3.
Pyrotoken Reserve: Burning is not a requirement of the ERC20 standard which means that while many tokens are burnable, most by design and intention, are not. When listed on Behodler, burnable tokens such as Maker can be registered as burnable. On every swap, a fee is levied on burnable tokens and burnt. This provides a deflationary service to the holders of the burnable token. For tokens which are not burnable, the fee is sent to a burnable wrapper token called a Pyrotoken. Any holder of a token can mint its corresponding Pyrotoken at a prevailing redeem rate. Whenever the pyrotoken burns, the redeem rate automatically rises. This instantly transfers the effect of a burn to holders similar to a reflect token. Recall that impermanent loss is the comparison between an LP's token composition and the result of just holding the underlying tokens. Pyrotokens amplify this discrepancy by creating a greater incentive to HODL. The burning of input tokens on Behodler creates an automatic incentive for communities to route trade through Behodler and the existence of Pyrotokens acts as a incentived marketing instrument, a cryptocurrency referral fee for using Behodler. Holders of Pyrotokens are not only encouraged to avoid instruments subject to impermanent loss but have an incentive to attract more usage of Behodler since trade of the underlying token amplifies the value of their Pyrotokens. Finally, Pyrotokens play an important part is promoting automining of SCX. Recall that token pairs containing SCX recapture MEV from external AMMs. Something like Pyro(SCX/USDC) would amplify the incentive to mint SCX/USDC LP token.

## The Philosophy of Behodler

In response to the misallocation of liquidity pricing in the broader Ethereum ecosystem, many AMMs have sought to double down on the oversupply of stablecoin liquidity by offering improved returns for correlated token liquidity provision. Uniswap V3's concentrated liquidity and Curve's bounded curvature of swaps are such examples. Behodler, by contrast, seeks to correct the pricing of liquidity in DeFi so that the allocation of capital is closer to the economic optimum. Understanding how this is achieved requires a deeper understanding into the nature of liquidity while paying careful attention to how Behodler relates to this. The first part of this section justifies the choice of bonding curve algorithm employed by Behodler, after which a theory on liquidity markets is posited. It concludes by explaining how Behodler acts as a true market for liquidity pricing at the margin.

### Pricing in SCX

Consider a fictional version of Behodler with only two tokens listed, DAI and Eth. Assume also that the price of Eth on the open market is 2000 DAI. Suppose we add 1 unit of DAI which mints 10000 units of Scarcity (SCX) and that the next unit of DAI mints 9999 units of Scarcity. This implies that the first unit of SCX costs (1/10000=) 0.0001 DAI while the second costs (1/9999=)0.00010001 DAI and the third costs 0.00010002. Conversely, if there are 10 units of DAI in Behodler already (which implies the next unit of Scarcity costs 0.0001001 DAI) then we can redeem DAI by sending SCX back into Behodler. The previous unit of SCX costs 1/9991 DAI or 0.00010009 DAI. So with 1 unit of SCX we can redeem 0.00010009 DAI. The nature of Behodler is such that the supply curve of Scarcity is the same for all tokens. Behodler has no notion of relative token values so the first unit of Eth in this example will also create 10000 SCX. If the number of units of Eth and DAI stored in Behodler are the same, this implies the SCX price of both is equal. This position is unstable since a trader can provide 1 unit of DAI, receive some SCX and then redeem 1 unit of Eth with that SCX, implying a trade of 1 Eth for 1 DAI. In a situation like this, traders will keep adding DAI to Behodler in order to redeem Eth. As the levels of DAI rise, the SCX price of DAI will rise. That is, the amount of SCX that each additional unit of DAI can generate will fall. Similarly, as Eth is withdrawn, the amount of SCX that additional units of Eth can generate will rise. The result will be a gradual slipping of relative price between DAI and Eth until their relative prices reflect their true prices.

#### Choosing the best bonding curve formula

The choice of bonding curve minting formula has an impact on the scalability of Behodler. To understand how liquidity scales, consider a version of Behodler that mints SCX along a linear supply function of P=Q for a token, T. What this means is that the price of the next unit of Scarcity is equal to the existing circulating supply of Scarcity so that the very first unit of SCX requires 1 T,the next unit requires 2 and so on. The total T in reserve is the integral of the price curve (denoting quantity of SCX with s),
$\int s \,ds \ = \frac{1}{2}s^2 + C$
$\implies T = \frac{1}{2}s^2 + C \tag{1}$
For a bonding curve, there is no initial Scarcity at T=0 so for the purposes of this analysis, assume C=0. The supply function of Scarcity in terms of T is
$S = \sqrt{2T}$
If liquidity is added to Behodler, it generates a change in Scarcity such that,
${\Delta}S = \sqrt{2T_E} - \sqrt{2T_S}$
where subscripts E and S represent end and start of a transaction respectively.
Suppose we wish to perform a swap of token T for token U. The roundtrip process is to mint SCX with T and then redeem that SCX for U. A swap then occurs where the SCX created by depositing T is equal to the SCX required to redeem U:
$\sqrt{2T_E} - \sqrt{2T_S} = {\Delta}S = \sqrt{2U_S} - \sqrt{2U_E}$
$\implies \sqrt{2T_S} + \sqrt{2U_S} = \sqrt{2T_E} + \sqrt{2U_E}$
We can drop the common square root of two factor to get:
$\sqrt{T_S} + \sqrt{U_S} = \sqrt{T_E} + \sqrt{U_E} \tag{2}$
This says that the sum of square roots of liquidity before a swap must equal the sum of square roots of liquidity after a swap. This is linear Behodler's version of the constant product formula pioneered by Uniswap, except that this is a constant sum formula. To see why, recall Uniswap's invariant is
$xy = K$
where x and y are liquidity levels after a swap. However, K is simply an xy from a previous swap. So using the notation from the previous analysis, the constant product formula can be re-written as
$T_{S}U_{S} = T_{E}U_{E} \tag{3}$
Returning to linear Behodler, at the margin, the price of Scarcity in terms of token, T is given by
$P_{SCX_{T}} = \frac{d}{dT}S = \frac{d}{dT}(\sqrt{2T}) = \frac{\sqrt{2}}{2\sqrt{T}}$
To calculate the relative price of token T and U at the margin, take the ratio of their marginal prices:
$\frac{P_{SCX_{T}}}{P_{SCX_{U}}} = \frac{\sqrt{U}}{\sqrt{T}} \tag{4}$

## The dApp Ecosystem Made Possible by Behodler

The value recaptured from MEV in Behodler through Scarcity and Pyrotokens can be put to work and amplified. Furthermore, we require a mechanism to sustainably expand the list of tokens while providing strong incentives for token holders to migrate to Behodler.

### Limbo

As mentioned in the previous section, the Law of Uniform Tentacle requires tokens traded on Behodler be preseeded with liquidity equal to the average value of existing bonded tokens (AVB). As SCX grows in popularity, liquidity will naturally rise in Behodler (a process known as automining) and as this occurs, the capital requirement for listing new tokens on Behodler rises. Limbo is a farming dapp that provides rewards to stakers of unlisted tokens. When the threshold requirement for listing on Behodler of staked tokens is exceeded, staking and withdrawals are locked, and the staking users are given a once off migration reward in return for their tokens.
The rewards issued to users are via a new token, Flan. The purpose of Flan is to smooth the distribution of SCX to prevent early bird attacks. When a new token is listed on Behodler via Limbo, it generates SCX. Some of this SCX is burnt. Half of the remainder is used to purchase Flan on an external AMM such as Sushi- or Uniswap. The remainder is pooled with the purchased Flan and the LP tokens generated are permanently locked in a 'blackhole' contract. As SCX rises in value, the value of Flan will naturally rise. If SCX represents the marginal value of liquidity on Behodler, Flan more closely resembles the average value of liquidity which makes it far less volatile than SCX and more appropriate as a reward token for staking.

#### Initial Token Listing through Limbo

In addition to high cap tokens, promising projects may wish to list on Behodler, first via Limbo, similar to Sushi's Onsen program. A token that successfully lists on Behodler benefits from attracting the average value bonded (AVB) worth of tokens into Behodler. As this number grows, the incentive to list on Behodler grows. This provides an avenue for near instant high liquidity without having to create a mining event.

### Bonfire

Flan is issued at a fixed rate per block and it is distributed on Limbo according to the allocpoint system pioneered by Chef Nomi in MasterChef.sol. This opens up a number of opportunities to create positive feedback value loops on Behodler by opening new streams of Flan rewards without inflating the token supply. Bonfire is a simple dapp that receives an ongoing stream of Flan, building up a reserve which can be used to provide an incentive to burn SCX, EYE and any other burnable token. Indeed, Bonfire acts as a secondary market for adding value to a project token. Deflation-as-a-service.

### Pyrotokens

Pyrotokens are burnable wrappers of non burnable tokens that trade on Behodler. Pyrotokens have a prevailing redeem rate with their reserve token. When pyrotokens are minted or redeemed, the redeem rate specifies the exchange rate between the pyotoken and its base token. The redeem rate is dynamically calculated as the quantity of reserve tokens divided by the total supply of pyrotokens. This means that burning automatically raises the redeem rate. The redeem rate can rise but it can never fall. This makes Pyrotokens an excellent, zero risk instrument for holding the base token. A Pyrotoken has 2 common points of burning:
1. 1.
When a pyrotoken is transferred, 0.1% is burnt
2. 2.
On redeem, a 2% exit fee is burnt.
The transfer fee ensures that when listed on external AMMs, pyrotokens will rise in value through random walk trade. The exit fee insulates the holder from sudden market downturns. If the base token is dumped, holders of the Pyrotoken may wish to redeem their base token in order to sell. Those who redeem first will increase the redeem rate for those remaining. The offsetting burn on exit blunts the downswing for those who remain holding.

#### Pyrotoken as a marketing device

Since a portion of trade revenue is redirected into Pyrotokens, holders of pyrotokens have an incentive to increase the popularity of Behodler without needing to be exposed to Scarcity, Flan or EYE. This creates a powerful incentive for risk averse users who may wish to hold only Eth (in the form of PyroWeth), yet still benefit from Behodler. Project founders who wish to list their tokens on Behodler, have an incentive to list their token as burnable in order to add a deflationary impact to their token. However they may also wish to have an LP of their token listed in order to create a PyroLP token.

#### Automining

Pyrotokens of LP tokens that contain SCX such as SCX/ETH on Uniswap create an incentive to offset impermanent loss while holding the underlying token, partly offsetting the distortion in LP pricing. Since PyroSCXETH would increase demand for SCX/ETH, more SCX would be drawn into Uniswap, creating more SCX burning as liquidity depth encourages large transfers. Residual liquidity on Behodler is defined as the difference between SCX's true total supply and what the token balances on Behodler imply it should be. In other words, the token balance calculated method is what SCX's total supply would be had no burning ever occurred. The difference between true total supply and 'unburnt' total supply represents a portion of SCX that can never be redeemed. This discrepancy is called residual liquidity and every burn of SCX increases residual liquidity.

#### A Market for DeFi composition

One of the reasons layer two and pseudo layer two platforms are desirable to DeFi users is that they allow for quite exotic combinatorial strategies to be employed at almost no cost. For instance, autocompounding a staked LP token involves harvesting the yield token, purchasing both underlying assets on an AMM, pooling those assets and then staking them. On mainnet, such an operation could involve quite a large upfront gas expense. Similarly, migrating LP tokens between AMMs can produce prohibitively high gas costs, siloing low value users. Services such as Zapper have emerged which attempt to bundle and optimize these operations to the best extent possible. Behodler offers a route for composing complex DeFi strategies at a gas cost less than a Uniswap trade. There are three pillars to this strategy:
1. 1.
Tokenized locking: Whenever a protocol locks an asset, the unlocking/locking mechanism can be abstracted behind a redeemable ERC20 token. For instance, liquidity staked on an AMM is locked and the AMM then provides a token to unlock. This rule can be generalized without limit. If there's a DeFi strategy that returns a yield for locking funds, that strategy can be wrapped into a token by any third party. Once that token is created, the embodied strategy can be traded on an AMM.
2. 2.
Low Gas AMM: Wrapping and unwrapping LP tokens can be fairly gas intensive since there are multiple transfers between external contracts as well as state updates occurring. Swapping LP tokens is no more expensive than swapping a regular ERC20 token. By providing a low cost AMM, traders wishing to exit an LP position for one token such as Eth can perform a simple swap out of their LP on Behodler. Behodler therefore offers a generalizable zap function for any DeFi strategy. By tokenizing strategies and listing them on Behodler, both users and third party dapps can enter and exit popular DeFi yield strategies, while not expending any more gas than a regular swap. Indeed, there is no limit to the customizability of strategies so that even third party compositional dapps can list on Behodler and benefit from receiving immediate liquidity equal in value to the prevailing AVB.
3. 3.
Pyrotoken stacking: LP tokens cannot be infinitely composed on Uniswap and Sushiswap but being able to do so may unlock exotic properties that allow fund managers to produce products similar to Balancer. Pyrotokens offer a bridge to allow infinite protocol stacking by adding a burnable scaffold between each layer. For instance, suppose Behodler lists the popular USDT/USDC LP pair from Sushiswap. This will automatically provide PyroUSDT/USDC for minting which, by definition, will have a better return than USDT/USDC. Next, a third party dapp stakes USDT/USDC on Sushi's Onsen to receive a yield in Sushi. They then tokenize this position, creating ODollar, a tradeable tokenized version of USDT/USDC staked on Onsen which has its Sushi revenue autocompounded regularly. We then create an LP token of ODollar and PyroUSDC/USDT and list it on Behodler. For simplicity, we refer to this LP token as LP_2. Now that LP_2 is tradeable on Behodler, it automatically unlocks PyroLP_2. We pair PyroLP_2 with WeiDAI on Sushi and from that, create a new LP token, LP_3. LP_3 is then listed on Behodler which unlocks PyroLP_3. This process of stacking yield through the intermediary of Pyrotokens is unlimited and since tradeable tokens on Behodler enjoy the AVB of liquidity, there's a certain volume of trade that each layer will necessarily enjoy due to price drift, ensuring that each layer of Pyrotokens in the stack contributes to the overall yield. Pyrotokens therefore play a central role in positioning Behodler as a market for yield instruments on Ethereum.

## Governance

Complete explanations for governance and of the broader ecosystem of Behodler (such as Limbo) are beyond the scope of this paper. However, to the extent that there are cross cutting issues, these will be touched upon. A capped supply, burnable governance token, EYE, exists for Behodler which will continue to grow in prominence as the ecosystem unfolds.

### When in doubt, burn

“How much you truly believe in something can be manifested only through what you are willing to risk for it.” - Nassim Nicholas Taleb
While simple democratic voting or token weighted voting in the case of Ethereum is the easiest to understand, it is subject to many shortcomings. On mainnet, gas consumption prohibits small voters from participating in smart contract binding votes. Instead, services such as Snapshot exist for non-binding preference signalling. In the case of Behodler governance, small impact decisions that require community input are handled through quadratic voting on Snapshot, both to offer a gas free means of voting and to amplify the voice of small token position holders. However, it does not make sense to apply the exact same approach onchain when it comes to larger decisions. Instead, the philosophy of decision making is derived from the best practices of decentralized dispute resolution drawn mainly from Kleros and the Ulex Open Source Governance Protocol and relies on a few principles, namely:
1. 1.
Skin in the game: When attempting to execute an important governance operation, the executor should be required to stake EYE (or an LP containing EYE) for a fixed period during which the decision can be disputed. A losing dispute sees the token burnt. This mechanism can be used in tandem with signalling platforms like Snapshot. For instance, if a vote is gathered on an action, an executor can stake EYE and execute the "will of the majority". If they fail to do so, the EYE is burnt. This also brings agility to governance. If an attack is underway on Limbo, for instance, the protocol can be instantly locked by providing a deposit in EYE and executing a public lock function. Unlocking the protocol is time consuming and can not be done instantly. This allows anyone in the community to prevent an exploit from being fully realized. If it was a false alarm, the community can deliberate on whether the lockdown was performed with good intentions or as an act of service denial. If the latter, the locker's staked EYE can be burnt.
2. 2.
DAO of DAOs: The application of monolithic DAOs to ecosystems does not acknowledge that different types of problems may require different forms of governance. In the case of Behodler, listing new tokens is central to security and requires careful, deliberative oversight. However, adjusting the APY of a pool on Limbo by a few percentage points does not pose an existential threat and would benefit from more lenient, agile forms of governance. The governance structure of the ecosystem is tiered so that each aspect can receive its own dedicated DAO. The first implementation of this is LimboDAO which controls governance decisions as relating only to Limbo and Flan. LimboDAO combines slow deliberative quadratic voting for infrequent but important decisions with a form of fast action governance called flash governance. Here anyone can stake a large portion of EYE and immediately execute a list of predefined governance operations. Rather than being based on token weights, LimboDAO awards non-transferrable voting points based on staking EYE. The votes can also be acquired by burning EYE. This latter option is a way to veto an important decision that isn't subject to flash governance.
3. 3.
Progressive Decentralization: Since the vast majority of EYE is on the open market, Behodler's governance incentives need to account for divergent preferences from interests possibly not aligned with the community. As such, decentralization must happen responsibly and rigorously so as to protect the protocol. A core tenet of good blockchain governance is to keep as much offchain as possible and Behodler's record of strong community engagement will remain a central pillar of governance, regardless of how sophisticated onchain DAOs become.

## Conclusion

The failure to price liquidity correctly in modern AMMs has lead to an ecosystem wide distortion in the deployment of capital for the purposes of creating liquidity. This distortion reduces growth in the DeFi economy and distorts the nature of new startups in favour of stablecoin yields. By pricing liquidity at the margin, Behodler offers an AMM solution to this distortion. As a secondary benefit, miner extracted value (MEV) is recaptured and embodied in the value of the deflationary liquidity token, Scarcity. By combining low gas consumption with primitives for high yield composition (Pyrotokens), Behodler can act as a yield instrument clearing house for users and third party dapps in DeFi. Finally, by tying all liquidity into one contract, Behodler offers new projects the prospect of an initial token offering service that guarantees instant, high liquidity. Bringing these three value propositions together will position Behodler as the source of a new wave of growth in DeFi innovation centered around fundamentals rather than impermanent loss aversion.