Merge pull request #77 from aave/feat/incentives-end-emission

Feat/incentives end emission
This commit is contained in:
Andrey 2021-06-17 15:53:09 +03:00 committed by GitHub
commit 4e3701c196
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 32 additions and 11 deletions

View File

@ -125,4 +125,9 @@ interface IAaveIncentivesController {
* @dev for backward compatibility with previous implementation of the Incentives controller
*/
function PRECISION() external view returns (uint8);
/**
* @dev Gets the distribution end timestamp of the emissions
*/
function DISTRIBUTION_END() external view returns (uint256);
}

View File

@ -59,7 +59,7 @@ contract UiPoolDataProvider is IUiPoolDataProvider {
AggregatedReserveData[] memory,
UserReserveData[] memory,
uint256,
uint256
IncentivesControllerData memory
)
{
ILendingPool lendingPool = ILendingPool(provider.getLendingPool());
@ -133,21 +133,21 @@ contract UiPoolDataProvider is IUiPoolDataProvider {
// incentives
if (address(0) != address(incentivesController)) {
(
reserveData.aTokenIncentivesIndex,
reserveData.aEmissionPerSecond,
reserveData.aIncentivesLastUpdateTimestamp,
reserveData.aTokenIncentivesIndex
reserveData.aIncentivesLastUpdateTimestamp
) = incentivesController.getAssetData(reserveData.aTokenAddress);
(
reserveData.sTokenIncentivesIndex,
reserveData.sEmissionPerSecond,
reserveData.sIncentivesLastUpdateTimestamp,
reserveData.sTokenIncentivesIndex
reserveData.sIncentivesLastUpdateTimestamp
) = incentivesController.getAssetData(reserveData.stableDebtTokenAddress);
(
reserveData.vTokenIncentivesIndex,
reserveData.vEmissionPerSecond,
reserveData.vIncentivesLastUpdateTimestamp,
reserveData.vTokenIncentivesIndex
reserveData.vIncentivesLastUpdateTimestamp
) = incentivesController.getAssetData(reserveData.variableDebtTokenAddress);
}
@ -200,11 +200,21 @@ contract UiPoolDataProvider is IUiPoolDataProvider {
}
}
IncentivesControllerData memory incentivesControllerData;
if (address(0) != address(incentivesController)) {
if (user != address(0)) {
incentivesControllerData.userUnclaimedRewards = incentivesController.getUserUnclaimedRewards(user);
}
incentivesControllerData.emissionEndTimestamp = incentivesController.DISTRIBUTION_END();
}
return (
reservesData,
userReservesData,
oracle.getAssetPrice(MOCK_USD_ADDRESS),
incentivesController.getUserUnclaimedRewards(user)
incentivesControllerData
);
}
}

View File

@ -68,6 +68,12 @@ interface IUiPoolDataProvider {
uint256 sTokenincentivesUserIndex;
}
struct IncentivesControllerData {
uint256 userUnclaimedRewards;
uint256 emissionEndTimestamp;
}
function getReservesData(ILendingPoolAddressesProvider provider, address user)
external
view
@ -75,6 +81,6 @@ interface IUiPoolDataProvider {
AggregatedReserveData[] memory,
UserReserveData[] memory,
uint256,
uint256
IncentivesControllerData memory
);
}

View File

@ -25,7 +25,7 @@ task(`deploy-${eContractid.UiPoolDataProvider}`, `Deploys the UiPoolDataProvider
},
[ePolygonNetwork.matic]: {
incentivesController: '0x357D51124f59836DeD84c8a1730D72B749d8BC23',
aaveOracle: '0x21451bD7b528896B4AB2b9764b521D6ed641708d',
aaveOracle: '0x0229F777B0fAb107F9591a41d5F02E4e98dB6f2d',
},
[ePolygonNetwork.mumbai]: {
incentivesController: '0xd41aE58e803Edf4304334acCE4DC4Ec34a63C644',
@ -42,7 +42,7 @@ task(`deploy-${eContractid.UiPoolDataProvider}`, `Deploys the UiPoolDataProvider
}
const oracle = addressesByNetwork[network].aaveOracle;
const incentivesController = addressesByNetwork[network].aaveOracle;
const incentivesController = addressesByNetwork[network].incentivesController;
console.log(`\n- UiPoolDataProvider deployment`);