- Zoom link for the synchronous AMAs (password: 557046):
- To sign up for the course, please fill in this form.
- For more information about the course, please also join defi-mooc-f22@googlegroups.com. And stay tuned!
- For general course content related questions, please join our discord.
Instructors
Dan Boneh | Arthur Gervais | Andrew Miller | Christine Parlour | Dawn Song |
Stanford | UCL | UIUC | UC Berkeley | UC Berkeley |
Volunteer Teaching Assistant
Meetings
Lectures: Online, Pre-Recorded (Asynchronous)
Guest Speaker AMAs: Tuesday, 10:00 AM - 11:59 AM
Online (Zoom) or 438 Soda Hall
Syllabus (subject to change)
Course Work
- Weekly quizzes
- Two lab exercises
- (Optional) Group project
Quiz
All quizzes are released in parallel with (or shortly after) the corresponding lecture and will be due midnight the following Wednesday. Please remember to complete the quiz each week. Although it’s graded on completion, we encourage you to do your best. The questions are all multiple-choice and there are usually at most 5 per quiz.
Lab
Labs 1 and 2 have been released and are available on GitHub here: https://github.com/rdi-berkeley/defi-mooc-lab. If you clone the GitHub repository, please ensure your code remains private. You are expected to complete this lab on an individual basis (not in groups), but can have conceptual discussions with your peers as long as no code is shared. Students in the Haas version of the course are encouraged, but not required, to attempt the labs.
In this exercise, you are expected to implement a smart contract that performs a flash loan and liquidation. For more details, please read through the README.md file in the GitHub repository. Lab 1 is simply a checkpoint on the way to the full contract implementation to ensure that students have their development environment up and running by early next week. The majority of your lab grade will come from your performance in Lab 2.
By November 14th, you should submit a single LiquidationOperator.sol file that successfully performs a Uniswap flash loan (“Lab 1”). Your score out of 5 possible points will be determined like so:
- 0 points: If your contract fails to compile
- 2 points: If your contract correctly identifies the Uniswap contract for WETH-USDT pair
- 4 points: If your contract correctly borrows USDT via a Uniswap flash loan
- 5 points: If your contract borrows enough USDT to liquidate the Aave loan in Lab 2
Then, by November 21st, complete and submit the full implementation (“Lab 2”). Your submission should be a single LiquidationOperator.sol file, and your score out of 15 possible points will be determined by the actual profit you earn in the test case.
- 0 points: If your contract fails to compile, fails to liquidate the target account, or fails to pass the assertions.
- 6 points: If your contract gets a positive number in profit.txt.
- 12 points: If your contract gets a profit of >= 21 ETH.
- 13 points: If your contract gets a profit of >= 24 ETH.
- 14 points: If your contract gets a profit of >= 30 ETH.
- 15 points: If your contract gets a profit of >= 43 ETH.
Assignment Timeline
Assignment | Released | Deadline |
---|---|---|
Group formation | 8/30 | 9/12 |
Project proposal | 9/13 | 10/03 |
Assignment 1 (Link) | 10/04 | 10/10 |
Assignment 2 (Link) | 10/18 | |
Project milestone | 10/25 | 10/31 |
Lab 1 (Github) (Submission) | 11/01 | |
Lab 2 (Github) (Submission) | 11/08 | 11/21 |
Project presentation | 11/22 | 12/05 |
Project final report | 12/06 | 12/12 |
Course Completion NFTs
We will distribute NFTs for completion of the course. Below are the rules for different tiers (subject to change):
Honorary Tier: Instructors, guest speakers, fireside chat speakers, TAs, and the most supportive students who help others on Discord and YouTube will be rewarded with special NFTs.
Legendary Tier: Students must:
- Complete at least 12 quizzes on time (before the following lecture date as specified on the website); and
- Receive a final grade of at least 40 out of 50 marks.
- (14 marks) Finish the two assignments by Oct 4th 2022 PST and Oct 10th 2022 PST
- (36 marks) Finish the two two labs with by Nov 1st 2022 PST and Nov 8th 2022 PST
Ninja Tier: Students must:
- Complete at least 10 quizzes on time (before Dec 12th 2022 PST); and
- Receive a final grade of at least 20 out of 58 marks.
- (14 marks) Finish the two assignments by Oct 4th 2022 PST and Oct 10th 2022 PST
- (36 marks) Finish the two two labs with by Nov 1st 2022 PST and Nov 8th 2022 PST
- (8 marks) Write an article about relevant topic covered in this course or your experience of the course posted online, and tweet about the article.
- for example a blog article on:
- Summarizing information from certain lectures
- A postmortem on the learning experience
- Novel financial services on DeFi, such as flash loans or AMM exchanges.
- The article’s marking criteria can be found below:
- Understanding (2 marks): Displays breadth and/or depth of understanding of the topic
- Importance (2 marks): Content conveys an important aspect of DeFi to the audience
- Clarity (3 marks): Explains complex concepts simply, clearly, and accurately
- References (1 mark): Cite the relevant lecture and reference materials such as research papers properly.
- for example a blog article on:
Trailblazer Tier:
- Students must complete at least 10 quizzes before Dec 31st 2022 PST; and
- Finish the two assignments with a score of at least 10 out of 14 total points before Dec 31st 2022 PST.
Course Description
The purpose of this class is to bring together students and interdisciplinary experts in Computer Science and Finance to discuss the emerging area of Decentralized Finance (or DeFi). DeFi has experienced an unprecedented growth, with hundreds of projects and a countless stream of financial, distributed systems, and blockchain innovations. The total value locked (TVL) in decentralized finance — a measure of the total value of assets committed to the DeFi ecosystem — has reached over $80 billion. When compared to the traditional centralized finance (CeFi), DeFi offers products and services serving similar financial goals, but critically innovates with novel capabilities such as instantaneous multi-billion USD flash loans. By utilizing blockchain and smart contract technologies, DeFi as a whole aims to provide a new platform for programmable, automated finance services that remove the reliance on central trust and intermediaries.
Our goal is to provide a framework to understand this new area of financial services. For each finance function, we will consider 1) the current intermediated structure, and then b) the DeFi version (actual or proposed) that fulfills the function. Is either one of these optimal? We will evaluate both through the lens of CS and finance. Is the application computable (efficiency, decidable), programmable (automatic)? Is the application welfare-enhancing and stable (not a source of systemic risk). How do the new and old systems interact? We aim for the students to be able to critically evaluate whether a new DeFi protocol is novel and practical. We further will capture the security danger in DeFi, as well as their impact on the underlying consensus security. Lastly, we hope to give an insight into how to program and structure secure and incentive-compatible DeFi applications.
Through the exposure to cutting-edge research as well as remaining open challenges, we hope for our students to quickly integrate into academic as well as industrial projects related to DeFi.
Summarizing, we will cover a broad spectrum of topics, including:
-
A comprehensive introduction covering a computer science and finance background required for the remainder of the course. We will discuss the basics of decentralized systems, permissionless blockchains, consensus, smart contracts and contrast DeFi to traditional finance.
-
We will cover the computer science and economic aspects of DeFi assets, and how they link to CeFi through stablecoins. The course will elaborate on DeFi asset exchanges and contrast the traditional limit order book models to automated market makers. Just like in CeFi, debt and derivatives play a fundamental role in DeFi. We’ll dive into the various debt models, such as under- and over-collateralized debt, as well as synthetic assets in DeFi. Insurances, portfolio management and prediction markets form equally crucial elements to a decentralised economy as we will elaborate on. Last but not least, we will show different attempts at measuring and tracking systemic risk and its computability.
-
To link blockchains with financial information from the real-world, we will provide a deep-dive into oracles. We will discuss decentralized reputation, identities and proof of properties. Because most DeFi is transparently readable, including transaction amounts, fees, dates/times, etc, privacy plays an increasingly important role in DeFi. We will cover various privacy technologies including zero-knowledge proofs and their applications in DeFi. We will also discuss various attempts at how to enforce data ownership, data monetization and valuation as well as controlled use and misuse of data.
-
A digital economy would not thrive without strong security. We will outline the many past security attacks, introspect a few of them in closer detail and provide recommendations on how to strengthen DeFi security. We will discuss the systemic risks stemming from Miner Extractable Value (MEV) and how MEV can be minimized by design. Decentralized governance provides power to a pseudonymous collective, and we will explore how governance works, and how it may be attacked.