Introducing WeiDai’s first burn Dapp: the Behodler token swapper!

Justin Goro
Behodler Liquidity Engine
7 min readMay 19, 2020

--

If you’ve visited the WeiDai dapp recently you might have noticed that the redeem rate has ticked up a bit since the beginning of the year. This is because the first of the WeiDai burning dapps has finally been deployed to mainnet after a good deal of stress testing (which includes responding to and protecting against a series of malicious miner attacks!). One of the side effects of all this mainnet testing has been a fair amount of WeiDai burning. This dapp offers users a number of benefits, especially early adopters and HODLers so read on to find out exactly how you can benefit from using it.

What is Behodler?

New button for token swapping!

Behodler is a token swapping contract similar to Uniswap. However, unlike Uniswap which creates a new contract for each trading pair, Behodler is a single omnischedule token bonding curve contract. Future articles will get into the weeds of what that means but in this article, we’ll focus on what Behodler does. Behodler accepts any token belonging to a pre-approved list. Right now that list is hardcoded but in the future the process of adding tokens will become further decentralized by tapping into Kleros token lists. At the time of writing this list is

WeiDai, 
Dai,
Orchid's OXT,
Kleros's PNK,
Eth,
Link,
Loom,
Wrapped Bitcoin aka WBTC,
Maker's MKR,
Brave Browser's BAT
Behodler's liquidity token aka Scarcity (SCX)

The first thing you should notice is that you can now exchange WeiDai directly for Dai or any of the other tokens. Previously, if you wanted WeiDai, you’d have to incubate Dai and claim it. This creates a perfect time arbitrage market between the patient and impatient. Those who can bear the incubation period and create WeiDai can sell it at a premium to those who can’t bear the wait.

WeiDai burning

Whenever Weidai is swapped for another token, a portion is set aside as a fee and burnt. Furthermore, whenever Dai is swapped, a portion is set aside as a fee, wrapped into WeiDai and burnt all in the span of one transaction. This means that regular trade of Dai and WeiDai will increase the WeiDai redeem rate!

Pricing and liquidity

The second thing that should stand out is that Behodler has a single liquidity token unlike Uniswap which issues a separate token for each trading pair. Whenever you send one of the tokens to Behodler, Scarcity (SCX) is issued to the user according to a token bonding curve. When you send Scarcity back to Behodler, it is burnt and you can signal which token you wish to receive in return. Each token has its own token bonding curve which means each token has its own price in Scarcity. This is where the omnischedule part of the description comes in. So how does swapping work? Suppose you want to swap some OXT for LINK. You’d send OXT to Behodler and receive X scarcity. You’d then use the scarcity you receive to send back to Behodler and request LINK. The scarcity is burnt and you receive a certain portion of LINK. The scarcity price of OXT increases and the Scarcity price of LINK declines as a result of the trade. In the Uniswap world, they’d call this effect “price slippage”.

Similar UX feel to Uniswap for familiarity

To avoid the schlep of going through Scarcity each time you wish to swap two tokens, a helper contract has been deployed which composes the whole operation into one transaction: Input token in — > Scarcity Out — >Scarcity In — > Output token out. This way users can swap tokens without even knowing about Scarcity.

If you wish to add liquidity to Behodler, the way you’d do it is by setting the output token to Scarcity. To trade in your liquidity token, you’d set the input token to Scarcity:

Trading directly for Scarcity uses less gas since it’s the most basic operation in Behodler

Fees, Rewards and Pyrotokens!

Behodler introduces special ERC20 reward tokens called Pyrotokens. Every token traded on Behodler has a corresponding Pyrotoken. For instance, OXT has PyroOXT, Kleros’s PNK has PyroKleros etc. Pyrotokens are trading rewards issued on every trade.

The Pyrotokens are wrappers that have a set redeem rate. As the name suggests, Pyrotokens can be burnt which increases their redeem rate. Like WeiDai, the redeem rate of a Pyrotoken can rise but it can never fall. In a generic sense, WeiDai is the Pyrotoken of Dai. So how do you get your hands on Pyrotokens?

