From 5c84b4e4861e045a5f80ed113f01b4b9df489d38 Mon Sep 17 00:00:00 2001 From: sendra Date: Mon, 11 Oct 2021 17:36:27 +0200 Subject: [PATCH] fixed deployment pipeline --- helpers/contracts-deployments.ts | 20 +++---- .../deployments/deploy-UiPoolDataProvider.ts | 55 +------------------ tasks/full/6-initialize.ts | 5 +- 3 files changed, 11 insertions(+), 69 deletions(-) diff --git a/helpers/contracts-deployments.ts b/helpers/contracts-deployments.ts index 8f0eee9a..bc03dafc 100644 --- a/helpers/contracts-deployments.ts +++ b/helpers/contracts-deployments.ts @@ -52,6 +52,7 @@ import { WETHGatewayFactory, FlashLiquidationAdapterFactory, UiIncentiveDataProviderFactory, + UiPoolDataProviderFactory, } from '../types'; import { withSaveAndVerify, @@ -78,18 +79,13 @@ export const deployUiIncentiveDataProvider = async (verify?: boolean) => verify ); -export const deployUiPoolDataProvider = async ( - [incentivesController, aaveOracle]: [tEthereumAddress, tEthereumAddress], - verify?: boolean -) => { - const id = eContractid.UiPoolDataProvider; - const args: string[] = [incentivesController, aaveOracle]; - const instance = await deployContract(id, args); - if (verify) { - await verifyContract(id, instance, args); - } - return instance; -}; +export const deployUiPoolDataProvider = async (verify?: boolean) => + withSaveAndVerify( + await new UiPoolDataProviderFactory(await getFirstSigner()).deploy(), + eContractid.UiPoolDataProvider, + [], + verify + ); const readArtifact = async (id: string) => { if (DRE.network.name === eEthereumNetwork.buidlerevm) { diff --git a/tasks/deployments/deploy-UiPoolDataProvider.ts b/tasks/deployments/deploy-UiPoolDataProvider.ts index 407818b6..464d6b92 100644 --- a/tasks/deployments/deploy-UiPoolDataProvider.ts +++ b/tasks/deployments/deploy-UiPoolDataProvider.ts @@ -1,13 +1,6 @@ import { task } from 'hardhat/config'; -import { - eAvalancheNetwork, - eContractid, - eEthereumNetwork, - eNetwork, - ePolygonNetwork, -} from '../../helpers/types'; +import { eContractid } from '../../helpers/types'; import { deployUiPoolDataProvider } from '../../helpers/contracts-deployments'; -import { exit } from 'process'; task(`deploy-${eContractid.UiPoolDataProvider}`, `Deploys the UiPoolDataProvider contract`) .addFlag('verify', 'Verify UiPoolDataProvider contract via Etherscan API.') @@ -16,54 +9,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', - }, - [eAvalancheNetwork.fuji]: { - incentivesController: '0xa1EF206fb9a8D8186157FC817fCddcC47727ED55', - aaveOracle: '0xD217DdD9f0Af84644dEFe84a0b634621D4617a29', - }, - [eAvalancheNetwork.avalanche]: { - incentivesController: '0x01D83Fe6A10D2f2B7AF17034343746188272cAc9', - aaveOracle: '0xdC336Cd4769f4cC7E9d726DA53e6d3fC710cEB89', - }, - }; - 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`); diff --git a/tasks/full/6-initialize.ts b/tasks/full/6-initialize.ts index fc93600d..b1fd7601 100644 --- a/tasks/full/6-initialize.ts +++ b/tasks/full/6-initialize.ts @@ -100,10 +100,7 @@ task('full:initialize-lending-pool', 'Initialize lending pool configuration.') await deployWalletBalancerProvider(verify); - const uiPoolDataProvider = await deployUiPoolDataProvider( - [incentivesController, oracle], - verify - ); + const uiPoolDataProvider = await deployUiPoolDataProvider(verify); console.log('UiPoolDataProvider deployed at:', uiPoolDataProvider.address); const lendingPoolAddress = await addressesProvider.getLendingPool();