$238.18 -3.56%
ETH · 16w

Developer Guide for Borrowing Crypto from the Compound Protocol

Borrowing Assets from the Compound Protocol

Quick Start Guide

The Compound Protocol allows users to borrow crypto assets, using any other supported asset as collateral — giving them the flexibility to settle a trade, or use an application, with an asset that they don’t already own.

For example, a user holding ETH may supply it to Compound and borrow DAI from Compound instantly.

This guide will teach you how to develop applications that facilitate borrowing assets from the Compound protocol using JavaScript and Solidity.

What drives the interest that protocol suppliers earn?

Borrowers. Those that borrow crypto assets from the Compound protocol pay a varying interest rate every Ethereum block. The interest that borrowers pay produces the interest that suppliers earn.

Table of Contents for This Guide How Do I Borrow Assets From Compound?

Borrowing can be done using a user interface, or with code. Before we walk through the steps of a borrowing sequence, let’s cover some key concepts.

Collateral — In order to borrow crypto from the Compound protocol, users need to first supply another type of crypto as collateral. This is provided using the same mint function used for supplying assets. Supplied collateral assets earn interest while in the protocol, but users cannot redeem or transfer collateral while it is securing an open borrowing position. The Collateral Factor — The maximum amount users can borrow is limited by the collateral factors of the assets they have supplied. For example, if a user supplies 100 DAI as collateral, and the posted collateral factor for DAI is 75%, then the user can borrow at most 75 DAI worth of other assets at any given time. Each asset on Compound can have a different collateral factor. Collateral factors for each asset can be fetched using the Comptroller contract. Enter Markets — An asset that is supplied to the protocol is not usable as collateral initially. In order to infor...
Continue on
Recent news
ETH -3.56% · · 3h

Card Reprints and Prestiging

As Gods Unchained grows, so will the demand for cards. With reprints in mind, we're looking at ways to ensure original sets retain their special status.