mirror of
https://github.com/Instadapp/aave-protocol-v2.git
synced 2024-07-29 21:47:30 +00:00
refactor: refactored migration scripts and Arc configuration
This commit is contained in:
parent
fd9e49fc4b
commit
c9b88505a8
|
@ -8,7 +8,7 @@ import {
|
|||
} from './types';
|
||||
import { getEthersSignersAddresses, getParamPerPool } from './contracts-helpers';
|
||||
import AaveConfig from '../markets/aave';
|
||||
import AaveProConfig from '../markets/aave-pro';
|
||||
import AaveArcConfig from '../markets/aave-arc';
|
||||
import MaticConfig from '../markets/matic';
|
||||
import AmmConfig from '../markets/amm';
|
||||
import { CommonsConfig } from '../markets/aave/commons';
|
||||
|
@ -22,7 +22,7 @@ export enum ConfigNames {
|
|||
Aave = 'Aave',
|
||||
Matic = 'Matic',
|
||||
Amm = 'Amm',
|
||||
AavePro = 'AavePro'
|
||||
Arc = 'Arc'
|
||||
}
|
||||
|
||||
export const loadPoolConfig = (configName: ConfigNames): PoolConfiguration => {
|
||||
|
@ -35,8 +35,8 @@ export const loadPoolConfig = (configName: ConfigNames): PoolConfiguration => {
|
|||
return AmmConfig;
|
||||
case ConfigNames.Commons:
|
||||
return CommonsConfig;
|
||||
case ConfigNames.AavePro:
|
||||
return AaveProConfig;
|
||||
case ConfigNames.Arc:
|
||||
return AaveArcConfig;
|
||||
default:
|
||||
throw new Error(`Unsupported pool configuration: ${Object.values(ConfigNames)}`);
|
||||
}
|
||||
|
@ -57,6 +57,9 @@ export const getReservesConfigByPool = (pool: AavePools): iMultiPoolsAssets<IRes
|
|||
[AavePools.matic]: {
|
||||
...MaticConfig.ReservesConfig,
|
||||
},
|
||||
[AavePools.arc]: {
|
||||
...AaveArcConfig.ReservesConfig
|
||||
}
|
||||
},
|
||||
pool
|
||||
);
|
||||
|
|
|
@ -180,7 +180,7 @@ export const getParamPerNetwork = <T>(param: iParamsPerNetwork<T>, network: eNet
|
|||
}
|
||||
};
|
||||
|
||||
export const getParamPerPool = <T>({ proto, amm, matic }: iParamsPerPool<T>, pool: AavePools) => {
|
||||
export const getParamPerPool = <T>({ proto, amm, matic, arc }: iParamsPerPool<T>, pool: AavePools) => {
|
||||
switch (pool) {
|
||||
case AavePools.proto:
|
||||
return proto;
|
||||
|
@ -188,6 +188,8 @@ export const getParamPerPool = <T>({ proto, amm, matic }: iParamsPerPool<T>, poo
|
|||
return amm;
|
||||
case AavePools.matic:
|
||||
return matic;
|
||||
case AavePools.arc:
|
||||
return arc;
|
||||
default:
|
||||
return proto;
|
||||
}
|
||||
|
|
|
@ -18,7 +18,7 @@ export const getDefenderRelaySigner = async () => {
|
|||
const credentials = { apiKey: DEFENDER_API_KEY, apiSecret: DEFENDER_SECRET_KEY };
|
||||
|
||||
defenderSigner = new DefenderRelaySigner(credentials, new DefenderRelayProvider(credentials), {
|
||||
speed: 'fast',
|
||||
speed: 'fastest',
|
||||
});
|
||||
|
||||
const defenderAddress = await defenderSigner.getAddress();
|
||||
|
|
|
@ -38,6 +38,7 @@ export enum AavePools {
|
|||
proto = 'proto',
|
||||
matic = 'matic',
|
||||
amm = 'amm',
|
||||
arc = 'arc'
|
||||
}
|
||||
|
||||
export enum eContractid {
|
||||
|
@ -275,7 +276,7 @@ export type iAavePoolAssets<T> = Pick<
|
|||
| 'xSUSHI'
|
||||
>;
|
||||
|
||||
export type iAaveProPoolAssets<T> = Pick<
|
||||
export type iAaveArcPoolAssets<T> = Pick<
|
||||
iAssetsWithoutUSD<T>,
|
||||
'USDC' | 'WBTC' | 'WETH' | 'AAVE'
|
||||
>;
|
||||
|
@ -436,6 +437,7 @@ export interface iParamsPerPool<T> {
|
|||
[AavePools.proto]: T;
|
||||
[AavePools.matic]: T;
|
||||
[AavePools.amm]: T;
|
||||
[AavePools.arc]: T;
|
||||
}
|
||||
|
||||
export interface iBasicDistributionParams {
|
||||
|
@ -513,8 +515,8 @@ export interface IAaveConfiguration extends ICommonConfiguration {
|
|||
ReservesConfig: iAavePoolAssets<IReserveParams>;
|
||||
}
|
||||
|
||||
export interface IAaveProConfiguration extends ICommonConfiguration {
|
||||
ReservesConfig: iAaveProPoolAssets<IReserveParams>;
|
||||
export interface IAaveArcConfiguration extends ICommonConfiguration {
|
||||
ReservesConfig: iAaveArcPoolAssets<IReserveParams>;
|
||||
}
|
||||
export interface IAmmConfiguration extends ICommonConfiguration {
|
||||
ReservesConfig: iLpPoolAssets<IReserveParams>;
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import { ZERO_ADDRESS } from '../../helpers/constants';
|
||||
import { IAaveProConfiguration, eEthereumNetwork, eContractid } from '../../helpers/types';
|
||||
import { IAaveArcConfiguration, eEthereumNetwork, eContractid } from '../../helpers/types';
|
||||
|
||||
import { CommonsConfig } from './commons';
|
||||
import {
|
||||
|
@ -13,9 +13,9 @@ import {
|
|||
// POOL--SPECIFIC PARAMS
|
||||
// ----------------
|
||||
|
||||
export const AaveConfig: IAaveProConfiguration = {
|
||||
export const AaveArcConfig: IAaveArcConfiguration = {
|
||||
...CommonsConfig,
|
||||
MarketId: 'Aave Pro market',
|
||||
MarketId: 'Aave Arc market',
|
||||
ProviderId: 1,
|
||||
LendingPoolImpl: eContractid.PermissionedLendingPool,
|
||||
ReservesConfig: {
|
||||
|
@ -55,4 +55,4 @@ export const AaveConfig: IAaveProConfiguration = {
|
|||
}
|
||||
};
|
||||
|
||||
export default AaveConfig;
|
||||
export default AaveArcConfig;
|
|
@ -106,7 +106,7 @@ task('full:initialize-lending-pool', 'Initialize lending pool configuration.')
|
|||
|
||||
let gateWay = getParamPerNetwork(WethGateway, network);
|
||||
if (!notFalsyOrZeroAddress(gateWay)) {
|
||||
if (pool === ConfigNames.AavePro) {
|
||||
if (pool === ConfigNames.Arc) {
|
||||
gateWay = (await getPermissionedWETHGateway()).address;
|
||||
} else {
|
||||
gateWay = (await getWETHGateway()).address;
|
||||
|
|
|
@ -7,7 +7,7 @@ import { usingTenderly } from '../../helpers/tenderly-utils';
|
|||
task('pro:mainnet', 'Deploy development enviroment')
|
||||
.addFlag('verify', 'Verify contracts at Etherscan')
|
||||
.setAction(async ({ verify }, DRE) => {
|
||||
const POOL_NAME = ConfigNames.AavePro;
|
||||
const POOL_NAME = ConfigNames.Arc;
|
||||
await DRE.run('set-DRE');
|
||||
|
||||
// Prevent loss of gas verifying all the needed ENVs for Etherscan verification
|
||||
|
@ -17,13 +17,12 @@ task('pro:mainnet', 'Deploy development enviroment')
|
|||
|
||||
console.log('Migration started\n');
|
||||
|
||||
|
||||
console.log('1. Deploy address provider');
|
||||
await DRE.run('full:deploy-address-provider', { pool: POOL_NAME });
|
||||
await DRE.run('full:deploy-address-provider', { pool: POOL_NAME, skipRegistry: true });
|
||||
|
||||
console.log('2. Deploy permissions manager');
|
||||
await DRE.run('deploy-permission-manager', { pool: POOL_NAME });
|
||||
|
||||
|
||||
console.log('3. Deploy lending pool');
|
||||
await DRE.run('full:deploy-lending-pool', { pool: POOL_NAME });
|
||||
|
||||
|
|
|
@ -4,7 +4,7 @@ import { PermissionManagerFactory } from '../../types';
|
|||
import { verifyContract } from '../../helpers/contracts-helpers';
|
||||
import { eContractid } from '../../helpers/types';
|
||||
import { insertContractAddressInDb } from '../../helpers/contracts-helpers';
|
||||
import { getLendingPoolAddressesProvider } from '../../helpers/contracts-getters';
|
||||
import { getFirstSigner, getLendingPoolAddressesProvider } from '../../helpers/contracts-getters';
|
||||
import { waitForTx } from '../../helpers/misc-utils';
|
||||
import { ethers } from 'ethers';
|
||||
|
||||
|
@ -21,7 +21,7 @@ task(`deploy-permission-manager`, `Deploys the PermissionManager contract`)
|
|||
|
||||
console.log(`\tDeploying PermissionManager implementation ...`);
|
||||
const permissionManagerInstance = await new PermissionManagerFactory(
|
||||
await localBRE.ethers.provider.getSigner()
|
||||
await getFirstSigner()
|
||||
).deploy();
|
||||
|
||||
await permissionManagerInstance.deployTransaction.wait();
|
||||
|
|
Loading…
Reference in New Issue
Block a user