Add emission details

This commit is contained in:
Mubaris NK 2021-04-27 16:05:25 +05:30
parent 237090f566
commit c7fda67f38
No known key found for this signature in database
GPG Key ID: 9AC09AD0F8D68561
2 changed files with 54 additions and 2 deletions

View File

@ -71,10 +71,20 @@ interface AavePriceOracle {
}
interface AaveIncentivesInterface {
struct AssetData {
uint128 emissionPerSecond;
uint128 lastUpdateTimestamp;
uint256 index;
}
function getRewardsBalance(
address[] calldata assets,
address user
) external view returns (uint256);
function assets(
address asset
) external view returns (AssetData memory);
}
interface ChainLinkInterface {
@ -201,6 +211,8 @@ contract AaveHelpers is DSMath {
uint availableLiquidity;
uint totalStableDebt;
uint totalVariableDebt;
uint collateralEmission;
uint debtEmission;
}
struct TokenPrice {
@ -237,6 +249,20 @@ contract AaveHelpers is DSMath {
aaveTokenData.isActive,
aaveTokenData.isFrozen
) = aaveData.getReserveConfigurationData(token);
(
address aToken,
,
address debtToken
) = aaveData.getReserveTokensAddresses(token);
AaveIncentivesInterface.AssetData memory _data;
AaveIncentivesInterface incentives = AaveIncentivesInterface(getAaveIncentivesAddress());
_data = incentives.assets(aToken);
aaveTokenData.collateralEmission = _data.emissionPerSecond;
_data = incentives.assets(debtToken);
aaveTokenData.debtEmission = _data.emissionPerSecond;
}
function getTokenData(
@ -337,5 +363,5 @@ contract Resolver is AaveHelpers {
}
contract InstaAaveV2Resolver is Resolver {
string public constant name = "AaveV2-Resolver-v1.5";
string public constant name = "AaveV2-Resolver-v1.6";
}

View File

@ -71,10 +71,20 @@ interface AavePriceOracle {
}
interface AaveIncentivesInterface {
struct AssetData {
uint128 emissionPerSecond;
uint128 lastUpdateTimestamp;
uint256 index;
}
function getRewardsBalance(
address[] calldata assets,
address user
) external view returns (uint256);
function assets(
address asset
) external view returns (AssetData memory);
}
interface ChainLinkInterface {
@ -197,6 +207,8 @@ contract AaveHelpers is DSMath {
uint availableLiquidity;
uint totalStableDebt;
uint totalVariableDebt;
uint collateralEmission;
uint debtEmission;
}
struct TokenPrice {
@ -233,6 +245,20 @@ contract AaveHelpers is DSMath {
aaveTokenData.isActive,
aaveTokenData.isFrozen
) = aaveData.getReserveConfigurationData(token);
(
address aToken,
,
address debtToken
) = aaveData.getReserveTokensAddresses(token);
AaveIncentivesInterface.AssetData memory _data;
AaveIncentivesInterface incentives = AaveIncentivesInterface(getAaveIncentivesAddress());
_data = incentives.assets(aToken);
aaveTokenData.collateralEmission = _data.emissionPerSecond;
_data = incentives.assets(debtToken);
aaveTokenData.debtEmission = _data.emissionPerSecond;
}
function getTokenData(
@ -333,5 +359,5 @@ contract Resolver is AaveHelpers {
}
contract InstaAaveV2Resolver is Resolver {
string public constant name = "AaveV2-Resolver-v1.5";
string public constant name = "AaveV2-Resolver-v1.6";
}