mirror of
https://github.com/Instadapp/aave-protocol-v2.git
synced 2024-07-29 21:47:30 +00:00
feat: Add optimistic kovan market
This commit is contained in:
parent
36c8f08782
commit
d6a0f34ba2
|
@ -10,6 +10,7 @@ import { getEthersSignersAddresses, getParamPerPool } from './contracts-helpers'
|
||||||
import AaveConfig from '../markets/aave';
|
import AaveConfig from '../markets/aave';
|
||||||
import MaticConfig from '../markets/matic';
|
import MaticConfig from '../markets/matic';
|
||||||
import AmmConfig from '../markets/amm';
|
import AmmConfig from '../markets/amm';
|
||||||
|
import OptimismConfig from '../markets/ovm';
|
||||||
|
|
||||||
import { CommonsConfig } from '../markets/aave/commons';
|
import { CommonsConfig } from '../markets/aave/commons';
|
||||||
import { DRE, filterMapBy } from './misc-utils';
|
import { DRE, filterMapBy } from './misc-utils';
|
||||||
|
@ -22,6 +23,7 @@ export enum ConfigNames {
|
||||||
Aave = 'Aave',
|
Aave = 'Aave',
|
||||||
Matic = 'Matic',
|
Matic = 'Matic',
|
||||||
Amm = 'Amm',
|
Amm = 'Amm',
|
||||||
|
Optimism = 'Optimism'
|
||||||
}
|
}
|
||||||
|
|
||||||
export const loadPoolConfig = (configName: ConfigNames): PoolConfiguration => {
|
export const loadPoolConfig = (configName: ConfigNames): PoolConfiguration => {
|
||||||
|
@ -32,6 +34,8 @@ export const loadPoolConfig = (configName: ConfigNames): PoolConfiguration => {
|
||||||
return MaticConfig;
|
return MaticConfig;
|
||||||
case ConfigNames.Amm:
|
case ConfigNames.Amm:
|
||||||
return AmmConfig;
|
return AmmConfig;
|
||||||
|
case ConfigNames.Optimism:
|
||||||
|
return OptimismConfig;
|
||||||
case ConfigNames.Commons:
|
case ConfigNames.Commons:
|
||||||
return CommonsConfig;
|
return CommonsConfig;
|
||||||
default:
|
default:
|
||||||
|
@ -59,6 +63,9 @@ export const getReservesConfigByPool = (pool: AavePools): iMultiPoolsAssets<IRes
|
||||||
[AavePools.matic]: {
|
[AavePools.matic]: {
|
||||||
...MaticConfig.ReservesConfig,
|
...MaticConfig.ReservesConfig,
|
||||||
},
|
},
|
||||||
|
[AavePools.optimism]: {
|
||||||
|
...OptimismConfig.ReservesConfig,
|
||||||
|
},
|
||||||
},
|
},
|
||||||
pool
|
pool
|
||||||
);
|
);
|
||||||
|
@ -131,6 +138,7 @@ export const getLendingRateOracles = (poolConfig: IBaseConfiguration) => {
|
||||||
} = poolConfig;
|
} = poolConfig;
|
||||||
|
|
||||||
const network = process.env.FORK ? process.env.FORK : DRE.network.name;
|
const network = process.env.FORK ? process.env.FORK : DRE.network.name;
|
||||||
|
console.log(ReserveAssets[network])
|
||||||
return filterMapBy(LendingRateOracleRatesCommon, (key) =>
|
return filterMapBy(LendingRateOracleRatesCommon, (key) =>
|
||||||
Object.keys(ReserveAssets[network]).includes(key)
|
Object.keys(ReserveAssets[network]).includes(key)
|
||||||
);
|
);
|
||||||
|
|
|
@ -48,6 +48,9 @@ import {
|
||||||
WETH9MockedFactory,
|
WETH9MockedFactory,
|
||||||
WETHGatewayFactory,
|
WETHGatewayFactory,
|
||||||
FlashLiquidationAdapterFactory,
|
FlashLiquidationAdapterFactory,
|
||||||
|
LendingPoolBaseLogic,
|
||||||
|
ConfiguratorLogic,
|
||||||
|
ConfiguratorLogicFactory,
|
||||||
} from '../types';
|
} from '../types';
|
||||||
import {
|
import {
|
||||||
withSaveAndVerify,
|
withSaveAndVerify,
|
||||||
|
@ -103,7 +106,14 @@ export const deployLendingPoolAddressesProviderRegistry = async (verify?: boolea
|
||||||
);
|
);
|
||||||
|
|
||||||
export const deployLendingPoolConfigurator = async (verify?: boolean) => {
|
export const deployLendingPoolConfigurator = async (verify?: boolean) => {
|
||||||
|
const configuratorLogic = await withSaveAndVerify(
|
||||||
|
await new ConfiguratorLogicFactory(await getFirstSigner()).deploy(),
|
||||||
|
eContractid.ConfiguratorLogic,
|
||||||
|
[],
|
||||||
|
verify
|
||||||
|
);
|
||||||
const lendingPoolConfiguratorImpl = await new LendingPoolConfiguratorFactory(
|
const lendingPoolConfiguratorImpl = await new LendingPoolConfiguratorFactory(
|
||||||
|
{['__$3ddc574512022f331a6a4c7e4bbb5c67b6$__']: configuratorLogic.address},
|
||||||
await getFirstSigner()
|
await getFirstSigner()
|
||||||
).deploy();
|
).deploy();
|
||||||
await insertContractAddressInDb(
|
await insertContractAddressInDb(
|
||||||
|
@ -168,12 +178,70 @@ export const deployValidationLogic = async (
|
||||||
return withSaveAndVerify(validationLogic, eContractid.ValidationLogic, [], verify);
|
return withSaveAndVerify(validationLogic, eContractid.ValidationLogic, [], verify);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
export const deployLendingPoolBaseLogic = async (
|
||||||
|
reserveLogic: Contract,
|
||||||
|
validationLogic: Contract,
|
||||||
|
verify?: boolean
|
||||||
|
) => {
|
||||||
|
const lendingPoolBaseLogicArtifact = await readArtifact(eContractid.LendingPoolBaseLogic);
|
||||||
|
|
||||||
|
const linkedLendingPoolLogicByteCode = linkBytecode(lendingPoolBaseLogicArtifact, {
|
||||||
|
[eContractid.ReserveLogic]: reserveLogic.address,
|
||||||
|
[eContractid.ValidationLogic]: validationLogic.address,
|
||||||
|
});
|
||||||
|
|
||||||
|
const lendingPoolBaseLogicFactory = await DRE.ethers.getContractFactory(
|
||||||
|
lendingPoolBaseLogicArtifact.abi,
|
||||||
|
linkedLendingPoolLogicByteCode
|
||||||
|
);
|
||||||
|
|
||||||
|
const lendingPoolBaseLogic = await (
|
||||||
|
await lendingPoolBaseLogicFactory.connect(await getFirstSigner()).deploy()
|
||||||
|
).deployed();
|
||||||
|
|
||||||
|
return withSaveAndVerify(lendingPoolBaseLogic, eContractid.LendingPoolBaseLogic, [], verify);
|
||||||
|
};
|
||||||
|
|
||||||
|
export const deployLendingPoolOtherLogic = async (
|
||||||
|
reserveLogic: Contract,
|
||||||
|
validationLogic: Contract,
|
||||||
|
verify?: boolean
|
||||||
|
) => {
|
||||||
|
const lendingPoolOtherLogicArtifact = await readArtifact(eContractid.LendingPoolOtherLogic);
|
||||||
|
|
||||||
|
const linkedLendingPoolLogicByteCode = linkBytecode(lendingPoolOtherLogicArtifact, {
|
||||||
|
[eContractid.ReserveLogic]: reserveLogic.address,
|
||||||
|
[eContractid.ValidationLogic]: validationLogic.address,
|
||||||
|
});
|
||||||
|
|
||||||
|
const lendingPoolOtherLogicFactory = await DRE.ethers.getContractFactory(
|
||||||
|
lendingPoolOtherLogicArtifact.abi,
|
||||||
|
linkedLendingPoolLogicByteCode
|
||||||
|
);
|
||||||
|
|
||||||
|
const lendingPoolOtherLogic = await (
|
||||||
|
await lendingPoolOtherLogicFactory.connect(await getFirstSigner()).deploy()
|
||||||
|
).deployed();
|
||||||
|
|
||||||
|
return withSaveAndVerify(lendingPoolOtherLogic, eContractid.LendingPoolOtherLogic, [], verify);
|
||||||
|
};
|
||||||
|
|
||||||
export const deployAaveLibraries = async (
|
export const deployAaveLibraries = async (
|
||||||
verify?: boolean
|
verify?: boolean
|
||||||
): Promise<LendingPoolLibraryAddresses> => {
|
): Promise<LendingPoolLibraryAddresses> => {
|
||||||
const reserveLogic = await deployReserveLogicLibrary(verify);
|
const reserveLogic = await deployReserveLogicLibrary(verify);
|
||||||
const genericLogic = await deployGenericLogic(reserveLogic, verify);
|
const genericLogic = await deployGenericLogic(reserveLogic, verify);
|
||||||
const validationLogic = await deployValidationLogic(reserveLogic, genericLogic, verify);
|
const validationLogic = await deployValidationLogic(reserveLogic, genericLogic, verify);
|
||||||
|
const lendingPoolBaseLogic = await deployLendingPoolBaseLogic(
|
||||||
|
reserveLogic,
|
||||||
|
validationLogic,
|
||||||
|
verify
|
||||||
|
);
|
||||||
|
const lendingPoolOtherLogic = await deployLendingPoolOtherLogic(
|
||||||
|
reserveLogic,
|
||||||
|
validationLogic,
|
||||||
|
verify
|
||||||
|
);
|
||||||
|
|
||||||
// Hardcoded solidity placeholders, if any library changes path this will fail.
|
// Hardcoded solidity placeholders, if any library changes path this will fail.
|
||||||
// The '__$PLACEHOLDER$__ can be calculated via solidity keccak, but the LendingPoolLibraryAddresses Type seems to
|
// The '__$PLACEHOLDER$__ can be calculated via solidity keccak, but the LendingPoolLibraryAddresses Type seems to
|
||||||
|
@ -189,8 +257,10 @@ export const deployAaveLibraries = async (
|
||||||
return {
|
return {
|
||||||
['__$de8c0cf1a7d7c36c802af9a64fb9d86036$__']: validationLogic.address,
|
['__$de8c0cf1a7d7c36c802af9a64fb9d86036$__']: validationLogic.address,
|
||||||
['__$22cd43a9dda9ce44e9b92ba393b88fb9ac$__']: reserveLogic.address,
|
['__$22cd43a9dda9ce44e9b92ba393b88fb9ac$__']: reserveLogic.address,
|
||||||
["__$52a8a86ab43135662ff256bbc95497e8e3$__"]: genericLogic.address,
|
['__$52a8a86ab43135662ff256bbc95497e8e3$__']: genericLogic.address,
|
||||||
}
|
['__$3eebaf3cae995fc60fc10192f4df8139e2$__']: lendingPoolOtherLogic.address,
|
||||||
|
['__$a51786c2269c2ea419cdc7fd27f45f7870$__']: lendingPoolBaseLogic.address,
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
export const deployLendingPool = async (verify?: boolean) => {
|
export const deployLendingPool = async (verify?: boolean) => {
|
||||||
|
|
|
@ -17,6 +17,8 @@ import {
|
||||||
iEthereumParamsPerNetwork,
|
iEthereumParamsPerNetwork,
|
||||||
iPolygonParamsPerNetwork,
|
iPolygonParamsPerNetwork,
|
||||||
iXDaiParamsPerNetwork,
|
iXDaiParamsPerNetwork,
|
||||||
|
eOptimismNetwork,
|
||||||
|
iOptimismParamsPerNetwork,
|
||||||
} from './types';
|
} from './types';
|
||||||
import { MintableERC20 } from '../types/MintableERC20';
|
import { MintableERC20 } from '../types/MintableERC20';
|
||||||
import { Artifact } from 'hardhat/types';
|
import { Artifact } from 'hardhat/types';
|
||||||
|
@ -147,6 +149,7 @@ export const getParamPerNetwork = <T>(param: iParamsPerNetwork<T>, network: eNet
|
||||||
param as iEthereumParamsPerNetwork<T>;
|
param as iEthereumParamsPerNetwork<T>;
|
||||||
const { matic, mumbai } = param as iPolygonParamsPerNetwork<T>;
|
const { matic, mumbai } = param as iPolygonParamsPerNetwork<T>;
|
||||||
const { xdai } = param as iXDaiParamsPerNetwork<T>;
|
const { xdai } = param as iXDaiParamsPerNetwork<T>;
|
||||||
|
const { optimism, optimismKovan } = param as iOptimismParamsPerNetwork<T>;
|
||||||
if (process.env.FORK) {
|
if (process.env.FORK) {
|
||||||
return param[process.env.FORK as eNetwork] as T;
|
return param[process.env.FORK as eNetwork] as T;
|
||||||
}
|
}
|
||||||
|
@ -172,6 +175,10 @@ export const getParamPerNetwork = <T>(param: iParamsPerNetwork<T>, network: eNet
|
||||||
return mumbai;
|
return mumbai;
|
||||||
case eXDaiNetwork.xdai:
|
case eXDaiNetwork.xdai:
|
||||||
return xdai;
|
return xdai;
|
||||||
|
case eOptimismNetwork.optimismKovan:
|
||||||
|
return optimismKovan;
|
||||||
|
case eOptimismNetwork.optimism:
|
||||||
|
return optimism;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -185,7 +192,10 @@ export const getOptionalParamAddressPerNetwork = (
|
||||||
return getParamPerNetwork(param, network);
|
return getParamPerNetwork(param, network);
|
||||||
};
|
};
|
||||||
|
|
||||||
export const getParamPerPool = <T>({ proto, amm, matic }: iParamsPerPool<T>, pool: AavePools) => {
|
export const getParamPerPool = <T>(
|
||||||
|
{ proto, amm, matic, optimism }: iParamsPerPool<T>,
|
||||||
|
pool: AavePools
|
||||||
|
) => {
|
||||||
switch (pool) {
|
switch (pool) {
|
||||||
case AavePools.proto:
|
case AavePools.proto:
|
||||||
return proto;
|
return proto;
|
||||||
|
@ -193,6 +203,8 @@ export const getParamPerPool = <T>({ proto, amm, matic }: iParamsPerPool<T>, poo
|
||||||
return amm;
|
return amm;
|
||||||
case AavePools.matic:
|
case AavePools.matic:
|
||||||
return matic;
|
return matic;
|
||||||
|
case AavePools.optimism:
|
||||||
|
return optimism;
|
||||||
default:
|
default:
|
||||||
return proto;
|
return proto;
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,7 +4,7 @@ export interface SymbolMap<T> {
|
||||||
[symbol: string]: T;
|
[symbol: string]: T;
|
||||||
}
|
}
|
||||||
|
|
||||||
export type eNetwork = eEthereumNetwork | ePolygonNetwork | eXDaiNetwork;
|
export type eNetwork = eEthereumNetwork | ePolygonNetwork | eXDaiNetwork | eOptimismNetwork;
|
||||||
|
|
||||||
export enum eEthereumNetwork {
|
export enum eEthereumNetwork {
|
||||||
buidlerevm = 'buidlerevm',
|
buidlerevm = 'buidlerevm',
|
||||||
|
@ -25,6 +25,11 @@ export enum eXDaiNetwork {
|
||||||
xdai = 'xdai',
|
xdai = 'xdai',
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export enum eOptimismNetwork {
|
||||||
|
optimismKovan = 'optimismKovan',
|
||||||
|
optimism = 'optimism'
|
||||||
|
}
|
||||||
|
|
||||||
export enum EthereumNetworkNames {
|
export enum EthereumNetworkNames {
|
||||||
kovan = 'kovan',
|
kovan = 'kovan',
|
||||||
ropsten = 'ropsten',
|
ropsten = 'ropsten',
|
||||||
|
@ -32,12 +37,15 @@ export enum EthereumNetworkNames {
|
||||||
matic = 'matic',
|
matic = 'matic',
|
||||||
mumbai = 'mumbai',
|
mumbai = 'mumbai',
|
||||||
xdai = 'xdai',
|
xdai = 'xdai',
|
||||||
|
optimism = 'optimism',
|
||||||
|
optimismKovan = 'optimismKovan'
|
||||||
}
|
}
|
||||||
|
|
||||||
export enum AavePools {
|
export enum AavePools {
|
||||||
proto = 'proto',
|
proto = 'proto',
|
||||||
matic = 'matic',
|
matic = 'matic',
|
||||||
amm = 'amm',
|
amm = 'amm',
|
||||||
|
optimism = 'optimism'
|
||||||
}
|
}
|
||||||
|
|
||||||
export enum eContractid {
|
export enum eContractid {
|
||||||
|
@ -87,6 +95,9 @@ export enum eContractid {
|
||||||
UniswapLiquiditySwapAdapter = 'UniswapLiquiditySwapAdapter',
|
UniswapLiquiditySwapAdapter = 'UniswapLiquiditySwapAdapter',
|
||||||
UniswapRepayAdapter = 'UniswapRepayAdapter',
|
UniswapRepayAdapter = 'UniswapRepayAdapter',
|
||||||
FlashLiquidationAdapter = 'FlashLiquidationAdapter',
|
FlashLiquidationAdapter = 'FlashLiquidationAdapter',
|
||||||
|
LendingPoolBaseLogic = 'LendingPoolBaseLogic',
|
||||||
|
LendingPoolOtherLogic = 'LendingPoolOtherLogic',
|
||||||
|
ConfiguratorLogic = 'ConfiguratorLogic'
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -319,6 +330,11 @@ export type iXDAIPoolAssets<T> = Pick<
|
||||||
'DAI' | 'USDC' | 'USDT' | 'WBTC' | 'WETH' | 'STAKE'
|
'DAI' | 'USDC' | 'USDT' | 'WBTC' | 'WETH' | 'STAKE'
|
||||||
>;
|
>;
|
||||||
|
|
||||||
|
export type iOptimismPoolAssets<T> = Pick<
|
||||||
|
iAssetsWithoutUSD<T>,
|
||||||
|
'DAI' | 'USDC' | 'USDT' | 'WBTC' | 'WETH' | 'LINK' | 'AAVE'
|
||||||
|
>;
|
||||||
|
|
||||||
export type iMultiPoolsAssets<T> = iAssetCommon<T> | iAavePoolAssets<T>;
|
export type iMultiPoolsAssets<T> = iAssetCommon<T> | iAavePoolAssets<T>;
|
||||||
|
|
||||||
export type iAavePoolTokens<T> = Omit<iAavePoolAssets<T>, 'ETH'>;
|
export type iAavePoolTokens<T> = Omit<iAavePoolAssets<T>, 'ETH'>;
|
||||||
|
@ -410,12 +426,15 @@ export interface IMarketRates {
|
||||||
export type iParamsPerNetwork<T> =
|
export type iParamsPerNetwork<T> =
|
||||||
| iEthereumParamsPerNetwork<T>
|
| iEthereumParamsPerNetwork<T>
|
||||||
| iPolygonParamsPerNetwork<T>
|
| iPolygonParamsPerNetwork<T>
|
||||||
| iXDaiParamsPerNetwork<T>;
|
| iXDaiParamsPerNetwork<T>
|
||||||
|
| iOptimismParamsPerNetwork<T>;
|
||||||
|
|
||||||
export interface iParamsPerNetworkAll<T>
|
export interface iParamsPerNetworkAll<T>
|
||||||
extends iEthereumParamsPerNetwork<T>,
|
extends iEthereumParamsPerNetwork<T>,
|
||||||
iPolygonParamsPerNetwork<T>,
|
iPolygonParamsPerNetwork<T>,
|
||||||
iXDaiParamsPerNetwork<T> {}
|
iXDaiParamsPerNetwork<T>,
|
||||||
|
iOptimismParamsPerNetwork<T> {}
|
||||||
|
|
||||||
|
|
||||||
export interface iEthereumParamsPerNetwork<T> {
|
export interface iEthereumParamsPerNetwork<T> {
|
||||||
[eEthereumNetwork.coverage]: T;
|
[eEthereumNetwork.coverage]: T;
|
||||||
|
@ -436,10 +455,16 @@ export interface iXDaiParamsPerNetwork<T> {
|
||||||
[eXDaiNetwork.xdai]: T;
|
[eXDaiNetwork.xdai]: T;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export interface iOptimismParamsPerNetwork<T> {
|
||||||
|
[eOptimismNetwork.optimismKovan]: T;
|
||||||
|
[eOptimismNetwork.optimism]: T;
|
||||||
|
}
|
||||||
|
|
||||||
export interface iParamsPerPool<T> {
|
export interface iParamsPerPool<T> {
|
||||||
[AavePools.proto]: T;
|
[AavePools.proto]: T;
|
||||||
[AavePools.matic]: T;
|
[AavePools.matic]: T;
|
||||||
[AavePools.amm]: T;
|
[AavePools.amm]: T;
|
||||||
|
[AavePools.optimism]: T;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface iBasicDistributionParams {
|
export interface iBasicDistributionParams {
|
||||||
|
@ -535,6 +560,10 @@ export interface IXDAIConfiguration extends ICommonConfiguration {
|
||||||
ReservesConfig: iXDAIPoolAssets<IReserveParams>;
|
ReservesConfig: iXDAIPoolAssets<IReserveParams>;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export interface IOptimismConfiguration extends ICommonConfiguration {
|
||||||
|
ReservesConfig: iOptimismPoolAssets<IReserveParams>;
|
||||||
|
}
|
||||||
|
|
||||||
export interface ITokenAddress {
|
export interface ITokenAddress {
|
||||||
[token: string]: tEthereumAddress;
|
[token: string]: tEthereumAddress;
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,166 @@
|
||||||
|
import {
|
||||||
|
oneRay,
|
||||||
|
ZERO_ADDRESS,
|
||||||
|
MOCK_CHAINLINK_AGGREGATORS_PRICES,
|
||||||
|
oneUsd,
|
||||||
|
} from '../../helpers/constants';
|
||||||
|
import { ICommonConfiguration, eOptimismNetwork } from '../../helpers/types';
|
||||||
|
|
||||||
|
// ----------------
|
||||||
|
// PROTOCOL GLOBAL PARAMS
|
||||||
|
// ----------------
|
||||||
|
|
||||||
|
export const CommonsConfig: ICommonConfiguration = {
|
||||||
|
MarketId: 'Commons',
|
||||||
|
ATokenNamePrefix: 'Aave Optimism Market',
|
||||||
|
StableDebtTokenNamePrefix: 'Aave Optimism Market stable debt',
|
||||||
|
VariableDebtTokenNamePrefix: 'Aave Optimism Market variable debt',
|
||||||
|
SymbolPrefix: '', // TODO: add a symbol?
|
||||||
|
ProviderId: 0, // Overriden in index.ts
|
||||||
|
OracleQuoteCurrency: 'USD',
|
||||||
|
OracleQuoteUnit: oneUsd.toString(),
|
||||||
|
ProtocolGlobalParams: {
|
||||||
|
TokenDistributorPercentageBase: '10000',
|
||||||
|
MockUsdPriceInWei: '5848466240000000',
|
||||||
|
UsdAddress: '0x10F7Fc1F91Ba351f9C629c5947AD69bD03C05b96', // TODO: what is this?
|
||||||
|
NilAddress: '0x0000000000000000000000000000000000000000',
|
||||||
|
OneAddress: '0x0000000000000000000000000000000000000001',
|
||||||
|
AaveReferral: '0',
|
||||||
|
},
|
||||||
|
|
||||||
|
// ----------------
|
||||||
|
// COMMON PROTOCOL PARAMS ACROSS POOLS AND NETWORKS
|
||||||
|
// ----------------
|
||||||
|
|
||||||
|
Mocks: {
|
||||||
|
AllAssetsInitialPrices: {
|
||||||
|
...MOCK_CHAINLINK_AGGREGATORS_PRICES,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
// TODO: reorg alphabetically, checking the reason of tests failing
|
||||||
|
LendingRateOracleRatesCommon: {
|
||||||
|
WETH: {
|
||||||
|
borrowRate: oneRay.multipliedBy(0.03).toFixed(),
|
||||||
|
},
|
||||||
|
DAI: {
|
||||||
|
borrowRate: oneRay.multipliedBy(0.039).toFixed(),
|
||||||
|
},
|
||||||
|
USDC: {
|
||||||
|
borrowRate: oneRay.multipliedBy(0.039).toFixed(),
|
||||||
|
},
|
||||||
|
USDT: {
|
||||||
|
borrowRate: oneRay.multipliedBy(0.035).toFixed(),
|
||||||
|
},
|
||||||
|
AAVE: {
|
||||||
|
borrowRate: oneRay.multipliedBy(0.03).toFixed(),
|
||||||
|
},
|
||||||
|
WBTC: {
|
||||||
|
borrowRate: oneRay.multipliedBy(0.03).toFixed(),
|
||||||
|
},
|
||||||
|
LINK: {
|
||||||
|
borrowRate: oneRay.multipliedBy(0.03).toFixed(),
|
||||||
|
},
|
||||||
|
},
|
||||||
|
// ----------------
|
||||||
|
// COMMON PROTOCOL ADDRESSES ACROSS POOLS
|
||||||
|
// ----------------
|
||||||
|
|
||||||
|
// If PoolAdmin/emergencyAdmin is set, will take priority over PoolAdminIndex/emergencyAdminIndex
|
||||||
|
PoolAdmin: {
|
||||||
|
[eOptimismNetwork.optimismKovan]: undefined,
|
||||||
|
[eOptimismNetwork.optimism]: undefined,
|
||||||
|
},
|
||||||
|
PoolAdminIndex: 0,
|
||||||
|
EmergencyAdminIndex: 0,
|
||||||
|
EmergencyAdmin: {
|
||||||
|
[eOptimismNetwork.optimism]: undefined,
|
||||||
|
[eOptimismNetwork.optimismKovan]: undefined,
|
||||||
|
},
|
||||||
|
ProviderRegistry: {
|
||||||
|
[eOptimismNetwork.optimism]: '',
|
||||||
|
[eOptimismNetwork.optimismKovan]: '0x18AF64027c1E17e99e5709E42174151F9f62C622',
|
||||||
|
},
|
||||||
|
ProviderRegistryOwner: {
|
||||||
|
[eOptimismNetwork.optimism]: '',
|
||||||
|
[eOptimismNetwork.optimismKovan]: '0xA68E2f643e0fa7062A78DFB6C629577aE21ad829',
|
||||||
|
},
|
||||||
|
LendingRateOracle: {
|
||||||
|
[eOptimismNetwork.optimism]: '',
|
||||||
|
[eOptimismNetwork.optimismKovan]: '0xf4fE2aBdcC90c80188E16A0aBc065da7e90cC0C9',
|
||||||
|
},
|
||||||
|
LendingPoolCollateralManager: {
|
||||||
|
[eOptimismNetwork.optimism]: '',
|
||||||
|
[eOptimismNetwork.optimismKovan]: '0xb4beffF48e24785F787c13EeF7366467477f8202',
|
||||||
|
},
|
||||||
|
LendingPoolConfigurator: {
|
||||||
|
[eOptimismNetwork.optimism]: '',
|
||||||
|
[eOptimismNetwork.optimismKovan]: '',
|
||||||
|
},
|
||||||
|
LendingPool: {
|
||||||
|
[eOptimismNetwork.optimism]: '',
|
||||||
|
[eOptimismNetwork.optimismKovan]: '',
|
||||||
|
},
|
||||||
|
WethGateway: {
|
||||||
|
[eOptimismNetwork.optimism]: '',
|
||||||
|
[eOptimismNetwork.optimismKovan]: '0x9B0C9d5a030915F01aB4962D52D54c03cf37D2ce',
|
||||||
|
},
|
||||||
|
TokenDistributor: {
|
||||||
|
[eOptimismNetwork.optimism]: '',
|
||||||
|
[eOptimismNetwork.optimismKovan]: '',
|
||||||
|
},
|
||||||
|
AaveOracle: {
|
||||||
|
[eOptimismNetwork.optimism]: '',
|
||||||
|
[eOptimismNetwork.optimismKovan]: '0xB6a4826e2e37118440B446C8Ff42D9b617b0844C',
|
||||||
|
},
|
||||||
|
FallbackOracle: {
|
||||||
|
[eOptimismNetwork.optimism]: ZERO_ADDRESS,
|
||||||
|
[eOptimismNetwork.optimismKovan]: ZERO_ADDRESS, // TODO: Deploy?
|
||||||
|
},
|
||||||
|
ChainlinkAggregator: {
|
||||||
|
[eOptimismNetwork.optimism]: {
|
||||||
|
WETH: '',
|
||||||
|
DAI: '',
|
||||||
|
USDC: '',
|
||||||
|
USDT: '',
|
||||||
|
AAVE: '',
|
||||||
|
WBTC: '',
|
||||||
|
LINK: '',
|
||||||
|
USD: '',
|
||||||
|
},
|
||||||
|
[eOptimismNetwork.optimismKovan]: {
|
||||||
|
WETH: '0xB438eADc39Ff9B3EaCA2e8ada6E9D74338f0B02D', // MOCK
|
||||||
|
DAI: '0xa269EC2e011d07045Eaef98db5fA6F4399c01768', // MOCK
|
||||||
|
USDC: '0x9E4702B6079BD54A5889E0104515fa87f4BB55AF', // MOCK
|
||||||
|
// USDT: '',
|
||||||
|
// AAVE: '',
|
||||||
|
WBTC: '0x662807E8d69168c89743DAB7b3e3aE18b37cAD8a', // RANDOM
|
||||||
|
// LINK: '',
|
||||||
|
USD: '0xB438eADc39Ff9B3EaCA2e8ada6E9D74338f0B02D', // MOCK
|
||||||
|
},
|
||||||
|
},
|
||||||
|
ReserveAssets: {
|
||||||
|
[eOptimismNetwork.optimism]: {},
|
||||||
|
[eOptimismNetwork.optimismKovan]: {},
|
||||||
|
},
|
||||||
|
ReservesConfig: {},
|
||||||
|
ATokenDomainSeparator: {
|
||||||
|
[eOptimismNetwork.optimism]: '',
|
||||||
|
[eOptimismNetwork.optimismKovan]: '',
|
||||||
|
},
|
||||||
|
WETH: {
|
||||||
|
[eOptimismNetwork.optimism]: '0x4200000000000000000000000000000000000006', // TODO: WETH
|
||||||
|
[eOptimismNetwork.optimismKovan]: '0x4200000000000000000000000000000000000006', // TODO: WETH
|
||||||
|
},
|
||||||
|
WrappedNativeToken: {
|
||||||
|
[eOptimismNetwork.optimism]: '0x4200000000000000000000000000000000000006', // WETH
|
||||||
|
[eOptimismNetwork.optimismKovan]: '0x4200000000000000000000000000000000000006', // WETH
|
||||||
|
},
|
||||||
|
ReserveFactorTreasuryAddress: {
|
||||||
|
[eOptimismNetwork.optimism]: '0x652e2Ac6b072Ba8bF7BEF2B11B092447dBc40bde', // TODO: Deploy Treasury
|
||||||
|
[eOptimismNetwork.optimismKovan]: '0x652e2Ac6b072Ba8bF7BEF2B11B092447dBc40bde',
|
||||||
|
},
|
||||||
|
IncentivesController: {
|
||||||
|
[eOptimismNetwork.optimism]: ZERO_ADDRESS,
|
||||||
|
[eOptimismNetwork.optimismKovan]: ZERO_ADDRESS,
|
||||||
|
},
|
||||||
|
};
|
|
@ -1 +1,53 @@
|
||||||
|
import { eOptimismNetwork, IOptimismConfiguration } from '../../helpers/types';
|
||||||
|
|
||||||
|
import { CommonsConfig } from './commons';
|
||||||
|
import {
|
||||||
|
strategyWETH,
|
||||||
|
strategyDAI,
|
||||||
|
strategyUSDC,
|
||||||
|
strategyUSDT,
|
||||||
|
strategyAAVE,
|
||||||
|
strategyWBTC,
|
||||||
|
strategyLINK,
|
||||||
|
} from './reservesConfigs';
|
||||||
|
|
||||||
|
// ----------------
|
||||||
|
// POOL--SPECIFIC PARAMS
|
||||||
|
// ----------------
|
||||||
|
|
||||||
|
export const OptimismConfig: IOptimismConfiguration = {
|
||||||
|
...CommonsConfig,
|
||||||
|
MarketId: 'Avalanche market',
|
||||||
|
ProviderId: 5, // TODO: What is this?
|
||||||
|
ReservesConfig: {
|
||||||
|
WETH: strategyWETH,
|
||||||
|
DAI: strategyDAI,
|
||||||
|
USDC: strategyUSDC,
|
||||||
|
USDT: strategyUSDT,
|
||||||
|
AAVE: strategyAAVE,
|
||||||
|
WBTC: strategyWBTC,
|
||||||
|
LINK: strategyLINK,
|
||||||
|
},
|
||||||
|
ReserveAssets: {
|
||||||
|
[eOptimismNetwork.optimism]: { // TODO: Check this
|
||||||
|
WETH: '0x4200000000000000000000000000000000000006',
|
||||||
|
// DAI: '',
|
||||||
|
// USDC: '', // TODO:
|
||||||
|
// USDT: '',
|
||||||
|
// AAVE: '', // TODO:
|
||||||
|
// WBTC: '',
|
||||||
|
// LINK: ''
|
||||||
|
},
|
||||||
|
[eOptimismNetwork.optimismKovan]: { // TODO: Deploy Mock tokens
|
||||||
|
WETH: '0x4200000000000000000000000000000000000006',
|
||||||
|
DAI: '0x47ee20342BC51ED759F0971cc96C31177ebc81Ae',
|
||||||
|
USDC: '0x4de9ee3d1F33676e505CA3747993929c29802293',
|
||||||
|
// USDT: '0x871091955225468eA25862A9C40147c698c20164',
|
||||||
|
// AAVE: '0xe84b739b6B5d057301cB49c30C7783158Ba2Ded0',
|
||||||
|
WBTC: '0x0706661fe3FB1f9b3D10DdFb3A30fBB709BC7D59',
|
||||||
|
// LINK: '0x5a5Fcf7Aa05Beb73A78D5d19b9f7eB8009454B73'
|
||||||
|
},
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
|
export default OptimismConfig;
|
||||||
|
|
|
@ -0,0 +1,102 @@
|
||||||
|
import BigNumber from 'bignumber.js';
|
||||||
|
import { oneRay } from '../../helpers/constants';
|
||||||
|
import { IInterestRateStrategyParams } from '../../helpers/types';
|
||||||
|
|
||||||
|
// BUSD SUSD
|
||||||
|
export const rateStrategyStableOne: IInterestRateStrategyParams = {
|
||||||
|
name: "rateStrategyStableOne",
|
||||||
|
optimalUtilizationRate: new BigNumber(0.8).multipliedBy(oneRay).toFixed(),
|
||||||
|
baseVariableBorrowRate: new BigNumber(0).multipliedBy(oneRay).toFixed(),
|
||||||
|
variableRateSlope1: new BigNumber(0.04).multipliedBy(oneRay).toFixed(),
|
||||||
|
variableRateSlope2: new BigNumber(1).multipliedBy(oneRay).toFixed(),
|
||||||
|
stableRateSlope1: '0',
|
||||||
|
stableRateSlope2: '0',
|
||||||
|
};
|
||||||
|
|
||||||
|
// DAI TUSD
|
||||||
|
export const rateStrategyStableTwo: IInterestRateStrategyParams = {
|
||||||
|
name: "rateStrategyStableTwo",
|
||||||
|
optimalUtilizationRate: new BigNumber(0.8).multipliedBy(oneRay).toFixed(),
|
||||||
|
baseVariableBorrowRate: new BigNumber(0).multipliedBy(oneRay).toFixed(),
|
||||||
|
variableRateSlope1: new BigNumber(0.04).multipliedBy(oneRay).toFixed(),
|
||||||
|
variableRateSlope2: new BigNumber(0.75).multipliedBy(oneRay).toFixed(),
|
||||||
|
stableRateSlope1: new BigNumber(0.02).multipliedBy(oneRay).toFixed(),
|
||||||
|
stableRateSlope2: new BigNumber(0.75).multipliedBy(oneRay).toFixed(),
|
||||||
|
}
|
||||||
|
|
||||||
|
// USDC USDT
|
||||||
|
export const rateStrategyStableThree: IInterestRateStrategyParams = {
|
||||||
|
name: "rateStrategyStableThree",
|
||||||
|
optimalUtilizationRate: new BigNumber(0.9).multipliedBy(oneRay).toFixed(),
|
||||||
|
baseVariableBorrowRate: new BigNumber(0).multipliedBy(oneRay).toFixed(),
|
||||||
|
variableRateSlope1: new BigNumber(0.04).multipliedBy(oneRay).toFixed(),
|
||||||
|
variableRateSlope2: new BigNumber(0.60).multipliedBy(oneRay).toFixed(),
|
||||||
|
stableRateSlope1: new BigNumber(0.02).multipliedBy(oneRay).toFixed(),
|
||||||
|
stableRateSlope2: new BigNumber(0.60).multipliedBy(oneRay).toFixed(),
|
||||||
|
}
|
||||||
|
|
||||||
|
// WETH
|
||||||
|
export const rateStrategyWETH: IInterestRateStrategyParams = {
|
||||||
|
name: "rateStrategyWETH",
|
||||||
|
optimalUtilizationRate: new BigNumber(0.65).multipliedBy(oneRay).toFixed(),
|
||||||
|
baseVariableBorrowRate: new BigNumber(0).multipliedBy(oneRay).toFixed(),
|
||||||
|
variableRateSlope1: new BigNumber(0.08).multipliedBy(oneRay).toFixed(),
|
||||||
|
variableRateSlope2: new BigNumber(1).multipliedBy(oneRay).toFixed(),
|
||||||
|
stableRateSlope1: new BigNumber(0.1).multipliedBy(oneRay).toFixed(),
|
||||||
|
stableRateSlope2: new BigNumber(1).multipliedBy(oneRay).toFixed(),
|
||||||
|
}
|
||||||
|
|
||||||
|
// AAVE
|
||||||
|
export const rateStrategyAAVE: IInterestRateStrategyParams = {
|
||||||
|
name: "rateStrategyAAVE",
|
||||||
|
optimalUtilizationRate: new BigNumber(0.45).multipliedBy(oneRay).toFixed(),
|
||||||
|
baseVariableBorrowRate: '0',
|
||||||
|
variableRateSlope1: '0',
|
||||||
|
variableRateSlope2: '0',
|
||||||
|
stableRateSlope1: '0',
|
||||||
|
stableRateSlope2: '0',
|
||||||
|
}
|
||||||
|
|
||||||
|
// BAT ENJ LINK MANA MKR REN YFI ZRX
|
||||||
|
export const rateStrategyVolatileOne: IInterestRateStrategyParams = {
|
||||||
|
name: "rateStrategyVolatileOne",
|
||||||
|
optimalUtilizationRate: new BigNumber(0.45).multipliedBy(oneRay).toFixed(),
|
||||||
|
baseVariableBorrowRate: new BigNumber(0).multipliedBy(oneRay).toFixed(),
|
||||||
|
variableRateSlope1: new BigNumber(0.07).multipliedBy(oneRay).toFixed(),
|
||||||
|
variableRateSlope2: new BigNumber(3).multipliedBy(oneRay).toFixed(),
|
||||||
|
stableRateSlope1: new BigNumber(0.1).multipliedBy(oneRay).toFixed(),
|
||||||
|
stableRateSlope2: new BigNumber(3).multipliedBy(oneRay).toFixed(),
|
||||||
|
}
|
||||||
|
|
||||||
|
// KNC WBTC
|
||||||
|
export const rateStrategyVolatileTwo: IInterestRateStrategyParams = {
|
||||||
|
name: "rateStrategyVolatileTwo",
|
||||||
|
optimalUtilizationRate: new BigNumber(0.65).multipliedBy(oneRay).toFixed(),
|
||||||
|
baseVariableBorrowRate: new BigNumber(0).multipliedBy(oneRay).toFixed(),
|
||||||
|
variableRateSlope1: new BigNumber(0.08).multipliedBy(oneRay).toFixed(),
|
||||||
|
variableRateSlope2: new BigNumber(3).multipliedBy(oneRay).toFixed(),
|
||||||
|
stableRateSlope1: new BigNumber(0.1).multipliedBy(oneRay).toFixed(),
|
||||||
|
stableRateSlope2: new BigNumber(3).multipliedBy(oneRay).toFixed(),
|
||||||
|
}
|
||||||
|
|
||||||
|
// SNX
|
||||||
|
export const rateStrategyVolatileThree: IInterestRateStrategyParams = {
|
||||||
|
name: "rateStrategyVolatileThree",
|
||||||
|
optimalUtilizationRate: new BigNumber(0.65).multipliedBy(oneRay).toFixed(),
|
||||||
|
baseVariableBorrowRate: new BigNumber(0).multipliedBy(oneRay).toFixed(),
|
||||||
|
variableRateSlope1: new BigNumber(0.08).multipliedBy(oneRay).toFixed(),
|
||||||
|
variableRateSlope2: new BigNumber(3).multipliedBy(oneRay).toFixed(),
|
||||||
|
stableRateSlope1: new BigNumber(0.1).multipliedBy(oneRay).toFixed(),
|
||||||
|
stableRateSlope2: new BigNumber(3).multipliedBy(oneRay).toFixed(),
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
export const rateStrategyVolatileFour: IInterestRateStrategyParams = {
|
||||||
|
name: "rateStrategyVolatileFour",
|
||||||
|
optimalUtilizationRate: new BigNumber(0.45).multipliedBy(oneRay).toFixed(),
|
||||||
|
baseVariableBorrowRate: '0',
|
||||||
|
variableRateSlope1: new BigNumber(0.07).multipliedBy(oneRay).toFixed(),
|
||||||
|
variableRateSlope2: new BigNumber(3).multipliedBy(oneRay).toFixed(),
|
||||||
|
stableRateSlope1: '0',
|
||||||
|
stableRateSlope2: '0',
|
||||||
|
}
|
|
@ -0,0 +1,111 @@
|
||||||
|
import { eContractid, IReserveParams } from '../../helpers/types';
|
||||||
|
|
||||||
|
import {
|
||||||
|
rateStrategyStableOne,
|
||||||
|
rateStrategyStableTwo,
|
||||||
|
rateStrategyStableThree,
|
||||||
|
rateStrategyWETH,
|
||||||
|
rateStrategyAAVE,
|
||||||
|
rateStrategyVolatileOne,
|
||||||
|
rateStrategyVolatileTwo,
|
||||||
|
rateStrategyVolatileThree,
|
||||||
|
rateStrategyVolatileFour,
|
||||||
|
} from './rateStrategies';
|
||||||
|
|
||||||
|
export const strategyDAI: IReserveParams = {
|
||||||
|
strategy: rateStrategyStableTwo,
|
||||||
|
baseLTVAsCollateral: '7500',
|
||||||
|
liquidationThreshold: '8000',
|
||||||
|
liquidationBonus: '10500',
|
||||||
|
borrowingEnabled: true,
|
||||||
|
stableBorrowRateEnabled: true,
|
||||||
|
reserveDecimals: '18',
|
||||||
|
aTokenImpl: eContractid.AToken,
|
||||||
|
reserveFactor: '1000',
|
||||||
|
borrowCap: '0',
|
||||||
|
supplyCap: '0',
|
||||||
|
};
|
||||||
|
|
||||||
|
export const strategyUSDC: IReserveParams = {
|
||||||
|
strategy: rateStrategyStableThree,
|
||||||
|
baseLTVAsCollateral: '8000',
|
||||||
|
liquidationThreshold: '8500',
|
||||||
|
liquidationBonus: '10500',
|
||||||
|
borrowingEnabled: true,
|
||||||
|
stableBorrowRateEnabled: true,
|
||||||
|
reserveDecimals: '6',
|
||||||
|
aTokenImpl: eContractid.AToken,
|
||||||
|
reserveFactor: '1000',
|
||||||
|
borrowCap: '0',
|
||||||
|
supplyCap: '0',
|
||||||
|
};
|
||||||
|
|
||||||
|
export const strategyUSDT: IReserveParams = {
|
||||||
|
strategy: rateStrategyStableThree,
|
||||||
|
baseLTVAsCollateral: '8000',
|
||||||
|
liquidationThreshold: '8500',
|
||||||
|
liquidationBonus: '10500',
|
||||||
|
borrowingEnabled: true,
|
||||||
|
stableBorrowRateEnabled: true,
|
||||||
|
reserveDecimals: '6',
|
||||||
|
aTokenImpl: eContractid.AToken,
|
||||||
|
reserveFactor: '1000',
|
||||||
|
borrowCap: '0',
|
||||||
|
supplyCap: '0',
|
||||||
|
};
|
||||||
|
|
||||||
|
export const strategyAAVE: IReserveParams = {
|
||||||
|
strategy: rateStrategyAAVE,
|
||||||
|
baseLTVAsCollateral: '5000',
|
||||||
|
liquidationThreshold: '6500',
|
||||||
|
liquidationBonus: '11000',
|
||||||
|
borrowingEnabled: false,
|
||||||
|
stableBorrowRateEnabled: false,
|
||||||
|
reserveDecimals: '18',
|
||||||
|
aTokenImpl: eContractid.AToken,
|
||||||
|
reserveFactor: '0',
|
||||||
|
borrowCap: '0',
|
||||||
|
supplyCap: '0',
|
||||||
|
};
|
||||||
|
|
||||||
|
export const strategyWETH: IReserveParams = {
|
||||||
|
strategy: rateStrategyWETH,
|
||||||
|
baseLTVAsCollateral: '8000',
|
||||||
|
liquidationThreshold: '8250',
|
||||||
|
liquidationBonus: '10500',
|
||||||
|
borrowingEnabled: true,
|
||||||
|
stableBorrowRateEnabled: true,
|
||||||
|
reserveDecimals: '18',
|
||||||
|
aTokenImpl: eContractid.AToken,
|
||||||
|
reserveFactor: '1000',
|
||||||
|
borrowCap: '0',
|
||||||
|
supplyCap: '0',
|
||||||
|
};
|
||||||
|
|
||||||
|
export const strategyLINK: IReserveParams = {
|
||||||
|
strategy: rateStrategyVolatileOne,
|
||||||
|
baseLTVAsCollateral: '7000',
|
||||||
|
liquidationThreshold: '7500',
|
||||||
|
liquidationBonus: '11000',
|
||||||
|
borrowingEnabled: true,
|
||||||
|
stableBorrowRateEnabled: true,
|
||||||
|
reserveDecimals: '18',
|
||||||
|
aTokenImpl: eContractid.AToken,
|
||||||
|
reserveFactor: '2000',
|
||||||
|
borrowCap: '0',
|
||||||
|
supplyCap: '0',
|
||||||
|
};
|
||||||
|
|
||||||
|
export const strategyWBTC: IReserveParams = {
|
||||||
|
strategy: rateStrategyVolatileTwo,
|
||||||
|
baseLTVAsCollateral: '7000',
|
||||||
|
liquidationThreshold: '7500',
|
||||||
|
liquidationBonus: '11000',
|
||||||
|
borrowingEnabled: true,
|
||||||
|
stableBorrowRateEnabled: true,
|
||||||
|
reserveDecimals: '8',
|
||||||
|
aTokenImpl: eContractid.AToken,
|
||||||
|
reserveFactor: '2000',
|
||||||
|
borrowCap: '0',
|
||||||
|
supplyCap: '0',
|
||||||
|
};
|
60
tasks/migrations/optimism.mainnet.ts
Normal file
60
tasks/migrations/optimism.mainnet.ts
Normal file
|
@ -0,0 +1,60 @@
|
||||||
|
import { task } from 'hardhat/config';
|
||||||
|
import { checkVerification } from '../../helpers/etherscan-verification';
|
||||||
|
import { ConfigNames } from '../../helpers/configuration';
|
||||||
|
import { printContracts } from '../../helpers/misc-utils';
|
||||||
|
import { usingTenderly } from '../../helpers/tenderly-utils';
|
||||||
|
|
||||||
|
task('optimism:mainnet', 'Deploy market at Optimism')
|
||||||
|
.addParam('pool', `Market pool configuration, one of ${Object.keys(ConfigNames)}`)
|
||||||
|
.addFlag('verify', 'Verify contracts at Etherscan')
|
||||||
|
.addFlag('skipRegistry', 'Skip addresses provider registration at Addresses Provider Registry')
|
||||||
|
.setAction(async ({ verify, pool, skipRegistry }, DRE) => {
|
||||||
|
const POOL_NAME = pool;
|
||||||
|
await DRE.run('set-DRE');
|
||||||
|
|
||||||
|
// Prevent loss of gas verifying all the needed ENVs for Etherscan verification
|
||||||
|
if (verify) {
|
||||||
|
checkVerification();
|
||||||
|
}
|
||||||
|
|
||||||
|
console.log('Migration started\n');
|
||||||
|
|
||||||
|
console.log('0. Deploy address provider registry');
|
||||||
|
await DRE.run('full:deploy-address-provider-registry', { pool: POOL_NAME });
|
||||||
|
|
||||||
|
console.log('1. Deploy address provider');
|
||||||
|
await DRE.run('full:deploy-address-provider', { pool: POOL_NAME, skipRegistry });
|
||||||
|
|
||||||
|
console.log('2. Deploy lending pool');
|
||||||
|
await DRE.run('full:deploy-lending-pool', { pool: POOL_NAME });
|
||||||
|
|
||||||
|
console.log('3. Deploy oracles');
|
||||||
|
await DRE.run('full:deploy-oracles', { pool: POOL_NAME });
|
||||||
|
|
||||||
|
console.log('4. Deploy Data Provider');
|
||||||
|
await DRE.run('full:data-provider', { pool: POOL_NAME });
|
||||||
|
console.log('5. Deploy WETH Gateway');
|
||||||
|
await DRE.run('full-deploy-weth-gateway', { pool: POOL_NAME });
|
||||||
|
|
||||||
|
console.log('6. Initialize lending pool');
|
||||||
|
await DRE.run('full:initialize-lending-pool', { pool: POOL_NAME });
|
||||||
|
|
||||||
|
if (verify) {
|
||||||
|
printContracts();
|
||||||
|
console.log('7. Veryfing contracts');
|
||||||
|
await DRE.run('verify:general', { all: true, pool: POOL_NAME });
|
||||||
|
|
||||||
|
console.log('8. Veryfing aTokens and debtTokens');
|
||||||
|
await DRE.run('verify:tokens', { pool: POOL_NAME });
|
||||||
|
}
|
||||||
|
|
||||||
|
if (usingTenderly()) {
|
||||||
|
const postDeployHead = DRE.tenderlyNetwork.getHead();
|
||||||
|
const postDeployFork = DRE.tenderlyNetwork.getFork();
|
||||||
|
console.log('Tenderly Info');
|
||||||
|
console.log('- Head', postDeployHead);
|
||||||
|
console.log('- Fork', postDeployFork);
|
||||||
|
}
|
||||||
|
console.log('\nFinished migrations');
|
||||||
|
printContracts();
|
||||||
|
});
|
Loading…
Reference in New Issue
Block a user