mirror of
				https://github.com/Instadapp/aave-protocol-v2.git
				synced 2024-07-29 21:47:30 +00:00 
			
		
		
		
	Changed "Lp"/"lp" prefix to "Amm"/"amm"
This commit is contained in:
		
							parent
							
								
									e9451c85eb
								
							
						
					
					
						commit
						c1142d4810
					
				| 
						 | 
				
			
			@ -8,7 +8,7 @@ import {
 | 
			
		|||
} from './types';
 | 
			
		||||
import { getParamPerPool } from './contracts-helpers';
 | 
			
		||||
import AaveConfig from '../markets/aave';
 | 
			
		||||
import LpConfig from '../markets/lp';
 | 
			
		||||
import AmmConfig from '../markets/amm';
 | 
			
		||||
import { CommonsConfig } from '../markets/aave/commons';
 | 
			
		||||
import { DRE, filterMapBy } from './misc-utils';
 | 
			
		||||
import { tEthereumAddress } from './types';
 | 
			
		||||
| 
						 | 
				
			
			@ -18,15 +18,15 @@ import { deployWETHMocked } from './contracts-deployments';
 | 
			
		|||
export enum ConfigNames {
 | 
			
		||||
  Commons = 'Commons',
 | 
			
		||||
  Aave = 'Aave',
 | 
			
		||||
  Lp = 'Lp',
 | 
			
