Here at DDEX, we’re super excited about all of the exciting work going on in the world of Decentralized Finance (#DeFi FTW!). From simple spot trading through the Hydro Swap widget, to derivatives on Market Protocol, to bundling tokens and creating indexes on Set Protocol, there’s just so damn many cool new tools that have emerged in 2018 and are enabling new types of financial transactions all over the world.

Today, we’re going to look at one of the fastest growing pieces of this ecosystem, MakerDAO and DAI. I’m going to show you how to use MakerDAO to create a decentralized loan and generate DAI, and then use that DAI to buy Eth or your favorite tokens on DDEX.

This is what is called “leveraged trading.” Normally, for traders to be able to do this they have to go through extensive sign-up processes and/or KYC. What’s more, unfortunately many of the centralized exchanges who offer leveraged trading in the crypto world don’t exactly have the best reputation. Fortunately, with the power of decentralized finance, you can do it without any sign-up, login or KYC, AND you can do it all directly from your Ethereum wallet without any fear of hacks or other issues associated with centralized, custodial exchanges. Even better, the current stability fee on a MakerDAO Collateralized Debt Position (CDP) is 2.5%, which is very competitive compared to most loan rates.

Sounds awesome, right? But before we get started, just let me quickly note that the below process is what you can expect with the current version of MakerDAO. With the incoming release of Muli-Collateral DAI, this process will change slightly — once it does, I’ll update this post with the new process. With that in mind, let’s get going.

What you’ll need to begin:

Some Eth

The Metamask Browser Extension or a Mobile dApp Browser (like Coinbase Wallet or Trust Wallet)

A plan for using your sweet, sweet leverage (i.e. an idea of what assets you’re long on)

I’ll be walking you through the steps on desktop, but they should be roughly the same if you’re using a mobile device. Still have questions after going through the process? Feel free to ask in the comments below or ping me @atyreefinch on Twitter any time.

Before we get too far in, let me make it clear that opening a loan with collateral — and especially collateral that is as volatile as crypto — always involves risk. If your loan ever gets close to it’s liquidation point (more on that later), you can always add more collateral to help protect it. But if you’re not watching closely or if you have no more Eth to add, there is absolutely a possibility that a big chunk of your funds can be lost.

With that in mind, let’s walk through the steps.

Visit https://dai.makerdao.com/ . You should see a dashboard that looks like the one above. Wrap your Ether to get WETH, AKA Wrapped Eth. Just like trading on any 0x Relayer, WETH is required for to interact with MakerDAO’s smart contracts (and multiple other dApps in the DeFi ecosystem). It makes your Eth ERC-20 compliant and able to do some fun things. Next, you’ll need to swap your WETH for PETH. PETH, AKA “Pooled Eth”. I won’t spend too much time on this, because the PETH requirement will be going away soon with Multi-Collateral DAI anyway. The main thing you need to know is that A) PETH helps keep the system stable, and B), in the event in a sudden “black swan” drop in the price of ETH, your PETH holding could be negatively impacted. There are some positive reasons to hold PETH too and if you’re interested in more information on the topic and how it will change with Multi Collateral DAI, I encourage you to read this post. Open a new CDP by hitting “Open Your CDP” button (in the lower left). Once it is created you can now see it in your “My CDP” section. Before you can get that luscious leverage though, you’ll need to lock your PETH into your CDP. After locking you can now “draw” the amount of DAI you would like to receive. This can be up to 2/3rds (66%) of you collateral, however I would personally never do anything more than 40% of my collateral to give myself some leeway and decrease risk of liquidation. I’m maybe a bit more risk averse than others though, feel free to create a loan that your comfortable with, you just need to know how to minimize your liquidation risk.

Your liquidation point is determined by the value of your collateral in USD. If it hits that point, your collateral is forced to rebuy DAI you’ve drawn from the CDP, and you may lose a good chunk of your assets in the process. Fortunately if things are going against you and the value of your collateral starts approaching its liquidation point, you can always add more collateral to prevent liquidation. With this in mind it is very important to always know when your collateral will be liquidated. Fortunately this is fairly easy to calculate — your CDP will be liquidated if the value of your collateral in USD hits 150% of the value of your loan.

For example, let’s say I took a $300 in DAI loan with 5 PETH as collateral and ETH is currently worth $200. 150% of $300=$450. In order for the value of my collateral of 5 Eth to drop down to $450, Eth would need to fall alllll the way down to $90 before I got liquidated. That seems pretty safe! So let’s move on. Complete the CDP process by using the draw command and receive DAI. Congratulations! You’ve just gotten your first trustless loan! Now, let’s take it over to DDEX so we can turn that leverage into some sweet, sweet gainzzzzzz. Head over to https://DDEX.io/trade and make that trade you’ve been planning on. If you’ve never traded on DDEX before, there’s a nice onboarding process that can walk you through the steps. If you have already traded on DDEX but haven’t traded with DAI yet, you may need to enable token allowance for the asset. After that, you can buy WETH, OMG, MKR, or ZRX directly with DAI, or convert to WETH and buy a number of other other of tokens. Wait until your token pumps, sell a chunk of it into DAI so you can repay your loan. You will also need a small amount of MKR to close out your CDP and pay maintenance fees. Head back to https://dai.makerdao.com/ to close out your loan. You use the “wipe” function to wipe your debt by sending back DAI to the CDP, use the “free” function to get your PETH out, and then the “shut” function to close your CDP and pay the maintenance fee of 2.5% in MKR. You can now convert your PETH back to ETH.

Wooooo! You just made some nice returns without needing to add any new FIAT to any centralized exchanges, and got all of your ETH back! Ain’t DeFi the greatest?