Blog Banner: 📟 Managing MakerDAO Vault Liquidations with Notifications

📟 Managing MakerDAO Vault Liquidations with Notifications

TLDR; Today we are excited to release an industry-defining notification engine for the Ethereum blockchain. In light of recent events that occurred with the Maker system, we leaned into our product roadmap to ship this urgent feature today rather than sometime later in the year. Our vision is to materially reduce the number of liquidations that happen to borrowers because nobody should lose funds due to bad or unavailable data.

What happened on Thursday (Mar 12, 2020)

First, a recap of what happened last week. Definitely a first for the entire DeFi ecosystem and hopefully the last of this magnitude. A reminder to how early we are and how much work there is still remaining to be done. The gist –

  1. The price of ETH dropped 30% in a matter of hours possibly due to the global COVID-19 news.
  2. Lots of Maker Vaults (formerly known as CDPs) got liquidated as a result of the ETH price drop because they could not maintain their minimum 150% collateralization ratio.

No doubt, getting liquidated sucks because the borrower loses their collateral. But the liquidation mechanism by itself isn't noteworthy.

Wild swings in cryptocurrency prices are common. The liquidation mechanism in Maker is designed to keep DAI from becoming under-collateralized. Normally, an auction is held for a bot (known as a "keeper") to submit a liquidation bid and the remaining collateral is returned to the vault owner upon liquidation.

What's interesting about Mar 12, 2020 – is the cascading failures that amplified the impact of liquidations:

1. Gas prices through the roof

Gas is how a user of Ethereum incentivizes miners to pick up their transactions and in this case – topping up their ETH collateral or repaying some of their DAI back. The extremely high gas prices made it very expensive for the borrowers to save their vaults.

2. Low DAI liquidity

Second, in order for the keepers to bid on the auctions, they needed DAI. With so much demand for DAI and very little liquidity, DAI lost its peg to the US dollar. When there's ample supply of DAI, the auction process will keep the bids honest. But in this case, a combination of high gas prices along with low DAI liquidity led to keepers dropping off from participating in the auctions. A single keeper found an "exploit" and was able to place bids for just 0.01 DAI. These auctions have a very short window to finalize – just 10 minutes. Because there were no other/better bids, the auctions finalized for essentially 100% profit for the keeper.

3. Oracle malfunction

Third, the Maker oracle reported wrong prices ETH-USD for a couple of hours. This was most likely due to Ethereum congestion with the high gas prices – the updated prices could not be written to the blockchain.

Bottom line: About 5 million DAI was lost due to liquidations. A third of them were basically free with 100% profit for the keepers. Vault holders were hurt, but they have no legal recourse. Some of this loss could have been avoided.

Covalent has built a notification engine for Ethereum

Ethereum clients like geth have had in-built support for notifications for many years now. You subscribe to events like "new transactions being mined" or event-based filters like ERC20 token transfers. Etherscan uses this in-built feature to send you an email whenever there's a transfer related to your account. This feature is important if you are a DApp developer who knows how to program smart contracts.

Covalent works differently – we are able to understand the semantic meaning of Ethereum transactions. Event-based filters work for a 2017-era Ethereum which were mostly token transfers. Today's transactions are much more sophisticated, eg: in DeFi you'd have borrow, lend, stake, slash and other actions. Moreover, your address might not be readily available in the to or from fields of a transaction and a simple filter on those fields will miss a lot of the interesting action.

Our focus is also different – we format our data for the end-user or investor of these DeFi products. That means we retrieve historical market prices and context on your positions that may not be readily available in an event log. It's similar to the existing Maker vault activity stream that we have within SafeKeep:

Image

Maker vault activity stream.

Our notification engine works in two steps:

  1. We maintain an index of all addresses on the entire Ethereum blockchain, so we can figure out if your addresses is involved in any transaction that involves a balance change. This index is continually updated every 30s, so we are about 2-3 blocks behind. We use our own custom implementation of the EVM that captures proxy contracts, relayed and meta transactions. This is an industry-first: to our knowledge nobody indexes the entire blockchain at this granularity.

  2. We have a calculation engine that recomputes your positions and unrealized gains using current market spot prices. In database-parlance, this is known as a materialized view. Specific to Maker, we can send you a notification when your Vault enters the danger zone, which is in the 150% - 165% collaterization ratio range, rather than after your vault is liquidated and you've lost funds.

We are beta-testing this new feature with a select group of users in our new product SafeKeep. If you're interested, you can sign up for our private beta today: