diff --git a/contracts/misc/UiPoolDataProvider.sol b/contracts/misc/UiPoolDataProvider.sol index 50a7f9ff..2d8b579a 100644 --- a/contracts/misc/UiPoolDataProvider.sol +++ b/contracts/misc/UiPoolDataProvider.sol @@ -131,36 +131,40 @@ contract UiPoolDataProvider is IUiPoolDataProvider { ); // incentives - IAaveIncentivesController.AssetData memory tokenIncentivesInfo = - incentivesController.assets(reserveData.aTokenAddress); - reserveData.aEmissionPerSecond = tokenIncentivesInfo.emissionPerSecond; - reserveData.aIncentivesLastUpdateTimestamp = tokenIncentivesInfo.lastUpdateTimestamp; - reserveData.aTokenIncentivesIndex = tokenIncentivesInfo.index; + if (address(incentivesController) != address(0)) { + IAaveIncentivesController.AssetData memory tokenIncentivesInfo = + incentivesController.assets(reserveData.aTokenAddress); + reserveData.aEmissionPerSecond = tokenIncentivesInfo.emissionPerSecond; + reserveData.aIncentivesLastUpdateTimestamp = tokenIncentivesInfo.lastUpdateTimestamp; + reserveData.aTokenIncentivesIndex = tokenIncentivesInfo.index; - tokenIncentivesInfo = incentivesController.assets(reserveData.stableDebtTokenAddress); - reserveData.sEmissionPerSecond = tokenIncentivesInfo.emissionPerSecond; - reserveData.sIncentivesLastUpdateTimestamp = tokenIncentivesInfo.lastUpdateTimestamp; - reserveData.sTokenIncentivesIndex = tokenIncentivesInfo.index; - - tokenIncentivesInfo = incentivesController.assets(reserveData.variableDebtTokenAddress); - reserveData.vEmissionPerSecond = tokenIncentivesInfo.emissionPerSecond; - reserveData.vIncentivesLastUpdateTimestamp = tokenIncentivesInfo.lastUpdateTimestamp; - reserveData.vTokenIncentivesIndex = tokenIncentivesInfo.index; + tokenIncentivesInfo = incentivesController.assets(reserveData.stableDebtTokenAddress); + reserveData.sEmissionPerSecond = tokenIncentivesInfo.emissionPerSecond; + reserveData.sIncentivesLastUpdateTimestamp = tokenIncentivesInfo.lastUpdateTimestamp; + reserveData.sTokenIncentivesIndex = tokenIncentivesInfo.index; + tokenIncentivesInfo = incentivesController.assets(reserveData.variableDebtTokenAddress); + reserveData.vEmissionPerSecond = tokenIncentivesInfo.emissionPerSecond; + reserveData.vIncentivesLastUpdateTimestamp = tokenIncentivesInfo.lastUpdateTimestamp; + reserveData.vTokenIncentivesIndex = tokenIncentivesInfo.index; + } if (user != address(0)) { // incentives - userReservesData[i].aTokenincentivesUserIndex = incentivesController.getUserAssetData( - user, - reserveData.aTokenAddress - ); - userReservesData[i].sTokenincentivesUserIndex = incentivesController.getUserAssetData( - user, - reserveData.stableDebtTokenAddress - ); - userReservesData[i].vTokenincentivesUserIndex = incentivesController.getUserAssetData( - user, - reserveData.variableDebtTokenAddress - ); + + if (address(incentivesController) != address(0)) { + userReservesData[i].aTokenincentivesUserIndex = incentivesController.getUserAssetData( + user, + reserveData.aTokenAddress + ); + userReservesData[i].sTokenincentivesUserIndex = incentivesController.getUserAssetData( + user, + reserveData.stableDebtTokenAddress + ); + userReservesData[i].vTokenincentivesUserIndex = incentivesController.getUserAssetData( + user, + reserveData.variableDebtTokenAddress + ); + } // user reserve data userReservesData[i].underlyingAsset = reserveData.underlyingAsset; userReservesData[i].scaledATokenBalance = IAToken(reserveData.aTokenAddress) @@ -196,13 +200,16 @@ contract UiPoolDataProvider is IUiPoolDataProvider { IncentivesControllerData memory incentivesControllerData; - incentivesControllerData.userUnclaimedRewards = incentivesController.getUserUnclaimedRewards(user); - // incentivesControllerData.rewardToken = incentivesController.REWARD_TOKEN(); - // incentivesControllerData.rewardTokenDecimals = IERC20Detailed(incentivesControllerData.rewardToken).decimals(); - // incentivesControllerData.rewardTokenSymbol = IERC20Detailed(incentivesControllerData.rewardToken).symbol(); - // incentivesControllerData.precision = incentivesController.PRECISION(); - incentivesControllerData.emissionEndTimestamp = incentivesController.DISTRIBUTION_END(); + if (address(incentivesController) != address(0)) { + incentivesControllerData.userUnclaimedRewards = incentivesController.getUserUnclaimedRewards(user); + // incentivesControllerData.rewardToken = incentivesController.REWARD_TOKEN(); + // incentivesControllerData.rewardTokenDecimals = IERC20Detailed(incentivesControllerData.rewardToken).decimals(); + // incentivesControllerData.rewardTokenSymbol = IERC20Detailed(incentivesControllerData.rewardToken).symbol(); + // incentivesControllerData.precision = incentivesController.PRECISION(); + incentivesControllerData.emissionEndTimestamp = incentivesController.DISTRIBUTION_END(); + } + return ( reservesData, userReservesData, diff --git a/tasks/deployments/deploy-UiPoolDataProvider.ts b/tasks/deployments/deploy-UiPoolDataProvider.ts index c2646923..6cc07449 100644 --- a/tasks/deployments/deploy-UiPoolDataProvider.ts +++ b/tasks/deployments/deploy-UiPoolDataProvider.ts @@ -11,14 +11,14 @@ task(`deploy-${eContractid.UiPoolDataProvider}`, `Deploys the UiPoolDataProvider } const addressesByNetwork = { - // [eEthereumNetwork.kovan]: { - // incentivesController: '', - // aaveOracle: '', - // }, - // [eEthereumNetwork.main]: { - // incentivesController: '', - // aaveOracle: '0xa50ba011c48153de246e5192c8f9258a2ba79ca9', - // }, + [eEthereumNetwork.kovan]: { + incentivesController: '0x0000000000000000000000000000000000000000', + aaveOracle: '0x8fb777d67e9945e2c01936e319057f9d41d559e6', + }, + [eEthereumNetwork.main]: { + incentivesController: '0xd784927Ff2f95ba542BfC824c8a8a98F3495f6b5', + aaveOracle: '0xa50ba011c48153de246e5192c8f9258a2ba79ca9', + }, [ePolygonNetwork.matic]: { incentivesController: '0x357D51124f59836DeD84c8a1730D72B749d8BC23', aaveOracle: '0x21451bD7b528896B4AB2b9764b521D6ed641708d',