mirror of
https://github.com/Instadapp/aave-protocol-v2.git
synced 2024-07-29 21:47:30 +00:00
Merge branch '181-check-configuration-and-scripts' into 'master'
Resolve "Check configuration and scripts" Closes #181 See merge request aave-tech/protocol-v2!204
This commit is contained in:
commit
57ee9e0a7c
|
@ -62,7 +62,7 @@ const getCommonNetworkConfig = (networkName: eEthereumNetwork, networkId: number
|
||||||
|
|
||||||
const mainnetFork = MAINNET_FORK
|
const mainnetFork = MAINNET_FORK
|
||||||
? {
|
? {
|
||||||
blockNumber: 11268220,
|
blockNumber: 11361132,
|
||||||
url: ALCHEMY_KEY
|
url: ALCHEMY_KEY
|
||||||
? `https://eth-mainnet.alchemyapi.io/v2/${ALCHEMY_KEY}`
|
? `https://eth-mainnet.alchemyapi.io/v2/${ALCHEMY_KEY}`
|
||||||
: `https://main.infura.io/v3/${INFURA_KEY}`,
|
: `https://main.infura.io/v3/${INFURA_KEY}`,
|
||||||
|
|
|
@ -7,7 +7,7 @@ import {
|
||||||
getStableAndVariableTokensHelper,
|
getStableAndVariableTokensHelper,
|
||||||
} from './contracts-getters';
|
} from './contracts-getters';
|
||||||
import { rawInsertContractAddressInDb } from './contracts-helpers';
|
import { rawInsertContractAddressInDb } from './contracts-helpers';
|
||||||
import { BigNumberish } from 'ethers';
|
import { BigNumber, BigNumberish } from 'ethers';
|
||||||
import {
|
import {
|
||||||
deployDefaultReserveInterestRateStrategy,
|
deployDefaultReserveInterestRateStrategy,
|
||||||
deployDelegationAwareAToken,
|
deployDelegationAwareAToken,
|
||||||
|
@ -35,8 +35,8 @@ export const initReservesByHelper = async (
|
||||||
treasuryAddress: tEthereumAddress,
|
treasuryAddress: tEthereumAddress,
|
||||||
incentivesController: tEthereumAddress,
|
incentivesController: tEthereumAddress,
|
||||||
verify: boolean
|
verify: boolean
|
||||||
) => {
|
): Promise<BigNumber> => {
|
||||||
|
let gasUsage = BigNumber.from('0');
|
||||||
const stableAndVariableDeployer = await getStableAndVariableTokensHelper();
|
const stableAndVariableDeployer = await getStableAndVariableTokensHelper();
|
||||||
const atokenAndRatesDeployer = await getATokensAndRatesHelper();
|
const atokenAndRatesDeployer = await getATokensAndRatesHelper();
|
||||||
|
|
||||||
|
@ -47,8 +47,8 @@ export const initReservesByHelper = async (
|
||||||
await waitForTx(await addressProvider.setPoolAdmin(atokenAndRatesDeployer.address));
|
await waitForTx(await addressProvider.setPoolAdmin(atokenAndRatesDeployer.address));
|
||||||
|
|
||||||
// CHUNK CONFIGURATION
|
// CHUNK CONFIGURATION
|
||||||
const tokensChunks = 4;
|
const tokensChunks = 2;
|
||||||
const initChunks = 6;
|
const initChunks = 4;
|
||||||
|
|
||||||
// Deploy tokens and rates that uses common aToken in chunks
|
// Deploy tokens and rates that uses common aToken in chunks
|
||||||
const reservesChunks = chunk(
|
const reservesChunks = chunk(
|
||||||
|
@ -123,11 +123,7 @@ export const initReservesByHelper = async (
|
||||||
|
|
||||||
// Deploy stable and variable deployers and save implementations
|
// Deploy stable and variable deployers and save implementations
|
||||||
const tx1 = await waitForTx(
|
const tx1 = await waitForTx(
|
||||||
await stableAndVariableDeployer.initDeployment(
|
await stableAndVariableDeployer.initDeployment(tokens, symbols, incentivesController)
|
||||||
tokens,
|
|
||||||
symbols,
|
|
||||||
incentivesController
|
|
||||||
)
|
|
||||||
);
|
);
|
||||||
tx1.events?.forEach((event, index) => {
|
tx1.events?.forEach((event, index) => {
|
||||||
rawInsertContractAddressInDb(`stableDebt${symbols[index]}`, event?.args?.stableToken);
|
rawInsertContractAddressInDb(`stableDebt${symbols[index]}`, event?.args?.stableToken);
|
||||||
|
@ -150,6 +146,10 @@ export const initReservesByHelper = async (
|
||||||
});
|
});
|
||||||
|
|
||||||
console.log(` - Deployed aToken, DebtTokens and Strategy for: ${symbols.join(', ')} `);
|
console.log(` - Deployed aToken, DebtTokens and Strategy for: ${symbols.join(', ')} `);
|
||||||
|
console.log(' * gasUsed: debtTokens batch', tx1.gasUsed.toString());
|
||||||
|
console.log(' * gasUsed: aTokens and Strategy batch', tx2.gasUsed.toString());
|
||||||
|
gasUsage = gasUsage.add(tx1.gasUsed).add(tx2.gasUsed);
|
||||||
|
|
||||||
const stableTokens: string[] = tx1.events?.map((e) => e.args?.stableToken) || [];
|
const stableTokens: string[] = tx1.events?.map((e) => e.args?.stableToken) || [];
|
||||||
const variableTokens: string[] = tx1.events?.map((e) => e.args?.variableToken) || [];
|
const variableTokens: string[] = tx1.events?.map((e) => e.args?.variableToken) || [];
|
||||||
const aTokens: string[] = tx2.events?.map((e) => e.args?.aToken) || [];
|
const aTokens: string[] = tx2.events?.map((e) => e.args?.aToken) || [];
|
||||||
|
@ -252,11 +252,15 @@ export const initReservesByHelper = async (
|
||||||
chunkedDecimals[chunkIndex]
|
chunkedDecimals[chunkIndex]
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
console.log(` - Reserve ready for: ${chunkedSymbols[chunkIndex].join(', ')}`);
|
console.log(` - Reserve ready for: ${chunkedSymbols[chunkIndex].join(', ')}`);
|
||||||
|
console.log(' * gasUsed', tx3.gasUsed.toString());
|
||||||
|
gasUsage = gasUsage.add(tx3.gasUsed);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Set deployer back as admin
|
// Set deployer back as admin
|
||||||
await waitForTx(await addressProvider.setPoolAdmin(admin));
|
await waitForTx(await addressProvider.setPoolAdmin(admin));
|
||||||
|
return gasUsage;
|
||||||
};
|
};
|
||||||
|
|
||||||
export const getPairsTokenAggregator = (
|
export const getPairsTokenAggregator = (
|
||||||
|
@ -304,7 +308,13 @@ export const configureReservesByHelper = async (
|
||||||
|
|
||||||
for (const [
|
for (const [
|
||||||
assetSymbol,
|
assetSymbol,
|
||||||
{ baseLTVAsCollateral, liquidationBonus, liquidationThreshold, reserveFactor, stableBorrowRateEnabled },
|
{
|
||||||
|
baseLTVAsCollateral,
|
||||||
|
liquidationBonus,
|
||||||
|
liquidationThreshold,
|
||||||
|
reserveFactor,
|
||||||
|
stableBorrowRateEnabled,
|
||||||
|
},
|
||||||
] of Object.entries(reservesParams) as [string, IReserveParams][]) {
|
] of Object.entries(reservesParams) as [string, IReserveParams][]) {
|
||||||
if (baseLTVAsCollateral === '-1') continue;
|
if (baseLTVAsCollateral === '-1') continue;
|
||||||
|
|
||||||
|
|
|
@ -351,6 +351,7 @@ export interface ICommonConfiguration {
|
||||||
ProtocolGlobalParams: IProtocolGlobalConfig;
|
ProtocolGlobalParams: IProtocolGlobalConfig;
|
||||||
Mocks: IMocksConfig;
|
Mocks: IMocksConfig;
|
||||||
ProviderRegistry: iParamsPerNetwork<tEthereumAddress | undefined>;
|
ProviderRegistry: iParamsPerNetwork<tEthereumAddress | undefined>;
|
||||||
|
ProviderRegistryOwner: iParamsPerNetwork<tEthereumAddress | undefined>;
|
||||||
LendingRateOracleRatesCommon: iMultiPoolsAssets<IMarketRates>;
|
LendingRateOracleRatesCommon: iMultiPoolsAssets<IMarketRates>;
|
||||||
LendingRateOracle: iParamsPerNetwork<tEthereumAddress>;
|
LendingRateOracle: iParamsPerNetwork<tEthereumAddress>;
|
||||||
TokenDistributor: iParamsPerNetwork<tEthereumAddress>;
|
TokenDistributor: iParamsPerNetwork<tEthereumAddress>;
|
||||||
|
|
|
@ -137,13 +137,22 @@ export const CommonsConfig: ICommonConfiguration = {
|
||||||
},
|
},
|
||||||
EmergencyAdminIndex: 1,
|
EmergencyAdminIndex: 1,
|
||||||
ProviderRegistry: {
|
ProviderRegistry: {
|
||||||
[eEthereumNetwork.kovan]: '',
|
[eEthereumNetwork.kovan]: '0x1E40B561EC587036f9789aF83236f057D1ed2A90',
|
||||||
[eEthereumNetwork.ropsten]: '',
|
[eEthereumNetwork.ropsten]: '',
|
||||||
[eEthereumNetwork.main]: '',
|
[eEthereumNetwork.main]: '0x52D306e36E3B6B02c153d0266ff0f85d18BCD413',
|
||||||
[eEthereumNetwork.coverage]: '',
|
[eEthereumNetwork.coverage]: '',
|
||||||
[eEthereumNetwork.hardhat]: '',
|
[eEthereumNetwork.hardhat]: '',
|
||||||
[eEthereumNetwork.buidlerevm]: '',
|
[eEthereumNetwork.buidlerevm]: '',
|
||||||
[eEthereumNetwork.tenderlyMain]: '',
|
[eEthereumNetwork.tenderlyMain]: '0x52D306e36E3B6B02c153d0266ff0f85d18BCD413',
|
||||||
|
},
|
||||||
|
ProviderRegistryOwner: {
|
||||||
|
[eEthereumNetwork.kovan]: '0x85e4A467343c0dc4aDAB74Af84448D9c45D8ae6F',
|
||||||
|
[eEthereumNetwork.ropsten]: '',
|
||||||
|
[eEthereumNetwork.main]: '0xbd723fc4f1d737dcfc48a07fe7336766d34cad5f',
|
||||||
|
[eEthereumNetwork.coverage]: '',
|
||||||
|
[eEthereumNetwork.hardhat]: '',
|
||||||
|
[eEthereumNetwork.buidlerevm]: '',
|
||||||
|
[eEthereumNetwork.tenderlyMain]: '0xbd723fc4f1d737dcfc48a07fe7336766d34cad5f',
|
||||||
},
|
},
|
||||||
LendingRateOracle: {
|
LendingRateOracle: {
|
||||||
[eEthereumNetwork.coverage]: '',
|
[eEthereumNetwork.coverage]: '',
|
||||||
|
|
|
@ -35,7 +35,7 @@
|
||||||
"aave:ropsten:full:migration": "npm run compile && npm run hardhat:ropsten -- aave:mainnet --verify",
|
"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:tenderly": "npm run compile && npm run hardhat:tenderly-main -- aave:mainnet",
|
||||||
"aave:fork:main": "npm run compile && MAINNET_FORK=true hardhat aave:mainnet",
|
"aave:fork:main": "npm run compile && MAINNET_FORK=true hardhat aave:mainnet",
|
||||||
"aave:main:full:migration": "npm run hardhat:main -- aave:mainnet --verify",
|
"aave:main:full:migration": "npm run compile && npm run hardhat:main -- aave:mainnet --verify",
|
||||||
"dev:prettier": "prettier --write .",
|
"dev:prettier": "prettier --write .",
|
||||||
"ci:test": "npm run compile && npm run test",
|
"ci:test": "npm run compile && npm run test",
|
||||||
"ci:clean": "rm -rf ./artifacts ./cache ./types",
|
"ci:clean": "rm -rf ./artifacts ./cache ./types",
|
||||||
|
@ -48,7 +48,9 @@
|
||||||
"mainnet:verify": "npm run hardhat:main verify:general -- --all --pool Aave",
|
"mainnet:verify": "npm run hardhat:main verify:general -- --all --pool Aave",
|
||||||
"kovan:verify:tokens": "npm run hardhat:kovan verify:tokens -- --pool Aave",
|
"kovan:verify:tokens": "npm run hardhat:kovan verify:tokens -- --pool Aave",
|
||||||
"ropsten:verify:tokens": "npm run hardhat:ropsten 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"
|
"mainnet:verify:tokens": "npm run hardhat:main verify:tokens -- --pool Aave",
|
||||||
|
"print-config:fork:mainnet": "MAINNET_FORK=true hardhat print-config:fork",
|
||||||
|
"print-config:kovan": "hardhat --network kovan print-config --pool Aave --data-provider 0xA1901785c29cBd48bfA74e46b67C736b26054fa4"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@nomiclabs/buidler": "^1.4.7",
|
"@nomiclabs/buidler": "^1.4.7",
|
||||||
|
|
11
tasks/full/0_address_provider_registry.ts
Normal file
11
tasks/full/0_address_provider_registry.ts
Normal file
|
@ -0,0 +1,11 @@
|
||||||
|
import { task } from 'hardhat/config';
|
||||||
|
import { deployLendingPoolAddressesProviderRegistry } from '../../helpers/contracts-deployments';
|
||||||
|
|
||||||
|
task('full:deploy-address-provider-registry', 'Deploy address provider registry')
|
||||||
|
.addFlag('verify', 'Verify contracts at Etherscan')
|
||||||
|
.setAction(async ({ verify }, DRE) => {
|
||||||
|
await DRE.run('set-DRE');
|
||||||
|
|
||||||
|
const contract = await deployLendingPoolAddressesProviderRegistry(verify);
|
||||||
|
console.log('Registry Address:', contract.address);
|
||||||
|
});
|
|
@ -12,7 +12,13 @@ import {
|
||||||
getEmergencyAdmin,
|
getEmergencyAdmin,
|
||||||
} from '../../helpers/configuration';
|
} from '../../helpers/configuration';
|
||||||
import { eEthereumNetwork } from '../../helpers/types';
|
import { eEthereumNetwork } from '../../helpers/types';
|
||||||
import { getLendingPoolAddressesProviderRegistry } from '../../helpers/contracts-getters';
|
import {
|
||||||
|
getFirstSigner,
|
||||||
|
getLendingPoolAddressesProviderRegistry,
|
||||||
|
} from '../../helpers/contracts-getters';
|
||||||
|
import { isAddress } from 'ethers/lib/utils';
|
||||||
|
import { isZeroAddress } from 'ethereumjs-util';
|
||||||
|
import { Signer } from 'ethers';
|
||||||
|
|
||||||
task(
|
task(
|
||||||
'full:deploy-address-provider',
|
'full:deploy-address-provider',
|
||||||
|
@ -22,30 +28,70 @@ task(
|
||||||
.addParam('pool', `Pool name to retrieve configuration, supported: ${Object.values(ConfigNames)}`)
|
.addParam('pool', `Pool name to retrieve configuration, supported: ${Object.values(ConfigNames)}`)
|
||||||
.setAction(async ({ verify, pool }, DRE) => {
|
.setAction(async ({ verify, pool }, DRE) => {
|
||||||
await DRE.run('set-DRE');
|
await DRE.run('set-DRE');
|
||||||
|
let signer: Signer;
|
||||||
const network = <eEthereumNetwork>DRE.network.name;
|
const network = <eEthereumNetwork>DRE.network.name;
|
||||||
const poolConfig = loadPoolConfig(pool);
|
const poolConfig = loadPoolConfig(pool);
|
||||||
const { ProviderId, MarketId } = poolConfig;
|
const { ProviderId, MarketId } = poolConfig;
|
||||||
|
|
||||||
const providerRegistryAddress = getParamPerNetwork(poolConfig.ProviderRegistry, network);
|
const providerRegistryAddress = getParamPerNetwork(poolConfig.ProviderRegistry, network);
|
||||||
// Deploy address provider and set genesis manager
|
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);
|
||||||
|
} else {
|
||||||
|
signer = await getFirstSigner();
|
||||||
|
const deployerAddress = await signer.getAddress();
|
||||||
|
if (providerRegistryOwner !== (await signer.getAddress())) {
|
||||||
|
throw Error(
|
||||||
|
`Current signer is not provider registry owner. \nCurrent deployer address: ${deployerAddress} \nExpected address: ${poolConfig.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
|
||||||
const addressesProvider = await deployLendingPoolAddressesProvider(MarketId, verify);
|
const addressesProvider = await deployLendingPoolAddressesProvider(MarketId, verify);
|
||||||
|
|
||||||
await waitForTx(await addressesProvider.setPoolAdmin(await getGenesisPoolAdmin(poolConfig)));
|
// 3. Set the provider at the Registry
|
||||||
await waitForTx(await addressesProvider.setEmergencyAdmin(await getEmergencyAdmin(poolConfig)));
|
|
||||||
|
|
||||||
console.log('Pool Admin', await addressesProvider.getPoolAdmin());
|
|
||||||
console.log('Emergency Admin', await addressesProvider.getEmergencyAdmin());
|
|
||||||
|
|
||||||
// If no provider registry is set, deploy lending pool address provider registry and register the address provider
|
|
||||||
const addressesProviderRegistry = notFalsyOrZeroAddress(providerRegistryAddress)
|
|
||||||
? await getLendingPoolAddressesProviderRegistry(providerRegistryAddress)
|
|
||||||
: await deployLendingPoolAddressesProviderRegistry(verify);
|
|
||||||
|
|
||||||
await waitForTx(
|
await waitForTx(
|
||||||
await addressesProviderRegistry.registerAddressesProvider(
|
await addressesProviderRegistry.registerAddressesProvider(
|
||||||
addressesProvider.address,
|
addressesProvider.address,
|
||||||
ProviderId
|
ProviderId
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
|
// 4. Set pool admins
|
||||||
|
|
||||||
|
await waitForTx(await addressesProvider.setPoolAdmin(await getGenesisPoolAdmin(poolConfig)));
|
||||||
|
await waitForTx(await addressesProvider.setEmergencyAdmin(await getEmergencyAdmin(poolConfig)));
|
||||||
|
|
||||||
|
console.log('Pool Admin', await addressesProvider.getPoolAdmin());
|
||||||
|
console.log('Emergency Admin', await addressesProvider.getEmergencyAdmin());
|
||||||
});
|
});
|
||||||
|
|
77
tasks/misc/print-config.ts
Normal file
77
tasks/misc/print-config.ts
Normal file
|
@ -0,0 +1,77 @@
|
||||||
|
import { task } from 'hardhat/config';
|
||||||
|
import { ConfigNames, loadPoolConfig } from '../../helpers/configuration';
|
||||||
|
import {
|
||||||
|
getAaveProtocolDataProvider,
|
||||||
|
getLendingPoolAddressesProvider,
|
||||||
|
getLendingPoolAddressesProviderRegistry,
|
||||||
|
} from '../../helpers/contracts-getters';
|
||||||
|
import { getParamPerNetwork } from '../../helpers/contracts-helpers';
|
||||||
|
import { DRE } from '../../helpers/misc-utils';
|
||||||
|
import { eEthereumNetwork } from '../../helpers/types';
|
||||||
|
|
||||||
|
task('print-config', 'Inits the DRE, to have access to all the plugins')
|
||||||
|
.addParam('dataProvider', 'Address of AaveProtocolDataProvider')
|
||||||
|
.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 eEthereumNetwork);
|
||||||
|
const poolConfig = loadPoolConfig(pool);
|
||||||
|
|
||||||
|
const providerRegistryAddress = getParamPerNetwork(poolConfig.ProviderRegistry, network);
|
||||||
|
|
||||||
|
const providerRegistry = await getLendingPoolAddressesProviderRegistry(providerRegistryAddress);
|
||||||
|
|
||||||
|
const providers = await providerRegistry.getAddressesProvidersList();
|
||||||
|
|
||||||
|
const addressesProvider = await getLendingPoolAddressesProvider(providers[0]); // Checks first provider
|
||||||
|
|
||||||
|
console.log('Addresses Providers', providers.join(', '));
|
||||||
|
console.log('Market Id: ', await addressesProvider.getMarketId());
|
||||||
|
console.log('LendingPool Proxy:', await addressesProvider.getLendingPool());
|
||||||
|
console.log(
|
||||||
|
'Lending Pool Collateral Manager',
|
||||||
|
await addressesProvider.getLendingPoolCollateralManager()
|
||||||
|
);
|
||||||
|
console.log(
|
||||||
|
'Lending Pool Configurator proxy',
|
||||||
|
await addressesProvider.getLendingPoolConfigurator()
|
||||||
|
);
|
||||||
|
console.log('Pool admin', await addressesProvider.getPoolAdmin());
|
||||||
|
console.log('Emergency admin', await addressesProvider.getEmergencyAdmin());
|
||||||
|
console.log('Price Oracle', await addressesProvider.getPriceOracle());
|
||||||
|
console.log('Lending Rate Oracle', await addressesProvider.getLendingRateOracle());
|
||||||
|
console.log('Lending Pool Data Provider', dataProvider);
|
||||||
|
const protocolDataProvider = await getAaveProtocolDataProvider(dataProvider);
|
||||||
|
|
||||||
|
const fields = [
|
||||||
|
'decimals',
|
||||||
|
'ltv',
|
||||||
|
'liquidationThreshold',
|
||||||
|
'liquidationBonus',
|
||||||
|
'reserveFactor',
|
||||||
|
'usageAsCollateralEnabled',
|
||||||
|
'borrowingEnabled',
|
||||||
|
'stableBorrowRateEnabled',
|
||||||
|
'isActive',
|
||||||
|
'isFrozen',
|
||||||
|
];
|
||||||
|
const tokensFields = ['aToken', 'stableDebtToken', 'variableDebtToken'];
|
||||||
|
for (const [symbol, address] of Object.entries(
|
||||||
|
getParamPerNetwork(poolConfig.ReserveAssets, network)
|
||||||
|
)) {
|
||||||
|
console.log(`- ${symbol} asset config`);
|
||||||
|
console.log(` - reserve address: ${address}`);
|
||||||
|
|
||||||
|
const reserveData = await protocolDataProvider.getReserveConfigurationData(address);
|
||||||
|
const tokensAddresses = await protocolDataProvider.getReserveTokensAddresses(address);
|
||||||
|
fields.forEach((field, index) => {
|
||||||
|
console.log(` - ${field}:`, reserveData[index].toString());
|
||||||
|
});
|
||||||
|
tokensFields.forEach((field, index) => {
|
||||||
|
console.log(` - ${field}:`, tokensAddresses[index]);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
12
tasks/misc/print-fork-config.ts
Normal file
12
tasks/misc/print-fork-config.ts
Normal file
|
@ -0,0 +1,12 @@
|
||||||
|
import { task } from 'hardhat/config';
|
||||||
|
import { getAaveProtocolDataProvider } from '../../helpers/contracts-getters';
|
||||||
|
|
||||||
|
task('print-config:fork', 'Deploy development enviroment')
|
||||||
|
.addFlag('verify', 'Verify contracts at Etherscan')
|
||||||
|
.setAction(async ({ verify }, DRE) => {
|
||||||
|
await DRE.run('set-DRE');
|
||||||
|
await DRE.run('aave:mainnet');
|
||||||
|
|
||||||
|
const dataProvider = await getAaveProtocolDataProvider();
|
||||||
|
await DRE.run('print-config', { dataProvider: dataProvider.address, pool: 'Aave' });
|
||||||
|
});
|
|
@ -40,6 +40,7 @@ task('verify:tokens', 'Deploy oracles for dev enviroment')
|
||||||
}
|
}
|
||||||
|
|
||||||
const {
|
const {
|
||||||
|
optimalUtilizationRate,
|
||||||
baseVariableBorrowRate,
|
baseVariableBorrowRate,
|
||||||
variableRateSlope1,
|
variableRateSlope1,
|
||||||
variableRateSlope2,
|
variableRateSlope2,
|
||||||
|
@ -64,6 +65,7 @@ task('verify:tokens', 'Deploy oracles for dev enviroment')
|
||||||
console.log(`\n- Verifying Strategy rate...\n`);
|
console.log(`\n- Verifying Strategy rate...\n`);
|
||||||
await verifyContract(interestRateStrategyAddress, [
|
await verifyContract(interestRateStrategyAddress, [
|
||||||
addressesProvider.address,
|
addressesProvider.address,
|
||||||
|
optimalUtilizationRate,
|
||||||
baseVariableBorrowRate,
|
baseVariableBorrowRate,
|
||||||
variableRateSlope1,
|
variableRateSlope1,
|
||||||
variableRateSlope2,
|
variableRateSlope2,
|
||||||
|
|
|
@ -12,7 +12,7 @@ import {
|
||||||
getWETHMocked,
|
getWETHMocked,
|
||||||
getWETHGateway,
|
getWETHGateway,
|
||||||
} from '../../helpers/contracts-getters';
|
} from '../../helpers/contracts-getters';
|
||||||
import { tEthereumAddress } from '../../helpers/types';
|
import { eEthereumNetwork, tEthereumAddress } from '../../helpers/types';
|
||||||
import { LendingPool } from '../../types/LendingPool';
|
import { LendingPool } from '../../types/LendingPool';
|
||||||
import { AaveProtocolDataProvider } from '../../types/AaveProtocolDataProvider';
|
import { AaveProtocolDataProvider } from '../../types/AaveProtocolDataProvider';
|
||||||
import { MintableERC20 } from '../../types/MintableERC20';
|
import { MintableERC20 } from '../../types/MintableERC20';
|
||||||
|
@ -26,10 +26,11 @@ import { almostEqual } from './almost-equal';
|
||||||
import { PriceOracle } from '../../types/PriceOracle';
|
import { PriceOracle } from '../../types/PriceOracle';
|
||||||
import { LendingPoolAddressesProvider } from '../../types/LendingPoolAddressesProvider';
|
import { LendingPoolAddressesProvider } from '../../types/LendingPoolAddressesProvider';
|
||||||
import { LendingPoolAddressesProviderRegistry } from '../../types/LendingPoolAddressesProviderRegistry';
|
import { LendingPoolAddressesProviderRegistry } from '../../types/LendingPoolAddressesProviderRegistry';
|
||||||
import { getEthersSigners } from '../../helpers/contracts-helpers';
|
import { getEthersSigners, getParamPerNetwork } from '../../helpers/contracts-helpers';
|
||||||
import { WETH9Mocked } from '../../types/WETH9Mocked';
|
import { WETH9Mocked } from '../../types/WETH9Mocked';
|
||||||
import { WETHGateway } from '../../types/WETHGateway';
|
import { WETHGateway } from '../../types/WETHGateway';
|
||||||
import { solidity } from 'ethereum-waffle';
|
import { solidity } from 'ethereum-waffle';
|
||||||
|
import { AaveConfig } from '../../markets/aave';
|
||||||
|
|
||||||
chai.use(bignumberChai());
|
chai.use(bignumberChai());
|
||||||
chai.use(almostEqual());
|
chai.use(almostEqual());
|
||||||
|
@ -100,9 +101,16 @@ export async function initializeMakeSuite() {
|
||||||
|
|
||||||
testEnv.configurator = await getLendingPoolConfiguratorProxy();
|
testEnv.configurator = await getLendingPoolConfiguratorProxy();
|
||||||
|
|
||||||
testEnv.oracle = await getPriceOracle();
|
|
||||||
testEnv.addressesProvider = await getLendingPoolAddressesProvider();
|
testEnv.addressesProvider = await getLendingPoolAddressesProvider();
|
||||||
|
|
||||||
|
if (process.env.MAINNET_FORK === 'true') {
|
||||||
|
testEnv.registry = await getLendingPoolAddressesProviderRegistry(
|
||||||
|
getParamPerNetwork(AaveConfig.ProviderRegistry, eEthereumNetwork.main)
|
||||||
|
);
|
||||||
|
} else {
|
||||||
testEnv.registry = await getLendingPoolAddressesProviderRegistry();
|
testEnv.registry = await getLendingPoolAddressesProviderRegistry();
|
||||||
|
testEnv.oracle = await getPriceOracle();
|
||||||
|
}
|
||||||
|
|
||||||
testEnv.helpersContract = await getAaveProtocolDataProvider();
|
testEnv.helpersContract = await getAaveProtocolDataProvider();
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user