Merge branch 'master' into protocol-2.5

This commit is contained in:
The3D 2021-05-15 01:06:29 +02:00
commit 899085450c
49 changed files with 1006 additions and 839 deletions

View File

@ -30,6 +30,20 @@ jobs:
run: npm ci
- name: Test
run: npm run ci:test
- name: Dev deployment
run: npm run aave:evm:dev:migration
- name: Mainnet deployment at Mainnet fork
run: npm run aave:fork:main
env:
ALCHEMY_KEY: ${{ secrets.ALCHEMY_KEY }}
- name: Amm deployment at Mainnet fork
run: npm run amm:fork:main
env:
ALCHEMY_KEY: ${{ secrets.ALCHEMY_KEY }}
- name: Aave deployment at Kovan fork
run: npm run aave:fork:kovan
env:
ALCHEMY_KEY: ${{ secrets.ALCHEMY_KEY }}
# - name: Coverage
# run: npm run coverage
# - uses: codecov/codecov-action@v1

View File

@ -32,6 +32,7 @@ contract ATokensAndRatesHelper is Ownable {
uint256 liquidationBonus;
uint256 reserveFactor;
bool stableBorrowingEnabled;
bool borrowingEnabled;
}
constructor(
@ -73,10 +74,12 @@ contract ATokensAndRatesHelper is Ownable {
inputParams[i].liquidationBonus
);
configurator.enableBorrowingOnReserve(
inputParams[i].asset,
inputParams[i].stableBorrowingEnabled
);
if (inputParams[i].borrowingEnabled) {
configurator.enableBorrowingOnReserve(
inputParams[i].asset,
inputParams[i].stableBorrowingEnabled
);
}
configurator.setReserveFactor(inputParams[i].asset, inputParams[i].reserveFactor);
}
}

View File