		||||
  Amm = 'Amm',
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
export const loadPoolConfig = (configName: ConfigNames): PoolConfiguration => {
 | 
			
		||||
  switch (configName) {
 | 
			
		||||
    case ConfigNames.Aave:
 | 
			
		||||
      return AaveConfig;
 | 
			
		||||
    case ConfigNames.Lp:
 | 
			
		||||
        return LpConfig;
 | 
			
		||||
    case ConfigNames.Amm:
 | 
			
		||||
        return AmmConfig;
 | 
			
		||||
    case ConfigNames.Commons:
 | 
			
		||||
      return CommonsConfig;
 | 
			
		||||
    default:
 | 
			
		||||
| 
						 | 
				
			
			@ -44,8 +44,8 @@ export const getReservesConfigByPool = (pool: AavePools): iMultiPoolsAssets<IRes
 | 
			
		|||
      [AavePools.proto]: {
 | 
			
		||||
        ...AaveConfig.ReservesConfig,
 | 
			
		||||
      },
 | 
			
		||||
      [AavePools.lp]: {
 | 
			
		||||
        ...LpConfig.ReservesConfig,
 | 
			
		||||
      [AavePools.amm]: {
 | 
			
		||||
        ...AmmConfig.ReservesConfig,
 | 
			
		||||
      },
 | 
			
		||||
    },
 | 
			
		||||
    pool
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -172,7 +172,7 @@ export const getPairsTokenAggregator = (
 | 
			
		|||
  },
 | 
			
		||||
  aggregatorsAddresses: { [tokenSymbol: string]: tEthereumAddress }
 | 
			
		||||
): [string[], string[]] => {
 | 
			
		||||
  const { ETH, USD, WETH, LpWETH, ...assetsAddressesWithoutEth } = allAssetsAddresses;
 | 
			
		||||
  const { ETH, USD, WETH, ...assetsAddressesWithoutEth } = allAssetsAddresses;
 | 
			
		||||
 | 
			
		||||
  const pairs = Object.entries(assetsAddressesWithoutEth).map(([tokenSymbol, tokenAddress]) => {
 | 
			
		||||
    //if (true/*tokenSymbol !== 'WETH' && tokenSymbol !== 'ETH' && tokenSymbol !== 'LpWETH'*/) {
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -159,12 +159,12 @@ export const getParamPerNetwork = <T>(
 | 
			
		|||
  }
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
export const getParamPerPool = <T>({ proto, lp }: iParamsPerPool<T>, pool: AavePools) => {
 | 
			
		||||
export const getParamPerPool = <T>({ proto, amm }: iParamsPerPool<T>, pool: AavePools) => {
 | 
			
		||||
  switch (pool) {
 | 
			
		||||
    case AavePools.proto:
 | 
			
		||||
      return proto;
 | 
			
		||||
      case AavePools.lp:
 | 
			
		||||
        return lp;
 | 
			
		||||
      case AavePools.amm:
 | 
			
		||||
        return amm;
 | 
			
		||||
    default:
 | 
			
		||||
      return proto;
 | 
			
		||||
  }
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -212,7 +212,7 @@ export const initReservesByHelper = async (
 | 
			
		|||
  const chunkedInitInputParams = chunk(initInputParams, initChunks);
 | 
			
		||||
 | 
			
		||||
  const configurator = await getLendingPoolConfiguratorProxy();
 | 
			
		||||
  await waitForTx(await addressProvider.setPoolAdmin(admin));
 | 
			
		||||
  //await waitForTx(await addressProvider.setPoolAdmin(admin));
 | 
			
		||||
 | 
			
		||||
  console.log(`- Reserves initialization in ${chunkedInitInputParams.length} txs`);
 | 
			
		||||
  for (let chunkIndex = 0; chunkIndex < chunkedInitInputParams.length; chunkIndex++) {
 | 
			
		||||
| 
						 | 
				
			
			@ -383,7 +383,7 @@ export const initTokenReservesByHelper = async (
 | 
			
		|||
  const poolAddress = await addressProvider.getLendingPool();
 | 
			
		||||
 | 
			
		||||
  // Set aTokenAndRatesDeployer as temporal admin
 | 
			
		||||
  await waitForTx(await addressProvider.setPoolAdmin(atokenAndRatesDeployer.address));
 | 
			
		||||
  //await waitForTx(await addressProvider.setPoolAdmin(atokenAndRatesDeployer.address));
 | 
			
		||||
 | 
			
		||||
  // CHUNK CONFIGURATION
 | 
			
		||||
  const initChunks = 4;
 | 
			
		||||
| 
						 | 
				
			
			@ -563,7 +563,7 @@ export const initTokenReservesByHelper = async (
 | 
			
		|||
  const chunkedInitInputParams = chunk(initInputParams, initChunks);
 | 
			
		||||
 | 
			
		||||
  const configurator = await getLendingPoolConfiguratorProxy();
 | 
			
		||||
  await waitForTx(await addressProvider.setPoolAdmin(admin));
 | 
			
		||||
  //await waitForTx(await addressProvider.setPoolAdmin(admin));
 | 
			
		||||
 | 
			
		||||
  console.log(`- Reserves initialization in ${chunkedInitInputParams.length} txs`);
 | 
			
		||||
  for (let chunkIndex = 0; chunkIndex < chunkedInitInputParams.length; chunkIndex++) {
 | 
			
		||||
| 
						 | 
				
			
			@ -576,7 +576,7 @@ export const initTokenReservesByHelper = async (
 | 
			
		|||
  }
 | 
			
		||||
 | 
			
		||||
  // Set deployer back as admin
 | 
			
		||||
  await waitForTx(await addressProvider.setPoolAdmin(admin));
 | 
			
		||||
  //await waitForTx(await addressProvider.setPoolAdmin(admin));
 | 
			
		||||
  return gasUsage;  // No longer relevant
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -22,7 +22,7 @@ export enum EthereumNetworkNames {
 | 
			
		|||
 | 
			
		||||
export enum AavePools {
 | 
			
		||||
  proto = 'proto',
 | 
			
		||||
  lp = 'lp',
 | 
			
		||||
  amm = 'amm',
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
export enum eContractid {
 | 
			
		||||
| 
						 | 
				
			
			@ -205,11 +205,6 @@ export interface iAssetBase<T> {
 | 
			
		|||
  USD: T;
 | 
			
		||||
  REN: T;
 | 
			
		||||
  ENJ: T;
 | 
			
		||||
  // LpWETH: T;
 | 
			
		||||
  // LpWBTC: T;
 | 
			
		||||
  // LpDAI: T;
 | 
			
		||||
  // LpUSDC: T;
 | 
			
		||||
  // LpUSDT: T;
 | 
			
		||||
  UniDAIWETH: T;
 | 
			
		||||
  UniWBTCWETH: T;
 | 
			
		||||
  UniAAVEWETH: T;
 | 
			
		||||
| 
						 | 
				
			
			@ -307,11 +302,6 @@ export enum TokenContractId {
 | 
			
		|||
  YFI = 'YFI',
 | 
			
		||||
  UNI = 'UNI',
 | 
			
		||||
  ENJ = 'ENJ',
 | 
			
		||||
  // LpWETH = 'LpWETH',
 | 
			
		||||
  // LpWBTC = 'LpWBTC',
 | 
			
		||||
  // LpDAI = 'LpDAI',
 | 
			
		||||
  // LpUSDC = 'LpUSDC',
 | 
			
		||||
  // LpUSDT = 'LpUSDT',
 | 
			
		||||
  UniDAIWETH = 'UniDAIWETH',
 | 
			
		||||
  UniWBTCWETH = 'UniWBTCWETH',
 | 
			
		||||
  UniAAVEWETH = 'UniAAVEWETH',
 | 
			
		||||
| 
						 | 
				
			
			@ -378,7 +368,7 @@ export interface iParamsPerNetwork<T> {
 | 
			
		|||
 | 
			
		||||
export interface iParamsPerPool<T> {
 | 
			
		||||
  [AavePools.proto]: T;
 | 
			
		||||
  [AavePools.lp]: T;
 | 
			
		||||
  [AavePools.amm]: T;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
export interface iBasicDistributionParams {
 | 
			
		||||
| 
						 | 
				
			
			@ -460,7 +450,7 @@ export interface IAaveConfiguration extends ICommonConfiguration {
 | 
			
		|||
  ReservesConfig: iAavePoolAssets<IReserveParams>;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
export interface ILpConfiguration extends ICommonConfiguration {
 | 
			
		||||
export interface IAmmConfiguration extends ICommonConfiguration {
 | 
			
		||||
  ReservesConfig: iLpPoolAssets<IReserveParams>;
 | 
			
		||||
}
 | 
			
		||||
export interface ITokenAddress {
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -22,11 +22,6 @@ const MOCK_CHAINLINK_AGGREGATORS_PRICES = {
 | 
			
		|||
  WBTC: oneEther.multipliedBy('47.332685').toFixed(),
 | 
			
		||||
  YFI: oneEther.multipliedBy('22.407436').toFixed(),
 | 
			
		||||
  ZRX: oneEther.multipliedBy('0.001151').toFixed(),
 | 
			
		||||
  // LpDAI: oneEther.multipliedBy('0.00369068412860').toFixed(),
 | 
			
		||||
  // LpUSDC: oneEther.multipliedBy('0.00367714136416').toFixed(),
 | 
			
		||||
  // LpUSDT: oneEther.multipliedBy('0.00369068412860').toFixed(),
 | 
			
		||||
  // LpWBTC: oneEther.multipliedBy('47.332685').toFixed(),
 | 
			
		||||
  // LpWETH: oneEther.toFixed(),
 | 
			
		||||
  UniDAIWETH: oneEther.multipliedBy('22.407436').toFixed(),
 | 
			
		||||
  UniWBTCWETH: oneEther.multipliedBy('22.407436').toFixed(),
 | 
			
		||||
  UniAAVEWETH: oneEther.multipliedBy('0.003620948469').toFixed(),
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1,5 +1,5 @@
 | 
			
		|||
import { oneRay, ZERO_ADDRESS } from '../../helpers/constants';
 | 
			
		||||
import { ILpConfiguration, EthereumNetwork, eEthereumNetwork } from '../../helpers/types';
 | 
			
		||||
import { IAmmConfiguration, EthereumNetwork, eEthereumNetwork } from '../../helpers/types';
 | 
			
		||||
 | 
			
		||||
import { CommonsConfig } from './commons';
 | 
			
		||||
import {
 | 
			
		||||
| 
						 | 
				
			
			@ -28,9 +28,9 @@ import {
 | 
			
		|||
// POOL--SPECIFIC PARAMS
 | 
			
		||||
// ----------------
 | 
			
		||||
 | 
			
		||||
export const lpConfig: ILpConfiguration = {
 | 
			
		||||
export const AmmConfig: IAmmConfiguration = {
 | 
			
		||||
  ...CommonsConfig,
 | 
			
		||||
  MarketId: 'Aave LP market',
 | 
			
		||||
  MarketId: 'Aave AMM market',
 | 
			
		||||
  ProviderId: 2,
 | 
			
		||||
  ReservesConfig: {
 | 
			
		||||
    WETH: strategyWETH,
 | 
			
		||||
| 
						 | 
				
			
			@ -129,4 +129,4 @@ export const lpConfig: ILpConfiguration = {
 | 
			
		|||
  },
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
export default lpConfig;
 | 
			
		||||
export default AmmConfig;
 | 
			
		||||
| 
						 | 
				
			
			@ -3,8 +3,8 @@ import { oneRay } from '../../helpers/constants';
 | 
			
		|||
import { IInterestRateStrategyParams } from '../../helpers/types';
 | 
			
		||||
 | 
			
		||||
// DAIWETH WBTCWETH AAVEWETH BATWETH USDCDAI CRVWETH LINKWETH MKRWETH RENWETH SNXWETH UNIWETH USDCWETH WBTCUSDC YFIWETH
 | 
			
		||||
export const rateStrategyLpBase: IInterestRateStrategyParams = {
 | 
			
		||||
    name: "rateStrategyLpBase",
 | 
			
		||||
export const rateStrategyAmmBase: IInterestRateStrategyParams = {
 | 
			
		||||
    name: "rateStrategyAmmBase",
 | 
			
		||||
    optimalUtilizationRate: new BigNumber(0.45).multipliedBy(oneRay).toFixed(),
 | 
			
		||||
    baseVariableBorrowRate: new BigNumber(0.03).multipliedBy(oneRay).toFixed(),
 | 
			
		||||
    variableRateSlope1: new BigNumber(0.10).multipliedBy(oneRay).toFixed(),
 | 
			
		||||
| 
						 | 
				
			
			@ -1,6 +1,6 @@
 | 
			
		|||
import { eContractid, IReserveParams} from '../../helpers/types';
 | 
			
		||||
import {
 | 
			
		||||
  rateStrategyLpBase,
 | 
			
		||||
  rateStrategyAmmBase,
 | 
			
		||||
  rateStrategyStable,
 | 
			
		||||
  rateStrategyBaseOne,
 | 
			
		||||
} from './rateStrategies';
 | 
			
		||||
| 
						 | 
				
			
			@ -67,7 +67,7 @@ export const strategyUSDT: IReserveParams = {
 | 
			
		|||
};
 | 
			
		||||
 | 
			
		||||
export const strategyDAIWETH: IReserveParams = {
 | 
			
		||||
  strategy: rateStrategyLpBase,
 | 
			
		||||
  strategy: rateStrategyAmmBase,
 | 
			
		||||
  baseLTVAsCollateral: '6000',
 | 
			
		||||
  liquidationThreshold: '7000',
 | 
			
		||||
  liquidationBonus: '11500',
 | 
			
		||||
| 
						 | 
				
			
			@ -79,7 +79,7 @@ export const strategyDAIWETH: IReserveParams = {
 | 
			
		|||
};
 | 
			
		||||
 | 
			
		||||
export const strategyWBTCWETH: IReserveParams = {
 | 
			
		||||
  strategy: rateStrategyLpBase,
 | 
			
		||||
  strategy: rateStrategyAmmBase,
 | 
			
		||||
  baseLTVAsCollateral: '6000',
 | 
			
		||||
  liquidationThreshold: '7000',
 | 
			
		||||
  liquidationBonus: '11500',
 | 
			
		||||
| 
						 | 
				
			
			@ -91,7 +91,7 @@ export const strategyWBTCWETH: IReserveParams = {
 | 
			
		|||
};
 | 
			
		||||
 | 
			
		||||
export const strategyAAVEWETH: IReserveParams = {
 | 
			
		||||
  strategy: rateStrategyLpBase,
 | 
			
		||||
  strategy: rateStrategyAmmBase,
 | 
			
		||||
  baseLTVAsCollateral: '6000',
 | 
			
		||||
  liquidationThreshold: '7000',
 | 
			
		||||
  liquidationBonus: '11500',
 | 
			
		||||
| 
						 | 
				
			
			@ -103,7 +103,7 @@ export const strategyAAVEWETH: IReserveParams = {
 | 
			
		|||
};
 | 
			
		||||
 | 
			
		||||
export const strategyBATWETH: IReserveParams = {
 | 
			
		||||
  strategy: rateStrategyLpBase,
 | 
			
		||||
  strategy: rateStrategyAmmBase,
 | 
			
		||||
  baseLTVAsCollateral: '6000',
 | 
			
		||||
  liquidationThreshold: '7000',
 | 
			
		||||
  liquidationBonus: '11500',
 | 
			
		||||
| 
						 | 
				
			
			@ -115,7 +115,7 @@ export const strategyBATWETH: IReserveParams = {
 | 
			
		|||
};
 | 
			
		||||
 | 
			
		||||
export const strategyUSDCDAI: IReserveParams = {
 | 
			
		||||
  strategy: rateStrategyLpBase,
 | 
			
		||||
  strategy: rateStrategyAmmBase,
 | 
			
		||||
  baseLTVAsCollateral: '6000',
 | 
			
		||||
  liquidationThreshold: '7000',
 | 
			
		||||
  liquidationBonus: '11500',
 | 
			
		||||
| 
						 | 
				
			
			@ -127,7 +127,7 @@ export const strategyUSDCDAI: IReserveParams = {
 | 
			
		|||
};
 | 
			
		||||
 | 
			
		||||
export const strategyCRVWETH: IReserveParams = {
 | 
			
		||||
  strategy: rateStrategyLpBase,
 | 
			
		||||
  strategy: rateStrategyAmmBase,
 | 
			
		||||
  baseLTVAsCollateral: '5000',
 | 
			
		||||
  liquidationThreshold: '6000',
 | 
			
		||||
  liquidationBonus: '11500',
 | 
			
		||||
| 
						 | 
				
			
			@ -139,7 +139,7 @@ export const strategyCRVWETH: IReserveParams = {
 | 
			
		|||
};
 | 
			
		||||
 | 
			
		||||
export const strategyLINKWETH: IReserveParams = {
 | 
			
		||||
  strategy: rateStrategyLpBase,
 | 
			
		||||
  strategy: rateStrategyAmmBase,
 | 
			
		||||
  baseLTVAsCollateral: '6000',
 | 
			
		||||
  liquidationThreshold: '7000',
 | 
			
		||||
  liquidationBonus: '11500',
 | 
			
		||||
| 
						 | 
				
			
			@ -151,7 +151,7 @@ export const strategyLINKWETH: IReserveParams = {
 | 
			
		|||
};
 | 
			
		||||
 | 
			
		||||
export const strategyMKRWETH: IReserveParams = {
 | 
			
		||||
  strategy: rateStrategyLpBase,
 | 
			
		||||
  strategy: rateStrategyAmmBase,
 | 
			
		||||
  baseLTVAsCollateral: '6000',
 | 
			
		||||
  liquidationThreshold: '7000',
 | 
			
		||||
  liquidationBonus: '11500',
 | 
			
		||||
| 
						 | 
				
			
			@ -163,7 +163,7 @@ export const strategyMKRWETH: IReserveParams = {
 | 
			
		|||
};
 | 
			
		||||
 | 
			
		||||
export const strategyRENWETH: IReserveParams = {
 | 
			
		||||
  strategy: rateStrategyLpBase,
 | 
			
		||||
  strategy: rateStrategyAmmBase,
 | 
			
		||||
  baseLTVAsCollateral: '6000',
 | 
			
		||||
  liquidationThreshold: '7000',
 | 
			
		||||
  liquidationBonus: '11500',
 | 
			
		||||
| 
						 | 
				
			
			@ -175,7 +175,7 @@ export const strategyRENWETH: IReserveParams = {
 | 
			
		|||
};
 | 
			
		||||
 | 
			
		||||
export const strategySNXWETH: IReserveParams = {
 | 
			
		||||
  strategy: rateStrategyLpBase,
 | 
			
		||||
  strategy: rateStrategyAmmBase,
 | 
			
		||||
  baseLTVAsCollateral: '4000',
 | 
			
		||||
  liquidationThreshold: '6000',
 | 
			
		||||
  liquidationBonus: '11500',
 | 
			
		||||
| 
						 | 
				
			
			@ -187,7 +187,7 @@ export const strategySNXWETH: IReserveParams = {
 | 
			
		|||
};
 | 
			
		||||
 | 
			
		||||
export const strategyUNIWETH: IReserveParams = {
 | 
			
		||||
  strategy: rateStrategyLpBase,
 | 
			
		||||
  strategy: rateStrategyAmmBase,
 | 
			
		||||
  baseLTVAsCollateral: '6000',
 | 
			
		||||
  liquidationThreshold: '7000',
 | 
			
		||||
  liquidationBonus: '11500',
 | 
			
		||||
| 
						 | 
				
			
			@ -199,7 +199,7 @@ export const strategyUNIWETH: IReserveParams = {
 | 
			
		|||
};
 | 
			
		||||
 | 
			
		||||
export const strategyUSDCWETH: IReserveParams = {
 | 
			
		||||
  strategy: rateStrategyLpBase,
 | 
			
		||||
  strategy: rateStrategyAmmBase,
 | 
			
		||||
  baseLTVAsCollateral: '6000',
 | 
			
		||||
  liquidationThreshold: '7000',
 | 
			
		||||
  liquidationBonus: '11500',
 | 
			
		||||
| 
						 | 
				
			
			@ -211,7 +211,7 @@ export const strategyUSDCWETH: IReserveParams = {
 | 
			
		|||
};
 | 
			
		||||
 | 
			
		||||
export const strategyWBTCUSDC: IReserveParams = {
 | 
			
		||||
  strategy: rateStrategyLpBase,
 | 
			
		||||
  strategy: rateStrategyAmmBase,
 | 
			
		||||
  baseLTVAsCollateral: '6000',
 | 
			
		||||
  liquidationThreshold: '7000',
 | 
			
		||||
  liquidationBonus: '11500',
 | 
			
		||||
| 
						 | 
				
			
			@ -223,7 +223,7 @@ export const strategyWBTCUSDC: IReserveParams = {
 | 
			
		|||
};
 | 
			
		||||
 | 
			
		||||
export const strategyYFIWETH: IReserveParams = {
 | 
			
		||||
  strategy: rateStrategyLpBase,
 | 
			
		||||
  strategy: rateStrategyAmmBase,
 | 
			
		||||
  baseLTVAsCollateral: '5000',
 | 
			
		||||
  liquidationThreshold: '6000',
 | 
			
		||||
  liquidationBonus: '11500',
 | 
			
		||||
							
								
								
									
										25497
									
								
								package-lock.json
									
									
									
										generated
									
									
									
								
							
							
						
						
									
										25497
									
								
								package-lock.json
									
									
									
										generated
									
									
									
								
							
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							
							
								
								
									
										10
									
								
								package.json
									
									
									
									
									
								
							
							
						
						
									
										10
									
								
								package.json
									
									
									
									
									
								
							| 
						 | 
				
			
			@ -17,8 +17,8 @@
 | 
			
		|||
    "compile": "SKIP_LOAD=true hardhat compile",
 | 
			
		||||
    "console:fork": "MAINNET_FORK=true hardhat console",
 | 
			
		||||
    "test": "TS_NODE_TRANSPILE_ONLY=1 hardhat test ./test-suites/test-aave/*.spec.ts",
 | 
			
		||||
    "test-lp": "TS_NODE_TRANSPILE_ONLY=1 hardhat test ./test-suites/test-lp/*.spec.ts",
 | 
			
		||||
    "test-lp-scenarios": "TS_NODE_TRANSPILE_ONLY=1 hardhat test ./test-suites/test-lp/__setup.spec.ts test-suites/test-lp/scenario.spec.ts",
 | 
			
		||||
    "test-amm": "TS_NODE_TRANSPILE_ONLY=1 hardhat test ./test-suites/test-amm/*.spec.ts",
 | 
			
		||||
    "test-amm-scenarios": "TS_NODE_TRANSPILE_ONLY=1 hardhat test ./test-suites/test-amm/__setup.spec.ts test-suites/test-amm/scenario.spec.ts",
 | 
			
		||||
    "test-scenarios": "npx hardhat test test-suites/test-aave/__setup.spec.ts test-suites/test-aave/scenario.spec.ts",
 | 
			
		||||
    "test-repay-with-collateral": "hardhat test test-suites/test-aave/__setup.spec.ts test-suites/test-aave/repay-with-collateral.spec.ts",
 | 
			
		||||
    "test-liquidate-with-collateral": "hardhat test test-suites/test-aave/__setup.spec.ts test-suites/test-aave/flash-liquidation-with-collateral.spec.ts",
 | 
			
		||||
| 
						 | 
				
			
			@ -33,19 +33,19 @@
 | 
			
		|||
    "test-stable-and-atokens": "hardhat test test-suites/test-aave/__setup.spec.ts test-suites/test-aave/atoken-transfer.spec.ts test-suites/test-aave/stable-token.spec.ts",
 | 
			
		||||
    "test-subgraph:scenarios": "hardhat --network hardhatevm_docker test test-suites/test-aave/__setup.spec.ts test-suites/test-aave/subgraph-scenarios.spec.ts",
 | 
			
		||||
    "test-weth:main": "hardhat test test-suites/test-aave/__setup.spec.ts test-suites/test-aave/weth-gateway.spec.ts",
 | 
			
		||||
    "test-weth:lp": "hardhat test test-suites/test-lp/__setup.spec.ts test-suites/test-lp/weth-gateway.spec.ts",
 | 
			
		||||
    "test-weth:amm": "hardhat test test-suites/test-amm/__setup.spec.ts test-suites/test-amm/weth-gateway.spec.ts",
 | 
			
		||||
    "test-uniswap": "hardhat test test-suites/test-aave/__setup.spec.ts test-suites/test-aave/uniswapAdapters*.spec.ts",
 | 
			
		||||
    "test:main:check-list": "MAINNET_FORK=true TS_NODE_TRANSPILE_ONLY=1 hardhat test  test-suites/test-aave/__setup.spec.ts test-suites/test-aave/mainnet/check-list.spec.ts",
 | 
			
		||||
    "dev:coverage": "buidler compile --force && buidler coverage --network coverage",
 | 
			
		||||
    "aave:evm:dev:migration": "npm run compile && hardhat aave:dev",
 | 
			
		||||
    "aave:docker:full:migration": "npm run compile && npm run hardhat:docker -- aave:mainnet",
 | 
			
		||||
    "aave:kovan:full:migration": "npm run compile && npm run hardhat:kovan -- aave:mainnet --verify",
 | 
			
		||||
    "lp:kovan:full:migration": "npm run compile && npm run hardhat:kovan -- lp:mainnet --verify",
 | 
			
		||||
    "amm:kovan:full:migration": "npm run compile && npm run hardhat:kovan -- amm:mainnet --verify",
 | 
			
		||||
    "aave:kovan:full:initialize": "npm run hardhat:kovan -- full:initialize-lending-pool --verify --pool Aave",
 | 
			
		||||
    "aave:ropsten:full:migration": "npm run compile && npm run hardhat:ropsten -- aave:mainnet --verify",
 | 
			
		||||
    "aave:fork:main:tenderly": "npm run compile && npm run hardhat:tenderly-main -- aave:mainnet",
 | 
			
		||||
    "aave:fork:main": "npm run compile && MAINNET_FORK=true hardhat aave:mainnet",
 | 
			
		||||
    "lp:fork:main": "npm run compile && MAINNET_FORK=true hardhat lp:mainnet",
 | 
			
		||||
    "amm:fork:main": "npm run compile && MAINNET_FORK=true hardhat amm:mainnet",
 | 
			
		||||
    "aave:main:full:migration": "npm run compile && npm run hardhat:main -- aave:mainnet --verify",
 | 
			
		||||
    "aave:main:full:initialize": "npm run compile && MAINNET_FORK=true full:initialize-tokens --pool Aave",
 | 
			
		||||
    "prettier:check": "npx prettier -c 'tasks/**/*.ts' 'contracts/**/*.sol' 'helpers/**/*.ts'  'test-suites/test-aave/**/*.ts'",
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -4,10 +4,10 @@ import { ConfigNames } from '../../helpers/configuration';
 | 
			
		|||
import { printContracts } from '../../helpers/misc-utils';
 | 
			
		||||
import { usingTenderly } from '../../helpers/tenderly-utils';
 | 
			
		||||
 | 
			
		||||
task('lp:mainnet', 'Deploy development enviroment')
 | 
			
		||||
task('amm:mainnet', 'Deploy development enviroment')
 | 
			
		||||
  .addFlag('verify', 'Verify contracts at Etherscan')
 | 
			
		||||
  .setAction(async ({ verify }, DRE) => {
 | 
			
		||||
    const POOL_NAME = ConfigNames.Lp;
 | 
			
		||||
    const POOL_NAME = ConfigNames.Amm;
 | 
			
		||||
    await DRE.run('set-DRE');
 | 
			
		||||
 | 
			
		||||
    // Prevent loss of gas verifying all the needed ENVs for Etherscan verification
 | 
			
		||||
| 
						 | 
				
			
			@ -46,7 +46,7 @@ import {
 | 
			
		|||
} from '../../helpers/oracles-helpers';
 | 
			
		||||
import { DRE, waitForTx } from '../../helpers/misc-utils';
 | 
			
		||||
import { initReservesByHelper, configureReservesByHelper } from '../../helpers/init-helpers';
 | 
			
		||||
import LpConfig from '../../markets/lp';
 | 
			
		||||
import AmmConfig from '../../markets/amm';
 | 
			
		||||
import { ZERO_ADDRESS } from '../../helpers/constants';
 | 
			
		||||
import {
 | 
			
		||||
  getLendingPool,
 | 
			
		||||
| 
						 | 
				
			
			@ -55,16 +55,16 @@ import {
 | 
			
		|||
} from '../../helpers/contracts-getters';
 | 
			
		||||
import { WETH9Mocked } from '../../types/WETH9Mocked';
 | 
			
		||||
 | 
			
		||||
const MOCK_USD_PRICE_IN_WEI = LpConfig.ProtocolGlobalParams.MockUsdPriceInWei;
 | 
			
		||||
const ALL_ASSETS_INITIAL_PRICES = LpConfig.Mocks.AllAssetsInitialPrices;
 | 
			
		||||
const USD_ADDRESS = LpConfig.ProtocolGlobalParams.UsdAddress;
 | 
			
		||||
const MOCK_CHAINLINK_AGGREGATORS_PRICES = LpConfig.Mocks.AllAssetsInitialPrices;
 | 
			
		||||
const LENDING_RATE_ORACLE_RATES_COMMON = LpConfig.LendingRateOracleRatesCommon;
 | 
			
		||||
const MOCK_USD_PRICE_IN_WEI = AmmConfig.ProtocolGlobalParams.MockUsdPriceInWei;
 | 
			
		||||
const ALL_ASSETS_INITIAL_PRICES = AmmConfig.Mocks.AllAssetsInitialPrices;
 | 
			
		||||
const USD_ADDRESS = AmmConfig.ProtocolGlobalParams.UsdAddress;
 | 
			
		||||
const MOCK_CHAINLINK_AGGREGATORS_PRICES = AmmConfig.Mocks.AllAssetsInitialPrices;
 | 
			
		||||
const LENDING_RATE_ORACLE_RATES_COMMON = AmmConfig.LendingRateOracleRatesCommon;
 | 
			
		||||
 | 
			
		||||
const deployAllMockTokens = async (deployer: Signer) => {
 | 
			
		||||
  const tokens: { [symbol: string]: MockContract | MintableERC20 | WETH9Mocked } = {};
 | 
			
		||||
 | 
			
		||||
  const lpConfigData = getReservesConfigByPool(AavePools.lp);
 | 
			
		||||
  const ammConfigData = getReservesConfigByPool(AavePools.amm);
 | 
			
		||||
 | 
			
		||||
  for (const tokenSymbol of Object.keys(TokenContractId)) {
 | 
			
		||||
    if (tokenSymbol === 'WETH') {
 | 
			
		||||
| 
						 | 
				
			
			@ -74,7 +74,7 @@ const deployAllMockTokens = async (deployer: Signer) => {
 | 
			
		|||
    }
 | 
			
		||||
    let decimals = 18;
 | 
			
		||||
 | 
			
		||||
    let configData = (<any>lpConfigData)[tokenSymbol];
 | 
			
		||||
    let configData = (<any>ammConfigData)[tokenSymbol];
 | 
			
		||||
 | 
			
		||||
    if (!configData) {
 | 
			
		||||
      decimals = 18;
 | 
			
		||||
| 
						 | 
				
			
			@ -97,7 +97,7 @@ const buildTestEnv = async (deployer: Signer, secondaryWallet: Signer) => {
 | 
			
		|||
 | 
			
		||||
  const mockTokens = await deployAllMockTokens(deployer);
 | 
			
		||||
 | 
			
		||||
  const addressesProvider = await deployLendingPoolAddressesProvider(LpConfig.MarketId);
 | 
			
		||||
  const addressesProvider = await deployLendingPoolAddressesProvider(AmmConfig.MarketId);
 | 
			
		||||
  await waitForTx(await addressesProvider.setPoolAdmin(aaveAdmin));
 | 
			
		||||
 | 
			
		||||
  //setting users[1] as emergency admin, which is in position 2 in the DRE addresses list
 | 
			
		||||
| 
						 | 
				
			
			@ -227,7 +227,7 @@ const buildTestEnv = async (deployer: Signer, secondaryWallet: Signer) => {
 | 
			
		|||
    aaveAdmin
 | 
			
		||||
  );
 | 
			
		||||
 | 
			
		||||
  const reservesParams = getReservesConfigByPool(AavePools.lp);
 | 
			
		||||
  const reservesParams = getReservesConfigByPool(AavePools.amm);
 | 
			
		||||
 | 
			
		||||
  const testHelpers = await deployAaveProtocolDataProvider(addressesProvider.address);
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -236,7 +236,7 @@ const buildTestEnv = async (deployer: Signer, secondaryWallet: Signer) => {
 | 
			
		|||
 | 
			
		||||
  console.log('Initialize configuration');
 | 
			
		||||
 | 
			
		||||
  const config = loadPoolConfig(ConfigNames.Lp);
 | 
			
		||||
  const config = loadPoolConfig(ConfigNames.Amm);
 | 
			
		||||
  
 | 
			
		||||
  const { 
 | 
			
		||||
    ATokenNamePrefix,
 | 
			
		||||
| 
						 | 
				
			
			@ -292,7 +292,7 @@ before(async () => {
 | 
			
		|||
  const MAINNET_FORK = process.env.MAINNET_FORK === 'true';
 | 
			
		||||
 | 
			
		||||
  if (MAINNET_FORK) {
 | 
			
		||||
    await rawBRE.run('lp:mainnet');
 | 
			
		||||
    await rawBRE.run('amm:mainnet');
 | 
			
		||||
  } else {
 | 
			
		||||
    console.log('-> Deploying test environment...');
 | 
			
		||||
    await buildTestEnv(deployer, secondaryWallet);
 | 
			
		||||
| 
						 | 
				
			
			@ -4,7 +4,7 @@ import { expect } from 'chai';
 | 
			
		|||
import { ethers } from 'ethers';
 | 
			
		||||
import { RateMode, ProtocolErrors } from '../../helpers/types';
 | 
			
		||||
import { makeSuite, TestEnv } from './helpers/make-suite';
 | 
			
		||||
import { CommonsConfig } from '../../markets/lp/commons';
 | 
			
		||||
import { CommonsConfig } from '../../markets/amm/commons';
 | 
			
		||||
 | 
			
		||||
const AAVE_REFERRAL = CommonsConfig.ProtocolGlobalParams.AaveReferral;
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -2,7 +2,7 @@ import { TestEnv, makeSuite } from './helpers/make-suite';
 | 
			
		|||
import { APPROVAL_AMOUNT_LENDING_POOL, RAY } from '../../helpers/constants';
 | 
			
		||||
import { convertToCurrencyDecimals } from '../../helpers/contracts-helpers';
 | 
			
		||||
import { ProtocolErrors } from '../../helpers/types';
 | 
			
		||||
import { strategyWETH } from '../../markets/lp/reservesConfigs';
 | 
			
		||||
import { strategyWETH } from '../../markets/amm/reservesConfigs';
 | 
			
		||||
 | 
			
		||||
const { expect } = require('chai');
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -20,7 +20,7 @@ import {
 | 
			
		|||
import { DelegationAwareATokenFactory } from '../../types';
 | 
			
		||||
import { DelegationAwareAToken } from '../../types/DelegationAwareAToken';
 | 
			
		||||
import { MintableDelegationERC20 } from '../../types/MintableDelegationERC20';
 | 
			
		||||
import LpConfig from '../../markets/lp';
 | 
			
		||||
import AmmConfig from '../../markets/amm';
 | 
			
		||||
 | 
			
		||||
const { parseEther } = ethers.utils;
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -35,7 +35,7 @@ makeSuite('AToken: underlying delegation', (testEnv: TestEnv) => {
 | 
			
		|||
    delegationERC20 = await deployMintableDelegationERC20(['DEL', 'DEL', '18']);
 | 
			
		||||
 | 
			
		||||
    delegationAToken = await deployDelegationAwareAToken(
 | 
			
		||||
      [pool.address, delegationERC20.address, await getTreasuryAddress(LpConfig), ZERO_ADDRESS, 'aDEL', 'aDEL'],
 | 
			
		||||
      [pool.address, delegationERC20.address, await getTreasuryAddress(AmmConfig), ZERO_ADDRESS, 'aDEL', 'aDEL'],
 | 
			
		||||
      false
 | 
			
		||||
    );
 | 
			
		||||
    
 | 
			
		||||
| 
						 | 
				
			
			@ -36,7 +36,7 @@ import { getParamPerNetwork } from '../../../helpers/contracts-helpers';
 | 
			
		|||
import { WETH9Mocked } from '../../../types/WETH9Mocked';
 | 
			
		||||
import { WETHGateway } from '../../../types/WETHGateway';
 | 
			
		||||
import { solidity } from 'ethereum-waffle';
 | 
			
		||||
import { lpConfig } from '../../../markets/lp';
 | 
			
		||||
import { AmmConfig } from '../../../markets/amm';
 | 
			
		||||
import { FlashLiquidationAdapter } from '../../../types';
 | 
			
		||||
import { HardhatRuntimeEnvironment } from 'hardhat/types';
 | 
			
		||||
import { usingTenderly } from '../../../helpers/tenderly-utils';
 | 
			
		||||
| 
						 | 
				
			
			@ -118,7 +118,7 @@ export async function initializeMakeSuite() {
 | 
			
		|||
 | 
			
		||||
  if (process.env.MAINNET_FORK === 'true') {
 | 
			
		||||
    testEnv.registry = await getLendingPoolAddressesProviderRegistry(
 | 
			
		||||
      getParamPerNetwork(lpConfig.ProviderRegistry, eEthereumNetwork.main)
 | 
			
		||||
      getParamPerNetwork(AmmConfig.ProviderRegistry, eEthereumNetwork.main)
 | 
			
		||||
    );
 | 
			
		||||
  } else {
 | 
			
		||||
    testEnv.registry = await getLendingPoolAddressesProviderRegistry();
 | 
			
		||||
| 
						 | 
				
			
			@ -7,7 +7,7 @@ import { makeSuite } from './helpers/make-suite';
 | 
			
		|||
import { ProtocolErrors, RateMode } from '../../helpers/types';
 | 
			
		||||
import { calcExpectedVariableDebtTokenBalance } from './helpers/utils/calculations';
 | 
			
		||||
import { getReserveData, getUserData } from './helpers/utils/helpers';
 | 
			
		||||
import { CommonsConfig } from '../../markets/lp/commons';
 | 
			
		||||
import { CommonsConfig } from '../../markets/amm/commons';
 | 
			
		||||
 | 
			
		||||
import { parseEther } from 'ethers/lib/utils';
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -8,7 +8,7 @@ import { getReservesConfigByPool } from '../../helpers/configuration';
 | 
			
		|||
import { AavePools, iLpPoolAssets, IReserveParams } from '../../helpers/types';
 | 
			
		||||
import { executeStory } from './helpers/scenario-engine';
 | 
			
		||||
 | 
			
		||||
const scenarioFolder = './test-suites/test-lp/helpers/scenarios/';
 | 
			
		||||
const scenarioFolder = './test-suites/test-amm/helpers/scenarios/';
 | 
			
		||||
 | 
			
		||||
const selectedScenarios: string[] = [];
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -25,7 +25,7 @@ fs.readdirSync(scenarioFolder).forEach((file) => {
 | 
			
		|||
      actionsConfiguration.skipIntegrityCheck = false; //set this to true to execute solidity-coverage
 | 
			
		||||
 | 
			
		||||
      calculationsConfiguration.reservesParams = <iLpPoolAssets<IReserveParams>>(
 | 
			
		||||
        getReservesConfigByPool(AavePools.lp)
 | 
			
		||||
        getReservesConfigByPool(AavePools.amm)
 | 
			
		||||
      );
 | 
			
		||||
    });
 | 
			
		||||
    after('Reset', () => {
 | 
			
		||||
| 
						 | 
				
			
			@ -19,7 +19,7 @@ makeSuite('Subgraph scenario tests', async (testEnv) => {
 | 
			
		|||
    actionsConfiguration.skipIntegrityCheck = false; //set this to true to execute solidity-coverage
 | 
			
		||||
 | 
			
		||||
    calculationsConfiguration.reservesParams = <iLpPoolAssets<IReserveParams>>(
 | 
			
		||||
      getReservesConfigByPool(AavePools.lp)
 | 
			
		||||
      getReservesConfigByPool(AavePools.amm)
 | 
			
		||||
    );
 | 
			
		||||
  });
 | 
			
		||||
  after('Reset', () => {
 | 
			
		||||
		Loading…
	
		Reference in New Issue
	
	Block a user