mirror of
				https://github.com/Instadapp/aave-protocol-v2.git
				synced 2024-07-29 21:47:30 +00:00 
			
		
		
		
	Added buidler mainnent fork
This commit is contained in:
		
							parent
							
								
									84053c7b1d
								
							
						
					
					
						commit
						d0ea8d2e32
					
				| 
						 | 
				
			
			@ -1,5 +1,6 @@
 | 
			
		|||
import path from 'path';
 | 
			
		||||
import fs from 'fs';
 | 
			
		||||
import {HardhatUserConfig} from 'hardhat/types';
 | 
			
		||||
// @ts-ignore
 | 
			
		||||
import {accounts} from './test-wallets.js';
 | 
			
		||||
import {eEthereumNetwork} from './helpers/types';
 | 
			
		||||
| 
						 | 
				
			
			@ -22,6 +23,7 @@ const ALCHEMY_KEY = process.env.ALCHEMY_KEY || '';
 | 
			
		|||
const ETHERSCAN_KEY = process.env.ETHERSCAN_KEY || '';
 | 
			
		||||
const MNEMONIC_PATH = "m/44'/60'/0'/0";
 | 
			
		||||
const MNEMONIC = process.env.MNEMONIC || '';
 | 
			
		||||
const MAINNET_FORK = process.env.MAINNET_FORK === 'true';
 | 
			
		||||
 | 
			
		||||
// Prevent to load scripts before compilation and typechain
 | 
			
		||||
if (!SKIP_LOAD) {
 | 
			
		||||
| 
						 | 
				
			
			@ -40,7 +42,9 @@ require(`${path.join(__dirname, 'tasks/misc')}/set-bre.ts`);
 | 
			
		|||
const getCommonNetworkConfig = (networkName: eEthereumNetwork, networkId: number) => {
 | 
			
		||||
  return {
 | 
			
		||||
    url: ALCHEMY_KEY
 | 
			
		||||
      ? `https://eth-${networkName}.alchemyapi.io/v2/${ALCHEMY_KEY}`
 | 
			
		||||
      ? `https://eth-${
 | 
			
		||||
          networkName === 'main' ? 'mainnet' : networkName
 | 
			
		||||
        }.alchemyapi.io/v2/${ALCHEMY_KEY}`
 | 
			
		||||
      : `https://${networkName}.infura.io/v3/${INFURA_KEY}`,
 | 
			
		||||
    hardfork: HARDFORK,
 | 
			
		||||
    blockGasLimit: DEFAULT_BLOCK_GAS_LIMIT,
 | 
			
		||||
| 
						 | 
				
			
			@ -56,7 +60,16 @@ const getCommonNetworkConfig = (networkName: eEthereumNetwork, networkId: number
 | 
			
		|||
  };
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
const buidlerConfig = {
 | 
			
		||||
const mainnetFork = MAINNET_FORK
 | 
			
		||||
  ? {
 | 
			
		||||
      blockNumber: 11268220,
 | 
			
		||||
      url: ALCHEMY_KEY
 | 
			
		||||
        ? `https://eth-mainnet.alchemyapi.io/v2/${ALCHEMY_KEY}`
 | 
			
		||||
        : `https://main.infura.io/v3/${INFURA_KEY}`,
 | 
			
		||||
    }
 | 
			
		||||
  : undefined;
 | 
			
		||||
 | 
			
		||||
const buidlerConfig: HardhatUserConfig = {
 | 
			
		||||
  solidity: {
 | 
			
		||||
    version: '0.6.8',
 | 
			
		||||
    settings: {
 | 
			
		||||
| 
						 | 
				
			
			@ -75,8 +88,8 @@ const buidlerConfig = {
 | 
			
		|||
    timeout: 0,
 | 
			
		||||
  },
 | 
			
		||||
  tenderly: {
 | 
			
		||||
    project: process.env.TENDERLY_PROJECT,
 | 
			
		||||
    username: process.env.TENDERLY_USERNAME,
 | 
			
		||||
    project: process.env.TENDERLY_PROJECT || '',
 | 
			
		||||
    username: process.env.TENDERLY_USERNAME || '',
 | 
			
		||||
    forkNetwork: '1', //Network id of the network we want to fork
 | 
			
		||||
  },
 | 
			
		||||
  networks: {
 | 
			
		||||
| 
						 | 
				
			
			@ -100,6 +113,7 @@ const buidlerConfig = {
 | 
			
		|||
        privateKey: secretKey,
 | 
			
		||||
        balance,
 | 
			
		||||
      })),
 | 
			
		||||
      forking: mainnetFork,
 | 
			
		||||
    },
 | 
			
		||||
    buidlerevm_docker: {
 | 
			
		||||
      hardfork: 'istanbul',
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -22,7 +22,8 @@
 | 
			
		|||
    "aave:kovan:full:initialize": "npm run hardhat:kovan -- full:initialize-lending-pool --verify --pool Aave",
 | 
			
		||||
    "aave:ropsten:dev:migration": "npm run hardhat:ropsten -- aave:dev --verify",
 | 
			
		||||
    "aave:ropsten:full:migration": "npm run hardhat:ropsten -- aave:full --verify",
 | 
			
		||||
    "aave:fork:main:migration": "npm run hardhat:tenderly-main -- aave:full:fork",
 | 
			
		||||
    "aave:fork:main:tendery": "npm run hardhat:tenderly-main -- aave:full:fork",
 | 
			
		||||
    "aave:fork:main": "MAINNET_FORK=true npm run aave:full:fork",
 | 
			
		||||
    "aave:main:dev:migration": "npm run hardhat:main -- aave:dev --verify",
 | 
			
		||||
    "aave:main:full:migration": "npm run hardhat:main -- aave:full --verify",
 | 
			
		||||
    "uniswap:evm:dev:migration": "hardhat uniswap:dev",
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -10,9 +10,6 @@ task('aave:full:fork', 'Deploy development enviroment')
 | 
			
		|||
  .setAction(async ({verify}, DRE) => {
 | 
			
		||||
    const POOL_NAME = ConfigNames.Aave;
 | 
			
		||||
    const network = <EthereumNetworkNames>DRE.network.name;
 | 
			
		||||
    if (!network.includes('tenderly')) {
 | 
			
		||||
      throw 'This task only supports tenderly networks: tenderlyMain, tenderlyKovan';
 | 
			
		||||
    }
 | 
			
		||||
    await DRE.run('set-DRE');
 | 
			
		||||
 | 
			
		||||
    // Prevent loss of gas verifying all the needed ENVs for Etherscan verification
 | 
			
		||||
| 
						 | 
				
			
			@ -21,10 +18,12 @@ task('aave:full:fork', 'Deploy development enviroment')
 | 
			
		|||
    }
 | 
			
		||||
 | 
			
		||||
    // Set the ethers provider to the one we initialized so it targets the correct backend
 | 
			
		||||
    console.log('- Setting up Tenderly provider');
 | 
			
		||||
    await DRE.tenderlyRPC.initializeFork();
 | 
			
		||||
    const provider = new DRE.ethers.providers.Web3Provider(DRE.tenderlyRPC as any);
 | 
			
		||||
    DRE.ethers.provider = provider;
 | 
			
		||||
    if (network.includes('tenderly')) {
 | 
			
		||||
      console.log('- Setting up Tenderly provider');
 | 
			
		||||
      await DRE.tenderlyRPC.initializeFork();
 | 
			
		||||
      const provider = new DRE.ethers.providers.Web3Provider(DRE.tenderlyRPC as any);
 | 
			
		||||
      DRE.ethers.provider = provider;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    console.log('Migration started\n');
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue
	
	Block a user