Skip to content

Commit

Permalink
feat: remove amm test scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
Steven Valeri committed Aug 3, 2021
1 parent efa9df9 commit 9f00d44
Show file tree
Hide file tree
Showing 85 changed files with 183 additions and 10,687 deletions.
17 changes: 8 additions & 9 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,13 @@
"hardhat:matic": "hardhat --network matic",
"compile": "SKIP_LOAD=true hardhat compile",
"console:fork": "FORK=main hardhat console",
"test": "npm run compile && TS_NODE_TRANSPILE_ONLY=1 hardhat test ./test-suites/test-aave/*.spec.ts",
"test": "npm run compile && TS_NODE_TRANSPILE_ONLY=1 hardhat test ./test-suites/*.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",
"test:aave": "hardhat test test-suites/test-aave/__setup.spec.ts",
"test:amm": "hardhat test test-suites/test-amm/__setup.spec.ts",
"test-scenarios": "npm run compile && npx hardhat test test-suites/__setup.spec.ts test-suites/scenario.spec.ts",
"test-subgraph:scenarios": "npm run compile && hardhat --network hardhatevm_docker test test-suites/__setup.spec.ts test-suites/subgraph-scenarios.spec.ts",
"test:main:check-list": "npm run compile && FORK=main TS_NODE_TRANSPILE_ONLY=1 hardhat test test-suites/__setup.spec.ts test-suites/mainnet/check-list.spec.ts",
"test:aave": "hardhat test test-suites/__setup.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 --skip-registry",
Expand Down Expand Up @@ -61,8 +60,8 @@
"aave:main:full:migration": "npm run compile && npm run hardhat:main -- aave:mainnet --verify",
"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' 'test-suites/test-amm/**/*.ts' 'markets/**/*.ts'",
"prettier:write": "prettier --write 'tasks/**/*.ts' 'contracts/**/*.sol' 'helpers/**/*.ts' 'test-suites/test-aave/**/*.ts' 'test-suites/test-amm/**/*.ts' 'markets/**/*.ts'",
"prettier:check": "npx prettier -c 'tasks/**/*.ts' 'contracts/**/*.sol' 'helpers/**/*.ts' 'test-suites/**/*.ts' 'markets/**/*.ts'",
"prettier:write": "prettier --write 'tasks/**/*.ts' 'contracts/**/*.sol' 'helpers/**/*.ts' 'test-suites/**/*.ts' 'markets/**/*.ts'",
"ci:test": "npm run compile && npm run test",
"ci:clean": "rm -rf ./artifacts ./cache ./types",
"print-contracts:kovan": "npm run hardhat:kovan -- print-contracts",
Expand Down Expand Up @@ -134,7 +133,7 @@
},
"husky": {
"hooks": {
"pre-commit": "pretty-quick --staged --pattern 'contracts/**/*.sol' --pattern 'helpers/**/*.ts' --pattern 'test-suites/test-aave/**/*.ts' --pattern 'test-suites/test-amm/**/*.ts' --pattern 'tasks/**/*.ts' --pattern 'markets/**/*.ts'"
"pre-commit": "pretty-quick --staged --pattern 'contracts/**/*.sol' --pattern 'helpers/**/*.ts' --pattern 'test-suites**/*.ts' --pattern 'tasks/**/*.ts' --pattern 'markets/**/*.ts'"
}
},
"author": "Aave",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import {
getEthersSigners,
registerContractInJsonDb,
getEthersSignersAddresses,
} from '../../helpers/contracts-helpers';
} from '../helpers/contracts-helpers';
import {
deployPoolAddressesProvider,
deployMintableERC20,
Expand All @@ -22,34 +22,34 @@ import {
deployATokensAndRatesHelper,
deployWETHMocked,
deployMockUniswapRouter,
} from '../../helpers/contracts-deployments';
import { eEthereumNetwork } from '../../helpers/types';
} 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';
import { TokenContractId, eContractid, tEthereumAddress, AavePools } from '../helpers/types';
import { MintableERC20 } from '../types/MintableERC20';
import {
ConfigNames,
getReservesConfigByPool,
getTreasuryAddress,
loadPoolConfig,
} from '../../helpers/configuration';
} from '../helpers/configuration';
import { initializeMakeSuite } from './helpers/make-suite';

