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
  • Summary
  • getEthPrice
  • getMkrPrice
  • getPethPrice
  • setEthPrice
  • setMkrPrice
  • getWethToPethRatio
Export as PDF
  1. Building on top of the Maker Protocol
  2. The Dai Javascript Library of the Maker Protocol
  3. Single-Collateral Sai

Price Service

PreviousCDP ServiceNextSystem Status

Last updated 5 years ago

Summary

Retrieve the PriceService through Maker.service('price'). The PriceService exposes the collateral and governance tokens' price information that is reported by the oracles in the Maker system.

const price = maker.service('price');

getEthPrice

Get the current USD price of ETH, as a USD_ETH .

const ethPrice = await price.getEthPrice();

getMkrPrice

Get the current USD price of the governance token MKR, as a USD_MKR .

const mkrPrice = await price.getMkrPrice();

getPethPrice

Get the current USD price of PETH (pooled ethereum), as a USD_PETH .

await pethPrice = price.getPethPrice();

setEthPrice

Set the current USD price of ETH. This requires the necessary permissions and will only be useful in a testing environment.

await price.setEthPrice(475);

setMkrPrice

Set the current USD price of the governance token MKR. This requires the necessary permissions and will only be useful in a testing environment.

await price.setMkrPrice(950.00);

getWethToPethRatio

Returns the current WETH to PETH ratio.

await price.getWethToPethRatio();
price unit
price unit
price unit