mirror of
https://github.com/Instadapp/aave-protocol-v2.git
synced 2024-07-29 21:47:30 +00:00
feat: added the permission manager deployment script
This commit is contained in:
parent
e735d31a34
commit
026d16f44e
45
tasks/deployments/deploy-permission-manager.ts
Normal file
45
tasks/deployments/deploy-permission-manager.ts
Normal file
|
@ -0,0 +1,45 @@
|
||||||
|
import { task } from 'hardhat/config';
|
||||||
|
|
||||||
|
import { PermissionManagerFactory } from '../../types';
|
||||||
|
import { verifyContract } from '../../helpers/contracts-helpers';
|
||||||
|
import { eContractid } from '../../helpers/types';
|
||||||
|
import { insertContractAddressInDb } from '../../helpers/contracts-helpers';
|
||||||
|
import { getLendingPoolAddressesProvider } from '../../helpers/contracts-getters';
|
||||||
|
import { waitForTx } from '../../helpers/misc-utils';
|
||||||
|
import { ethers } from 'ethers';
|
||||||
|
|
||||||
|
task(`deploy-permission-manager`, `Deploys the PermissionManager contract`)
|
||||||
|
.addFlag('verify', 'Verify PermissionManager contract via Etherscan API.')
|
||||||
|
.setAction(async ({ verify }, localBRE) => {
|
||||||
|
await localBRE.run('set-DRE');
|
||||||
|
|
||||||
|
if (!localBRE.network.config.chainId) {
|
||||||
|
throw new Error('INVALID_CHAIN_ID');
|
||||||
|
}
|
||||||
|
|
||||||
|
console.log(`\n- PermissionManager deployment`);
|
||||||
|
|
||||||
|
console.log(`\tDeploying PermissionManager implementation ...`);
|
||||||
|
const permissionManagerInstance = await new PermissionManagerFactory(
|
||||||
|
await localBRE.ethers.provider.getSigner()
|
||||||
|
).deploy();
|
||||||
|
|
||||||
|
await permissionManagerInstance.deployTransaction.wait();
|
||||||
|
|
||||||
|
console.log('Permission manager address', permissionManagerInstance.address);
|
||||||
|
await verifyContract(eContractid.PermissionManager, permissionManagerInstance, []);
|
||||||
|
|
||||||
|
// register the permission manager in the addresses provider
|
||||||
|
const addressesProvider = await getLendingPoolAddressesProvider();
|
||||||
|
const permissionManagerHash = ethers.utils.keccak256(ethers.utils.toUtf8Bytes("PERMISSION_MANAGER"));
|
||||||
|
|
||||||
|
await waitForTx(await addressesProvider.setAddress(permissionManagerHash, permissionManagerInstance.address));
|
||||||
|
|
||||||
|
// store the permission manager contract in the DB
|
||||||
|
await insertContractAddressInDb(
|
||||||
|
eContractid.PermissionManager,
|
||||||
|
permissionManagerInstance.address
|
||||||
|
);
|
||||||
|
|
||||||
|
console.log(`\tFinished PermissionManager implementation deployment`);
|
||||||
|
});
|
|
@ -19,7 +19,6 @@ import { loadPoolConfig, ConfigNames } from '../../helpers/configuration';
|
||||||
task('full:deploy-lending-pool', 'Deploy lending pool for dev enviroment')
|
task('full:deploy-lending-pool', 'Deploy lending pool for dev enviroment')
|
||||||
.addFlag('verify', 'Verify contracts at Etherscan')
|
.addFlag('verify', 'Verify 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)}`)
|
||||||
.addParam('lendingPoolImpl')
|
|
||||||
.setAction(async ({ verify, pool }, DRE: HardhatRuntimeEnvironment) => {
|
.setAction(async ({ verify, pool }, DRE: HardhatRuntimeEnvironment) => {
|
||||||
try {
|
try {
|
||||||
await DRE.run('set-DRE');
|
await DRE.run('set-DRE');
|
||||||
|
|
Loading…
Reference in New Issue
Block a user