Giter VIP home page Giter VIP logo

dai-backstop-syndicate's Introduction

DAI Backstop Syndicate

Build Status License: CC0-1.0

Backstop Syndicate for MakerDAO

Abstract

A Community Effort to Ensure a Successful Auction of MKR

Context

On Thursday, 12 March, the price of ETH fell precipitously. The price decline caused many vaults in the Multi-Collateral Dai system to become undercollateralized. Many of these undercollateralized loans were liquidated as expected. However, due to a combination of market panic, network congestion, an issue with the price oracle, and attention deficits, some of the vaults were liquidated in exchange for zero DAI. As a result, the Multi-Collateral Dai system currently has a negative surplus. To eliminate this negative surplus, MakerDAO plans to sell MKR tokens in exchange for DAI in a real-time auction to begin on Thursday 19 March.

We have established a pooled auction contract that gives syndicate participants a way to participate in the auction process should the price of MKR (denominated in Dai) fall to 100 DAI / MKR. Anyone can trigger an auction using pooled funds at the given price once the auctions begin, and all participants in the pool will then be able to redeem the tokens they minted by supplying Dai for the equivalent Dai / MKR blend held by the pool.

This contract is not designed to provide liquidity for liquidations during flaps (exchanging MKR for DAI the other direction) or flips (exchanging DAI for a vault's collateral). This contract is designed to signal community support for MKR and act as a buyer of last resort during the upcoming MKR auction.

Technical Implementation

The DaiBackstopSyndicate smart contract allows anyone to indicate support for the backstop by depositing Dai with the enlist function. This mints an ERC20 token called "DBSv1-100" to represent the share of pooled funds owned by the depositor. Anyone is free to enlist to the syndicate until the pool performs the first bid. This first bid is triggered automatically once MKR auctions reach a price point below 100 DAI/MKR. The syndicate will participate in all auctions until the Dai pool is exhausted. A holder of the ERC20 "DBSv1-100" pool token can call defect at anytime to withdraw a proportional amount of the pool's remaining Dai and MKR. There is also a single function, controlled by an owner, called ceaseFire that halts all new auctions and deposits (withdrawals are of course never "halted", though you may not be able to withdraw if the Dai is currently being used for an auction).

Deployed Contract

backstopsyndicate.eth => 0x00000000357646e36Fe575885Bb3e1A0772E64Cc (Dai Backstop Syndicate v3-100)

Group Chat

Telegram

Acknowledgements

Thank you to the following community members for contributions to this tool.

@0age | @thegostep | @PhABC | @epheph | @samczsun | @scott-l-e-w-i-s | @Neablis | @graemecode | @sambacha | @banteg

dai-backstop-syndicate's People

Contributors

0age avatar brianmcmichael avatar cgewecke avatar epheph avatar phabc avatar samczsun avatar scott-l-e-w-i-s avatar thegostep avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

dai-backstop-syndicate's Issues

Consider adding an upper limit to number of active auction sets.

The OpenZeppelin EnumerableSet is used here for maintaining the list of auctionsets and includes a warning against using enumerate() on large data sets.

I haven't benchmarked the gas usage of this contract yet but enumerate() is called in getActiveAuctions() but critically in _getActiveAuctionVatDaiTotal() which is relied upon in many locations, including defect(), getDefectAmount(), getDaiBalance(), and getDaiBalanceForAuctions()

The _getActiveAuctionVatDaiTotal() function calls enumerate() on the set at line 350 and then makes another complete loop across the set at 354.
This function will end up being quite expensive due to the consecutive loops, mloads, and safemath operations.

Starting 3/19 there will be approximately 50 auctions starting in quick succession, followed by another 50 or so in the following days. I'm concerned that adding too many auctions to this set will cause the _getActiveAuctionVatDaiTotal() function to begin failing due to gas limitations and start preventing other functionality.

At this point the safest solution might be to add a check in the EnumerableSet's add() function that sets a maximum number of auctions that can safely be maintained at one time. I have not benchmarked the gas usage of this function yet, however, and so I do not yet know what the safe number of auctions might be.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.