Skip to content

Commit

Permalink
feat: Remove LendingPool references of tasks, helpers and tests
Browse files Browse the repository at this point in the history
  • Loading branch information
miguelmtzinf committed Jul 30, 2021
1 parent 702a8d3 commit 6fdde99
Show file tree
Hide file tree
Showing 35 changed files with 135 additions and 135 deletions.
2 changes: 1 addition & 1 deletion helpers/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ export const ONE_ADDRESS = '0x0000000000000000000000000000000000000001';
// ----------------
export const OPTIMAL_UTILIZATION_RATE = new BigNumber(0.8).times(RAY);
export const EXCESS_UTILIZATION_RATE = new BigNumber(0.2).times(RAY);
export const APPROVAL_AMOUNT_LENDING_POOL = '1000000000000000000000000000';
export const APPROVAL_AMOUNT_POOL = '1000000000000000000000000000';
export const TOKEN_DISTRIBUTOR_PERCENTAGE_BASE = '10000';
export const MOCK_USD_PRICE_IN_WEI = '5848466240000000';
export const USD_ADDRESS = '0x10F7Fc1F91Ba351f9C629c5947AD69bD03C05b96';
Expand Down
2 changes: 1 addition & 1 deletion helpers/contracts-deployments.ts
Original file line number Diff line number Diff line change
Expand Up @@ -524,7 +524,7 @@ export const authorizeWETHGateway = async (
) =>
await new WETHGatewayFactory(await getFirstSigner())
.attach(wethGateWay)
.authorizeLendingPool(pool);
.authorizePool(pool);

