mirror of
https://github.com/Instadapp/aave-protocol-v2.git
synced 2024-07-29 21:47:30 +00:00
31 lines
1.5 KiB
TypeScript
31 lines
1.5 KiB
TypeScript
import { formatEther } from 'ethers/lib/utils';
|
|
import { task } from 'hardhat/config';
|
|
import { ConfigNames, loadPoolConfig } from '../../helpers/configuration';
|
|
import { deployLendingPoolAddressesProviderRegistry } from '../../helpers/contracts-deployments';
|
|
import { getFirstSigner } from '../../helpers/contracts-getters';
|
|
import { getParamPerNetwork } from '../../helpers/contracts-helpers';
|
|
import { notFalsyOrZeroAddress } from '../../helpers/misc-utils';
|
|
import { eNetwork } from '../../helpers/types';
|
|
|
|
task('full:deploy-address-provider-registry', 'Deploy address provider registry')
|
|
.addFlag('verify', 'Verify contracts at Etherscan')
|
|
.addParam('pool', `Pool name to retrieve configuration, supported: ${Object.values(ConfigNames)}`)
|
|
.setAction(async ({ verify, pool }, DRE) => {
|
|
await DRE.run('set-DRE');
|
|
const poolConfig = loadPoolConfig(pool);
|
|
const network = <eNetwork>DRE.network.name;
|
|
const signer = await getFirstSigner();
|
|
|
|
const providerRegistryAddress = getParamPerNetwork(poolConfig.ProviderRegistry, network);
|
|
|
|
console.log('Signer', await signer.getAddress());
|
|
console.log('Balance', formatEther(await signer.getBalance()));
|
|
|
|
if (notFalsyOrZeroAddress(providerRegistryAddress)) {
|
|
console.log('Already deployed Provider RRegistry Address at', providerRegistryAddress);
|
|
} else {
|
|
const contract = await deployLendingPoolAddressesProviderRegistry(verify);
|
|
console.log('Deployed Registry Address:', contract.address);
|
|
}
|
|
});
|