mirror of
https://github.com/Instadapp/aave-protocol-v2.git
synced 2024-07-29 21:47:30 +00:00
fix: added try catch for incentives controller interactions
This commit is contained in:
parent
9df1502f22
commit
60dc2346c8
|
@ -131,38 +131,61 @@ contract UiPoolDataProvider is IUiPoolDataProvider {
|
||||||
);
|
);
|
||||||
|
|
||||||
// incentives
|
// incentives
|
||||||
(
|
try incentivesController.getAssetData(reserveData.aTokenAddress) returns (
|
||||||
reserveData.aEmissionPerSecond,
|
uint256 aEmissionPerSecond, uint256 aIncentivesLastUpdateTimestamp, uint256 aTokenIncentivesIndex) {
|
||||||
reserveData.aIncentivesLastUpdateTimestamp,
|
|
||||||
reserveData.aTokenIncentivesIndex
|
reserveData.aEmissionPerSecond = aEmissionPerSecond;
|
||||||
) = incentivesController.getAssetData(reserveData.aTokenAddress);
|
reserveData.aIncentivesLastUpdateTimestamp = aIncentivesLastUpdateTimestamp;
|
||||||
|
reserveData.aTokenIncentivesIndex = aTokenIncentivesIndex;
|
||||||
|
} catch Error(string memory /*reason*/) {
|
||||||
|
}
|
||||||
|
|
||||||
|
try incentivesController.getAssetData(reserveData.variableDebtTokenAddress) returns (
|
||||||
|
uint256 vEmissionPerSecond, uint256 vIncentivesLastUpdateTimestamp, uint256 vTokenIncentivesIndex) {
|
||||||
|
|
||||||
|
reserveData.vEmissionPerSecond = vEmissionPerSecond;
|
||||||
|
reserveData.vIncentivesLastUpdateTimestamp = vIncentivesLastUpdateTimestamp;
|
||||||
|
reserveData.vTokenIncentivesIndex = vTokenIncentivesIndex;
|
||||||
|
} catch Error(string memory /*reason*/) {
|
||||||
|
}
|
||||||
|
|
||||||
(
|
try incentivesController.getAssetData(reserveData.stableDebtTokenAddress) returns (
|
||||||
reserveData.sEmissionPerSecond,
|
uint256 sEmissionPerSecond, uint256 sIncentivesLastUpdateTimestamp, uint256 sTokenIncentivesIndex) {
|
||||||
reserveData.sIncentivesLastUpdateTimestamp,
|
|
||||||
reserveData.sTokenIncentivesIndex
|
reserveData.sEmissionPerSecond = sEmissionPerSecond;
|
||||||
) = incentivesController.getAssetData(reserveData.stableDebtTokenAddress);
|
reserveData.sIncentivesLastUpdateTimestamp = sIncentivesLastUpdateTimestamp;
|
||||||
|
reserveData.sTokenIncentivesIndex = sTokenIncentivesIndex;
|
||||||
(
|
} catch Error(string memory /*reason*/) {
|
||||||
reserveData.vEmissionPerSecond,
|
}
|
||||||
reserveData.vIncentivesLastUpdateTimestamp,
|
|
||||||
reserveData.vTokenIncentivesIndex
|
|
||||||
) = incentivesController.getAssetData(reserveData.variableDebtTokenAddress);
|
|
||||||
|
|
||||||
if (user != address(0)) {
|
if (user != address(0)) {
|
||||||
// incentives
|
// incentives
|
||||||
userReservesData[i].aTokenincentivesUserIndex = incentivesController.getUserAssetData(
|
try incentivesController.getUserAssetData(
|
||||||
user,
|
user,
|
||||||
reserveData.aTokenAddress
|
reserveData.aTokenAddress
|
||||||
);
|
) returns (
|
||||||
userReservesData[i].sTokenincentivesUserIndex = incentivesController.getUserAssetData(
|
uint256 aTokenincentivesUserIndex) {
|
||||||
user,
|
userReservesData[i].aTokenincentivesUserIndex = aTokenincentivesUserIndex;
|
||||||
reserveData.stableDebtTokenAddress
|
} catch Error(string memory /*reason*/) {
|
||||||
);
|
}
|
||||||
userReservesData[i].vTokenincentivesUserIndex = incentivesController.getUserAssetData(
|
|
||||||
|
try incentivesController.getUserAssetData(
|
||||||
user,
|
user,
|
||||||
reserveData.variableDebtTokenAddress
|
reserveData.variableDebtTokenAddress
|
||||||
);
|
) returns (
|
||||||
|
uint256 vTokenincentivesUserIndex) {
|
||||||
|
userReservesData[i].vTokenincentivesUserIndex = vTokenincentivesUserIndex;
|
||||||
|
} catch Error(string memory /*reason*/) {
|
||||||
|
}
|
||||||
|
|
||||||
|
try incentivesController.getUserAssetData(
|
||||||
|
user,
|
||||||
|
reserveData.stableDebtTokenAddress
|
||||||
|
) returns (
|
||||||
|
uint256 sTokenincentivesUserIndex) {
|
||||||
|
userReservesData[i].sTokenincentivesUserIndex = sTokenincentivesUserIndex;
|
||||||
|
} catch Error(string memory /*reason*/) {
|
||||||
|
}
|
||||||
// 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,11 +219,16 @@ contract UiPoolDataProvider is IUiPoolDataProvider {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
uint256 unclaimedRewards;
|
||||||
|
try incentivesController.getUserUnclaimedRewards(user) returns (uint256 rewards) {
|
||||||
|
unclaimedRewards = rewards;
|
||||||
|
} catch Error (string memory) {}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
reservesData,
|
reservesData,
|
||||||
userReservesData,
|
userReservesData,
|
||||||
oracle.getAssetPrice(MOCK_USD_ADDRESS),
|
oracle.getAssetPrice(MOCK_USD_ADDRESS),
|
||||||
incentivesController.getUserUnclaimedRewards(user)
|
unclaimedRewards
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user