Use registry address. Fix Provider verify. Fix WalletProvider verify.

This commit is contained in:
David Racero 2020-12-01 10:29:30 +01:00
parent 57ee9e0a7c
commit 7bd0e9afd1

View File

@ -1,7 +1,7 @@
import {zeroAddress} from 'ethereumjs-util'; import { zeroAddress } from 'ethereumjs-util';
import {task} from 'hardhat/config'; import { task } from 'hardhat/config';
import {loadPoolConfig, ConfigNames, getWethAddress} from '../../helpers/configuration'; import { loadPoolConfig, ConfigNames, getWethAddress } from '../../helpers/configuration';
import {ZERO_ADDRESS} from '../../helpers/constants'; import { ZERO_ADDRESS } from '../../helpers/constants';
import { import {
getAaveProtocolDataProvider, getAaveProtocolDataProvider,
getAddressById, getAddressById,
@ -16,21 +16,30 @@ import {
getWalletProvider, getWalletProvider,
getWETHGateway, getWETHGateway,
} from '../../helpers/contracts-getters'; } from '../../helpers/contracts-getters';
import {getParamPerNetwork} from '../../helpers/contracts-helpers'; import { getParamPerNetwork } from '../../helpers/contracts-helpers';
import {verifyContract} from '../../helpers/etherscan-verification'; import { verifyContract } from '../../helpers/etherscan-verification';
import {eEthereumNetwork, ICommonConfiguration} from '../../helpers/types'; import { notFalsyOrZeroAddress } from '../../helpers/misc-utils';
import { eEthereumNetwork, ICommonConfiguration } from '../../helpers/types';
task('verify:general', 'Deploy oracles for dev enviroment') task('verify:general', 'Deploy oracles for dev enviroment')
.addFlag('all', 'Verify all contracts at Etherscan') .addFlag('all', 'Verify all contracts at Etherscan')
.addParam('pool', `Pool name to retrieve configuration, supported: ${Object.values(ConfigNames)}`) .addParam('pool', `Pool name to retrieve configuration, supported: ${Object.values(ConfigNames)}`)
.setAction(async ({all, pool}, localDRE) => { .setAction(async ({ all, pool }, localDRE) => {
await localDRE.run('set-DRE'); await localDRE.run('set-DRE');
const network = localDRE.network.name as eEthereumNetwork; const network = localDRE.network.name as eEthereumNetwork;
const poolConfig = loadPoolConfig(pool); const poolConfig = loadPoolConfig(pool);
const {ReserveAssets, ReservesConfig} = poolConfig as ICommonConfiguration; const {
ReserveAssets,
ReservesConfig,
ProviderRegistry,
MarketId,
} = poolConfig as ICommonConfiguration;
const registryAddress = getParamPerNetwork(ProviderRegistry, network);
const addressesProvider = await getLendingPoolAddressesProvider(); const addressesProvider = await getLendingPoolAddressesProvider();
const addressesProviderRegistry = await getLendingPoolAddressesProviderRegistry(); const addressesProviderRegistry = notFalsyOrZeroAddress(registryAddress)
? await getLendingPoolAddressesProviderRegistry(registryAddress)
: await getLendingPoolAddressesProviderRegistry();
const lendingPoolProxy = await getLendingPool(); const lendingPoolProxy = await getLendingPool();
const lendingPoolConfigurator = await getLendingPoolConfiguratorProxy(); const lendingPoolConfigurator = await getLendingPoolConfiguratorProxy();
const lendingPoolCollateralManager = await getLendingPoolCollateralManager(); const lendingPoolCollateralManager = await getLendingPoolCollateralManager();
@ -45,7 +54,7 @@ task('verify:general', 'Deploy oracles for dev enviroment')
// Address Provider // Address Provider
console.log('\n- Verifying address provider...\n'); console.log('\n- Verifying address provider...\n');
await verifyContract(addressesProvider.address, []); await verifyContract(addressesProvider.address, [MarketId]);
// Address Provider Registry // Address Provider Registry
console.log('\n- Verifying address provider registry...\n'); console.log('\n- Verifying address provider registry...\n');
@ -69,7 +78,7 @@ task('verify:general', 'Deploy oracles for dev enviroment')
// Wallet balance provider // Wallet balance provider
console.log('\n- Verifying Wallet Balance Provider...\n'); console.log('\n- Verifying Wallet Balance Provider...\n');
await verifyContract(walletProvider.address, [addressesProvider.address]); await verifyContract(walletProvider.address, []);
// WETHGateway // WETHGateway
console.log('\n- Verifying WETHGateway...\n'); console.log('\n- Verifying WETHGateway...\n');