Skip to content

Commit 4e3701c

Browse files
authored
Merge pull request #77 from aave/feat/incentives-end-emission
Feat/incentives end emission
2 parents 53b2723 + 5f34943 commit 4e3701c

File tree

4 files changed

+32
-11
lines changed

4 files changed

+32
-11
lines changed

contracts/interfaces/IAaveIncentivesController.sol

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -125,4 +125,9 @@ interface IAaveIncentivesController {
125125
* @dev for backward compatibility with previous implementation of the Incentives controller
126126
*/
127127
function PRECISION() external view returns (uint8);
128+
129+
/**
130+
* @dev Gets the distribution end timestamp of the emissions
131+
*/
132+
function DISTRIBUTION_END() external view returns (uint256);
128133
}

contracts/misc/UiPoolDataProvider.sol

Lines changed: 18 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ contract UiPoolDataProvider is IUiPoolDataProvider {
5959
AggregatedReserveData[] memory,
6060
UserReserveData[] memory,
6161
uint256,
62-
uint256
62+
IncentivesControllerData memory
6363
)
6464
{
6565
ILendingPool lendingPool = ILendingPool(provider.getLendingPool());
@@ -133,21 +133,21 @@ contract UiPoolDataProvider is IUiPoolDataProvider {
133133
// incentives
134134
if (address(0) != address(incentivesController)) {
135135
(
136+
reserveData.aTokenIncentivesIndex,
136137
reserveData.aEmissionPerSecond,
137-
reserveData.aIncentivesLastUpdateTimestamp,
138-
reserveData.aTokenIncentivesIndex
138+
reserveData.aIncentivesLastUpdateTimestamp
139139
) = incentivesController.getAssetData(reserveData.aTokenAddress);
140140

141141
(
142+
reserveData.sTokenIncentivesIndex,
142143
reserveData.sEmissionPerSecond,
143-
reserveData.sIncentivesLastUpdateTimestamp,
144-
reserveData.sTokenIncentivesIndex
144+
reserveData.sIncentivesLastUpdateTimestamp
145145
) = incentivesController.getAssetData(reserveData.stableDebtTokenAddress);
146146

147147
(
148+
reserveData.vTokenIncentivesIndex,
148149
reserveData.vEmissionPerSecond,
149-
reserveData.vIncentivesLastUpdateTimestamp,
150-
reserveData.vTokenIncentivesIndex
150+
reserveData.vIncentivesLastUpdateTimestamp
151151
) = incentivesController.getAssetData(reserveData.variableDebtTokenAddress);
152152
}
153153

@@ -200,11 +200,21 @@ contract UiPoolDataProvider is IUiPoolDataProvider {
200200
}
201201
}
202202

203+
204+
IncentivesControllerData memory incentivesControllerData;
205+
206+
if (address(0) != address(incentivesController)) {
207+
if (user != address(0)) {
208+
incentivesControllerData.userUnclaimedRewards = incentivesController.getUserUnclaimedRewards(user);
209+
}
210+
incentivesControllerData.emissionEndTimestamp = incentivesController.DISTRIBUTION_END();
211+
}
212+
203213
return (
204214
reservesData,
205215
userReservesData,
206216
oracle.getAssetPrice(MOCK_USD_ADDRESS),
207-
incentivesController.getUserUnclaimedRewards(user)
217+
incentivesControllerData
208218
);
209219
}
210220
}

contracts/misc/interfaces/IUiPoolDataProvider.sol

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,13 +68,19 @@ interface IUiPoolDataProvider {
6868
uint256 sTokenincentivesUserIndex;
6969
}
7070

71+
struct IncentivesControllerData {
72+
uint256 userUnclaimedRewards;
73+
uint256 emissionEndTimestamp;
74+
}
75+
76+
7177
function getReservesData(ILendingPoolAddressesProvider provider, address user)
7278
external
7379
view
7480
returns (
7581
AggregatedReserveData[] memory,
7682
UserReserveData[] memory,
7783
uint256,
78-
uint256
84+
IncentivesControllerData memory
7985
);
8086
}

tasks/deployments/deploy-UiPoolDataProvider.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ task(`deploy-${eContractid.UiPoolDataProvider}`, `Deploys the UiPoolDataProvider
2525
},
2626
[ePolygonNetwork.matic]: {
2727
incentivesController: '0x357D51124f59836DeD84c8a1730D72B749d8BC23',
28-
aaveOracle: '0x21451bD7b528896B4AB2b9764b521D6ed641708d',
28+
aaveOracle: '0x0229F777B0fAb107F9591a41d5F02E4e98dB6f2d',
2929
},
3030
[ePolygonNetwork.mumbai]: {
3131
incentivesController: '0xd41aE58e803Edf4304334acCE4DC4Ec34a63C644',
@@ -42,7 +42,7 @@ task(`deploy-${eContractid.UiPoolDataProvider}`, `Deploys the UiPoolDataProvider
4242
}
4343

4444
const oracle = addressesByNetwork[network].aaveOracle;
45-
const incentivesController = addressesByNetwork[network].aaveOracle;
45+
const incentivesController = addressesByNetwork[network].incentivesController;
4646

4747
console.log(`\n- UiPoolDataProvider deployment`);
4848

0 commit comments

Comments
 (0)