import {
setInitialAssetPricesInOracle,
deployAllMockAggregators,
setInitialMarketRatesInRatesOracleByHelper,
} from '../../helpers/oracles-helpers';
import { DRE, waitForTx } from '../../helpers/misc-utils';
import { initReservesByHelper, configureReservesByHelper } from '../../helpers/init-helpers';
import AaveConfig from '../../markets/aave';
import { ZERO_ADDRESS } from '../../helpers/constants';
} from '../helpers/oracles-helpers';
import { DRE, waitForTx } from '../helpers/misc-utils';
import { initReservesByHelper, configureReservesByHelper } from '../helpers/init-helpers';
import AaveConfig from '../markets/aave';
import { ZERO_ADDRESS } from '../helpers/constants';
import {
getPool,
getPoolConfiguratorProxy,
getPairsTokenAggregator,
} from '../../helpers/contracts-getters';
import { WETH9Mocked } from '../../types/WETH9Mocked';
} from '../helpers/contracts-getters';
import { WETH9Mocked } from '../types/WETH9Mocked';

const MOCK_USD_PRICE_IN_WEI = AaveConfig.ProtocolGlobalParams.MockUsdPriceInWei;
const ALL_ASSETS_INITIAL_PRICES = AaveConfig.Mocks.AllAssetsInitialPrices;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { TestEnv, makeSuite } from './helpers/make-suite';
import { ZERO_ADDRESS } from '../../helpers/constants';
import { ProtocolErrors } from '../../helpers/types';
import { ZERO_ADDRESS } from '../helpers/constants';
import { ProtocolErrors } from '../helpers/types';

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

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { expect } from 'chai';
import { makeSuite, TestEnv } from './helpers/make-suite';
import { ProtocolErrors } from '../../helpers/types';
import { ProtocolErrors } from '../helpers/types';

