How to generate DAI and lend it in Moneymarket

David Novotny
Learn Bitcoin & blockchain
7 min readJan 15, 2023

Introduction

DAI is an unbiased collateralized USD-pegged stablecoin that can be minted through the so-called CDP (Collateralised debt position) system. In other words, DAI is generated by depositing ETH (or another token) as collateral, notably via the Maker DAO’s Oasis Vault. However, it can also be bought on DEXs or swapped. DAI is maintained and regulated by said Maker DAO. Once created, this stablecoin serves as a financial asset in Ethereum’s DeFis. One example is the Compound protocol, which enables users to borrow and supply DAI and many other tokens. In this tutorial, I will show you how the process of acquiring and using DAI works.

Prerequisites

· Some ETHs

· Appropriate wallet that supports DAI and Compound (e.g., Metamask, Tally Ho, Trezor, Coinbase wallet, etc.)

PS: In this tutorial, we will be using the Metamask Wallet.

STEP 1: ACQUIRE DAI

There are three main ways to acquire a DAI stablecoin:

1. Open an Oasis Vault

Despite this being an utterly authentic and often fun way to generate Maker DAO’s token, it has one major setback: it contradicts our purpose of just a simple demonstration of DAI utilization. In order to open the vault, a severe amount of capital is required since its Dust limit is set at $5000. This limit specifies the minimum amount of DAI that can be minted for this type of Vault. Still, let us have a look at how to navigate this very straightforward and user-friendly app.

First, click on the following link that will get you to the main page of Oasis.app: https://oasis.app/#earn

Then click on “Connect Wallet,” choose Metamask, and log in.

Next, the following overview will pop up:

Once submitted, the transaction may take a while, depending on the gas price you paid. Ultimately, your transaction will be confirmed, and your DAI will become available in your wallet.

Information to ETH-C Vault’s overview:

VaultID — unique reference to the particular Maker Vault

Stability fee — mandatory fee collected by the Maker protocol for the vault setup

Collateralisation ratio — value of the collateral / DAI debt

Minimum collateralisation ratio (Liquidation ratio) — if the vault reaches below the minimum collateralisation level, it is considered undercollateralized and is subject to liquidation.

Liquidation fee — fee issued upon liquidation of the vault and added to the vault’s total outstanding debt. It incentivizes owners of the vault to avoid liquidation.

Dust Limit — Minimum amount of DAI that can be mined with this type of vault

2. Buy DAI on DEXs(Uniswap, Binance…)

Buying DAI on decentralized exchanges cannot be easier. Simply log in to your Metamask wallet, choose the exchange that supports DAI, proceed to payment, and you are all set.

3. Use a “Swap” function on Metamask

This function enables you to gain tokens directly from your desktop or mobile wallet. The Swaps combine data from DEXs, aggregators, and market makers to ensure the user gets the most competitive prices with low network fees and negligible slippage. Furthermore, it offers a broader range of tokens compared to any single service. Let us see how it works.

Start with connecting to your Metamask wallet (make sure you are on the Ethereum Mainnet)

Right after, your DAI tokens should appear in your wallet. If not, click on “import tokens” in Metamask and type in the corresponding name of the token. Then it should become available.

STEP 2: PROCEED TO SUPPLY DAI

After successfully acquiring DAI, we may now use it so as to gain interest from it. For this purpose, we will be using the Compound protocol. The Compound is an Ethereum smart contract for supplying and borrowing assets through its “cTokens”.

Each cToken is assigned an interest rate and risk model[1] and allows accounts to “mint,” “redeem,” “borrow,” and “repay a borrow.” You are issued these tokens upon supplying funds. They act first and foremost as your “deposit certificate.” Additionally, all the accrued interests are added to the cToken holding and not straight to the original coin, making it a good means of track-keeping of the value growth outside of the Compound protocol.

The protocol was launched in 2018, and its current main version, “V2”, was established in 2019 (we will use this version in the tutorial). In August 2022, the “V3” version was added and is now being used simultaneously with the V2.

To get to Compound, click on the following link: https://v2-app.compound.finance/#

Since we have acquired around 14 DAI from the swap, let’s supply 10 DAI, for example. When ready, click on “SUPPLY.”

Next, confirm the transaction on Metamask by confirming the transaction fees as well.

Explanatory notes to the Supply overview:

Supply APY — annual percentage yield of DAI stemming from the supply.

Distribution APY — annual percentage yield of COMP token stemming from the supply. COMP token is Compound’s native cryptocurrency. This ERC-2O token’s main function is governance. COMP holders have the right either to vote or to delegate votes on all key changes concerning the protocol.

Borrow limit — it indicates to what extent a user can borrow based on the current fund supply and the collateralisation ratio.

*Note that the promised APY is not guaranteed due to the utilisation of the DAI lending pool, which is almost constantly below 100%, meaning not every DAI in the pool gets utilised. This utilisation figure could be seen in the V1 version. However, it is not displayed in V2.

Finally, you should see your funds supplied on the main page. Then tick off the option to use DAI as collateral. Now you are successfully lending DAI and will likely gain some profit from it.

*Do not forget to import your newly minted cDAI in your Metamask wallet, so you can keep track of your funds and eventually withdraw them when done lending

To withdraw the funds, click on “Dai” on the Supply side, switch to “Withdraw,” enter the sum you want to withdraw, and confirm. Once again, the gas fee will be deducted from your Metamask account.

Borrowing

As soon as you have lent some funds to Compound, you can make use of the borrow function. Based on the “Borrowing Limit,” there is a possibility to borrow currencies up to this specific limit that is calculated based on your fund supply. You must also be aware of the interests that are often and naturally much more significant than in the case of lending. However, the most important thing is to track your collateralization ratio thoroughly; otherwise, your account might get liquidated.

Conclusion

I have been lending DAI for around a month, and unfortunately, the profits from the interest payments do not cover my expenses (capital investment and gas fees combined). The reason is that I traded a very negligible amount of DAI, so the transaction fees often reach up to 20% of my involved capital, which is a vast sum. If you are determined to try lending DAI, I recommend supplying a little more significant amount, as the value/fee ratio will be relatively more prominent. Moreover, a month is an insignificant time horizon. Thus, keep the funds supplied for at least one year if you want to see a difference.

On the other hand, embarking on DeFi is a valuable experience, so even the merest involvement is considered a success. All that matters is to be enthusiastic about it.

References

[1] So-called Comptroller, which validates permissible user actions and disallows actions if they do not fit a particular parameter (for instance, when borrowing, the user must preserve sufficient collateral balance across all invested equity)

--

--