mirror of
https://github.com/Instadapp/aave-protocol-v2.git
synced 2024-07-29 21:47:30 +00:00
61 lines
2.2 KiB
TypeScript
61 lines
2.2 KiB
TypeScript
import {task} from 'hardhat/config';
|
|
import {
|
|
deployATokensAndRatesHelper,
|
|
deployLendingPool,
|
|
deployLendingPoolConfigurator,
|
|
deployStableAndVariableTokensHelper,
|
|
} from '../../helpers/contracts-deployments';
|
|
import {eContractid} from '../../helpers/types';
|
|
import {waitForTx} from '../../helpers/misc-utils';
|
|
import {
|
|
getLendingPoolAddressesProvider,
|
|
getLendingPool,
|
|
getLendingPoolConfiguratorProxy,
|
|
} from '../../helpers/contracts-getters';
|
|
import {insertContractAddressInDb} from '../../helpers/contracts-helpers';
|
|
|
|
task('dev:deploy-lending-pool', 'Deploy lending pool for dev enviroment')
|
|
.addFlag('verify', 'Verify contracts at Etherscan')
|
|
.setAction(async ({verify}, localBRE) => {
|
|
await localBRE.run('set-DRE');
|
|
// TEST--- CURRENTLY FAILS BECAUSE ALREADY HAS AN IMPLEMENTATION, SHOULD BE DONE BEFORE UNI MARKET TASK
|
|
const addressesProvider = await getLendingPoolAddressesProvider();
|
|
|
|
const lendingPoolImpl = await deployLendingPool(verify);
|
|
|
|
// Set lending pool impl to Address Provider
|
|
await waitForTx(await addressesProvider.setLendingPoolImpl(lendingPoolImpl.address));
|
|
|
|
const address = await addressesProvider.getLendingPool();
|
|
console.log("AAVE MARKET LENDING POOL:", address);
|
|
|
|
const lendingPoolProxy = await getLendingPool(address);
|
|
|
|
await insertContractAddressInDb(eContractid.LendingPool, lendingPoolProxy.address);
|
|
|
|
const lendingPoolConfiguratorImpl = await deployLendingPoolConfigurator(verify);
|
|
|
|
// Set lending pool conf impl to Address Provider
|
|
await waitForTx(
|
|
await addressesProvider.setLendingPoolConfiguratorImpl(lendingPoolConfiguratorImpl.address)
|
|
);
|
|
|
|
const lendingPoolConfiguratorProxy = await getLendingPoolConfiguratorProxy(
|
|
await addressesProvider.getLendingPoolConfigurator()
|
|
);
|
|
await insertContractAddressInDb(
|
|
eContractid.LendingPoolConfigurator,
|
|
lendingPoolConfiguratorProxy.address
|
|
);
|
|
|
|
// Deploy deployment helpers
|
|
await deployStableAndVariableTokensHelper(
|
|
[lendingPoolProxy.address, addressesProvider.address],
|
|
verify
|
|
);
|
|
await deployATokensAndRatesHelper(
|
|
[lendingPoolProxy.address, addressesProvider.address, lendingPoolConfiguratorProxy.address],
|
|
verify
|
|
);
|
|
});
|