fix: finalized aave pro deployment scripts and configuration

This commit is contained in:
The3D 2021-05-17 21:12:54 +02:00
parent f9a0c172dd
commit e735d31a34
5 changed files with 49 additions and 15 deletions

View File

@ -51,6 +51,7 @@ import {
FlashLiquidationAdapterFactory, FlashLiquidationAdapterFactory,
PermissionedVariableDebtTokenFactory, PermissionedVariableDebtTokenFactory,
PermissionedStableDebtTokenFactory, PermissionedStableDebtTokenFactory,
PermissionedLendingPoolFactory
} from '../types'; } from '../types';
import { import {
withSaveAndVerify, withSaveAndVerify,
@ -189,11 +190,21 @@ export const deployAaveLibraries = async (
}; };
}; };
export const deployLendingPool = async (verify?: boolean) => { export const deployLendingPool = async (verify?: boolean, lendingPoolImpl?: eContractid) => {
const libraries = await deployAaveLibraries(verify); const libraries = await deployAaveLibraries(verify);
const lendingPoolImpl = await new LendingPoolFactory(libraries, await getFirstSigner()).deploy();
await insertContractAddressInDb(eContractid.LendingPoolImpl, lendingPoolImpl.address); let instance;
return withSaveAndVerify(lendingPoolImpl, eContractid.LendingPool, [], verify); switch(lendingPoolImpl) {
case eContractid.PermissionedLendingPool:
instance = await new PermissionedLendingPoolFactory(libraries, await getFirstSigner()).deploy();
break;
case eContractid.LendingPool:
default:
instance = await new LendingPoolFactory(libraries, await getFirstSigner()).deploy();
}
await insertContractAddressInDb(eContractid.LendingPoolImpl, instance.address);
return withSaveAndVerify(instance, eContractid.LendingPool, [], verify);
}; };
export const deployPriceOracle = async (verify?: boolean) => export const deployPriceOracle = async (verify?: boolean) =>

View File

