--- lang: zh-tw tags: NTHU, Notes, Cryptocurrency date: 20201221 robots: noindex, nofollow license: GPL-3.0 --- The Maker Protocol: MakerDAO's Multi-Collateral Dai (MCD) System === - https://makerdao.com/en/whitepaper/ 寫在開頭 --- ### 需要知道的名稱 - Maker protocol - Multi-Collateral Dai (MCD) system - 一種系統可以讓用戶使用經過「Maker Governance」批准的資產種類作為擔保品來生成 Dai - MakerDAO - Maker Decentralized Autonomous Organization - 它是一項去中心化自治組織的專案,透過發行 MKR token 並吸引許多人持有它,來有效管理 Maker protocol - Maker Governance - 由 MakerDAO 社群運營的一套 Maker protocol 管理流程 - 包含:有投票權的 MKR token holder + 可以自由提案 (proposal) 的任何人 - MKR token holder = MKR voter - 他們是決定某提案是否可以對 Maker protocol 造成實際修改的人 - 詳細職責請見 [MKR Holder Responsibilities](#MKR-Holder-Responsibilities) - Dai - 一種 1:1 soft-pegged 美元的資產擔保型加密貨幣,其發行過程具備去中心化 - 因為波動性低,所以 Dai 能夠抵禦惡性通貨膨脹 - Dai $\neq$ MKR token - 必看簡短影片 - [How to Open a Maker Vault](https://vimeo.com/427849477) ### 巨觀來看 - MCD = Dai + Maker Vaults + Oracles + MKR voters - Dai:stablecoin - Maker Vault:為 Dai 的價值背書 - Oracle:提供報價 (price oracle)、執行緊急流程 (emergency oracle) - MKR voter:決定 MCD 的各種規則、參數 歷史典故 --- - MakerDAO 專案開始於 2014 年,是一個由丹麥企業家 Rune Christenson 所創立的開源去中心化自治組織 - 2017 年出現第一版系統,叫做 Dai Stablecoin System (現改稱為 Sai 以資區別舊系統) - Tx Hash:0x91b318fd3498c14a1495357d6a4e895fd29c3d915ee695a6fbc8ef72908a1aa8 - ETH 是唯一可被當成抵押品的資產 - 經過抵押出來的產出物叫做 Single-Collateral Dai - 自 Nov. 2019 起,目前已被 MCD 取代為可以使用「多種」抵押品生成 Dai 的系統 - 宗旨:描述怎麼透過一種特別的 smart contracts (i.e., CDPs) 來質借 ETH 去生成 Dai 為什麼你該選擇 MCD? --- - 白皮書認為 Bitcoin 固定發行量 & 波動率太高 (內建投機的天性),所以不適合當作主流貨幣 (mainstream money) - Dai 的價值在於穩定性 > The Dai stablecoin, on the other hand, succeeds where Bitcoin fails precisely because Dai is designed to **minimize price volatility**. A decentralized, unbiased, collateral-backed cryptocurrency that is **soft-pegged to the US Dollar**, **Dai’s value is in its stability**. - 已發生的真實案例 1. J.P. Morgan 發行測試版數位貨幣 1:1 兌換美元 2. Facebook 的 Libra - Dai vs Ethereum 的穩定性比較 - Dai - USD:https://coinmarketcap.com/currencies/multi-collateral-dai/ - USDT - USD:https://coinmarketcap.com/currencies/tether/ - ETH - USD:https://coinmarketcap.com/currencies/ethereum/ An Overview of the Maker Protocol --- - [The Maker Protocol](#The-Maker-Protocol) - [The Dai Stablecoin](#The-Dai-Stablecoin) - [Maker Vaults](#Maker-Vaults) - [Key External Actors](#Key-External-Actors) - [The Dai Savings Rate](#The-Dai-Savings-Rate) - [Governance of the Maker Protocol](#Governance-of-the-Maker-Protocol) - [Price Stability Mechanisms](#Price-Stability-Mechanisms) - [The Future of the Maker Protocol](#The-Future-of-the-Maker-Protocol) The Maker Protocol --- - 由 MakerDAO 來維護 - 由 Maker Foundation 和一些合作夥伴來維護 - 由 governance token—MKR token 的人來投票決定未來走向 - 透過 [scientific governance](https://community-development.makerdao.com/en/learn/governance/gov-risk-framework/) 系統,MKR token 持有者可以 - 由 Executive Voting 和 Governance Polling 組成 - 管理 Maker Protocol 和管理 Dai 的金融風險 - 確保 Dai 的穩定性、透明性、有效性 - MKR token - 它是一種 ERC-20 token,因此票票等值 - voting contract 確保每個 token 持有人可以用持有的全部 MKR 進行投票 - 注意:MKR token $\neq$ Dai,一個是管理權 (可比擬成股票)、一個是穩定幣 (貨幣) The Dai Stablecoin --- > The Dai stablecoin is a decentralized, unbiased, collateral-backed cryptocurrency soft-pegged to the US Dollar. - 可以用任何錢包 (wallet) 來持有 Dai - Dai 的生成步驟 - 方法一:使用金庫生成 1. 用戶持有合格的 Ethereum-based collateral (或其他已被 MKR voters 核可的資產) 2. 把資產存入 Maker Vaults 3. 用戶拿到 Dai > This is how Dai is entered into circulation and how users gain **access to liquidity**. - 方法二:直接跟別人買 Dai - Dai 的用途 - 當作一般的 cryptocurrency 那樣用 - 利用 Maker Protocol 的功能「Dai Savings Rate (DSR)」賺利息 - Dai 持有人利用 DSR contract 鎖住持有的 Dai 來自動賺利息 - 流通中的 Dai 都有超額資產做抵押 - 生成 Dai 的交易紀錄可以在 ETH mainnet 上面查詢到 - 普通貨幣具備的四個特性 Dai 都有 1. A store of value - Dai 是 stable-coin 2. A medium of exchange - Dai 是 cryptocurrency 3. A unit of account - "A unit of account" is a **standardized measurement of value** used to **price goods and services**. - 目前 1 Dai $=$ 1 USD 4. A standard of deferred payment - 使用者用 Dai 償還過去建立的 Maker Vaults 才可關閉它、拿回被抵押的資產 - 白皮書認為這個特點令 Dai 贏過其他 stablecoin (例如中心化發行的stablecoin) - 抵押品資產 (collateral assets) - 由 MKR token holder 投票納入 Maker protocol 的 digital asset - Dai 整體「價值」完全來自於那些存入 Maker Vaults 當作抵押品的資產 - 18 Collateral Types - https://blog.makerdao.com/a-guide-to-dai-stats/ - What is ETH-B Collateral? - 具有不同 risk parameter 的 ETH (ETH-A 與 ETH-B 不同,其他以此類推) - https://vote.makerdao.com/executive/5f893c49296acd001aa224a5?network=mainnet#proposal-detail - 哪裡找的到 18 種抵押品類型的 risk parameters? - [Maker Docs](https://docs.makerdao.com/dai.js/cdptypeservice#collateral-type-instances) - [如何提案新增抵押品種類](https://github.com/makerdao/community/blob/master/risk/collateral-onboarding-guide.md) Maker Vaults --- - 把個人擁有的資產轉換成 Dai 很簡單 - 所有經過 MKR voters 投票核可的資產種類都可以拿來抵押 - 使用 Maker protocol 提供的智能合約—Maker Vaults 即可生成 Dai - 現存很多線上服務可以用 (e.g. Oasis Borrow),也可以自己呼叫 API 進行 - 使用者取回被抵押的資產,除了要付清當時拿到的 Dai,還要額外加上 stability fee - 特別注意 stability fee **只能用** Dai 支付 - 使用者可以跟自己創立的 Maker Vaults 直接互動,享有完整控制權 - 除非抵押品價值低於 liquidation ratio (會被強制拍賣抵押品) - 使用者可以中途拿回部分的抵押品,只要支付相對應的 Dai 和 stability fee 即可,不必每次全部拿回 - 不同種類的抵押品要用不同的 Maker Vaults 來裝 > Importantly, **each collateral asset deposited requires its own Vault**. So, some users will own multiple Vaults with different types of collateral and levels of collateralization. - 如果 Maker Vault 的 collateral-to-debt ratio (C/D tatio) 低於 liquidation ratio (LR),那麼 Maker protocol 就會自動執行拍賣 (liquidation) - LR 由 MKR voters 決定 (屬於 risk parameter 的一環),不同的抵押品種類有不同的比率 - 由 keepers 「無時無刻」在檢查並找出 C/D ratio 過低的金庫 - Maker protocol auction - [細節??](https://docs.makerdao.com/auctions/the-auctions-of-the-maker-protocol) - 重要名詞 - 拍賣得標者:winning bidder (WB) - Maker buffer > The funds in the Maker Buffer are revenues from Stability Fees, Liquidation Fees, and other income streams. - 因為 Maker protocol 設計成超額抵押,所以解除 Maker Vault 時本來就會獲得多出來的 Dai - Maker Vault 正常解除掉獲得的 stability fee 也是多出來的 Dai - Maker Vault 被強制拍賣掉也會獲得多的 Dai (i.e., liquidation fee) - liquidation fee = liquidation penalty = liquidation penalty fee - 這些多出來的 Dai 被累積進 Maker buffer 1. collateral auction (CA) - WB 支付 Dai,取得金庫中的抵押品 - 細節:MCD 收到 Dai 之後,扣除「抵押品對應的 Dai & stability fee & liquidation fee」,如果還有剩下 Dai 就會退還給金庫持有者 - 如果金庫的 C/D ratio 沒有低得太慘,則不一定要拍賣全部抵押品才可還「積欠的 Dai」,此時就會涉及 rCA 2. debt auction (DA) - WB 支付 Dai,取得 MKR token - 細節 - 如果執行 CA 之後,仍然無法取得足夠的 Dai 來償還抵押品 (e.g. 抵押品瞬間變垃圾、沒有人想買抵押品),則 Maker protocol 會先用 Maker buffer 來填補這個缺口;如果仍然補不完,就會執行 DA - Maker protocol 透過此機制償還那些沒有被 CA 消除的負債 3. surplus auction (SA) - WB 支付 MKR token,取得 Dai - 細節 - 如果 Maker buffer 增加超過特定上限,就會執行 SA 把 Dai 賣給得標的 WB - WB 需要支付 MKR token 以換取得標的 Dai - Maker protocol 經由 SA 收到的 MKR token 隨後會被摧毀,以控制 MKR token 發行量 4. reverse collateral auction (rCA) - 屬於是 CA 的其中一個環節 - 尚未弄懂?? Key External Actors --- - Keeper - 幫助 Dai 可以達成 1:1 USD soft peg 的目標 - 就是出現可套利空間而吸引來的套利者們 - 因此檢查 C/D ratio 過低的這個工作,理論上是無時無刻都在進行 > A Keeper is an independent (usually automated) actor that is **incentivized by arbitrage opportunities** to provide liquidity in various aspects of a decentralized system. - 除了買賣 Dai 之外,Keeper 也參與 CA、SA、DA - Price oracle - Maker protocol 計算 C/D ratio,才知道何時該拍賣 Maker Vault - 詳細架構:https://blog.makerdao.com/introducing-oracles-v2-and-defi-feeds/ - 由許多 oracle feeds 構成,MKR voters 投票選出一組可信任的 trusted feeds,透過 Ethereum transaction 把價格輸入進 Maker 系統 - 為了避免大部分 oracle feeds 被控制的攻擊,建立保護層 [oracle security module (OSM)](https://docs.makerdao.com/smart-contract-modules/oracle-module/oracle-security-module-osm-detailed-documentation) - 價格更新延後一小時 - 如果發現有 oracle feed 被攻擊,可以透過 MKR voters 投票或用 emergency oracle 把它凍結 (emergency oracle 的行為也是由 MKR voters 投票決定好) - Emergency oracle - 由 MKR voters 投票選出 - 功能 1. 凍結 (freeze) 特定 oracle feed 2. 執行 emergency shutdown (ES) - DAO teams - 一些維護 Maker 系統的人,最終可能會被「MKR voters 投票機制」取代 The Dai Savings Rate --- - https://blog.makerdao.com/why-the-dai-savings-rate-is-a-game-changer-for-the-defi-ecosystem-and-beyond/ - 把「Dai」(not 抵押品!) 利用 DSR contract 鎖進 Maker valut 賺利息 - DSR 的升降由 MKR voters 投票決定,可以控制 Dai 兌 USD 的匯率 - 未來會建立 DSR adjustment module、base rate 等功能,讓調整 DSR 的工作「自動化」,不用每次都要 MKR token holder 投票 - [用 DSR contract 賺到的 Dai 的來源](https://www.reddit.com/r/MakerDAO/comments/iip2ct/what_is_dsr_paid_out_of) - 簡單來說就是來自 stability fee Governance of the Maker Protocol --- #### ■ Use of the MKR Token in Maker Governance - MKR token - the governance token of the Maker protocol - 任何人都可以提案變更 Maker protocol - MKR token holder 投票決定是否接受提案 (polling) - MKR token holder 的投票結果可能不會立刻生效,還可以選擇啟動 governance security module (GSM) 延遲生效最多 24 小時,或是直接觸發 emergency shutdown ##### Polling and Executive Voting - 由 DAO 社群先討論出幾個 proposal contract - MKR token holder 投票選出 active proposal - active proposal 獲得 administrative access,執行並修改 Maker protocol ##### The MKR Token’s Role in Recapitalization - MKR token 的發行量與控制 Maker protocol 的債務也有關 - 如果債務太多,就會觸發 debt auction 來增加 MKR token 發行量 ##### MKR Holder Responsibilities - MKR token holder 可以投票決定以下幾種事情 1. 新增合格的抵押品種類和其 risk parameters 2. 新增、修改已有的 risk parameters 3. 修改 DSR 4. 選擇 trusted oracle feeds 成員 5. 選擇 emergency oracle 成員 6. 觸發 emergency shutdown 7. 升級系統 #### ■ Risk Parameters Controlled by Maker Governance - 不同抵押品種類有不同的 risk parameters - 對於每種抵押品來說,應該具備以下幾種關鍵的 risk parameter 1. Debt Ceiling - 每一種抵押品可以生成的最多 Dai 數量 - 確保 MCD 系統的抵押品具備足夠 diversification 2. Stability Fee - 相當於以 APR 計算的「借款利息」 - 只能用 Dai 支付,被 Maker protocol 收集到 Maker buffer 當中 3. Liquidation Ratio (LR) - LR 較低代表 Maker Governance 認為該種抵押品的價格波動率比較低 4. Liquidation Penalty 5. Collateral Auction (CA) Duration - 拍賣過程可持續的最久期限 - DA 和 SA duration 是全域參數,不會因為不同種抵押品而不同 6. Auction Bid Duration - 如果持續特定時間都沒有新的 auction bid,則拍賣過程會提前結束 7. Auction Step Size - 鼓勵參加拍賣的人要即早提高出價 - 防止加價幅度過低 #### ■ Risk and Mitigation Responsibilities of Governance > The successful operation of the Maker Protocol depends on Maker Governance **taking necessary steps to mitigate risks**. ##### 1. A malicious attack on the smart contract infrastructure by a bad actor. - 問題描述:Maker Protocol 最怕有厲害的專家發現一些 smart contract 的漏洞,造成整個系統可能受到嚴重破壞或是直接被偷走,而災難性地無法復原 - 對策:Dai codebase 已經通過「形式驗證」!(formal verification),Maker Foundation 也有找第三方機構來稽核安全性 - https://blog.makerdao.com/mcd-security-roadmap-update-october-2019/ - https://forum.makerdao.com/t/publication-of-the-runtime-verification-audit/976 ##### 2. A black swan event - 問題描述:「黑天鵝事件」就是大家都知道的那個概念,白皮書舉例了幾種可能性,但是不代表只限於以下幾種 - 針對 Dai 價值來源—抵押品的攻擊 - 一種或數種的抵押品的價格突然巨幅滑落 (已發生過,參考以下的MKR Auction for The 1st Time) - price oracle 被攻擊 - 隱藏邪惡企圖的 Maker Governance proposal - 對策:Maker protocol 設計很多環節 (LR、debt ceiling、GSM、OSM、ES、、、) 來盡力避免黑天鵝,不過無法保證可以完全抵抗攻擊 ##### 3. Unforeseen pricing errors and market irrationality - 問題描述:price oracle 和其他市場因素可能會讓 Dai 波動時間維持一段很長的時間,偏離原本 stablecoin 的原意;如此一來,可能讓調整 DSR 水準 和 MKR 供給量等手段失去作用,整個市場對 Dai 的信心崩潰 - 對策 - 白皮書認為 Maker Governance 已聚集足夠的資產池,讓 keeper 有動力做它們的職責 (維持市場效率) > **Maker Governance incentivizes a sufficiently large capital pool** to act as Keepers of the market in order to maximize rationality and market efficiency, and allow the Dai supply to grow at a steady pace without major market shocks. - 最後手段就是啟動 emergency shutdown,解散整個 Maker protocol 系統 ##### 4. User Abandonment for Less Complicated Solutions - 問題描述:Maker protocol 太複雜、沒人想搞懂,所以逐漸被捨棄 - 對策:Maker 社群和 Maker Foundation 致力於各種的「廣告行銷」 ##### 5. Dissolution of The Maker Foundation - 問題描述:Maker Foundation 希望有朝一日 Maker protocol 可以完全去中心化的自動運行,到時候就會解散基金會;萬一在 Maker Foundation 解散之後,Maker protocol 仍然無法正確運行,那就會很危險 - 對策: - 漸進式解散 (退場) Maker Foundation - MKR token holder 的投票機制仍然可以達成「治理」的效果 ##### 6. General Issues with Experimental Technology - 問題描述:未來可能引進的新技術和目前已存在於 Maker protocol 的技術,無法被完全百分百確認為正確且安全,可能存在為之風險使得系統部分或完全崩潰 - 對策:同上述 (1) 的困境 Price Stability Mechanisms --- ### The Dai Target Price - 設計上,Dai 和美元的匯率是 1:1 - 這個設計被認為即使在啟動 ES 也應該達成 ### Emergency Shutdown - 使用時機:Maker protocol 被攻擊、短時間有大量金庫被解除、Maker protocol 升級功能 - ES 的流程只能由 Maker Governance 控制 - MKR voter 可以把 MKR token 存入 emergency shutdown module (ESM) 來觸發 ES 運作,只要 ESM 當中被存入足夠的 MKR token,ES 就會立刻生效執行 - 這個設計可以加速 GSM 原本會延遲一段時間才執行 ES 的流程 - ES 流程三部曲 1. The Maker Protocol shuts down; Vault owners withdraw assets. - 所有使用者都不能再建立新的金庫 - 原本存在的金庫 - 如果非「資不抵債」,則金庫擁有者可以馬上取回抵押品 - 如果是「資不抵債」,則會進入下一階段 - price oracle 會停止價格更新的機制,以確保所有使用者可以順利取回抵押品 2. Post-Emergency Shutdown auction processing - 前階段資不抵債的金庫會進入 CA 階段拍賣抵押品 - 此階段的時間長度由 Maker Governance 事先決定好,會比最長的 CA 還要久,以確保所有抵押品都能順利拍賣掉 3. Dai holders claim their remaining collateral - 結束 CA 之後,使用者可以用 Dai target price (i.e., Dai:USD=1:1)以 Dai 取回抵押品 - Example:如果 ETH 兌 USD 是 200,則持有 1000 Dai (相當於 $1000) 的人可以取回 5 ETH - 更多怎麼取回抵押品的細節與優先順序等內容,請看[詳細文件1](https://community-development.makerdao.com/en/learn/governance/emergency-shutdown/)、[詳細文件2](https://blog.makerdao.com/introduction-to-emergency-shutdown-in-multi-collateral-dai/)、[詳細文件3](https://docs.makerdao.com/smart-contract-modules/shutdown) The Future of the Maker Protocol --- - 白皮書有給一些[例子](https://makerdao.com/en/whitepaper/#the-future-of-the-maker-protocol-increased-adoption-and-full-decentralization),不過顯然隨著 MakerDAO 社群的發展,可能有點過時了 Conclusion --- - 及時統計資訊:https://daistats.com/#/ - [實際應用案例](https://makerdao.com/en/whitepaper/#dai-use-case-benefits-and-examples) 其他內容 --- ### 術語表 - MakerDAO:https://community-development.makerdao.com/en/faqs/glossary - Maker Protocol:https://docs.makerdao.com/other-documentation/system-glossary - Maker voters 投票結果:https://vote.makerdao.com/executive - line:The **debt ceiling** for a specific collateral type. - Line:The **total** debt ceiling for all collateral types. - dust:The minimum possible debt of a Vault. ### Dai Stats - [網站](https://daistats.com/) - [2020年度統計](https://blog.makerdao.com/a-guide-to-dai-stats/) ### MKR Auction (aka Debt Auction) for The 1st Time - https://blog.makerdao.com/mkr-debt-auction-announcement-and-details/ - https://www.theblockcrypto.com/post/58606/in-a-first-makerdao-protocol-to-auction-mkr-tokens-to-cover-4m-bad-debt ### Governance Risk Framework - https://community-development.makerdao.com/en/learn/governance/gov-risk-framework/ ### Liquidation 2.0 (Available Now) - https://docs.makerdao.com/smart-contract-modules/dog-and-clipper-detailed-documentation#2-features - 特色 - Instant settlement - (舊版) English auction $\rightarrow$ (新版) Dutch auction - Flash lending of collateral - Auction 得標者可以直接把得標的 collateral 賣給其他人取得足以支付得標的 Dai,即使一開始得標者沒有持有任何 Dai - Price as a function of time - Resetting an auction - Improved keeper wallet security