diff --git a/contracts/misc/UiIncentiveDataProvider.sol b/contracts/misc/UiIncentiveDataProvider.sol new file mode 100644 index 00000000..d59db137 --- /dev/null +++ b/contracts/misc/UiIncentiveDataProvider.sol @@ -0,0 +1,288 @@ +// 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'; +import {IERC20Detailed} from '../dependencies/openzeppelin/contracts/IERC20Detailed.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) + { + return (_getReservesIncentivesData(provider), _getUserReservesIncentivesData(provider, user)); + } + + 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]); + + try IStableDebtToken(baseData.aTokenAddress).getIncentivesController() returns (IAaveIncentivesController aTokenIncentiveController) { + if (address(aTokenIncentiveController) != address(0)) { + address aRewardToken = aTokenIncentiveController.REWARD_TOKEN(); + + try aTokenIncentiveController.getAssetData(baseData.aTokenAddress) returns ( + uint256 aTokenIncentivesIndex, + uint256 aEmissionPerSecond, + uint256 aIncentivesLastUpdateTimestamp + ) { + reserveIncentiveData.aIncentiveData = IncentiveData( + aEmissionPerSecond, + aIncentivesLastUpdateTimestamp, + aTokenIncentivesIndex, + aTokenIncentiveController.DISTRIBUTION_END(), + baseData.aTokenAddress, + aRewardToken, + address(aTokenIncentiveController), + IERC20Detailed(aRewardToken).decimals(), + aTokenIncentiveController.PRECISION() + ); + } catch (bytes memory /*lowLevelData*/) { + ( + uint256 aEmissionPerSecond, + uint256 aIncentivesLastUpdateTimestamp, + uint256 aTokenIncentivesIndex + ) = aTokenIncentiveController.assets(baseData.aTokenAddress); + + reserveIncentiveData.aIncentiveData = IncentiveData( + 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 + ) { + 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); + + 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 + } + + 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 + ) { + 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); + + 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); + } + + 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]; + + IUiIncentiveDataProvider.UserIncentiveData memory aUserIncentiveData; + + 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*/) { + + } + + userReservesIncentivesData[i].aTokenIncentivesUserData = aUserIncentiveData; + + UserIncentiveData memory vUserIncentiveData; + + 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*/) { + + } + + userReservesIncentivesData[i].vTokenIncentivesUserData = vUserIncentiveData; + + UserIncentiveData memory sUserIncentiveData; + + 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*/) { + + } + + userReservesIncentivesData[i].sTokenIncentivesUserData = sUserIncentiveData; + } + + return (userReservesIncentivesData); + } +} \ No newline at end of file diff --git a/contracts/misc/UiPoolDataProvider.sol b/contracts/misc/UiPoolDataProvider.sol index 214a30f7..c4d12d8a 100644 --- a/contracts/misc/UiPoolDataProvider.sol +++ b/contracts/misc/UiPoolDataProvider.sol @@ -6,7 +6,7 @@ import {IERC20Detailed} from '../dependencies/openzeppelin/contracts/IERC20Detai import {ILendingPoolAddressesProvider} from '../interfaces/ILendingPoolAddressesProvider.sol'; import {IUiPoolDataProvider} from './interfaces/IUiPoolDataProvider.sol'; import {ILendingPool} from '../interfaces/ILendingPool.sol'; -import {IPriceOracleGetter} from '../interfaces/IPriceOracleGetter.sol'; +import {IAaveOracle} from './IAaveOracle.sol'; import {IAToken} from '../interfaces/IAToken.sol'; import {IVariableDebtToken} from '../interfaces/IVariableDebtToken.sol'; import {IStableDebtToken} from '../interfaces/IStableDebtToken.sol'; @@ -24,10 +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) @@ -68,72 +66,11 @@ contract UiPoolDataProvider is IUiPoolDataProvider { uint256 ) { + IAaveOracle oracle = IAaveOracle(provider.getPriceOracle()); ILendingPool lendingPool = ILendingPool(provider.getLendingPool()); address[] memory reserves = lendingPool.getReservesList(); - AggregatedReserveData[] memory reservesData = new AggregatedReserveData[](reserves.length); - for (uint256 i = 0; i < reserves.length; i++) { - AggregatedReserveData memory reserveData = reservesData[i]; - reserveData.underlyingAsset = reserves[i]; - - // reserve current state - DataTypes.ReserveData memory baseData = - lendingPool.getReserveData(reserveData.underlyingAsset); - reserveData.liquidityIndex = baseData.liquidityIndex; - reserveData.variableBorrowIndex = baseData.variableBorrowIndex; - reserveData.liquidityRate = baseData.currentLiquidityRate; - reserveData.variableBorrowRate = baseData.currentVariableBorrowRate; - reserveData.stableBorrowRate = baseData.currentStableBorrowRate; - reserveData.lastUpdateTimestamp = baseData.lastUpdateTimestamp; - reserveData.aTokenAddress = baseData.aTokenAddress; - reserveData.stableDebtTokenAddress = baseData.stableDebtTokenAddress; - reserveData.variableDebtTokenAddress = baseData.variableDebtTokenAddress; - reserveData.interestRateStrategyAddress = baseData.interestRateStrategyAddress; - reserveData.priceInEth = oracle.getAssetPrice(reserveData.underlyingAsset); - - reserveData.availableLiquidity = IERC20Detailed(reserveData.underlyingAsset).balanceOf( - reserveData.aTokenAddress - ); - ( - reserveData.totalPrincipalStableDebt, - , - reserveData.averageStableRate, - reserveData.stableDebtLastUpdateTimestamp - ) = IStableDebtToken(reserveData.stableDebtTokenAddress).getSupplyData(); - reserveData.totalScaledVariableDebt = IVariableDebtToken(reserveData.variableDebtTokenAddress) - .scaledTotalSupply(); - - // reserve configuration - - // we're getting this info from the aToken, because some of assets can be not compliant with ETC20Detailed - reserveData.symbol = IERC20Detailed(reserveData.underlyingAsset).symbol(); - reserveData.name = ''; - - ( - reserveData.baseLTVasCollateral, - reserveData.reserveLiquidationThreshold, - reserveData.reserveLiquidationBonus, - reserveData.decimals, - reserveData.reserveFactor - ) = baseData.configuration.getParamsMemory(); - ( - reserveData.isActive, - reserveData.isFrozen, - reserveData.borrowingEnabled, - reserveData.stableBorrowRateEnabled - ) = baseData.configuration.getFlagsMemory(); - reserveData.usageAsCollateralEnabled = reserveData.baseLTVasCollateral != 0; - ( - reserveData.variableRateSlope1, - reserveData.variableRateSlope2, - reserveData.stableRateSlope1, - reserveData.stableRateSlope2 - ) = getInterestRateStrategySlopes( - DefaultReserveInterestRateStrategy(reserveData.interestRateStrategyAddress) - ); - } - - return (reservesData, oracle.getAssetPrice(MOCK_USD_ADDRESS)); + return (_getReserveData(oracle, reserves), oracle.getAssetPrice(MOCK_USD_ADDRESS)); } function getUserReservesData(ILendingPoolAddressesProvider provider, address user) @@ -192,6 +129,7 @@ contract UiPoolDataProvider is IUiPoolDataProvider { uint256 ) { + IAaveOracle oracle = IAaveOracle(provider.getPriceOracle()); ILendingPool lendingPool = ILendingPool(provider.getLendingPool()); address[] memory reserves = lendingPool.getReservesList(); DataTypes.UserConfigurationMap memory userConfig = lendingPool.getUserConfiguration(user); @@ -300,4 +238,73 @@ contract UiPoolDataProvider is IUiPoolDataProvider { oracle.getAssetPrice(MOCK_USD_ADDRESS), ); } + + + function _getReserveData(IAaveOracle oracle, ILendingPool lendingPool) private returns (AggregatedReserveData[] memory) { + AggregatedReserveData[] memory reservesData = new AggregatedReserveData[](reserves.length); + + for (uint256 i = 0; i < reserves.length; i++) { + AggregatedReserveData memory reserveData = reservesData[i]; + reserveData.underlyingAsset = reserves[i]; + + // reserve current state + DataTypes.ReserveData memory baseData = + lendingPool.getReserveData(reserveData.underlyingAsset); + reserveData.liquidityIndex = baseData.liquidityIndex; + reserveData.variableBorrowIndex = baseData.variableBorrowIndex; + reserveData.liquidityRate = baseData.currentLiquidityRate; + reserveData.variableBorrowRate = baseData.currentVariableBorrowRate; + reserveData.stableBorrowRate = baseData.currentStableBorrowRate; + reserveData.lastUpdateTimestamp = baseData.lastUpdateTimestamp; + reserveData.aTokenAddress = baseData.aTokenAddress; + reserveData.stableDebtTokenAddress = baseData.stableDebtTokenAddress; + reserveData.variableDebtTokenAddress = baseData.variableDebtTokenAddress; + reserveData.interestRateStrategyAddress = baseData.interestRateStrategyAddress; + // TODO: change naming to base something + reserveData.priceInEth = oracle.getAssetPrice(reserveData.underlyingAsset); + + reserveData.availableLiquidity = IERC20Detailed(reserveData.underlyingAsset).balanceOf( + reserveData.aTokenAddress + ); + ( + reserveData.totalPrincipalStableDebt, + , + reserveData.averageStableRate, + reserveData.stableDebtLastUpdateTimestamp + ) = IStableDebtToken(reserveData.stableDebtTokenAddress).getSupplyData(); + reserveData.totalScaledVariableDebt = IVariableDebtToken(reserveData.variableDebtTokenAddress) + .scaledTotalSupply(); + + // reserve configuration + + // we're getting this info from the aToken, because some of assets can be not compliant with ETC20Detailed + reserveData.symbol = IERC20Detailed(reserveData.underlyingAsset).symbol(); + reserveData.name = ''; + + ( + reserveData.baseLTVasCollateral, + reserveData.reserveLiquidationThreshold, + reserveData.reserveLiquidationBonus, + reserveData.decimals, + reserveData.reserveFactor + ) = baseData.configuration.getParamsMemory(); + ( + reserveData.isActive, + reserveData.isFrozen, + reserveData.borrowingEnabled, + reserveData.stableBorrowRateEnabled + ) = baseData.configuration.getFlagsMemory(); + reserveData.usageAsCollateralEnabled = reserveData.baseLTVasCollateral != 0; + ( + reserveData.variableRateSlope1, + reserveData.variableRateSlope2, + reserveData.stableRateSlope1, + reserveData.stableRateSlope2 + ) = getInterestRateStrategySlopes( + DefaultReserveInterestRateStrategy(reserveData.interestRateStrategyAddress) + ); + } + + return reserveData; + } } diff --git a/contracts/misc/interfaces/IAaveOracle.sol b/contracts/misc/interfaces/IAaveOracle.sol new file mode 100644 index 00000000..abb01fd7 --- /dev/null +++ b/contracts/misc/interfaces/IAaveOracle.sol @@ -0,0 +1,18 @@ +// SPDX-License-Identifier: agpl-3.0 +pragma solidity 0.6.12; + +/** + * @title IAaveOracle interface + * @notice Interface for the Aave oracle. + **/ + +interface IAaveOracle { + address public immutable BASE_CURRENCY; + uint256 public immutable BASE_CURRENCY_UNIT; + address public immutable WETH; + + /*********** + @dev returns the asset price in ETH + */ + function getAssetPrice(address asset) external view returns (uint256); +} \ No newline at end of file diff --git a/contracts/misc/interfaces/IUiIncentiveDataprovider.sol b/contracts/misc/interfaces/IUiIncentiveDataprovider.sol new file mode 100644 index 00000000..085bc283 --- /dev/null +++ b/contracts/misc/interfaces/IUiIncentiveDataprovider.sol @@ -0,0 +1,58 @@ +// 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; + address incentiveControllerAddress; + uint8 rewardTokenDecimals; + uint8 precision; + } + + struct UserReserveIncentiveData { + address underlyingAsset; + UserIncentiveData aTokenIncentivesUserData; + UserIncentiveData vTokenIncentivesUserData; + UserIncentiveData sTokenIncentivesUserData; + } + + struct UserIncentiveData { + uint256 tokenincentivesUserIndex; + uint256 userUnclaimedRewards; + address tokenAddress; + address rewardTokenAddress; + address incentiveControllerAddress; + uint8 rewardTokenDecimals; + } + + 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); +} \ No newline at end of file diff --git a/helpers/contracts-deployments.ts b/helpers/contracts-deployments.ts index 13c64a78..8f0eee9a 100644 --- a/helpers/contracts-deployments.ts +++ b/helpers/contracts-deployments.ts @@ -51,6 +51,7 @@ import { WETH9MockedFactory, WETHGatewayFactory, FlashLiquidationAdapterFactory, + UiIncentiveDataProviderFactory, } from '../types'; import { withSaveAndVerify, @@ -69,6 +70,14 @@ import { LendingPoolLibraryAddresses } from '../types/LendingPoolFactory'; import { UiPoolDataProvider } from '../types'; import { eNetwork } from './types'; +export const deployUiIncentiveDataProvider = async (verify?: boolean) => + withSaveAndVerify( + await new UiIncentiveDataProviderFactory(await getFirstSigner()).deploy(), + eContractid.UiIncentiveDataProvider, + [], + verify + ); + export const deployUiPoolDataProvider = async ( [incentivesController, aaveOracle]: [tEthereumAddress, tEthereumAddress], verify?: boolean diff --git a/helpers/types.ts b/helpers/types.ts index babd113e..bc624a0e 100644 --- a/helpers/types.ts +++ b/helpers/types.ts @@ -98,6 +98,7 @@ export enum eContractid { MockParaSwapAugustus = 'MockParaSwapAugustus', MockParaSwapAugustusRegistry = 'MockParaSwapAugustusRegistry', ParaSwapLiquiditySwapAdapter = 'ParaSwapLiquiditySwapAdapter', + UiIncentiveDataProvider = 'UiIncentiveDataProvider', } /* diff --git a/package-lock.json b/package-lock.json index e5198127..7f3c76fd 100644 --- a/package-lock.json +++ b/package-lock.json @@ -14793,7 +14793,7 @@ } }, "ethereumjs-abi": { - "version": "git+https://github.com/ethereumjs/ethereumjs-abi.git#ee3994657fa7a427238e6ba92a84d0b529bbcde0", + "version": "git+https://github.com/ethereumjs/ethereumjs-abi.git#1a27c59c15ab1e95ee8e5c4ed6ad814c49cc439e", "from": "git+https://github.com/ethereumjs/ethereumjs-abi.git", "dev": true, "requires": { diff --git a/package.json b/package.json index dfe0b2d4..2c53066b 100644 --- a/package.json +++ b/package.json @@ -76,6 +76,10 @@ "matic:deployUIProvider": "hardhat --network matic deploy-UiPoolDataProvider", "mumbai:deployUIProvider": "hardhat --network mumbai deploy-UiPoolDataProvider", "fuji:deployUIProvider": "hardhat --network fuji 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 --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", 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`); + });