@ -90,6 +90,7 @@ export enum eContractid {
PermissionManager = 'PermissionManager', PermissionManager = 'PermissionManager',
PermissionedStableDebtToken = 'PermissionedStableDebtToken', PermissionedStableDebtToken = 'PermissionedStableDebtToken',
PermissionedVariableDebtToken = 'PermissionedVariableDebtToken', PermissionedVariableDebtToken = 'PermissionedVariableDebtToken',
PermissionedLendingPool = 'PermissionedLendingPool'
} }
/* /*
@ -474,6 +475,7 @@ export interface ILendingRate {
export interface ICommonConfiguration { export interface ICommonConfiguration {
MarketId: string; MarketId: string;
LendingPoolImpl?: eContractid;
ATokenNamePrefix: string; ATokenNamePrefix: string;
StableDebtTokenNamePrefix: string; StableDebtTokenNamePrefix: string;
VariableDebtTokenNamePrefix: string; VariableDebtTokenNamePrefix: string;

View File

@ -8,11 +8,11 @@ import { ICommonConfiguration, eEthereumNetwork } from '../../helpers/types';
export const CommonsConfig: ICommonConfiguration = { export const CommonsConfig: ICommonConfiguration = {
MarketId: 'Commons', MarketId: 'Commons',
ATokenNamePrefix: 'Aave interest bearing', ATokenNamePrefix: 'Aave Pro market',
StableDebtTokenNamePrefix: 'Aave stable debt bearing', StableDebtTokenNamePrefix: 'Aave Pro stable debt ',
VariableDebtTokenNamePrefix: 'Aave variable debt bearing', VariableDebtTokenNamePrefix: 'Aave Pro variable debt ',
SymbolPrefix: '', SymbolPrefix: '',
ProviderId: 0, // Overriden in index.ts ProviderId: 0, // Overridden in index.ts
ProtocolGlobalParams: { ProtocolGlobalParams: {
TokenDistributorPercentageBase: '10000', TokenDistributorPercentageBase: '10000',
MockUsdPriceInWei: '5848466240000000', MockUsdPriceInWei: '5848466240000000',
@ -295,4 +295,22 @@ export const CommonsConfig: ICommonConfiguration = {
[eEthereumNetwork.main]: '0x464c71f6c2f760dda6093dcb91c24c39e5d6e18c', [eEthereumNetwork.main]: '0x464c71f6c2f760dda6093dcb91c24c39e5d6e18c',
[eEthereumNetwork.tenderlyMain]: '0x464c71f6c2f760dda6093dcb91c24c39e5d6e18c', [eEthereumNetwork.tenderlyMain]: '0x464c71f6c2f760dda6093dcb91c24c39e5d6e18c',
}, },
WrappedNativeToken: {
[eEthereumNetwork.coverage]: '', // deployed in local evm
[eEthereumNetwork.hardhat]: '', // deployed in local evm
[eEthereumNetwork.buidlerevm]: '', // deployed in local evm
[eEthereumNetwork.kovan]: '0xd0a1e359811322d97991e03f863a0c30c2cf029c',
[eEthereumNetwork.ropsten]: '0xc778417e063141139fce010982780140aa0cd5ab',
[eEthereumNetwork.main]: '0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2',
[eEthereumNetwork.tenderlyMain]: '0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2',
},
IncentivesController: {
[eEthereumNetwork.coverage]: ZERO_ADDRESS,
[eEthereumNetwork.hardhat]: ZERO_ADDRESS,
[eEthereumNetwork.buidlerevm]: ZERO_ADDRESS,
[eEthereumNetwork.kovan]: ZERO_ADDRESS,
[eEthereumNetwork.ropsten]: ZERO_ADDRESS,
[eEthereumNetwork.main]: ZERO_ADDRESS,
[eEthereumNetwork.tenderlyMain]: ZERO_ADDRESS,
},
}; };

View File

@ -1,4 +1,5 @@
import { IAaveProConfiguration, eEthereumNetwork } from '../../helpers/types'; import { ZERO_ADDRESS } from '../../helpers/constants';
import { IAaveProConfiguration, eEthereumNetwork, eContractid } from '../../helpers/types';
import { CommonsConfig } from './commons'; import { CommonsConfig } from './commons';
import { import {
@ -16,6 +17,7 @@ export const AaveConfig: IAaveProConfiguration = {
...CommonsConfig, ...CommonsConfig,
MarketId: 'Aave Pro market', MarketId: 'Aave Pro market',
ProviderId: 1, ProviderId: 1,
LendingPoolImpl: eContractid.PermissionedLendingPool,
ReservesConfig: { ReservesConfig: {
USDC: strategyUSDC, USDC: strategyUSDC,
USDT: strategyUSDT, USDT: strategyUSDT,
@ -28,29 +30,29 @@ export const AaveConfig: IAaveProConfiguration = {
[eEthereumNetwork.coverage]: {}, [eEthereumNetwork.coverage]: {},
[eEthereumNetwork.kovan]: { [eEthereumNetwork.kovan]: {
USDC: '0xe22da380ee6B445bb8273C81944ADEB6E8450422', USDC: '0xe22da380ee6B445bb8273C81944ADEB6E8450422',
USDT: '0x13512979ADE267AB5100878E2e0f485B568328a4',
WBTC: '0xD1B98B6607330172f1D991521145A22BCe793277', WBTC: '0xD1B98B6607330172f1D991521145A22BCe793277',
WETH: '0xd0a1e359811322d97991e03f863a0c30c2cf029c', WETH: '0xd0a1e359811322d97991e03f863a0c30c2cf029c',
AAVE: '0xB597cd8D3217ea6477232F9217fa70837ff667Af',
}, },
[eEthereumNetwork.ropsten]: { [eEthereumNetwork.ropsten]: {
USDC: '0x851dEf71f0e6A903375C1e536Bd9ff1684BAD802', USDC: '0x851dEf71f0e6A903375C1e536Bd9ff1684BAD802',
USDT: '0xB404c51BBC10dcBE948077F18a4B8E553D160084',
WBTC: '0xa0E54Ab6AA5f0bf1D62EC3526436F3c05b3348A0', WBTC: '0xa0E54Ab6AA5f0bf1D62EC3526436F3c05b3348A0',
WETH: '0xc778417e063141139fce010982780140aa0cd5ab', WETH: '0xc778417e063141139fce010982780140aa0cd5ab',
AAVE: 'ZERO_ADDRESS',
}, },
[eEthereumNetwork.main]: { [eEthereumNetwork.main]: {
USDC: '0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48', USDC: '0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48',
USDT: '0xdAC17F958D2ee523a2206206994597C13D831ec7',
WBTC: '0x2260FAC5E5542a773Aa44fBCfeDf7C193bc2C599', WBTC: '0x2260FAC5E5542a773Aa44fBCfeDf7C193bc2C599',
WETH: '0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2', WETH: '0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2',
AAVE: '0x7Fc66500c84A76Ad7e9c93437bFc5Ac33E2DDaE9',
}, },
[eEthereumNetwork.tenderlyMain]: { [eEthereumNetwork.tenderlyMain]: {
USDC: '0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48', USDC: '0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48',
USDT: '0xdAC17F958D2ee523a2206206994597C13D831ec7',
WBTC: '0x2260FAC5E5542a773Aa44fBCfeDf7C193bc2C599', WBTC: '0x2260FAC5E5542a773Aa44fBCfeDf7C193bc2C599',
WETH: '0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2', WETH: '0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2',
AAVE: '0x7Fc66500c84A76Ad7e9c93437bFc5Ac33E2DDaE9',
}, },
}, }
}; };
export default AaveConfig; export default AaveConfig;

View File

@ -19,6 +19,7 @@ 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');
@ -32,7 +33,7 @@ task('full:deploy-lending-pool', 'Deploy lending pool for dev enviroment')
let lendingPoolImplAddress = getParamPerNetwork(LendingPool, network); let lendingPoolImplAddress = getParamPerNetwork(LendingPool, network);
if (!notFalsyOrZeroAddress(lendingPoolImplAddress)) { if (!notFalsyOrZeroAddress(lendingPoolImplAddress)) {
console.log('\tDeploying new lending pool implementation & libraries...'); console.log('\tDeploying new lending pool implementation & libraries...');
const lendingPoolImpl = await deployLendingPool(verify); const lendingPoolImpl = await deployLendingPool(verify, poolConfig.LendingPoolImpl);
lendingPoolImplAddress = lendingPoolImpl.address; lendingPoolImplAddress = lendingPoolImpl.address;
await lendingPoolImpl.initialize(addressesProvider.address); await lendingPoolImpl.initialize(addressesProvider.address);
} }