3 min read - Posted 20 Sep 18

CDP Liquidator

A Collateralized Debt Position (CDP) is an ETH lockup mechanism by which DAI is created. In extreme liquidity scenarios, some users will need a convenient way to exit risky positions. This project is a cool experiment to let a user send their at-risk CDPs to a contract to pay off debts and return remaining collateral to the user. - Hugh Lang (ECF)



MakerDAO is a set of smart contracts that manage the operation of a dollar pegged cryptocurrency called DAI. CDP's (Collateralized Debt Positions) are the mechanism by which DAI is created. Users of the system lock up collateral (ETH) in a smart contract called a CDP, and gain the right to mint a certain amount of DAI in return.

If the value of their collateral falls below 1.5x their outstanding debt, the loan is considered too risky, and the system will take their collateral and sell it to cover the debt. Any surplus collateral is returned to to the user (minus a 13% liquidation fee).

The liquidation fee obviously makes this an expensive and undesirable prospect for CDP holders.

If the value of the collateral falls very suddenly, CDP holders can be left in a position where their CDP is rapidly approaching liquidation, but they do not have enough easily available funds to close their position themselves.

These holders would be very happy to have a service that would allow them to close their positions without paying the liquidation fee.

What it does

We have created a service that allows users who do not have enough liquidity to pay a smart contract to close their CDP for them (and thus significantly reduce the cost of liqudation).

Since the CDPs are overcollateralized, the contract is paid with a cut of the excess collateral. All remaining collateral is returned to the user.

The contract will be funded with DAI, and funders receive a portion of the fees proportional to their contribution.

This creates a market for CDP's and allows CDP holders to conveniently exit risky positions.

Users will send their risky CDP's to the contract and then the contract will do the following:

Pay off the outstanding debt Close the CDP Return the remaining collateral (minus the fee) to the original owner of the CDP Distributes the fee amongst the funders of the contract How we built it We created a set of smart contracts (see the liquidator-contracts repo), and forked and modified the oasis.direct frontend to serve as a user interface for the contracts.

In order to guarantee atomicity of the liquidation process we made use of a proxy contract (ds-proxy) that bundles multiple transactions together into one.

Challenges we ran into

Solidity tooling sucks. We are bad at maths.

Accomplishments that we're proud of

Working MVP.

What we learned

Maths. Tooling for command line blockchain interaction & scripting (seth / dapp.tools)

What's next for cdp-liquidator

The contract should sell any collateral it holds for DAI. Polish UI Smart contract auditing Main deployment ??? profit

Try it out


GitHub: Smart Contracts

GitHub: Frontend

Created with Sketch.Content is"CC-BY-SA 4.0" licensed
Article On-chain
Article Author

Kauri Team




Related Articles
FAQ: Liquidation

{entityMap:{0:{type:LINK,mutability:MUTABLE,data:{url:https://mkr.tools/},1:{type:LINK,mutability:MUTABLE,data:{url:http://dai.makerdao.com/},2:{type:LINK,mutability:MUTABLE,data:{url:https://mkr.tools/system/liquidations},3:{type:LINK,mutability:MUTABLE,data:{url:https://www.investopedia.com/terms/r/risk-profile.asp}},blocks:[{key:foo,text:What is Liquidation?,type:header-two,depth:0,inlineStyleRanges:,entityRanges:,data:{}},{key:83im2,text:To ensure there is enough collateral in the system to

Kauri Team

03 May 18

The DeFi Series — An overview of the ecosystem and major protocols

TL; DR As the first piece of our DeFi series, this article aims to introduce the overview landscape and share knowledge collected around the several most major protocols. In this piece we touched the overlap on user base of Maker and Compound, and will continue research on user base and systematic risks in the coming DeFi pieces. Keep an eye out for our continually refreshed dashboard and Reporting tools to download all the data. Also we will keep sending DeFi related weekly newsletter for follo


25 Apr 19