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();

Last updated