A simple guide to create your own decentralized Stablecoin with an interest yield using dYdX, renBTC and Paraswap

Azamat Malaev
HodlTree
Published in
4 min readJul 26, 2020

Sometimes being unsatisfied with the current stablecoins (DAI, USDC, USDT and etc.), you come across the need of creating your own one.

Not only is there a way to create the decentralized stablecoin, but to get it with the following benefits:

  1. Decentralized
  2. Positive interest yield
  3. Your own :)

To create it you will need only 3 components.

  1. The first component you will need is perpetual contracts on dYdX

What is dYdX?
dYdX is a decentralized trading platform that currently supports margin trading, spot trading, lending, and borrowing. dYdX runs on smart contracts on the Ethereum blockchain and allows users to trade with no intermediaries.

What are perpetual contracts?
Perpetual Contract Markets exist on the dYdX Perpetual Contracts Protocol. They are synthetic trading markets on Ethereum that allow for exposure to arbitrary liquid assets using ERC-20 tokens as collateral. More…

What are the funding payments?
Perpetual contracts are inspired by traditional futures contracts but differ in that there is no expiry date and therefore no final settlement or delivery. Funding payments are therefore used to incentivize the price of the perpetual to trade at the price of the underlying. More…

2. Secondly, you will need Paraswap

What is Paraswap?
Paraswap is a decentralized exchange aggregator that provides the best prices over multiple DEXs on the Ethereum blockchain. More…

3. And the last component of your own stablecoin is renBTC

What is renBTC?

Any asset minted on Ethereum by RenVM is a 1:1 backed ERC-20. This means that if you have 1 renBTC (an ERC-20), you can always redeem it for 1 BTC. It’s a direct supply peg. renBTC isn’t synthetic, it doesn’t rely on a liquidation mechanism, and it’s not the price of Bitcoin on Ethereum. It is a one to one representation of Bitcoin on Ethereum that can be redeemed for BTC at any time, in any amount. More…

After having figured out the main components, let’s start creating our own decentralized stablecoin.

Let’s say we have $20,000 and we want to create $20,000 stablecoins. For convenience, let’s imagine the price of Bitcoin is $10,000.

We divide our funds into 2 parts of $10,000:

  1. Open a short position on dYdX (BTC-USDC perpetual contract)
  2. Buy 1 renBTC for $10,000

As a result, we get the position:

The total value of the position will always be $20,000 + Funding payments for short BTC on dYdX.

At the moment the 8H funding rate is 0.0163% for BTC-USDC
This means if the rates do not change, during the year you will earn:

0.0163*3*365=17,84% for your short position
$10,000*0.1784=$1784

Total position size is $20,000
Total APY is $1784/20000*100=8.92%

Now you can mint $20,000 of your stablecoins against the collateral of your position.

Here is a simplified smart contract architecture allowing you to mint your own stablecoin.

Mint
1. Alice sends ETH to the smart contract
2. Smart contract make exchange ETH to renBTC & USDC
3. Smart contract open short position on dYdX
4. Smart contract mints stablecoins and send them to Alice.

Redeem
1. Alice sends stablecoins to the smart contract
2. Smart contract close short position on dYdX
3. Smart contract make exchange renBTC & USDC to ETH
4. Smart contract burn stablecoins and sends ETH to Alice

Rebalance
1. In case of the margin call on the dYdX, smart contract sells part of renBTC
2. Smart contract open a short position on the dYdX again

A smart contract needs a decentralized oracle to check the prices. (Chainlink)

This way you can create your own smart contract creating stablecoins.

Please retweet if you enjoyed it :)

Stay tuned
Twitter Telegram Website

HodlTree is a second-generation decentralized lending protocol. Our mission is to provide significantly improved interest rates for ETH & BTC with a targeted rate of around 8–20% APY and expand the list of coins in the nearest future. We are developing a decentralized solution for cryptocurrency holders where they can earn money without losing control over their coins.

The scale of a stablecoin depends on liquidity in BTC-USDC perpetual contract.
Slippage is possible.
Funding payments can be negative.

Disclaimer

The Content is for informational purposes only, you should not consider any such information or other material as legal, tax, investment, financial, or other advice.

References:
https://renproject.io/
https://dydx.exchange/
https://paraswap.io/
https://chain.link/
https://en.wikipedia.org/wiki/Smart_contract

--

--

Azamat Malaev
HodlTree

Co-founder at HodlTree. The inventor of the new data compression algorithm. Patent-pending for interest yielding tokens.