Maker Protocol Technical Docs
  • MakerDAO Technical Docs
  • Getting Started
    • Maker Protocol 101
  • Smart Contract Modules
    • Dai Module
      • Dai - Detailed Documentation
    • Core Module
      • Vat - Detailed Documentation
      • Spot - Detailed Documentation
    • Collateral Module
      • Join - Detailed Documentation
    • Liquidation 2.0 Module
    • System Stabilizer Module
      • Flapper - Detailed Documentation
      • Flopper - Detailed Documentation
      • Vow - Detailed Documentation
    • Oracle Module
      • Oracle Security Module (OSM) - Detailed Documentation
      • Median - Detailed Documentation
    • MKR Module
    • Governance Module
      • Spell - Detailed Documentation
      • Pause - Detailed Documentation
      • Chief - Detailed Documentation
    • Rates Module
      • Pot - Detailed Documentation
      • Jug - Detailed Documentation
    • Proxy Module
      • Proxy Actions - Detailed Documentation
      • Vote Proxy - Detailed Documentation
      • CDP Manager - Detailed Documentation
      • DSR Manager - Detailed Documentation
    • Flash Mint Module
    • Maker Protocol Emergency Shutdown
      • Emergency Shutdown for Partners
      • The Emergency Shutdown Process for Multi-Collateral Dai (MCD)
      • End - Detailed Documentation
      • ESM - Detailed Documentation
  • Glossary
    • MCD Glossaries
    • Smart Contract Annotations
  • Deployment Addresses
    • Maker Protocol Deployments
  • Security
    • Security for the Maker Protocol
  • Building on top of the Maker Protocol
    • Developer Guides and Tutorials
    • The Dai Javascript Library of the Maker Protocol
      • Getting started
      • Configuration
        • Plugins
      • Vault manager
      • Collateral types
      • Dai Savings Rate
      • Currency units
      • System data
      • Advanced
        • Transaction manager
        • DSProxy
        • Events
        • Using multiple accounts
        • Adding a new service
      • Single-Collateral Sai
        • Collateralized Debt Position
        • CDP Service
        • Price Service
        • System Status
        • Tokens
        • Token Conversion
        • Exchange Service
    • Pymaker
  • Keepers
    • The Auctions of the Maker Protocol
    • Auction Keepers
      • Auction Keeper Bot Setup Guide
    • Market Maker Keepers
      • Market Maker Keeper Bot Setup Guide
    • Cage Keeper
    • Simple Arbitrage Keeper
    • Chief Keeper
  • Command-line Interfaces
    • Seth
    • Multi Collateral Dai (MCD) CLI
    • Dai and Collateral Redemption during Emergency Shutdown
    • Emergency Shutdown (ES) CLI
  • Miscellaneous
    • Liquidations 1.2 System (Deprecated)
      • Cat - Detailed Documentation
      • Flipper - Detailed Documentation
    • SCD <> MCD Migration
    • Upgrading to Multi-Collateral Dai Guide
Powered by GitBook
On this page
  • Properties
  • cdpTypes
  • Instance methods
  • getCdpType()
  • Collateral type instances
  • Properties
  • Caching
Export as PDF
  1. Building on top of the Maker Protocol
  2. The Dai Javascript Library of the Maker Protocol

Collateral types

PreviousVault managerNextDai Savings Rate

Last updated 5 years ago

Use the 'mcd:cdpType' service to look up parameters for different collateral types in the system. In the code, this is called .

const service = maker.service('mcd:cdpType');

Properties

cdpTypes

This is a list of , initialized during Maker.create.

service.cdpTypes.forEach(type => console.log(type.ilk));
// ETH-A
// BAT-A
// USDC-A

Instance methods

getCdpType()

Return the for the specified currency and/or .

// this will error if more than one type is defined for ETH
const type = service.getCdpType(ETH);

// disambiguate using the ilk name string:
const ethA = service.getCdpType(null, 'ETH-A');

Collateral type instances

Properties

ilk

The name of the collateral type as a string, e.g. "ETH-A".

totalCollateral

The total amount of collateral locked in all vaults of this collateral type.

totalDebt

The total Dai debt drawn against all vaults of this collateral type.

debtCeiling

The debt ceiling for this collateral type.

liquidationRatio

Vaults of this type become unsafe (subject to liquidation) when their ratio between USD value of collateral and Dai drawn is less than or equal to this amount.

price

console.log(type.price.toString()); // "9000.01 ETH/USD"

liquidationPenalty

The penalty added to the Dai amount to be raised at auction when a vault is liquidated, as a percentage. e.g. if the penalty is 13%, this value will be BigNumber(0.13).

annualStabilityFee

Caching

When a vault instance is created, its data is pre-fetched from the blockchain, allowing the properties below to be read synchronously. This data is cached in the instance. To refresh this data, do the following:

vault.reset();
await vault.prefetch();

To refresh the data for all collateral type instances at once:

service.resetAllCdpTypes();
await service.prefetchAllCdpTypes();

The USD price of this collateral type's token, using recent price feed data, as a . (See "A note on caching" above).

The annual stability fee (risk premium) of the collateral type, not including the , as a BigNumber. e.g. if the rate is 5%, this value will be BigNumber(0.05).

CdpTypeService
collateral type instances
collateral type instance
ilk
currency ratio
base rate