Introduction

Please join the #development room in the Compound community Discord server; our team, and members of the community, look forward to helping you build an application on top of Compound. Your questions help us improve, so please don't hesitate to ask if you can't find what you are looking for here.

Networks

The Compound Protocol is currently deployed on the following networks:

Codebase

The Compound protocol codebase is hosted on Github, and the source code for each contract is verified on Etherscan.

Exponential Math

The Compound smart contracts use a system of exponential math in order to represent fractional quantities with sufficient precision. Throughout the documentation and code we make reference to mantissas, which are unsigned integers scaled up by a factor of 1e18 from their nominal value. By using mantissas within our contracts, we may perform basic mathematical operations like multiplication and division at a higher resolution than working with the unscaled quantities directly as integers. To gain a better understanding of how this works, see Exponential.sol.

Gas Costs

The gas usage of the protocol functions may fluctuate by market and user. External calls, such as to underlying ERC-20 tokens, may use an arbitrary amount of gas. Any calculations that involve checking account liquidity, have gas costs that increase with the number of entered markets. Thus, while it can be difficult to provide any guarantees about costs, we provide the table below for guidance:

FunctionTypical Gas Cost
Mint< 90K
Redeem, Transfer< 250K if borrowing, otherwise < 90K
Borrow< 300K
Repay Borrow< 90K
Liquidate Borrow< 400K

Glossary

TermDescription
Collateral FactorThe amount of an asset that may be borrowed for each unit of collateral provided. The collateral factor is defined per market.
Close FactorThe portion of a borrow in a single market that may be closed by a liquidator during a single liquidation. For example, if Joe borrows 100 ZRX and the close factor is 0.3, then a liquidator may close 30 ZRX. The close factor is globally defined across all markets.
Liquidation IncentiveThe additional collateral given to liquidators as an incentive to perform liquidation of underwater accounts. For example, if the liquidation incentive is 1.1, liquidators receive an extra 10% of the borrowers collateral for every unit they close. The liquidation incentive is globally defined across all markets.