makeSuite('AToken: Modifiers', (testEnv: TestEnv) => {
const { CT_CALLER_MUST_BE_POOL } = ProtocolErrors;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
import { MAX_UINT_AMOUNT, ZERO_ADDRESS } from '../../helpers/constants';
import { BUIDLEREVM_CHAINID } from '../../helpers/buidler-constants';
import { buildPermitParams, getSignatureFromTypedData } from '../../helpers/contracts-helpers';
import { MAX_UINT_AMOUNT, ZERO_ADDRESS } from '../helpers/constants';
import { BUIDLEREVM_CHAINID } from '../helpers/buidler-constants';
import { buildPermitParams, getSignatureFromTypedData } from '../helpers/contracts-helpers';
import { expect } from 'chai';
import { ethers } from 'ethers';
import { makeSuite, TestEnv } from './helpers/make-suite';
import { DRE } from '../../helpers/misc-utils';
import { waitForTx } from '../../helpers/misc-utils';
import { DRE } from '../helpers/misc-utils';
import { waitForTx } from '../helpers/misc-utils';
import { _TypedDataEncoder } from 'ethers/lib/utils';

const { parseEther } = ethers.utils;
const TEST_WALLET_PATH = '../test-wallets.js';

makeSuite('AToken: Permit', (testEnv: TestEnv) => {
it('Checks the domain separator', async () => {
Expand Down Expand Up @@ -58,7 +59,7 @@ makeSuite('AToken: Permit', (testEnv: TestEnv) => {
expiration.toFixed()
);

const ownerPrivateKey = require('../../test-wallets.js').accounts[0].secretKey;
const ownerPrivateKey = require(TEST_WALLET_PATH).accounts[0].secretKey;
if (!ownerPrivateKey) {
throw new Error('INVALID_OWNER_PK');
}
Expand Down Expand Up @@ -103,7 +104,7 @@ makeSuite('AToken: Permit', (testEnv: TestEnv) => {
permitAmount
);

const ownerPrivateKey = require('../../test-wallets.js').accounts[0].secretKey;
const ownerPrivateKey = require(TEST_WALLET_PATH).accounts[0].secretKey;
if (!ownerPrivateKey) {
throw new Error('INVALID_OWNER_PK');
}
Expand Down Expand Up @@ -145,7 +146,7 @@ makeSuite('AToken: Permit', (testEnv: TestEnv) => {
permitAmount
);

const ownerPrivateKey = require('../../test-wallets.js').accounts[0].secretKey;
const ownerPrivateKey = require(TEST_WALLET_PATH).accounts[0].secretKey;
if (!ownerPrivateKey) {
throw new Error('INVALID_OWNER_PK');
}
Expand Down Expand Up @@ -191,7 +192,7 @@ makeSuite('AToken: Permit', (testEnv: TestEnv) => {
permitAmount
);

const ownerPrivateKey = require('../../test-wallets.js').accounts[0].secretKey;
const ownerPrivateKey = require(TEST_WALLET_PATH).accounts[0].secretKey;
if (!ownerPrivateKey) {
throw new Error('INVALID_OWNER_PK');
}
Expand Down Expand Up @@ -226,7 +227,7 @@ makeSuite('AToken: Permit', (testEnv: TestEnv) => {
permitAmount
);

const ownerPrivateKey = require('../../test-wallets.js').accounts[0].secretKey;
const ownerPrivateKey = require(TEST_WALLET_PATH).accounts[0].secretKey;
if (!ownerPrivateKey) {
throw new Error('INVALID_OWNER_PK');
}
Expand Down Expand Up @@ -261,7 +262,7 @@ makeSuite('AToken: Permit', (testEnv: TestEnv) => {
permitAmount
);

const ownerPrivateKey = require('../../test-wallets.js').accounts[0].secretKey;
const ownerPrivateKey = require(TEST_WALLET_PATH).accounts[0].secretKey;
if (!ownerPrivateKey) {
throw new Error('INVALID_OWNER_PK');
}
Expand Down Expand Up @@ -296,7 +297,7 @@ makeSuite('AToken: Permit', (testEnv: TestEnv) => {
permitAmount
);

const ownerPrivateKey = require('../../test-wallets.js').accounts[0].secretKey;
const ownerPrivateKey = require(TEST_WALLET_PATH).accounts[0].secretKey;
if (!ownerPrivateKey) {
throw new Error('INVALID_OWNER_PK');
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import { APPROVAL_AMOUNT_POOL, MAX_UINT_AMOUNT, ZERO_ADDRESS } from '../../helpers/constants';
import { convertToCurrencyDecimals } from '../../helpers/contracts-helpers';
import { APPROVAL_AMOUNT_POOL, MAX_UINT_AMOUNT, ZERO_ADDRESS } from '../helpers/constants';
import { convertToCurrencyDecimals } from '../helpers/contracts-helpers';
import { expect } from 'chai';
import { ethers } from 'ethers';
import { RateMode, ProtocolErrors } from '../../helpers/types';
import { RateMode, ProtocolErrors } from '../helpers/types';
import { makeSuite, TestEnv } from './helpers/make-suite';
import { CommonsConfig } from '../../markets/aave/commons';
import { CommonsConfig } from '../markets/aave/commons';

const AAVE_REFERRAL = CommonsConfig.ProtocolGlobalParams.AaveReferral;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
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 { APPROVAL_AMOUNT_POOL, oneRay } from '../helpers/constants';
import { convertToCurrencyDecimals, getContract } 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 { MockFlashLoanReceiver } from '../types/MockFlashLoanReceiver';
import { ProtocolErrors, eContractid } from '../helpers/types';
import { VariableDebtToken } from '../types/VariableDebtToken';
import { StableDebtToken } from '../types/StableDebtToken';
import {
getMockFlashLoanReceiver,
getStableDebtToken,
getVariableDebtToken,
} from '../../helpers/contracts-getters';
} from '../helpers/contracts-getters';

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

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ import {
RAY,
MAX_BORROW_CAP,
MAX_SUPPLY_CAP,
} from '../../helpers/constants';
import { ProtocolErrors } from '../../helpers/types';
import { MintableERC20, WETH9, WETH9Mocked } from '../../types';
} from '../helpers/constants';
import { ProtocolErrors } from '../helpers/types';
import { MintableERC20, WETH9, WETH9Mocked } from '../types';
import { parseEther } from '@ethersproject/units';
import { BigNumber } from '@ethersproject/bignumber';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,19 +5,19 @@ import {
RAY,
MAX_BORROW_CAP,
MAX_SUPPLY_CAP,
} from '../../helpers/constants';
import { ProtocolErrors } from '../../helpers/types';
} from '../helpers/constants';
import { ProtocolErrors } from '../helpers/types';
import {
BorrowRepayTestMock,
BorrowRepayTestMockFactory,
MintableERC20,
WETH9,
WETH9Mocked,
} from '../../types';
} from '../types';
import { parseEther } from '@ethersproject/units';
import { BigNumber } from '@ethersproject/bignumber';
import { waitForTx } from '../../helpers/misc-utils';
import { getFirstSigner } from '../../helpers/contracts-getters';
import { waitForTx } from '../helpers/misc-utils';
import { getFirstSigner } from '../helpers/contracts-getters';

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

Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,8 @@
import { TestEnv, makeSuite } from './helpers/make-suite';
import {
APPROVAL_AMOUNT_POOL,
MAX_UINT_AMOUNT,
RAY,
MAX_BORROW_CAP,
} from '../../helpers/constants';
import { convertToCurrencyDecimals } from '../../helpers/contracts-helpers';
import { ProtocolErrors } from '../../helpers/types';
import { strategyWETH } from '../../markets/aave/reservesConfigs';
import { APPROVAL_AMOUNT_POOL, MAX_UINT_AMOUNT, RAY, MAX_BORROW_CAP } from '../helpers/constants';
import { convertToCurrencyDecimals } from '../helpers/contracts-helpers';
import { ProtocolErrors } from '../helpers/types';
import { strategyWETH } from '../markets/aave/reservesConfigs';
import { BigNumber } from '@ethersproject/bignumber';

const { expect } = require('chai');
Expand Down
Original file line number Diff line number Diff line change
@@ -1,26 +1,26 @@
import { MAX_UINT_AMOUNT, ZERO_ADDRESS } from '../../helpers/constants';
import { BUIDLEREVM_CHAINID } from '../../helpers/buidler-constants';
import { buildPermitParams, getSignatureFromTypedData } from '../../helpers/contracts-helpers';
import { MAX_UINT_AMOUNT, ZERO_ADDRESS } from '../helpers/constants';
import { BUIDLEREVM_CHAINID } from '../helpers/buidler-constants';
import { buildPermitParams, getSignatureFromTypedData } from '../helpers/contracts-helpers';
import { expect } from 'chai';
import { ethers } from 'ethers';
import { ProtocolErrors } from '../../helpers/types';
import { ProtocolErrors } from '../helpers/types';
import { makeSuite, TestEnv } from './helpers/make-suite';
import { DRE } from '../../helpers/misc-utils';
import { DRE } from '../helpers/misc-utils';
import {
ConfigNames,
getATokenDomainSeparatorPerNetwork,
getTreasuryAddress,
loadPoolConfig,
} from '../../helpers/configuration';
import { waitForTx } from '../../helpers/misc-utils';
} from '../helpers/configuration';
import { waitForTx } from '../helpers/misc-utils';
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';
} 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;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,19 +1,20 @@
import { MAX_UINT_AMOUNT, ZERO_ADDRESS } from '../../helpers/constants';
import { BUIDLEREVM_CHAINID } from '../../helpers/buidler-constants';
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';
} 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 { DRE } from '../helpers/misc-utils';
import { waitForTx } from '../helpers/misc-utils';
import { _TypedDataEncoder } from 'ethers/lib/utils';

const { parseEther } = ethers.utils;
const TEST_WALLET_PATH = '../test-wallets.js';

makeSuite('Permit Delegation', (testEnv: TestEnv) => {
const mintedAmount = '1000';
Expand Down Expand Up @@ -91,7 +92,7 @@ makeSuite('Permit Delegation', (testEnv: TestEnv) => {
permitAmount.toString()
);

const user2PrivateKey = require('../../test-wallets.js').accounts[1].secretKey;
const user2PrivateKey = require('../test-wallets.js').accounts[1].secretKey;
if (!user2PrivateKey) {
throw new Error('INVALID_OWNER_PK');
}
Expand Down Expand Up @@ -141,7 +142,7 @@ makeSuite('Permit Delegation', (testEnv: TestEnv) => {
permitAmount.toString()
);

const user2PrivateKey = require('../../test-wallets.js').accounts[1].secretKey;
const user2PrivateKey = require('../test-wallets.js').accounts[1].secretKey;
if (!user2PrivateKey) {
throw new Error('INVALID_OWNER_PK');
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
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 { 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 { MockFlashLoanReceiver } from '../../types/MockFlashLoanReceiver';
import { getMockFlashLoanReceiver } from '../../helpers/contracts-getters';
import { MockFlashLoanReceiver } from '../types/MockFlashLoanReceiver';
import { getMockFlashLoanReceiver } from '../helpers/contracts-getters';
import { domainToUnicode } from 'url';

const { expect } = require('chai');
Expand Down
Loading

0 comments on commit 9f00d44

Please sign in to comment.