mirror of
https://github.com/Instadapp/aave-protocol-v2.git
synced 2024-07-29 21:47:30 +00:00
added extra checks and fallbacks
This commit is contained in:
parent
9417062c98
commit
b206ea0023
|
@ -54,51 +54,87 @@ contract UiIncentiveDataProvider is IUiIncentiveDataProvider {
|
||||||
|
|
||||||
try IStableDebtToken(baseData.aTokenAddress).getIncentivesController() returns (IAaveIncentivesController aTokenIncentiveController) {
|
try IStableDebtToken(baseData.aTokenAddress).getIncentivesController() returns (IAaveIncentivesController aTokenIncentiveController) {
|
||||||
if (address(aTokenIncentiveController) != address(0)) {
|
if (address(aTokenIncentiveController) != address(0)) {
|
||||||
(
|
address aRewardToken = aTokenIncentiveController.REWARD_TOKEN();
|
||||||
uint256 aTokenIncentivesIndex,
|
|
||||||
uint256 aEmissionPerSecond,
|
|
||||||
uint256 aIncentivesLastUpdateTimestamp
|
|
||||||
) = aTokenIncentiveController.getAssetData(baseData.aTokenAddress);
|
|
||||||
|
|
||||||
address aRewardToken = aTokenIncentiveController.REWARD_TOKEN();
|
try aTokenIncentiveController.getAssetData(baseData.aTokenAddress) returns (
|
||||||
|
uint256 aTokenIncentivesIndex,
|
||||||
|
uint256 aEmissionPerSecond,
|
||||||
|
uint256 aIncentivesLastUpdateTimestamp
|
||||||
|
) {
|
||||||
|
reserveIncentiveData.aIncentiveData = IncentiveData(
|
||||||
|
aEmissionPerSecond,
|
||||||
|
aIncentivesLastUpdateTimestamp,
|
||||||
|
aTokenIncentivesIndex,
|
||||||
|
aTokenIncentiveController.DISTRIBUTION_END(),
|
||||||
|
baseData.aTokenAddress,
|
||||||
|
aRewardToken,
|
||||||
|
address(aTokenIncentiveController),
|
||||||
|
IERC20Detailed(aRewardToken).decimals(),
|
||||||
|
aTokenIncentiveController.PRECISION()
|
||||||
|
);
|
||||||
|
} catch (bytes memory /*lowLevelData*/) {
|
||||||
|
(
|
||||||
|
uint256 aEmissionPerSecond,
|
||||||
|
uint256 aIncentivesLastUpdateTimestamp,
|
||||||
|
uint256 aTokenIncentivesIndex
|
||||||
|
) = aTokenIncentiveController.assets(baseData.aTokenAddress);
|
||||||
|
|
||||||
reserveIncentiveData.aIncentiveData = IncentiveData(
|
reserveIncentiveData.aIncentiveData = IncentiveData(
|
||||||
aEmissionPerSecond,
|
aEmissionPerSecond,
|
||||||
aIncentivesLastUpdateTimestamp,
|
aIncentivesLastUpdateTimestamp,
|
||||||
aTokenIncentivesIndex,
|
aTokenIncentivesIndex,
|
||||||
aTokenIncentiveController.DISTRIBUTION_END(),
|
aTokenIncentiveController.DISTRIBUTION_END(),
|
||||||
baseData.aTokenAddress,
|
baseData.aTokenAddress,
|
||||||
aRewardToken,
|
aRewardToken,
|
||||||
address(aTokenIncentiveController),
|
address(aTokenIncentiveController),
|
||||||
IERC20Detailed(aRewardToken).decimals(),
|
IERC20Detailed(aRewardToken).decimals(),
|
||||||
aTokenIncentiveController.PRECISION()
|
aTokenIncentiveController.PRECISION()
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
} catch(bytes memory /*lowLevelData*/) {
|
} catch(bytes memory /*lowLevelData*/) {
|
||||||
// Will not get here
|
// Will not get here
|
||||||
}
|
}
|
||||||
|
|
||||||
try IStableDebtToken(baseData.stableDebtTokenAddress).getIncentivesController() returns (IAaveIncentivesController sTokenIncentiveController) {
|
try IStableDebtToken(baseData.stableDebtTokenAddress).getIncentivesController() returns (IAaveIncentivesController sTokenIncentiveController) {
|
||||||
if (address(sTokenIncentiveController) != address(0)) {
|
if (address(sTokenIncentiveController) != address(0)) {
|
||||||
(
|
|
||||||
|
address sRewardToken = sTokenIncentiveController.REWARD_TOKEN();
|
||||||
|
try sTokenIncentiveController.getAssetData(baseData.stableDebtTokenAddress) returns (
|
||||||
uint256 sTokenIncentivesIndex,
|
uint256 sTokenIncentivesIndex,
|
||||||
uint256 sEmissionPerSecond,
|
uint256 sEmissionPerSecond,
|
||||||
uint256 sIncentivesLastUpdateTimestamp
|
uint256 sIncentivesLastUpdateTimestamp
|
||||||
) = sTokenIncentiveController.getAssetData(baseData.stableDebtTokenAddress);
|
) {
|
||||||
|
reserveIncentiveData.sIncentiveData = IncentiveData(
|
||||||
|
sEmissionPerSecond,
|
||||||
|
sIncentivesLastUpdateTimestamp,
|
||||||
|
sTokenIncentivesIndex,
|
||||||
|
sTokenIncentiveController.DISTRIBUTION_END(),
|
||||||
|
baseData.stableDebtTokenAddress,
|
||||||
|
sRewardToken,
|
||||||
|
address(sTokenIncentiveController),
|
||||||
|
IERC20Detailed(sRewardToken).decimals(),
|
||||||
|
sTokenIncentiveController.PRECISION()
|
||||||
|
);
|
||||||
|
} catch (bytes memory /*lowLevelData*/) {
|
||||||
|
(
|
||||||
|
uint256 sEmissionPerSecond,
|
||||||
|
uint256 sIncentivesLastUpdateTimestamp,
|
||||||
|
uint256 sTokenIncentivesIndex
|
||||||
|
) = sTokenIncentiveController.assets(baseData.stableDebtTokenAddress);
|
||||||
|
|
||||||
address sRewardToken = sTokenIncentiveController.REWARD_TOKEN();
|
reserveIncentiveData.sIncentiveData = IncentiveData(
|
||||||
|
sEmissionPerSecond,
|
||||||
reserveIncentiveData.sIncentiveData = IncentiveData(
|
sIncentivesLastUpdateTimestamp,
|
||||||
sEmissionPerSecond,
|
sTokenIncentivesIndex,
|
||||||
sIncentivesLastUpdateTimestamp,
|
sTokenIncentiveController.DISTRIBUTION_END(),
|
||||||
sTokenIncentivesIndex,
|
baseData.stableDebtTokenAddress,
|
||||||
sTokenIncentiveController.DISTRIBUTION_END(),
|
sRewardToken,
|
||||||
baseData.stableDebtTokenAddress,
|
address(sTokenIncentiveController),
|
||||||
sRewardToken,
|
IERC20Detailed(sRewardToken).decimals(),
|
||||||
address(sTokenIncentiveController),
|
sTokenIncentiveController.PRECISION()
|
||||||
IERC20Detailed(sRewardToken).decimals(),
|
);
|
||||||
sTokenIncentiveController.PRECISION()
|
}
|
||||||
);
|
|
||||||
}
|
}
|
||||||
} catch(bytes memory /*lowLevelData*/) {
|
} catch(bytes memory /*lowLevelData*/) {
|
||||||
// Will not get here
|
// Will not get here
|
||||||
|
@ -106,32 +142,48 @@ contract UiIncentiveDataProvider is IUiIncentiveDataProvider {
|
||||||
|
|
||||||
try IStableDebtToken(baseData.variableDebtTokenAddress).getIncentivesController() returns (IAaveIncentivesController vTokenIncentiveController) {
|
try IStableDebtToken(baseData.variableDebtTokenAddress).getIncentivesController() returns (IAaveIncentivesController vTokenIncentiveController) {
|
||||||
if (address(vTokenIncentiveController) != address(0)) {
|
if (address(vTokenIncentiveController) != address(0)) {
|
||||||
(
|
address vRewardToken = vTokenIncentiveController.REWARD_TOKEN();
|
||||||
|
|
||||||
|
try vTokenIncentiveController.getAssetData(baseData.variableDebtTokenAddress) returns (
|
||||||
uint256 vTokenIncentivesIndex,
|
uint256 vTokenIncentivesIndex,
|
||||||
uint256 vEmissionPerSecond,
|
uint256 vEmissionPerSecond,
|
||||||
uint256 vIncentivesLastUpdateTimestamp
|
uint256 vIncentivesLastUpdateTimestamp
|
||||||
) = vTokenIncentiveController.getAssetData(baseData.variableDebtTokenAddress);
|
) {
|
||||||
|
reserveIncentiveData.vIncentiveData = IncentiveData(
|
||||||
|
vEmissionPerSecond,
|
||||||
|
vIncentivesLastUpdateTimestamp,
|
||||||
|
vTokenIncentivesIndex,
|
||||||
|
vTokenIncentiveController.DISTRIBUTION_END(),
|
||||||
|
baseData.variableDebtTokenAddress,
|
||||||
|
vRewardToken,
|
||||||
|
address(vTokenIncentiveController),
|
||||||
|
IERC20Detailed(vRewardToken).decimals(),
|
||||||
|
vTokenIncentiveController.PRECISION()
|
||||||
|
);
|
||||||
|
} catch (bytes memory /*lowLevelData*/) {
|
||||||
|
(
|
||||||
|
uint256 vEmissionPerSecond,
|
||||||
|
uint256 vIncentivesLastUpdateTimestamp,
|
||||||
|
uint256 vTokenIncentivesIndex
|
||||||
|
) = vTokenIncentiveController.assets(baseData.variableDebtTokenAddress);
|
||||||
|
|
||||||
address vRewardToken = vTokenIncentiveController.REWARD_TOKEN();
|
reserveIncentiveData.vIncentiveData = IncentiveData(
|
||||||
|
vEmissionPerSecond,
|
||||||
reserveIncentiveData.vIncentiveData = IncentiveData(
|
vIncentivesLastUpdateTimestamp,
|
||||||
vEmissionPerSecond,
|
vTokenIncentivesIndex,
|
||||||
vIncentivesLastUpdateTimestamp,
|
vTokenIncentiveController.DISTRIBUTION_END(),
|
||||||
vTokenIncentivesIndex,
|
baseData.variableDebtTokenAddress,
|
||||||
vTokenIncentiveController.DISTRIBUTION_END(),
|
vRewardToken,
|
||||||
baseData.variableDebtTokenAddress,
|
address(vTokenIncentiveController),
|
||||||
vRewardToken,
|
IERC20Detailed(vRewardToken).decimals(),
|
||||||
address(vTokenIncentiveController),
|
vTokenIncentiveController.PRECISION()
|
||||||
IERC20Detailed(vRewardToken).decimals(),
|
);
|
||||||
vTokenIncentiveController.PRECISION()
|
}
|
||||||
);
|
|
||||||
}
|
}
|
||||||
} catch(bytes memory /*lowLevelData*/) {
|
} catch(bytes memory /*lowLevelData*/) {
|
||||||
// Will not get here
|
// Will not get here
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return (reservesIncentiveData);
|
return (reservesIncentiveData);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user