From afa025265bc149e2701f63dc575d9d1a82ba2f32 Mon Sep 17 00:00:00 2001 From: Josh Stevens Date: Wed, 1 Sep 2021 13:02:15 +0100 Subject: [PATCH 01/17] feat: bring incentive into its own data provider --- contracts/misc/UiIncentiveDataProvider.sol | 192 ++++++++++++++++++ contracts/misc/UiPoolDataProvider.sol | 126 +----------- .../interfaces/IUiIncentiveDataProvider.sol | 53 +++++ .../misc/interfaces/IUiPoolDataProvider.sol | 27 +-- 4 files changed, 256 insertions(+), 142 deletions(-) create mode 100644 contracts/misc/UiIncentiveDataProvider.sol create mode 100644 contracts/misc/interfaces/IUiIncentiveDataProvider.sol diff --git a/contracts/misc/UiIncentiveDataProvider.sol b/contracts/misc/UiIncentiveDataProvider.sol new file mode 100644 index 00000000..828c8540 --- /dev/null +++ b/contracts/misc/UiIncentiveDataProvider.sol @@ -0,0 +1,192 @@ +// SPDX-License-Identifier: agpl-3.0 +pragma solidity 0.6.12; +pragma experimental ABIEncoderV2; + +import {ILendingPoolAddressesProvider} from '../interfaces/ILendingPoolAddressesProvider.sol'; +import {IAaveIncentivesController} from '../interfaces/IAaveIncentivesController.sol'; +import {IUiIncentiveDataProvider} from './interfaces/IUiIncentiveDataProvider.sol'; +import {ILendingPool} from '../interfaces/ILendingPool.sol'; +import {IAToken} from '../interfaces/IAToken.sol'; +import {IVariableDebtToken} from '../interfaces/IVariableDebtToken.sol'; +import {IStableDebtToken} from '../interfaces/IStableDebtToken.sol'; +import {UserConfiguration} from '../protocol/libraries/configuration/UserConfiguration.sol'; +import {DataTypes} from '../protocol/libraries/types/DataTypes.sol'; + +contract UiIncentiveDataProvider is IUiIncentiveDataProvider { + using UserConfiguration for DataTypes.UserConfigurationMap; + + constructor() public {} + + function getFullReservesIncentiveData(ILendingPoolAddressesProvider provider, address user) + external + view + override + returns (AggregatedReserveIncentiveData[] memory, UserReserveIncentiveData[] memory) + { + AggregatedReserveIncentiveData[] memory reservesIncentivesData = + _getReservesIncentivesData(provider); + UserReserveIncentiveData[] memory userReservesIncentivesData = + _getUserReservesIncentivesData(provider, user); + + return (reservesIncentivesData, userReservesIncentivesData); + } + + function getReservesIncentivesData(ILendingPoolAddressesProvider provider) + external + view + override + returns (AggregatedReserveIncentiveData[] memory) + { + return _getReservesIncentivesData(provider); + } + + function _getReservesIncentivesData(ILendingPoolAddressesProvider provider) + private + view + returns (AggregatedReserveIncentiveData[] memory) + { + ILendingPool lendingPool = ILendingPool(provider.getLendingPool()); + address[] memory reserves = lendingPool.getReservesList(); + AggregatedReserveIncentiveData[] memory reservesIncentiveData = + new AggregatedReserveIncentiveData[](reserves.length); + + for (uint256 i = 0; i < reserves.length; i++) { + AggregatedReserveIncentiveData memory reserveIncentiveData = reservesIncentiveData[i]; + reserveIncentiveData.underlyingAsset = reserves[i]; + + DataTypes.ReserveData memory baseData = lendingPool.getReserveData(reserves[i]); + + IAaveIncentivesController aTokenIncentiveController = + IAToken(baseData.aTokenAddress).getIncentivesController(); + + ( + uint256 aEmissionPerSecond, + uint256 aIncentivesLastUpdateTimestamp, + uint256 aTokenIncentivesIndex + ) = aTokenIncentiveController.assets(baseData.aTokenAddress); + + reserveIncentiveData.aIncentiveData = IncentiveData( + aEmissionPerSecond, + aIncentivesLastUpdateTimestamp, + aTokenIncentivesIndex, + aTokenIncentiveController.DISTRIBUTION_END(), + baseData.aTokenAddress, + aTokenIncentiveController.REWARD_TOKEN() + ); + + IAaveIncentivesController sTokenIncentiveController = + IStableDebtToken(baseData.stableDebtTokenAddress).getIncentivesController(); + + ( + uint256 sEmissionPerSecond, + uint256 sIncentivesLastUpdateTimestamp, + uint256 sTokenIncentivesIndex + ) = sTokenIncentiveController.assets(baseData.stableDebtTokenAddress); + + reserveIncentiveData.sIncentiveData = IncentiveData( + sEmissionPerSecond, + sIncentivesLastUpdateTimestamp, + sTokenIncentivesIndex, + sTokenIncentiveController.DISTRIBUTION_END(), + baseData.stableDebtTokenAddress, + sTokenIncentiveController.REWARD_TOKEN() + ); + + IAaveIncentivesController vTokenIncentiveController = + IVariableDebtToken(baseData.variableDebtTokenAddress).getIncentivesController(); + + ( + uint256 vEmissionPerSecond, + uint256 vIncentivesLastUpdateTimestamp, + uint256 vTokenIncentivesIndex + ) = vTokenIncentiveController.assets(baseData.variableDebtTokenAddress); + + reserveIncentiveData.vIncentiveData = IncentiveData( + vEmissionPerSecond, + vIncentivesLastUpdateTimestamp, + vTokenIncentivesIndex, + vTokenIncentiveController.DISTRIBUTION_END(), + baseData.variableDebtTokenAddress, + vTokenIncentiveController.REWARD_TOKEN() + ); + } + + return (reservesIncentiveData); + } + + function getUserReservesIncentivesData(ILendingPoolAddressesProvider provider, address user) + external + view + override + returns (UserReserveIncentiveData[] memory) + { + return _getUserReservesIncentivesData(provider, user); + } + + function _getUserReservesIncentivesData(ILendingPoolAddressesProvider provider, address user) + private + view + returns (UserReserveIncentiveData[] memory) + { + ILendingPool lendingPool = ILendingPool(provider.getLendingPool()); + address[] memory reserves = lendingPool.getReservesList(); + + UserReserveIncentiveData[] memory userReservesIncentivesData = + new UserReserveIncentiveData[](user != address(0) ? reserves.length : 0); + + for (uint256 i = 0; i < reserves.length; i++) { + DataTypes.ReserveData memory baseData = lendingPool.getReserveData(reserves[i]); + + // user reserve data + userReservesIncentivesData[i].underlyingAsset = reserves[i]; + + IAaveIncentivesController aTokenIncentiveController = + IAToken(baseData.aTokenAddress).getIncentivesController(); + + IUiIncentiveDataProvider.UserIncentiveData memory aUserIncentiveData; + aUserIncentiveData.tokenIncentivesUserData = aTokenIncentiveController.getUserAssetData( + user, + baseData.aTokenAddress + ); + aUserIncentiveData.userUnclaimedRewards = aTokenIncentiveController.getUserUnclaimedRewards( + user + ); + aUserIncentiveData.tokenAddress = baseData.aTokenAddress; + aUserIncentiveData.rewardTokenAddress = aTokenIncentiveController.REWARD_TOKEN(); + + userReservesIncentivesData[i].aTokenIncentivesUserData = aUserIncentiveData; + + IAaveIncentivesController vTokenIncentiveController = + IVariableDebtToken(baseData.variableDebtTokenAddress).getIncentivesController(); + UserIncentiveData memory vUserIncentiveData; + vUserIncentiveData.tokenIncentivesUserData = vTokenIncentiveController.getUserAssetData( + user, + baseData.variableDebtTokenAddress + ); + vUserIncentiveData.userUnclaimedRewards = vTokenIncentiveController.getUserUnclaimedRewards( + user + ); + vUserIncentiveData.tokenAddress = baseData.variableDebtTokenAddress; + vUserIncentiveData.rewardTokenAddress = vTokenIncentiveController.REWARD_TOKEN(); + + userReservesIncentivesData[i].vTokenIncentivesUserData = vUserIncentiveData; + + IAaveIncentivesController sTokenIncentiveController = + IStableDebtToken(baseData.stableDebtTokenAddress).getIncentivesController(); + UserIncentiveData memory sUserIncentiveData; + sUserIncentiveData.tokenIncentivesUserData = sTokenIncentiveController.getUserAssetData( + user, + baseData.stableDebtTokenAddress + ); + sUserIncentiveData.userUnclaimedRewards = sTokenIncentiveController.getUserUnclaimedRewards( + user + ); + sUserIncentiveData.tokenAddress = baseData.stableDebtTokenAddress; + sUserIncentiveData.rewardTokenAddress = sTokenIncentiveController.REWARD_TOKEN(); + + userReservesIncentivesData[i].sTokenIncentivesUserData = sUserIncentiveData; + } + + return (userReservesIncentivesData); + } +} diff --git a/contracts/misc/UiPoolDataProvider.sol b/contracts/misc/UiPoolDataProvider.sol index e9f40fe5..002e09ce 100644 --- a/contracts/misc/UiPoolDataProvider.sol +++ b/contracts/misc/UiPoolDataProvider.sol @@ -4,7 +4,6 @@ pragma experimental ABIEncoderV2; import {IERC20Detailed} from '../dependencies/openzeppelin/contracts/IERC20Detailed.sol'; import {ILendingPoolAddressesProvider} from '../interfaces/ILendingPoolAddressesProvider.sol'; -import {IAaveIncentivesController} from '../interfaces/IAaveIncentivesController.sol'; import {IUiPoolDataProvider} from './interfaces/IUiPoolDataProvider.sol'; import {ILendingPool} from '../interfaces/ILendingPool.sol'; import {IPriceOracleGetter} from '../interfaces/IPriceOracleGetter.sol'; @@ -25,11 +24,9 @@ contract UiPoolDataProvider is IUiPoolDataProvider { using UserConfiguration for DataTypes.UserConfigurationMap; address public constant MOCK_USD_ADDRESS = 0x10F7Fc1F91Ba351f9C629c5947AD69bD03C05b96; - IAaveIncentivesController public immutable override incentivesController; IPriceOracleGetter public immutable oracle; - constructor(IAaveIncentivesController _incentivesController, IPriceOracleGetter _oracle) public { - incentivesController = _incentivesController; + constructor(IPriceOracleGetter _oracle) public { oracle = _oracle; } @@ -65,11 +62,7 @@ contract UiPoolDataProvider is IUiPoolDataProvider { public view override - returns ( - AggregatedReserveData[] memory, - uint256, - uint256 - ) + returns (AggregatedReserveData[] memory, uint256) { ILendingPool lendingPool = ILendingPool(provider.getLendingPool()); address[] memory reserves = lendingPool.getReservesList(); @@ -134,45 +127,16 @@ contract UiPoolDataProvider is IUiPoolDataProvider { ) = getInterestRateStrategySlopes( DefaultReserveInterestRateStrategy(reserveData.interestRateStrategyAddress) ); - - // incentives - if (address(0) != address(incentivesController)) { - ( - reserveData.aEmissionPerSecond, - reserveData.aIncentivesLastUpdateTimestamp, - reserveData.aTokenIncentivesIndex - // ) = incentivesController.getAssetData(reserveData.aTokenAddress); TODO: temp fix - ) = incentivesController.assets(reserveData.aTokenAddress); - - ( - reserveData.sEmissionPerSecond, - reserveData.sIncentivesLastUpdateTimestamp, - reserveData.sTokenIncentivesIndex - // ) = incentivesController.getAssetData(reserveData.stableDebtTokenAddress); TODO: temp fix - ) = incentivesController.assets(reserveData.stableDebtTokenAddress); - - ( - reserveData.vEmissionPerSecond, - reserveData.vIncentivesLastUpdateTimestamp, - reserveData.vTokenIncentivesIndex - // ) = incentivesController.getAssetData(reserveData.variableDebtTokenAddress); TODO: temp fix - ) = incentivesController.assets(reserveData.variableDebtTokenAddress); - } } - uint256 emissionEndTimestamp; - if (address(0) != address(incentivesController)) { - emissionEndTimestamp = incentivesController.DISTRIBUTION_END(); - } - - return (reservesData, oracle.getAssetPrice(MOCK_USD_ADDRESS), emissionEndTimestamp); + return (reservesData, oracle.getAssetPrice(MOCK_USD_ADDRESS)); } function getUserReservesData(ILendingPoolAddressesProvider provider, address user) external view override - returns (UserReserveData[] memory, uint256) + returns (UserReserveData[] memory) { ILendingPool lendingPool = ILendingPool(provider.getLendingPool()); address[] memory reserves = lendingPool.getReservesList(); @@ -183,21 +147,7 @@ contract UiPoolDataProvider is IUiPoolDataProvider { for (uint256 i = 0; i < reserves.length; i++) { DataTypes.ReserveData memory baseData = lendingPool.getReserveData(reserves[i]); - // incentives - if (address(0) != address(incentivesController)) { - userReservesData[i].aTokenincentivesUserIndex = incentivesController.getUserAssetData( - user, - baseData.aTokenAddress - ); - userReservesData[i].vTokenincentivesUserIndex = incentivesController.getUserAssetData( - user, - baseData.variableDebtTokenAddress - ); - userReservesData[i].sTokenincentivesUserIndex = incentivesController.getUserAssetData( - user, - baseData.stableDebtTokenAddress - ); - } + // user reserve data userReservesData[i].underlyingAsset = reserves[i]; userReservesData[i].scaledATokenBalance = IAToken(baseData.aTokenAddress).scaledBalanceOf( @@ -225,12 +175,7 @@ contract UiPoolDataProvider is IUiPoolDataProvider { } } - uint256 userUnclaimedRewards; - if (address(0) != address(incentivesController)) { - userUnclaimedRewards = incentivesController.getUserUnclaimedRewards(user); - } - - return (userReservesData, userUnclaimedRewards); + return (userReservesData); } function getReservesData(ILendingPoolAddressesProvider provider, address user) @@ -240,8 +185,7 @@ contract UiPoolDataProvider is IUiPoolDataProvider { returns ( AggregatedReserveData[] memory, UserReserveData[] memory, - uint256, - IncentivesControllerData memory + uint256 ) { ILendingPool lendingPool = ILendingPool(provider.getLendingPool()); @@ -312,46 +256,7 @@ contract UiPoolDataProvider is IUiPoolDataProvider { DefaultReserveInterestRateStrategy(reserveData.interestRateStrategyAddress) ); - // incentives - if (address(0) != address(incentivesController)) { - ( - reserveData.aTokenIncentivesIndex, - reserveData.aEmissionPerSecond, - reserveData.aIncentivesLastUpdateTimestamp - // ) = incentivesController.getAssetData(reserveData.aTokenAddress); TODO: temp fix - ) = incentivesController.assets(reserveData.aTokenAddress); - - ( - reserveData.sTokenIncentivesIndex, - reserveData.sEmissionPerSecond, - reserveData.sIncentivesLastUpdateTimestamp - // ) = incentivesController.getAssetData(reserveData.stableDebtTokenAddress); TODO: temp fix - ) = incentivesController.assets(reserveData.stableDebtTokenAddress); - - ( - reserveData.vTokenIncentivesIndex, - reserveData.vEmissionPerSecond, - reserveData.vIncentivesLastUpdateTimestamp - // ) = incentivesController.getAssetData(reserveData.variableDebtTokenAddress); TODO: temp fix - ) = incentivesController.assets(reserveData.variableDebtTokenAddress); - } - if (user != address(0)) { - // incentives - if (address(0) != address(incentivesController)) { - userReservesData[i].aTokenincentivesUserIndex = incentivesController.getUserAssetData( - user, - reserveData.aTokenAddress - ); - userReservesData[i].vTokenincentivesUserIndex = incentivesController.getUserAssetData( - user, - reserveData.variableDebtTokenAddress - ); - userReservesData[i].sTokenincentivesUserIndex = incentivesController.getUserAssetData( - user, - reserveData.stableDebtTokenAddress - ); - } // user reserve data userReservesData[i].underlyingAsset = reserveData.underlyingAsset; userReservesData[i].scaledATokenBalance = IAToken(reserveData.aTokenAddress) @@ -385,21 +290,6 @@ contract UiPoolDataProvider is IUiPoolDataProvider { } } - IncentivesControllerData memory incentivesControllerData; - - if (address(0) != address(incentivesController)) { - if (user != address(0)) { - incentivesControllerData.userUnclaimedRewards = incentivesController - .getUserUnclaimedRewards(user); - } - incentivesControllerData.emissionEndTimestamp = incentivesController.DISTRIBUTION_END(); - } - - return ( - reservesData, - userReservesData, - oracle.getAssetPrice(MOCK_USD_ADDRESS), - incentivesControllerData - ); + return (reservesData, userReservesData, oracle.getAssetPrice(MOCK_USD_ADDRESS)); } } diff --git a/contracts/misc/interfaces/IUiIncentiveDataProvider.sol b/contracts/misc/interfaces/IUiIncentiveDataProvider.sol new file mode 100644 index 00000000..1c108e04 --- /dev/null +++ b/contracts/misc/interfaces/IUiIncentiveDataProvider.sol @@ -0,0 +1,53 @@ +// SPDX-License-Identifier: agpl-3.0 +pragma solidity 0.6.12; +pragma experimental ABIEncoderV2; + +import {ILendingPoolAddressesProvider} from '../../interfaces/ILendingPoolAddressesProvider.sol'; + +interface IUiIncentiveDataProvider { + struct AggregatedReserveIncentiveData { + address underlyingAsset; + IncentiveData aIncentiveData; + IncentiveData vIncentiveData; + IncentiveData sIncentiveData; + } + + struct IncentiveData { + uint256 emissionPerSecond; + uint256 incentivesLastUpdateTimestamp; + uint256 tokenIncentivesIndex; + uint256 emissionEndTimestamp; + address tokenAddress; + address rewardTokenAddress; + } + + struct UserReserveIncentiveData { + address underlyingAsset; + UserIncentiveData aTokenIncentivesUserData; + UserIncentiveData vTokenIncentivesUserData; + UserIncentiveData sTokenIncentivesUserData; + } + + struct UserIncentiveData { + uint256 tokenIncentivesUserData; + uint256 userUnclaimedRewards; + address tokenAddress; + address rewardTokenAddress; + } + + function getReservesIncentivesData(ILendingPoolAddressesProvider provider) + external + view + returns (AggregatedReserveIncentiveData[] memory); + + function getUserReservesIncentivesData(ILendingPoolAddressesProvider provider, address user) + external + view + returns (UserReserveIncentiveData[] memory); + + // generic method with full data + function getFullReservesIncentiveData(ILendingPoolAddressesProvider provider, address user) + external + view + returns (AggregatedReserveIncentiveData[] memory, UserReserveIncentiveData[] memory); +} diff --git a/contracts/misc/interfaces/IUiPoolDataProvider.sol b/contracts/misc/interfaces/IUiPoolDataProvider.sol index db7f3093..29af0b21 100644 --- a/contracts/misc/interfaces/IUiPoolDataProvider.sol +++ b/contracts/misc/interfaces/IUiPoolDataProvider.sol @@ -42,16 +42,6 @@ interface IUiPoolDataProvider { uint256 variableRateSlope2; uint256 stableRateSlope1; uint256 stableRateSlope2; - // incentives - uint256 aEmissionPerSecond; - uint256 vEmissionPerSecond; - uint256 sEmissionPerSecond; - uint256 aIncentivesLastUpdateTimestamp; - uint256 vIncentivesLastUpdateTimestamp; - uint256 sIncentivesLastUpdateTimestamp; - uint256 aTokenIncentivesIndex; - uint256 vTokenIncentivesIndex; - uint256 sTokenIncentivesIndex; } struct UserReserveData { @@ -62,10 +52,6 @@ interface IUiPoolDataProvider { uint256 scaledVariableDebt; uint256 principalStableDebt; uint256 stableBorrowLastUpdateTimestamp; - // incentives - uint256 aTokenincentivesUserIndex; - uint256 vTokenincentivesUserIndex; - uint256 sTokenincentivesUserIndex; } struct IncentivesControllerData { @@ -78,24 +64,18 @@ interface IUiPoolDataProvider { view returns (address[] memory); - function incentivesController() external view returns (IAaveIncentivesController); - function getSimpleReservesData(ILendingPoolAddressesProvider provider) external view returns ( AggregatedReserveData[] memory, - uint256, // usd price eth - uint256 // emission end timestamp + uint256 // usd price eth ); function getUserReservesData(ILendingPoolAddressesProvider provider, address user) external view - returns ( - UserReserveData[] memory, - uint256 // user unclaimed rewards - ); + returns (UserReserveData[] memory); // generic method with full data function getReservesData(ILendingPoolAddressesProvider provider, address user) @@ -104,7 +84,6 @@ interface IUiPoolDataProvider { returns ( AggregatedReserveData[] memory, UserReserveData[] memory, - uint256, - IncentivesControllerData memory + uint256 ); } From 7f90cf6da763a4358ecf9176e39913c34051fb12 Mon Sep 17 00:00:00 2001 From: Josh Stevens Date: Wed, 1 Sep 2021 13:06:40 +0100 Subject: [PATCH 02/17] remove some memory properites we do not need --- contracts/misc/UiIncentiveDataProvider.sol | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/contracts/misc/UiIncentiveDataProvider.sol b/contracts/misc/UiIncentiveDataProvider.sol index 828c8540..fcb643aa 100644 --- a/contracts/misc/UiIncentiveDataProvider.sol +++ b/contracts/misc/UiIncentiveDataProvider.sol @@ -23,12 +23,7 @@ contract UiIncentiveDataProvider is IUiIncentiveDataProvider { override returns (AggregatedReserveIncentiveData[] memory, UserReserveIncentiveData[] memory) { - AggregatedReserveIncentiveData[] memory reservesIncentivesData = - _getReservesIncentivesData(provider); - UserReserveIncentiveData[] memory userReservesIncentivesData = - _getUserReservesIncentivesData(provider, user); - - return (reservesIncentivesData, userReservesIncentivesData); + return (_getReservesIncentivesData(provider), _getUserReservesIncentivesData(provider, user)); } function getReservesIncentivesData(ILendingPoolAddressesProvider provider) From 5abac5eecd81c8c5148c675fe91417fecfa280f3 Mon Sep 17 00:00:00 2001 From: Josh Stevens Date: Wed, 1 Sep 2021 13:10:48 +0100 Subject: [PATCH 03/17] change variable name to tokenincentivesUserIndex --- contracts/misc/UiIncentiveDataProvider.sol | 6 +++--- contracts/misc/interfaces/IUiIncentiveDataProvider.sol | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/contracts/misc/UiIncentiveDataProvider.sol b/contracts/misc/UiIncentiveDataProvider.sol index fcb643aa..1fd14911 100644 --- a/contracts/misc/UiIncentiveDataProvider.sol +++ b/contracts/misc/UiIncentiveDataProvider.sol @@ -139,7 +139,7 @@ contract UiIncentiveDataProvider is IUiIncentiveDataProvider { IAToken(baseData.aTokenAddress).getIncentivesController(); IUiIncentiveDataProvider.UserIncentiveData memory aUserIncentiveData; - aUserIncentiveData.tokenIncentivesUserData = aTokenIncentiveController.getUserAssetData( + aUserIncentiveData.tokenincentivesUserIndex = aTokenIncentiveController.getUserAssetData( user, baseData.aTokenAddress ); @@ -154,7 +154,7 @@ contract UiIncentiveDataProvider is IUiIncentiveDataProvider { IAaveIncentivesController vTokenIncentiveController = IVariableDebtToken(baseData.variableDebtTokenAddress).getIncentivesController(); UserIncentiveData memory vUserIncentiveData; - vUserIncentiveData.tokenIncentivesUserData = vTokenIncentiveController.getUserAssetData( + vUserIncentiveData.tokenincentivesUserIndex = vTokenIncentiveController.getUserAssetData( user, baseData.variableDebtTokenAddress ); @@ -169,7 +169,7 @@ contract UiIncentiveDataProvider is IUiIncentiveDataProvider { IAaveIncentivesController sTokenIncentiveController = IStableDebtToken(baseData.stableDebtTokenAddress).getIncentivesController(); UserIncentiveData memory sUserIncentiveData; - sUserIncentiveData.tokenIncentivesUserData = sTokenIncentiveController.getUserAssetData( + sUserIncentiveData.tokenincentivesUserIndex = sTokenIncentiveController.getUserAssetData( user, baseData.stableDebtTokenAddress ); diff --git a/contracts/misc/interfaces/IUiIncentiveDataProvider.sol b/contracts/misc/interfaces/IUiIncentiveDataProvider.sol index 1c108e04..2c6d92ed 100644 --- a/contracts/misc/interfaces/IUiIncentiveDataProvider.sol +++ b/contracts/misc/interfaces/IUiIncentiveDataProvider.sol @@ -29,7 +29,7 @@ interface IUiIncentiveDataProvider { } struct UserIncentiveData { - uint256 tokenIncentivesUserData; + uint256 tokenincentivesUserIndex; uint256 userUnclaimedRewards; address tokenAddress; address rewardTokenAddress; From 6b1e542a5b257027820b9e91c2d772921baa65de Mon Sep 17 00:00:00 2001 From: Josh Stevens Date: Wed, 1 Sep 2021 14:19:23 +0100 Subject: [PATCH 04/17] use oracle from `ILendingPoolAddressesProvider` --- contracts/misc/UiPoolDataProvider.sol | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/contracts/misc/UiPoolDataProvider.sol b/contracts/misc/UiPoolDataProvider.sol index 002e09ce..cf6277ac 100644 --- a/contracts/misc/UiPoolDataProvider.sol +++ b/contracts/misc/UiPoolDataProvider.sol @@ -24,11 +24,8 @@ contract UiPoolDataProvider is IUiPoolDataProvider { using UserConfiguration for DataTypes.UserConfigurationMap; address public constant MOCK_USD_ADDRESS = 0x10F7Fc1F91Ba351f9C629c5947AD69bD03C05b96; - IPriceOracleGetter public immutable oracle; - constructor(IPriceOracleGetter _oracle) public { - oracle = _oracle; - } + constructor() public {} function getInterestRateStrategySlopes(DefaultReserveInterestRateStrategy interestRateStrategy) internal @@ -64,6 +61,7 @@ contract UiPoolDataProvider is IUiPoolDataProvider { override returns (AggregatedReserveData[] memory, uint256) { + IPriceOracleGetter oracle = IPriceOracleGetter(provider.getPriceOracle()); ILendingPool lendingPool = ILendingPool(provider.getLendingPool()); address[] memory reserves = lendingPool.getReservesList(); AggregatedReserveData[] memory reservesData = new AggregatedReserveData[](reserves.length); @@ -188,6 +186,7 @@ contract UiPoolDataProvider is IUiPoolDataProvider { uint256 ) { + IPriceOracleGetter oracle = IPriceOracleGetter(provider.getPriceOracle()); ILendingPool lendingPool = ILendingPool(provider.getLendingPool()); address[] memory reserves = lendingPool.getReservesList(); DataTypes.UserConfigurationMap memory userConfig = lendingPool.getUserConfiguration(user); From e43d791d39ccfee13efc910f37b91662695f494e Mon Sep 17 00:00:00 2001 From: Josh Stevens Date: Wed, 1 Sep 2021 14:26:13 +0100 Subject: [PATCH 05/17] deployment scripts --- helpers/contracts-deployments.ts | 21 ++++++---- .../deploy-UiIncentiveDataProvider.ts | 23 +++++++++++ .../deployments/deploy-UiPoolDataProvider.ts | 38 +------------------ 3 files changed, 37 insertions(+), 45 deletions(-) create mode 100644 tasks/deployments/deploy-UiIncentiveDataProvider.ts diff --git a/helpers/contracts-deployments.ts b/helpers/contracts-deployments.ts index 2d764885..a76c5011 100644 --- a/helpers/contracts-deployments.ts +++ b/helpers/contracts-deployments.ts @@ -63,17 +63,22 @@ import { MintableDelegationERC20 } from '../types/MintableDelegationERC20'; import { readArtifact as buidlerReadArtifact } from '@nomiclabs/buidler/plugins'; import { HardhatRuntimeEnvironment } from 'hardhat/types'; import { LendingPoolLibraryAddresses } from '../types/LendingPoolFactory'; -import { UiPoolDataProvider } from '../types'; +import { UiPoolDataProvider, UiIncentiveDataProvider } from '../types'; -export const deployUiPoolDataProvider = async ( - [incentivesController, aaveOracle]: [tEthereumAddress, tEthereumAddress], - verify?: boolean -) => { +export const deployUiPoolDataProvider = async (verify?: boolean) => { const id = eContractid.UiPoolDataProvider; - const args: string[] = [incentivesController, aaveOracle]; - const instance = await deployContract(id, args); + const instance = await deployContract(id, []); if (verify) { - await verifyContract(id, instance, args); + await verifyContract(id, instance, []); + } + return instance; +}; + +export const deployUiIncentiveDataProvider = async (verify?: boolean) => { + const id = eContractid.UiIncentiveDataProvider; + const instance = await deployContract(id, []); + if (verify) { + await verifyContract(id, instance, []); } return instance; }; diff --git a/tasks/deployments/deploy-UiIncentiveDataProvider.ts b/tasks/deployments/deploy-UiIncentiveDataProvider.ts new file mode 100644 index 00000000..c5add015 --- /dev/null +++ b/tasks/deployments/deploy-UiIncentiveDataProvider.ts @@ -0,0 +1,23 @@ +import { task } from 'hardhat/config'; +import { eContractid, eEthereumNetwork, eNetwork, ePolygonNetwork } from '../../helpers/types'; +import { deployUiIncentiveDataProvider } from '../../helpers/contracts-deployments'; +import { exit } from 'process'; + +task( + `deploy-${eContractid.UiIncentiveDataProvider}`, + `Deploys the UiIncentiveDataProvider contract` +) + .addFlag('verify', 'Verify UiIncentiveDataProvider contract via Etherscan API.') + .setAction(async ({ verify }, localBRE) => { + await localBRE.run('set-DRE'); + if (!localBRE.network.config.chainId) { + throw new Error('INVALID_CHAIN_ID'); + } + + console.log(`\n- UiIncentiveDataProvider deployment`); + + const uiIncentiveDataProvider = await deployUiIncentiveDataProvider(verify); + + console.log('UiPoolDataProvider deployed at:', uiIncentiveDataProvider.address); + console.log(`\tFinished UiPoolDataProvider deployment`); + }); diff --git a/tasks/deployments/deploy-UiPoolDataProvider.ts b/tasks/deployments/deploy-UiPoolDataProvider.ts index 9e360db3..ada011c8 100644 --- a/tasks/deployments/deploy-UiPoolDataProvider.ts +++ b/tasks/deployments/deploy-UiPoolDataProvider.ts @@ -10,46 +10,10 @@ task(`deploy-${eContractid.UiPoolDataProvider}`, `Deploys the UiPoolDataProvider if (!localBRE.network.config.chainId) { throw new Error('INVALID_CHAIN_ID'); } - const network = localBRE.network.name; - - const addressesByNetwork: { - [key: string]: { incentivesController: string; aaveOracle: string }; - } = { - [eEthereumNetwork.kovan]: { - incentivesController: '0x0000000000000000000000000000000000000000', - aaveOracle: '0x8fb777d67e9945e2c01936e319057f9d41d559e6', - }, - [eEthereumNetwork.main]: { - incentivesController: '0xd784927Ff2f95ba542BfC824c8a8a98F3495f6b5', - aaveOracle: '0xa50ba011c48153de246e5192c8f9258a2ba79ca9', - }, - [ePolygonNetwork.matic]: { - incentivesController: '0x357D51124f59836DeD84c8a1730D72B749d8BC23', - aaveOracle: '0x0229F777B0fAb107F9591a41d5F02E4e98dB6f2d', - }, - [ePolygonNetwork.mumbai]: { - incentivesController: '0xd41aE58e803Edf4304334acCE4DC4Ec34a63C644', - aaveOracle: '0xC365C653f7229894F93994CD0b30947Ab69Ff1D5', - }, - }; - const supportedNetworks = Object.keys(addressesByNetwork); - - if (!supportedNetworks.includes(network)) { - console.error( - `[task][error] Network "${network}" not supported, please use one of: ${supportedNetworks.join()}` - ); - exit(2); - } - - const oracle = addressesByNetwork[network].aaveOracle; - const incentivesController = addressesByNetwork[network].incentivesController; console.log(`\n- UiPoolDataProvider deployment`); - const uiPoolDataProvider = await deployUiPoolDataProvider( - [incentivesController, oracle], - verify - ); + const uiPoolDataProvider = await deployUiPoolDataProvider(verify); console.log('UiPoolDataProvider deployed at:', uiPoolDataProvider.address); console.log(`\tFinished UiPoolDataProvider deployment`); From c786b246ccdb58537b0f8b61dbb23a6b409baa12 Mon Sep 17 00:00:00 2001 From: Josh Stevens Date: Wed, 1 Sep 2021 14:28:41 +0100 Subject: [PATCH 06/17] change priceInEth > priceForAsset --- contracts/misc/UiPoolDataProvider.sol | 4 ++-- contracts/misc/interfaces/IUiPoolDataProvider.sol | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/contracts/misc/UiPoolDataProvider.sol b/contracts/misc/UiPoolDataProvider.sol index cf6277ac..db7484b2 100644 --- a/contracts/misc/UiPoolDataProvider.sol +++ b/contracts/misc/UiPoolDataProvider.sol @@ -83,7 +83,7 @@ contract UiPoolDataProvider is IUiPoolDataProvider { reserveData.stableDebtTokenAddress = baseData.stableDebtTokenAddress; reserveData.variableDebtTokenAddress = baseData.variableDebtTokenAddress; reserveData.interestRateStrategyAddress = baseData.interestRateStrategyAddress; - reserveData.priceInEth = oracle.getAssetPrice(reserveData.underlyingAsset); + reserveData.priceForAsset = oracle.getAssetPrice(reserveData.underlyingAsset); reserveData.availableLiquidity = IERC20Detailed(reserveData.underlyingAsset).balanceOf( reserveData.aTokenAddress @@ -212,7 +212,7 @@ contract UiPoolDataProvider is IUiPoolDataProvider { reserveData.stableDebtTokenAddress = baseData.stableDebtTokenAddress; reserveData.variableDebtTokenAddress = baseData.variableDebtTokenAddress; reserveData.interestRateStrategyAddress = baseData.interestRateStrategyAddress; - reserveData.priceInEth = oracle.getAssetPrice(reserveData.underlyingAsset); + reserveData.priceForAsset = oracle.getAssetPrice(reserveData.underlyingAsset); reserveData.availableLiquidity = IERC20Detailed(reserveData.underlyingAsset).balanceOf( reserveData.aTokenAddress diff --git a/contracts/misc/interfaces/IUiPoolDataProvider.sol b/contracts/misc/interfaces/IUiPoolDataProvider.sol index 29af0b21..162f23af 100644 --- a/contracts/misc/interfaces/IUiPoolDataProvider.sol +++ b/contracts/misc/interfaces/IUiPoolDataProvider.sol @@ -37,7 +37,7 @@ interface IUiPoolDataProvider { uint256 averageStableRate; uint256 stableDebtLastUpdateTimestamp; uint256 totalScaledVariableDebt; - uint256 priceInEth; + uint256 priceForAsset; uint256 variableRateSlope1; uint256 variableRateSlope2; uint256 stableRateSlope1; From 5f3316398386e37c3347b15a654799864fa88323 Mon Sep 17 00:00:00 2001 From: Josh Stevens Date: Mon, 13 Sep 2021 13:00:01 +0100 Subject: [PATCH 07/17] PR change fixes --- contracts/misc/UiIncentiveDataProvider.sol | 112 +++++++++++------- .../misc/interfaces/IUiPoolDataProvider.sol | 5 - 2 files changed, 69 insertions(+), 48 deletions(-) diff --git a/contracts/misc/UiIncentiveDataProvider.sol b/contracts/misc/UiIncentiveDataProvider.sol index 1fd14911..25bce5d9 100644 --- a/contracts/misc/UiIncentiveDataProvider.sol +++ b/contracts/misc/UiIncentiveDataProvider.sol @@ -55,10 +55,10 @@ contract UiIncentiveDataProvider is IUiIncentiveDataProvider { IAToken(baseData.aTokenAddress).getIncentivesController(); ( + uint256 aTokenIncentivesIndex, uint256 aEmissionPerSecond, - uint256 aIncentivesLastUpdateTimestamp, - uint256 aTokenIncentivesIndex - ) = aTokenIncentiveController.assets(baseData.aTokenAddress); + uint256 aIncentivesLastUpdateTimestamp + ) = aTokenIncentiveController.getAssetData(baseData.aTokenAddress); reserveIncentiveData.aIncentiveData = IncentiveData( aEmissionPerSecond, @@ -73,10 +73,10 @@ contract UiIncentiveDataProvider is IUiIncentiveDataProvider { IStableDebtToken(baseData.stableDebtTokenAddress).getIncentivesController(); ( + uint256 sTokenIncentivesIndex, uint256 sEmissionPerSecond, - uint256 sIncentivesLastUpdateTimestamp, - uint256 sTokenIncentivesIndex - ) = sTokenIncentiveController.assets(baseData.stableDebtTokenAddress); + uint256 sIncentivesLastUpdateTimestamp + ) = sTokenIncentiveController.getAssetData(baseData.stableDebtTokenAddress); reserveIncentiveData.sIncentiveData = IncentiveData( sEmissionPerSecond, @@ -91,10 +91,10 @@ contract UiIncentiveDataProvider is IUiIncentiveDataProvider { IVariableDebtToken(baseData.variableDebtTokenAddress).getIncentivesController(); ( + uint256 vTokenIncentivesIndex, uint256 vEmissionPerSecond, - uint256 vIncentivesLastUpdateTimestamp, - uint256 vTokenIncentivesIndex - ) = vTokenIncentiveController.assets(baseData.variableDebtTokenAddress); + uint256 vIncentivesLastUpdateTimestamp + ) = vTokenIncentiveController.getAssetData(baseData.variableDebtTokenAddress); reserveIncentiveData.vIncentiveData = IncentiveData( vEmissionPerSecond, @@ -135,49 +135,75 @@ contract UiIncentiveDataProvider is IUiIncentiveDataProvider { // user reserve data userReservesIncentivesData[i].underlyingAsset = reserves[i]; - IAaveIncentivesController aTokenIncentiveController = - IAToken(baseData.aTokenAddress).getIncentivesController(); - IUiIncentiveDataProvider.UserIncentiveData memory aUserIncentiveData; - aUserIncentiveData.tokenincentivesUserIndex = aTokenIncentiveController.getUserAssetData( - user, - baseData.aTokenAddress - ); - aUserIncentiveData.userUnclaimedRewards = aTokenIncentiveController.getUserUnclaimedRewards( - user - ); - aUserIncentiveData.tokenAddress = baseData.aTokenAddress; - aUserIncentiveData.rewardTokenAddress = aTokenIncentiveController.REWARD_TOKEN(); + + if (baseData.aTokenAddress != address(0)) { + IAaveIncentivesController aTokenIncentiveController = + IAToken(baseData.aTokenAddress).getIncentivesController(); + + aUserIncentiveData.tokenincentivesUserIndex = aTokenIncentiveController.getUserAssetData( + user, + baseData.aTokenAddress + ); + aUserIncentiveData.userUnclaimedRewards = aTokenIncentiveController.getUserUnclaimedRewards( + user + ); + aUserIncentiveData.tokenAddress = baseData.aTokenAddress; + aUserIncentiveData.rewardTokenAddress = aTokenIncentiveController.REWARD_TOKEN(); + } else { + aUserIncentiveData.tokenincentivesUserIndex = uint256(0); + aUserIncentiveData.userUnclaimedRewards = uint256(0); + aUserIncentiveData.tokenAddress = baseData.aTokenAddress; + aUserIncentiveData.rewardTokenAddress = address(0); + } userReservesIncentivesData[i].aTokenIncentivesUserData = aUserIncentiveData; - IAaveIncentivesController vTokenIncentiveController = - IVariableDebtToken(baseData.variableDebtTokenAddress).getIncentivesController(); UserIncentiveData memory vUserIncentiveData; - vUserIncentiveData.tokenincentivesUserIndex = vTokenIncentiveController.getUserAssetData( - user, - baseData.variableDebtTokenAddress - ); - vUserIncentiveData.userUnclaimedRewards = vTokenIncentiveController.getUserUnclaimedRewards( - user - ); - vUserIncentiveData.tokenAddress = baseData.variableDebtTokenAddress; - vUserIncentiveData.rewardTokenAddress = vTokenIncentiveController.REWARD_TOKEN(); + + if (baseData.variableDebtTokenAddress != address(0)) { + IAaveIncentivesController vTokenIncentiveController = + IVariableDebtToken(baseData.variableDebtTokenAddress).getIncentivesController(); + + vUserIncentiveData.tokenincentivesUserIndex = vTokenIncentiveController.getUserAssetData( + user, + baseData.variableDebtTokenAddress + ); + vUserIncentiveData.userUnclaimedRewards = vTokenIncentiveController.getUserUnclaimedRewards( + user + ); + vUserIncentiveData.tokenAddress = baseData.variableDebtTokenAddress; + vUserIncentiveData.rewardTokenAddress = vTokenIncentiveController.REWARD_TOKEN(); + } else { + vUserIncentiveData.tokenincentivesUserIndex = uint256(0); + vUserIncentiveData.userUnclaimedRewards = uint256(0); + vUserIncentiveData.tokenAddress = baseData.variableDebtTokenAddress; + vUserIncentiveData.rewardTokenAddress = address(0); + } userReservesIncentivesData[i].vTokenIncentivesUserData = vUserIncentiveData; - IAaveIncentivesController sTokenIncentiveController = - IStableDebtToken(baseData.stableDebtTokenAddress).getIncentivesController(); UserIncentiveData memory sUserIncentiveData; - sUserIncentiveData.tokenincentivesUserIndex = sTokenIncentiveController.getUserAssetData( - user, - baseData.stableDebtTokenAddress - ); - sUserIncentiveData.userUnclaimedRewards = sTokenIncentiveController.getUserUnclaimedRewards( - user - ); - sUserIncentiveData.tokenAddress = baseData.stableDebtTokenAddress; - sUserIncentiveData.rewardTokenAddress = sTokenIncentiveController.REWARD_TOKEN(); + + if (baseData.stableDebtTokenAddress != address(0)) { + IAaveIncentivesController sTokenIncentiveController = + IStableDebtToken(baseData.stableDebtTokenAddress).getIncentivesController(); + + sUserIncentiveData.tokenincentivesUserIndex = sTokenIncentiveController.getUserAssetData( + user, + baseData.stableDebtTokenAddress + ); + sUserIncentiveData.userUnclaimedRewards = sTokenIncentiveController.getUserUnclaimedRewards( + user + ); + sUserIncentiveData.tokenAddress = baseData.stableDebtTokenAddress; + sUserIncentiveData.rewardTokenAddress = sTokenIncentiveController.REWARD_TOKEN(); + } else { + sUserIncentiveData.tokenincentivesUserIndex = uint256(0); + sUserIncentiveData.userUnclaimedRewards = uint256(0); + sUserIncentiveData.tokenAddress = baseData.stableDebtTokenAddress; + sUserIncentiveData.rewardTokenAddress = address(0); + } userReservesIncentivesData[i].sTokenIncentivesUserData = sUserIncentiveData; } diff --git a/contracts/misc/interfaces/IUiPoolDataProvider.sol b/contracts/misc/interfaces/IUiPoolDataProvider.sol index 162f23af..db39355a 100644 --- a/contracts/misc/interfaces/IUiPoolDataProvider.sol +++ b/contracts/misc/interfaces/IUiPoolDataProvider.sol @@ -54,11 +54,6 @@ interface IUiPoolDataProvider { uint256 stableBorrowLastUpdateTimestamp; } - struct IncentivesControllerData { - uint256 userUnclaimedRewards; - uint256 emissionEndTimestamp; - } - function getReservesList(ILendingPoolAddressesProvider provider) external view From b25c7a0ad54129b2ffbbe16659825e69b8ea0fa0 Mon Sep 17 00:00:00 2001 From: Josh Stevens Date: Mon, 13 Sep 2021 13:41:50 +0100 Subject: [PATCH 08/17] PR changes --- contracts/misc/UiIncentiveDataProvider.sol | 36 ++++++---------------- 1 file changed, 9 insertions(+), 27 deletions(-) diff --git a/contracts/misc/UiIncentiveDataProvider.sol b/contracts/misc/UiIncentiveDataProvider.sol index 25bce5d9..6a1d3574 100644 --- a/contracts/misc/UiIncentiveDataProvider.sol +++ b/contracts/misc/UiIncentiveDataProvider.sol @@ -136,11 +136,10 @@ contract UiIncentiveDataProvider is IUiIncentiveDataProvider { userReservesIncentivesData[i].underlyingAsset = reserves[i]; IUiIncentiveDataProvider.UserIncentiveData memory aUserIncentiveData; + IAaveIncentivesController aTokenIncentiveController = + IAToken(baseData.aTokenAddress).getIncentivesController(); - if (baseData.aTokenAddress != address(0)) { - IAaveIncentivesController aTokenIncentiveController = - IAToken(baseData.aTokenAddress).getIncentivesController(); - + if (address(aTokenIncentiveController) != address(0)) { aUserIncentiveData.tokenincentivesUserIndex = aTokenIncentiveController.getUserAssetData( user, baseData.aTokenAddress @@ -150,21 +149,15 @@ contract UiIncentiveDataProvider is IUiIncentiveDataProvider { ); aUserIncentiveData.tokenAddress = baseData.aTokenAddress; aUserIncentiveData.rewardTokenAddress = aTokenIncentiveController.REWARD_TOKEN(); - } else { - aUserIncentiveData.tokenincentivesUserIndex = uint256(0); - aUserIncentiveData.userUnclaimedRewards = uint256(0); - aUserIncentiveData.tokenAddress = baseData.aTokenAddress; - aUserIncentiveData.rewardTokenAddress = address(0); } userReservesIncentivesData[i].aTokenIncentivesUserData = aUserIncentiveData; UserIncentiveData memory vUserIncentiveData; + IAaveIncentivesController vTokenIncentiveController = + IVariableDebtToken(baseData.variableDebtTokenAddress).getIncentivesController(); - if (baseData.variableDebtTokenAddress != address(0)) { - IAaveIncentivesController vTokenIncentiveController = - IVariableDebtToken(baseData.variableDebtTokenAddress).getIncentivesController(); - + if (address(vTokenIncentiveController) != address(0)) { vUserIncentiveData.tokenincentivesUserIndex = vTokenIncentiveController.getUserAssetData( user, baseData.variableDebtTokenAddress @@ -174,21 +167,15 @@ contract UiIncentiveDataProvider is IUiIncentiveDataProvider { ); vUserIncentiveData.tokenAddress = baseData.variableDebtTokenAddress; vUserIncentiveData.rewardTokenAddress = vTokenIncentiveController.REWARD_TOKEN(); - } else { - vUserIncentiveData.tokenincentivesUserIndex = uint256(0); - vUserIncentiveData.userUnclaimedRewards = uint256(0); - vUserIncentiveData.tokenAddress = baseData.variableDebtTokenAddress; - vUserIncentiveData.rewardTokenAddress = address(0); } userReservesIncentivesData[i].vTokenIncentivesUserData = vUserIncentiveData; UserIncentiveData memory sUserIncentiveData; + IAaveIncentivesController sTokenIncentiveController = + IStableDebtToken(baseData.stableDebtTokenAddress).getIncentivesController(); - if (baseData.stableDebtTokenAddress != address(0)) { - IAaveIncentivesController sTokenIncentiveController = - IStableDebtToken(baseData.stableDebtTokenAddress).getIncentivesController(); - + if (address(sTokenIncentiveController) != address(0)) { sUserIncentiveData.tokenincentivesUserIndex = sTokenIncentiveController.getUserAssetData( user, baseData.stableDebtTokenAddress @@ -198,11 +185,6 @@ contract UiIncentiveDataProvider is IUiIncentiveDataProvider { ); sUserIncentiveData.tokenAddress = baseData.stableDebtTokenAddress; sUserIncentiveData.rewardTokenAddress = sTokenIncentiveController.REWARD_TOKEN(); - } else { - sUserIncentiveData.tokenincentivesUserIndex = uint256(0); - sUserIncentiveData.userUnclaimedRewards = uint256(0); - sUserIncentiveData.tokenAddress = baseData.stableDebtTokenAddress; - sUserIncentiveData.rewardTokenAddress = address(0); } userReservesIncentivesData[i].sTokenIncentivesUserData = sUserIncentiveData; From 96a54e4f92e98e55ae4e0575805e9cf7ab76cfb4 Mon Sep 17 00:00:00 2001 From: Josh Stevens Date: Mon, 13 Sep 2021 13:44:50 +0100 Subject: [PATCH 09/17] PR changes --- contracts/misc/UiIncentiveDataProvider.sol | 85 ++++++++++++---------- 1 file changed, 45 insertions(+), 40 deletions(-) diff --git a/contracts/misc/UiIncentiveDataProvider.sol b/contracts/misc/UiIncentiveDataProvider.sol index 6a1d3574..e5fef136 100644 --- a/contracts/misc/UiIncentiveDataProvider.sol +++ b/contracts/misc/UiIncentiveDataProvider.sol @@ -53,57 +53,62 @@ contract UiIncentiveDataProvider is IUiIncentiveDataProvider { IAaveIncentivesController aTokenIncentiveController = IAToken(baseData.aTokenAddress).getIncentivesController(); + if (address(aTokenIncentiveController) != address(0)) { + ( + uint256 aTokenIncentivesIndex, + uint256 aEmissionPerSecond, + uint256 aIncentivesLastUpdateTimestamp + ) = aTokenIncentiveController.getAssetData(baseData.aTokenAddress); - ( - uint256 aTokenIncentivesIndex, - uint256 aEmissionPerSecond, - uint256 aIncentivesLastUpdateTimestamp - ) = aTokenIncentiveController.getAssetData(baseData.aTokenAddress); - - reserveIncentiveData.aIncentiveData = IncentiveData( - aEmissionPerSecond, - aIncentivesLastUpdateTimestamp, - aTokenIncentivesIndex, - aTokenIncentiveController.DISTRIBUTION_END(), - baseData.aTokenAddress, - aTokenIncentiveController.REWARD_TOKEN() - ); + reserveIncentiveData.aIncentiveData = IncentiveData( + aEmissionPerSecond, + aIncentivesLastUpdateTimestamp, + aTokenIncentivesIndex, + aTokenIncentiveController.DISTRIBUTION_END(), + baseData.aTokenAddress, + aTokenIncentiveController.REWARD_TOKEN() + ); + } IAaveIncentivesController sTokenIncentiveController = IStableDebtToken(baseData.stableDebtTokenAddress).getIncentivesController(); - ( - 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); - reserveIncentiveData.sIncentiveData = IncentiveData( - sEmissionPerSecond, - sIncentivesLastUpdateTimestamp, - sTokenIncentivesIndex, - sTokenIncentiveController.DISTRIBUTION_END(), - baseData.stableDebtTokenAddress, - sTokenIncentiveController.REWARD_TOKEN() - ); + reserveIncentiveData.sIncentiveData = IncentiveData( + sEmissionPerSecond, + sIncentivesLastUpdateTimestamp, + sTokenIncentivesIndex, + sTokenIncentiveController.DISTRIBUTION_END(), + baseData.stableDebtTokenAddress, + sTokenIncentiveController.REWARD_TOKEN() + ); + } IAaveIncentivesController vTokenIncentiveController = IVariableDebtToken(baseData.variableDebtTokenAddress).getIncentivesController(); - ( - 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); - reserveIncentiveData.vIncentiveData = IncentiveData( - vEmissionPerSecond, - vIncentivesLastUpdateTimestamp, - vTokenIncentivesIndex, - vTokenIncentiveController.DISTRIBUTION_END(), - baseData.variableDebtTokenAddress, - vTokenIncentiveController.REWARD_TOKEN() - ); + reserveIncentiveData.vIncentiveData = IncentiveData( + vEmissionPerSecond, + vIncentivesLastUpdateTimestamp, + vTokenIncentivesIndex, + vTokenIncentiveController.DISTRIBUTION_END(), + baseData.variableDebtTokenAddress, + vTokenIncentiveController.REWARD_TOKEN() + ); + } } return (reservesIncentiveData); From 53113e9b9e3109c3bd90c0b70c62695994d4dd62 Mon Sep 17 00:00:00 2001 From: sendra Date: Fri, 17 Sep 2021 17:15:21 +0200 Subject: [PATCH 10/17] feat: added reward token decimals --- contracts/misc/UiIncentiveDataProvider.sol | 28 +++++++++++++++---- .../interfaces/IUiIncentiveDataProvider.sol | 2 ++ 2 files changed, 24 insertions(+), 6 deletions(-) diff --git a/contracts/misc/UiIncentiveDataProvider.sol b/contracts/misc/UiIncentiveDataProvider.sol index e5fef136..e92111d6 100644 --- a/contracts/misc/UiIncentiveDataProvider.sol +++ b/contracts/misc/UiIncentiveDataProvider.sol @@ -11,6 +11,7 @@ import {IVariableDebtToken} from '../interfaces/IVariableDebtToken.sol'; import {IStableDebtToken} from '../interfaces/IStableDebtToken.sol'; import {UserConfiguration} from '../protocol/libraries/configuration/UserConfiguration.sol'; import {DataTypes} from '../protocol/libraries/types/DataTypes.sol'; +import {IERC20Detailed} from '../dependencies/openzeppelin/contracts/IERC20Detailed.sol'; contract UiIncentiveDataProvider is IUiIncentiveDataProvider { using UserConfiguration for DataTypes.UserConfigurationMap; @@ -60,13 +61,16 @@ contract UiIncentiveDataProvider is IUiIncentiveDataProvider { uint256 aIncentivesLastUpdateTimestamp ) = aTokenIncentiveController.getAssetData(baseData.aTokenAddress); + address aRewardToken = aTokenIncentiveController.REWARD_TOKEN(); + reserveIncentiveData.aIncentiveData = IncentiveData( aEmissionPerSecond, aIncentivesLastUpdateTimestamp, aTokenIncentivesIndex, aTokenIncentiveController.DISTRIBUTION_END(), baseData.aTokenAddress, - aTokenIncentiveController.REWARD_TOKEN() + aRewardToken, + IERC20Detailed(aRewardToken).decimals() ); } @@ -80,13 +84,16 @@ contract UiIncentiveDataProvider is IUiIncentiveDataProvider { uint256 sIncentivesLastUpdateTimestamp ) = sTokenIncentiveController.getAssetData(baseData.stableDebtTokenAddress); + address sRewardToken = sTokenIncentiveController.REWARD_TOKEN(); + reserveIncentiveData.sIncentiveData = IncentiveData( sEmissionPerSecond, sIncentivesLastUpdateTimestamp, sTokenIncentivesIndex, sTokenIncentiveController.DISTRIBUTION_END(), baseData.stableDebtTokenAddress, - sTokenIncentiveController.REWARD_TOKEN() + sRewardToken, + IERC20Detailed(sRewardToken).decimals() ); } @@ -100,13 +107,16 @@ contract UiIncentiveDataProvider is IUiIncentiveDataProvider { uint256 vIncentivesLastUpdateTimestamp ) = vTokenIncentiveController.getAssetData(baseData.variableDebtTokenAddress); + address vRewardToken = vTokenIncentiveController.REWARD_TOKEN(); + reserveIncentiveData.vIncentiveData = IncentiveData( vEmissionPerSecond, vIncentivesLastUpdateTimestamp, vTokenIncentivesIndex, vTokenIncentiveController.DISTRIBUTION_END(), baseData.variableDebtTokenAddress, - vTokenIncentiveController.REWARD_TOKEN() + vRewardToken, + IERC20Detailed(vRewardToken).decimals() ); } } @@ -145,6 +155,7 @@ contract UiIncentiveDataProvider is IUiIncentiveDataProvider { IAToken(baseData.aTokenAddress).getIncentivesController(); if (address(aTokenIncentiveController) != address(0)) { + address aRewardToken = aTokenIncentiveController.REWARD_TOKEN(); aUserIncentiveData.tokenincentivesUserIndex = aTokenIncentiveController.getUserAssetData( user, baseData.aTokenAddress @@ -153,7 +164,8 @@ contract UiIncentiveDataProvider is IUiIncentiveDataProvider { user ); aUserIncentiveData.tokenAddress = baseData.aTokenAddress; - aUserIncentiveData.rewardTokenAddress = aTokenIncentiveController.REWARD_TOKEN(); + aUserIncentiveData.rewardTokenAddress = aRewardToken; + aUserIncentiveData.rewardTokenDecimals = IERC20Detailed(aRewardToken).decimals(); } userReservesIncentivesData[i].aTokenIncentivesUserData = aUserIncentiveData; @@ -163,6 +175,7 @@ contract UiIncentiveDataProvider is IUiIncentiveDataProvider { IVariableDebtToken(baseData.variableDebtTokenAddress).getIncentivesController(); if (address(vTokenIncentiveController) != address(0)) { + address vRewardToken = vTokenIncentiveController.REWARD_TOKEN(); vUserIncentiveData.tokenincentivesUserIndex = vTokenIncentiveController.getUserAssetData( user, baseData.variableDebtTokenAddress @@ -171,7 +184,8 @@ contract UiIncentiveDataProvider is IUiIncentiveDataProvider { user ); vUserIncentiveData.tokenAddress = baseData.variableDebtTokenAddress; - vUserIncentiveData.rewardTokenAddress = vTokenIncentiveController.REWARD_TOKEN(); + vUserIncentiveData.rewardTokenAddress = vRewardToken; + vUserIncentiveData.rewardTokenDecimals = IERC20Detailed(vRewardToken).decimals(); } userReservesIncentivesData[i].vTokenIncentivesUserData = vUserIncentiveData; @@ -181,6 +195,7 @@ contract UiIncentiveDataProvider is IUiIncentiveDataProvider { IStableDebtToken(baseData.stableDebtTokenAddress).getIncentivesController(); if (address(sTokenIncentiveController) != address(0)) { + address sRewardToken = sTokenIncentiveController.REWARD_TOKEN(); sUserIncentiveData.tokenincentivesUserIndex = sTokenIncentiveController.getUserAssetData( user, baseData.stableDebtTokenAddress @@ -189,7 +204,8 @@ contract UiIncentiveDataProvider is IUiIncentiveDataProvider { user ); sUserIncentiveData.tokenAddress = baseData.stableDebtTokenAddress; - sUserIncentiveData.rewardTokenAddress = sTokenIncentiveController.REWARD_TOKEN(); + sUserIncentiveData.rewardTokenAddress = sRewardToken; + sUserIncentiveData.rewardTokenDecimals = IERC20Detailed(sRewardToken).decimals(); } userReservesIncentivesData[i].sTokenIncentivesUserData = sUserIncentiveData; diff --git a/contracts/misc/interfaces/IUiIncentiveDataProvider.sol b/contracts/misc/interfaces/IUiIncentiveDataProvider.sol index 2c6d92ed..ed062bf5 100644 --- a/contracts/misc/interfaces/IUiIncentiveDataProvider.sol +++ b/contracts/misc/interfaces/IUiIncentiveDataProvider.sol @@ -19,6 +19,7 @@ interface IUiIncentiveDataProvider { uint256 emissionEndTimestamp; address tokenAddress; address rewardTokenAddress; + uint8 rewardTokenDecimals; } struct UserReserveIncentiveData { @@ -33,6 +34,7 @@ interface IUiIncentiveDataProvider { uint256 userUnclaimedRewards; address tokenAddress; address rewardTokenAddress; + uint8 rewardTokenDecimals; } function getReservesIncentivesData(ILendingPoolAddressesProvider provider) From 947900aa2b65452a0fa574b89202d019a71996fc Mon Sep 17 00:00:00 2001 From: sendra Date: Wed, 22 Sep 2021 19:17:31 +0200 Subject: [PATCH 11/17] added return of incentive controller address --- contracts/misc/UiIncentiveDataProvider.sol | 6 ++++++ contracts/misc/interfaces/IUiIncentiveDataProvider.sol | 2 ++ 2 files changed, 8 insertions(+) diff --git a/contracts/misc/UiIncentiveDataProvider.sol b/contracts/misc/UiIncentiveDataProvider.sol index e92111d6..4b8372b2 100644 --- a/contracts/misc/UiIncentiveDataProvider.sol +++ b/contracts/misc/UiIncentiveDataProvider.sol @@ -70,6 +70,7 @@ contract UiIncentiveDataProvider is IUiIncentiveDataProvider { aTokenIncentiveController.DISTRIBUTION_END(), baseData.aTokenAddress, aRewardToken, + address(aTokenIncentiveController), IERC20Detailed(aRewardToken).decimals() ); } @@ -93,6 +94,7 @@ contract UiIncentiveDataProvider is IUiIncentiveDataProvider { sTokenIncentiveController.DISTRIBUTION_END(), baseData.stableDebtTokenAddress, sRewardToken, + address(sTokenIncentiveController), IERC20Detailed(sRewardToken).decimals() ); } @@ -116,6 +118,7 @@ contract UiIncentiveDataProvider is IUiIncentiveDataProvider { vTokenIncentiveController.DISTRIBUTION_END(), baseData.variableDebtTokenAddress, vRewardToken, + address(vTokenIncentiveController), IERC20Detailed(vRewardToken).decimals() ); } @@ -165,6 +168,7 @@ contract UiIncentiveDataProvider is IUiIncentiveDataProvider { ); aUserIncentiveData.tokenAddress = baseData.aTokenAddress; aUserIncentiveData.rewardTokenAddress = aRewardToken; + aUserIncentiveData.incentiveControllerAddress = address(aTokenIncentiveController); aUserIncentiveData.rewardTokenDecimals = IERC20Detailed(aRewardToken).decimals(); } @@ -185,6 +189,7 @@ contract UiIncentiveDataProvider is IUiIncentiveDataProvider { ); vUserIncentiveData.tokenAddress = baseData.variableDebtTokenAddress; vUserIncentiveData.rewardTokenAddress = vRewardToken; + vUserIncentiveData.incentiveControllerAddress = address(vTokenIncentiveController); vUserIncentiveData.rewardTokenDecimals = IERC20Detailed(vRewardToken).decimals(); } @@ -205,6 +210,7 @@ contract UiIncentiveDataProvider is IUiIncentiveDataProvider { ); sUserIncentiveData.tokenAddress = baseData.stableDebtTokenAddress; sUserIncentiveData.rewardTokenAddress = sRewardToken; + sUserIncentiveData.incentiveControllerAddress = address(sTokenIncentiveController); sUserIncentiveData.rewardTokenDecimals = IERC20Detailed(sRewardToken).decimals(); } diff --git a/contracts/misc/interfaces/IUiIncentiveDataProvider.sol b/contracts/misc/interfaces/IUiIncentiveDataProvider.sol index ed062bf5..c9d7f5d0 100644 --- a/contracts/misc/interfaces/IUiIncentiveDataProvider.sol +++ b/contracts/misc/interfaces/IUiIncentiveDataProvider.sol @@ -19,6 +19,7 @@ interface IUiIncentiveDataProvider { uint256 emissionEndTimestamp; address tokenAddress; address rewardTokenAddress; + address incentiveControllerAddress; uint8 rewardTokenDecimals; } @@ -34,6 +35,7 @@ interface IUiIncentiveDataProvider { uint256 userUnclaimedRewards; address tokenAddress; address rewardTokenAddress; + address incentiveControllerAddress; uint8 rewardTokenDecimals; } From 5279eb325524c17910bddf7eb5a6b29ffcb6ab92 Mon Sep 17 00:00:00 2001 From: sendra Date: Thu, 23 Sep 2021 16:22:43 +0200 Subject: [PATCH 12/17] added precision --- contracts/misc/UiIncentiveDataProvider.sol | 9 ++++++--- contracts/misc/interfaces/IUiIncentiveDataProvider.sol | 1 + 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/contracts/misc/UiIncentiveDataProvider.sol b/contracts/misc/UiIncentiveDataProvider.sol index 4b8372b2..15972cde 100644 --- a/contracts/misc/UiIncentiveDataProvider.sol +++ b/contracts/misc/UiIncentiveDataProvider.sol @@ -71,7 +71,8 @@ contract UiIncentiveDataProvider is IUiIncentiveDataProvider { baseData.aTokenAddress, aRewardToken, address(aTokenIncentiveController), - IERC20Detailed(aRewardToken).decimals() + IERC20Detailed(aRewardToken).decimals(), + aTokenIncentiveController.PRECISION() ); } @@ -95,7 +96,8 @@ contract UiIncentiveDataProvider is IUiIncentiveDataProvider { baseData.stableDebtTokenAddress, sRewardToken, address(sTokenIncentiveController), - IERC20Detailed(sRewardToken).decimals() + IERC20Detailed(sRewardToken).decimals(), + sTokenIncentiveController.PRECISION() ); } @@ -119,7 +121,8 @@ contract UiIncentiveDataProvider is IUiIncentiveDataProvider { baseData.variableDebtTokenAddress, vRewardToken, address(vTokenIncentiveController), - IERC20Detailed(vRewardToken).decimals() + IERC20Detailed(vRewardToken).decimals(), + vTokenIncentiveController.PRECISION() ); } } diff --git a/contracts/misc/interfaces/IUiIncentiveDataProvider.sol b/contracts/misc/interfaces/IUiIncentiveDataProvider.sol index c9d7f5d0..799e7e00 100644 --- a/contracts/misc/interfaces/IUiIncentiveDataProvider.sol +++ b/contracts/misc/interfaces/IUiIncentiveDataProvider.sol @@ -21,6 +21,7 @@ interface IUiIncentiveDataProvider { address rewardTokenAddress; address incentiveControllerAddress; uint8 rewardTokenDecimals; + uint8 precision; } struct UserReserveIncentiveData { From e3cbc75c35e749a2ed1bf02e28c39848a12bb1ba Mon Sep 17 00:00:00 2001 From: sendra Date: Thu, 23 Sep 2021 17:12:17 +0200 Subject: [PATCH 13/17] fixed deployment --- helpers/types.ts | 1 + package.json | 4 ++++ 2 files changed, 5 insertions(+) diff --git a/helpers/types.ts b/helpers/types.ts index 267b5abb..66b6bdfa 100644 --- a/helpers/types.ts +++ b/helpers/types.ts @@ -76,6 +76,7 @@ export enum eContractid { StableAndVariableTokensHelper = 'StableAndVariableTokensHelper', ATokensAndRatesHelper = 'ATokensAndRatesHelper', UiPoolDataProvider = 'UiPoolDataProvider', + UiIncentiveDataProvider = 'UiIncentiveDataProvider', WETHGateway = 'WETHGateway', WETH = 'WETH', WETHMocked = 'WETHMocked', diff --git a/package.json b/package.json index b9debafc..ebc964da 100644 --- a/package.json +++ b/package.json @@ -70,6 +70,10 @@ "main:deployUIProvider": "hardhat --network main deploy-UiPoolDataProvider --verify", "matic:deployUIProvider": "hardhat --network matic deploy-UiPoolDataProvider", "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", "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", From ae58a05f430602eefe5ddf132214d91d1ac42aec Mon Sep 17 00:00:00 2001 From: sendra Date: Fri, 24 Sep 2021 14:19:31 +0200 Subject: [PATCH 14/17] added try catch --- contracts/misc/UiIncentiveDataProvider.sol | 95 ++++++++++++---------- hardhat.config.ts | 1 + package-lock.json | 14 ++-- package.json | 2 +- 4 files changed, 59 insertions(+), 53 deletions(-) diff --git a/contracts/misc/UiIncentiveDataProvider.sol b/contracts/misc/UiIncentiveDataProvider.sol index 15972cde..00dd3923 100644 --- a/contracts/misc/UiIncentiveDataProvider.sol +++ b/contracts/misc/UiIncentiveDataProvider.sol @@ -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); diff --git a/hardhat.config.ts b/hardhat.config.ts index 10b4402b..3ea8dbcb 100644 --- a/hardhat.config.ts +++ b/hardhat.config.ts @@ -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), diff --git a/package-lock.json b/package-lock.json index 7f3c76fd..e66b7248 100644 --- a/package-lock.json +++ b/package-lock.json @@ -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": { diff --git a/package.json b/package.json index ebc964da..e99a2fba 100644 --- a/package.json +++ b/package.json @@ -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", From 9417062c9830119a73ccdc847f71c69ed8b7bd7c Mon Sep 17 00:00:00 2001 From: sendra Date: Fri, 24 Sep 2021 15:02:23 +0200 Subject: [PATCH 15/17] added try catch to user method --- contracts/misc/UiIncentiveDataProvider.sol | 96 ++++++++++++---------- hardhat.config.ts | 2 +- helpers/contracts-helpers.ts | 21 ++--- helpers/etherscan-verification.ts | 2 +- package-lock.json | 15 ++++ package.json | 5 +- 6 files changed, 77 insertions(+), 64 deletions(-) diff --git a/contracts/misc/UiIncentiveDataProvider.sol b/contracts/misc/UiIncentiveDataProvider.sol index 00dd3923..646a2758 100644 --- a/contracts/misc/UiIncentiveDataProvider.sol +++ b/contracts/misc/UiIncentiveDataProvider.sol @@ -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; diff --git a/hardhat.config.ts b/hardhat.config.ts index 3ea8dbcb..c51da6f4 100644 --- a/hardhat.config.ts +++ b/hardhat.config.ts @@ -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'; diff --git a/helpers/contracts-helpers.ts b/helpers/contracts-helpers.ts index cb7c016e..f3e081d3 100644 --- a/helpers/contracts-helpers.ts +++ b/helpers/contracts-helpers.ts @@ -142,14 +142,8 @@ export const linkBytecode = (artifact: BuidlerArtifact | Artifact, libraries: an }; export const getParamPerNetwork = (param: iParamsPerNetwork, network: eNetwork) => { - const { - main, - ropsten, - kovan, - coverage, - buidlerevm, - tenderlyMain, - } = param as iEthereumParamsPerNetwork; + const { main, ropsten, kovan, coverage, buidlerevm, tenderlyMain } = + param as iEthereumParamsPerNetwork; const { matic, mumbai } = param as iPolygonParamsPerNetwork; const { xdai } = param as iXDaiParamsPerNetwork; 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; }; diff --git a/helpers/etherscan-verification.ts b/helpers/etherscan-verification.ts index 3bf097d3..512af228 100644 --- a/helpers/etherscan-verification.ts +++ b/helpers/etherscan-verification.ts @@ -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)); diff --git a/package-lock.json b/package-lock.json index e66b7248..11f9149e 100644 --- a/package-lock.json +++ b/package-lock.json @@ -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", diff --git a/package.json b/package.json index e99a2fba..903d4677 100644 --- a/package.json +++ b/package.json @@ -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", From b206ea0023d8991458c26a0178aaa0ab843c3ae7 Mon Sep 17 00:00:00 2001 From: sendra Date: Fri, 24 Sep 2021 16:00:49 +0200 Subject: [PATCH 16/17] added extra checks and fallbacks --- contracts/misc/UiIncentiveDataProvider.sol | 156 ++++++++++++++------- 1 file changed, 104 insertions(+), 52 deletions(-) diff --git a/contracts/misc/UiIncentiveDataProvider.sol b/contracts/misc/UiIncentiveDataProvider.sol index 646a2758..4666b3e1 100644 --- a/contracts/misc/UiIncentiveDataProvider.sol +++ b/contracts/misc/UiIncentiveDataProvider.sol @@ -54,51 +54,87 @@ contract UiIncentiveDataProvider is IUiIncentiveDataProvider { try IStableDebtToken(baseData.aTokenAddress).getIncentivesController() returns (IAaveIncentivesController aTokenIncentiveController) { if (address(aTokenIncentiveController) != address(0)) { - ( - uint256 aTokenIncentivesIndex, - uint256 aEmissionPerSecond, - uint256 aIncentivesLastUpdateTimestamp - ) = aTokenIncentiveController.getAssetData(baseData.aTokenAddress); + address aRewardToken = aTokenIncentiveController.REWARD_TOKEN(); - address aRewardToken = aTokenIncentiveController.REWARD_TOKEN(); - - reserveIncentiveData.aIncentiveData = IncentiveData( - aEmissionPerSecond, - aIncentivesLastUpdateTimestamp, - aTokenIncentivesIndex, - aTokenIncentiveController.DISTRIBUTION_END(), - baseData.aTokenAddress, - aRewardToken, - address(aTokenIncentiveController), - IERC20Detailed(aRewardToken).decimals(), - aTokenIncentiveController.PRECISION() - ); - } + 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( + aEmissionPerSecond, + aIncentivesLastUpdateTimestamp, + aTokenIncentivesIndex, + aTokenIncentiveController.DISTRIBUTION_END(), + baseData.aTokenAddress, + aRewardToken, + address(aTokenIncentiveController), + IERC20Detailed(aRewardToken).decimals(), + aTokenIncentiveController.PRECISION() + ); + } + } } catch(bytes memory /*lowLevelData*/) { // Will not get here } try IStableDebtToken(baseData.stableDebtTokenAddress).getIncentivesController() returns (IAaveIncentivesController sTokenIncentiveController) { if (address(sTokenIncentiveController) != address(0)) { - ( + + address sRewardToken = sTokenIncentiveController.REWARD_TOKEN(); + try sTokenIncentiveController.getAssetData(baseData.stableDebtTokenAddress) returns ( uint256 sTokenIncentivesIndex, uint256 sEmissionPerSecond, 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, - 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 @@ -106,32 +142,48 @@ contract UiIncentiveDataProvider is IUiIncentiveDataProvider { try IStableDebtToken(baseData.variableDebtTokenAddress).getIncentivesController() returns (IAaveIncentivesController vTokenIncentiveController) { if (address(vTokenIncentiveController) != address(0)) { - ( + address vRewardToken = vTokenIncentiveController.REWARD_TOKEN(); + + try vTokenIncentiveController.getAssetData(baseData.variableDebtTokenAddress) returns ( uint256 vTokenIncentivesIndex, uint256 vEmissionPerSecond, 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, - vIncentivesLastUpdateTimestamp, - vTokenIncentivesIndex, - vTokenIncentiveController.DISTRIBUTION_END(), - baseData.variableDebtTokenAddress, - vRewardToken, - address(vTokenIncentiveController), - IERC20Detailed(vRewardToken).decimals(), - vTokenIncentiveController.PRECISION() - ); + 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 - } - + } } - return (reservesIncentiveData); } From c45bee4ae17fe624adcd36ab6a9ede700babbcf1 Mon Sep 17 00:00:00 2001 From: kartojal Date: Mon, 27 Sep 2021 11:51:29 +0200 Subject: [PATCH 17/17] config: remove temp etherscan plugin --- hardhat.config.ts | 2 +- helper-hardhat-config.ts | 2 +- helpers/contracts-deployments.ts | 16 +++--- helpers/contracts-helpers.ts | 10 +--- package-lock.json | 94 ++++++++++---------------------- package.json | 2 +- 6 files changed, 41 insertions(+), 85 deletions(-) diff --git a/hardhat.config.ts b/hardhat.config.ts index 10b4402b..e374ca20 100644 --- a/hardhat.config.ts +++ b/hardhat.config.ts @@ -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'; diff --git a/helper-hardhat-config.ts b/helper-hardhat-config.ts index 2b1e9d01..2b7e7183 100644 --- a/helper-hardhat-config.ts +++ b/helper-hardhat-config.ts @@ -63,7 +63,7 @@ export const NETWORKS_DEFAULT_GAS: iParamsPerNetwork = { [eEthereumNetwork.buidlerevm]: 65 * GWEI, [eEthereumNetwork.tenderlyMain]: 0.01 * GWEI, [ePolygonNetwork.mumbai]: 1 * GWEI, - [ePolygonNetwork.matic]: 1 * GWEI, + [ePolygonNetwork.matic]: 50 * GWEI, [eXDaiNetwork.xdai]: 1 * GWEI, }; diff --git a/helpers/contracts-deployments.ts b/helpers/contracts-deployments.ts index a76c5011..95133cae 100644 --- a/helpers/contracts-deployments.ts +++ b/helpers/contracts-deployments.ts @@ -49,6 +49,7 @@ import { WETH9MockedFactory, WETHGatewayFactory, FlashLiquidationAdapterFactory, + UiIncentiveDataProviderFactory, } from '../types'; import { withSaveAndVerify, @@ -74,14 +75,13 @@ export const deployUiPoolDataProvider = async (verify?: boolean) => { return instance; }; -export const deployUiIncentiveDataProvider = async (verify?: boolean) => { - const id = eContractid.UiIncentiveDataProvider; - const instance = await deployContract(id, []); - if (verify) { - await verifyContract(id, instance, []); - } - return instance; -}; +export const deployUiIncentiveDataProvider = async (verify?: boolean) => + withSaveAndVerify( + await new UiIncentiveDataProviderFactory(await getFirstSigner()).deploy(), + eContractid.UiIncentiveDataProvider, + [], + verify + ); const readArtifact = async (id: string) => { if (DRE.network.name === eEthereumNetwork.buidlerevm) { diff --git a/helpers/contracts-helpers.ts b/helpers/contracts-helpers.ts index cb7c016e..fed36214 100644 --- a/helpers/contracts-helpers.ts +++ b/helpers/contracts-helpers.ts @@ -142,14 +142,8 @@ export const linkBytecode = (artifact: BuidlerArtifact | Artifact, libraries: an }; export const getParamPerNetwork = (param: iParamsPerNetwork, network: eNetwork) => { - const { - main, - ropsten, - kovan, - coverage, - buidlerevm, - tenderlyMain, - } = param as iEthereumParamsPerNetwork; + const { main, ropsten, kovan, coverage, buidlerevm, tenderlyMain } = + param as iEthereumParamsPerNetwork; const { matic, mumbai } = param as iPolygonParamsPerNetwork; const { xdai } = param as iXDaiParamsPerNetwork; if (process.env.FORK) { diff --git a/package-lock.json b/package-lock.json index 7f3c76fd..8ce5209b 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1133,7 +1133,6 @@ "version": "5.1.2", "resolved": "https://registry.npmjs.org/@ethersproject/abi/-/abi-5.1.2.tgz", "integrity": "sha512-uMhoQVPX0UtfzTpekYQSEUcJGDgsJ25ifz+SV6PDETWaUFhcR8RNgb1QPTASP13inW8r6iy0/Xdq9D5hK2pNvA==", - "dev": true, "requires": { "@ethersproject/address": "^5.1.0", "@ethersproject/bignumber": "^5.1.0", @@ -1150,7 +1149,6 @@ "version": "5.1.0", "resolved": "https://registry.npmjs.org/@ethersproject/abstract-provider/-/abstract-provider-5.1.0.tgz", "integrity": "sha512-8dJUnT8VNvPwWhYIau4dwp7qe1g+KgdRm4XTWvjkI9gAT2zZa90WF5ApdZ3vl1r6NDmnn6vUVvyphClRZRteTQ==", - "dev": true, "requires": { "@ethersproject/bignumber": "^5.1.0", "@ethersproject/bytes": "^5.1.0", @@ -1165,7 +1163,6 @@ "version": "5.1.0", "resolved": "https://registry.npmjs.org/@ethersproject/abstract-signer/-/abstract-signer-5.1.0.tgz", "integrity": "sha512-qQDMkjGZSSJSKl6AnfTgmz9FSnzq3iEoEbHTYwjDlEAv+LNP7zd4ixCcVWlWyk+2siud856M5CRhAmPdupeN9w==", - "dev": true, "requires": { "@ethersproject/abstract-provider": "^5.1.0", "@ethersproject/bignumber": "^5.1.0", @@ -1178,7 +1175,6 @@ "version": "5.1.0", "resolved": "https://registry.npmjs.org/@ethersproject/address/-/address-5.1.0.tgz", "integrity": "sha512-rfWQR12eHn2cpstCFS4RF7oGjfbkZb0oqep+BfrT+gWEGWG2IowJvIsacPOvzyS1jhNF4MQ4BS59B04Mbovteg==", - "dev": true, "requires": { "@ethersproject/bignumber": "^5.1.0", "@ethersproject/bytes": "^5.1.0", @@ -1191,7 +1187,6 @@ "version": "5.1.0", "resolved": "https://registry.npmjs.org/@ethersproject/base64/-/base64-5.1.0.tgz", "integrity": "sha512-npD1bLvK4Bcxz+m4EMkx+F8Rd7CnqS9DYnhNu0/GlQBXhWjvfoAZzk5HJ0f1qeyp8d+A86PTuzLOGOXf4/CN8g==", - "dev": true, "requires": { "@ethersproject/bytes": "^5.1.0" } @@ -1210,7 +1205,6 @@ "version": "5.1.1", "resolved": "https://registry.npmjs.org/@ethersproject/bignumber/-/bignumber-5.1.1.tgz", "integrity": "sha512-AVz5iqz7+70RIqoQTznsdJ6DOVBYciNlvO+AlQmPTB6ofCvoihI9bQdr6wljsX+d5W7Yc4nyvQvP4JMzg0Agig==", - "dev": true, "requires": { "@ethersproject/bytes": "^5.1.0", "@ethersproject/logger": "^5.1.0", @@ -1221,7 +1215,6 @@ "version": "5.1.0", "resolved": "https://registry.npmjs.org/@ethersproject/bytes/-/bytes-5.1.0.tgz", "integrity": "sha512-sGTxb+LVjFxJcJeUswAIK6ncgOrh3D8c192iEJd7mLr95V6du119rRfYT/b87WPkZ5I3gRBUYIYXtdgCWACe8g==", - "dev": true, "requires": { "@ethersproject/logger": "^5.1.0" } @@ -1230,7 +1223,6 @@ "version": "5.1.0", "resolved": "https://registry.npmjs.org/@ethersproject/constants/-/constants-5.1.0.tgz", "integrity": "sha512-0/SuHrxc8R8k+JiLmJymxHJbojUDWBQqO+b+XFdwaP0jGzqC09YDy/CAlSZB6qHsBifY8X3I89HcK/oMqxRdBw==", - "dev": true, "requires": { "@ethersproject/bignumber": "^5.1.0" } @@ -1257,7 +1249,6 @@ "version": "5.1.0", "resolved": "https://registry.npmjs.org/@ethersproject/hash/-/hash-5.1.0.tgz", "integrity": "sha512-fNwry20yLLPpnRRwm3fBL+2ksgO+KMadxM44WJmRIoTKzy4269+rbq9KFoe2LTqq2CXJM2CE70beGaNrpuqflQ==", - "dev": true, "requires": { "@ethersproject/abstract-signer": "^5.1.0", "@ethersproject/address": "^5.1.0", @@ -1314,7 +1305,6 @@ "version": "5.1.0", "resolved": "https://registry.npmjs.org/@ethersproject/keccak256/-/keccak256-5.1.0.tgz", "integrity": "sha512-vrTB1W6AEYoadww5c9UyVJ2YcSiyIUTNDRccZIgwTmFFoSHwBtcvG1hqy9RzJ1T0bMdATbM9Hfx2mJ6H0i7Hig==", - "dev": true, "requires": { "@ethersproject/bytes": "^5.1.0", "js-sha3": "0.5.7" @@ -1323,22 +1313,19 @@ "js-sha3": { "version": "0.5.7", "resolved": "https://registry.npmjs.org/js-sha3/-/js-sha3-0.5.7.tgz", - "integrity": "sha1-DU/9gALVMzqrr0oj7tL2N0yfKOc=", - "dev": true + "integrity": "sha1-DU/9gALVMzqrr0oj7tL2N0yfKOc=" } } }, "@ethersproject/logger": { "version": "5.1.0", "resolved": "https://registry.npmjs.org/@ethersproject/logger/-/logger-5.1.0.tgz", - "integrity": "sha512-wtUaD1lBX10HBXjjKV9VHCBnTdUaKQnQ2XSET1ezglqLdPdllNOIlLfhyCRqXm5xwcjExVI5ETokOYfjPtaAlw==", - "dev": true + "integrity": "sha512-wtUaD1lBX10HBXjjKV9VHCBnTdUaKQnQ2XSET1ezglqLdPdllNOIlLfhyCRqXm5xwcjExVI5ETokOYfjPtaAlw==" }, "@ethersproject/networks": { "version": "5.1.0", "resolved": "https://registry.npmjs.org/@ethersproject/networks/-/networks-5.1.0.tgz", "integrity": "sha512-A/NIrIED/G/IgU1XUukOA3WcFRxn2I4O5GxsYGA5nFlIi+UZWdGojs85I1VXkR1gX9eFnDXzjE6OtbgZHjFhIA==", - "dev": true, "requires": { "@ethersproject/logger": "^5.1.0" } @@ -1357,7 +1344,6 @@ "version": "5.1.0", "resolved": "https://registry.npmjs.org/@ethersproject/properties/-/properties-5.1.0.tgz", "integrity": "sha512-519KKTwgmH42AQL3+GFV3SX6khYEfHsvI6v8HYejlkigSDuqttdgVygFTDsGlofNFchhDwuclrxQnD5B0YLNMg==", - "dev": true, "requires": { "@ethersproject/logger": "^5.1.0" } @@ -1411,7 +1397,6 @@ "version": "5.1.0", "resolved": "https://registry.npmjs.org/@ethersproject/rlp/-/rlp-5.1.0.tgz", "integrity": "sha512-vDTyHIwNPrecy55gKGZ47eJZhBm8LLBxihzi5ou+zrSvYTpkSTWRcKUlXFDFQVwfWB+P5PGyERAdiDEI76clxw==", - "dev": true, "requires": { "@ethersproject/bytes": "^5.1.0", "@ethersproject/logger": "^5.1.0" @@ -1444,7 +1429,6 @@ "version": "5.1.0", "resolved": "https://registry.npmjs.org/@ethersproject/signing-key/-/signing-key-5.1.0.tgz", "integrity": "sha512-tE5LFlbmdObG8bY04NpuwPWSRPgEswfxweAI1sH7TbP0ml1elNfqcq7ii/3AvIN05i5U0Pkm3Tf8bramt8MmLw==", - "dev": true, "requires": { "@ethersproject/bytes": "^5.1.0", "@ethersproject/logger": "^5.1.0", @@ -1470,7 +1454,6 @@ "version": "5.1.0", "resolved": "https://registry.npmjs.org/@ethersproject/strings/-/strings-5.1.0.tgz", "integrity": "sha512-perBZy0RrmmL0ejiFGUOlBVjMsUceqLut3OBP3zP96LhiJWWbS8u1NqQVgN4/Gyrbziuda66DxiQocXhsvx+Sw==", - "dev": true, "requires": { "@ethersproject/bytes": "^5.1.0", "@ethersproject/constants": "^5.1.0", @@ -1481,7 +1464,6 @@ "version": "5.1.1", "resolved": "https://registry.npmjs.org/@ethersproject/transactions/-/transactions-5.1.1.tgz", "integrity": "sha512-Nwgbp09ttIVN0OoUBatCXaHxR7grWPHbozJN8v7AXDLrl6nnOIBEMDh+yJTnosSQlFhcyjfTGGN+Mx6R8HdvMw==", - "dev": true, "requires": { "@ethersproject/address": "^5.1.0", "@ethersproject/bignumber": "^5.1.0", @@ -1532,7 +1514,6 @@ "version": "5.1.0", "resolved": "https://registry.npmjs.org/@ethersproject/web/-/web-5.1.0.tgz", "integrity": "sha512-LTeluWgTq04+RNqAkVhpydPcRZK/kKxD2Vy7PYGrAD27ABO9kTqTBKwiOuzTyAHKUQHfnvZbXmxBXJAGViSDcA==", - "dev": true, "requires": { "@ethersproject/base64": "^5.1.0", "@ethersproject/bytes": "^5.1.0", @@ -1724,6 +1705,20 @@ "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==", + "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", @@ -2856,8 +2851,7 @@ "bn.js": { "version": "4.12.0", "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-4.12.0.tgz", - "integrity": "sha512-c98Bf3tPniI+scsdk237ku1Dc3ujXQTSgyiPUDEOe7tRkhrqridvh8klBv0HCEso1OLOYcHuCv/cS6DNxKH+ZA==", - "dev": true + "integrity": "sha512-c98Bf3tPniI+scsdk237ku1Dc3ujXQTSgyiPUDEOe7tRkhrqridvh8klBv0HCEso1OLOYcHuCv/cS6DNxKH+ZA==" }, "body-parser": { "version": "1.19.0", @@ -2952,8 +2946,7 @@ "brorand": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/brorand/-/brorand-1.1.0.tgz", - "integrity": "sha1-EsJe/kCkXjwyPrhnWgoM5XsiNx8=", - "dev": true + "integrity": "sha1-EsJe/kCkXjwyPrhnWgoM5XsiNx8=" }, "browser-stdout": { "version": "1.3.1", @@ -3211,7 +3204,6 @@ "version": "5.2.0", "resolved": "https://registry.npmjs.org/cbor/-/cbor-5.2.0.tgz", "integrity": "sha512-5IMhi9e1QU76ppa5/ajP1BmMWZ2FHkhAhjeVKQ/EFCgYSEaeVaoGtL7cxJskf9oCCk+XjzaIdc3IuU/dbA/o2A==", - "dev": true, "requires": { "bignumber.js": "^9.0.1", "nofilter": "^1.0.4" @@ -3220,8 +3212,7 @@ "bignumber.js": { "version": "9.0.1", "resolved": "https://registry.npmjs.org/bignumber.js/-/bignumber.js-9.0.1.tgz", - "integrity": "sha512-IdZR9mh6ahOBv/hYGiXyVuyCetmGJhtYkqLBpTStdhEGjegpPlUawydyaF3pbIOFynJTpllEs+NP+CS9jKFLjA==", - "dev": true + "integrity": "sha512-IdZR9mh6ahOBv/hYGiXyVuyCetmGJhtYkqLBpTStdhEGjegpPlUawydyaF3pbIOFynJTpllEs+NP+CS9jKFLjA==" } } }, @@ -3776,7 +3767,6 @@ "version": "4.3.1", "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.1.tgz", "integrity": "sha512-doEwdvm4PCeK4K3RQN2ZC2BYUBaxwLARCqZmMjtF8a51J2Rb0xpVloFRnCODwqjpwnAoao4pelN8l3RJdv3gRQ==", - "dev": true, "requires": { "ms": "2.1.2" } @@ -4233,7 +4223,6 @@ "version": "6.5.4", "resolved": "https://registry.npmjs.org/elliptic/-/elliptic-6.5.4.tgz", "integrity": "sha512-iLhC6ULemrljPZb+QutR5TQGB+pdW6KGD5RSegS+8sorOZT+rdQFbsQFJgvN3eRqNALqJer4oQ16YvJHlU8hzQ==", - "dev": true, "requires": { "bn.js": "^4.11.9", "brorand": "^1.1.0", @@ -5653,7 +5642,6 @@ "version": "7.0.1", "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-7.0.1.tgz", "integrity": "sha512-YJDaCJZEnBmcbw13fvdAM9AwNOJwOzrE4pqMqBq5nFiEqXUqHwlK4B+3pUw6JNvfSPtX05xFHtYy/1ni01eGCw==", - "dev": true, "requires": { "graceful-fs": "^4.1.2", "jsonfile": "^4.0.0", @@ -14793,7 +14781,7 @@ } }, "ethereumjs-abi": { - "version": "git+https://github.com/ethereumjs/ethereumjs-abi.git#1a27c59c15ab1e95ee8e5c4ed6ad814c49cc439e", + "version": "git+https://github.com/ethereumjs/ethereumjs-abi.git#ee3994657fa7a427238e6ba92a84d0b529bbcde0", "from": "git+https://github.com/ethereumjs/ethereumjs-abi.git", "dev": true, "requires": { @@ -15514,8 +15502,7 @@ "graceful-fs": { "version": "4.2.6", "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.6.tgz", - "integrity": "sha512-nTnJ528pbqxYanhpDYsi4Rd8MAeaBA67+RZ10CM1m3bTAVFEDcd5AuA4a6W5YkGZ1iNXHzZz8T6TBKLeBuNriQ==", - "dev": true + "integrity": "sha512-nTnJ528pbqxYanhpDYsi4Rd8MAeaBA67+RZ10CM1m3bTAVFEDcd5AuA4a6W5YkGZ1iNXHzZz8T6TBKLeBuNriQ==" }, "growl": { "version": "1.10.5", @@ -15974,7 +15961,6 @@ "version": "1.1.7", "resolved": "https://registry.npmjs.org/hash.js/-/hash.js-1.1.7.tgz", "integrity": "sha512-taOaskGt4z4SOANNseOviYDvjEJinIkRgmp7LbKP2YTTmVxWBl87s/uzK9r+44BclBSp2X7K1hqeNfz9JbBeXA==", - "dev": true, "requires": { "inherits": "^2.0.3", "minimalistic-assert": "^1.0.1" @@ -15990,7 +15976,6 @@ "version": "1.0.1", "resolved": "https://registry.npmjs.org/hmac-drbg/-/hmac-drbg-1.0.1.tgz", "integrity": "sha1-0nRXAQJabHdabFRXk+1QL8DGSaE=", - "dev": true, "requires": { "hash.js": "^1.0.3", "minimalistic-assert": "^1.0.0", @@ -16634,7 +16619,6 @@ "version": "4.0.0", "resolved": "https://registry.npmjs.org/jsonfile/-/jsonfile-4.0.0.tgz", "integrity": "sha1-h3Gq4HmbZAdrdmQPygWPnBDjPss=", - "dev": true, "requires": { "graceful-fs": "^4.1.6" } @@ -17387,14 +17371,12 @@ "minimalistic-assert": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/minimalistic-assert/-/minimalistic-assert-1.0.1.tgz", - "integrity": "sha512-UtJcAD4yEaGtjPezWuO9wC4nwUnVH/8/Im3yEHQP4b67cXlD/Qr9hdITCU1xDbSEXg2XKNaP8jsReV7vQd00/A==", - "dev": true + "integrity": "sha512-UtJcAD4yEaGtjPezWuO9wC4nwUnVH/8/Im3yEHQP4b67cXlD/Qr9hdITCU1xDbSEXg2XKNaP8jsReV7vQd00/A==" }, "minimalistic-crypto-utils": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/minimalistic-crypto-utils/-/minimalistic-crypto-utils-1.0.1.tgz", - "integrity": "sha1-9sAMHAsIIkblxNmd+4x8CDsrWCo=", - "dev": true + "integrity": "sha1-9sAMHAsIIkblxNmd+4x8CDsrWCo=" }, "minimatch": { "version": "3.0.4", @@ -17642,8 +17624,7 @@ "ms": { "version": "2.1.2", "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", - "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==", - "dev": true + "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==" }, "multibase": { "version": "0.6.1", @@ -17772,8 +17753,7 @@ "node-fetch": { "version": "2.6.1", "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.6.1.tgz", - "integrity": "sha512-V4aYg89jEoVRxRb2fJdAg8FHvI7cEyYdVAh94HH0UIK8oJxUfkjlDQN9RbMx+bEjP7+ggMiFRprSti032Oipxw==", - "dev": true + "integrity": "sha512-V4aYg89jEoVRxRb2fJdAg8FHvI7cEyYdVAh94HH0UIK8oJxUfkjlDQN9RbMx+bEjP7+ggMiFRprSti032Oipxw==" }, "node-gyp-build": { "version": "4.2.3", @@ -17784,8 +17764,7 @@ "nofilter": { "version": "1.0.4", "resolved": "https://registry.npmjs.org/nofilter/-/nofilter-1.0.4.tgz", - "integrity": "sha512-N8lidFp+fCz+TD51+haYdbDGrcBWwuHX40F5+z0qkUjMJ5Tp+rdSuAkMJ9N9eoolDlEVTf6u5icM+cNKkKW2mA==", - "dev": true + "integrity": "sha512-N8lidFp+fCz+TD51+haYdbDGrcBWwuHX40F5+z0qkUjMJ5Tp+rdSuAkMJ9N9eoolDlEVTf6u5icM+cNKkKW2mA==" }, "nopt": { "version": "3.0.6", @@ -19090,8 +19069,7 @@ "semver": { "version": "6.3.0", "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.0.tgz", - "integrity": "sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw==", - "dev": true + "integrity": "sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw==" }, "semver-compare": { "version": "1.0.0", @@ -19903,21 +19881,6 @@ } } }, - "temp-hardhat-etherscan": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/temp-hardhat-etherscan/-/temp-hardhat-etherscan-2.0.2.tgz", - "integrity": "sha512-q9+OMPXlsXZ+2fnF+Xmvv0J9vNJChwOXVGJIATiDJr7Qe8LzTwgs55C4l4NKMWPLe4PE9UjcQMVntRfXGTF9vA==", - "dev": true, - "requires": { - "@ethersproject/abi": "^5.0.2", - "@ethersproject/address": "^5.0.2", - "cbor": "^5.0.2", - "fs-extra": "^7.0.1", - "lodash": "^4.17.11", - "node-fetch": "^2.6.0", - "semver": "^6.3.0" - } - }, "test-value": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/test-value/-/test-value-2.1.0.tgz", @@ -20343,8 +20306,7 @@ "universalify": { "version": "0.1.2", "resolved": "https://registry.npmjs.org/universalify/-/universalify-0.1.2.tgz", - "integrity": "sha512-rBJeI5CXAlmy1pV+617WB9J63U6XcazHHF2f2dbJix4XzpUF0RS3Zbj0FGIOCAva5P/d/GBOYaACQ1w+0azUkg==", - "dev": true + "integrity": "sha512-rBJeI5CXAlmy1pV+617WB9J63U6XcazHHF2f2dbJix4XzpUF0RS3Zbj0FGIOCAva5P/d/GBOYaACQ1w+0azUkg==" }, "unpipe": { "version": "1.0.0", diff --git a/package.json b/package.json index ebc964da..a4495ff3 100644 --- a/package.json +++ b/package.json @@ -133,7 +133,6 @@ "prettier-plugin-solidity": "^1.0.0-alpha.53", "pretty-quick": "^2.0.1", "solidity-coverage": "^0.7.16", - "temp-hardhat-etherscan": "^2.0.2", "ts-generator": "^0.1.1", "ts-node": "^8.10.2", "tslint": "^6.1.2", @@ -158,6 +157,7 @@ ], "license": "AGPLv3", "dependencies": { + "@nomiclabs/hardhat-etherscan": "^2.1.6", "axios-curlirize": "^1.3.7", "tmp-promise": "^3.0.2" },