Compound Finance & ethPM
Earn interest on your DAI with ethPM and the Compound Protocol
Last updated
Was this helpful?
Earn interest on your DAI with ethPM and the Compound Protocol
Last updated
Was this helpful?
If you're like me, you have a hard time turning down free money. So why just let your crypto sit around and gather dust instead of putting it to work?
This guide will show you how to earn interest on your DAI with only a few lines of code in your terminal. You'll instantly start accumulating interest on your DAI by supplying it to the Compound protocol for others to borrow. We won't go deep into the Compound protocol, but you can learn more about it .
Use the DAI & Compound ethPM packages
Approve the cDAI contract to transfer your DAI
Exchange your DAI for cDAI (aka supply your DAI to the Compound liquidity pool)
The private key for an account that owns DAI
&
General understanding of
First, let's get the two packages we'll need to supply our DAI to the Compound protocol.
package name: dai-dai
version: 1.0.0
located on:
package name: compound
version: 1.0.0
located on:
In the Compound v2 protocol, "minting" is analogous for supplying your DAI to the liquidity pool. Here we'll specify how many DAI we want to supply, and we start earning interest on the very next block after this tx is mined. Neato!
Give this a couple blocks before you accrue interest. But check daily to see the accumulated rewards of your DAI's hard work!
Before we can supply our DAI to the Compound protocol, we have to approve the cDAI contract to transfer our DAI tokens and convert them into cDAI. This is a with many erc20-based systems. We'll use our cDAI
contract instance for the address.
Verify your supply & interest accrued with the . You can also use these ethPM packages and your newly created contract instances to borrow DAI or any other supported feature of the . The compound
package we use here also contains deployment information for all the other , so you can use the same package to lend/borrow REP, ETH, BAT, etc...