Skip to content

Commit 6319733

Browse files
committed
added 0 address check in case we dont have incentives controller
1 parent 5e59623 commit 6319733

File tree

2 files changed

+49
-42
lines changed

2 files changed

+49
-42
lines changed

contracts/misc/UiPoolDataProvider.sol

Lines changed: 41 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -131,36 +131,40 @@ contract UiPoolDataProvider is IUiPoolDataProvider {
131131
);
132132

133133
// incentives
134-
IAaveIncentivesController.AssetData memory tokenIncentivesInfo =
135-
incentivesController.assets(reserveData.aTokenAddress);
136-
reserveData.aEmissionPerSecond = tokenIncentivesInfo.emissionPerSecond;
137-
reserveData.aIncentivesLastUpdateTimestamp = tokenIncentivesInfo.lastUpdateTimestamp;
138-
reserveData.aTokenIncentivesIndex = tokenIncentivesInfo.index;
139-
140-
tokenIncentivesInfo = incentivesController.assets(reserveData.stableDebtTokenAddress);
141-
reserveData.sEmissionPerSecond = tokenIncentivesInfo.emissionPerSecond;
142-
reserveData.sIncentivesLastUpdateTimestamp = tokenIncentivesInfo.lastUpdateTimestamp;
143-
reserveData.sTokenIncentivesIndex = tokenIncentivesInfo.index;
144-
145-
tokenIncentivesInfo = incentivesController.assets(reserveData.variableDebtTokenAddress);
146-
reserveData.vEmissionPerSecond = tokenIncentivesInfo.emissionPerSecond;
147-
reserveData.vIncentivesLastUpdateTimestamp = tokenIncentivesInfo.lastUpdateTimestamp;
148-
reserveData.vTokenIncentivesIndex = tokenIncentivesInfo.index;
149-
134+
if (address(incentivesController) != address(0)) {
135+
IAaveIncentivesController.AssetData memory tokenIncentivesInfo =
136+
incentivesController.assets(reserveData.aTokenAddress);
137+
reserveData.aEmissionPerSecond = tokenIncentivesInfo.emissionPerSecond;
138+
reserveData.aIncentivesLastUpdateTimestamp = tokenIncentivesInfo.lastUpdateTimestamp;
139+
reserveData.aTokenIncentivesIndex = tokenIncentivesInfo.index;
140+
141+
tokenIncentivesInfo = incentivesController.assets(reserveData.stableDebtTokenAddress);
142+
reserveData.sEmissionPerSecond = tokenIncentivesInfo.emissionPerSecond;
143+
reserveData.sIncentivesLastUpdateTimestamp = tokenIncentivesInfo.lastUpdateTimestamp;
144+
reserveData.sTokenIncentivesIndex = tokenIncentivesInfo.index;
145+
146+
tokenIncentivesInfo = incentivesController.assets(reserveData.variableDebtTokenAddress);
147+
reserveData.vEmissionPerSecond = tokenIncentivesInfo.emissionPerSecond;
148+
reserveData.vIncentivesLastUpdateTimestamp = tokenIncentivesInfo.lastUpdateTimestamp;
149+
reserveData.vTokenIncentivesIndex = tokenIncentivesInfo.index;
150+
}
150151
if (user != address(0)) {
151152
// incentives
152-
userReservesData[i].aTokenincentivesUserIndex = incentivesController.getUserAssetData(
153-
user,
154-
reserveData.aTokenAddress
155-
);
156-
userReservesData[i].sTokenincentivesUserIndex = incentivesController.getUserAssetData(
157-
user,
158-
reserveData.stableDebtTokenAddress
159-
);
160-
userReservesData[i].vTokenincentivesUserIndex = incentivesController.getUserAssetData(
161-
user,
162-
reserveData.variableDebtTokenAddress
163-
);
153+
154+
if (address(incentivesController) != address(0)) {
155+
userReservesData[i].aTokenincentivesUserIndex = incentivesController.getUserAssetData(
156+
user,
157+
reserveData.aTokenAddress
158+
);
159+
userReservesData[i].sTokenincentivesUserIndex = incentivesController.getUserAssetData(
160+
user,
161+
reserveData.stableDebtTokenAddress
162+
);
163+
userReservesData[i].vTokenincentivesUserIndex = incentivesController.getUserAssetData(
164+
user,
165+
reserveData.variableDebtTokenAddress
166+
);
167+
}
164168
// user reserve data
165169
userReservesData[i].underlyingAsset = reserveData.underlyingAsset;
166170
userReservesData[i].scaledATokenBalance = IAToken(reserveData.aTokenAddress)
@@ -196,13 +200,16 @@ contract UiPoolDataProvider is IUiPoolDataProvider {
196200

197201

198202
IncentivesControllerData memory incentivesControllerData;
199-
incentivesControllerData.userUnclaimedRewards = incentivesController.getUserUnclaimedRewards(user);
200-
// incentivesControllerData.rewardToken = incentivesController.REWARD_TOKEN();
201-
// incentivesControllerData.rewardTokenDecimals = IERC20Detailed(incentivesControllerData.rewardToken).decimals();
202-
// incentivesControllerData.rewardTokenSymbol = IERC20Detailed(incentivesControllerData.rewardToken).symbol();
203-
// incentivesControllerData.precision = incentivesController.PRECISION();
204-
incentivesControllerData.emissionEndTimestamp = incentivesController.DISTRIBUTION_END();
205203

204+
if (address(incentivesController) != address(0)) {
205+
incentivesControllerData.userUnclaimedRewards = incentivesController.getUserUnclaimedRewards(user);
206+
// incentivesControllerData.rewardToken = incentivesController.REWARD_TOKEN();
207+
// incentivesControllerData.rewardTokenDecimals = IERC20Detailed(incentivesControllerData.rewardToken).decimals();
208+
// incentivesControllerData.rewardTokenSymbol = IERC20Detailed(incentivesControllerData.rewardToken).symbol();
209+
// incentivesControllerData.precision = incentivesController.PRECISION();
210+
incentivesControllerData.emissionEndTimestamp = incentivesController.DISTRIBUTION_END();
211+
}
212+
206213
return (
207214
reservesData,
208215
userReservesData,

tasks/deployments/deploy-UiPoolDataProvider.ts

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,14 @@ task(`deploy-${eContractid.UiPoolDataProvider}`, `Deploys the UiPoolDataProvider
1111
}
1212

1313
const addressesByNetwork = {
14-
// [eEthereumNetwork.kovan]: {
15-
// incentivesController: '',
16-
// aaveOracle: '',
17-
// },
18-
// [eEthereumNetwork.main]: {
19-
// incentivesController: '',
20-
// aaveOracle: '0xa50ba011c48153de246e5192c8f9258a2ba79ca9',
21-
// },
14+
[eEthereumNetwork.kovan]: {
15+
incentivesController: '0x0000000000000000000000000000000000000000',
16+
aaveOracle: '0x8fb777d67e9945e2c01936e319057f9d41d559e6',
17+
},
18+
[eEthereumNetwork.main]: {
19+
incentivesController: '0xd784927Ff2f95ba542BfC824c8a8a98F3495f6b5',
20+
aaveOracle: '0xa50ba011c48153de246e5192c8f9258a2ba79ca9',
21+
},
2222
[ePolygonNetwork.matic]: {
2323
incentivesController: '0x357D51124f59836DeD84c8a1730D72B749d8BC23',
2424
aaveOracle: '0x21451bD7b528896B4AB2b9764b521D6ed641708d',

0 commit comments

Comments
 (0)