AMM for Tesla

sasha ivanov
3 min readMar 21, 2021

--

Automatic market makers really revolutionized crypto, taking it from simple value transfer to more complex algorithmic decentralized fund swaps, effectively questioning the very existence of centralized crypto exchanges. Parallel to innovation in on-chain value asset transfer we have experienced the emergence of another asset class on the blockchains, inspired by traditional finance, namely synthetic assets. In “old-school” finance you can build a basket of several derivative instruments whose value will track the behavior of any asset. Taking this idea onto the blockchains we can mirror real world assets in a decentralized way.

Of course it is of special importance to build synthetics that track stable assets, such as the US dollar. We have made a lot of progress going into that direction, with top algo stables having capitalizations in billions. Algo stable coins provide a necessary decentralized peg volatile assets can be traded against.

But it is also quite interesting to try and build volatile synthetics, tracking real world assets such as, for example, gold or Tesla stock. Besides purely theoretical reasons to do that we can bring crypto mechanisms to the world of traditional finance — for example we can create decentralized liquidity pools for on-chain assets swaps, enabling additional cash flows to asset holders.

But usually It is quite hard to guarantee liquidity for very volatile synthetic assets. Usually it is done using overcollateralization, but it still does not provide guaranteed liquidity and requires either too much funds in collateral or liquidity providers (that need to provide the funds to collateralize the asset) run a risk of losing their funds. It is really not that difficult to build a synthetic asset backed in excess by some crypto tokens, the trick is to know what to do when the synthetics grow much faster than the assets it is backed with. We might choose to liquidate the assets through a margin call or have very high over-collateral, but those approaches have obvious drawbacks.

It is suggested to take a different approach, and use on-chain liquidity pools mechanisms to issue, redeem and provide liquidity for volatile synthetic assets (VSA). Effectively we combine the world of AMM’s with synthetics. This approach is based on the observation that on average large uniswap pools such as Eth/DAI do not lose funds despite the impermanent loss. This could imply that if we could build a backing mechanism working on similar principles, LP’s would not lose their funds and could provide permanent liquidity no matter the price.

LP’s do not issue VSA directly; instead they provide liquidity to the VSA/USD pool (USD can be any USD stable coin, or we consider volatile assets as the other asset in the pair as well). Oracle (external world) VSA price is used to convert 50% of LP’s USD liquidity into a given VSA. It effectively issues new VSA in the pool. The rest of USD liquidity remains intact and added to the pool. When a user wants to buy VSA he does it in an uniswap-like way — he just swaps it out from the pool, sending USD token to it. New assets are brought to life when a LP adds funds to the liquidity pool, asset liquidity becomes the basis for asset existence itself.

The average asset purchase price is P=Po*I, where Po is oracle price, and I is a coefficient depending on the transaction volume and maybe on some other parameters, if we want to go beyond a simple Uniswap formula (for example using DODO). Asset redemption happens the same way. Since we use the external price to rebalance the pool arbitrage works differently from traditional uniswap pools, where arbitrageurs balance out the swap price in the pool according to external prices. In our setup arbitrageurs bring the pool back to balance after a large swap moved the price far enough from the oracle price.

LP’s in the pool receive swap fees and also might receive yield farming incentives. Pool liquidity adjusts itself in such a way that there’s a low risk of running out of USD liquidity that is needed to guarantee the redemption of VSA in case its price goes too high up. On top of that fees add to the pool, and slippage effectively reduces the redemption size. LP’s can withdraw their funds from the pool, in this case VSA is converted back into USD. There’s also a fine for withdrawing funds. Issued assets can also be deposited back into the liquidity pools, used for issuance, and receive trading and yield farming rewards

Stay tuned for the detailed white paper and implementation on Waves. If you are an Elon’s fan soon you’ll be able to become a LP of Tesla pool, or Dogecoin pool :)

--

--