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()
function exchangeRate() external view returns (uint);
- RETURN: The current exchange rate as an unsigned integer, scaled by 1 * 10^18.
QToken qToken = QToken(<qTokenAddress>);
uint rate = qToken.exchangeRate();
const qToken = await ethers.getContractAt(<qTokenABI>, <qTokenAddress>);
const rate = await qToken.exchangeRate();