added try catch

This commit is contained in:
sendra 2021-09-24 14:19:31 +02:00
parent e3cbc75c35
commit ae58a05f43
4 changed files with 59 additions and 53 deletions

View File

@ -52,9 +52,8 @@ contract UiIncentiveDataProvider is IUiIncentiveDataProvider {
DataTypes.ReserveData memory baseData = lendingPool.getReserveData(reserves[i]);
IAaveIncentivesController aTokenIncentiveController =
IAToken(baseData.aTokenAddress).getIncentivesController();
if (address(aTokenIncentiveController) != address(0)) {
try IStableDebtToken(baseData.aTokenAddress).getIncentivesController() returns (IAaveIncentivesController aTokenIncentiveController) {
if (address(aTokenIncentiveController) != address(0)) {
(
uint256 aTokenIncentivesIndex,
uint256 aEmissionPerSecond,
@ -75,56 +74,62 @@ contract UiIncentiveDataProvider is IUiIncentiveDataProvider {
aTokenIncentiveController.PRECISION()
);
}
} catch(bytes memory /*lowLevelData*/) {
// Will not get here
}
IAaveIncentivesController sTokenIncentiveController =
IStableDebtToken(baseData.stableDebtTokenAddress).getIncentivesController();
try IStableDebtToken(baseData.stableDebtTokenAddress).getIncentivesController() returns (IAaveIncentivesController sTokenIncentiveController) {
if (address(sTokenIncentiveController) != address(0)) {
(
uint256 sTokenIncentivesIndex,
uint256 sEmissionPerSecond,
uint256 sIncentivesLastUpdateTimestamp
) = sTokenIncentiveController.getAssetData(baseData.stableDebtTokenAddress);
if (address(sTokenIncentiveController) != address(0)) {
(
uint256 sTokenIncentivesIndex,
uint256 sEmissionPerSecond,
uint256 sIncentivesLastUpdateTimestamp
) = sTokenIncentiveController.getAssetData(baseData.stableDebtTokenAddress);
address sRewardToken = sTokenIncentiveController.REWARD_TOKEN();
address sRewardToken = sTokenIncentiveController.REWARD_TOKEN();
reserveIncentiveData.sIncentiveData = IncentiveData(
sEmissionPerSecond,
sIncentivesLastUpdateTimestamp,
sTokenIncentivesIndex,
sTokenIncentiveController.DISTRIBUTION_END(),
baseData.stableDebtTokenAddress,
sRewardToken,
address(sTokenIncentiveController),
IERC20Detailed(sRewardToken).decimals(),
sTokenIncentiveController.PRECISION()
);
reserveIncentiveData.sIncentiveData = IncentiveData(
sEmissionPerSecond,
sIncentivesLastUpdateTimestamp,
sTokenIncentivesIndex,
sTokenIncentiveController.DISTRIBUTION_END(),
baseData.stableDebtTokenAddress,
sRewardToken,
address(sTokenIncentiveController),
IERC20Detailed(sRewardToken).decimals(),
sTokenIncentiveController.PRECISION()
);
}
} catch(bytes memory /*lowLevelData*/) {
// Will not get here
}
IAaveIncentivesController vTokenIncentiveController =
IVariableDebtToken(baseData.variableDebtTokenAddress).getIncentivesController();
try IStableDebtToken(baseData.variableDebtTokenAddress).getIncentivesController() returns (IAaveIncentivesController vTokenIncentiveController) {
if (address(vTokenIncentiveController) != address(0)) {
(
uint256 vTokenIncentivesIndex,
uint256 vEmissionPerSecond,
uint256 vIncentivesLastUpdateTimestamp
) = vTokenIncentiveController.getAssetData(baseData.variableDebtTokenAddress);
if (address(vTokenIncentiveController) != address(0)) {
(
uint256 vTokenIncentivesIndex,
uint256 vEmissionPerSecond,
uint256 vIncentivesLastUpdateTimestamp
) = vTokenIncentiveController.getAssetData(baseData.variableDebtTokenAddress);
address vRewardToken = vTokenIncentiveController.REWARD_TOKEN();
address vRewardToken = vTokenIncentiveController.REWARD_TOKEN();
reserveIncentiveData.vIncentiveData = IncentiveData(
vEmissionPerSecond,
vIncentivesLastUpdateTimestamp,
vTokenIncentivesIndex,
vTokenIncentiveController.DISTRIBUTION_END(),
baseData.variableDebtTokenAddress,
vRewardToken,
address(vTokenIncentiveController),
IERC20Detailed(vRewardToken).decimals(),
vTokenIncentiveController.PRECISION()
);
}
} catch(bytes memory /*lowLevelData*/) {
// Will not get here
}
reserveIncentiveData.vIncentiveData = IncentiveData(
vEmissionPerSecond,
vIncentivesLastUpdateTimestamp,
vTokenIncentivesIndex,
vTokenIncentiveController.DISTRIBUTION_END(),
baseData.variableDebtTokenAddress,
vRewardToken,
address(vTokenIncentiveController),
IERC20Detailed(vRewardToken).decimals(),
vTokenIncentiveController.PRECISION()
);
}
}
return (reservesIncentiveData);

View File

@ -96,6 +96,7 @@ const buidlerConfig: HardhatUserConfig = {
ropsten: getCommonNetworkConfig(eEthereumNetwork.ropsten, 3),
main: getCommonNetworkConfig(eEthereumNetwork.main, 1),
tenderlyMain: getCommonNetworkConfig(eEthereumNetwork.tenderlyMain, 3030),
tenderly: getCommonNetworkConfig(eEthereumNetwork.tenderlyMain, 3030),
matic: getCommonNetworkConfig(ePolygonNetwork.matic, 137),
mumbai: getCommonNetworkConfig(ePolygonNetwork.mumbai, 80001),
xdai: getCommonNetworkConfig(eXDaiNetwork.xdai, 100),

14
package-lock.json generated
View File

@ -1950,9 +1950,9 @@
}
},
"@tenderly/hardhat-tenderly": {
"version": "1.1.0-beta.5",
"resolved": "https://registry.npmjs.org/@tenderly/hardhat-tenderly/-/hardhat-tenderly-1.1.0-beta.5.tgz",
"integrity": "sha512-NecF6ewefpDyIF/mz0kTZGlPMa+ri/LOAPPqmyRA/oGEZ19BLM0sHdJFObTv8kJnxIJZBHpTkUaeDPp8KcpZsg==",
"version": "1.1.0-beta.8",
"resolved": "https://registry.npmjs.org/@tenderly/hardhat-tenderly/-/hardhat-tenderly-1.1.0-beta.8.tgz",
"integrity": "sha512-ppXvp2/CGI/1iAGZvCpHk7vBmlvUJerMcVtiXtCRZtXFO1vDs2SJ+RKaW5bI+eFFkLWx75aZVc/lxTx2vIzPsg==",
"dev": true,
"requires": {
"@nomiclabs/hardhat-ethers": "^2.0.1",
@ -2697,12 +2697,12 @@
"dev": true
},
"axios": {
"version": "0.21.1",
"resolved": "https://registry.npmjs.org/axios/-/axios-0.21.1.tgz",
"integrity": "sha512-dKQiRHxGD9PPRIUNIWvZhPTPpl1rf/OxTYKsqKUDjBwYylTvV7SjSHJb9ratfyzM6wCdLCOYLzs73qpg5c4iGA==",
"version": "0.21.4",
"resolved": "https://registry.npmjs.org/axios/-/axios-0.21.4.tgz",
"integrity": "sha512-ut5vewkiu8jjGBdqpM44XxjuCjq9LAKeHVmoVfHVzy8eHgxxq8SbAVQNovDA8mVi05kP0Ea/n/UzcSHcTJQfNg==",
"dev": true,
"requires": {
"follow-redirects": "^1.10.0"
"follow-redirects": "^1.14.0"
}
},
"axios-curlirize": {

View File

@ -102,7 +102,7 @@
"@nomiclabs/hardhat-ethers": "^2.0.0",
"@nomiclabs/hardhat-waffle": "^2.0.0",
"@openzeppelin/contracts": "3.1.0",
"@tenderly/hardhat-tenderly": "1.1.0-beta.5",
"@tenderly/hardhat-tenderly": "^1.1.0-beta.8",
"@typechain/ethers-v4": "1.0.0",
"@typechain/ethers-v5": "^2.0.0",
"@typechain/truffle-v4": "2.0.2",