mirror of
https://github.com/Instadapp/aave-protocol-v2.git
synced 2024-07-29 21:47:30 +00:00
feat: updated deployment scripts for the permissioned market
This commit is contained in:
parent
0150023517
commit
b47fd4f7b9
|
@ -33,7 +33,7 @@ const MNEMONIC = process.env.MNEMONIC || '';
|
||||||
|
|
||||||
// Prevent to load scripts before compilation and typechain
|
// Prevent to load scripts before compilation and typechain
|
||||||
if (!SKIP_LOAD) {
|
if (!SKIP_LOAD) {
|
||||||
['misc', 'migrations', 'dev', 'full', 'verifications', 'deployments', 'helpers'].forEach(
|
['misc', 'migrations', 'dev', 'full', 'verifications', 'deployments', 'permissioned', 'helpers'].forEach(
|
||||||
(folder) => {
|
(folder) => {
|
||||||
const tasksPath = path.join(__dirname, 'tasks', folder);
|
const tasksPath = path.join(__dirname, 'tasks', folder);
|
||||||
fs.readdirSync(tasksPath)
|
fs.readdirSync(tasksPath)
|
||||||
|
|
|
@ -51,7 +51,8 @@ import {
|
||||||
FlashLiquidationAdapterFactory,
|
FlashLiquidationAdapterFactory,
|
||||||
PermissionedVariableDebtTokenFactory,
|
PermissionedVariableDebtTokenFactory,
|
||||||
PermissionedStableDebtTokenFactory,
|
PermissionedStableDebtTokenFactory,
|
||||||
PermissionedLendingPoolFactory
|
PermissionedLendingPoolFactory,
|
||||||
|
PermissionedWETHGatewayFactory
|
||||||
} from '../types';
|
} from '../types';
|
||||||
import {
|
import {
|
||||||
withSaveAndVerify,
|
withSaveAndVerify,
|
||||||
|
@ -584,6 +585,15 @@ export const deployWETHGateway = async (args: [tEthereumAddress], verify?: boole
|
||||||
verify
|
verify
|
||||||
);
|
);
|
||||||
|
|
||||||
|
export const deployPermissionedWETHGateway = async (args: [tEthereumAddress], verify?: boolean) =>
|
||||||
|
withSaveAndVerify(
|
||||||
|
await new PermissionedWETHGatewayFactory(await getFirstSigner()).deploy(...args),
|
||||||
|
eContractid.PermissionedWETHGateway,
|
||||||
|
args,
|
||||||
|
verify
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
export const authorizeWETHGateway = async (
|
export const authorizeWETHGateway = async (
|
||||||
wethGateWay: tEthereumAddress,
|
wethGateWay: tEthereumAddress,
|
||||||
lendingPool: tEthereumAddress
|
lendingPool: tEthereumAddress
|
||||||
|
|
|
@ -30,6 +30,7 @@ import {
|
||||||
WETH9MockedFactory,
|
WETH9MockedFactory,
|
||||||
WETHGatewayFactory,
|
WETHGatewayFactory,
|
||||||
FlashLiquidationAdapterFactory,
|
FlashLiquidationAdapterFactory,
|
||||||
|
PermissionManagerFactory,
|
||||||
} from '../types';
|
} from '../types';
|
||||||
import { IERC20DetailedFactory } from '../types/IERC20DetailedFactory';
|
import { IERC20DetailedFactory } from '../types/IERC20DetailedFactory';
|
||||||
import { getEthersSigners, MockTokenMap } from './contracts-helpers';
|
import { getEthersSigners, MockTokenMap } from './contracts-helpers';
|
||||||
|
@ -364,3 +365,11 @@ export const getFlashLiquidationAdapter = async (address?: tEthereumAddress) =>
|
||||||
.address,
|
.address,
|
||||||
await getFirstSigner()
|
await getFirstSigner()
|
||||||
);
|
);
|
||||||
|
|
||||||
|
export const getPermissionManager = async (address?: tEthereumAddress) =>
|
||||||
|
await PermissionManagerFactory.connect(
|
||||||
|
address ||
|
||||||
|
(await getDb().get(`${eContractid.PermissionManager}.${DRE.network.name}`).value()).address,
|
||||||
|
await getFirstSigner()
|
||||||
|
);
|
||||||
|
|
||||||
|
|
|
@ -90,7 +90,8 @@ export enum eContractid {
|
||||||
PermissionManager = 'PermissionManager',
|
PermissionManager = 'PermissionManager',
|
||||||
PermissionedStableDebtToken = 'PermissionedStableDebtToken',
|
PermissionedStableDebtToken = 'PermissionedStableDebtToken',
|
||||||
PermissionedVariableDebtToken = 'PermissionedVariableDebtToken',
|
PermissionedVariableDebtToken = 'PermissionedVariableDebtToken',
|
||||||
PermissionedLendingPool = 'PermissionedLendingPool'
|
PermissionedLendingPool = 'PermissionedLendingPool',
|
||||||
|
PermissionedWETHGateway = 'PermissionedWETHGateway'
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
|
@ -33,8 +33,8 @@ task('pro:mainnet', 'Deploy development enviroment')
|
||||||
console.log('5. Deploy Data Provider');
|
console.log('5. Deploy Data Provider');
|
||||||
await DRE.run('full:data-provider', { pool: POOL_NAME });
|
await DRE.run('full:data-provider', { pool: POOL_NAME });
|
||||||
|
|
||||||
console.log('6. Deploy WETH Gateway');
|
console.log('6. Deploy Permissioned WETH Gateway');
|
||||||
await DRE.run('full-deploy-weth-gateway', { pool: POOL_NAME });
|
await DRE.run('full-deploy-permissioned-weth-gateway', { pool: POOL_NAME });
|
||||||
|
|
||||||
console.log('7. Initialize lending pool');
|
console.log('7. Initialize lending pool');
|
||||||
await DRE.run('full:initialize-lending-pool', { pool: POOL_NAME });
|
await DRE.run('full:initialize-lending-pool', { pool: POOL_NAME });
|
||||||
|
|
41
tasks/permissioned/deploy-permissioned-wethGateWay.ts
Normal file
41
tasks/permissioned/deploy-permissioned-wethGateWay.ts
Normal file
|
@ -0,0 +1,41 @@
|
||||||
|
import { task } from 'hardhat/config';
|
||||||
|
import {
|
||||||
|
loadPoolConfig,
|
||||||
|
ConfigNames,
|
||||||
|
getWrappedNativeTokenAddress,
|
||||||
|
} from '../../helpers/configuration';
|
||||||
|
import { deployPermissionedWETHGateway, deployWETHGateway } from '../../helpers/contracts-deployments';
|
||||||
|
import { getFirstSigner, getPermissionManager } from '../../helpers/contracts-getters';
|
||||||
|
import { waitForTx } from '../../helpers/misc-utils';
|
||||||
|
|
||||||
|
const CONTRACT_NAME = 'WETHGateway';
|
||||||
|
|
||||||
|
task(`full-deploy-permissioned-weth-gateway`, `Deploys the ${CONTRACT_NAME} contract`)
|
||||||
|
.addParam('pool', `Pool name to retrieve configuration, supported: ${Object.values(ConfigNames)}`)
|
||||||
|
.addFlag('verify', `Verify ${CONTRACT_NAME} contract via Etherscan API.`)
|
||||||
|
.setAction(async ({ verify, pool }, localBRE) => {
|
||||||
|
await localBRE.run('set-DRE');
|
||||||
|
const poolConfig = loadPoolConfig(pool);
|
||||||
|
const Weth = await getWrappedNativeTokenAddress(poolConfig);
|
||||||
|
|
||||||
|
if (!localBRE.network.config.chainId) {
|
||||||
|
throw new Error('INVALID_CHAIN_ID');
|
||||||
|
}
|
||||||
|
const wethGateWay = await deployPermissionedWETHGateway([Weth], verify);
|
||||||
|
|
||||||
|
const deployer = await getFirstSigner();
|
||||||
|
const deployerAddress = await deployer.getAddress();
|
||||||
|
|
||||||
|
//adding permissions to the permission manager for the weth gateway
|
||||||
|
const permissionManager = await getPermissionManager();
|
||||||
|
|
||||||
|
|
||||||
|
await waitForTx(await permissionManager.addPermissionAdmins([deployerAddress]));
|
||||||
|
|
||||||
|
await waitForTx(await permissionManager.connect(deployer).addPermissions([0, 1],[deployerAddress, deployerAddress] ));
|
||||||
|
|
||||||
|
await waitForTx(await permissionManager.removePermissionAdmins([deployerAddress]));
|
||||||
|
|
||||||
|
console.log(`${CONTRACT_NAME}.address`, wethGateWay.address);
|
||||||
|
console.log(`\tFinished ${CONTRACT_NAME} deployment`);
|
||||||
|
});
|
Loading…
Reference in New Issue
Block a user