Skip to content

Commit

Permalink
feat: remove unused imports and variables
Browse files Browse the repository at this point in the history
  • Loading branch information
Steven Valeri committed Aug 3, 2021
1 parent 9f00d44 commit 09e72f2
Show file tree
Hide file tree
Showing 31 changed files with 49 additions and 171 deletions.
5 changes: 1 addition & 4 deletions helpers/contracts-deployments.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { BigNumberish, Contract } from 'ethers';
import { Contract } from 'ethers';
import { DRE } from './misc-utils';
import {
tEthereumAddress,
Expand All @@ -15,7 +15,6 @@ import { MintableERC20 } from '../types/MintableERC20';
import { MockContract } from 'ethereum-waffle';
import { getReservesConfigByPool } from './configuration';
import { getFirstSigner } from './contracts-getters';
import { ZERO_ADDRESS } from './constants';
import {
AaveProtocolDataProviderFactory,
ATokenFactory,
Expand Down Expand Up @@ -50,8 +49,6 @@ import {
registerContractInJsonDb,
linkBytecode,
insertContractAddressInDb,
deployContract,
verifyContract,
} from './contracts-helpers';
import { StableAndVariableTokensHelperFactory } from '../types/StableAndVariableTokensHelperFactory';
import { MintableDelegationERC20 } from '../types/MintableDelegationERC20';
Expand Down
1 change: 0 additions & 1 deletion helpers/contracts-helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ import {
ePolygonNetwork,
eXDaiNetwork,
eNetwork,
iParamsPerNetworkAll,
iEthereumParamsPerNetwork,
iPolygonParamsPerNetwork,
iXDaiParamsPerNetwork,
Expand Down
13 changes: 2 additions & 11 deletions helpers/init-helpers.ts
Original file line number Diff line number Diff line change
@@ -1,24 +1,21 @@
import {
eContractid,
eEthereumNetwork,
eNetwork,
iMultiPoolsAssets,
IReserveParams,
tEthereumAddress,
} from './types';
import { AaveProtocolDataProvider } from '../types/AaveProtocolDataProvider';
import { chunk, DRE, getDb, waitForTx } from './misc-utils';
import { chunk, getDb, waitForTx } from './misc-utils';
import {
getAaveProtocolDataProvider,
getAToken,
getATokensAndRatesHelper,
getFirstSigner,
getPoolAddressesProvider,
getPoolConfiguratorProxy,
getStableAndVariableTokensHelper,
} from './contracts-getters';
import { rawInsertContractAddressInDb } from './contracts-helpers';
import { BigNumber, BigNumberish, Signer } from 'ethers';
import { BigNumber, BigNumberish } from 'ethers';
import {
deployDefaultReserveInterestRateStrategy,
deployDelegationAwareAToken,
Expand All @@ -27,13 +24,7 @@ import {
deployGenericATokenImpl,
deployGenericStableDebtToken,
deployGenericVariableDebtToken,
deployStableDebtToken,
deployVariableDebtToken,
} from './contracts-deployments';
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) {
Expand Down
3 changes: 1 addition & 2 deletions tasks/dev/5_initialize.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import {
deployMockFlashLoanReceiver,
deployAaveProtocolDataProvider,
} from '../../helpers/contracts-deployments';
import { getParamPerNetwork } from '../../helpers/contracts-helpers';
import { eNetwork } from '../../helpers/types';
import {
ConfigNames,
Expand All @@ -14,7 +13,7 @@ import {
} from '../../helpers/configuration';

import { tEthereumAddress, AavePools, eContractid } from '../../helpers/types';
import { waitForTx, filterMapBy, notFalsyOrZeroAddress } from '../../helpers/misc-utils';
import { waitForTx, filterMapBy } from '../../helpers/misc-utils';
import { configureReservesByHelper, initReservesByHelper } from '../../helpers/init-helpers';
import { getAllTokenAddresses } from '../../helpers/mock-helpers';
import { ZERO_ADDRESS } from '../../helpers/constants';
Expand Down
8 changes: 1 addition & 7 deletions tasks/full/6-initialize.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,7 @@
import { task } from 'hardhat/config';
import { getParamPerNetwork } from '../../helpers/contracts-helpers';
import { deployPoolCollateralManager } from '../../helpers/contracts-deployments';
import {
loadPoolConfig,
ConfigNames,
getWethAddress,
getTreasuryAddress,
} from '../../helpers/configuration';
import { loadPoolConfig, ConfigNames, getTreasuryAddress } from '../../helpers/configuration';
import { eNetwork, ICommonConfiguration } from '../../helpers/types';
import { notFalsyOrZeroAddress, waitForTx } from '../../helpers/misc-utils';
import { initReservesByHelper, configureReservesByHelper } from '../../helpers/init-helpers';
Expand All @@ -15,7 +10,6 @@ import {
getAaveProtocolDataProvider,
getPoolAddressesProvider,
} from '../../helpers/contracts-getters';
import { ZERO_ADDRESS } from '../../helpers/constants';

task('full:initialize-pool', 'Initialize pool configuration.')
.addFlag('verify', 'Verify contracts at Etherscan')
Expand Down
3 changes: 1 addition & 2 deletions tasks/misc/print-config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,7 @@ import {
getPoolAddressesProviderRegistry,
} from '../../helpers/contracts-getters';
import { getParamPerNetwork } from '../../helpers/contracts-helpers';
import { DRE } from '../../helpers/misc-utils';
import { eEthereumNetwork, eNetwork, ePolygonNetwork, eXDaiNetwork } from '../../helpers/types';
import { eNetwork } from '../../helpers/types';

task('print-config', 'Inits the DRE, to have access to all the plugins')
.addParam('dataProvider', 'Address of AaveProtocolDataProvider')
Expand Down
14 changes: 6 additions & 8 deletions tasks/misc/print-fork-config.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
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');
task('print-config:fork', 'Deploy development enviroment').setAction(async (_, 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' });
});
const dataProvider = await getAaveProtocolDataProvider();
await DRE.run('print-config', { dataProvider: dataProvider.address, pool: 'Aave' });
});
21 changes: 2 additions & 19 deletions tasks/verifications/1_general.ts
Original file line number Diff line number Diff line change
@@ -1,21 +1,13 @@
import { error } from 'console';
import { zeroAddress } from 'ethereumjs-util';
import { task } from 'hardhat/config';
import { loadPoolConfig, ConfigNames, getTreasuryAddress } from '../../helpers/configuration';
import { ZERO_ADDRESS } from '../../helpers/constants';
import {
getAaveProtocolDataProvider,
getAddressById,
getPool,
getPoolAddressesProvider,
getPoolAddressesProviderRegistry,
getPoolCollateralManager,
getPoolCollateralManagerImpl,
getPoolConfiguratorImpl,
getPoolConfiguratorProxy,
getPoolImpl,
getProxy,
getWalletProvider,
} from '../../helpers/contracts-getters';
import { verifyContract, getParamPerNetwork } from '../../helpers/contracts-helpers';
import { notFalsyOrZeroAddress } from '../../helpers/misc-utils';
Expand All @@ -28,16 +20,8 @@ task('verify:general', 'Verify contracts at Etherscan')
await localDRE.run('set-DRE');
const network = localDRE.network.name as eNetwork;
const poolConfig = loadPoolConfig(pool);
const {
ReserveAssets,
ReservesConfig,
ProviderRegistry,
MarketId,
PoolCollateralManager,
PoolConfigurator,
Pool,
} = poolConfig as ICommonConfiguration;
const treasuryAddress = await getTreasuryAddress(poolConfig);
const { ProviderRegistry, MarketId, PoolCollateralManager, PoolConfigurator, Pool } =
poolConfig as ICommonConfiguration;

const registryAddress = getParamPerNetwork(ProviderRegistry, network);
const addressesProvider = await getPoolAddressesProvider();
Expand Down Expand Up @@ -69,7 +53,6 @@ task('verify:general', 'Verify contracts at Etherscan')
: await getPoolCollateralManagerImpl();

const dataProvider = await getAaveProtocolDataProvider();
const walletProvider = await getWalletProvider();

// Address Provider
console.log('\n- Verifying address provider...\n');
Expand Down
7 changes: 1 addition & 6 deletions tasks/verifications/2_tokens.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,5 @@
import { task } from 'hardhat/config';
import {
loadPoolConfig,
ConfigNames,
getWethAddress,
getTreasuryAddress,
} from '../../helpers/configuration';
import { loadPoolConfig, ConfigNames, getTreasuryAddress } from '../../helpers/configuration';
import { ZERO_ADDRESS } from '../../helpers/constants';
import {
getAddressById,
Expand Down
3 changes: 1 addition & 2 deletions test-suites/__setup.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ import {
deployWETHMocked,
deployMockUniswapRouter,
} from '../helpers/contracts-deployments';
import { eEthereumNetwork } from '../helpers/types';
import { ethers, Signer } from 'ethers';
import { TokenContractId, eContractid, tEthereumAddress, AavePools } from '../helpers/types';
import { MintableERC20 } from '../types/MintableERC20';
Expand All @@ -40,7 +39,7 @@ import {
deployAllMockAggregators,
setInitialMarketRatesInRatesOracleByHelper,
} from '../helpers/oracles-helpers';
import { DRE, waitForTx } from '../helpers/misc-utils';
import { waitForTx } from '../helpers/misc-utils';
import { initReservesByHelper, configureReservesByHelper } from '../helpers/init-helpers';
import AaveConfig from '../markets/aave';
import { ZERO_ADDRESS } from '../helpers/constants';
Expand Down
6 changes: 2 additions & 4 deletions test-suites/authorized-flashloan.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,10 @@ import BigNumber from 'bignumber.js';

import { TestEnv, makeSuite } from './helpers/make-suite';
import { APPROVAL_AMOUNT_POOL, oneRay } from '../helpers/constants';
import { convertToCurrencyDecimals, getContract } from '../helpers/contracts-helpers';
import { convertToCurrencyDecimals } from '../helpers/contracts-helpers';
import { ethers } from 'ethers';
import { MockFlashLoanReceiver } from '../types/MockFlashLoanReceiver';
import { ProtocolErrors, eContractid } from '../helpers/types';
import { VariableDebtToken } from '../types/VariableDebtToken';
import { StableDebtToken } from '../types/StableDebtToken';
import { ProtocolErrors } from '../helpers/types';
import {
getMockFlashLoanReceiver,
getStableDebtToken,
Expand Down
10 changes: 2 additions & 8 deletions test-suites/borrow-cap.spec.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,7 @@
import { TestEnv, makeSuite } from './helpers/make-suite';
import {
APPROVAL_AMOUNT_POOL,
MAX_UINT_AMOUNT,
RAY,
MAX_BORROW_CAP,
MAX_SUPPLY_CAP,
} from '../helpers/constants';
import { MAX_UINT_AMOUNT, MAX_BORROW_CAP } from '../helpers/constants';
import { ProtocolErrors } from '../helpers/types';
import { MintableERC20, WETH9, WETH9Mocked } from '../types';
import { MintableERC20, WETH9Mocked } from '../types';
import { parseEther } from '@ethersproject/units';
import { BigNumber } from '@ethersproject/bignumber';

Expand Down
10 changes: 0 additions & 10 deletions test-suites/borrow-repay-same-tx.ts
Original file line number Diff line number Diff line change
@@ -1,22 +1,12 @@
import { TestEnv, makeSuite } from './helpers/make-suite';
import {
APPROVAL_AMOUNT_POOL,
MAX_UINT_AMOUNT,
RAY,
MAX_BORROW_CAP,
MAX_SUPPLY_CAP,
} from '../helpers/constants';
import { ProtocolErrors } from '../helpers/types';
import {
BorrowRepayTestMock,
BorrowRepayTestMockFactory,
MintableERC20,
WETH9,
WETH9Mocked,
} from '../types';
import { parseEther } from '@ethersproject/units';
import { BigNumber } from '@ethersproject/bignumber';
import { waitForTx } from '../helpers/misc-utils';
import { getFirstSigner } from '../helpers/contracts-getters';

const { expect } = require('chai');
Expand Down
2 changes: 1 addition & 1 deletion test-suites/configurator.spec.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { TestEnv, makeSuite } from './helpers/make-suite';
import { APPROVAL_AMOUNT_POOL, MAX_UINT_AMOUNT, RAY, MAX_BORROW_CAP } from '../helpers/constants';
import { APPROVAL_AMOUNT_POOL, RAY, MAX_BORROW_CAP } from '../helpers/constants';
import { convertToCurrencyDecimals } from '../helpers/contracts-helpers';
import { ProtocolErrors } from '../helpers/types';
import { strategyWETH } from '../markets/aave/reservesConfigs';
Expand Down
15 changes: 2 additions & 13 deletions test-suites/delegation-aware-atoken.spec.ts
Original file line number Diff line number Diff line change
@@ -1,31 +1,20 @@
import { MAX_UINT_AMOUNT, ZERO_ADDRESS } from '../helpers/constants';
import { BUIDLEREVM_CHAINID } from '../helpers/buidler-constants';
import { buildPermitParams, getSignatureFromTypedData } from '../helpers/contracts-helpers';
import { ZERO_ADDRESS } from '../helpers/constants';
import { expect } from 'chai';
import { ethers } from 'ethers';
import { ProtocolErrors } from '../helpers/types';
import { makeSuite, TestEnv } from './helpers/make-suite';
import { DRE } from '../helpers/misc-utils';
import {
ConfigNames,
getATokenDomainSeparatorPerNetwork,
getTreasuryAddress,
loadPoolConfig,
} from '../helpers/configuration';
import { waitForTx } from '../helpers/misc-utils';
import { getTreasuryAddress } from '../helpers/configuration';
import {
deployDelegationAwareAToken,
deployMintableDelegationERC20,
} from '../helpers/contracts-deployments';
import { DelegationAwareATokenFactory } from '../types';
import { DelegationAwareAToken } from '../types/DelegationAwareAToken';
import { MintableDelegationERC20 } from '../types/MintableDelegationERC20';
import AaveConfig from '../markets/aave';

const { parseEther } = ethers.utils;

makeSuite('AToken: underlying delegation', (testEnv: TestEnv) => {
const poolConfig = loadPoolConfig(ConfigNames.Commons);
let delegationAToken = <DelegationAwareAToken>{};
let delegationERC20 = <MintableDelegationERC20>{};

Expand Down
2 changes: 0 additions & 2 deletions test-suites/delegation-permit.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,13 @@ import { MAX_UINT_AMOUNT, ZERO_ADDRESS } from '../helpers/constants';
import { BUIDLEREVM_CHAINID } from '../helpers/buidler-constants';
import {
buildPermitDelegationParams,
buildPermitParams,
convertToCurrencyDecimals,
getSignatureFromTypedData,
} from '../helpers/contracts-helpers';
import { expect } from 'chai';
import { BigNumber, ethers } from 'ethers';
import { makeSuite, TestEnv } from './helpers/make-suite';
import { DRE } from '../helpers/misc-utils';
import { waitForTx } from '../helpers/misc-utils';
import { _TypedDataEncoder } from 'ethers/lib/utils';

const { parseEther } = ethers.utils;
Expand Down
9 changes: 3 additions & 6 deletions test-suites/drop-reserve.spec.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,9 @@
import { makeSuite, TestEnv } from './helpers/make-suite';
import { ProtocolErrors, RateMode } from '../helpers/types';
import { APPROVAL_AMOUNT_POOL, MAX_UINT_AMOUNT, oneEther } from '../helpers/constants';
import { convertToCurrencyDecimals } from '../helpers/contracts-helpers';
import { parseEther, parseUnits } from 'ethers/lib/utils';
import { BigNumber } from 'bignumber.js';
import { ProtocolErrors } from '../helpers/types';
import { MAX_UINT_AMOUNT } from '../helpers/constants';
import { parseEther } from 'ethers/lib/utils';
import { MockFlashLoanReceiver } from '../types/MockFlashLoanReceiver';
import { getMockFlashLoanReceiver } from '../helpers/contracts-getters';
import { domainToUnicode } from 'url';

const { expect } = require('chai');

Expand Down
8 changes: 3 additions & 5 deletions test-suites/flashloan.spec.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
import BigNumber from 'bignumber.js';

import { TestEnv, makeSuite } from './helpers/make-suite';
import { APPROVAL_AMOUNT_POOL, MAX_UINT_AMOUNT, oneRay } from '../helpers/constants';
import { convertToCurrencyDecimals, getContract } from '../helpers/contracts-helpers';
import { APPROVAL_AMOUNT_POOL, MAX_UINT_AMOUNT } from '../helpers/constants';
import { convertToCurrencyDecimals } from '../helpers/contracts-helpers';
import { ethers } from 'ethers';
import { MockFlashLoanReceiver } from '../types/MockFlashLoanReceiver';
import { ProtocolErrors, eContractid } from '../helpers/types';
import { VariableDebtToken } from '../types/VariableDebtToken';
import { StableDebtToken } from '../types/StableDebtToken';
import { ProtocolErrors } from '../helpers/types';
import {
getMockFlashLoanReceiver,
getStableDebtToken,
Expand Down
2 changes: 1 addition & 1 deletion test-suites/helpers/make-suite.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import {
getVariableDebtToken,
getStableDebtToken,
} from '../../helpers/contracts-getters';
import { eEthereumNetwork, eNetwork, tEthereumAddress } from '../../helpers/types';
import { eNetwork, tEthereumAddress } from '../../helpers/types';
import { Pool } from '../../types/Pool';
import { AaveProtocolDataProvider } from '../../types/AaveProtocolDataProvider';
import { MintableERC20 } from '../../types/MintableERC20';
Expand Down
1 change: 0 additions & 1 deletion test-suites/helpers/scenario-engine.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ import {
depositWithPermit,
} from './actions';
import { RateMode } from '../../helpers/types';
import { Wallet } from '@ethersproject/wallet';

export interface Action {
name: string;
Expand Down
8 changes: 1 addition & 7 deletions test-suites/helpers/utils/calculations.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,8 @@
import BigNumber from 'bignumber.js';
import { ONE_YEAR, RAY, MAX_UINT_AMOUNT, PERCENTAGE_FACTOR } from '../../../helpers/constants';
import {
IReserveParams,
iAavePoolAssets,
RateMode,
tEthereumAddress,
} from '../../../helpers/types';
import { IReserveParams, iAavePoolAssets, RateMode } from '../../../helpers/types';
import './math';
import { ReserveData, UserReserveData } from './interfaces';
import { expect } from 'chai';

export const strToBN = (amount: string): BigNumber => new BigNumber(amount);

Expand Down
Loading

0 comments on commit 09e72f2

Please sign in to comment.