mirror of
				https://github.com/Instadapp/aave-protocol-v2.git
				synced 2024-07-29 21:47:30 +00:00 
			
		
		
		
	Added re-using collateral manager functionality
This commit is contained in:
		
							parent
							
								
									5cc18fe6f3
								
							
						
					
					
						commit
						283cf2ce97
					
				| 
						 | 
				
			
			@ -430,6 +430,7 @@ export interface ICommonConfiguration {
 | 
			
		|||
  Mocks: IMocksConfig;
 | 
			
		||||
  ProviderRegistry: iParamsPerNetwork<tEthereumAddress | undefined>;
 | 
			
		||||
  ProviderRegistryOwner: iParamsPerNetwork<tEthereumAddress | undefined>;
 | 
			
		||||
  LendingPoolCollateralManager: iParamsPerNetwork<tEthereumAddress>;
 | 
			
		||||
  LendingRateOracleRatesCommon: iMultiPoolsAssets<IMarketRates>;
 | 
			
		||||
  LendingRateOracle: iParamsPerNetwork<tEthereumAddress>;
 | 
			
		||||
  TokenDistributor: iParamsPerNetwork<tEthereumAddress>;
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -182,6 +182,15 @@ export const CommonsConfig: ICommonConfiguration = {
 | 
			
		|||
    [eEthereumNetwork.ropsten]: '0x05dcca805a6562c1bdd0423768754acb6993241b',
 | 
			
		||||
    [eEthereumNetwork.main]: '0x8A32f49FFbA88aba6EFF96F45D8BD1D4b3f35c7D',
 | 
			
		||||
    [eEthereumNetwork.tenderlyMain]: '0x8A32f49FFbA88aba6EFF96F45D8BD1D4b3f35c7D',
 | 
			
		||||
  },  
 | 
			
		||||
  LendingPoolCollateralManager: {
 | 
			
		||||
    [eEthereumNetwork.coverage]: '',
 | 
			
		||||
    [eEthereumNetwork.hardhat]: '',
 | 
			
		||||
    [eEthereumNetwork.buidlerevm]: '',
 | 
			
		||||
    [eEthereumNetwork.kovan]: '0x9269b6453d0d75370c4c85e5a42977a53efdb72a',
 | 
			
		||||
    [eEthereumNetwork.ropsten]: '',
 | 
			
		||||
    [eEthereumNetwork.main]: '0xbd4765210d4167CE2A5b87280D9E8Ee316D5EC7C',
 | 
			
		||||
    [eEthereumNetwork.tenderlyMain]: '0xbd4765210d4167CE2A5b87280D9E8Ee316D5EC7C',
 | 
			
		||||
  },
 | 
			
		||||
  TokenDistributor: {
 | 
			
		||||
    [eEthereumNetwork.coverage]: '',
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -177,11 +177,20 @@ export const CommonsConfig: ICommonConfiguration = {
 | 
			
		|||
    [eEthereumNetwork.coverage]: '',
 | 
			
		||||
    [eEthereumNetwork.hardhat]: '',
 | 
			
		||||
    [eEthereumNetwork.buidlerevm]: '',
 | 
			
		||||
    [eEthereumNetwork.kovan]: '',//'0xdCde9Bb6a49e37fA433990832AB541AE2d4FEB4a',
 | 
			
		||||
    [eEthereumNetwork.kovan]: '0xdCde9Bb6a49e37fA433990832AB541AE2d4FEB4a',
 | 
			
		||||
    [eEthereumNetwork.ropsten]: '0x05dcca805a6562c1bdd0423768754acb6993241b',
 | 
			
		||||
    [eEthereumNetwork.main]: '', //'0x8A32f49FFbA88aba6EFF96F45D8BD1D4b3f35c7D',
 | 
			
		||||
    [eEthereumNetwork.main]: '0x8A32f49FFbA88aba6EFF96F45D8BD1D4b3f35c7D',
 | 
			
		||||
    [eEthereumNetwork.tenderlyMain]: '0x8A32f49FFbA88aba6EFF96F45D8BD1D4b3f35c7D',
 | 
			
		||||
  },
 | 
			
		||||
  LendingPoolCollateralManager: {
 | 
			
		||||
    [eEthereumNetwork.coverage]: '',
 | 
			
		||||
    [eEthereumNetwork.hardhat]: '',
 | 
			
		||||
    [eEthereumNetwork.buidlerevm]: '',
 | 
			
		||||
    [eEthereumNetwork.kovan]: '0x9269b6453d0d75370c4c85e5a42977a53efdb72a',
 | 
			
		||||
    [eEthereumNetwork.ropsten]: '',
 | 
			
		||||
    [eEthereumNetwork.main]: '0xbd4765210d4167CE2A5b87280D9E8Ee316D5EC7C',
 | 
			
		||||
    [eEthereumNetwork.tenderlyMain]: '0xbd4765210d4167CE2A5b87280D9E8Ee316D5EC7C',
 | 
			
		||||
  },
 | 
			
		||||
  TokenDistributor: {
 | 
			
		||||
    [eEthereumNetwork.coverage]: '',
 | 
			
		||||
    [eEthereumNetwork.buidlerevm]: '',
 | 
			
		||||
| 
						 | 
				
			
			@ -195,9 +204,9 @@ export const CommonsConfig: ICommonConfiguration = {
 | 
			
		|||
    [eEthereumNetwork.coverage]: '',
 | 
			
		||||
    [eEthereumNetwork.hardhat]: '',
 | 
			
		||||
    [eEthereumNetwork.buidlerevm]: '',
 | 
			
		||||
    [EthereumNetwork.kovan]: '',//'0xB8bE51E6563BB312Cbb2aa26e352516c25c26ac1',
 | 
			
		||||
    [EthereumNetwork.kovan]: '',//'0xB8bE51E6563BB312Cbb2aa26e352516c25c26ac1', // Need to re-deploy because of onlyOwner
 | 
			
		||||
    [EthereumNetwork.ropsten]: ZERO_ADDRESS,
 | 
			
		||||
    [EthereumNetwork.main]: '', //'0xA50ba011c48153De246E5192C8f9258A2ba79Ca9',
 | 
			
		||||
    [EthereumNetwork.main]: '0xA50ba011c48153De246E5192C8f9258A2ba79Ca9',
 | 
			
		||||
    [EthereumNetwork.tenderlyMain]: '0xA50ba011c48153De246E5192C8f9258A2ba79Ca9',
 | 
			
		||||
  },
 | 
			
		||||
  FallbackOracle: {
 | 
			
		||||
| 
						 | 
				
			
			@ -218,20 +227,20 @@ export const CommonsConfig: ICommonConfiguration = {
 | 
			
		|||
      LpWBTC: '0xF7904a295A029a3aBDFFB6F12755974a958C7C25',
 | 
			
		||||
      LpUSDC: '0x64EaC61A2DFda2c3Fa04eED49AA33D021AeC8838',
 | 
			
		||||
      LpDAI:'0x22B58f1EbEDfCA50feF632bD73368b2FdA96D541',
 | 
			
		||||
      LpDAIWETH: '0x90B86B501BF4d800a7F76E551952E214Cc58Fba3',   // Mock oracles
 | 
			
		||||
      LpWBTCWETH: '0x90B86B501BF4d800a7F76E551952E214Cc58Fba3',  
 | 
			
		||||
      LpAAVEWETH: '0x90B86B501BF4d800a7F76E551952E214Cc58Fba3',
 | 
			
		||||
      LpBATWETH: '0x90B86B501BF4d800a7F76E551952E214Cc58Fba3',
 | 
			
		||||
      LpUSDCDAI: '0x90B86B501BF4d800a7F76E551952E214Cc58Fba3',
 | 
			
		||||
      LpCRVWETH: '0x90B86B501BF4d800a7F76E551952E214Cc58Fba3',
 | 
			
		||||
      LpLINKWETH: '0x90B86B501BF4d800a7F76E551952E214Cc58Fba3',
 | 
			
		||||
      LpMKRWETH: '0x90B86B501BF4d800a7F76E551952E214Cc58Fba3',
 | 
			
		||||
      LpRENWETH: '0x90B86B501BF4d800a7F76E551952E214Cc58Fba3',
 | 
			
		||||
      LpSNXWETH: '0x90B86B501BF4d800a7F76E551952E214Cc58Fba3',
 | 
			
		||||
      LpUNIWETH: '0x90B86B501BF4d800a7F76E551952E214Cc58Fba3',
 | 
			
		||||
      LpUSDCWETH: '0x90B86B501BF4d800a7F76E551952E214Cc58Fba3',
 | 
			
		||||
      LpWBTCUSDC: '0x90B86B501BF4d800a7F76E551952E214Cc58Fba3',
 | 
			
		||||
      LpYFIWETH: '0x90B86B501BF4d800a7F76E551952E214Cc58Fba3',
 | 
			
		||||
      LpDAIWETH: '0x5699302154A020FB1DE2B1d39f4c73785A235d8F',   // Mock oracles
 | 
			
		||||
      LpWBTCWETH: '0x5699302154A020FB1DE2B1d39f4c73785A235d8F',  
 | 
			
		||||
      LpAAVEWETH: '0x5699302154A020FB1DE2B1d39f4c73785A235d8F',
 | 
			
		||||
      LpBATWETH: '0x5699302154A020FB1DE2B1d39f4c73785A235d8F',
 | 
			
		||||
      LpUSDCDAI: '0x5699302154A020FB1DE2B1d39f4c73785A235d8F',
 | 
			
		||||
      LpCRVWETH: '0x5699302154A020FB1DE2B1d39f4c73785A235d8F',
 | 
			
		||||
      LpLINKWETH: '0x5699302154A020FB1DE2B1d39f4c73785A235d8F',
 | 
			
		||||
      LpMKRWETH: '0x5699302154A020FB1DE2B1d39f4c73785A235d8F',
 | 
			
		||||
      LpRENWETH: '0x5699302154A020FB1DE2B1d39f4c73785A235d8F',
 | 
			
		||||
      LpSNXWETH: '0x5699302154A020FB1DE2B1d39f4c73785A235d8F',
 | 
			
		||||
      LpUNIWETH: '0x5699302154A020FB1DE2B1d39f4c73785A235d8F',
 | 
			
		||||
      LpUSDCWETH: '0x5699302154A020FB1DE2B1d39f4c73785A235d8F',
 | 
			
		||||
      LpWBTCUSDC: '0x5699302154A020FB1DE2B1d39f4c73785A235d8F',
 | 
			
		||||
      LpYFIWETH: '0x5699302154A020FB1DE2B1d39f4c73785A235d8F',
 | 
			
		||||
      USD: '0x9326BFA02ADD2366b30bacB125260Af641031331',
 | 
			
		||||
    },
 | 
			
		||||
    [EthereumNetwork.ropsten]: {
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -3,7 +3,6 @@ import { getParamPerNetwork } from '../../helpers/contracts-helpers';
 | 
			
		|||
import {
 | 
			
		||||
  deployLendingPoolCollateralManager,
 | 
			
		||||
  deployWalletBalancerProvider,
 | 
			
		||||
  deployAaveProtocolDataProvider,
 | 
			
		||||
  deployWETHGateway,
 | 
			
		||||
} from '../../helpers/contracts-deployments';
 | 
			
		||||
import {
 | 
			
		||||
| 
						 | 
				
			
			@ -30,7 +29,7 @@ task('full:initialize-lending-pool', 'Initialize lending pool configuration.')
 | 
			
		|||
      await localBRE.run('set-DRE');
 | 
			
		||||
      const network = <eEthereumNetwork>localBRE.network.name;
 | 
			
		||||
      const poolConfig = loadPoolConfig(pool);
 | 
			
		||||
      const { ReserveAssets, ReservesConfig } = poolConfig as ICommonConfiguration;
 | 
			
		||||
      const { ReserveAssets, ReservesConfig, LendingPoolCollateralManager } = poolConfig as ICommonConfiguration;
 | 
			
		||||
 | 
			
		||||
      const reserveAssets = await getParamPerNetwork(ReserveAssets, network);
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -55,10 +54,17 @@ task('full:initialize-lending-pool', 'Initialize lending pool configuration.')
 | 
			
		|||
      );
 | 
			
		||||
      await configureReservesByHelper(ReservesConfig, reserveAssets, testHelpers, admin);
 | 
			
		||||
 | 
			
		||||
      const collateralManager = await deployLendingPoolCollateralManager(verify);
 | 
			
		||||
      
 | 
			
		||||
      
 | 
			
		||||
      let collateralManagerAddress = await getParamPerNetwork(LendingPoolCollateralManager, network);
 | 
			
		||||
      if (!collateralManagerAddress) {
 | 
			
		||||
        const collateralManager = await deployLendingPoolCollateralManager(verify);
 | 
			
		||||
        collateralManagerAddress = collateralManager.address;
 | 
			
		||||
      }
 | 
			
		||||
      // Seems unnecessary to register the collateral manager in the JSON db
 | 
			
		||||
 | 
			
		||||
      await waitForTx(
 | 
			
		||||
        await addressesProvider.setLendingPoolCollateralManager(collateralManager.address)
 | 
			
		||||
        await addressesProvider.setLendingPoolCollateralManager(collateralManagerAddress)
 | 
			
		||||
      );
 | 
			
		||||
 | 
			
		||||
      await deployWalletBalancerProvider(verify);
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue
	
	Block a user