Developers
  • Introduction
  • QTokens
    • Transfer
    • Total Supply
    • Underlying Balance
    • Exchange Rate
    • Get Cash
    • Total Borrow
    • Borrow Balance
    • Borrow Rate
    • Supply Rate
    • Total Reserve
    • Reserve Factor
    • Key Events
  • Qore
    • Market List
    • Enter Markets
    • Exit Markets
    • Get Markets In
    • Supply
    • Redeem with QToken
    • Redeem with Underlying
    • Borrow
    • Repay Borrow
    • Repay Borrow Behalf
    • Liquidate Borrow
    • Get Account Liquidity
    • Market Information
    • Close Factor
    • Liquidation Incentive
    • Qubit Distribution Speeds
    • Pending Qubit (or Accrued Qubit)
    • Claim Qubit
    • Key Events
  • Qubit Locker
    • qScore
    • Total qScore
    • Deposit
    • Locked Balance
    • Locked Period
    • Extend Lock Period
    • Unlocked Balance
    • Withdraw
Powered by GitBook
On this page
  • QToken
  • Solidity
  • Ethers.js

Was this helpful?

  1. QTokens

Exchange Rate

Each qToken is convertible into an ever increasing quantity of the underlying asset, as interest accrues in the market. The exchange rate between a qToken and the underlying asset is equal to:

exchangeRate = (getCash() + totalBorrow() - totalReserve()) / totalSupply()

QToken

function exchangeRate() external view returns (uint);
  • RETURN: The current exchange rate as an unsigned integer, scaled by 1 * 10^18.

Solidity

QToken qToken = QToken(<qTokenAddress>);
uint rate = qToken.exchangeRate();

Ethers.js

const qToken = await ethers.getContractAt(<qTokenABI>, <qTokenAddress>);
const rate = await qToken.exchangeRate();
PreviousUnderlying BalanceNextGet Cash

Last updated 3 years ago

Was this helpful?