Developers
Search…
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:
1
exchangeRate = (getCash() + totalBorrow() - totalReserve()) / totalSupply()
Copied!

QToken

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

Solidity

1
QToken qToken = QToken(<qTokenAddress>);
2
uint rate = qToken.exchangeRate();
Copied!

Ethers.js

1
const qToken = await ethers.getContractAt(<qTokenABI>, <qTokenAddress>);
2
const rate = await qToken.exchangeRate();
Copied!
Last modified 2mo ago
Copy link