From 599c2759f16d09e480be69c889b543cbf998b763 Mon Sep 17 00:00:00 2001 From: Zer0dot Date: Mon, 22 Feb 2021 22:25:58 -0500 Subject: [PATCH] Fixed & tested etherscan verification (on Kovan) --- tasks/verifications/1_general.ts | 44 +++++++++++++++++++++++--------- tasks/verifications/2_tokens.ts | 13 ++++++++-- 2 files changed, 43 insertions(+), 14 deletions(-) diff --git a/tasks/verifications/1_general.ts b/tasks/verifications/1_general.ts index 89a54d0d..80a76162 100644 --- a/tasks/verifications/1_general.ts +++ b/tasks/verifications/1_general.ts @@ -27,7 +27,7 @@ import { verifyContract } from '../../helpers/etherscan-verification'; import { notFalsyOrZeroAddress } from '../../helpers/misc-utils'; import { eEthereumNetwork, ICommonConfiguration } from '../../helpers/types'; -task('verify:general', 'Deploy oracles for dev enviroment') +task('verify:general', 'Verify contracts at Etherscan') .addFlag('all', 'Verify all contracts at Etherscan') .addParam('pool', `Pool name to retrieve configuration, supported: ${Object.values(ConfigNames)}`) .setAction(async ({ all, pool }, localDRE) => { @@ -39,6 +39,10 @@ task('verify:general', 'Deploy oracles for dev enviroment') ReservesConfig, ProviderRegistry, MarketId, + LendingPoolCollateralManager, + LendingPoolConfigurator, + LendingPool, + WethGateway, } = poolConfig as ICommonConfiguration; const treasuryAddress = await getTreasuryAddress(poolConfig); @@ -47,17 +51,33 @@ task('verify:general', 'Deploy oracles for dev enviroment') const addressesProviderRegistry = notFalsyOrZeroAddress(registryAddress) ? await getLendingPoolAddressesProviderRegistry(registryAddress) : await getLendingPoolAddressesProviderRegistry(); - const lendingPoolProxy = await getLendingPool(); - const lendingPoolConfigurator = await getLendingPoolConfiguratorProxy(); - const lendingPoolCollateralManager = await getLendingPoolCollateralManager(); + const lendingPoolAddress = await addressesProvider.getLendingPool(); + const lendingPoolConfiguratorAddress = await addressesProvider.getLendingPoolConfigurator();//getLendingPoolConfiguratorProxy(); + const lendingPoolCollateralManagerAddress = await addressesProvider.getLendingPoolCollateralManager(); if (all) { - const lendingPoolImpl = await getLendingPoolImpl(); - const lendingPoolConfiguratorImpl = await getLendingPoolConfiguratorImpl(); - const lendingPoolCollateralManagerImpl = await getLendingPoolCollateralManagerImpl(); + const lendingPoolImplAddress = getParamPerNetwork(LendingPool, network); + const lendingPoolImpl = notFalsyOrZeroAddress(lendingPoolImplAddress) + ? await getLendingPoolImpl(lendingPoolImplAddress) + : await getLendingPoolImpl(); + + const lendingPoolConfiguratorImplAddress = getParamPerNetwork(LendingPoolConfigurator, network); + const lendingPoolConfiguratorImpl = notFalsyOrZeroAddress(lendingPoolConfiguratorImplAddress) + ? await getLendingPoolConfiguratorImpl(lendingPoolConfiguratorImplAddress) + : await getLendingPoolConfiguratorImpl(); + + const lendingPoolCollateralManagerImplAddress = getParamPerNetwork(LendingPoolCollateralManager, network); + const lendingPoolCollateralManagerImpl = notFalsyOrZeroAddress(lendingPoolCollateralManagerImplAddress) + ? await getLendingPoolCollateralManagerImpl(lendingPoolCollateralManagerImplAddress) + : await getLendingPoolCollateralManagerImpl(); + const dataProvider = await getAaveProtocolDataProvider(); const walletProvider = await getWalletProvider(); - const wethGateway = await getWETHGateway(); + + const wethGatewayAddress = getParamPerNetwork(WethGateway, network); + const wethGateway = notFalsyOrZeroAddress(wethGatewayAddress) + ? await getWETHGateway(wethGatewayAddress) + : await getWETHGateway(); // Address Provider console.log('\n- Verifying address provider...\n'); @@ -93,15 +113,15 @@ task('verify:general', 'Deploy oracles for dev enviroment') } // Lending Pool proxy console.log('\n- Verifying Lending Pool Proxy...\n'); - await verifyContract(lendingPoolProxy.address, [addressesProvider.address]); + await verifyContract(lendingPoolAddress, [addressesProvider.address]); // LendingPool Conf proxy console.log('\n- Verifying Lending Pool Configurator Proxy...\n'); - await verifyContract(lendingPoolConfigurator.address, [addressesProvider.address]); + await verifyContract(lendingPoolConfiguratorAddress, [addressesProvider.address]); // Proxy collateral manager console.log('\n- Verifying Lending Pool Collateral Manager Proxy...\n'); - await verifyContract(lendingPoolCollateralManager.address, []); + await verifyContract(lendingPoolCollateralManagerAddress, []); // DelegatedAwareAToken console.log('\n- Verifying DelegatedAwareAToken...\n'); @@ -110,7 +130,7 @@ task('verify:general', 'Deploy oracles for dev enviroment') if (aUNI) { console.log('Verifying aUNI'); await verifyContract(aUNI, [ - lendingPoolProxy.address, + lendingPoolAddress, UNI, treasuryAddress, 'Aave interest bearing UNI', diff --git a/tasks/verifications/2_tokens.ts b/tasks/verifications/2_tokens.ts index 4ea86cc5..a611c275 100644 --- a/tasks/verifications/2_tokens.ts +++ b/tasks/verifications/2_tokens.ts @@ -8,6 +8,7 @@ import { import { ZERO_ADDRESS } from '../../helpers/constants'; import { getAddressById, + getFirstSigner, getLendingPool, getLendingPoolAddressesProvider, getLendingPoolConfiguratorProxy, @@ -15,6 +16,7 @@ import { import { getParamPerNetwork } from '../../helpers/contracts-helpers'; import { verifyContract } from '../../helpers/etherscan-verification'; import { eEthereumNetwork, ICommonConfiguration, IReserveParams } from '../../helpers/types'; +import { LendingPoolConfiguratorFactory, LendingPoolFactory } from '../../types'; task('verify:tokens', 'Deploy oracles for dev enviroment') .addParam('pool', `Pool name to retrieve configuration, supported: ${Object.values(ConfigNames)}`) @@ -26,8 +28,15 @@ task('verify:tokens', 'Deploy oracles for dev enviroment') const treasuryAddress = await getTreasuryAddress(poolConfig); const addressesProvider = await getLendingPoolAddressesProvider(); - const lendingPoolProxy = await getLendingPool(); - const lendingPoolConfigurator = await getLendingPoolConfiguratorProxy(); + const lendingPoolProxy = LendingPoolFactory.connect( + await addressesProvider.getLendingPool(), + await getFirstSigner() + ); + + const lendingPoolConfigurator = LendingPoolConfiguratorFactory.connect( + await addressesProvider.getLendingPoolConfigurator(), + await getFirstSigner() + ); const configs = Object.entries(ReservesConfig) as [string, IReserveParams][]; for (const entry of Object.entries(getParamPerNetwork(ReserveAssets, network))) {