export const deployMockStableDebtToken = async (
args: [tEthereumAddress, tEthereumAddress, tEthereumAddress, string, string, string],
Expand Down
2 changes: 1 addition & 1 deletion tasks/deployments/deploy-UniswapLiquiditySwapAdapter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ task(`deploy-${CONTRACT_NAME}`, `Deploys the ${CONTRACT_NAME} contract`)

console.log(`\n- ${CONTRACT_NAME} deployment`);
/*const args = [
'0x88757f2f99175387aB4C6a4b3067c77A695b0349', // lending provider kovan address
'0x88757f2f99175387aB4C6a4b3067c77A695b0349', // provider kovan address
'0xfcd87315f0e4067070ade8682fcdbc3006631441', // uniswap router address
];
*/
Expand Down
2 changes: 1 addition & 1 deletion tasks/deployments/deploy-UniswapRepayAdapter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ task(`deploy-${CONTRACT_NAME}`, `Deploys the ${CONTRACT_NAME} contract`)

console.log(`\n- ${CONTRACT_NAME} deployment`);
// const args = [
// '0x88757f2f99175387aB4C6a4b3067c77A695b0349', // lending provider kovan address
// '0x88757f2f99175387aB4C6a4b3067c77A695b0349', // provider kovan address
// '0xfcd87315f0e4067070ade8682fcdbc3006631441', // uniswap router address
// ];
const uniswapRepayAdapter = await new UniswapRepayAdapterFactory(await getFirstSigner()).deploy(
Expand Down
4 changes: 2 additions & 2 deletions tasks/helpers/deploy-new-asset.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import {
import { setDRE } from '../../helpers/misc-utils';
import { ZERO_ADDRESS } from './../../helpers/constants';

const LENDING_POOL_ADDRESS_PROVIDER = {
const POOL_ADDRESS_PROVIDER = {
main: '0xb53c1a33016b2dc2ff3653530bff1848a515c8c5',
kovan: '0x652B2937Efd0B5beA1c8d54293FC1289672AFC6b',
};
Expand Down Expand Up @@ -44,7 +44,7 @@ WRONG RESERVE ASSET SETUP:
marketConfigs.AaveConfig.ReserveAssets[localBRE.network.name][symbol];
const deployCustomAToken = chooseATokenDeployment(strategyParams.aTokenImpl);
const addressProvider = await getPoolAddressesProvider(
LENDING_POOL_ADDRESS_PROVIDER[network]
POOL_ADDRESS_PROVIDER[network]
);
const poolAddress = await addressProvider.getPool();
const treasuryAddress = await getTreasuryAddress(marketConfigs.AaveConfig);
Expand Down
6 changes: 3 additions & 3 deletions test-suites/test-aave/atoken-transfer.spec.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { APPROVAL_AMOUNT_LENDING_POOL, MAX_UINT_AMOUNT, ZERO_ADDRESS } from '../../helpers/constants';
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';
Expand All @@ -20,7 +20,7 @@ makeSuite('AToken: Transfer', (testEnv: TestEnv) => {

await dai.connect(users[0].signer).mint(await convertToCurrencyDecimals(dai.address, '1000'));

await dai.connect(users[0].signer).approve(pool.address, APPROVAL_AMOUNT_LENDING_POOL);
await dai.connect(users[0].signer).approve(pool.address, APPROVAL_AMOUNT_POOL);

//user 1 deposits 1000 DAI
const amountDAItoDeposit = await convertToCurrencyDecimals(dai.address, '1000');
Expand Down Expand Up @@ -51,7 +51,7 @@ makeSuite('AToken: Transfer', (testEnv: TestEnv) => {

await weth.connect(users[0].signer).mint(await convertToCurrencyDecimals(weth.address, '1'));

await weth.connect(users[0].signer).approve(pool.address, APPROVAL_AMOUNT_LENDING_POOL);
await weth.connect(users[0].signer).approve(pool.address, APPROVAL_AMOUNT_POOL);

await pool
.connect(users[0].signer)
Expand Down
14 changes: 7 additions & 7 deletions test-suites/test-aave/authorized-flashloan.spec.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import BigNumber from 'bignumber.js';

import { TestEnv, makeSuite } from './helpers/make-suite';
import { APPROVAL_AMOUNT_LENDING_POOL, oneRay } from '../../helpers/constants';
import { APPROVAL_AMOUNT_POOL, oneRay } from '../../helpers/constants';
import { convertToCurrencyDecimals, getContract } from '../../helpers/contracts-helpers';
import { ethers } from 'ethers';
import { MockFlashLoanReceiver } from '../../types/MockFlashLoanReceiver';
Expand Down Expand Up @@ -42,7 +42,7 @@ makeSuite('Pool FlashLoan function', (testEnv: TestEnv) => {

await weth.mint(amountToDeposit);

await weth.approve(pool.address, APPROVAL_AMOUNT_LENDING_POOL);
await weth.approve(pool.address, APPROVAL_AMOUNT_POOL);

await pool.deposit(weth.address, amountToDeposit, userAddress, '0');
});
Expand Down Expand Up @@ -173,7 +173,7 @@ makeSuite('Pool FlashLoan function', (testEnv: TestEnv) => {

await dai.connect(caller.signer).mint(await convertToCurrencyDecimals(dai.address, '1000'));

await dai.connect(caller.signer).approve(pool.address, APPROVAL_AMOUNT_LENDING_POOL);
await dai.connect(caller.signer).approve(pool.address, APPROVAL_AMOUNT_POOL);

const amountToDeposit = await convertToCurrencyDecimals(dai.address, '1000');

Expand Down Expand Up @@ -244,7 +244,7 @@ makeSuite('Pool FlashLoan function', (testEnv: TestEnv) => {

await usdc.mint(await convertToCurrencyDecimals(usdc.address, '1000'));

await usdc.approve(pool.address, APPROVAL_AMOUNT_LENDING_POOL);
await usdc.approve(pool.address, APPROVAL_AMOUNT_POOL);

const amountToDeposit = await convertToCurrencyDecimals(usdc.address, '1000');

Expand Down Expand Up @@ -324,7 +324,7 @@ makeSuite('Pool FlashLoan function', (testEnv: TestEnv) => {

await weth.connect(caller.signer).mint(await convertToCurrencyDecimals(weth.address, '5'));

await weth.connect(caller.signer).approve(pool.address, APPROVAL_AMOUNT_LENDING_POOL);
await weth.connect(caller.signer).approve(pool.address, APPROVAL_AMOUNT_POOL);

const amountToDeposit = await convertToCurrencyDecimals(weth.address, '5');

Expand Down Expand Up @@ -362,7 +362,7 @@ makeSuite('Pool FlashLoan function', (testEnv: TestEnv) => {

await dai.connect(caller.signer).mint(await convertToCurrencyDecimals(dai.address, '1000'));

await dai.connect(caller.signer).approve(pool.address, APPROVAL_AMOUNT_LENDING_POOL);
await dai.connect(caller.signer).approve(pool.address, APPROVAL_AMOUNT_POOL);

const amountToDeposit = await convertToCurrencyDecimals(dai.address, '1000');

Expand Down Expand Up @@ -429,7 +429,7 @@ makeSuite('Pool FlashLoan function', (testEnv: TestEnv) => {
// Deposit 1000 dai for onBehalfOf user
await dai.connect(onBehalfOf.signer).mint(await convertToCurrencyDecimals(dai.address, '1000'));

await dai.connect(onBehalfOf.signer).approve(pool.address, APPROVAL_AMOUNT_LENDING_POOL);
await dai.connect(onBehalfOf.signer).approve(pool.address, APPROVAL_AMOUNT_POOL);

const amountToDeposit = await convertToCurrencyDecimals(dai.address, '1000');

Expand Down
2 changes: 1 addition & 1 deletion test-suites/test-aave/borrow-cap.spec.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { TestEnv, makeSuite } from './helpers/make-suite';
import {
APPROVAL_AMOUNT_LENDING_POOL,
APPROVAL_AMOUNT_POOL,
MAX_UINT_AMOUNT,
RAY,
MAX_BORROW_CAP,
Expand Down
2 changes: 1 addition & 1 deletion test-suites/test-aave/borrow-repay-same-tx.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { TestEnv, makeSuite } from './helpers/make-suite';
import {
APPROVAL_AMOUNT_LENDING_POOL,
APPROVAL_AMOUNT_POOL,
MAX_UINT_AMOUNT,
RAY,
MAX_BORROW_CAP,
Expand Down
4 changes: 2 additions & 2 deletions test-suites/test-aave/configurator.spec.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { TestEnv, makeSuite } from './helpers/make-suite';
import {
APPROVAL_AMOUNT_LENDING_POOL,
APPROVAL_AMOUNT_POOL,
MAX_UINT_AMOUNT,
RAY,
MAX_BORROW_CAP,
Expand Down Expand Up @@ -1277,7 +1277,7 @@ makeSuite('PoolConfigurator', (testEnv: TestEnv) => {
await dai.mint(await convertToCurrencyDecimals(dai.address, '1000'));

//approve protocol to access depositor wallet
await dai.approve(pool.address, APPROVAL_AMOUNT_LENDING_POOL);
await dai.approve(pool.address, APPROVAL_AMOUNT_POOL);
const amountDAItoDeposit = await convertToCurrencyDecimals(dai.address, '1000');

//user 1 deposits 1000 DAI
Expand Down
2 changes: 1 addition & 1 deletion test-suites/test-aave/drop-reserve.spec.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { makeSuite, TestEnv } from './helpers/make-suite';
import { ProtocolErrors, RateMode } from '../../helpers/types';
import { APPROVAL_AMOUNT_LENDING_POOL, MAX_UINT_AMOUNT, oneEther } from '../../helpers/constants';
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';
Expand Down
20 changes: 10 additions & 10 deletions test-suites/test-aave/flashloan.spec.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import BigNumber from 'bignumber.js';

import { TestEnv, makeSuite } from './helpers/make-suite';
import { APPROVAL_AMOUNT_LENDING_POOL, MAX_UINT_AMOUNT, oneRay } from '../../helpers/constants';
import { APPROVAL_AMOUNT_POOL, MAX_UINT_AMOUNT, oneRay } from '../../helpers/constants';
import { convertToCurrencyDecimals, getContract } from '../../helpers/contracts-helpers';
import { ethers } from 'ethers';
import { MockFlashLoanReceiver } from '../../types/MockFlashLoanReceiver';
Expand Down Expand Up @@ -50,18 +50,18 @@ makeSuite('Pool FlashLoan function', (testEnv: TestEnv) => {

await weth.mint(amountToDeposit);

await weth.approve(pool.address, APPROVAL_AMOUNT_LENDING_POOL);
await weth.approve(pool.address, APPROVAL_AMOUNT_POOL);

await pool.deposit(weth.address, amountToDeposit, userAddress, '0');

await aave.mint(amountToDeposit);

await aave.approve(pool.address, APPROVAL_AMOUNT_LENDING_POOL);
await aave.approve(pool.address, APPROVAL_AMOUNT_POOL);

await pool.deposit(aave.address, amountToDeposit, userAddress, '0');
await dai.mint(amountToDeposit);

await dai.approve(pool.address, APPROVAL_AMOUNT_LENDING_POOL);
await dai.approve(pool.address, APPROVAL_AMOUNT_POOL);

await pool.deposit(dai.address, amountToDeposit, userAddress, '0');
});
Expand Down Expand Up @@ -324,7 +324,7 @@ makeSuite('Pool FlashLoan function', (testEnv: TestEnv) => {

await dai.connect(caller.signer).mint(await convertToCurrencyDecimals(dai.address, '1000'));

await dai.connect(caller.signer).approve(pool.address, APPROVAL_AMOUNT_LENDING_POOL);
await dai.connect(caller.signer).approve(pool.address, APPROVAL_AMOUNT_POOL);

const amountToDeposit = await convertToCurrencyDecimals(dai.address, '1000');

Expand Down Expand Up @@ -368,7 +368,7 @@ makeSuite('Pool FlashLoan function', (testEnv: TestEnv) => {
expect(callerDebt.toString()).to.be.equal('800000000000000000', 'Invalid user debt');
// repays debt for later, so no interest accrue
await weth.connect(caller.signer).mint(await convertToCurrencyDecimals(weth.address, '1000'));
await weth.connect(caller.signer).approve(pool.address, APPROVAL_AMOUNT_LENDING_POOL);
await weth.connect(caller.signer).approve(pool.address, APPROVAL_AMOUNT_POOL);
await pool.connect(caller.signer).repay(weth.address, MAX_UINT_AMOUNT, 2, caller.address);
});
it('tries to take a flashloan that is bigger than the available liquidity (revert expected)', async () => {
Expand Down Expand Up @@ -412,7 +412,7 @@ makeSuite('Pool FlashLoan function', (testEnv: TestEnv) => {

await usdc.mint(await convertToCurrencyDecimals(usdc.address, '1000'));

await usdc.approve(pool.address, APPROVAL_AMOUNT_LENDING_POOL);
await usdc.approve(pool.address, APPROVAL_AMOUNT_POOL);

const amountToDeposit = await convertToCurrencyDecimals(usdc.address, '1000');

Expand Down Expand Up @@ -505,7 +505,7 @@ makeSuite('Pool FlashLoan function', (testEnv: TestEnv) => {

await weth.connect(caller.signer).mint(await convertToCurrencyDecimals(weth.address, '5'));

await weth.connect(caller.signer).approve(pool.address, APPROVAL_AMOUNT_LENDING_POOL);
await weth.connect(caller.signer).approve(pool.address, APPROVAL_AMOUNT_POOL);

const amountToDeposit = await convertToCurrencyDecimals(weth.address, '5');

Expand Down Expand Up @@ -543,7 +543,7 @@ makeSuite('Pool FlashLoan function', (testEnv: TestEnv) => {

await dai.connect(caller.signer).mint(await convertToCurrencyDecimals(dai.address, '1000'));

await dai.connect(caller.signer).approve(pool.address, APPROVAL_AMOUNT_LENDING_POOL);
await dai.connect(caller.signer).approve(pool.address, APPROVAL_AMOUNT_POOL);

const amountToDeposit = await convertToCurrencyDecimals(dai.address, '1000');

Expand Down Expand Up @@ -610,7 +610,7 @@ makeSuite('Pool FlashLoan function', (testEnv: TestEnv) => {
// Deposit 1000 dai for onBehalfOf user
await dai.connect(onBehalfOf.signer).mint(await convertToCurrencyDecimals(dai.address, '1000'));

await dai.connect(onBehalfOf.signer).approve(pool.address, APPROVAL_AMOUNT_LENDING_POOL);
await dai.connect(onBehalfOf.signer).approve(pool.address, APPROVAL_AMOUNT_POOL);

const amountToDeposit = await convertToCurrencyDecimals(dai.address, '1000');

Expand Down
14 changes: 7 additions & 7 deletions test-suites/test-aave/liquidation-atoken.spec.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import BigNumber from 'bignumber.js';

import { DRE } from '../../helpers/misc-utils';
import { APPROVAL_AMOUNT_LENDING_POOL, oneEther } from '../../helpers/constants';
import { APPROVAL_AMOUNT_POOL, oneEther } from '../../helpers/constants';
import { convertToCurrencyDecimals } from '../../helpers/contracts-helpers';
import { makeSuite } from './helpers/make-suite';
import { ProtocolErrors, RateMode } from '../../helpers/types';
Expand All @@ -28,7 +28,7 @@ makeSuite('Pool liquidation - liquidator receiving aToken', (testEnv) => {
await dai.connect(depositor.signer).mint(await convertToCurrencyDecimals(dai.address, '1000'));

//approve protocol to access depositor wallet
await dai.connect(depositor.signer).approve(pool.address, APPROVAL_AMOUNT_LENDING_POOL);
await dai.connect(depositor.signer).approve(pool.address, APPROVAL_AMOUNT_POOL);

//user 1 deposits 1000 DAI
const amountDAItoDeposit = await convertToCurrencyDecimals(dai.address, '1000');
Expand All @@ -42,7 +42,7 @@ makeSuite('Pool liquidation - liquidator receiving aToken', (testEnv) => {
await weth.connect(borrower.signer).mint(amountETHtoDeposit);

//approve protocol to access borrower wallet
await weth.connect(borrower.signer).approve(pool.address, APPROVAL_AMOUNT_LENDING_POOL);
await weth.connect(borrower.signer).approve(pool.address, APPROVAL_AMOUNT_POOL);

//user 2 deposits 1 WETH
await pool
Expand Down Expand Up @@ -124,7 +124,7 @@ makeSuite('Pool liquidation - liquidator receiving aToken', (testEnv) => {
await dai.mint(await convertToCurrencyDecimals(dai.address, '1000'));

//approve protocol to access depositor wallet
await dai.approve(pool.address, APPROVAL_AMOUNT_LENDING_POOL);
await dai.approve(pool.address, APPROVAL_AMOUNT_POOL);

const daiReserveDataBefore = await getReserveData(helpersContract, dai.address);
const ethReserveDataBefore = await helpersContract.getReserveData(weth.address);
Expand Down Expand Up @@ -240,7 +240,7 @@ makeSuite('Pool liquidation - liquidator receiving aToken', (testEnv) => {
.mint(await convertToCurrencyDecimals(usdc.address, '1000'));

//approve protocol to access depositor wallet
await usdc.connect(depositor.signer).approve(pool.address, APPROVAL_AMOUNT_LENDING_POOL);
await usdc.connect(depositor.signer).approve(pool.address, APPROVAL_AMOUNT_POOL);

//user 3 deposits 1000 USDC
const amountUSDCtoDeposit = await convertToCurrencyDecimals(usdc.address, '1000');
Expand All @@ -256,7 +256,7 @@ makeSuite('Pool liquidation - liquidator receiving aToken', (testEnv) => {
await weth.connect(borrower.signer).mint(amountETHtoDeposit);

//approve protocol to access borrower wallet
await weth.connect(borrower.signer).approve(pool.address, APPROVAL_AMOUNT_LENDING_POOL);
await weth.connect(borrower.signer).approve(pool.address, APPROVAL_AMOUNT_POOL);

await pool
.connect(borrower.signer)
Expand Down Expand Up @@ -291,7 +291,7 @@ makeSuite('Pool liquidation - liquidator receiving aToken', (testEnv) => {
await usdc.mint(await convertToCurrencyDecimals(usdc.address, '1000'));

//approve protocol to access depositor wallet
await usdc.approve(pool.address, APPROVAL_AMOUNT_LENDING_POOL);
await usdc.approve(pool.address, APPROVAL_AMOUNT_POOL);

const userReserveDataBefore = await helpersContract.getUserReserveData(
usdc.address,
Expand Down
Loading

0 comments on commit 6fdde99

Please sign in to comment.