mirror of
https://github.com/Instadapp/aave-protocol-v2.git
synced 2024-07-29 21:47:30 +00:00
added try catch to user method
This commit is contained in:
parent
ae58a05f43
commit
9417062c98
|
@ -162,64 +162,70 @@ contract UiIncentiveDataProvider is IUiIncentiveDataProvider {
|
|||
userReservesIncentivesData[i].underlyingAsset = reserves[i];
|
||||
|
||||
IUiIncentiveDataProvider.UserIncentiveData memory aUserIncentiveData;
|
||||
IAaveIncentivesController aTokenIncentiveController =
|
||||
IAToken(baseData.aTokenAddress).getIncentivesController();
|
||||
|
||||
try IAToken(baseData.aTokenAddress).getIncentivesController() returns (IAaveIncentivesController aTokenIncentiveController) {
|
||||
if (address(aTokenIncentiveController) != address(0)) {
|
||||
address aRewardToken = aTokenIncentiveController.REWARD_TOKEN();
|
||||
aUserIncentiveData.tokenincentivesUserIndex = aTokenIncentiveController.getUserAssetData(
|
||||
user,
|
||||
baseData.aTokenAddress
|
||||
);
|
||||
aUserIncentiveData.userUnclaimedRewards = aTokenIncentiveController.getUserUnclaimedRewards(
|
||||
user
|
||||
);
|
||||
aUserIncentiveData.tokenAddress = baseData.aTokenAddress;
|
||||
aUserIncentiveData.rewardTokenAddress = aRewardToken;
|
||||
aUserIncentiveData.incentiveControllerAddress = address(aTokenIncentiveController);
|
||||
aUserIncentiveData.rewardTokenDecimals = IERC20Detailed(aRewardToken).decimals();
|
||||
}
|
||||
} catch (bytes memory /*lowLevelData*/) {
|
||||
|
||||
if (address(aTokenIncentiveController) != address(0)) {
|
||||
address aRewardToken = aTokenIncentiveController.REWARD_TOKEN();
|
||||
aUserIncentiveData.tokenincentivesUserIndex = aTokenIncentiveController.getUserAssetData(
|
||||
user,
|
||||
baseData.aTokenAddress
|
||||
);
|
||||
aUserIncentiveData.userUnclaimedRewards = aTokenIncentiveController.getUserUnclaimedRewards(
|
||||
user
|
||||
);
|
||||
aUserIncentiveData.tokenAddress = baseData.aTokenAddress;
|
||||
aUserIncentiveData.rewardTokenAddress = aRewardToken;
|
||||
aUserIncentiveData.incentiveControllerAddress = address(aTokenIncentiveController);
|
||||
aUserIncentiveData.rewardTokenDecimals = IERC20Detailed(aRewardToken).decimals();
|
||||
}
|
||||
|
||||
userReservesIncentivesData[i].aTokenIncentivesUserData = aUserIncentiveData;
|
||||
|
||||
UserIncentiveData memory vUserIncentiveData;
|
||||
IAaveIncentivesController vTokenIncentiveController =
|
||||
IVariableDebtToken(baseData.variableDebtTokenAddress).getIncentivesController();
|
||||
|
||||
try IVariableDebtToken(baseData.variableDebtTokenAddress).getIncentivesController() returns(IAaveIncentivesController vTokenIncentiveController) {
|
||||
if (address(vTokenIncentiveController) != address(0)) {
|
||||
address vRewardToken = vTokenIncentiveController.REWARD_TOKEN();
|
||||
vUserIncentiveData.tokenincentivesUserIndex = vTokenIncentiveController.getUserAssetData(
|
||||
user,
|
||||
baseData.variableDebtTokenAddress
|
||||
);
|
||||
vUserIncentiveData.userUnclaimedRewards = vTokenIncentiveController.getUserUnclaimedRewards(
|
||||
user
|
||||
);
|
||||
vUserIncentiveData.tokenAddress = baseData.variableDebtTokenAddress;
|
||||
vUserIncentiveData.rewardTokenAddress = vRewardToken;
|
||||
vUserIncentiveData.incentiveControllerAddress = address(vTokenIncentiveController);
|
||||
vUserIncentiveData.rewardTokenDecimals = IERC20Detailed(vRewardToken).decimals();
|
||||
}
|
||||
} catch (bytes memory /*lowLevelData*/) {
|
||||
|
||||
if (address(vTokenIncentiveController) != address(0)) {
|
||||
address vRewardToken = vTokenIncentiveController.REWARD_TOKEN();
|
||||
vUserIncentiveData.tokenincentivesUserIndex = vTokenIncentiveController.getUserAssetData(
|
||||
user,
|
||||
baseData.variableDebtTokenAddress
|
||||
);
|
||||
vUserIncentiveData.userUnclaimedRewards = vTokenIncentiveController.getUserUnclaimedRewards(
|
||||
user
|
||||
);
|
||||
vUserIncentiveData.tokenAddress = baseData.variableDebtTokenAddress;
|
||||
vUserIncentiveData.rewardTokenAddress = vRewardToken;
|
||||
vUserIncentiveData.incentiveControllerAddress = address(vTokenIncentiveController);
|
||||
vUserIncentiveData.rewardTokenDecimals = IERC20Detailed(vRewardToken).decimals();
|
||||
}
|
||||
|
||||
userReservesIncentivesData[i].vTokenIncentivesUserData = vUserIncentiveData;
|
||||
|
||||
UserIncentiveData memory sUserIncentiveData;
|
||||
IAaveIncentivesController sTokenIncentiveController =
|
||||
IStableDebtToken(baseData.stableDebtTokenAddress).getIncentivesController();
|
||||
|
||||
try IStableDebtToken(baseData.stableDebtTokenAddress).getIncentivesController() returns (IAaveIncentivesController sTokenIncentiveController) {
|
||||
if (address(sTokenIncentiveController) != address(0)) {
|
||||
address sRewardToken = sTokenIncentiveController.REWARD_TOKEN();
|
||||
sUserIncentiveData.tokenincentivesUserIndex = sTokenIncentiveController.getUserAssetData(
|
||||
user,
|
||||
baseData.stableDebtTokenAddress
|
||||
);
|
||||
sUserIncentiveData.userUnclaimedRewards = sTokenIncentiveController.getUserUnclaimedRewards(
|
||||
user
|
||||
);
|
||||
sUserIncentiveData.tokenAddress = baseData.stableDebtTokenAddress;
|
||||
sUserIncentiveData.rewardTokenAddress = sRewardToken;
|
||||
sUserIncentiveData.incentiveControllerAddress = address(sTokenIncentiveController);
|
||||
sUserIncentiveData.rewardTokenDecimals = IERC20Detailed(sRewardToken).decimals();
|
||||
}
|
||||
} catch (bytes memory /*lowLevelData*/) {
|
||||
|
||||
if (address(sTokenIncentiveController) != address(0)) {
|
||||
address sRewardToken = sTokenIncentiveController.REWARD_TOKEN();
|
||||
sUserIncentiveData.tokenincentivesUserIndex = sTokenIncentiveController.getUserAssetData(
|
||||
user,
|
||||
baseData.stableDebtTokenAddress
|
||||
);
|
||||
sUserIncentiveData.userUnclaimedRewards = sTokenIncentiveController.getUserUnclaimedRewards(
|
||||
user
|
||||
);
|
||||
sUserIncentiveData.tokenAddress = baseData.stableDebtTokenAddress;
|
||||
sUserIncentiveData.rewardTokenAddress = sRewardToken;
|
||||
sUserIncentiveData.incentiveControllerAddress = address(sTokenIncentiveController);
|
||||
sUserIncentiveData.rewardTokenDecimals = IERC20Detailed(sRewardToken).decimals();
|
||||
}
|
||||
|
||||
userReservesIncentivesData[i].sTokenIncentivesUserData = sUserIncentiveData;
|
||||
|
|
|
@ -16,7 +16,7 @@ require('dotenv').config();
|
|||
|
||||
import '@nomiclabs/hardhat-ethers';
|
||||
import '@nomiclabs/hardhat-waffle';
|
||||
import 'temp-hardhat-etherscan';
|
||||
import '@nomiclabs/hardhat-etherscan';
|
||||
import 'hardhat-gas-reporter';
|
||||
import 'hardhat-typechain';
|
||||
import '@tenderly/hardhat-tenderly';
|
||||
|
|
|
@ -142,14 +142,8 @@ export const linkBytecode = (artifact: BuidlerArtifact | Artifact, libraries: an
|
|||
};
|
||||
|
||||
export const getParamPerNetwork = <T>(param: iParamsPerNetwork<T>, network: eNetwork) => {
|
||||
const {
|
||||
main,
|
||||
ropsten,
|
||||
kovan,
|
||||
coverage,
|
||||
buidlerevm,
|
||||
tenderlyMain,
|
||||
} = param as iEthereumParamsPerNetwork<T>;
|
||||
const { main, ropsten, kovan, coverage, buidlerevm, tenderlyMain } =
|
||||
param as iEthereumParamsPerNetwork<T>;
|
||||
const { matic, mumbai } = param as iPolygonParamsPerNetwork<T>;
|
||||
const { xdai } = param as iXDaiParamsPerNetwork<T>;
|
||||
if (process.env.FORK) {
|
||||
|
@ -332,13 +326,10 @@ export const verifyContract = async (
|
|||
instance: Contract,
|
||||
args: (string | string[])[]
|
||||
) => {
|
||||
if (usingPolygon()) {
|
||||
await verifyAtPolygon(id, instance, args);
|
||||
} else {
|
||||
if (usingTenderly()) {
|
||||
await verifyAtTenderly(id, instance);
|
||||
}
|
||||
await verifyEtherscanContract(instance.address, args);
|
||||
if (usingTenderly()) {
|
||||
await verifyAtTenderly(id, instance);
|
||||
}
|
||||
await verifyEtherscanContract(instance.address, args);
|
||||
|
||||
return instance;
|
||||
};
|
||||
|
|
|
@ -14,7 +14,7 @@ const okErrors = [`Contract source code already verified`];
|
|||
|
||||
const unableVerifyError = 'Fail - Unable to verify';
|
||||
|
||||
export const SUPPORTED_ETHERSCAN_NETWORKS = ['main', 'ropsten', 'kovan'];
|
||||
export const SUPPORTED_ETHERSCAN_NETWORKS = ['main', 'ropsten', 'kovan', 'mumbai', 'matic'];
|
||||
|
||||
function delay(ms: number) {
|
||||
return new Promise((resolve) => setTimeout(resolve, ms));
|
||||
|
|
15
package-lock.json
generated
15
package-lock.json
generated
|
@ -1724,6 +1724,21 @@
|
|||
"integrity": "sha512-6quxWe8wwS4X5v3Au8q1jOvXYEPkS1Fh+cME5u6AwNdnI4uERvPlVjlgRWzpnb+Rrt1l/cEqiNRH9GlsBMSDQg==",
|
||||
"dev": true
|
||||
},
|
||||
"@nomiclabs/hardhat-etherscan": {
|
||||
"version": "2.1.6",
|
||||
"resolved": "https://registry.npmjs.org/@nomiclabs/hardhat-etherscan/-/hardhat-etherscan-2.1.6.tgz",
|
||||
"integrity": "sha512-gCvT5fj8GbXS9+ACS3BzrX0pzYHHZqAHCb+NcipOkl2cy48FakUXlzrCf4P4sTH+Y7W10OgT62ezD1sJ+/NikQ==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"@ethersproject/abi": "^5.1.2",
|
||||
"@ethersproject/address": "^5.0.2",
|
||||
"cbor": "^5.0.2",
|
||||
"debug": "^4.1.1",
|
||||
"fs-extra": "^7.0.1",
|
||||
"node-fetch": "^2.6.0",
|
||||
"semver": "^6.3.0"
|
||||
}
|
||||
},
|
||||
"@nomiclabs/hardhat-waffle": {
|
||||
"version": "2.0.1",
|
||||
"resolved": "https://registry.npmjs.org/@nomiclabs/hardhat-waffle/-/hardhat-waffle-2.0.1.tgz",
|
||||
|
|
|
@ -72,8 +72,8 @@
|
|||
"mumbai:deployUIProvider": "hardhat --network mumbai deploy-UiPoolDataProvider",
|
||||
"dev:deployUIIncentivesProvider": "hardhat --network kovan deploy-UiIncentiveDataProvider --verify",
|
||||
"main:deployUIIncentivesProvider": "hardhat --network main deploy-UiIncentiveDataProvider --verify",
|
||||
"matic:deployUIIncentivesProvider": "hardhat --network matic deploy-UiIncentiveDataProvider",
|
||||
"mumbai:deployUIIncentivesProvider": "hardhat --network mumbai deploy-UiIncentiveDataProvider",
|
||||
"matic:deployUIIncentivesProvider": "hardhat --network matic deploy-UiIncentiveDataProvider --verify",
|
||||
"mumbai:deployUIIncentivesProvider": "hardhat --network mumbai deploy-UiIncentiveDataProvider --verify",
|
||||
"dev:deployUniswapRepayAdapter": "hardhat --network kovan deploy-UniswapRepayAdapter --provider 0x88757f2f99175387aB4C6a4b3067c77A695b0349 --router 0xfcd87315f0e4067070ade8682fcdbc3006631441 --weth 0xd0a1e359811322d97991e03f863a0c30c2cf029c",
|
||||
"dev:UniswapLiquiditySwapAdapter": "hardhat --network kovan deploy-UniswapLiquiditySwapAdapter --provider 0x88757f2f99175387aB4C6a4b3067c77A695b0349 --router 0xfcd87315f0e4067070ade8682fcdbc3006631441 --weth 0xd0a1e359811322d97991e03f863a0c30c2cf029c",
|
||||
"main:deployUniswapRepayAdapter": "hardhat --network main deploy-UniswapRepayAdapter --provider 0xB53C1a33016B2DC2fF3653530bfF1848a515c8c5 --router 0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D --weth 0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2",
|
||||
|
@ -100,6 +100,7 @@
|
|||
"@nomiclabs/buidler-etherscan": "^2.1.0",
|
||||
"@nomiclabs/buidler-waffle": "2.0.0",
|
||||
"@nomiclabs/hardhat-ethers": "^2.0.0",
|
||||
"@nomiclabs/hardhat-etherscan": "^2.1.6",
|
||||
"@nomiclabs/hardhat-waffle": "^2.0.0",
|
||||
"@openzeppelin/contracts": "3.1.0",
|
||||
"@tenderly/hardhat-tenderly": "^1.1.0-beta.8",
|
||||
|
|
Loading…
Reference in New Issue
Block a user