How sky-ecosystem/dss works
Project Type and Purpose
• This is a blockchain‐native, on‐chain financial system: the core smart contracts for MakerDAO’s Multi Collateral Dai (MCD).
Main Components
a. External Assets
• Native Ether or ERC-20 tokens (e.g., WETH, USDC, custom collateral).
b. Adapters (“join” contracts)
• One adapter per collateral type.
• They standardize token decimals/semantics and funnel collateral into the core via a single function (slip).
c. Core System Contracts (in src/)
• Vat: the heart of the system, holds collateral balances and Dai-denominated debt balances.
• Jug / Spotter: risk parameters (stability fees, liquidation ratios, price feeds).
• Dog: liquidation trigger logic.
• Flapper / Flopper: auctions for surplus Dai (flap) and system debt (flop).
• Vow: orchestrates auctions and system surplus/debt management.
d. Dai Token Implementation
• DSToken wrapper around core’s vat.dai. Users exit to mint ERC-20 Dai.
e. MKR Token (external)
• Used in system debt auctions (to cover bad debt) and governance.
f. Price Feeds (oracles)
• Push price data into the Spotter contract.
g. Governance Layer (external contracts/users)
• Multi-owner authority that adjusts risk parameters and upgrades modules.
Relationships and Data Flows
• Users send collateral to an Adapter → Adapter calls Vat.slip() → Vat updates collateral balance.
• To get ERC-20 Dai, users call exit(), which burns core Dai and mints ERC-20 DSToken.
• Price Feed updates trigger Spotter to mark undercollateralized CDPs → Dog starts a liquidation auction.
• Flopper (debt auction) and Flapper (surplus auction) are invoked by Vow based on system surplus/debt.
• MKR holders bid MKR in auctions to cover system debt or claim surplus.
Architectural Patterns & Principles
• Modular contracts: each responsibility in its own contract (SRP).
• Adapter pattern: abstracts arbitrary collateral via a uniform interface.
• Auction pattern: fixed‐lot auctions for collateral and MKR.
• No external calls & no precision loss in core (formal verification–friendly).
• Multi‐owner/simple authentication: contracts trust a small set of actors for configuration.
Technologies & Libraries
• Solidity contracts under src/
• ds-math, ds-token, ds-value libs under lib/
• Nix (shell.nix) for reproducible dev environment
• GitHub Actions for CI (.github/workflows/tests.yaml)
• Formal verification tools (via zero‐division and external‐call constraints)
Putting It All Together
• At the top, list off‐chain actors: Users, Price Feeds, Governance UI.
• Modularity by grouping adapters separately and linking them back to core via the single “slip” interface.