@ -5,7 +5,12 @@ import { HardhatUserConfig } from 'hardhat/types';
import { accounts } from './test-wallets.js';
import { eEthereumNetwork, eNetwork, ePolygonNetwork, eXDaiNetwork } from './helpers/types';
import { BUIDLEREVM_CHAINID, COVERAGE_CHAINID } from './helpers/buidler-constants';
import { NETWORKS_RPC_URL, NETWORKS_DEFAULT_GAS } from './helper-hardhat-config';
import {
NETWORKS_RPC_URL,
NETWORKS_DEFAULT_GAS,
BLOCK_TO_FORK,
buildForkConfig,
} from './helper-hardhat-config';
require('dotenv').config();
@ -16,6 +21,7 @@ import 'hardhat-gas-reporter';
import 'hardhat-typechain';
import '@tenderly/hardhat-tenderly';
import 'solidity-coverage';
import { fork } from 'child_process';
const SKIP_LOAD = process.env.SKIP_LOAD === 'true';
const DEFAULT_BLOCK_GAS_LIMIT = 12450000;
@ -24,7 +30,6 @@ const HARDFORK = 'istanbul';
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) {
@ -57,12 +62,7 @@ const getCommonNetworkConfig = (networkName: eNetwork, networkId: number) => ({
},
});
const mainnetFork = MAINNET_FORK
? {
blockNumber: 12012081,
url: NETWORKS_RPC_URL['main'],
}
: undefined;
let forkMode;
const buidlerConfig: HardhatUserConfig = {
solidity: {
@ -111,7 +111,7 @@ const buidlerConfig: HardhatUserConfig = {
privateKey: secretKey,
balance,
})),
forking: mainnetFork,
forking: buildForkConfig(),
},
buidlerevm_docker: {
hardfork: 'berlin',

View File

@ -1,4 +1,5 @@
// @ts-ignore
import { HardhatNetworkForkingUserConfig, HardhatUserConfig } from 'hardhat/types';
import {
eEthereumNetwork,
ePolygonNetwork,
@ -11,9 +12,26 @@ require('dotenv').config();
const INFURA_KEY = process.env.INFURA_KEY || '';
const ALCHEMY_KEY = process.env.ALCHEMY_KEY || '';
const TENDERLY_FORK_ID = process.env.TENDERLY_FORK_ID || '';
const FORK = process.env.FORK || '';
const FORK_BLOCK_NUMBER = process.env.FORK_BLOCK_NUMBER
? parseInt(process.env.FORK_BLOCK_NUMBER)
: 0;
const GWEI = 1000 * 1000 * 1000;
export const buildForkConfig = (): HardhatNetworkForkingUserConfig | undefined => {
let forkMode;
if (FORK) {
forkMode = {
url: NETWORKS_RPC_URL[FORK],
};
if (FORK_BLOCK_NUMBER || BLOCK_TO_FORK[FORK]) {
forkMode.blockNumber = FORK_BLOCK_NUMBER || BLOCK_TO_FORK[FORK];
}
}
return forkMode;
};
export const NETWORKS_RPC_URL: iParamsPerNetwork<string> = {
[eEthereumNetwork.kovan]: ALCHEMY_KEY
? `https://eth-kovan.alchemyapi.io/v2/${ALCHEMY_KEY}`
@ -34,7 +52,7 @@ export const NETWORKS_RPC_URL: iParamsPerNetwork<string> = {
};
export const NETWORKS_DEFAULT_GAS: iParamsPerNetwork<number> = {
[eEthereumNetwork.kovan]: 65 * GWEI,
[eEthereumNetwork.kovan]: 1 * GWEI,
[eEthereumNetwork.ropsten]: 65 * GWEI,
[eEthereumNetwork.main]: 65 * GWEI,
[eEthereumNetwork.coverage]: 65 * GWEI,
@ -42,6 +60,19 @@ export const NETWORKS_DEFAULT_GAS: iParamsPerNetwork<number> = {
[eEthereumNetwork.buidlerevm]: 65 * GWEI,
[eEthereumNetwork.tenderlyMain]: 0.01 * GWEI,
[ePolygonNetwork.mumbai]: 1 * GWEI,
[ePolygonNetwork.matic]: 2 * GWEI,
[ePolygonNetwork.matic]: 1 * GWEI,
[eXDaiNetwork.xdai]: 1 * GWEI,
};
export const BLOCK_TO_FORK: iParamsPerNetwork<number | undefined> = {
[eEthereumNetwork.main]: 12406069,
[eEthereumNetwork.kovan]: undefined,
[eEthereumNetwork.ropsten]: undefined,
[eEthereumNetwork.coverage]: undefined,
[eEthereumNetwork.hardhat]: undefined,
[eEthereumNetwork.buidlerevm]: undefined,
[eEthereumNetwork.tenderlyMain]: 12406069,
[ePolygonNetwork.mumbai]: undefined,
[ePolygonNetwork.matic]: undefined,
[eXDaiNetwork.xdai]: undefined,
};

View File

@ -30,7 +30,7 @@ export const loadPoolConfig = (configName: ConfigNames): PoolConfiguration => {
case ConfigNames.Matic:
return MaticConfig;
case ConfigNames.Amm:
return AmmConfig;
return AmmConfig;
case ConfigNames.Commons:
return CommonsConfig;
default:
@ -61,7 +61,7 @@ export const getReservesConfigByPool = (pool: AavePools): iMultiPoolsAssets<IRes
export const getGenesisPoolAdmin = async (
config: ICommonConfiguration
): Promise<tEthereumAddress> => {
const currentNetwork = process.env.MAINNET_FORK === 'true' ? 'main' : DRE.network.name;
const currentNetwork = process.env.FORK ? process.env.FORK : DRE.network.name;
const targetAddress = getParamPerNetwork(config.PoolAdmin, <eNetwork>currentNetwork);
if (targetAddress) {
return targetAddress;
@ -76,7 +76,7 @@ export const getGenesisPoolAdmin = async (
export const getEmergencyAdmin = async (
config: ICommonConfiguration
): Promise<tEthereumAddress> => {
const currentNetwork = process.env.MAINNET_FORK === 'true' ? 'main' : DRE.network.name;
const currentNetwork = process.env.FORK ? process.env.FORK : DRE.network.name;
const targetAddress = getParamPerNetwork(config.EmergencyAdmin, <eNetwork>currentNetwork);
if (targetAddress) {
return targetAddress;
@ -91,7 +91,7 @@ export const getEmergencyAdmin = async (
export const getTreasuryAddress = async (
config: ICommonConfiguration
): Promise<tEthereumAddress> => {
const currentNetwork = process.env.MAINNET_FORK === 'true' ? 'main' : DRE.network.name;
const currentNetwork = process.env.FORK ? process.env.FORK : DRE.network.name;
return getParamPerNetwork(config.ReserveFactorTreasuryAddress, <eNetwork>currentNetwork);
};
@ -101,7 +101,7 @@ export const getATokenDomainSeparatorPerNetwork = (
): tEthereumAddress => getParamPerNetwork<tEthereumAddress>(config.ATokenDomainSeparator, network);
export const getWethAddress = async (config: ICommonConfiguration) => {
const currentNetwork = process.env.MAINNET_FORK === 'true' ? 'main' : DRE.network.name;
const currentNetwork = process.env.FORK ? process.env.FORK : DRE.network.name;
const wethAddress = getParamPerNetwork(config.WETH, <eNetwork>currentNetwork);
if (wethAddress) {
return wethAddress;
@ -113,6 +113,19 @@ export const getWethAddress = async (config: ICommonConfiguration) => {
return weth.address;
};
export const getWrappedNativeTokenAddress = async (config: ICommonConfiguration) => {
const currentNetwork = process.env.MAINNET_FORK === 'true' ? 'main' : DRE.network.name;
const wethAddress = getParamPerNetwork(config.WrappedNativeToken, <eNetwork>currentNetwork);
if (wethAddress) {
return wethAddress;
}
if (currentNetwork.includes('main')) {
throw new Error('WETH not set at mainnet configuration.');
}
const weth = await deployWETHMocked();
return weth.address;
};
export const getLendingRateOracles = (poolConfig: ICommonConfiguration) => {
const {
ProtocolGlobalParams: { UsdAddress },
@ -120,8 +133,7 @@ export const getLendingRateOracles = (poolConfig: ICommonConfiguration) => {
ReserveAssets,
} = poolConfig;
const MAINNET_FORK = process.env.MAINNET_FORK === 'true';
const network = MAINNET_FORK ? 'main' : DRE.network.name;
const network = process.env.FORK ? process.env.FORK : DRE.network.name;
return filterMapBy(LendingRateOracleRatesCommon, (key) =>
Object.keys(ReserveAssets[network]).includes(key)
);

View File

@ -56,6 +56,7 @@ import {
linkBytecode,
insertContractAddressInDb,
deployContract,
verifyContract,
} from './contracts-helpers';
import { StableAndVariableTokensHelperFactory } from '../types/StableAndVariableTokensHelperFactory';
import { MintableDelegationERC20 } from '../types/MintableDelegationERC20';
@ -63,7 +64,6 @@ import { readArtifact as buidlerReadArtifact } from '@nomiclabs/buidler/plugins'
import { HardhatRuntimeEnvironment } from 'hardhat/types';
import { LendingPoolLibraryAddresses } from '../types/LendingPoolFactory';
import { UiPoolDataProvider } from '../types';
import { verifyContract } from './etherscan-verification';
export const deployUiPoolDataProvider = async (
[incentivesController, aaveOracle]: [tEthereumAddress, tEthereumAddress],
@ -73,7 +73,7 @@ export const deployUiPoolDataProvider = async (
const args: string[] = [incentivesController, aaveOracle];
const instance = await deployContract<UiPoolDataProvider>(id, args);
if (verify) {
await verifyContract(instance.address, args);
await verifyContract(id, instance, args);
}
return instance;
};

View File

@ -33,19 +33,19 @@ import {
} from '../types';
import { IERC20DetailedFactory } from '../types/IERC20DetailedFactory';
import { MockTokenMap } from './contracts-helpers';
import { DRE, getDb } from './misc-utils';
import { DRE, getDb, notFalsyOrZeroAddress } from './misc-utils';
import { eContractid, PoolConfiguration, tEthereumAddress, TokenContractId } from './types';
export const getFirstSigner = async () => (await DRE.ethers.getSigners())[0];
export const getLendingPoolAddressesProvider = async (address?: tEthereumAddress) =>
await LendingPoolAddressesProviderFactory.connect(
export const getLendingPoolAddressesProvider = async (address?: tEthereumAddress) => {
return await LendingPoolAddressesProviderFactory.connect(
address ||
(await getDb().get(`${eContractid.LendingPoolAddressesProvider}.${DRE.network.name}`).value())
.address,
await getFirstSigner()
);
};
export const getLendingPoolConfiguratorProxy = async (address?: tEthereumAddress) => {
return await LendingPoolConfiguratorFactory.connect(
address ||
@ -172,7 +172,7 @@ export const getPairsTokenAggregator = (
},
aggregatorsAddresses: { [tokenSymbol: string]: tEthereumAddress }
): [string[], string[]] => {
const { ETH, USD, WETH, ...assetsAddressesWithoutEth } = allAssetsAddresses;
const { ETH, WETH, ...assetsAddressesWithoutEth } = allAssetsAddresses;
const pairs = Object.entries(assetsAddressesWithoutEth).map(([tokenSymbol, tokenAddress]) => {
//if (true/*tokenSymbol !== 'WETH' && tokenSymbol !== 'ETH' && tokenSymbol !== 'LpWETH'*/) {
@ -195,12 +195,13 @@ export const getPairsTokenAggregator = (
export const getLendingPoolAddressesProviderRegistry = async (address?: tEthereumAddress) =>
await LendingPoolAddressesProviderRegistryFactory.connect(
address ||
(
await getDb()
.get(`${eContractid.LendingPoolAddressesProviderRegistry}.${DRE.network.name}`)
.value()
).address,
notFalsyOrZeroAddress(address)
? address
: (
await getDb()
.get(`${eContractid.LendingPoolAddressesProviderRegistry}.${DRE.network.name}`)
.value()
).address,
await getFirstSigner()
);

View File

@ -22,16 +22,17 @@ import {
import { MintableERC20 } from '../types/MintableERC20';
import { Artifact } from 'hardhat/types';
import { Artifact as BuidlerArtifact } from '@nomiclabs/buidler/types';
import { verifyContract } from './etherscan-verification';
import { verifyEtherscanContract } from './etherscan-verification';
import { getIErc20Detailed } from './contracts-getters';
import { usingTenderly } from './tenderly-utils';
import { usingTenderly, verifyAtTenderly } from './tenderly-utils';
import { usingPolygon, verifyAtPolygon } from './polygon-utils';
export type MockTokenMap = { [symbol: string]: MintableERC20 };
export const registerContractInJsonDb = async (contractId: string, contractInstance: Contract) => {
const currentNetwork = DRE.network.name;
const MAINNET_FORK = process.env.MAINNET_FORK === 'true';
if (MAINNET_FORK || (currentNetwork !== 'hardhat' && !currentNetwork.includes('coverage'))) {
const FORK = process.env.FORK;
if (FORK || (currentNetwork !== 'hardhat' && !currentNetwork.includes('coverage'))) {
console.log(`*** ${contractId} ***\n`);
console.log(`Network: ${currentNetwork}`);
console.log(`tx: ${contractInstance.deployTransaction.hash}`);
@ -98,18 +99,8 @@ export const withSaveAndVerify = async <ContractType extends Contract>(
): Promise<ContractType> => {
await waitForTx(instance.deployTransaction);
await registerContractInJsonDb(id, instance);
if (usingTenderly()) {
console.log();
console.log('Doing Tenderly contract verification of', id);
await (DRE as any).tenderlyRPC.verify({
name: id,
address: instance.address,
});
console.log(`Verified ${id} at Tenderly!`);
console.log();
}
if (verify) {
await verifyContract(instance.address, args);
await verifyContract(id, instance, args);
}
return instance;
};
@ -153,9 +144,8 @@ export const getParamPerNetwork = <T>(param: iParamsPerNetwork<T>, network: eNet
} = param as iEthereumParamsPerNetwork<T>;
const { matic, mumbai } = param as iPolygonParamsPerNetwork<T>;
const { xdai } = param as iXDaiParamsPerNetwork<T>;
const MAINNET_FORK = process.env.MAINNET_FORK === 'true';
if (MAINNET_FORK) {
return main;
if (process.env.FORK) {
return param[process.env.FORK as eNetwork] as T;
}
switch (network) {
@ -328,3 +318,19 @@ export const buildFlashLiquidationAdapterParams = (
[collateralAsset, debtAsset, user, debtToCover, useEthPath]
);
};
export const verifyContract = async (
id: string,
instance: Contract,
args: (string | string[])[]
) => {
if (usingPolygon()) {
await verifyAtPolygon(id, instance, args);
} else {
if (usingTenderly()) {
await verifyAtTenderly(id, instance);
}
await verifyEtherscanContract(instance.address, args);
}
return instance;
};

View File

@ -20,7 +20,7 @@ function delay(ms: number) {
return new Promise((resolve) => setTimeout(resolve, ms));
}
export const verifyContract = async (
export const verifyEtherscanContract = async (
address: string,
constructorArguments: (string | string[])[],
libraries?: string

View File

@ -12,6 +12,7 @@ import {
getAaveProtocolDataProvider,
getAToken,
getATokensAndRatesHelper,
getFirstSigner,
getLendingPoolAddressesProvider,
getLendingPoolConfiguratorProxy,
getStableAndVariableTokensHelper,
@ -32,6 +33,7 @@ import {
import { ZERO_ADDRESS } from './constants';
import { isZeroAddress } from 'ethereumjs-util';
import { DefaultReserveInterestRateStrategy, DelegationAwareAToken } from '../types';
import { config } from 'process';
export const chooseATokenDeployment = (id: eContractid) => {
switch (id) {
@ -144,6 +146,10 @@ export const initReservesByHelper = async (
) as [string, IReserveParams][];
for (let [symbol, params] of reserves) {
if (!tokenAddresses[symbol]) {
console.log(`- Skipping init of ${symbol} due token address is not set at markets config`);
continue;
}
const { strategy, aTokenImpl, reserveDecimals } = params;
const {
optimalUtilizationRate,
@ -201,7 +207,7 @@ export const initReservesByHelper = async (
interestRateStrategyAddress: strategyAddressPerAsset[reserveSymbols[i]],
underlyingAsset: reserveTokens[i],
treasury: treasuryAddress,
incentivesController: ZERO_ADDRESS,
incentivesController,
underlyingAssetName: reserveSymbols[i],
aTokenName: `${aTokenNamePrefix} ${reserveSymbols[i]}`,
aTokenSymbol: `a${symbolPrefix}${reserveSymbols[i]}`,
@ -209,7 +215,7 @@ export const initReservesByHelper = async (
variableDebtTokenSymbol: `variableDebt${symbolPrefix}${reserveSymbols[i]}`,
stableDebtTokenName: `${stableDebtTokenNamePrefix} ${reserveSymbols[i]}`,
stableDebtTokenSymbol: `stableDebt${symbolPrefix}${reserveSymbols[i]}`,
params: '0x10'
params: '0x10',
});
}
@ -271,11 +277,6 @@ export const configureReservesByHelper = async (
const atokenAndRatesDeployer = await getATokensAndRatesHelper();
const tokens: string[] = [];
const symbols: string[] = [];
const baseLTVA: string[] = [];
const liquidationThresholds: string[] = [];
const liquidationBonuses: string[] = [];
const reserveFactors: string[] = [];
const stableRatesEnabled: boolean[] = [];
const inputParams: {
asset: string;
@ -284,6 +285,7 @@ export const configureReservesByHelper = async (
liquidationBonus: BigNumberish;
reserveFactor: BigNumberish;
stableBorrowingEnabled: boolean;
borrowingEnabled: boolean;
}[] = [];
for (const [
@ -294,8 +296,15 @@ export const configureReservesByHelper = async (
liquidationThreshold,
reserveFactor,
stableBorrowRateEnabled,
borrowingEnabled,
},
] of Object.entries(reservesParams) as [string, IReserveParams][]) {
if (!tokenAddresses[assetSymbol]) {
console.log(
`- Skipping init of ${assetSymbol} due token address is not set at markets config`
);
continue;
}
if (baseLTVAsCollateral === '-1') continue;
const assetAddressIndex = Object.keys(tokenAddresses).findIndex(
@ -321,15 +330,11 @@ export const configureReservesByHelper = async (
liquidationBonus: liquidationBonus,
reserveFactor: reserveFactor,
stableBorrowingEnabled: stableBorrowRateEnabled,
borrowingEnabled: borrowingEnabled,
});
tokens.push(tokenAddress);
symbols.push(assetSymbol);
baseLTVA.push(baseLTVAsCollateral);
liquidationThresholds.push(liquidationThreshold);
liquidationBonuses.push(liquidationBonus);
reserveFactors.push(reserveFactor);
stableRatesEnabled.push(stableBorrowRateEnabled);
}
if (tokens.length) {
// Set aTokenAndRatesDeployer as temporal admin
@ -360,229 +365,6 @@ const getAddressById = async (
): Promise<tEthereumAddress | undefined> =>
(await getDb().get(`${id}.${network}`).value())?.address || undefined;
// Function deprecated? Updated but untested, script is not updated on package.json.
// This is not called during regular deployment, only in the "full:initialize-tokens"
// hardhat task.
export const initTokenReservesByHelper = async (
reservesParams: iMultiPoolsAssets<IReserveParams>,
tokenAddresses: { [symbol: string]: tEthereumAddress },
admin: tEthereumAddress,
addressesProviderAddress: tEthereumAddress,
ratesHelperAddress: tEthereumAddress,
dataProviderAddress: tEthereumAddress,
signer: Signer,
treasuryAddress: tEthereumAddress,
verify: boolean
) => {
let gasUsage = BigNumber.from('0');
const atokenAndRatesDeployer = await (await getATokensAndRatesHelper(ratesHelperAddress)).connect(
signer
);
const addressProvider = await (
await getLendingPoolAddressesProvider(addressesProviderAddress)
).connect(signer);
const protocolDataProvider = await (
await getAaveProtocolDataProvider(dataProviderAddress)
).connect(signer);
const poolAddress = await addressProvider.getLendingPool();
// Set aTokenAndRatesDeployer as temporal admin
//await waitForTx(await addressProvider.setPoolAdmin(atokenAndRatesDeployer.address));
// CHUNK CONFIGURATION
const initChunks = 4;
// Initialize variables for future reserves initialization
let deployedStableTokens: string[] = [];
let deployedVariableTokens: string[] = [];
let deployedATokens: string[] = [];
let deployedRates: string[] = [];
//let reserveTokens: string[] = [];
let reserveInitDecimals: string[] = [];
let reserveSymbols: string[] = [];
let initInputParams: {
aTokenImpl: string;
stableDebtTokenImpl: string;
variableDebtTokenImpl: string;
underlyingAssetDecimals: BigNumberish;
interestRateStrategyAddress: string;
underlyingAsset: string;
treasury: string;
incentivesController: string;
underlyingAssetName: string;
aTokenName: string;
aTokenSymbol: string;
variableDebtTokenName: string;
variableDebtTokenSymbol: string;
stableDebtTokenName: string;
stableDebtTokenSymbol: string;
params: string;
}[] = [];
const network =
process.env.MAINNET_FORK === 'true' ? eEthereumNetwork.main : (DRE.network.name as eNetwork);
// Grab config from DB
for (const [symbol, address] of Object.entries(tokenAddresses)) {
const { aTokenAddress } = await protocolDataProvider.getReserveTokensAddresses(address);
const reserveParamIndex = Object.keys(reservesParams).findIndex((value) => value === symbol);
const [, { reserveDecimals: decimals }] = (Object.entries(reservesParams) as [
string,
IReserveParams
][])[reserveParamIndex];
if (!isZeroAddress(aTokenAddress)) {
console.log(`- Skipping ${symbol} due already initialized`);
continue;
}
let stableTokenImpl = await getAddressById(`stableDebtTokenImpl`, network);
let variableTokenImpl = await getAddressById(`variableDebtTokenImpl`, network);
let aTokenImplementation: string | undefined = '';
const [, { aTokenImpl, strategy }] = (Object.entries(reservesParams) as [
string,
IReserveParams
][])[reserveParamIndex];
if (aTokenImpl === eContractid.AToken) {
aTokenImplementation = await getAddressById(`aTokenImpl`, network);
} else if (aTokenImpl === eContractid.DelegationAwareAToken) {
aTokenImplementation = await getAddressById(`delegationAwareATokenImpl`, network);
}
let strategyImpl = await getAddressById(strategy.name, network);
if (!stableTokenImpl) {
const stableDebt = await deployStableDebtToken(
[
poolAddress,
tokenAddresses[symbol],
ZERO_ADDRESS, // Incentives controller
`Aave stable debt bearing ${symbol}`,
`stableDebt${symbol}`,
],
verify
);
stableTokenImpl = stableDebt.address;
}
if (!variableTokenImpl) {
const variableDebt = await deployVariableDebtToken(
[
poolAddress,
tokenAddresses[symbol],
ZERO_ADDRESS, // Incentives Controller
`Aave variable debt bearing ${symbol}`,
`variableDebt${symbol}`,
],
verify
);
variableTokenImpl = variableDebt.address;
}
if (!aTokenImplementation) {
const [, { aTokenImpl }] = (Object.entries(reservesParams) as [string, IReserveParams][])[
reserveParamIndex
];
const deployCustomAToken = chooseATokenDeployment(aTokenImpl);
const aToken = await deployCustomAToken(
[
poolAddress,
tokenAddresses[symbol],
treasuryAddress,
ZERO_ADDRESS,
`Aave interest bearing ${symbol}`,
`a${symbol}`,
],
verify
);
aTokenImplementation = aToken.address;
}
if (!strategyImpl) {
const [, { strategy }] = (Object.entries(reservesParams) as [string, IReserveParams][])[
reserveParamIndex
];
const {
optimalUtilizationRate,
baseVariableBorrowRate,
variableRateSlope1,
variableRateSlope2,
stableRateSlope1,
stableRateSlope2,
} = strategy;
const rates = await deployDefaultReserveInterestRateStrategy(
[
tokenAddresses[symbol],
optimalUtilizationRate,
baseVariableBorrowRate,
variableRateSlope1,
variableRateSlope2,
stableRateSlope1,
stableRateSlope2,
],
verify
);
strategyImpl = rates.address;
}
// --- REMOVED BECAUSE WE NOW USE THE SAME IMPLEMENTATIONS ---
// const symbols = [`a${symbol}`, `variableDebt${symbol}`, `stableDebt${symbol}`];
// const tokens = [aTokenImplementation, variableTokenImpl, stableTokenImpl];
// for (let index = 0; index < symbols.length; index++) {
// if (!(await isErc20SymbolCorrect(tokens[index], symbols[index]))) {
// console.error(`${symbol} and implementation does not match: ${tokens[index]}`);
// throw Error('Symbol does not match implementation.');
// }
// }
console.log(`- Added ${symbol} to the initialize batch`);
deployedStableTokens.push(stableTokenImpl);
deployedVariableTokens.push(variableTokenImpl);
deployedATokens.push(aTokenImplementation);
//reserveTokens.push();
deployedRates.push(strategyImpl);
reserveInitDecimals.push(decimals.toString());
reserveSymbols.push(symbol);
}
for (let i = 0; i < deployedATokens.length; i++) {
initInputParams.push({
aTokenImpl: deployedATokens[i],
stableDebtTokenImpl: deployedStableTokens[i],
variableDebtTokenImpl: deployedVariableTokens[i],
underlyingAssetDecimals: reserveInitDecimals[i],
interestRateStrategyAddress: deployedRates[i],
underlyingAsset: tokenAddresses[reserveSymbols[i]],
treasury: treasuryAddress,
incentivesController: ZERO_ADDRESS,
underlyingAssetName: reserveSymbols[i],
aTokenName: `Aave interest bearing ${reserveSymbols[i]}`,
aTokenSymbol: `a${reserveSymbols[i]}`,
variableDebtTokenName: `Aave variable debt bearing ${reserveSymbols[i]}`,
variableDebtTokenSymbol: `variableDebt${reserveSymbols[i]}`,
stableDebtTokenName: `Aave stable debt bearing ${reserveSymbols[i]}`,
stableDebtTokenSymbol: `stableDebt${reserveSymbols[i]}`,
params: '0x10'
});
}
// Deploy init reserves per chunks
const chunkedSymbols = chunk(reserveSymbols, initChunks);
const chunkedInitInputParams = chunk(initInputParams, initChunks);
const configurator = await getLendingPoolConfiguratorProxy();
//await waitForTx(await addressProvider.setPoolAdmin(admin));
console.log(`- Reserves initialization in ${chunkedInitInputParams.length} txs`);
for (let chunkIndex = 0; chunkIndex < chunkedInitInputParams.length; chunkIndex++) {
const tx3 = await waitForTx(
await configurator.batchInitReserve(chunkedInitInputParams[chunkIndex])
);
console.log(` - Reserve ready for: ${chunkedSymbols[chunkIndex].join(', ')}`);
console.log(' * gasUsed', tx3.gasUsed.toString());
}
// Set deployer back as admin
//await waitForTx(await addressProvider.setPoolAdmin(admin));
return gasUsage; // No longer relevant
};
// Function deprecated
const isErc20SymbolCorrect = async (token: tEthereumAddress, symbol: string) => {
const erc20 = await getAToken(token); // using aToken for ERC20 interface

View File

@ -72,9 +72,6 @@ export const setInitialAssetPricesInOracle = async (
priceOracleInstance: PriceOracle
) => {
for (const [assetSymbol, price] of Object.entries(prices) as [string, string][]) {
console.log("Trying for ", assetsAddresses, assetSymbol);
const assetAddressIndex = Object.keys(assetsAddresses).findIndex(
(value) => value === assetSymbol
);

142
helpers/polygon-utils.ts Normal file
View File

@ -0,0 +1,142 @@
import axios from 'axios';
import { Contract } from 'ethers/lib/ethers';
import { HardhatRuntimeEnvironment } from 'hardhat/types';
import { DRE } from './misc-utils';
import { ePolygonNetwork, EthereumNetworkNames } from './types';
const TASK_FLATTEN_GET_FLATTENED_SOURCE = 'flatten:get-flattened-sources';
const TASK_COMPILE_SOLIDITY_GET_SOURCE_PATHS = 'compile:solidity:get-source-paths';
/* Polygon Helpers */
export const usingPolygon = () =>
DRE && Object.keys(ePolygonNetwork).includes((DRE as HardhatRuntimeEnvironment).network.name);
/* Polygon Verifier */
const SOLIDITY_PRAGMA = 'pragma solidity';
const LICENSE_IDENTIFIER = 'License-Identifier';
const EXPERIMENTAL_ABIENCODER = 'pragma experimental ABIEncoderV2;';
const encodeDeployParams = (instance: Contract, args: (string | string[])[]) => {
return instance.interface.encodeDeploy(args).replace('0x', '');
};
// Remove lines at "text" that includes "matcher" string, but keeping first "keep" lines
const removeLines = (text: string, matcher: string, keep = 0): string => {
let counter = keep;
return text
.split('\n')
.filter((line) => {
const match = !line.includes(matcher);
if (match === false && counter > 0) {
counter--;
return true;
}
return match;
})
.join('\n');
};
// Try to find the path of a Contract by name of the file without ".sol"
const findPath = async (id: string): Promise<string> => {
const paths = await DRE.run(TASK_COMPILE_SOLIDITY_GET_SOURCE_PATHS);
const path = paths.find((x) => {
const t = x.split('/');
return t[t.length - 1].split('.')[0] == id;
});
if (!path) {
throw Error('Missing path for contract name: ${id}');
}
return path;
};
// Hardhat Flattener, similar to truffle flattener
const hardhatFlattener = async (filePath: string) =>
await DRE.run(TASK_FLATTEN_GET_FLATTENED_SOURCE, { files: [filePath] });
// Verify a smart contract at Polygon Matic network via a GET request to the block explorer
export const verifyAtPolygon = async (
id: string,
instance: Contract,
args: (string | string[])[]
) => {
/*
${net == mumbai or mainnet}
https://explorer-${net}.maticvigil.com/api
?module=contract
&action=verify
&addressHash={addressHash}
&name={name}
&compilerVersion={compilerVersion}
&optimization={false}
&contractSourceCode={contractSourceCode}
*/
const network = (DRE as HardhatRuntimeEnvironment).network.name;
const net = network === EthereumNetworkNames.matic ? 'mainnet' : network;
const filePath = await findPath(id);
const encodedConstructorParams = encodeDeployParams(instance, args);
const flattenSourceCode = await hardhatFlattener(filePath);
// Remove pragmas and license identifier after first match, required by block explorers like explorer-mainnet.maticgivil.com or Etherscan
const cleanedSourceCode = removeLines(
removeLines(removeLines(flattenSourceCode, LICENSE_IDENTIFIER, 1), SOLIDITY_PRAGMA, 1),
EXPERIMENTAL_ABIENCODER,
1
);
try {
console.log(
`[Polygon Verify] Verifying ${id} with address ${instance.address} at Matic ${net} network`
);
const response = await axios.post(
`https://explorer-${net}.maticvigil.com/api`,
{
addressHash: instance.address,
name: id,
compilerVersion: 'v0.6.12+commit.27d51765',
optimization: 'true',
contractSourceCode: cleanedSourceCode,
constructorArguments: encodedConstructorParams,
},
{
params: {
module: 'contract',
action: 'verify',
},
headers: {
'Content-Type': 'application/json',
Referer: 'aavematic-42e1f6da',
},
}
);
if (response.status === 200 && response.data.message === 'OK') {
console.log(`[Polygon Verify] Verified contract at Matic ${net} network.`);
console.log(
`[Polygon Verify] Check at: https://explorer-${net}.maticvigil.com/address/${instance.address}/contracts) \n`
);
return;
}
throw Error(JSON.stringify(response.data, null, 2));
} catch (error) {
if (error?.message.includes('Smart-contract already verified.')) {
console.log(
`[Polygon Verify] Already verified. Check it at: https://explorer-${net}.maticvigil.com/address/${instance.address}/contracts) \n`
);
return;
}
console.error('[Polygon Verify] Error:', error.toString());
console.log(
`[Polygon Verify] Skipping verification for ${id} with ${instance.address} due an unknown error.`
);
console.log(
`Please proceed with manual verification at https://explorer-${net}.maticvigil.com/address/${instance.address}/contracts`
);
console.log(`- Use the following as encoded constructor params`);
console.log(encodedConstructorParams);
console.log(`- Flattened and cleaned source code`);
console.log(cleanedSourceCode);
}
};

View File

@ -1,3 +1,4 @@
import { Contract } from 'ethers';
import { HardhatRuntimeEnvironment } from 'hardhat/types';
import { DRE } from './misc-utils';
@ -5,3 +6,12 @@ export const usingTenderly = () =>
DRE &&
((DRE as HardhatRuntimeEnvironment).network.name.includes('tenderly') ||
process.env.TENDERLY === 'true');
export const verifyAtTenderly = async (id: string, instance: Contract) => {
console.log('\n- Doing Tenderly contract verification of', id);
await (DRE as any).tenderlyRPC.verify({
name: id,
address: instance.address,
});
console.log(` - Verified ${id} at Tenderly!`);
};

View File

@ -296,7 +296,7 @@ export type iLpPoolAssets<T> = Pick<
export type iMaticPoolAssets<T> = Pick<
iAssetsWithoutUSD<T>,
'DAI' | 'USDC' | 'USDT' | 'WBTC' | 'WETH' | 'WMATIC'
'DAI' | 'USDC' | 'USDT' | 'WBTC' | 'WETH' | 'WMATIC' | 'AAVE'
>;
export type iXDAIPoolAssets<T> = Pick<
@ -350,7 +350,7 @@ export enum TokenContractId {
BptBALWETH = 'BptBALWETH',
WMATIC = 'WMATIC',
STAKE = 'STAKE',
xSUSHI = 'xSUSHI'
xSUSHI = 'xSUSHI',
}
export interface IReserveParams extends IReserveBorrowParams, IReserveCollateralParams {
@ -489,8 +489,10 @@ export interface ICommonConfiguration {
ReservesConfig: iMultiPoolsAssets<IReserveParams>;
ATokenDomainSeparator: iParamsPerNetwork<string>;
WETH: iParamsPerNetwork<tEthereumAddress>;
WrappedNativeToken: iParamsPerNetwork<tEthereumAddress>;
WethGateway: iParamsPerNetwork<tEthereumAddress>;
ReserveFactorTreasuryAddress: iParamsPerNetwork<tEthereumAddress>;
IncentivesController: iParamsPerNetwork<tEthereumAddress>;
}
export interface IAaveConfiguration extends ICommonConfiguration {

View File

@ -1,5 +1,11 @@
import BigNumber from 'bignumber.js';
import { oneEther, oneRay, RAY, ZERO_ADDRESS, MOCK_CHAINLINK_AGGREGATORS_PRICES } from '../../helpers/constants';
import {
oneEther,
oneRay,
RAY,
ZERO_ADDRESS,
MOCK_CHAINLINK_AGGREGATORS_PRICES,
} from '../../helpers/constants';
import { ICommonConfiguration, eEthereumNetwork } from '../../helpers/types';
// ----------------
@ -87,6 +93,9 @@ export const CommonsConfig: ICommonConfiguration = {
UNI: {
borrowRate: oneRay.multipliedBy(0.03).toFixed(),
},
ENJ: {
borrowRate: oneRay.multipliedBy(0.03).toFixed(),
},
BUSD: {
borrowRate: oneRay.multipliedBy(0.05).toFixed(),
},
@ -129,21 +138,21 @@ export const CommonsConfig: ICommonConfiguration = {
ProviderRegistryOwner: {
[eEthereumNetwork.kovan]: '0x85e4A467343c0dc4aDAB74Af84448D9c45D8ae6F',
[eEthereumNetwork.ropsten]: '',
[eEthereumNetwork.main]: '0xbd723fc4f1d737dcfc48a07fe7336766d34cad5f',
[eEthereumNetwork.main]: '0xB9062896ec3A615a4e4444DF183F0531a77218AE',
[eEthereumNetwork.coverage]: '',
[eEthereumNetwork.hardhat]: '',
[eEthereumNetwork.buidlerevm]: '',
[eEthereumNetwork.tenderlyMain]: '0xbd723fc4f1d737dcfc48a07fe7336766d34cad5f',
[eEthereumNetwork.tenderlyMain]: '0xB9062896ec3A615a4e4444DF183F0531a77218AE',
},
LendingRateOracle: {
[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]: '',
@ -175,7 +184,7 @@ export const CommonsConfig: ICommonConfiguration = {
[eEthereumNetwork.coverage]: '',
[eEthereumNetwork.hardhat]: '',
[eEthereumNetwork.buidlerevm]: '',
[eEthereumNetwork.kovan]: '0xf99b8E67a0E044734B01EC4586D1c88C9a869718',
[eEthereumNetwork.kovan]: '',
[eEthereumNetwork.ropsten]: '',
[eEthereumNetwork.main]: '',
[eEthereumNetwork.tenderlyMain]: '',
@ -193,9 +202,9 @@ export const CommonsConfig: ICommonConfiguration = {
[eEthereumNetwork.coverage]: '',
[eEthereumNetwork.hardhat]: '',
[eEthereumNetwork.buidlerevm]: '',
[eEthereumNetwork.kovan]: '',//'0xB8bE51E6563BB312Cbb2aa26e352516c25c26ac1',
[eEthereumNetwork.kovan]: '', //'0xB8bE51E6563BB312Cbb2aa26e352516c25c26ac1',
[eEthereumNetwork.ropsten]: ZERO_ADDRESS,
[eEthereumNetwork.main]: '',//'0xA50ba011c48153De246E5192C8f9258A2ba79Ca9',
[eEthereumNetwork.main]: '', //'0xA50ba011c48153De246E5192C8f9258A2ba79Ca9',
[eEthereumNetwork.tenderlyMain]: '0xA50ba011c48153De246E5192C8f9258A2ba79Ca9',
},
FallbackOracle: {
@ -276,6 +285,7 @@ export const CommonsConfig: ICommonConfiguration = {
YFI: '0x7c5d4F8345e66f68099581Db340cd65B078C41f4',
ZRX: '0x2Da4983a622a8498bb1a21FaE9D8F6C664939962',
USD: '0x5f4eC3Df9cbd43714FE2740f5E3616155c5b8419',
xSUSHI: '0x9b26214bEC078E68a394AaEbfbffF406Ce14893F',
},
[eEthereumNetwork.tenderlyMain]: {
AAVE: '0x6Df09E975c830ECae5bd4eD9d90f3A95a4f88012',
@ -298,6 +308,7 @@ export const CommonsConfig: ICommonConfiguration = {
YFI: '0x7c5d4F8345e66f68099581Db340cd65B078C41f4',
ZRX: '0x2Da4983a622a8498bb1a21FaE9D8F6C664939962',
USD: '0x5f4eC3Df9cbd43714FE2740f5E3616155c5b8419',
xSUSHI: '0x9b26214bEC078E68a394AaEbfbffF406Ce14893F',
},
},
ReserveAssets: {
@ -331,6 +342,15 @@ export const CommonsConfig: ICommonConfiguration = {
[eEthereumNetwork.main]: '0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2',
[eEthereumNetwork.tenderlyMain]: '0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2',
},
WrappedNativeToken: {
[eEthereumNetwork.coverage]: '', // deployed in local evm
[eEthereumNetwork.hardhat]: '', // deployed in local evm
[eEthereumNetwork.buidlerevm]: '', // deployed in local evm
[eEthereumNetwork.kovan]: '0xd0a1e359811322d97991e03f863a0c30c2cf029c',
[eEthereumNetwork.ropsten]: '0xc778417e063141139fce010982780140aa0cd5ab',
[eEthereumNetwork.main]: '0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2',
[eEthereumNetwork.tenderlyMain]: '0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2',
},
ReserveFactorTreasuryAddress: {
[eEthereumNetwork.coverage]: '0x464c71f6c2f760dda6093dcb91c24c39e5d6e18c',
[eEthereumNetwork.hardhat]: '0x464c71f6c2f760dda6093dcb91c24c39e5d6e18c',
@ -340,4 +360,13 @@ export const CommonsConfig: ICommonConfiguration = {
[eEthereumNetwork.main]: '0x464c71f6c2f760dda6093dcb91c24c39e5d6e18c',
[eEthereumNetwork.tenderlyMain]: '0x464c71f6c2f760dda6093dcb91c24c39e5d6e18c',
},
IncentivesController: {
[eEthereumNetwork.coverage]: ZERO_ADDRESS,
[eEthereumNetwork.hardhat]: ZERO_ADDRESS,
[eEthereumNetwork.buidlerevm]: ZERO_ADDRESS,
[eEthereumNetwork.kovan]: ZERO_ADDRESS,
[eEthereumNetwork.ropsten]: ZERO_ADDRESS,
[eEthereumNetwork.main]: ZERO_ADDRESS,
[eEthereumNetwork.tenderlyMain]: ZERO_ADDRESS,
},
};

View File

@ -23,6 +23,7 @@ import {
strategyWETH,
strategyYFI,
strategyXSUSHI,
strategyENJ,
} from './reservesConfigs';
// ----------------
@ -38,7 +39,7 @@ export const AaveConfig: IAaveConfiguration = {
BAT: strategyBAT,
BUSD: strategyBUSD,
DAI: strategyDAI,
ENJ: strategyREN,
ENJ: strategyENJ,
KNC: strategyKNC,
LINK: strategyLINK,
MANA: strategyMANA,

View File

@ -139,14 +139,13 @@ export const CommonsConfig: ICommonConfiguration = {
[eEthereumNetwork.tenderlyMain]: '0x52D306e36E3B6B02c153d0266ff0f85d18BCD413',
},
ProviderRegistryOwner: {
// DEPLOYED WITH CORRECT ADDRESS
[eEthereumNetwork.kovan]: '0x85e4A467343c0dc4aDAB74Af84448D9c45D8ae6F',
[eEthereumNetwork.ropsten]: '',
[eEthereumNetwork.main]: '0xbd723fc4f1d737dcfc48a07fe7336766d34cad5f',
[eEthereumNetwork.main]: '0xB9062896ec3A615a4e4444DF183F0531a77218AE',
[eEthereumNetwork.coverage]: '',
[eEthereumNetwork.hardhat]: '',
[eEthereumNetwork.buidlerevm]: '',
[eEthereumNetwork.tenderlyMain]: '0xbd723fc4f1d737dcfc48a07fe7336766d34cad5f',
[eEthereumNetwork.tenderlyMain]: '0xB9062896ec3A615a4e4444DF183F0531a77218AE',
},
LendingRateOracle: {
[eEthereumNetwork.coverage]: '',
@ -326,6 +325,15 @@ export const CommonsConfig: ICommonConfiguration = {
[eEthereumNetwork.main]: '0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2',
[eEthereumNetwork.tenderlyMain]: '0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2',
},
WrappedNativeToken: {
[eEthereumNetwork.coverage]: '', // deployed in local evm
[eEthereumNetwork.hardhat]: '', // deployed in local evm
[eEthereumNetwork.buidlerevm]: '', // deployed in local evm
[eEthereumNetwork.kovan]: '0xd0a1e359811322d97991e03f863a0c30c2cf029c',
[eEthereumNetwork.ropsten]: '0xc778417e063141139fce010982780140aa0cd5ab',
[eEthereumNetwork.main]: '0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2',
[eEthereumNetwork.tenderlyMain]: '0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2',
},
ReserveFactorTreasuryAddress: {
[eEthereumNetwork.coverage]: '0x464c71f6c2f760dda6093dcb91c24c39e5d6e18c',
[eEthereumNetwork.hardhat]: '0x464c71f6c2f760dda6093dcb91c24c39e5d6e18c',
@ -335,4 +343,13 @@ export const CommonsConfig: ICommonConfiguration = {
[eEthereumNetwork.main]: '0x464c71f6c2f760dda6093dcb91c24c39e5d6e18c',
[eEthereumNetwork.tenderlyMain]: '0x464c71f6c2f760dda6093dcb91c24c39e5d6e18c',
},
IncentivesController: {
[eEthereumNetwork.coverage]: ZERO_ADDRESS,
[eEthereumNetwork.hardhat]: ZERO_ADDRESS,
[eEthereumNetwork.buidlerevm]: ZERO_ADDRESS,
[eEthereumNetwork.kovan]: ZERO_ADDRESS,
[eEthereumNetwork.ropsten]: ZERO_ADDRESS,
[eEthereumNetwork.main]: ZERO_ADDRESS,
[eEthereumNetwork.tenderlyMain]: ZERO_ADDRESS,
},
};

View File

@ -1,5 +1,11 @@
import BigNumber from 'bignumber.js';
import { oneEther, oneRay, RAY, ZERO_ADDRESS, MOCK_CHAINLINK_AGGREGATORS_PRICES } from '../../helpers/constants';
import {
oneEther,
oneRay,
RAY,
ZERO_ADDRESS,
MOCK_CHAINLINK_AGGREGATORS_PRICES,
} from '../../helpers/constants';
import { ICommonConfiguration, ePolygonNetwork } from '../../helpers/types';
// ----------------
@ -49,7 +55,10 @@ export const CommonsConfig: ICommonConfiguration = {
borrowRate: oneRay.multipliedBy(0.03).toFixed(),
},
WMATIC: {
borrowRate: oneRay.multipliedBy(0.05).toFixed(), // TEMP
borrowRate: oneRay.multipliedBy(0.05).toFixed(),
},
AAVE: {
borrowRate: oneRay.multipliedBy(0.03).toFixed(),
},
},
// ----------------
@ -62,46 +71,46 @@ export const CommonsConfig: ICommonConfiguration = {
[ePolygonNetwork.matic]: undefined,
},
PoolAdminIndex: 0,
EmergencyAdminIndex: 0,
EmergencyAdmin: {
[ePolygonNetwork.mumbai]: undefined,
[ePolygonNetwork.matic]: undefined,
},
LendingPool: {
[ePolygonNetwork.mumbai]: '',
[ePolygonNetwork.matic]: '0xABdC61Cd16e5111f335f4135B7A0e65Cc7F86327',
[ePolygonNetwork.matic]: '',
},
LendingPoolConfigurator: {
[ePolygonNetwork.mumbai]: '',
[ePolygonNetwork.matic]: '0x17c4A170FFF882862F656597889016D3a6073534',
[ePolygonNetwork.matic]: '',
},
EmergencyAdminIndex: 1,
ProviderRegistry: {
[ePolygonNetwork.mumbai]: '0x569859d41499B4dDC28bfaA43915051FF0A38a6F', // TEMP
[ePolygonNetwork.matic]: '0x28334e4791860a0c1eCF89a62B973ba04a5d643F', // TEMP
[ePolygonNetwork.mumbai]: ZERO_ADDRESS,
[ePolygonNetwork.matic]: '0x3ac4e9aa29940770aeC38fe853a4bbabb2dA9C19',
},
ProviderRegistryOwner: {
[ePolygonNetwork.mumbai]: '0x18d9bA2baEfBdE0FF137C4ad031427EF205f1Fd9', // TEMP
[ePolygonNetwork.matic]: '0x85e4A467343c0dc4aDAB74Af84448D9c45D8ae6F', // TEMP
[ePolygonNetwork.mumbai]: '',
[ePolygonNetwork.matic]: '0xD7D86236d6c463521920fCC50A9CB56f8C8Bf008',
},
LendingRateOracle: {
[ePolygonNetwork.mumbai]: '',
[ePolygonNetwork.matic]: '',
},
[ePolygonNetwork.matic]: '0x17F73aEaD876CC4059089ff815EDA37052960dFB',
},
LendingPoolCollateralManager: {
[ePolygonNetwork.mumbai]: '',
[ePolygonNetwork.matic]: '0x9Af76e0575D139570D3B4c821567Fe935E8c25C5',
[ePolygonNetwork.matic]: '',
},
TokenDistributor: {
[ePolygonNetwork.mumbai]: '',
[ePolygonNetwork.matic]: '',
},
WethGateway: {
WethGateway: {
[ePolygonNetwork.mumbai]: '',
[ePolygonNetwork.matic]: '0x15A46f5073789b7D16F6F46632aE50Bae838d938',
[ePolygonNetwork.matic]: '',
},
AaveOracle: {
[ePolygonNetwork.mumbai]: '',
[ePolygonNetwork.matic]: '0x1B38fa90596F2C25bCf1B193A6c6a718349AFDfC',
[ePolygonNetwork.matic]: '0x0229F777B0fAb107F9591a41d5F02E4e98dB6f2d',
},
FallbackOracle: {
[ePolygonNetwork.mumbai]: ZERO_ADDRESS,
@ -109,12 +118,13 @@ export const CommonsConfig: ICommonConfiguration = {
},
ChainlinkAggregator: {
[ePolygonNetwork.matic]: {
DAI: '0x4746DeC9e833A82EC7C2C1356372CcF2cfcD2F3D',
USDC: '0xfE4A8cc5b5B2366C1B58Bea3858e81843581b2F7',
USDT: '0x0A6513e40db6EB1b165753AD52E80663aeA50545',
WBTC: '0xc907E116054Ad103354f2D350FD2514433D57F6f',
WETH: '0xF9680D99D6C9589e2a93a78A04A279e509205945',
WMATIC: '0xAB594600376Ec9fD91F8e885dADF0CE036862dE0',
AAVE: '0xbE23a3AA13038CfC28aFd0ECe4FdE379fE7fBfc4',
DAI: '0xFC539A559e170f848323e19dfD66007520510085',
USDC: '0xefb7e6be8356cCc6827799B6A7348eE674A80EaE',
USDT: '0xf9d5AAC6E5572AEFa6bd64108ff86a222F69B64d',
WBTC: '0xA338e0492B2F944E9F8C0653D3AD1484f2657a37',
WMATIC: '0x327e23A4855b6F663a28c5161541d69Af8973302',
USD: '0xF9680D99D6C9589e2a93a78A04A279e509205945',
},
[ePolygonNetwork.mumbai]: {
DAI: ZERO_ADDRESS,
@ -134,11 +144,19 @@ export const CommonsConfig: ICommonConfiguration = {
[ePolygonNetwork.matic]: '',
},
WETH: {
[ePolygonNetwork.mumbai]: '0x9c3C9283D3e44854697Cd22D3Faa240Cfb032889', // WMATIC address (untested)
[ePolygonNetwork.matic]: '0x0d500B1d8E8eF31E21C99d1Db9A6444d3ADf1270', // WMATIC address
[ePolygonNetwork.mumbai]: ZERO_ADDRESS,
[ePolygonNetwork.matic]: '0x7ceB23fD6bC0adD59E62ac25578270cFf1b9f619',
},
WrappedNativeToken: {
[ePolygonNetwork.mumbai]: ZERO_ADDRESS,
[ePolygonNetwork.matic]: '0x0d500B1d8E8eF31E21C99d1Db9A6444d3ADf1270',
},
ReserveFactorTreasuryAddress: {
[ePolygonNetwork.mumbai]: '0x464c71f6c2f760dda6093dcb91c24c39e5d6e18c', // TEMP
[ePolygonNetwork.matic]: '0x464c71f6c2f760dda6093dcb91c24c39e5d6e18c', // TEMP
[ePolygonNetwork.mumbai]: ZERO_ADDRESS,
[ePolygonNetwork.matic]: '0x7734280A4337F37Fbf4651073Db7c28C80B339e9',
},
IncentivesController: {
[ePolygonNetwork.mumbai]: ZERO_ADDRESS,
[ePolygonNetwork.matic]: '0x357D51124f59836DeD84c8a1730D72B749d8BC23',
},
};

View File

@ -1,4 +1,3 @@
import { oneRay, ZERO_ADDRESS } from '../../helpers/constants';
import { IMaticConfiguration, ePolygonNetwork } from '../../helpers/types';
import { CommonsConfig } from './commons';
@ -9,6 +8,7 @@ import {
strategyWBTC,
strategyWETH,
strategyMATIC,
strategyAAVE,
} from './reservesConfigs';
// ----------------
@ -18,7 +18,7 @@ import {
export const MaticConfig: IMaticConfiguration = {
...CommonsConfig,
MarketId: 'Matic Market',
ProviderId: 3, // Unknown?
ProviderId: 3, // Unknown?
ReservesConfig: {
DAI: strategyDAI,
USDC: strategyUSDC,
@ -26,6 +26,7 @@ export const MaticConfig: IMaticConfiguration = {
WBTC: strategyWBTC,
WETH: strategyWETH,
WMATIC: strategyMATIC,
AAVE: strategyAAVE,
},
ReserveAssets: {
[ePolygonNetwork.matic]: {
@ -35,8 +36,10 @@ export const MaticConfig: IMaticConfiguration = {
WBTC: '0x1BFD67037B42Cf73acF2047067bd4F2C47D9BfD6',
WETH: '0x7ceB23fD6bC0adD59E62ac25578270cFf1b9f619',
WMATIC: '0x0d500B1d8E8eF31E21C99d1Db9A6444d3ADf1270',
AAVE: '0xD6DF932A45C0f255f85145f286eA0b292B21C90B',
},
[ePolygonNetwork.mumbai]: { // Mock tokens with a simple "mint" external function, except wmatic
[ePolygonNetwork.mumbai]: {
// Mock tokens with a simple "mint" external function, except wmatic
DAI: '0x13b3fda609C1eeb23b4F4b69257840760dCa6C4a',
USDC: '0x52b63223994433FdE2F1350Ba69Dfd2779f06ABA',
USDT: '0xB3abd1912F586fDFFa13606882c28E27913853d2',

View File

@ -1,15 +1,13 @@
// import BigNumber from 'bignumber.js';
// import { oneRay } from '../../helpers/constants';
import { eContractid, IReserveParams } from '../../helpers/types';
import {
rateStrategyStableOne,
import {
rateStrategyStableTwo,
rateStrategyStableThree,
rateStrategyWETH,
rateStrategyAAVE,
rateStrategyVolatileOne,
rateStrategyVolatileTwo,
rateStrategyVolatileThree,
} from './rateStrategies';
export const strategyDAI: IReserveParams = {
@ -18,10 +16,10 @@ export const strategyDAI: IReserveParams = {
liquidationThreshold: '8000',
liquidationBonus: '10500',
borrowingEnabled: true,
stableBorrowRateEnabled: true,
stableBorrowRateEnabled: false,
reserveDecimals: '18',
aTokenImpl: eContractid.AToken,
reserveFactor: '1000'
reserveFactor: '1000',
};
export const strategyUSDC: IReserveParams = {
@ -30,22 +28,22 @@ export const strategyUSDC: IReserveParams = {
liquidationThreshold: '8500',
liquidationBonus: '10500',
borrowingEnabled: true,
stableBorrowRateEnabled: true,
stableBorrowRateEnabled: false,
reserveDecimals: '6',
aTokenImpl: eContractid.AToken,
reserveFactor: '1000'
reserveFactor: '1000',
};
export const strategyUSDT: IReserveParams = {
strategy: rateStrategyStableThree,
baseLTVAsCollateral: '8000',
liquidationThreshold: '8500',
liquidationBonus: '10500',
borrowingEnabled: true,
stableBorrowRateEnabled: true,
reserveDecimals: '6',
aTokenImpl: eContractid.AToken,
reserveFactor: '1000'
strategy: rateStrategyStableThree,
baseLTVAsCollateral: '0',
liquidationThreshold: '0',
liquidationBonus: '0',
borrowingEnabled: true,
stableBorrowRateEnabled: false,
reserveDecimals: '6',
aTokenImpl: eContractid.AToken,
reserveFactor: '1000',
};
export const strategyWETH: IReserveParams = {
@ -54,10 +52,10 @@ export const strategyWETH: IReserveParams = {
liquidationThreshold: '8250',
liquidationBonus: '10500',
borrowingEnabled: true,
stableBorrowRateEnabled: true,
stableBorrowRateEnabled: false,
reserveDecimals: '18',
aTokenImpl: eContractid.AToken,
reserveFactor: '1000'
reserveFactor: '1000',
};
export const strategyWBTC: IReserveParams = {
@ -66,20 +64,32 @@ export const strategyWBTC: IReserveParams = {
liquidationThreshold: '7500',
liquidationBonus: '11000',
borrowingEnabled: true,
stableBorrowRateEnabled: true,
stableBorrowRateEnabled: false,
reserveDecimals: '8',
aTokenImpl: eContractid.AToken,
reserveFactor: '2000'
reserveFactor: '2000',
};
export const strategyMATIC: IReserveParams = {
strategy: rateStrategyVolatileOne, //Temp?
strategy: rateStrategyVolatileOne, //Temp?
baseLTVAsCollateral: '5000',
liquidationThreshold: '6500',
liquidationBonus: '11000',
borrowingEnabled: true,
stableBorrowRateEnabled: true,
stableBorrowRateEnabled: false,
reserveDecimals: '18',
aTokenImpl: eContractid.AToken,
reserveFactor: '2000'
};
reserveFactor: '2000',
};
export const strategyAAVE: IReserveParams = {
strategy: rateStrategyAAVE,
baseLTVAsCollateral: '5000',
liquidationThreshold: '6500',
liquidationBonus: '11000',
borrowingEnabled: false,
stableBorrowRateEnabled: false,
reserveDecimals: '18',
aTokenImpl: eContractid.AToken,
reserveFactor: '0',
};

View File

@ -1,5 +1,11 @@
import BigNumber from 'bignumber.js';
import { oneEther, oneRay, RAY, ZERO_ADDRESS, MOCK_CHAINLINK_AGGREGATORS_PRICES } from '../../helpers/constants';
import {
oneEther,
oneRay,
RAY,
ZERO_ADDRESS,
MOCK_CHAINLINK_AGGREGATORS_PRICES,
} from '../../helpers/constants';
import { ICommonConfiguration, eXDaiNetwork } from '../../helpers/types';
// ----------------
@ -79,14 +85,14 @@ export const CommonsConfig: ICommonConfiguration = {
},
LendingRateOracle: {
[eXDaiNetwork.xdai]: '',
},
},
LendingPoolCollateralManager: {
[eXDaiNetwork.xdai]: '',
},
TokenDistributor: {
[eXDaiNetwork.xdai]: '',
},
WethGateway: {
WethGateway: {
[eXDaiNetwork.xdai]: '',
},
AaveOracle: {
@ -114,7 +120,13 @@ export const CommonsConfig: ICommonConfiguration = {
WETH: {
[eXDaiNetwork.xdai]: '', // DAI: xDAI is the base token, DAI is also there, We need WXDAI
},
WrappedNativeToken: {
[eXDaiNetwork.xdai]: '', // DAI: xDAI is the base token, DAI is also there, We need WXDAI
},
ReserveFactorTreasuryAddress: {
[eXDaiNetwork.xdai]: '', // TEMP
[eXDaiNetwork.xdai]: '', // TEMP
},
IncentivesController: {
[eXDaiNetwork.xdai]: ZERO_ADDRESS,
},
};

269
package-lock.json generated
View File

@ -2657,6 +2657,11 @@
"follow-redirects": "^1.10.0"
}
},
"axios-curlirize": {
"version": "1.3.7",
"resolved": "https://registry.npmjs.org/axios-curlirize/-/axios-curlirize-1.3.7.tgz",
"integrity": "sha512-csSsuMyZj1dv1fL0zRPnDAHWrmlISMvK+wx9WJI/igRVDT4VMgbf2AVenaHghFLfI1nQijXUevYEguYV6u5hjA=="
},
"balanced-match": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.0.tgz",
@ -3118,6 +3123,7 @@
"version": "1.0.2",
"resolved": "https://registry.npmjs.org/call-bind/-/call-bind-1.0.2.tgz",
"integrity": "sha512-7O+FbCihrB5WGbFYesctwmTKae6rOiIzmz1icreWJ+0aA7LJfuqhEso2T9ncpcFtzMQtzXf2QGGueWJGTYsqrA==",
"dev": true,
"requires": {
"function-bind": "^1.1.1",
"get-intrinsic": "^1.0.2"
@ -5529,7 +5535,8 @@
"function-bind": {
"version": "1.1.1",
"resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.1.tgz",
"integrity": "sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A=="
"integrity": "sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A==",
"dev": true
},
"functional-red-black-tree": {
"version": "1.0.1",
@ -6368,6 +6375,36 @@
"@ethersproject/strings": ">=5.0.0-beta.130"
}
},
"@ethersproject/abstract-provider": {
"version": "5.0.8",
"resolved": "https://registry.npmjs.org/@ethersproject/abstract-provider/-/abstract-provider-5.0.8.tgz",
"integrity": "sha512-fqJXkewcGdi8LogKMgRyzc/Ls2js07yor7+g9KfPs09uPOcQLg7cc34JN+lk34HH9gg2HU0DIA5797ZR8znkfw==",
"dev": true,
"optional": true,
"requires": {
"@ethersproject/bignumber": "^5.0.13",
"@ethersproject/bytes": "^5.0.9",
"@ethersproject/logger": "^5.0.8",
"@ethersproject/networks": "^5.0.7",
"@ethersproject/properties": "^5.0.7",
"@ethersproject/transactions": "^5.0.9",
"@ethersproject/web": "^5.0.12"
}
},
"@ethersproject/abstract-signer": {
"version": "5.0.10",
"resolved": "https://registry.npmjs.org/@ethersproject/abstract-signer/-/abstract-signer-5.0.10.tgz",
"integrity": "sha512-irx7kH7FDAeW7QChDPW19WsxqeB1d3XLyOLSXm0bfPqL1SS07LXWltBJUBUxqC03ORpAOcM3JQj57DU8JnVY2g==",
"dev": true,
"optional": true,
"requires": {
"@ethersproject/abstract-provider": "^5.0.8",
"@ethersproject/bignumber": "^5.0.13",
"@ethersproject/bytes": "^5.0.9",
"@ethersproject/logger": "^5.0.8",
"@ethersproject/properties": "^5.0.7"
}
},
"@ethersproject/address": {
"version": "5.0.9",
"resolved": "https://registry.npmjs.org/@ethersproject/address/-/address-5.0.9.tgz",
@ -6382,6 +6419,16 @@
"@ethersproject/rlp": "^5.0.7"
}
},
"@ethersproject/base64": {
"version": "5.0.7",
"resolved": "https://registry.npmjs.org/@ethersproject/base64/-/base64-5.0.7.tgz",
"integrity": "sha512-S5oh5DVfCo06xwJXT8fQC68mvJfgScTl2AXvbYMsHNfIBTDb084Wx4iA9MNlEReOv6HulkS+gyrUM/j3514rSw==",
"dev": true,
"optional": true,
"requires": {
"@ethersproject/bytes": "^5.0.9"
}
},
"@ethersproject/bignumber": {
"version": "5.0.13",
"resolved": "https://registry.npmjs.org/@ethersproject/bignumber/-/bignumber-5.0.13.tgz",
@ -6449,6 +6496,16 @@
"dev": true,
"optional": true
},
"@ethersproject/networks": {
"version": "5.0.7",
"resolved": "https://registry.npmjs.org/@ethersproject/networks/-/networks-5.0.7.tgz",
"integrity": "sha512-dI14QATndIcUgcCBL1c5vUr/YsI5cCHLN81rF7PU+yS7Xgp2/Rzbr9+YqpC6NBXHFUASjh6GpKqsVMpufAL0BQ==",
"dev": true,
"optional": true,
"requires": {
"@ethersproject/logger": "^5.0.8"
}
},
"@ethersproject/properties": {
"version": "5.0.7",
"resolved": "https://registry.npmjs.org/@ethersproject/properties/-/properties-5.0.7.tgz",
@ -6513,6 +6570,20 @@
"@ethersproject/signing-key": "^5.0.8"
}
},
"@ethersproject/web": {
"version": "5.0.12",
"resolved": "https://registry.npmjs.org/@ethersproject/web/-/web-5.0.12.tgz",
"integrity": "sha512-gVxS5iW0bgidZ76kr7LsTxj4uzN5XpCLzvZrLp8TP+4YgxHfCeetFyQkRPgBEAJdNrexdSBayvyJvzGvOq0O8g==",
"dev": true,
"optional": true,
"requires": {
"@ethersproject/base64": "^5.0.7",
"@ethersproject/bytes": "^5.0.9",
"@ethersproject/logger": "^5.0.8",
"@ethersproject/properties": "^5.0.7",
"@ethersproject/strings": "^5.0.8"
}
},
"@sindresorhus/is": {
"version": "0.14.0",
"resolved": "https://registry.npmjs.org/@sindresorhus/is/-/is-0.14.0.tgz",
@ -7825,14 +7896,6 @@
"dev": true,
"requires": {
"node-gyp-build": "^4.2.0"
},
"dependencies": {
"node-gyp-build": {
"version": "4.2.3",
"resolved": "https://registry.npmjs.org/node-gyp-build/-/node-gyp-build-4.2.3.tgz",
"integrity": "sha512-MN6ZpzmfNCRM+3t57PTJHgHyw/h4OWnZ6mR8P5j/uZtqQr46RRuDE/P+g3n0YR/AiYXeWixZZzaip77gdICfRg==",
"dev": true
}
}
},
"bytes": {
@ -7933,6 +7996,16 @@
}
}
},
"call-bind": {
"version": "1.0.2",
"resolved": "https://registry.npmjs.org/call-bind/-/call-bind-1.0.2.tgz",
"integrity": "sha512-7O+FbCihrB5WGbFYesctwmTKae6rOiIzmz1icreWJ+0aA7LJfuqhEso2T9ncpcFtzMQtzXf2QGGueWJGTYsqrA==",
"dev": true,
"requires": {
"function-bind": "^1.1.1",
"get-intrinsic": "^1.0.2"
}
},
"caniuse-lite": {
"version": "1.0.30001174",
"resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001174.tgz",
@ -8451,6 +8524,7 @@
"version": "1.1.3",
"resolved": "https://registry.npmjs.org/define-properties/-/define-properties-1.1.3.tgz",
"integrity": "sha512-3MqfYKj2lLzdMSf8ZIZE/V+Zuy+BgD6f164e8K2w7dgnpKArBDerGYpM46IYYcjnkdPNMjPk9A6VFB8+3SKlXQ==",
"dev": true,
"requires": {
"object-keys": "^1.0.12"
}
@ -8676,6 +8750,7 @@
"version": "1.2.1",
"resolved": "https://registry.npmjs.org/es-to-primitive/-/es-to-primitive-1.2.1.tgz",
"integrity": "sha512-QCOllgZJtaUo9miYBcLChTUaHNjJF3PYs1VidD7AwiEj1kYxKeQTctLAezAOH5ZKRH0g2IgPn6KwB4IT8iRpvA==",
"dev": true,
"requires": {
"is-callable": "^1.1.4",
"is-date-object": "^1.0.1",
@ -10845,7 +10920,8 @@
"function-bind": {
"version": "1.1.1",
"resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.1.tgz",
"integrity": "sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A=="
"integrity": "sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A==",
"dev": true
},
"functional-red-black-tree": {
"version": "1.0.1",
@ -10853,6 +10929,17 @@
"integrity": "sha1-GwqzvVU7Kg1jmdKcDj6gslIHgyc=",
"dev": true
},
"get-intrinsic": {
"version": "1.0.2",
"resolved": "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.0.2.tgz",
"integrity": "sha512-aeX0vrFm21ILl3+JpFFRNe9aUvp6VFZb2/CTbgLb8j75kOhvoNYjt9d8KA/tJG4gSo8nzEDedRl0h7vDmBYRVg==",
"dev": true,
"requires": {
"function-bind": "^1.1.1",
"has": "^1.0.3",
"has-symbols": "^1.0.1"
}
},
"get-stream": {
"version": "5.2.0",
"resolved": "https://registry.npmjs.org/get-stream/-/get-stream-5.2.0.tgz",
@ -10968,6 +11055,7 @@
"version": "1.0.3",
"resolved": "https://registry.npmjs.org/has/-/has-1.0.3.tgz",
"integrity": "sha512-f2dvO0VU6Oej7RkWJGrehjbzMAjFp5/VKPp5tTpWIV4JHHZK1/BxbFRtf/siA2SWTe09caDmVtYYzWEIbBS4zw==",
"dev": true,
"requires": {
"function-bind": "^1.1.1"
}
@ -11005,7 +11093,8 @@
"has-symbols": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/has-symbols/-/has-symbols-1.0.1.tgz",
"integrity": "sha512-PLcsoqu++dmEIZB+6totNFKq/7Do+Z0u4oT0zKOJNl3lYK6vGwwu2hjHs+68OEZbTjiUE9bgOABXbP/GvrS0Kg=="
"integrity": "sha512-PLcsoqu++dmEIZB+6totNFKq/7Do+Z0u4oT0zKOJNl3lYK6vGwwu2hjHs+68OEZbTjiUE9bgOABXbP/GvrS0Kg==",
"dev": true
},
"has-to-string-tag-x": {
"version": "1.4.1",
@ -11278,7 +11367,8 @@
"is-callable": {
"version": "1.2.2",
"resolved": "https://registry.npmjs.org/is-callable/-/is-callable-1.2.2.tgz",
"integrity": "sha512-dnMqspv5nU3LoewK2N/y7KLtxtakvTuaCsU9FU50/QDmdbHNy/4/JuRtMHqRU22o3q+W89YQndQEeCVwK+3qrA=="
"integrity": "sha512-dnMqspv5nU3LoewK2N/y7KLtxtakvTuaCsU9FU50/QDmdbHNy/4/JuRtMHqRU22o3q+W89YQndQEeCVwK+3qrA==",
"dev": true
},
"is-ci": {
"version": "2.0.0",
@ -11301,7 +11391,8 @@
"is-date-object": {
"version": "1.0.2",
"resolved": "https://registry.npmjs.org/is-date-object/-/is-date-object-1.0.2.tgz",
"integrity": "sha512-USlDT524woQ08aoZFzh3/Z6ch9Y/EWXEHQ/AaRN0SkKq4t2Jw2R2339tSXmwuVoY7LLlBCbOIlx2myP/L5zk0g=="
"integrity": "sha512-USlDT524woQ08aoZFzh3/Z6ch9Y/EWXEHQ/AaRN0SkKq4t2Jw2R2339tSXmwuVoY7LLlBCbOIlx2myP/L5zk0g==",
"dev": true
},
"is-descriptor": {
"version": "1.0.2",
@ -11350,7 +11441,8 @@
"is-negative-zero": {
"version": "2.0.1",
"resolved": "https://registry.npmjs.org/is-negative-zero/-/is-negative-zero-2.0.1.tgz",
"integrity": "sha512-2z6JzQvZRa9A2Y7xC6dQQm4FSTSTNWjKIYYTt4246eMTJmIo0Q+ZyOsU66X8lxK1AbB92dFeglPLrhwpeRKO6w=="
"integrity": "sha512-2z6JzQvZRa9A2Y7xC6dQQm4FSTSTNWjKIYYTt4246eMTJmIo0Q+ZyOsU66X8lxK1AbB92dFeglPLrhwpeRKO6w==",
"dev": true
},
"is-object": {
"version": "1.0.2",
@ -11379,6 +11471,7 @@
"version": "1.1.1",
"resolved": "https://registry.npmjs.org/is-regex/-/is-regex-1.1.1.tgz",
"integrity": "sha512-1+QkEcxiLlB7VEyFtyBg94e08OAsvq7FUBgApTq/w2ymCLyKJgDPsybBENVtA7XCQEgEXxKPonG+mvYRxh/LIg==",
"dev": true,
"requires": {
"has-symbols": "^1.0.1"
}
@ -11394,6 +11487,7 @@
"version": "1.0.3",
"resolved": "https://registry.npmjs.org/is-symbol/-/is-symbol-1.0.3.tgz",
"integrity": "sha512-OwijhaRSgqvhm/0ZdAcXNZt9lYdKFpcRDT5ULUuYXPoT794UNOdU+gpT6Rzo7b4V2HUl/op6GqY894AZwv9faQ==",
"dev": true,
"requires": {
"has-symbols": "^1.0.1"
}
@ -12236,7 +12330,8 @@
"object-inspect": {
"version": "1.9.0",
"resolved": "https://registry.npmjs.org/object-inspect/-/object-inspect-1.9.0.tgz",
"integrity": "sha512-i3Bp9iTqwhaLZBxGkRfo5ZbE07BQRT7MGu8+nNgwW9ItGp1TzCTw2DLEoWwjClxBjOFI/hWljTAmYGCEwmtnOw=="
"integrity": "sha512-i3Bp9iTqwhaLZBxGkRfo5ZbE07BQRT7MGu8+nNgwW9ItGp1TzCTw2DLEoWwjClxBjOFI/hWljTAmYGCEwmtnOw==",
"dev": true
},
"object-is": {
"version": "1.1.4",
@ -12246,33 +12341,13 @@
"requires": {
"call-bind": "^1.0.0",
"define-properties": "^1.1.3"
},
"dependencies": {
"es-abstract": {
"version": "1.18.0-next.1",
"resolved": "https://registry.npmjs.org/es-abstract/-/es-abstract-1.18.0-next.1.tgz",
"integrity": "sha512-I4UGspA0wpZXWENrdA0uHbnhte683t3qT/1VFH9aX2dA5PPSf6QW5HHXf5HImaqPmjXaVeVk4RGWnaylmV7uAA==",
"requires": {
"es-to-primitive": "^1.2.1",
"function-bind": "^1.1.1",
"has": "^1.0.3",
"has-symbols": "^1.0.1",
"is-callable": "^1.2.2",
"is-negative-zero": "^2.0.0",
"is-regex": "^1.1.1",
"object-inspect": "^1.8.0",
"object-keys": "^1.1.1",
"object.assign": "^4.1.1",
"string.prototype.trimend": "^1.0.1",
"string.prototype.trimstart": "^1.0.1"
}
}
}
},
"object-keys": {
"version": "1.1.1",
"resolved": "https://registry.npmjs.org/object-keys/-/object-keys-1.1.1.tgz",
"integrity": "sha512-NuAESUOUMrlIXOfHKzD6bpPu3tYt3xvjNdRIQ+FeT0lNb4K8WR70CaDxhuNguS2XG+GjkyMwOzsN5ZktImfhLA=="
"integrity": "sha512-NuAESUOUMrlIXOfHKzD6bpPu3tYt3xvjNdRIQ+FeT0lNb4K8WR70CaDxhuNguS2XG+GjkyMwOzsN5ZktImfhLA==",
"dev": true
},
"object-visit": {
"version": "1.0.1",
@ -12287,32 +12362,12 @@
"version": "4.1.2",
"resolved": "https://registry.npmjs.org/object.assign/-/object.assign-4.1.2.tgz",
"integrity": "sha512-ixT2L5THXsApyiUPYKmW+2EHpXXe5Ii3M+f4e+aJFAHao5amFRW6J0OO6c/LU8Be47utCx2GL89hxGB6XSmKuQ==",
"dev": true,
"requires": {
"call-bind": "^1.0.0",
"define-properties": "^1.1.3",
"has-symbols": "^1.0.1",
"object-keys": "^1.1.1"
},
"dependencies": {
"es-abstract": {
"version": "1.18.0-next.1",
"resolved": "https://registry.npmjs.org/es-abstract/-/es-abstract-1.18.0-next.1.tgz",
"integrity": "sha512-I4UGspA0wpZXWENrdA0uHbnhte683t3qT/1VFH9aX2dA5PPSf6QW5HHXf5HImaqPmjXaVeVk4RGWnaylmV7uAA==",
"requires": {
"es-to-primitive": "^1.2.1",
"function-bind": "^1.1.1",
"has": "^1.0.3",
"has-symbols": "^1.0.1",
"is-callable": "^1.2.2",
"is-negative-zero": "^2.0.0",
"is-regex": "^1.1.1",
"object-inspect": "^1.8.0",
"object-keys": "^1.1.1",
"object.assign": "^4.1.1",
"string.prototype.trimend": "^1.0.1",
"string.prototype.trimstart": "^1.0.1"
}
}
}
},
"object.getownpropertydescriptors": {
@ -12867,47 +12922,16 @@
"unbox-primitive": "^1.0.0"
},
"dependencies": {
"has-symbols": {
"version": "1.0.2",
"resolved": "https://registry.npmjs.org/has-symbols/-/has-symbols-1.0.2.tgz",
"integrity": "sha512-chXa79rL/UC2KlX17jo3vRGz0azaWEx5tGqZg5pO3NUyEJVB17dMruQlzCCOfUvElghKcm5194+BCRvi2Rv/Gw==",
"dev": true
},
"is-callable": {
"version": "1.2.3",
"resolved": "https://registry.npmjs.org/is-callable/-/is-callable-1.2.3.tgz",
"integrity": "sha512-J1DcMe8UYTBSrKezuIUTUwjXsho29693unXM2YhJUTR2txK/eG47bvNa/wipPFmZFgr/N6f1GA66dv0mEyTIyQ==",
"dev": true
},
"is-regex": {
"version": "1.1.2",
"resolved": "https://registry.npmjs.org/is-regex/-/is-regex-1.1.2.tgz",
"integrity": "sha512-axvdhb5pdhEVThqJzYXwMlVuZwC+FF2DpcOhTS+y/8jVq4trxyPgfcwIxIKiyeuLlSQYKkmUaPQJ8ZE4yNKXDg==",
"get-intrinsic": {
"version": "1.1.1",
"resolved": "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.1.1.tgz",
"integrity": "sha512-kWZrnVM42QCiEA2Ig1bG8zjoIMOgxWwYCEeNdwY6Tv/cOSeGpcoX4pXHfKUxNKVoArnrEr2e9srnAxxGIraS9Q==",
"dev": true,
"requires": {
"call-bind": "^1.0.2",
"function-bind": "^1.1.1",
"has": "^1.0.3",
"has-symbols": "^1.0.1"
}
},
"string.prototype.trimend": {
"version": "1.0.4",
"resolved": "https://registry.npmjs.org/string.prototype.trimend/-/string.prototype.trimend-1.0.4.tgz",
"integrity": "sha512-y9xCjw1P23Awk8EvTpcyL2NIr1j7wJ39f+k6lvRnSMz+mz9CGz9NYPelDk42kOz6+ql8xjfK8oYzy3jAP5QU5A==",
"dev": true,
"requires": {
"call-bind": "^1.0.2",
"define-properties": "^1.1.3"
}
},
"string.prototype.trimstart": {
"version": "1.0.4",
"resolved": "https://registry.npmjs.org/string.prototype.trimstart/-/string.prototype.trimstart-1.0.4.tgz",
"integrity": "sha512-jh6e984OBfvxS50tdY2nRZnoC5/mLFKOREQfw8t5yytkoUsJRNxvI/E39qu1sD0OtWI3OC0XgKSmcWwziwYuZw==",
"dev": true,
"requires": {
"call-bind": "^1.0.2",
"define-properties": "^1.1.3"
}
}
}
}
@ -12996,15 +13020,6 @@
"uuid": "^3.3.2"
}
},
"resolve": {
"version": "1.17.0",
"resolved": "https://registry.npmjs.org/resolve/-/resolve-1.17.0.tgz",
"integrity": "sha512-ic+7JYiV8Vi2yzQGFWOkiZD5Z9z7O2Zhm9XMaTxdJExKasieFCr+yXZ/WmXsckHiKl12ar0y6XiXDx3m4RHn1w==",
"dev": true,
"requires": {
"path-parse": "^1.0.6"
}
},
"resolve-url": {
"version": "0.2.1",
"resolved": "https://registry.npmjs.org/resolve-url/-/resolve-url-0.2.1.tgz",
@ -13663,34 +13678,13 @@
"call-bind": "^1.0.0",
"define-properties": "^1.1.3",
"es-abstract": "^1.18.0-next.1"
},
"dependencies": {
"es-abstract": {
"version": "1.18.0-next.1",
"resolved": "https://registry.npmjs.org/es-abstract/-/es-abstract-1.18.0-next.1.tgz",
"integrity": "sha512-I4UGspA0wpZXWENrdA0uHbnhte683t3qT/1VFH9aX2dA5PPSf6QW5HHXf5HImaqPmjXaVeVk4RGWnaylmV7uAA==",
"dev": true,
"requires": {
"es-to-primitive": "^1.2.1",
"function-bind": "^1.1.1",
"has": "^1.0.3",
"has-symbols": "^1.0.1",
"is-callable": "^1.2.2",
"is-negative-zero": "^2.0.0",
"is-regex": "^1.1.1",
"object-inspect": "^1.8.0",
"object-keys": "^1.1.1",
"object.assign": "^4.1.1",
"string.prototype.trimend": "^1.0.1",
"string.prototype.trimstart": "^1.0.1"
}
}
}
},
"string.prototype.trimend": {
"version": "1.0.3",
"resolved": "https://registry.npmjs.org/string.prototype.trimend/-/string.prototype.trimend-1.0.3.tgz",
"integrity": "sha512-ayH0pB+uf0U28CtjlLvL7NaohvR1amUvVZk+y3DYb0Ey2PUV5zPkkKy9+U1ndVEIXO8hNg18eIv9Jntbii+dKw==",
"dev": true,
"requires": {
"call-bind": "^1.0.0",
"define-properties": "^1.1.3"
@ -13700,6 +13694,7 @@
"version": "1.0.3",
"resolved": "https://registry.npmjs.org/string.prototype.trimstart/-/string.prototype.trimstart-1.0.3.tgz",
"integrity": "sha512-oBIBUy5lea5tt0ovtOFiEQaBkoBBkyJhZXzJYrSmDo5IUUqbOPvVezuRs/agBIdZ2p2Eo1FD6bD9USyBLfl3xg==",
"dev": true,
"requires": {
"call-bind": "^1.0.0",
"define-properties": "^1.1.3"
@ -13886,6 +13881,15 @@
"resolved": "https://registry.npmjs.org/object-inspect/-/object-inspect-1.7.0.tgz",
"integrity": "sha512-a7pEHdh1xKIAgTySUGgLMx/xwDZskN1Ud6egYYN3EdRW4ZMPNEDUTF+hwy2LUC+Bl+SyLXANnwz/jyh/qutKUw==",
"dev": true
},
"resolve": {
"version": "1.17.0",
"resolved": "https://registry.npmjs.org/resolve/-/resolve-1.17.0.tgz",
"integrity": "sha512-ic+7JYiV8Vi2yzQGFWOkiZD5Z9z7O2Zhm9XMaTxdJExKasieFCr+yXZ/WmXsckHiKl12ar0y6XiXDx3m4RHn1w==",
"dev": true,
"requires": {
"path-parse": "^1.0.6"
}
}
}
},
@ -14247,14 +14251,6 @@
"dev": true,
"requires": {
"node-gyp-build": "^4.2.0"
},
"dependencies": {
"node-gyp-build": {
"version": "4.2.3",
"resolved": "https://registry.npmjs.org/node-gyp-build/-/node-gyp-build-4.2.3.tgz",
"integrity": "sha512-MN6ZpzmfNCRM+3t57PTJHgHyw/h4OWnZ6mR8P5j/uZtqQr46RRuDE/P+g3n0YR/AiYXeWixZZzaip77gdICfRg==",
"dev": true
}
}
},
"utf8": {
@ -15233,6 +15229,7 @@
"version": "1.1.1",
"resolved": "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.1.1.tgz",
"integrity": "sha512-kWZrnVM42QCiEA2Ig1bG8zjoIMOgxWwYCEeNdwY6Tv/cOSeGpcoX4pXHfKUxNKVoArnrEr2e9srnAxxGIraS9Q==",
"dev": true,
"requires": {
"function-bind": "^1.1.1",
"has": "^1.0.3",
@ -15789,6 +15786,7 @@
"version": "1.0.3",
"resolved": "https://registry.npmjs.org/has/-/has-1.0.3.tgz",
"integrity": "sha512-f2dvO0VU6Oej7RkWJGrehjbzMAjFp5/VKPp5tTpWIV4JHHZK1/BxbFRtf/siA2SWTe09caDmVtYYzWEIbBS4zw==",
"dev": true,
"requires": {
"function-bind": "^1.1.1"
}
@ -15814,7 +15812,8 @@
"has-symbols": {
"version": "1.0.2",
"resolved": "https://registry.npmjs.org/has-symbols/-/has-symbols-1.0.2.tgz",
"integrity": "sha512-chXa79rL/UC2KlX17jo3vRGz0azaWEx5tGqZg5pO3NUyEJVB17dMruQlzCCOfUvElghKcm5194+BCRvi2Rv/Gw=="
"integrity": "sha512-chXa79rL/UC2KlX17jo3vRGz0azaWEx5tGqZg5pO3NUyEJVB17dMruQlzCCOfUvElghKcm5194+BCRvi2Rv/Gw==",
"dev": true
},
"has-to-string-tag-x": {
"version": "1.4.1",

View File

@ -17,42 +17,47 @@
"hardhat:mumbai": "hardhat --network mumbai",
"hardhat:matic": "hardhat --network matic",
"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-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": "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",
"test-liquidate-underlying": "hardhat test test-suites/test-aave/__setup.spec.ts test-suites/test-aave/liquidation-underlying.spec.ts",
"test-configurator": "hardhat test test-suites/test-aave/__setup.spec.ts test-suites/test-aave/configurator.spec.ts",
"test-transfers": "hardhat test test-suites/test-aave/__setup.spec.ts test-suites/test-aave/atoken-transfer.spec.ts",
"test-flash": "hardhat test test-suites/test-aave/__setup.spec.ts test-suites/test-aave/flashloan.spec.ts",
"test-liquidate": "hardhat test test-suites/test-aave/__setup.spec.ts test-suites/test-aave/liquidation-atoken.spec.ts",
"test-deploy": "hardhat test test-suites/test-aave/__setup.spec.ts test-suites/test-aave/test-init.spec.ts",
"test-pausable": "hardhat test test-suites/test-aave/__setup.spec.ts test-suites/test-aave/pausable-functions.spec.ts",
"test-permit": "hardhat test test-suites/test-aave/__setup.spec.ts test-suites/test-aave/atoken-permit.spec.ts",
"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: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",
"console:fork": "FORK=main hardhat console",
"test": "npm run compile && TS_NODE_TRANSPILE_ONLY=1 hardhat test ./test-suites/test-aave/*.spec.ts",
"test-amm": "npm run compile && TS_NODE_TRANSPILE_ONLY=1 hardhat test ./test-suites/test-amm/*.spec.ts",
"test-amm-scenarios": "npm run compile && TS_NODE_TRANSPILE_ONLY=1 hardhat test ./test-suites/test-amm/__setup.spec.ts test-suites/test-amm/scenario.spec.ts",
"test-scenarios": "npm run compile && npx hardhat test test-suites/test-aave/__setup.spec.ts test-suites/test-aave/scenario.spec.ts",
"test-subgraph:scenarios": "npm run compile && hardhat --network hardhatevm_docker test test-suites/test-aave/__setup.spec.ts test-suites/test-aave/subgraph-scenarios.spec.ts",
"test:main:check-list": "npm run compile && FORK=main 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",
"matic:mumbai:full:migration": "npm run compile && npm run hardhat:mumbai matic:mainnet",
"matic:matic:full:migration": "npm run compile && npm run hardhat:matic matic:mainnet",
"amm:kovan:full:migration": "npm run compile && npm run hardhat:kovan -- amm:mainnet --verify",
"aave:docker:full:migration": "npm run compile && npm run hardhat:docker -- aave:mainnet --skip-registry",
"aave:kovan:full:migration": "npm run compile && npm run hardhat:kovan -- aave:mainnet --skip-registry",
"matic:mumbai:full:migration": "npm run compile && npm run hardhat:mumbai sidechain:mainnet -- --pool Matic --skip-registry",
"matic:matic:full:migration": "npm run compile && npm run hardhat:matic sidechain:mainnet -- --pool Matic --skip-registry",
"amm:kovan:full:migration": "npm run compile && npm run hardhat:kovan -- amm:mainnet --skip-registry",
"aave:docker:full:migration:add-registry": "npm run compile && npm run hardhat:docker -- aave:mainnet",
"aave:kovan:full:migration:add-registry": "npm run compile && npm run hardhat:kovan -- aave:mainnet",
"matic:mumbai:full:migration:add-registry": "npm run compile && npm run hardhat:mumbai sidechain:mainnet -- --pool Matic",
"matic:matic:full:migration:add-registry": "npm run compile && npm run hardhat:matic sidechain:mainnet -- --pool Matic",
"amm:kovan:full:migration:add-registry": "npm run compile && npm run hardhat:kovan -- amm:mainnet",
"aave:docker:add-market-to-registry-from-config": "npm run compile && npm run hardhat:docker -- add-market-to-registry --pool Aave",
"aave:kovan:add-market-to-registry-from-config": "npm run compile && npm run hardhat:kovan -- add-market-to-registry --pool Aave",
"matic:mumbai:add-market-to-registry-from-config": "npm run compile && npm run hardhat:mumbai add-market-to-registry --pool Matic",
"amm:kovan:add-market-to-registry-from-config": "npm run compile && npm run hardhat:kovan -- add-market-to-registry --pool Amm",
"matic:matic:add-market-to-registry-from-config": "npm run compile && npm run hardhat:matic add-market-to-registry --pool Matic",
"aave:main:add-market-to-registry-from-config": "npm run compile && npm run hardhat:main -- add-market-to-registry --pool Aave",
"aave:docker:add-market-to-new-registry": "npm run compile && npm run hardhat:docker -- add-market-to-registry --pool Aave --deploy-registry",
"aave:kovan:add-market-to-new-registry": "npm run compile && npm run hardhat:kovan -- add-market-to-registry --pool Aave --verify --deploy-registry",
"matic:mumbai:add-market-to-new-registry": "npm run compile && npm run hardhat:mumbai add-market-to-registry --pool Matic --verify --deploy-registry",
"amm:kovan:add-market-to-new-registry": "npm run compile && npm run hardhat:kovan -- add-market-to-registry --pool Amm --verify --deploy-registry",
"matic:matic:add-market-to-new-registry": "npm run compile && npm run hardhat:matic -- add-market-to-registry --pool Matic --verify --deploy-registry",
"aave:main:add-market-to-new-registry": "npm run compile && npm run hardhat:matic -- add-market-to-registry --pool Matic --verify --deploy-registry",
"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",
"amm:fork:main": "npm run compile && MAINNET_FORK=true hardhat amm:mainnet",
"aave:fork:main": "npm run compile && FORK=main hardhat aave:mainnet",
"aave:fork:kovan": "npm run compile && FORK=kovan hardhat aave:mainnet",
"amm:fork:main": "npm run compile && FORK=main hardhat amm:mainnet",
"amm:fork:kovan": "npm run compile && FORK=kovan hardhat amm:mainnet",
"amm:fork:main:tenderly": "npm run compile && npm run hardhat:tenderly-main -- 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",
"aave:main:full:initialize": "npm run compile && FORK=main full:initialize-tokens --pool Aave",
"amm:main:full:migration": "npm run compile && npm run hardhat:main -- amm:mainnet --verify",
"prettier:check": "npx prettier -c 'tasks/**/*.ts' 'contracts/**/*.sol' 'helpers/**/*.ts' 'test-suites/test-aave/**/*.ts'",
"prettier:write": "prettier --write 'tasks/**/*.ts' 'contracts/**/*.sol' 'helpers/**/*.ts' 'test-suites/test-aave/**/*.ts'",
@ -72,14 +77,15 @@
"kovan:verify": "npm run hardhat:kovan verify:general -- --all --pool Aave",
"ropsten:verify": "npm run hardhat:ropsten verify:general -- --all --pool Aave",
"mainnet:verify": "npm run hardhat:main verify:general -- --all --pool Aave",
"matic:mumbai:verify": "npm run hardhat:mumbai verify:general -- --all --pool Matic",
"matic:mainnet:verify": "npm run hardhat:matic verify:general -- --all --pool Matic",
"matic:mumbai:verify:tokens": "npm run hardhat:mumbai verify:tokens -- --pool Matic",
"matic:mainnet:verify:tokens": "npm run hardhat:matic verify:tokens -- --pool Matic",
"kovan:verify:tokens": "npm run hardhat:kovan verify:tokens -- --pool Aave",
"ropsten:verify:tokens": "npm run hardhat:ropsten verify:tokens -- --pool Aave",
"mainnet:verify:tokens": "npm run hardhat:main verify:tokens -- --pool Aave",
"print-config:fork:mainnet": "MAINNET_FORK=true hardhat print-config:fork",
"print-config:fork:mainnet": "FORK=main hardhat print-config:fork",
"print-config:kovan": "hardhat --network kovan print-config --pool Aave --data-provider 0xA1901785c29cBd48bfA74e46b67C736b26054fa4",
"main:fork:initialize-tokens": "npm run compile && MAINNET_FORK=true hardhat full:initialize-tokens --pool Aave",
"main:initialize-tokens": "npm run compile && hardhat --network main full:initialize-tokens --pool Aave",
"kovan:initialize-tokens": "npm run compile && hardhat --network kovan full:initialize-tokens --pool Aave",
"external:deploy-assets-kovan": "npm run compile && hardhat --network kovan external:deploy-new-asset --symbol ${SYMBOL} --verify",
"external:deploy-assets-main": "npm run compile && hardhat --network main external:deploy-new-asset --symbol ${SYMBOL} --verify",
"prepublishOnly": "npm run compile"
@ -147,6 +153,7 @@
],
"license": "AGPLv3",
"dependencies": {
"axios-curlirize": "^1.3.7",
"tmp-promise": "^3.0.2"
},
"keywords": [

View File

@ -0,0 +1,96 @@
import { task } from 'hardhat/config';
import { getParamPerNetwork } from '../../helpers/contracts-helpers';
import { waitForTx } from '../../helpers/misc-utils';
import { ConfigNames, loadPoolConfig } from '../../helpers/configuration';
import { eNetwork } from '../../helpers/types';
import {
getFirstSigner,
getLendingPoolAddressesProvider,
getLendingPoolAddressesProviderRegistry,
} from '../../helpers/contracts-getters';
import { isAddress, parseEther } from 'ethers/lib/utils';
import { isZeroAddress } from 'ethereumjs-util';
import { Signer } from 'ethers';
import { exit } from 'process';
task('add-market-to-registry', 'Adds address provider to registry')
.addParam('pool', `Pool name to retrieve configuration, supported: ${Object.values(ConfigNames)}`)
.addOptionalParam('addressesProvider', `Address of LendingPoolAddressProvider`)
.addFlag('verify', 'Verify contracts at Etherscan')
.addFlag('deployRegistry', 'Deploy a new address provider registry')
.setAction(async ({ verify, addressesProvider, pool, deployRegistry }, DRE) => {
await DRE.run('set-DRE');
let signer: Signer;
const network = <eNetwork>DRE.network.name;
const poolConfig = loadPoolConfig(pool);
const { ProviderId } = poolConfig;
let providerRegistryAddress = getParamPerNetwork(poolConfig.ProviderRegistry, network);
let providerRegistryOwner = getParamPerNetwork(poolConfig.ProviderRegistryOwner, network);
const currentSignerAddress = await (
await (await getFirstSigner()).getAddress()
).toLocaleLowerCase();
let deployed = false;
if (
deployRegistry ||
!providerRegistryAddress ||
!isAddress(providerRegistryAddress) ||
isZeroAddress(providerRegistryAddress)
) {
console.log('- Deploying a new Address Providers Registry:');
await DRE.run('full:deploy-address-provider-registry', { verify });
providerRegistryAddress = (await getLendingPoolAddressesProviderRegistry()).address;
providerRegistryOwner = await (await getFirstSigner()).getAddress();
deployed = true;
}
if (
!providerRegistryOwner ||
!isAddress(providerRegistryOwner) ||
isZeroAddress(providerRegistryOwner)
) {
throw Error('config.ProviderRegistryOwner is missing or is not an address.');
}
// Checks if deployer address is registry owner
if (process.env.FORK) {
await DRE.network.provider.request({
method: 'hardhat_impersonateAccount',
params: [providerRegistryOwner],
});
signer = DRE.ethers.provider.getSigner(providerRegistryOwner);
const firstAccount = await getFirstSigner();
await firstAccount.sendTransaction({ value: parseEther('10'), to: providerRegistryOwner });
} else if (
!deployed &&
providerRegistryOwner.toLocaleLowerCase() !== currentSignerAddress.toLocaleLowerCase()
) {
console.error('ProviderRegistryOwner config does not match current signer:');
console.error('Expected:', providerRegistryOwner);
console.error('Current:', currentSignerAddress);
exit(2);
} else {
signer = DRE.ethers.provider.getSigner(providerRegistryOwner);
}
// 1. Address Provider Registry instance
const addressesProviderRegistry = (
await getLendingPoolAddressesProviderRegistry(providerRegistryAddress)
).connect(signer);
const addressesProviderInstance = await getLendingPoolAddressesProvider(addressesProvider);
// 2. Set the provider at the Registry
await waitForTx(
await addressesProviderRegistry.registerAddressesProvider(
addressesProviderInstance.address,
ProviderId
)
);
console.log(
`Added LendingPoolAddressesProvider with address "${addressesProviderInstance.address}" to registry located at ${addressesProviderRegistry.address}`
);
});

View File

@ -1,6 +1,7 @@
import { task } from 'hardhat/config';
import { eContractid, eEthereumNetwork, ePolygonNetwork } from '../../helpers/types';
import { eContractid, eEthereumNetwork, eNetwork, ePolygonNetwork } from '../../helpers/types';
import { deployUiPoolDataProvider } from '../../helpers/contracts-deployments';
import { exit } from 'process';
task(`deploy-${eContractid.UiPoolDataProvider}`, `Deploys the UiPoolDataProvider contract`)
.addFlag('verify', 'Verify UiPoolDataProvider contract via Etherscan API.')
@ -9,8 +10,11 @@ task(`deploy-${eContractid.UiPoolDataProvider}`, `Deploys the UiPoolDataProvider
if (!localBRE.network.config.chainId) {
throw new Error('INVALID_CHAIN_ID');
}
const network = localBRE.network.name;
const addressesByNetwork = {
const addressesByNetwork: {
[key: string]: { incentivesController: string; aaveOracle: string };
} = {
[eEthereumNetwork.kovan]: {
incentivesController: '0x0000000000000000000000000000000000000000',
aaveOracle: '0x8fb777d67e9945e2c01936e319057f9d41d559e6',
@ -28,17 +32,25 @@ task(`deploy-${eContractid.UiPoolDataProvider}`, `Deploys the UiPoolDataProvider
aaveOracle: '0xC365C653f7229894F93994CD0b30947Ab69Ff1D5',
},
};
const supportedNetworks = Object.keys(addressesByNetwork);
if (!supportedNetworks.includes(network)) {
console.error(
`[task][error] Network "${network}" not supported, please use one of: ${supportedNetworks.join()}`
);
exit(2);
}
const oracle = addressesByNetwork[network].aaveOracle;
const incentivesController = addressesByNetwork[network].aaveOracle;
console.log(`\n- UiPoolDataProvider deployment`);
console.log(`\tDeploying UiPoolDataProvider implementation ...`);
const UiPoolDataProvider = await deployUiPoolDataProvider(
[
addressesByNetwork[localBRE.network.name].incentivesController,
addressesByNetwork[localBRE.network.name].aaveOracle,
],
const uiPoolDataProvider = await deployUiPoolDataProvider(
[incentivesController, oracle],
verify
);
console.log(`\tFinished UiPoolDataProvider deployment: ${UiPoolDataProvider.address}`);
console.log('UiPoolDataProvider deployed at:', uiPoolDataProvider.address);
console.log(`\tFinished UiPoolDataProvider deployment`);
});

View File

@ -1,8 +1,9 @@
import { task } from 'hardhat/config';
import { UniswapLiquiditySwapAdapterFactory } from '../../types';
import { verifyContract } from '../../helpers/etherscan-verification';
import { verifyContract } from '../../helpers/contracts-helpers';
import { getFirstSigner } from '../../helpers/contracts-getters';
import { eContractid } from '../../helpers/types';
const CONTRACT_NAME = 'UniswapLiquiditySwapAdapter';
@ -29,7 +30,14 @@ task(`deploy-${CONTRACT_NAME}`, `Deploys the ${CONTRACT_NAME} contract`)
).deploy(provider, router, weth);
await uniswapRepayAdapter.deployTransaction.wait();
console.log(`${CONTRACT_NAME}.address`, uniswapRepayAdapter.address);
await verifyContract(uniswapRepayAdapter.address, [provider, router, weth]);
if (verify) {
await verifyContract(eContractid.UniswapLiquiditySwapAdapter, uniswapRepayAdapter, [
provider,
router,
weth,
]);
}
console.log(`\tFinished ${CONTRACT_NAME} proxy and implementation deployment`);
});

View File

@ -1,8 +1,9 @@
import { task } from 'hardhat/config';
import { UniswapRepayAdapterFactory } from '../../types';
import { verifyContract } from '../../helpers/etherscan-verification';
import { verifyContract } from '../../helpers/contracts-helpers';
import { getFirstSigner } from '../../helpers/contracts-getters';
import { eContractid } from '../../helpers/types';
const CONTRACT_NAME = 'UniswapRepayAdapter';
@ -30,7 +31,14 @@ task(`deploy-${CONTRACT_NAME}`, `Deploys the ${CONTRACT_NAME} contract`)
);
await uniswapRepayAdapter.deployTransaction.wait();
console.log(`${CONTRACT_NAME}.address`, uniswapRepayAdapter.address);
await verifyContract(uniswapRepayAdapter.address, [provider, router, weth]);
if (verify) {
await verifyContract(eContractid.UniswapRepayAdapter, uniswapRepayAdapter, [
provider,
router,
weth,
]);
}
console.log(
`\tFinished ${CONTRACT_NAME}${CONTRACT_NAME}lDataProvider proxy and implementation deployment`

View File

@ -18,6 +18,7 @@ task(
const addressesProvider = await deployLendingPoolAddressesProvider(AaveConfig.MarketId, verify);
await waitForTx(await addressesProvider.setPoolAdmin(admin));
await waitForTx(await addressesProvider.setEmergencyAdmin(admin));
const addressesProviderRegistry = await deployLendingPoolAddressesProviderRegistry(verify);
await waitForTx(

View File

@ -4,7 +4,6 @@ import {
deployMockFlashLoanReceiver,
deployWalletBalancerProvider,
deployAaveProtocolDataProvider,
deployWETHGateway,
authorizeWETHGateway,
} from '../../helpers/contracts-deployments';
import { getParamPerNetwork } from '../../helpers/contracts-helpers';
@ -13,18 +12,18 @@ import {
ConfigNames,
getReservesConfigByPool,
getTreasuryAddress,
getWethAddress,
loadPoolConfig,
} from '../../helpers/configuration';
import { tEthereumAddress, AavePools, eContractid } from '../../helpers/types';
import { waitForTx, filterMapBy } from '../../helpers/misc-utils';
import { waitForTx, filterMapBy, notFalsyOrZeroAddress } from '../../helpers/misc-utils';
import { configureReservesByHelper, initReservesByHelper } from '../../helpers/init-helpers';
import { getAllTokenAddresses } from '../../helpers/mock-helpers';
import { ZERO_ADDRESS } from '../../helpers/constants';
import {
getAllMockedTokens,
getLendingPoolAddressesProvider,
getWETHGateway,
} from '../../helpers/contracts-getters';
import { insertContractAddressInDb } from '../../helpers/contracts-helpers';
@ -92,6 +91,10 @@ task('dev:initialize-lending-pool', 'Initialize lending pool configuration.')
await insertContractAddressInDb(eContractid.AaveProtocolDataProvider, testHelpers.address);
const lendingPoolAddress = await addressesProvider.getLendingPool();
const gateWay = await getParamPerNetwork(WethGateway, network);
await authorizeWETHGateway(gateWay, lendingPoolAddress);
let gateway = getParamPerNetwork(WethGateway, network);
if (!notFalsyOrZeroAddress(gateway)) {
gateway = (await getWETHGateway()).address;
}
await authorizeWETHGateway(gateway, lendingPoolAddress);
});

View File

@ -1,11 +1,30 @@
import { formatEther } from 'ethers/lib/utils';
import { task } from 'hardhat/config';
import { ConfigNames, loadPoolConfig } from '../../helpers/configuration';
import { deployLendingPoolAddressesProviderRegistry } from '../../helpers/contracts-deployments';
import { getFirstSigner } from '../../helpers/contracts-getters';
import { getParamPerNetwork } from '../../helpers/contracts-helpers';
import { notFalsyOrZeroAddress } from '../../helpers/misc-utils';
import { eNetwork } from '../../helpers/types';
task('full:deploy-address-provider-registry', 'Deploy address provider registry')
.addFlag('verify', 'Verify contracts at Etherscan')
.setAction(async ({ verify }, DRE) => {
.addParam('pool', `Pool name to retrieve configuration, supported: ${Object.values(ConfigNames)}`)
.setAction(async ({ verify, pool }, DRE) => {
await DRE.run('set-DRE');
const poolConfig = loadPoolConfig(pool);
const network = <eNetwork>DRE.network.name;
const signer = await getFirstSigner();
const contract = await deployLendingPoolAddressesProviderRegistry(verify);
console.log('Registry Address:', contract.address);
const providerRegistryAddress = getParamPerNetwork(poolConfig.ProviderRegistry, network);
console.log('Signer', await signer.getAddress());
console.log('Balance', formatEther(await signer.getBalance()));
if (notFalsyOrZeroAddress(providerRegistryAddress)) {
console.log('Already deployed Provider Registry Address at', providerRegistryAddress);
} else {
const contract = await deployLendingPoolAddressesProviderRegistry(verify);
console.log('Deployed Registry Address:', contract.address);
}
});

View File

@ -1,9 +1,5 @@
import { task } from 'hardhat/config';
import { getParamPerNetwork } from '../../helpers/contracts-helpers';
import {
deployLendingPoolAddressesProvider,
deployLendingPoolAddressesProviderRegistry,
} from '../../helpers/contracts-deployments';
import { deployLendingPoolAddressesProvider } from '../../helpers/contracts-deployments';
import { notFalsyOrZeroAddress, waitForTx } from '../../helpers/misc-utils';
import {
ConfigNames,
@ -11,16 +7,8 @@ import {
getGenesisPoolAdmin,
getEmergencyAdmin,
} from '../../helpers/configuration';
import { getParamPerNetwork } from '../../helpers/contracts-helpers';
import { eNetwork } from '../../helpers/types';
import {
getFirstSigner,
getLendingPoolAddressesProviderRegistry,
} from '../../helpers/contracts-getters';
import { formatEther, isAddress, parseEther } from 'ethers/lib/utils';
import { isZeroAddress } from 'ethereumjs-util';
import { Signer, BigNumber } from 'ethers';
import { parse } from 'path';
//import BigNumber from 'bignumber.js';
task(
'full:deploy-address-provider',
@ -28,65 +16,29 @@ task(
)
.addFlag('verify', 'Verify contracts at Etherscan')
.addParam('pool', `Pool name to retrieve configuration, supported: ${Object.values(ConfigNames)}`)
.setAction(async ({ verify, pool }, DRE) => {
.addFlag('skipRegistry')
.setAction(async ({ verify, pool, skipRegistry }, DRE) => {
await DRE.run('set-DRE');
let signer: Signer;
const network = <eNetwork>DRE.network.name;
const poolConfig = loadPoolConfig(pool);
const { ProviderId, MarketId } = poolConfig;
const { MarketId } = poolConfig;
const providerRegistryAddress = getParamPerNetwork(poolConfig.ProviderRegistry, network);
const providerRegistryOwner = getParamPerNetwork(poolConfig.ProviderRegistryOwner, network);
if (
!providerRegistryAddress ||
!isAddress(providerRegistryAddress) ||
isZeroAddress(providerRegistryAddress)
) {
throw Error('config.ProviderRegistry is missing or is not an address.');
}
if (
!providerRegistryOwner ||
!isAddress(providerRegistryOwner) ||
isZeroAddress(providerRegistryOwner)
) {
throw Error('config.ProviderRegistryOwner is missing or is not an address.');
}
// Checks if deployer address is registry owner
if (process.env.MAINNET_FORK === 'true') {
await DRE.network.provider.request({
method: 'hardhat_impersonateAccount',
params: [providerRegistryOwner],
});
signer = DRE.ethers.provider.getSigner(providerRegistryOwner);
const firstAccount = await getFirstSigner();
await firstAccount.sendTransaction({ value: parseEther('10'), to: providerRegistryOwner });
} else {
signer = DRE.ethers.provider.getSigner(providerRegistryOwner);
}
// 1. Address Provider Registry instance
const addressesProviderRegistry = (
await getLendingPoolAddressesProviderRegistry(providerRegistryAddress)
).connect(signer);
console.log('Registry Address', addressesProviderRegistry.address);
// 2. Deploy address provider and set genesis manager
// 1. Deploy address provider and set genesis manager
const addressesProvider = await deployLendingPoolAddressesProvider(MarketId, verify);
// DISABLE SEC. 3 FOR GOVERNANCE USE!
// 3. Set the provider at the Registry
await waitForTx(
await addressesProviderRegistry.registerAddressesProvider(
addressesProvider.address,
ProviderId
)
);
// 4. Set pool admins
// 2. Add to registry or setup a new one
if (!skipRegistry) {
const providerRegistryAddress = getParamPerNetwork(
poolConfig.ProviderRegistry,
<eNetwork>DRE.network.name
);
await DRE.run('add-market-to-registry', {
pool,
addressesProvider: addressesProvider.address,
deployRegistry: !notFalsyOrZeroAddress(providerRegistryAddress),
});
}
// 3. Set pool admins
await waitForTx(await addressesProvider.setPoolAdmin(await getGenesisPoolAdmin(poolConfig)));
await waitForTx(await addressesProvider.setEmergencyAdmin(await getEmergencyAdmin(poolConfig)));

View File

@ -34,6 +34,7 @@ task('full:deploy-lending-pool', 'Deploy lending pool for dev enviroment')
console.log('\tDeploying new lending pool implementation & libraries...');
const lendingPoolImpl = await deployLendingPool(verify);
lendingPoolImplAddress = lendingPoolImpl.address;
await lendingPoolImpl.initialize(addressesProvider.address);
}
console.log('\tSetting lending pool implementation with address:', lendingPoolImplAddress);
// Set lending pool impl to Address provider

View File

@ -17,7 +17,7 @@ import {
getLendingRateOracle,
getPairsTokenAggregator,
} from '../../helpers/contracts-getters';
import { AaveOracle } from '../../types';
import { AaveOracle, LendingRateOracle } from '../../types';
task('full:deploy-oracles', 'Deploy oracles for dev enviroment')
.addFlag('verify', 'Verify contracts at Etherscan')
@ -49,38 +49,34 @@ task('full:deploy-oracles', 'Deploy oracles for dev enviroment')
const [tokens, aggregators] = getPairsTokenAggregator(tokensToWatch, chainlinkAggregators);
let aaveOracle: AaveOracle;
let lendingRateOracle: LendingRateOracle;
if (notFalsyOrZeroAddress(aaveOracleAddress)) {
aaveOracle = await await getAaveOracle(aaveOracleAddress);
const owner = await aaveOracle.owner();
const signer = DRE.ethers.provider.getSigner(owner);
aaveOracle = await (await getAaveOracle(aaveOracleAddress)).connect(signer);
await waitForTx(await aaveOracle.setAssetSources(tokens, aggregators));
} else {
aaveOracle = await deployAaveOracle(
[tokens, aggregators, fallbackOracleAddress, await getWethAddress(poolConfig)],
verify
);
await waitForTx(await aaveOracle.setAssetSources(tokens, aggregators));
}
let lendingRateOracle = notFalsyOrZeroAddress(lendingRateOracleAddress)
? await getLendingRateOracle(lendingRateOracleAddress)
: await deployLendingRateOracle(verify);
const { USD, ...tokensAddressesWithoutUsd } = tokensToWatch;
if (notFalsyOrZeroAddress(lendingRateOracleAddress)) {
lendingRateOracle = await getLendingRateOracle(lendingRateOracleAddress);
} else {
lendingRateOracle = await deployLendingRateOracle(verify);
const { USD, ...tokensAddressesWithoutUsd } = tokensToWatch;
await setInitialMarketRatesInRatesOracleByHelper(
lendingRateOracles,
tokensAddressesWithoutUsd,
lendingRateOracle,
admin
);
}
console.log('Aave Oracle: %s', lendingRateOracle.address);
console.log('Lending Rate Oracle: %s', lendingRateOracle.address);
lendingRateOracle = lendingRateOracle.connect(
DRE.ethers.provider.getSigner(await lendingRateOracle.owner())
);
// This must be done any time a new market is created I believe
//if (!lendingRateOracleAddress) {
await setInitialMarketRatesInRatesOracleByHelper(
lendingRateOracles,
tokensAddressesWithoutUsd,
lendingRateOracle,
admin
);
//}
console.log('ORACLES: %s and %s', aaveOracle.address, lendingRateOracle.address);
// Register the proxy price provider on the addressesProvider
await waitForTx(await addressesProvider.setPriceOracle(aaveOracle.address));
await waitForTx(await addressesProvider.setLendingRateOracle(lendingRateOracle.address));

View File

@ -1,10 +1,10 @@
import { task } from 'hardhat/config';
import { AaveConfig } from '../../markets/aave/index';
import { getParamPerNetwork } from '../../helpers/contracts-helpers';
import { loadPoolConfig, ConfigNames, getWethAddress } from '../../helpers/configuration';
import {
loadPoolConfig,
ConfigNames,
getWrappedNativeTokenAddress,
} from '../../helpers/configuration';
import { deployWETHGateway } from '../../helpers/contracts-deployments';
import { DRE } from '../../helpers/misc-utils';
import { eNetwork } from '../../helpers/types';
const CONTRACT_NAME = 'WETHGateway';
@ -13,20 +13,13 @@ task(`full-deploy-weth-gateway`, `Deploys the ${CONTRACT_NAME} contract`)
.addFlag('verify', `Verify ${CONTRACT_NAME} contract via Etherscan API.`)
.setAction(async ({ verify, pool }, localBRE) => {
await localBRE.run('set-DRE');
const network = <eNetwork>localBRE.network.name;
const poolConfig = loadPoolConfig(pool);
const Weth = await getWethAddress(poolConfig);
const { WethGateway } = poolConfig;
const Weth = await getWrappedNativeTokenAddress(poolConfig);
if (!localBRE.network.config.chainId) {
throw new Error('INVALID_CHAIN_ID');
}
let gateWay = getParamPerNetwork(WethGateway, network);
if (gateWay === '') {
const wethGateWay = await deployWETHGateway([Weth], verify);
console.log(`${CONTRACT_NAME}.address`, wethGateWay.address);
console.log(`\tFinished ${CONTRACT_NAME} deployment`);
} else {
console.log(`Weth gateway already deployed. Address: ${gateWay}`);
}
const wethGateWay = await deployWETHGateway([Weth], verify);
console.log(`${CONTRACT_NAME}.address`, wethGateWay.address);
console.log(`\tFinished ${CONTRACT_NAME} deployment`);
});

View File

@ -40,10 +40,11 @@ task('full:initialize-lending-pool', 'Initialize lending pool configuration.')
ReservesConfig,
LendingPoolCollateralManager,
WethGateway,
IncentivesController,
} = poolConfig as ICommonConfiguration;
const reserveAssets = await getParamPerNetwork(ReserveAssets, network);
const incentivesController = await getParamPerNetwork(IncentivesController, network);
const addressesProvider = await getLendingPoolAddressesProvider();
const testHelpers = await getAaveProtocolDataProvider();
@ -64,7 +65,7 @@ task('full:initialize-lending-pool', 'Initialize lending pool configuration.')
SymbolPrefix,
admin,
treasuryAddress,
ZERO_ADDRESS,
incentivesController,
verify
);
await configureReservesByHelper(ReservesConfig, reserveAssets, testHelpers, admin);
@ -87,6 +88,18 @@ task('full:initialize-lending-pool', 'Initialize lending pool configuration.')
await addressesProvider.setLendingPoolCollateralManager(collateralManagerAddress)
);
console.log(
'\tSetting AaveProtocolDataProvider at AddressesProvider at id: 0x01',
collateralManagerAddress
);
const aaveProtocolDataProvider = await getAaveProtocolDataProvider();
await waitForTx(
await addressesProvider.setAddress(
'0x0100000000000000000000000000000000000000000000000000000000000000',
aaveProtocolDataProvider.address
)
);
await deployWalletBalancerProvider(verify);
const lendingPoolAddress = await addressesProvider.getLendingPool();
@ -95,6 +108,7 @@ task('full:initialize-lending-pool', 'Initialize lending pool configuration.')
if (!notFalsyOrZeroAddress(gateWay)) {
gateWay = (await getWETHGateway()).address;
}
console.log('GATEWAY', gateWay);
await authorizeWETHGateway(gateWay, lendingPoolAddress);
} catch (err) {
console.error(err);

View File

@ -29,7 +29,10 @@ task('aave:dev', 'Deploy development enviroment')
console.log('4. Deploy oracles');
await localBRE.run('dev:deploy-oracles', { verify, pool: POOL_NAME });
console.log('5. Initialize lending pool');
console.log('5. Deploy WETH Gateway');
await localBRE.run('full-deploy-weth-gateway', { verify, pool: POOL_NAME });
console.log('6. Initialize lending pool');
await localBRE.run('dev:initialize-lending-pool', { verify, pool: POOL_NAME });
console.log('\nFinished migration');

View File

@ -6,7 +6,8 @@ import { usingTenderly } from '../../helpers/tenderly-utils';
task('aave:mainnet', 'Deploy development enviroment')
.addFlag('verify', 'Verify contracts at Etherscan')
.setAction(async ({ verify }, DRE) => {
.addFlag('skipRegistry', 'Skip addresses provider registration at Addresses Provider Registry')
.setAction(async ({ verify, skipRegistry }, DRE) => {
const POOL_NAME = ConfigNames.Aave;
await DRE.run('set-DRE');
@ -18,7 +19,7 @@ task('aave: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 });
console.log('2. Deploy lending pool');
await DRE.run('full:deploy-lending-pool', { pool: POOL_NAME });

View File

@ -6,7 +6,8 @@ import { usingTenderly } from '../../helpers/tenderly-utils';
task('amm:mainnet', 'Deploy development enviroment')
.addFlag('verify', 'Verify contracts at Etherscan')
.setAction(async ({ verify }, DRE) => {
.addFlag('skipRegistry', 'Skip addresses provider registration at Addresses Provider Registry')
.setAction(async ({ verify, skipRegistry }, DRE) => {
const POOL_NAME = ConfigNames.Amm;
await DRE.run('set-DRE');
@ -18,7 +19,7 @@ task('amm: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 });
console.log('2. Deploy lending pool');
await DRE.run('full:deploy-lending-pool', { pool: POOL_NAME });

View File

@ -4,10 +4,12 @@ import { ConfigNames } from '../../helpers/configuration';
import { printContracts } from '../../helpers/misc-utils';
import { usingTenderly } from '../../helpers/tenderly-utils';
task('matic:mainnet', 'Deploy development enviroment')
task('sidechain:mainnet', 'Deploy market at sidechain')
.addParam('pool', `Market pool configuration, one of ${Object.keys(ConfigNames)}`)
.addFlag('verify', 'Verify contracts at Etherscan')
.setAction(async ({ verify }, DRE) => {
const POOL_NAME = ConfigNames.Matic;
.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
@ -17,8 +19,11 @@ task('matic:mainnet', 'Deploy development enviroment')
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 });
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 });
@ -28,16 +33,18 @@ task('matic:mainnet', 'Deploy development enviroment')
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('5. Initialize lending pool');
console.log('6. Initialize lending pool');
await DRE.run('full:initialize-lending-pool', { pool: POOL_NAME });
if (verify) {
printContracts();
console.log('4. Veryfing contracts');
console.log('7. Veryfing contracts');
await DRE.run('verify:general', { all: true, pool: POOL_NAME });
console.log('5. Veryfing aTokens and debtTokens');
console.log('8. Veryfing aTokens and debtTokens');
await DRE.run('verify:tokens', { pool: POOL_NAME });
}

View File

@ -1,88 +0,0 @@
import { task } from 'hardhat/config';
import { getParamPerNetwork } from '../../helpers/contracts-helpers';
import { loadPoolConfig, ConfigNames, getTreasuryAddress } from '../../helpers/configuration';
import { eEthereumNetwork, eNetwork, ICommonConfiguration } from '../../helpers/types';
import { waitForTx } from '../../helpers/misc-utils';
import { initTokenReservesByHelper } from '../../helpers/init-helpers';
import { exit } from 'process';
import {
getFirstSigner,
getLendingPoolAddressesProvider,
getLendingPoolAddressesProviderRegistry,
} from '../../helpers/contracts-getters';
import { Signer } from 'ethers';
import { formatEther, parseEther } from 'ethers/lib/utils';
task('full:initialize-tokens', 'Initialize lending pool configuration.')
.addParam('pool', `Pool name to retrieve configuration, supported: ${Object.values(ConfigNames)}`)
.addParam('ratesDeployer', `RatesHelper address `)
.addParam('dataProvider', `Data provider address`)
.addFlag('verify')
.setAction(async ({ verify, pool, dataProvider, ratesDeployer }, DRE) => {
try {
await DRE.run('set-DRE');
let signer: Signer;
const network =
process.env.MAINNET_FORK === 'true' ? eEthereumNetwork.main : <eNetwork>DRE.network.name;
const poolConfig = loadPoolConfig(pool);
const { ReserveAssets, ReservesConfig } = poolConfig as ICommonConfiguration;
const reserveAssets = await getParamPerNetwork(ReserveAssets, network);
const treasuryAddress = await getTreasuryAddress(poolConfig);
const providerRegistryAddress = getParamPerNetwork(poolConfig.ProviderRegistry, network);
const providerRegistryOwner = getParamPerNetwork(poolConfig.ProviderRegistryOwner, network);
const providerRegistry = await getLendingPoolAddressesProviderRegistry(
providerRegistryAddress
);
const providers = await providerRegistry.getAddressesProvidersList();
const addressesProvider = await getLendingPoolAddressesProvider(providers[0]); // Checks first provider
const admin = await addressesProvider.getPoolAdmin();
if (!reserveAssets) {
throw 'Reserve assets is undefined. Check ReserveAssets configuration at config directory';
}
if (process.env.MAINNET_FORK === 'true') {
await DRE.network.provider.request({
method: 'hardhat_impersonateAccount',
params: [providerRegistryOwner],
});
signer = DRE.ethers.provider.getSigner(providerRegistryOwner);
const user = await getFirstSigner();
await waitForTx(
await user.sendTransaction({ to: await signer.getAddress(), value: parseEther('10') })
);
const balance = await signer.getBalance();
console.log('signer balance', formatEther(balance));
} else {
signer = DRE.ethers.provider.getSigner(providerRegistryOwner);
}
// Init unitilialized reserves
await initTokenReservesByHelper(
ReservesConfig,
reserveAssets,
admin,
addressesProvider.address,
ratesDeployer,
dataProvider,
signer,
treasuryAddress,
verify
);
// Show contracts state
await DRE.run('print-config', {
pool: 'Aave',
dataProvider,
});
} catch (err) {
console.error(err);
exit(1);
}
});

View File

@ -14,10 +14,10 @@ task('print-config', 'Inits the DRE, to have access to all the plugins')
.addParam('pool', `Pool name to retrieve configuration, supported: ${Object.values(ConfigNames)}`)
.setAction(async ({ pool, dataProvider }, localBRE) => {
await localBRE.run('set-DRE');
const network =
process.env.MAINNET_FORK === 'true'
? eEthereumNetwork.main
: (localBRE.network.name as eNetwork);
const network = process.env.FORK
? (process.env.FORK as eNetwork)
: (localBRE.network.name as eNetwork);
console.log(network);
const poolConfig = loadPoolConfig(pool);
const providerRegistryAddress = getParamPerNetwork(poolConfig.ProviderRegistry, network);
@ -60,7 +60,7 @@ task('print-config', 'Inits the DRE, to have access to all the plugins')
];
const tokensFields = ['aToken', 'stableDebtToken', 'variableDebtToken'];
for (const [symbol, address] of Object.entries(
getParamPerNetwork(poolConfig.ReserveAssets, network)
getParamPerNetwork(poolConfig.ReserveAssets, network as eNetwork)
)) {
console.log(`- ${symbol} asset config`);
console.log(` - reserve address: ${address}`);

View File

@ -5,6 +5,8 @@ import { usingTenderly } from '../../helpers/tenderly-utils';
import { HardhatRuntimeEnvironment } from 'hardhat/types';
import { getFirstSigner } from '../../helpers/contracts-getters';
import { formatEther } from 'ethers/lib/utils';
import { fork } from 'child_process';
import { env } from 'process';
task(`set-DRE`, `Inits the DRE, to have access to all the plugins' objects`).setAction(
async (_, _DRE) => {
@ -36,6 +38,18 @@ task(`set-DRE`, `Inits the DRE, to have access to all the plugins' objects`).set
);
}
console.log('- Enviroment');
if (process.env.FORK) {
console.log(' - Fork Mode activated at network: ', process.env.FORK);
if (_DRE?.config?.networks?.hardhat?.forking?.url) {
console.log(' - Provider URL:', _DRE.config.networks.hardhat.forking?.url?.split('/')[2]);
} else {
console.error(
`[FORK][Error], missing Provider URL for "${_DRE.network.name}" network. Fill the URL at './helper-hardhat-config.ts' file`
);
}
}
console.log(' - Network :', _DRE.network.name);
setDRE(_DRE);
return _DRE;
}

View File

@ -1,6 +1,5 @@
import { task } from 'hardhat/config';
import { verifyContract, checkVerification } from '../../helpers/etherscan-verification';
import { verifyEtherscanContract, checkVerification } from '../../helpers/etherscan-verification';
interface VerifyParams {
contractName: string;
address: string;
@ -24,6 +23,6 @@ task('verify-sc', 'Inits the DRE, to have access to all the plugins')
checkVerification();
const result = await verifyContract(address, constructorArguments, libraries);
const result = await verifyEtherscanContract(address, constructorArguments, libraries);
return result;
});

View File

@ -19,13 +19,13 @@ import {
getLendingPoolConfiguratorImpl,
getLendingPoolConfiguratorProxy,
getLendingPoolImpl,
getProxy,
getWalletProvider,
getWETHGateway,
} from '../../helpers/contracts-getters';
import { getParamPerNetwork } from '../../helpers/contracts-helpers';
import { verifyContract } from '../../helpers/etherscan-verification';
import { verifyContract, getParamPerNetwork } from '../../helpers/contracts-helpers';
import { notFalsyOrZeroAddress } from '../../helpers/misc-utils';
import { eNetwork, ICommonConfiguration } from '../../helpers/types';
import { eContractid, eNetwork, ICommonConfiguration } from '../../helpers/types';
task('verify:general', 'Verify contracts at Etherscan')
.addFlag('all', 'Verify all contracts at Etherscan')
@ -55,6 +55,10 @@ task('verify:general', 'Verify contracts at Etherscan')
const lendingPoolConfiguratorAddress = await addressesProvider.getLendingPoolConfigurator(); //getLendingPoolConfiguratorProxy();
const lendingPoolCollateralManagerAddress = await addressesProvider.getLendingPoolCollateralManager();
const lendingPoolProxy = await getProxy(lendingPoolAddress);
const lendingPoolConfiguratorProxy = await getProxy(lendingPoolConfiguratorAddress);
const lendingPoolCollateralManagerProxy = await getProxy(lendingPoolCollateralManagerAddress);
if (all) {
const lendingPoolImplAddress = getParamPerNetwork(LendingPool, network);
const lendingPoolImpl = notFalsyOrZeroAddress(lendingPoolImplAddress)
@ -89,64 +93,69 @@ task('verify:general', 'Verify contracts at Etherscan')
// Address Provider
console.log('\n- Verifying address provider...\n');
await verifyContract(addressesProvider.address, [MarketId]);
await verifyContract(eContractid.LendingPoolAddressesProvider, addressesProvider, [MarketId]);
// Address Provider Registry
console.log('\n- Verifying address provider registry...\n');
await verifyContract(addressesProviderRegistry.address, []);
await verifyContract(
eContractid.LendingPoolAddressesProviderRegistry,
addressesProviderRegistry,
[]
);
// Lending Pool implementation
console.log('\n- Verifying LendingPool Implementation...\n');
await verifyContract(lendingPoolImpl.address, []);
await verifyContract(eContractid.LendingPool, lendingPoolImpl, []);
// Lending Pool Configurator implementation
console.log('\n- Verifying LendingPool Configurator Implementation...\n');
await verifyContract(lendingPoolConfiguratorImpl.address, []);
await verifyContract(eContractid.LendingPoolConfigurator, lendingPoolConfiguratorImpl, []);
// Lending Pool Collateral Manager implementation
console.log('\n- Verifying LendingPool Collateral Manager Implementation...\n');
await verifyContract(lendingPoolCollateralManagerImpl.address, []);
await verifyContract(
eContractid.LendingPoolCollateralManager,
lendingPoolCollateralManagerImpl,
[]
);
// Test helpers
console.log('\n- Verifying Aave Provider Helpers...\n');
await verifyContract(dataProvider.address, [addressesProvider.address]);
await verifyContract(eContractid.AaveProtocolDataProvider, dataProvider, [
addressesProvider.address,
]);
// Wallet balance provider
console.log('\n- Verifying Wallet Balance Provider...\n');
await verifyContract(walletProvider.address, []);
await verifyContract(eContractid.WalletBalanceProvider, walletProvider, []);
// WETHGateway
console.log('\n- Verifying WETHGateway...\n');
await verifyContract(wethGateway.address, [await getWethAddress(poolConfig)]);
await verifyContract(eContractid.WETHGateway, wethGateway, [
await getWethAddress(poolConfig),
]);
}
// Lending Pool proxy
console.log('\n- Verifying Lending Pool Proxy...\n');
await verifyContract(lendingPoolAddress, [addressesProvider.address]);
await verifyContract(eContractid.InitializableAdminUpgradeabilityProxy, lendingPoolProxy, [
addressesProvider.address,
]);
// LendingPool Conf proxy
console.log('\n- Verifying Lending Pool Configurator Proxy...\n');
await verifyContract(lendingPoolConfiguratorAddress, [addressesProvider.address]);
await verifyContract(
eContractid.InitializableAdminUpgradeabilityProxy,
lendingPoolConfiguratorProxy,
[addressesProvider.address]
);
// Proxy collateral manager
console.log('\n- Verifying Lending Pool Collateral Manager Proxy...\n');
await verifyContract(lendingPoolCollateralManagerAddress, []);
await verifyContract(
eContractid.InitializableAdminUpgradeabilityProxy,
lendingPoolCollateralManagerProxy,
[]
);
// DelegatedAwareAToken
console.log('\n- Verifying DelegatedAwareAToken...\n');
const UNI = getParamPerNetwork(ReserveAssets, network).UNI;
const aUNI = await getAddressById('aUNI');
if (aUNI) {
console.log('Verifying aUNI');
await verifyContract(aUNI, [
lendingPoolAddress,
UNI,
treasuryAddress,
'Aave interest bearing UNI',
'aUNI',
ZERO_ADDRESS,
]);
} else {
console.error('Missing aUNI address at JSON DB. Skipping...');
}
console.log('Finished verifications.');
});

View File

@ -8,14 +8,16 @@ import {
import { ZERO_ADDRESS } from '../../helpers/constants';
import {
getAddressById,
getAToken,
getFirstSigner,
getLendingPool,
getInterestRateStrategy,
getLendingPoolAddressesProvider,
getLendingPoolConfiguratorProxy,
getProxy,
getStableDebtToken,
getVariableDebtToken,
} from '../../helpers/contracts-getters';
import { getParamPerNetwork } from '../../helpers/contracts-helpers';
import { verifyContract } from '../../helpers/etherscan-verification';
import { eNetwork, ICommonConfiguration, IReserveParams } from '../../helpers/types';
import { getParamPerNetwork, verifyContract } from '../../helpers/contracts-helpers';
import { eContractid, eNetwork, ICommonConfiguration, IReserveParams } from '../../helpers/types';
import { LendingPoolConfiguratorFactory, LendingPoolFactory } from '../../types';
task('verify:tokens', 'Deploy oracles for dev enviroment')
@ -66,27 +68,43 @@ task('verify:tokens', 'Deploy oracles for dev enviroment')
console.log;
// Proxy Stable Debt
console.log(`\n- Verifying Stable Debt Token proxy...\n`);
await verifyContract(stableDebtTokenAddress, [lendingPoolConfigurator.address]);
await verifyContract(
eContractid.InitializableAdminUpgradeabilityProxy,
await getProxy(stableDebtTokenAddress),
[lendingPoolConfigurator.address]
);
// Proxy Variable Debt
console.log(`\n- Verifying Debt Token proxy...\n`);
await verifyContract(variableDebtTokenAddress, [lendingPoolConfigurator.address]);
await verifyContract(
eContractid.InitializableAdminUpgradeabilityProxy,
await getProxy(variableDebtTokenAddress),
[lendingPoolConfigurator.address]
);
// Proxy aToken
console.log('\n- Verifying aToken proxy...\n');
await verifyContract(aTokenAddress, [lendingPoolConfigurator.address]);
await verifyContract(
eContractid.InitializableAdminUpgradeabilityProxy,
await getProxy(aTokenAddress),
[lendingPoolConfigurator.address]
);
// Strategy Rate
console.log(`\n- Verifying Strategy rate...\n`);
await verifyContract(interestRateStrategyAddress, [
addressesProvider.address,
optimalUtilizationRate,
baseVariableBorrowRate,
variableRateSlope1,
variableRateSlope2,
stableRateSlope1,
stableRateSlope2,
]);
await verifyContract(
eContractid.DefaultReserveInterestRateStrategy,
await getInterestRateStrategy(interestRateStrategyAddress),
[
addressesProvider.address,
optimalUtilizationRate,
baseVariableBorrowRate,
variableRateSlope1,
variableRateSlope2,
stableRateSlope1,
stableRateSlope2,
]
);
const stableDebt = await getAddressById(`stableDebt${token}`);
const variableDebt = await getAddressById(`variableDebt${token}`);
@ -94,7 +112,7 @@ task('verify:tokens', 'Deploy oracles for dev enviroment')
if (aToken) {
console.log('\n- Verifying aToken...\n');
await verifyContract(aToken, [
await verifyContract(eContractid.AToken, await getAToken(aToken), [
lendingPoolProxy.address,
tokenAddress,
treasuryAddress,
@ -107,7 +125,7 @@ task('verify:tokens', 'Deploy oracles for dev enviroment')
}
if (stableDebt) {
console.log('\n- Verifying StableDebtToken...\n');
await verifyContract(stableDebt, [
await verifyContract(eContractid.StableDebtToken, await getStableDebtToken(stableDebt), [
lendingPoolProxy.address,
tokenAddress,
`Aave stable debt bearing ${token}`,
@ -119,13 +137,17 @@ task('verify:tokens', 'Deploy oracles for dev enviroment')
}
if (variableDebt) {
console.log('\n- Verifying VariableDebtToken...\n');
await verifyContract(variableDebt, [
lendingPoolProxy.address,
tokenAddress,
`Aave variable debt bearing ${token}`,
`variableDebt${token}`,
ZERO_ADDRESS,
]);
await verifyContract(
eContractid.VariableDebtToken,
await getVariableDebtToken(variableDebt),
[
lendingPoolProxy.address,
tokenAddress,
`Aave variable debt bearing ${token}`,
`variableDebt${token}`,
ZERO_ADDRESS,
]
);
} else {
console.error(`Skipping variable debt verify for ${token}. Missing address at JSON DB.`);
}

View File

@ -191,7 +191,7 @@ const buildTestEnv = async (deployer: Signer, secondaryWallet: Signer) => {
WMATIC: mockTokens.WMATIC.address,
USD: USD_ADDRESS,
STAKE: mockTokens.STAKE.address,
xSUSHI: mockTokens.xSUSHI.address
xSUSHI: mockTokens.xSUSHI.address,
},
fallbackOracle
);
@ -295,9 +295,9 @@ const buildTestEnv = async (deployer: Signer, secondaryWallet: Signer) => {
before(async () => {
await rawBRE.run('set-DRE');
const [deployer, secondaryWallet] = await getEthersSigners();
const MAINNET_FORK = process.env.MAINNET_FORK === 'true';
const FORK = process.env.FORK;
if (MAINNET_FORK) {
if (FORK) {
await rawBRE.run('aave:mainnet');
} else {
console.log('-> Deploying test environment...');

View File

@ -15,7 +15,7 @@ import {
getUniswapRepayAdapter,
getFlashLiquidationAdapter,
} from '../../../helpers/contracts-getters';
import { eEthereumNetwork, tEthereumAddress } from '../../../helpers/types';
import { eEthereumNetwork, eNetwork, tEthereumAddress } from '../../../helpers/types';
import { LendingPool } from '../../../types/LendingPool';
import { AaveProtocolDataProvider } from '../../../types/AaveProtocolDataProvider';
import { MintableERC20 } from '../../../types/MintableERC20';
@ -116,9 +116,9 @@ export async function initializeMakeSuite() {
testEnv.addressesProvider = await getLendingPoolAddressesProvider();
if (process.env.MAINNET_FORK === 'true') {
if (process.env.FORK) {
testEnv.registry = await getLendingPoolAddressesProviderRegistry(
getParamPerNetwork(AaveConfig.ProviderRegistry, eEthereumNetwork.main)
getParamPerNetwork(AaveConfig.ProviderRegistry, process.env.FORK as eNetwork)
);
} else {
testEnv.registry = await getLendingPoolAddressesProviderRegistry();

View File

@ -26,7 +26,7 @@ import {
deployUniswapLiquiditySwapAdapter,
deployUniswapRepayAdapter,
deployFlashLiquidationAdapter,
authorizeWETHGateway
authorizeWETHGateway,
} from '../../helpers/contracts-deployments';
import { Signer } from 'ethers';
import { TokenContractId, eContractid, tEthereumAddress, AavePools } from '../../helpers/types';
@ -240,8 +240,8 @@ const buildTestEnv = async (deployer: Signer, secondaryWallet: Signer) => {
console.log('Initialize configuration');
const config = loadPoolConfig(ConfigNames.Amm);
const {
const {
ATokenNamePrefix,
StableDebtTokenNamePrefix,
VariableDebtTokenNamePrefix,
@ -292,9 +292,9 @@ const buildTestEnv = async (deployer: Signer, secondaryWallet: Signer) => {
before(async () => {
await rawBRE.run('set-DRE');
const [deployer, secondaryWallet] = await getEthersSigners();
const MAINNET_FORK = process.env.MAINNET_FORK === 'true';
const FORK = process.env.FORK;
if (MAINNET_FORK) {
if (FORK) {
await rawBRE.run('amm:mainnet');
} else {
console.log('-> Deploying test environment...');

View File

@ -15,7 +15,7 @@ import {
getUniswapRepayAdapter,
getFlashLiquidationAdapter,
} from '../../../helpers/contracts-getters';
import { eEthereumNetwork, tEthereumAddress } from '../../../helpers/types';
import { eEthereumNetwork, eNetwork, tEthereumAddress } from '../../../helpers/types';
import { LendingPool } from '../../../types/LendingPool';
import { AaveProtocolDataProvider } from '../../../types/AaveProtocolDataProvider';
import { MintableERC20 } from '../../../types/MintableERC20';
@ -116,9 +116,9 @@ export async function initializeMakeSuite() {
testEnv.addressesProvider = await getLendingPoolAddressesProvider();
if (process.env.MAINNET_FORK === 'true') {
if (process.env.FORK) {
testEnv.registry = await getLendingPoolAddressesProviderRegistry(
getParamPerNetwork(AmmConfig.ProviderRegistry, eEthereumNetwork.main)
getParamPerNetwork(AmmConfig.ProviderRegistry, process.env.FORK as eNetwork)
);
} else {
testEnv.registry = await getLendingPoolAddressesProviderRegistry();