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

View File

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

14
package-lock.json generated
View File

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

View File

@ -102,7 +102,7 @@
"@nomiclabs/hardhat-ethers": "^2.0.0", "@nomiclabs/hardhat-ethers": "^2.0.0",
"@nomiclabs/hardhat-waffle": "^2.0.0", "@nomiclabs/hardhat-waffle": "^2.0.0",
"@openzeppelin/contracts": "3.1.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-v4": "1.0.0",
"@typechain/ethers-v5": "^2.0.0", "@typechain/ethers-v5": "^2.0.0",
"@typechain/truffle-v4": "2.0.2", "@typechain/truffle-v4": "2.0.2",