2020-11-30 18:25:06 +00:00
|
|
|
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')
|
2020-11-30 18:47:16 +00:00
|
|
|
.addParam('dataProvider', 'Address of AaveProtocolDataProvider')
|
2020-11-30 18:25:06 +00:00
|
|
|
.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',
|
|
|
|
];
|
2020-11-30 18:41:42 +00:00
|
|
|
const tokensFields = ['aToken', 'stableDebtToken', 'variableDebtToken'];
|
2020-11-30 18:25:06 +00:00
|
|
|
for (const [symbol, address] of Object.entries(
|
|
|
|
getParamPerNetwork(poolConfig.ReserveAssets, network)
|
|
|
|
)) {
|
|
|
|
console.log(`- ${symbol} asset config`);
|
|
|
|
console.log(` - reserve address: ${address}`);
|
|
|
|
|
2020-11-30 18:41:42 +00:00
|
|
|
const reserveData = await protocolDataProvider.getReserveConfigurationData(address);
|
|
|
|
const tokensAddresses = await protocolDataProvider.getReserveTokensAddresses(address);
|
2020-11-30 18:25:06 +00:00
|
|
|
fields.forEach((field, index) => {
|
|
|
|
console.log(` - ${field}:`, reserveData[index].toString());
|
|
|
|
});
|
2020-11-30 18:41:42 +00:00
|
|
|
tokensFields.forEach((field, index) => {
|
|
|
|
console.log(` - ${field}:`, tokensAddresses[index]);
|
|
|
|
});
|
2020-11-30 18:25:06 +00:00
|
|
|
}
|
|
|
|
});
|