added 0 address check in case we dont have incentives controller

This commit is contained in:
sendra 2021-06-07 13:39:34 +02:00
parent 5e5962372e
commit 6319733e82
2 changed files with 47 additions and 40 deletions

View File

@ -131,6 +131,7 @@ contract UiPoolDataProvider is IUiPoolDataProvider {
); );
// incentives // incentives
if (address(incentivesController) != address(0)) {
IAaveIncentivesController.AssetData memory tokenIncentivesInfo = IAaveIncentivesController.AssetData memory tokenIncentivesInfo =
incentivesController.assets(reserveData.aTokenAddress); incentivesController.assets(reserveData.aTokenAddress);
reserveData.aEmissionPerSecond = tokenIncentivesInfo.emissionPerSecond; reserveData.aEmissionPerSecond = tokenIncentivesInfo.emissionPerSecond;
@ -146,9 +147,11 @@ contract UiPoolDataProvider is IUiPoolDataProvider {
reserveData.vEmissionPerSecond = tokenIncentivesInfo.emissionPerSecond; reserveData.vEmissionPerSecond = tokenIncentivesInfo.emissionPerSecond;
reserveData.vIncentivesLastUpdateTimestamp = tokenIncentivesInfo.lastUpdateTimestamp; reserveData.vIncentivesLastUpdateTimestamp = tokenIncentivesInfo.lastUpdateTimestamp;
reserveData.vTokenIncentivesIndex = tokenIncentivesInfo.index; reserveData.vTokenIncentivesIndex = tokenIncentivesInfo.index;
}
if (user != address(0)) { if (user != address(0)) {
// incentives // incentives
if (address(incentivesController) != address(0)) {
userReservesData[i].aTokenincentivesUserIndex = incentivesController.getUserAssetData( userReservesData[i].aTokenincentivesUserIndex = incentivesController.getUserAssetData(
user, user,
reserveData.aTokenAddress reserveData.aTokenAddress
@ -161,6 +164,7 @@ contract UiPoolDataProvider is IUiPoolDataProvider {
user, user,
reserveData.variableDebtTokenAddress reserveData.variableDebtTokenAddress
); );
}
// user reserve data // user reserve data
userReservesData[i].underlyingAsset = reserveData.underlyingAsset; userReservesData[i].underlyingAsset = reserveData.underlyingAsset;
userReservesData[i].scaledATokenBalance = IAToken(reserveData.aTokenAddress) userReservesData[i].scaledATokenBalance = IAToken(reserveData.aTokenAddress)
@ -196,12 +200,15 @@ contract UiPoolDataProvider is IUiPoolDataProvider {
IncentivesControllerData memory incentivesControllerData; IncentivesControllerData memory incentivesControllerData;
if (address(incentivesController) != address(0)) {
incentivesControllerData.userUnclaimedRewards = incentivesController.getUserUnclaimedRewards(user); incentivesControllerData.userUnclaimedRewards = incentivesController.getUserUnclaimedRewards(user);
// incentivesControllerData.rewardToken = incentivesController.REWARD_TOKEN(); // incentivesControllerData.rewardToken = incentivesController.REWARD_TOKEN();
// incentivesControllerData.rewardTokenDecimals = IERC20Detailed(incentivesControllerData.rewardToken).decimals(); // incentivesControllerData.rewardTokenDecimals = IERC20Detailed(incentivesControllerData.rewardToken).decimals();
// incentivesControllerData.rewardTokenSymbol = IERC20Detailed(incentivesControllerData.rewardToken).symbol(); // incentivesControllerData.rewardTokenSymbol = IERC20Detailed(incentivesControllerData.rewardToken).symbol();
// incentivesControllerData.precision = incentivesController.PRECISION(); // incentivesControllerData.precision = incentivesController.PRECISION();
incentivesControllerData.emissionEndTimestamp = incentivesController.DISTRIBUTION_END(); incentivesControllerData.emissionEndTimestamp = incentivesController.DISTRIBUTION_END();
}
return ( return (
reservesData, reservesData,

View File

@ -11,14 +11,14 @@ task(`deploy-${eContractid.UiPoolDataProvider}`, `Deploys the UiPoolDataProvider
} }
const addressesByNetwork = { const addressesByNetwork = {
// [eEthereumNetwork.kovan]: { [eEthereumNetwork.kovan]: {
// incentivesController: '', incentivesController: '0x0000000000000000000000000000000000000000',
// aaveOracle: '', aaveOracle: '0x8fb777d67e9945e2c01936e319057f9d41d559e6',
// }, },
// [eEthereumNetwork.main]: { [eEthereumNetwork.main]: {
// incentivesController: '', incentivesController: '0xd784927Ff2f95ba542BfC824c8a8a98F3495f6b5',
// aaveOracle: '0xa50ba011c48153de246e5192c8f9258a2ba79ca9', aaveOracle: '0xa50ba011c48153de246e5192c8f9258a2ba79ca9',
// }, },
[ePolygonNetwork.matic]: { [ePolygonNetwork.matic]: {
incentivesController: '0x357D51124f59836DeD84c8a1730D72B749d8BC23', incentivesController: '0x357D51124f59836DeD84c8a1730D72B749d8BC23',
aaveOracle: '0x21451bD7b528896B4AB2b9764b521D6ed641708d', aaveOracle: '0x21451bD7b528896B4AB2b9764b521D6ed641708d',