Add COMP Speed and total supply in Aave

This commit is contained in:
Mubaris NK 2021-04-27 16:27:06 +05:30
parent c7fda67f38
commit 263d4570e6
No known key found for this signature in database
GPG Key ID: 9AC09AD0F8D68561
3 changed files with 20 additions and 1 deletions

View File

@ -58,6 +58,10 @@ interface AaveLendingPool {
);
}
interface TokenInterface {
function totalSupply() external view returns (uint);
}
interface AaveAddressProvider {
function getLendingPool() external view returns (address);
function getPriceOracle() external view returns (address);
@ -208,6 +212,7 @@ contract AaveHelpers is DSMath {
bool stableBorrowEnabled;
bool isActive;
bool isFrozen;
uint totalSupply;
uint availableLiquidity;
uint totalStableDebt;
uint totalVariableDebt;
@ -263,6 +268,7 @@ contract AaveHelpers is DSMath {
aaveTokenData.collateralEmission = _data.emissionPerSecond;
_data = incentives.assets(debtToken);
aaveTokenData.debtEmission = _data.emissionPerSecond;
aaveTokenData.totalSupply = TokenInterface(aToken).totalSupply();
}
function getTokenData(

View File

@ -10,6 +10,7 @@ interface CTokenInterface {
function underlying() external view returns (address);
function balanceOf(address) external view returns (uint);
function getCash() external view returns (uint);
}
interface TokenInterface {
@ -30,6 +31,7 @@ interface ComptrollerLensInterface {
function borrowCaps(address) external view returns (uint);
function borrowGuardianPaused(address) external view returns (bool);
function oracle() external view returns (address);
function compSpeeds(address) external view returns (uint);
}
interface CompReadInterface {
@ -117,10 +119,12 @@ contract Helpers is DSMath {
uint balanceOfUser;
uint borrowBalanceStoredUser;
uint totalBorrows;
uint totalSupplied;
uint borrowCap;
uint supplyRatePerBlock;
uint borrowRatePerBlock;
uint collateralFactor;
uint compSpeed;
bool isComped;
bool isBorrowPaused;
}
@ -144,17 +148,20 @@ contract Resolver is Helpers {
CTokenInterface cToken = CTokenInterface(cAddress[i]);
(uint priceInETH, uint priceInUSD) = getPriceInEth(cToken);
(,uint collateralFactor, bool isComped) = troller.markets(address(cToken));
uint _totalBorrowed = cToken.totalBorrows();
tokensData[i] = CompData(
priceInETH,
priceInUSD,
cToken.exchangeRateStored(),
cToken.balanceOf(owner),
cToken.borrowBalanceStored(owner),
cToken.totalBorrows(),
_totalBorrowed,
add(_totalBorrowed, cToken.getCash()),
troller.borrowCaps(cAddress[i]),
cToken.supplyRatePerBlock(),
cToken.borrowRatePerBlock(),
collateralFactor,
troller.compSpeeds(cAddress[i]),
isComped,
troller.borrowGuardianPaused(cAddress[i])
);

View File

@ -58,6 +58,10 @@ interface AaveLendingPool {
);
}
interface TokenInterface {
function totalSupply() external view returns (uint);
}
interface AaveAddressProvider {
function getLendingPool() external view returns (address);
function getPriceOracle() external view returns (address);
@ -204,6 +208,7 @@ contract AaveHelpers is DSMath {
bool stableBorrowEnabled;
bool isActive;
bool isFrozen;
uint totalSupply;
uint availableLiquidity;
uint totalStableDebt;
uint totalVariableDebt;
@ -259,6 +264,7 @@ contract AaveHelpers is DSMath {
aaveTokenData.collateralEmission = _data.emissionPerSecond;
_data = incentives.assets(debtToken);
aaveTokenData.debtEmission = _data.emissionPerSecond;
aaveTokenData.totalSupply = TokenInterface(aToken).totalSupply();
}
function getTokenData(