Fixed & tested etherscan verification (on Kovan)

This commit is contained in:
Zer0dot 2021-02-22 22:25:58 -05:00 committed by Hadrien Charlanes
parent 50e2828008
commit 599c2759f1
2 changed files with 43 additions and 14 deletions

View File

@ -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',

View File

@ -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))) {