Whenever you sell a token into Behodler, a fee (currently 2.4%) is levied. The fee is wrapped into the corresponding Pyrotoken. Half of it is burnt to push up the redeem rate. The remainder is given to you as a trading reward. This creates the perfect early adopter reward scheme. Suppose you receive some PyroLINK at a redeem rate of 1 PyroLINK = 0.02 Link. You go away for a month and in the mean time, some high frequency arbitrage bots have been trading away on Behodler, exploiting differences in price between Behodler, Kyber Network, Uniswap etc. Their incessant trading of LINK leads to frequent burning of PyroLink and when you return, the PyroLINK redeem rate is now 0.1. You’ve experienced a five fold increase in your PyroLINK without doing anything!

Pyrotokens are the HODLer’s token since mere trading volume leads to growth in value, taking a lot of the downside risk out of HODLing your favourite tokens.

The Behodler provides a Pyrotoken tab that allows you to redeem your pyrotokens

In the image above, the current redeem rate of PyroKleros is 0.0575. This means that when I wish to redeem 100 PyroKleros, I’ll receive 5.75 PNK.

Fees and Liquidity growth and more user rewards!

Uniswap charges a small trading fee to grow the liquidity pool of each trading pair and increase the value of the liquidity token as a reward to liquidity providers. The corresponding mechanism for Behodler occurs when you sell Scarcity back into the contract. A small fee is levied and burnt. The remaining Scarcity is then used to redeem the token in question. This small friction leads to gradual growth in the pool of ALL tokens. The value of Scarcity rises in this way because the amount of any token that Scarcity can be redeemed for gradually increases with every trade. Unlike the Uniswap token, there is no long term impermanent loss. Instead, frequent trading will gradually grow the liquidity base and increase the value of the Scarcity token as measured in the basket of underlying tokens.The economics of how this works will be elaborated on in upcoming articles. So the second early adopter reward mechanism is to simply buy some Scarcity and hang on to it. Over time, the pool of Scarcity will shrink relative to growing pools of tokens. This is why the liquidity token is called Scarcity because scarcity is a driving force in market transactions and trading on Behodler increases the relative scarcity of Scarcity.

High gas and high fees

Technical users will notice that a token swap on Behodler uses more gas than on Uniswap. The purpose of Behodler isn’t to be as good for low volume, high frequency trading as Uniswap. Instead Behodler is designed with a number of goals in mind, including:

  1. Reward users with tokens that grow in value over time (Pyrotokens), eventually compensating them for gas usage.
  2. Create a liquidity token (Scarcity) that grows in value over time so that it could be used as a basis for future dapps (eg. collateral for a stablecoin).
  3. Create a single contract that can “see” all prices at once. Behodler stamps the price of every trade into a recording contract which keeps a moving average to provide a token price oracle that is resistant to flash loan style attacks.
  4. A dapp that burns WeiDai with regular usage. This evolves WeiDai from a stablecoin wrapper into a true thriftcoin.
  5. A portal for impatient users to get their hands on WeiDai without having to first incubate Dai.
  6. A sink for Weth and thereby a sink for Eth. The importance of the Ethereum ecosystem endogenously creating sinks for Eth cannot be overstated.

Warnings and Disclaimers. Please read before using Behodler.

Please consult legal experts if you suspect that Behodler or anything in the WeiDai ecosystem is forbidden in your jurisdiction. Although it has been as thoroughly tested as can be conceived and that all the precautions and best practices of Ethereum development have been taken into account, Behodler is still in beta and should be treated with caution. Finally, beware of front running miners. Like Uniswap, Behodler has guards in place to ensure minimal price slippage. When I turned these guards off during testing on mainnet, the miners immediately began front running Dai swaps. They seem to run scripts that look out for easy arbitrage opportunities and will delay your transaction being included in a block in order to make the same transaction first. If you notice your transactions failing, open the transaction in Etherscan and check to see if the error message says something about price slippage. This probably means that a miner delayed your trade in order to get ahead in the queue. If you’re a dapp developer, always keep in mind that miners can order transactions within a block according to their own discretion.

Why the name?

In Dungeons and Dragons there’s a monster called the beholder. It has eyes on many tentacles that be moved to see in all directions but one central head. The Behodler token swapping contract has many token bonding curves (tentacles) which can ‘see’ the price of all the tokens and one central token (Scarcity) through which all tokens are priced. In addition, the Scarcity fees mean that over time the pools of token reserves grow, meaning that this contract is a sink for those tokens. Or in cryptocurrency parlance, it HODLs those tokens. Putting those two concepts together: Beholder + HODL = Behodler.

--

--