mirror of
https://github.com/Instadapp/aave-protocol-v2.git
synced 2024-07-29 21:47:30 +00:00
- Finished migration of configurator.spec.ts
This commit is contained in:
parent
6ef4ca54b5
commit
57cc16e665
6
package-lock.json
generated
6
package-lock.json
generated
|
@ -1940,6 +1940,12 @@
|
|||
"type-detect": "^4.0.5"
|
||||
}
|
||||
},
|
||||
"chai-bignumber": {
|
||||
"version": "3.0.0",
|
||||
"resolved": "https://registry.npmjs.org/chai-bignumber/-/chai-bignumber-3.0.0.tgz",
|
||||
"integrity": "sha512-SubOtaSI2AILWTWe2j0c6i2yFT/f9J6UBjeVGDuwDiPLkF/U5+/eTWUE3sbCZ1KgcPF6UJsDVYbIxaYA097MQA==",
|
||||
"dev": true
|
||||
},
|
||||
"chalk": {
|
||||
"version": "2.4.2",
|
||||
"resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz",
|
||||
|
|
|
@ -33,6 +33,7 @@
|
|||
"bignumber.js": "9.0.0",
|
||||
"buidler-typechain": "0.1.1",
|
||||
"chai": "4.2.0",
|
||||
"chai-bignumber": "3.0.0",
|
||||
"ethereum-waffle": "2.5.1",
|
||||
"ethers": "4.0.47",
|
||||
"ganache-cli": "6.9.1",
|
||||
|
|
|
@ -626,6 +626,7 @@ const buildTestEnv = async (deployer: Signer, secondaryWallet: Signer) => {
|
|||
before(async () => {
|
||||
await rawBRE.run("set-bre");
|
||||
const [deployer, secondaryWallet] = await getEthersSigners();
|
||||
console.log("-> Deploying test environment...")
|
||||
await buildTestEnv(deployer, secondaryWallet);
|
||||
console.log("\n***************");
|
||||
console.log("Setup and snapshot finished");
|
||||
|
|
|
@ -1,44 +1,28 @@
|
|||
import {expect} from "chai";
|
||||
import {getAToken} from "../helpers/contracts-helpers";
|
||||
import {AToken} from "../types/AToken";
|
||||
import {makeSuite, TestEnv} from "./helpers/make-suite";
|
||||
|
||||
makeSuite("AToken: Modifiers", (testEnv: TestEnv) => {
|
||||
let _aDAI = {} as AToken;
|
||||
const NOT_LENDING_POOL_MSG =
|
||||
"The caller of this function must be a lending pool";
|
||||
|
||||
before(async () => {
|
||||
const {helpersContract} = testEnv;
|
||||
|
||||
const aDAIAddress = (await helpersContract.getAllATokens()).find(
|
||||
(aToken) => aToken.symbol === "aDAI"
|
||||
)?.tokenAddress;
|
||||
if (!aDAIAddress) {
|
||||
console.log(`atoken-modifiers.spec: aDAI not correctly initialized`);
|
||||
process.exit(1);
|
||||
}
|
||||
_aDAI = await getAToken(aDAIAddress);
|
||||
});
|
||||
|
||||
it("Tries to invoke mintOnDeposit not being the LendingPool", async () => {
|
||||
const {deployer} = testEnv;
|
||||
await expect(_aDAI.mintOnDeposit(deployer.address, "1")).to.be.revertedWith(
|
||||
const {deployer, aDai} = testEnv;
|
||||
await expect(aDai.mintOnDeposit(deployer.address, "1")).to.be.revertedWith(
|
||||
NOT_LENDING_POOL_MSG
|
||||
);
|
||||
});
|
||||
|
||||
it("Tries to invoke burnOnLiquidation not being the LendingPool", async () => {
|
||||
const {deployer} = testEnv;
|
||||
const {deployer, aDai} = testEnv;
|
||||
await expect(
|
||||
_aDAI.burnOnLiquidation(deployer.address, "1")
|
||||
aDai.burnOnLiquidation(deployer.address, "1")
|
||||
).to.be.revertedWith(NOT_LENDING_POOL_MSG);
|
||||
});
|
||||
|
||||
it("Tries to invoke transferOnLiquidation not being the LendingPool", async () => {
|
||||
const {deployer, users} = testEnv;
|
||||
const {deployer, users, aDai} = testEnv;
|
||||
await expect(
|
||||
_aDAI.transferOnLiquidation(deployer.address, users[0].address, "1")
|
||||
aDai.transferOnLiquidation(deployer.address, users[0].address, "1")
|
||||
).to.be.revertedWith(NOT_LENDING_POOL_MSG);
|
||||
});
|
||||
});
|
||||
|
|
|
@ -13,32 +13,32 @@ import {makeSuite, TestEnv} from "./helpers/make-suite";
|
|||
|
||||
makeSuite("AToken: Transfer", (testEnv: TestEnv) => {
|
||||
it("User 0 deposits 1000 DAI, transfers to user 1", async () => {
|
||||
const {users, pool, core, _dai, _aDai} = testEnv;
|
||||
const {users, pool, core, dai, aDai} = testEnv;
|
||||
|
||||
await _dai
|
||||
await dai
|
||||
.connect(users[0].signer)
|
||||
.mint(await convertToCurrencyDecimals(_dai.address, "1000"));
|
||||
.mint(await convertToCurrencyDecimals(dai.address, "1000"));
|
||||
|
||||
await _dai
|
||||
await dai
|
||||
.connect(users[0].signer)
|
||||
.approve(core.address, APPROVAL_AMOUNT_LENDING_POOL_CORE);
|
||||
|
||||
//user 1 deposits 1000 DAI
|
||||
const amountDAItoDeposit = await convertToCurrencyDecimals(
|
||||
_dai.address,
|
||||
dai.address,
|
||||
"1000"
|
||||
);
|
||||
|
||||
await pool
|
||||
.connect(users[0].signer)
|
||||
.deposit(_dai.address, amountDAItoDeposit, "0");
|
||||
.deposit(dai.address, amountDAItoDeposit, "0");
|
||||
|
||||
await _aDai
|
||||
await aDai
|
||||
.connect(users[0].signer)
|
||||
.transfer(users[1].address, amountDAItoDeposit);
|
||||
|
||||
const fromBalance = await _aDai.balanceOf(users[0].address);
|
||||
const toBalance = await _aDai.balanceOf(users[1].address);
|
||||
const fromBalance = await aDai.balanceOf(users[0].address);
|
||||
const toBalance = await aDai.balanceOf(users[1].address);
|
||||
|
||||
expect(fromBalance.toString()).to.be.equal(
|
||||
"0",
|
||||
|
@ -51,19 +51,16 @@ makeSuite("AToken: Transfer", (testEnv: TestEnv) => {
|
|||
});
|
||||
|
||||
it("User 1 redirects interest to user 2, transfers 500 DAI back to user 0", async () => {
|
||||
const {users, _aDai, _dai} = testEnv;
|
||||
await _aDai
|
||||
const {users, aDai, dai} = testEnv;
|
||||
await aDai
|
||||
.connect(users[1].signer)
|
||||
.redirectInterestStream(users[2].address);
|
||||
|
||||
const aDAIRedirected = await convertToCurrencyDecimals(
|
||||
_dai.address,
|
||||
"1000"
|
||||
);
|
||||
const aDAIRedirected = await convertToCurrencyDecimals(dai.address, "1000");
|
||||
|
||||
const aDAItoTransfer = await convertToCurrencyDecimals(_dai.address, "500");
|
||||
const aDAItoTransfer = await convertToCurrencyDecimals(dai.address, "500");
|
||||
|
||||
const user2RedirectedBalanceBefore = await _aDai.getRedirectedBalance(
|
||||
const user2RedirectedBalanceBefore = await aDai.getRedirectedBalance(
|
||||
users[2].address
|
||||
);
|
||||
expect(user2RedirectedBalanceBefore.toString()).to.be.equal(
|
||||
|
@ -71,14 +68,14 @@ makeSuite("AToken: Transfer", (testEnv: TestEnv) => {
|
|||
"Invalid redirected balance for user 2 before transfer"
|
||||
);
|
||||
|
||||
await _aDai
|
||||
await aDai
|
||||
.connect(users[1].signer)
|
||||
.transfer(users[0].address, aDAItoTransfer);
|
||||
|
||||
const user2RedirectedBalanceAfter = await _aDai.getRedirectedBalance(
|
||||
const user2RedirectedBalanceAfter = await aDai.getRedirectedBalance(
|
||||
users[2].address
|
||||
);
|
||||
const user1RedirectionAddress = await _aDai.getInterestRedirectionAddress(
|
||||
const user1RedirectionAddress = await aDai.getInterestRedirectionAddress(
|
||||
users[1].address
|
||||
);
|
||||
|
||||
|
@ -93,18 +90,18 @@ makeSuite("AToken: Transfer", (testEnv: TestEnv) => {
|
|||
});
|
||||
|
||||
it("User 0 transfers back to user 1", async () => {
|
||||
const {users, _aDai, _dai} = testEnv;
|
||||
const aDAItoTransfer = await convertToCurrencyDecimals(_dai.address, "500");
|
||||
const {users, aDai, dai} = testEnv;
|
||||
const aDAItoTransfer = await convertToCurrencyDecimals(dai.address, "500");
|
||||
|
||||
await _aDai
|
||||
await aDai
|
||||
.connect(users[0].signer)
|
||||
.transfer(users[1].address, aDAItoTransfer);
|
||||
|
||||
const user2RedirectedBalanceAfter = await _aDai.getRedirectedBalance(
|
||||
const user2RedirectedBalanceAfter = await aDai.getRedirectedBalance(
|
||||
users[2].address
|
||||
);
|
||||
|
||||
const user1BalanceAfter = await _aDai.balanceOf(users[1].address);
|
||||
const user1BalanceAfter = await aDai.balanceOf(users[1].address);
|
||||
|
||||
expect(user2RedirectedBalanceAfter.toString()).to.be.equal(
|
||||
user1BalanceAfter.toString(),
|
||||
|
@ -134,15 +131,12 @@ makeSuite("AToken: Transfer", (testEnv: TestEnv) => {
|
|||
});
|
||||
|
||||
it("User 1 sets the DAI as collateral and borrows, tries to transfer everything back to user 0 (revert expected)", async () => {
|
||||
const {users, pool, _aDai, _dai} = testEnv;
|
||||
const {users, pool, aDai, dai} = testEnv;
|
||||
await pool
|
||||
.connect(users[1].signer)
|
||||
.setUserUseReserveAsCollateral(_dai.address, true);
|
||||
.setUserUseReserveAsCollateral(dai.address, true);
|
||||
|
||||
const aDAItoTransfer = await convertToCurrencyDecimals(
|
||||
_dai.address,
|
||||
"1000"
|
||||
);
|
||||
const aDAItoTransfer = await convertToCurrencyDecimals(dai.address, "1000");
|
||||
|
||||
await pool
|
||||
.connect(users[1].signer)
|
||||
|
@ -154,21 +148,21 @@ makeSuite("AToken: Transfer", (testEnv: TestEnv) => {
|
|||
);
|
||||
|
||||
await expect(
|
||||
_aDai.connect(users[1].signer).transfer(users[0].address, aDAItoTransfer),
|
||||
aDai.connect(users[1].signer).transfer(users[0].address, aDAItoTransfer),
|
||||
"Transfer cannot be allowed."
|
||||
).to.be.revertedWith("Transfer cannot be allowed.");
|
||||
});
|
||||
|
||||
it("User 0 tries to transfer 0 balance (revert expected)", async () => {
|
||||
const {users, pool, _aDai, _dai} = testEnv;
|
||||
const {users, pool, aDai, dai} = testEnv;
|
||||
await expect(
|
||||
_aDai.connect(users[0].signer).transfer(users[1].address, "0"),
|
||||
aDai.connect(users[0].signer).transfer(users[1].address, "0"),
|
||||
"Transferred amount needs to be greater than zero"
|
||||
).to.be.revertedWith("Transferred amount needs to be greater than zero");
|
||||
});
|
||||
|
||||
it("User 1 repays the borrow, transfers aDAI back to user 0", async () => {
|
||||
const {users, pool, _aDai, _dai} = testEnv;
|
||||
const {users, pool, aDai, dai} = testEnv;
|
||||
await pool
|
||||
.connect(users[1].signer)
|
||||
.repay(MOCK_ETH_ADDRESS, MAX_UINT_AMOUNT, users[1].address, {
|
||||
|
@ -176,19 +170,19 @@ makeSuite("AToken: Transfer", (testEnv: TestEnv) => {
|
|||
});
|
||||
|
||||
const aDAItoTransfer = await convertToCurrencyDecimals(
|
||||
_aDai.address,
|
||||
aDai.address,
|
||||
"1000"
|
||||
);
|
||||
|
||||
await _aDai
|
||||
await aDai
|
||||
.connect(users[1].signer)
|
||||
.transfer(users[0].address, aDAItoTransfer);
|
||||
|
||||
const user2RedirectedBalanceAfter = await _aDai.getRedirectedBalance(
|
||||
const user2RedirectedBalanceAfter = await aDai.getRedirectedBalance(
|
||||
users[2].address
|
||||
);
|
||||
|
||||
const user1RedirectionAddress = await _aDai.getInterestRedirectionAddress(
|
||||
const user1RedirectionAddress = await aDai.getInterestRedirectionAddress(
|
||||
users[1].address
|
||||
);
|
||||
|
||||
|
@ -204,41 +198,41 @@ makeSuite("AToken: Transfer", (testEnv: TestEnv) => {
|
|||
});
|
||||
|
||||
it("User 0 redirects interest to user 2, transfers 500 aDAI to user 1. User 1 redirects to user 3. User 0 transfers another 100 aDAI", async () => {
|
||||
const {users, pool, _aDai, _dai} = testEnv;
|
||||
const {users, pool, aDai, dai} = testEnv;
|
||||
|
||||
let aDAItoTransfer = await convertToCurrencyDecimals(_aDai.address, "500");
|
||||
let aDAItoTransfer = await convertToCurrencyDecimals(aDai.address, "500");
|
||||
|
||||
await _aDai
|
||||
await aDai
|
||||
.connect(users[0].signer)
|
||||
.redirectInterestStream(users[2].address);
|
||||
|
||||
await _aDai
|
||||
await aDai
|
||||
.connect(users[0].signer)
|
||||
.transfer(users[1].address, aDAItoTransfer);
|
||||
|
||||
await _aDai
|
||||
await aDai
|
||||
.connect(users[1].signer)
|
||||
.redirectInterestStream(users[3].address);
|
||||
|
||||
aDAItoTransfer = await convertToCurrencyDecimals(_aDai.address, "100");
|
||||
aDAItoTransfer = await convertToCurrencyDecimals(aDai.address, "100");
|
||||
|
||||
await _aDai
|
||||
await aDai
|
||||
.connect(users[0].signer)
|
||||
.transfer(users[1].address, aDAItoTransfer);
|
||||
|
||||
const user2RedirectedBalanceAfter = await _aDai.getRedirectedBalance(
|
||||
const user2RedirectedBalanceAfter = await aDai.getRedirectedBalance(
|
||||
users[2].address
|
||||
);
|
||||
const user3RedirectedBalanceAfter = await _aDai.getRedirectedBalance(
|
||||
const user3RedirectedBalanceAfter = await aDai.getRedirectedBalance(
|
||||
users[3].address
|
||||
);
|
||||
|
||||
const expectedUser2Redirected = await convertToCurrencyDecimals(
|
||||
_aDai.address,
|
||||
aDai.address,
|
||||
"400"
|
||||
);
|
||||
const expectedUser3Redirected = await convertToCurrencyDecimals(
|
||||
_aDai.address,
|
||||
aDai.address,
|
||||
"600"
|
||||
);
|
||||
|
||||
|
|
|
@ -1,314 +1,311 @@
|
|||
// import {ITestEnvWithoutInstances} from '../utils/types';
|
||||
// import {
|
||||
// LendingPoolCoreInstance,
|
||||
// LendingPoolConfiguratorInstance,
|
||||
// LendingPoolInstance,
|
||||
// } from '../utils/typechain-types/truffle-contracts';
|
||||
// import {testEnvProviderWithoutInstances} from '../utils/truffle/dlp-tests-env';
|
||||
// import {RAY, ETHEREUM_ADDRESS, APPROVAL_AMOUNT_LENDING_POOL_CORE} from '../utils/constants';
|
||||
// import {convertToCurrencyDecimals} from '../utils/misc-utils';
|
||||
import {TestEnv, makeSuite} from "./helpers/make-suite";
|
||||
import {
|
||||
MOCK_ETH_ADDRESS,
|
||||
RAY,
|
||||
APPROVAL_AMOUNT_LENDING_POOL_CORE,
|
||||
} from "../helpers/constants";
|
||||
import {convertToCurrencyDecimals} from "../helpers/contracts-helpers";
|
||||
|
||||
// const expectRevert = require('@openzeppelin/test-helpers').expectRevert;
|
||||
// const {expect} = require('chai');
|
||||
const {expect} = require("chai");
|
||||
|
||||
// contract('LendingPoolConfigurator', async ([deployer, ...users]) => {
|
||||
// let _testEnvProvider: ITestEnvWithoutInstances;
|
||||
// let _lendingPoolConfiguratorInstance: LendingPoolConfiguratorInstance;
|
||||
// let _lendingPoolCoreInstance: LendingPoolCoreInstance;
|
||||
// let _lendingPoolInstance: LendingPoolInstance;
|
||||
makeSuite("AToken: Transfer", (testEnv: TestEnv) => {
|
||||
it("Deactivates the ETH reserve", async () => {
|
||||
const {configurator, core} = testEnv;
|
||||
await configurator.deactivateReserve(MOCK_ETH_ADDRESS);
|
||||
const isActive = await core.getReserveIsActive(MOCK_ETH_ADDRESS);
|
||||
expect(isActive).to.be.equal(false);
|
||||
});
|
||||
|
||||
// before('Initializing LendingPoolConfigurator test variables', async () => {
|
||||
// console.time('setup-test');
|
||||
// _testEnvProvider = await testEnvProviderWithoutInstances(artifacts, [deployer, ...users]);
|
||||
it("Rectivates the ETH reserve", async () => {
|
||||
const {configurator, core} = testEnv;
|
||||
await configurator.activateReserve(MOCK_ETH_ADDRESS);
|
||||
|
||||
// const {
|
||||
// getLendingPoolInstance,
|
||||
// getLendingPoolCoreInstance,
|
||||
// getLendingPoolConfiguratorInstance,
|
||||
// } = _testEnvProvider;
|
||||
// const instances = await Promise.all([
|
||||
// getLendingPoolConfiguratorInstance(),
|
||||
// getLendingPoolCoreInstance(),
|
||||
// getLendingPoolInstance(),
|
||||
// ]);
|
||||
// _lendingPoolConfiguratorInstance = instances[0];
|
||||
// _lendingPoolCoreInstance = instances[1];
|
||||
// _lendingPoolInstance = instances[2];
|
||||
const isActive = await core.getReserveIsActive(MOCK_ETH_ADDRESS);
|
||||
expect(isActive).to.be.equal(true);
|
||||
});
|
||||
|
||||
// console.timeEnd('setup-test');
|
||||
// });
|
||||
it("Check the onlyLendingPoolManager on deactivateReserve ", async () => {
|
||||
const {configurator, users} = testEnv;
|
||||
await expect(
|
||||
configurator.connect(users[2].signer).deactivateReserve(MOCK_ETH_ADDRESS),
|
||||
"The caller must be a lending pool manager"
|
||||
).to.be.revertedWith("The caller must be a lending pool manager");
|
||||
});
|
||||
|
||||
// it('Deactivates the ETH reserve', async () => {
|
||||
// await _lendingPoolConfiguratorInstance.deactivateReserve(ETHEREUM_ADDRESS);
|
||||
// const isActive = await _lendingPoolCoreInstance.getReserveIsActive(ETHEREUM_ADDRESS);
|
||||
// expect(isActive).to.be.equal(false);
|
||||
// });
|
||||
it("Check the onlyLendingPoolManager on activateReserve ", async () => {
|
||||
const {configurator, users} = testEnv;
|
||||
await expect(
|
||||
configurator.connect(users[2].signer).activateReserve(MOCK_ETH_ADDRESS),
|
||||
"The caller must be a lending pool manager"
|
||||
).to.be.revertedWith("The caller must be a lending pool manager");
|
||||
});
|
||||
|
||||
// it('Rectivates the ETH reserve', async () => {
|
||||
// await _lendingPoolConfiguratorInstance.activateReserve(ETHEREUM_ADDRESS);
|
||||
it("Freezes the ETH reserve", async () => {
|
||||
const {configurator, core} = testEnv;
|
||||
await configurator.freezeReserve(MOCK_ETH_ADDRESS);
|
||||
const isFreezed = await core.getReserveIsFreezed(MOCK_ETH_ADDRESS);
|
||||
expect(isFreezed).to.be.equal(true);
|
||||
});
|
||||
|
||||
// const isActive = await _lendingPoolCoreInstance.getReserveIsActive(ETHEREUM_ADDRESS);
|
||||
// expect(isActive).to.be.equal(true);
|
||||
// });
|
||||
it("Unfreezes the ETH reserve", async () => {
|
||||
const {configurator, core} = testEnv;
|
||||
await configurator.unfreezeReserve(MOCK_ETH_ADDRESS);
|
||||
|
||||
// it('Check the onlyLendingPoolManager on deactivateReserve ', async () => {
|
||||
// await expectRevert(
|
||||
// _lendingPoolConfiguratorInstance.deactivateReserve(ETHEREUM_ADDRESS, {from: users[2]}),
|
||||
// 'The caller must be a lending pool manager'
|
||||
// );
|
||||
// });
|
||||
const isFreezed = await core.getReserveIsFreezed(MOCK_ETH_ADDRESS);
|
||||
expect(isFreezed).to.be.equal(false);
|
||||
});
|
||||
|
||||
// it('Check the onlyLendingPoolManager on activateReserve ', async () => {
|
||||
// await expectRevert(
|
||||
// _lendingPoolConfiguratorInstance.activateReserve(ETHEREUM_ADDRESS, {from: users[2]}),
|
||||
// 'The caller must be a lending pool manager'
|
||||
// );
|
||||
// });
|
||||
it("Check the onlyLendingPoolManager on freezeReserve ", async () => {
|
||||
const {configurator, users} = testEnv;
|
||||
await expect(
|
||||
configurator.connect(users[2].signer).freezeReserve(MOCK_ETH_ADDRESS),
|
||||
"The caller must be a lending pool manager"
|
||||
).to.be.revertedWith("The caller must be a lending pool manager");
|
||||
});
|
||||
|
||||
// it('Freezes the ETH reserve', async () => {
|
||||
// await _lendingPoolConfiguratorInstance.freezeReserve(ETHEREUM_ADDRESS);
|
||||
// const isFreezed = await _lendingPoolCoreInstance.getReserveIsFreezed(ETHEREUM_ADDRESS);
|
||||
// expect(isFreezed).to.be.equal(true);
|
||||
// });
|
||||
it("Check the onlyLendingPoolManager on unfreezeReserve ", async () => {
|
||||
const {configurator, users} = testEnv;
|
||||
await expect(
|
||||
configurator.connect(users[2].signer).unfreezeReserve(MOCK_ETH_ADDRESS),
|
||||
"The caller must be a lending pool manager"
|
||||
).to.be.revertedWith("The caller must be a lending pool manager");
|
||||
});
|
||||
|
||||
// it('Unfreezes the ETH reserve', async () => {
|
||||
// await _lendingPoolConfiguratorInstance.unfreezeReserve(ETHEREUM_ADDRESS);
|
||||
it("Deactivates the ETH reserve for borrowing", async () => {
|
||||
const {configurator, core} = testEnv;
|
||||
await configurator.disableBorrowingOnReserve(MOCK_ETH_ADDRESS);
|
||||
const isEnabled = await core.isReserveBorrowingEnabled(MOCK_ETH_ADDRESS);
|
||||
expect(isEnabled).to.be.equal(false);
|
||||
});
|
||||
|
||||
// const isFreezed = await _lendingPoolCoreInstance.getReserveIsFreezed(ETHEREUM_ADDRESS);
|
||||
// expect(isFreezed).to.be.equal(false);
|
||||
// });
|
||||
it("Activates the ETH reserve for borrowing", async () => {
|
||||
const {configurator, core} = testEnv;
|
||||
await configurator.enableBorrowingOnReserve(MOCK_ETH_ADDRESS, true);
|
||||
const isEnabled = await core.isReserveBorrowingEnabled(MOCK_ETH_ADDRESS);
|
||||
const interestIndex = await core.getReserveLiquidityCumulativeIndex(
|
||||
MOCK_ETH_ADDRESS
|
||||
);
|
||||
expect(isEnabled).to.be.equal(true);
|
||||
expect(interestIndex.toString()).to.be.equal(RAY);
|
||||
});
|
||||
|
||||
// it('Check the onlyLendingPoolManager on freezeReserve ', async () => {
|
||||
// await expectRevert(
|
||||
// _lendingPoolConfiguratorInstance.freezeReserve(ETHEREUM_ADDRESS, {from: users[2]}),
|
||||
// 'The caller must be a lending pool manager'
|
||||
// );
|
||||
// });
|
||||
it("Check the onlyLendingPoolManager on disableBorrowingOnReserve ", async () => {
|
||||
const {configurator, users} = testEnv;
|
||||
await expect(
|
||||
configurator
|
||||
.connect(users[2].signer)
|
||||
.disableBorrowingOnReserve(MOCK_ETH_ADDRESS),
|
||||
"The caller must be a lending pool manager"
|
||||
).to.be.revertedWith("The caller must be a lending pool manager");
|
||||
});
|
||||
|
||||
// it('Check the onlyLendingPoolManager on unfreezeReserve ', async () => {
|
||||
// await expectRevert(
|
||||
// _lendingPoolConfiguratorInstance.unfreezeReserve(ETHEREUM_ADDRESS, {from: users[2]}),
|
||||
// 'The caller must be a lending pool manager'
|
||||
// );
|
||||
// });
|
||||
it("Check the onlyLendingPoolManager on enableBorrowingOnReserve ", async () => {
|
||||
const {configurator, users} = testEnv;
|
||||
await expect(
|
||||
configurator
|
||||
.connect(users[2].signer)
|
||||
.enableBorrowingOnReserve(MOCK_ETH_ADDRESS, true),
|
||||
"The caller must be a lending pool manager"
|
||||
).to.be.revertedWith("The caller must be a lending pool manager");
|
||||
});
|
||||
|
||||
// it('Deactivates the ETH reserve for borrowing', async () => {
|
||||
// await _lendingPoolConfiguratorInstance.disableBorrowingOnReserve(ETHEREUM_ADDRESS);
|
||||
// const isEnabled = await _lendingPoolCoreInstance.isReserveBorrowingEnabled(ETHEREUM_ADDRESS);
|
||||
// expect(isEnabled).to.be.equal(false);
|
||||
// });
|
||||
it("Deactivates the ETH reserve as collateral", async () => {
|
||||
const {configurator, core} = testEnv;
|
||||
await configurator.disableReserveAsCollateral(MOCK_ETH_ADDRESS);
|
||||
const isEnabled = await core.isReserveUsageAsCollateralEnabled(
|
||||
MOCK_ETH_ADDRESS
|
||||
);
|
||||
expect(isEnabled).to.be.equal(false);
|
||||
});
|
||||
|
||||
// it('Activates the ETH reserve for borrowing', async () => {
|
||||
// await _lendingPoolConfiguratorInstance.enableBorrowingOnReserve(ETHEREUM_ADDRESS, true);
|
||||
// const isEnabled = await _lendingPoolCoreInstance.isReserveBorrowingEnabled(ETHEREUM_ADDRESS);
|
||||
// const interestIndex = await _lendingPoolCoreInstance.getReserveLiquidityCumulativeIndex(
|
||||
// ETHEREUM_ADDRESS
|
||||
// );
|
||||
// expect(isEnabled).to.be.equal(true);
|
||||
// expect(interestIndex.toString()).to.be.equal(RAY);
|
||||
// });
|
||||
it("Activates the ETH reserve as collateral", async () => {
|
||||
const {configurator, core} = testEnv;
|
||||
await configurator.enableReserveAsCollateral(
|
||||
MOCK_ETH_ADDRESS,
|
||||
"75",
|
||||
"80",
|
||||
"105"
|
||||
);
|
||||
|
||||
// it('Check the onlyLendingPoolManager on disableBorrowingOnReserve ', async () => {
|
||||
// await expectRevert(
|
||||
// _lendingPoolConfiguratorInstance.disableBorrowingOnReserve(ETHEREUM_ADDRESS, {
|
||||
// from: users[2],
|
||||
// }),
|
||||
// 'The caller must be a lending pool manager'
|
||||
// );
|
||||
// });
|
||||
const isEnabled = await core.isReserveUsageAsCollateralEnabled(
|
||||
MOCK_ETH_ADDRESS
|
||||
);
|
||||
expect(isEnabled).to.be.equal(true);
|
||||
});
|
||||
|
||||
// it('Check the onlyLendingPoolManager on enableBorrowingOnReserve ', async () => {
|
||||
// await expectRevert(
|
||||
// _lendingPoolConfiguratorInstance.enableBorrowingOnReserve(ETHEREUM_ADDRESS, true, {
|
||||
// from: users[2],
|
||||
// }),
|
||||
// 'The caller must be a lending pool manager'
|
||||
// );
|
||||
// });
|
||||
it("Check the onlyLendingPoolManager on disableReserveAsCollateral ", async () => {
|
||||
const {configurator, users} = testEnv;
|
||||
await expect(
|
||||
configurator
|
||||
.connect(users[2].signer)
|
||||
.disableReserveAsCollateral(MOCK_ETH_ADDRESS),
|
||||
"The caller must be a lending pool manager"
|
||||
).to.be.revertedWith("The caller must be a lending pool manager");
|
||||
});
|
||||
|
||||
// it('Deactivates the ETH reserve as collateral', async () => {
|
||||
// await _lendingPoolConfiguratorInstance.disableReserveAsCollateral(ETHEREUM_ADDRESS);
|
||||
// const isEnabled = await _lendingPoolCoreInstance.isReserveUsageAsCollateralEnabled(
|
||||
// ETHEREUM_ADDRESS
|
||||
// );
|
||||
// expect(isEnabled).to.be.equal(false);
|
||||
// });
|
||||
it("Check the onlyLendingPoolManager on enableReserveAsCollateral ", async () => {
|
||||
const {configurator, users} = testEnv;
|
||||
await expect(
|
||||
configurator
|
||||
.connect(users[2].signer)
|
||||
.enableReserveAsCollateral(MOCK_ETH_ADDRESS, "75", "80", "105"),
|
||||
"The caller must be a lending pool manager"
|
||||
).to.be.revertedWith("The caller must be a lending pool manager");
|
||||
});
|
||||
|
||||
// it('Activates the ETH reserve as collateral', async () => {
|
||||
// await _lendingPoolConfiguratorInstance.enableReserveAsCollateral(
|
||||
// ETHEREUM_ADDRESS,
|
||||
// '75',
|
||||
// '80',
|
||||
// '105'
|
||||
// );
|
||||
it("Disable stable borrow rate on the ETH reserve", async () => {
|
||||
const {configurator, core} = testEnv;
|
||||
await configurator.disableReserveStableBorrowRate(MOCK_ETH_ADDRESS);
|
||||
const isEnabled = await core.getReserveIsStableBorrowRateEnabled(
|
||||
MOCK_ETH_ADDRESS
|
||||
);
|
||||
expect(isEnabled).to.be.equal(false);
|
||||
});
|
||||
|
||||
// const isEnabled = await _lendingPoolCoreInstance.isReserveUsageAsCollateralEnabled(
|
||||
// ETHEREUM_ADDRESS
|
||||
// );
|
||||
// expect(isEnabled).to.be.equal(true);
|
||||
// });
|
||||
it("Enables stable borrow rate on the ETH reserve", async () => {
|
||||
const {configurator, core} = testEnv;
|
||||
await configurator.enableReserveStableBorrowRate(MOCK_ETH_ADDRESS);
|
||||
const isEnabled = await core.getReserveIsStableBorrowRateEnabled(
|
||||
MOCK_ETH_ADDRESS
|
||||
);
|
||||
expect(isEnabled).to.be.equal(true);
|
||||
});
|
||||
|
||||
// it('Check the onlyLendingPoolManager on disableReserveAsCollateral ', async () => {
|
||||
// await expectRevert(
|
||||
// _lendingPoolConfiguratorInstance.disableReserveAsCollateral(ETHEREUM_ADDRESS, {
|
||||
// from: users[2],
|
||||
// }),
|
||||
// 'The caller must be a lending pool manager'
|
||||
// );
|
||||
// });
|
||||
it("Check the onlyLendingPoolManager on disableReserveStableBorrowRate", async () => {
|
||||
const {configurator, users} = testEnv;
|
||||
await expect(
|
||||
configurator
|
||||
.connect(users[2].signer)
|
||||
.disableReserveStableBorrowRate(MOCK_ETH_ADDRESS),
|
||||
"The caller must be a lending pool manager"
|
||||
).to.be.revertedWith("The caller must be a lending pool manager");
|
||||
});
|
||||
|
||||
// it('Check the onlyLendingPoolManager on enableReserveAsCollateral ', async () => {
|
||||
// await expectRevert(
|
||||
// _lendingPoolConfiguratorInstance.enableReserveAsCollateral(
|
||||
// ETHEREUM_ADDRESS,
|
||||
// '75',
|
||||
// '80',
|
||||
// '105',
|
||||
// {from: users[2]}
|
||||
// ),
|
||||
// 'The caller must be a lending pool manager'
|
||||
// );
|
||||
// });
|
||||
it("Check the onlyLendingPoolManager on enableReserveStableBorrowRate", async () => {
|
||||
const {configurator, users} = testEnv;
|
||||
await expect(
|
||||
configurator
|
||||
.connect(users[2].signer)
|
||||
.enableReserveStableBorrowRate(MOCK_ETH_ADDRESS),
|
||||
"The caller must be a lending pool manager"
|
||||
).to.be.revertedWith("The caller must be a lending pool manager");
|
||||
});
|
||||
|
||||
// it('Disable stable borrow rate on the ETH reserve', async () => {
|
||||
// await _lendingPoolConfiguratorInstance.disableReserveStableBorrowRate(ETHEREUM_ADDRESS);
|
||||
// const isEnabled = await _lendingPoolCoreInstance.getReserveIsStableBorrowRateEnabled(
|
||||
// ETHEREUM_ADDRESS
|
||||
// );
|
||||
// expect(isEnabled).to.be.equal(false);
|
||||
// });
|
||||
it("Changes LTV of the reserve", async () => {
|
||||
const {configurator, pool} = testEnv;
|
||||
await configurator.setReserveBaseLTVasCollateral(MOCK_ETH_ADDRESS, "60");
|
||||
const {ltv}: any = await pool.getReserveConfigurationData(MOCK_ETH_ADDRESS);
|
||||
expect(ltv).to.be.bignumber.equal("60", "Invalid LTV");
|
||||
});
|
||||
|
||||
// it('Enables stable borrow rate on the ETH reserve', async () => {
|
||||
// await _lendingPoolConfiguratorInstance.enableReserveStableBorrowRate(ETHEREUM_ADDRESS);
|
||||
// const isEnabled = await _lendingPoolCoreInstance.getReserveIsStableBorrowRateEnabled(
|
||||
// ETHEREUM_ADDRESS
|
||||
// );
|
||||
// expect(isEnabled).to.be.equal(true);
|
||||
// });
|
||||
it("Check the onlyLendingPoolManager on setReserveBaseLTVasCollateral", async () => {
|
||||
const {configurator, users} = testEnv;
|
||||
await expect(
|
||||
configurator
|
||||
.connect(users[2].signer)
|
||||
.setReserveBaseLTVasCollateral(MOCK_ETH_ADDRESS, "75"),
|
||||
"The caller must be a lending pool manager"
|
||||
).to.be.revertedWith("The caller must be a lending pool manager");
|
||||
});
|
||||
|
||||
// it('Check the onlyLendingPoolManager on disableReserveStableBorrowRate', async () => {
|
||||
// await expectRevert(
|
||||
// _lendingPoolConfiguratorInstance.disableReserveStableBorrowRate(ETHEREUM_ADDRESS, {
|
||||
// from: users[2],
|
||||
// }),
|
||||
// 'The caller must be a lending pool manager'
|
||||
// );
|
||||
// });
|
||||
it("Changes liquidation threshold of the reserve", async () => {
|
||||
const {configurator, pool} = testEnv;
|
||||
await configurator.setReserveLiquidationThreshold(MOCK_ETH_ADDRESS, "75");
|
||||
const {liquidationThreshold}: any = await pool.getReserveConfigurationData(
|
||||
MOCK_ETH_ADDRESS
|
||||
);
|
||||
expect(liquidationThreshold).to.be.bignumber.equal(
|
||||
"75",
|
||||
"Invalid Liquidation threshold"
|
||||
);
|
||||
});
|
||||
|
||||
// it('Check the onlyLendingPoolManager on enableReserveStableBorrowRate', async () => {
|
||||
// await expectRevert(
|
||||
// _lendingPoolConfiguratorInstance.enableReserveStableBorrowRate(ETHEREUM_ADDRESS, {
|
||||
// from: users[2],
|
||||
// }),
|
||||
// 'The caller must be a lending pool manager'
|
||||
// );
|
||||
// });
|
||||
it("Check the onlyLendingPoolManager on setReserveLiquidationThreshold", async () => {
|
||||
const {configurator, users} = testEnv;
|
||||
await expect(
|
||||
configurator
|
||||
.connect(users[2].signer)
|
||||
.setReserveLiquidationThreshold(MOCK_ETH_ADDRESS, "80"),
|
||||
"The caller must be a lending pool manager"
|
||||
).to.be.revertedWith("The caller must be a lending pool manager");
|
||||
});
|
||||
|
||||
// it('Changes LTV of the reserve', async () => {
|
||||
// await _lendingPoolConfiguratorInstance.setReserveBaseLTVasCollateral(ETHEREUM_ADDRESS, '60');
|
||||
// const {ltv}: any = await _lendingPoolInstance.getReserveConfigurationData(ETHEREUM_ADDRESS);
|
||||
// expect(ltv).to.be.bignumber.equal('60', 'Invalid LTV');
|
||||
// });
|
||||
it("Changes liquidation bonus of the reserve", async () => {
|
||||
const {configurator, core} = testEnv;
|
||||
await configurator.setReserveLiquidationBonus(MOCK_ETH_ADDRESS, "110");
|
||||
const liquidationBonus = await core.getReserveLiquidationBonus(
|
||||
MOCK_ETH_ADDRESS
|
||||
);
|
||||
expect(liquidationBonus).to.be.bignumber.equal(
|
||||
"110",
|
||||
"Invalid Liquidation discount"
|
||||
);
|
||||
});
|
||||
|
||||
// it('Check the onlyLendingPoolManager on setReserveBaseLTVasCollateral', async () => {
|
||||
// await expectRevert(
|
||||
// _lendingPoolConfiguratorInstance.setReserveBaseLTVasCollateral(ETHEREUM_ADDRESS, '75', {
|
||||
// from: users[2],
|
||||
// }),
|
||||
// 'The caller must be a lending pool manager'
|
||||
// );
|
||||
// });
|
||||
it("Check the onlyLendingPoolManager on setReserveLiquidationBonus", async () => {
|
||||
const {configurator, users} = testEnv;
|
||||
await expect(
|
||||
configurator
|
||||
.connect(users[2].signer)
|
||||
.setReserveLiquidationBonus(MOCK_ETH_ADDRESS, "80"),
|
||||
"The caller must be a lending pool manager"
|
||||
).to.be.revertedWith("The caller must be a lending pool manager");
|
||||
});
|
||||
|
||||
// it('Changes liquidation threshold of the reserve', async () => {
|
||||
// await _lendingPoolConfiguratorInstance.setReserveLiquidationThreshold(ETHEREUM_ADDRESS, '75');
|
||||
// const {liquidationThreshold}: any = await _lendingPoolInstance.getReserveConfigurationData(
|
||||
// ETHEREUM_ADDRESS
|
||||
// );
|
||||
// expect(liquidationThreshold).to.be.bignumber.equal('75', 'Invalid Liquidation threshold');
|
||||
// });
|
||||
it("Check the onlyLendingPoolManager on setReserveDecimals", async () => {
|
||||
const {configurator, users} = testEnv;
|
||||
await expect(
|
||||
configurator
|
||||
.connect(users[2].signer)
|
||||
.setReserveDecimals(MOCK_ETH_ADDRESS, "80"),
|
||||
"The caller must be a lending pool manager"
|
||||
).to.be.revertedWith("The caller must be a lending pool manager");
|
||||
});
|
||||
|
||||
// it('Check the onlyLendingPoolManager on setReserveLiquidationThreshold', async () => {
|
||||
// await expectRevert(
|
||||
// _lendingPoolConfiguratorInstance.setReserveLiquidationThreshold(ETHEREUM_ADDRESS, '80', {
|
||||
// from: users[2],
|
||||
// }),
|
||||
// 'The caller must be a lending pool manager'
|
||||
// );
|
||||
// });
|
||||
it("Removes the last added reserve", async () => {
|
||||
const {configurator, pool} = testEnv;
|
||||
const reservesBefore = await pool.getReserves();
|
||||
|
||||
// it('Changes liquidation bonus of the reserve', async () => {
|
||||
// await _lendingPoolConfiguratorInstance.setReserveLiquidationBonus(ETHEREUM_ADDRESS, '110');
|
||||
// const liquidationBonus = await _lendingPoolCoreInstance.getReserveLiquidationBonus(
|
||||
// ETHEREUM_ADDRESS
|
||||
// );
|
||||
// expect(liquidationBonus).to.be.bignumber.equal('110', 'Invalid Liquidation discount');
|
||||
// });
|
||||
const lastReserve = reservesBefore[reservesBefore.length - 1];
|
||||
|
||||
// it('Check the onlyLendingPoolManager on setReserveLiquidationBonus', async () => {
|
||||
// await expectRevert(
|
||||
// _lendingPoolConfiguratorInstance.setReserveLiquidationBonus(ETHEREUM_ADDRESS, '80', {
|
||||
// from: users[2],
|
||||
// }),
|
||||
// 'The caller must be a lending pool manager'
|
||||
// );
|
||||
// });
|
||||
await configurator.removeLastAddedReserve(lastReserve);
|
||||
|
||||
// it('Check the onlyLendingPoolManager on setReserveDecimals', async () => {
|
||||
// await expectRevert(
|
||||
// _lendingPoolConfiguratorInstance.setReserveDecimals(ETHEREUM_ADDRESS, '80', {from: users[2]}),
|
||||
// 'The caller must be a lending pool manager'
|
||||
// );
|
||||
// });
|
||||
const reservesAfter = await pool.getReserves();
|
||||
|
||||
// it('Removes the last added reserve', async () => {
|
||||
// const reservesBefore = await _lendingPoolInstance.getReserves();
|
||||
expect(reservesAfter.length).to.be.equal(
|
||||
reservesBefore.length - 1,
|
||||
"Invalid number of reserves after removal"
|
||||
);
|
||||
});
|
||||
|
||||
// const lastReserve = reservesBefore[reservesBefore.length - 1];
|
||||
it("Check the onlyLendingPoolManager on setReserveLiquidationBonus", async () => {
|
||||
const {configurator, users} = testEnv;
|
||||
await expect(
|
||||
configurator
|
||||
.connect(users[2].signer)
|
||||
.setReserveLiquidationBonus(MOCK_ETH_ADDRESS, "80"),
|
||||
"The caller must be a lending pool manager"
|
||||
).to.be.revertedWith("The caller must be a lending pool manager");
|
||||
});
|
||||
|
||||
// await _lendingPoolConfiguratorInstance.removeLastAddedReserve(lastReserve);
|
||||
it("Reverts when trying to disable the DAI reserve with liquidity on it", async () => {
|
||||
const {dai, core, pool, configurator} = testEnv;
|
||||
|
||||
// const reservesAfter = await _lendingPoolInstance.getReserves();
|
||||
await dai.mint(await convertToCurrencyDecimals(dai.address, "1000"));
|
||||
|
||||
// expect(reservesAfter.length).to.be.equal(
|
||||
// reservesBefore.length - 1,
|
||||
// 'Invalid number of reserves after removal'
|
||||
// );
|
||||
// });
|
||||
//approve protocol to access depositor wallet
|
||||
await dai.approve(core.address, APPROVAL_AMOUNT_LENDING_POOL_CORE);
|
||||
const amountDAItoDeposit = await convertToCurrencyDecimals(
|
||||
dai.address,
|
||||
"1000"
|
||||
);
|
||||
|
||||
// it('Check the onlyLendingPoolManager on setReserveLiquidationBonus', async () => {
|
||||
// await expectRevert(
|
||||
// _lendingPoolConfiguratorInstance.setReserveLiquidationBonus(ETHEREUM_ADDRESS, '80', {
|
||||
// from: users[2],
|
||||
// }),
|
||||
// 'The caller must be a lending pool manager'
|
||||
// );
|
||||
// });
|
||||
//user 1 deposits 1000 DAI
|
||||
await pool.deposit(dai.address, amountDAItoDeposit, "0");
|
||||
|
||||
// it('Reverts when trying to disable the DAI reserve with liquidity on it', async () => {
|
||||
// const {getAllAssetsInstances, getFirstDepositorAddressOnTests} = _testEnvProvider;
|
||||
|
||||
// const daiInstance = (await getAllAssetsInstances()).DAI;
|
||||
|
||||
// const _depositorAddress = await getFirstDepositorAddressOnTests();
|
||||
|
||||
// await daiInstance.mint(await convertToCurrencyDecimals(daiInstance.address, '1000'), {
|
||||
// from: _depositorAddress,
|
||||
// });
|
||||
|
||||
// //approve protocol to access depositor wallet
|
||||
// await daiInstance.approve(_lendingPoolCoreInstance.address, APPROVAL_AMOUNT_LENDING_POOL_CORE, {
|
||||
// from: _depositorAddress,
|
||||
// });
|
||||
// const amountDAItoDeposit = await convertToCurrencyDecimals(daiInstance.address, '1000');
|
||||
|
||||
// //user 1 deposits 1000 DAI
|
||||
// await _lendingPoolInstance.deposit(daiInstance.address, amountDAItoDeposit, '0', {
|
||||
// from: _depositorAddress,
|
||||
// });
|
||||
|
||||
// await expectRevert(
|
||||
// _lendingPoolConfiguratorInstance.deactivateReserve(daiInstance.address),
|
||||
// 'The liquidity of the reserve needs to be 0'
|
||||
// );
|
||||
// });
|
||||
// });
|
||||
await expect(
|
||||
configurator.deactivateReserve(dai.address),
|
||||
"The liquidity of the reserve needs to be 0"
|
||||
).to.be.revertedWith("The liquidity of the reserve needs to be 0");
|
||||
});
|
||||
});
|
||||
|
|
|
@ -9,6 +9,7 @@ import {
|
|||
getAaveProtocolTestHelpers,
|
||||
getAToken,
|
||||
getMintableErc20,
|
||||
getLendingPoolConfiguratorProxy,
|
||||
} from "../../helpers/contracts-helpers";
|
||||
import {tEthereumAddress} from "../../helpers/types";
|
||||
import {LendingPool} from "../../types/LendingPool";
|
||||
|
@ -17,21 +18,28 @@ import {LendingPoolAddressesProvider} from "../../types/LendingPoolAddressesProv
|
|||
import {AaveProtocolTestHelpers} from "../../types/AaveProtocolTestHelpers";
|
||||
import {MintableErc20} from "../../types/MintableErc20";
|
||||
import {AToken} from "../../types/AToken";
|
||||
import {LendingPoolConfigurator} from "../../types/LendingPoolConfigurator";
|
||||
|
||||
import chai from "chai";
|
||||
// @ts-ignore
|
||||
import bignumberChai from "chai-bignumber";
|
||||
chai.use(bignumberChai());
|
||||
|
||||
export interface SignerWithAddress {
|
||||
signer: Signer;
|
||||
address: tEthereumAddress;
|
||||
}
|
||||
export type TestEnv = {
|
||||
export interface TestEnv {
|
||||
deployer: SignerWithAddress;
|
||||
users: SignerWithAddress[];
|
||||
pool: LendingPool;
|
||||
core: LendingPoolCore;
|
||||
configurator: LendingPoolConfigurator;
|
||||
addressesProvider: LendingPoolAddressesProvider;
|
||||
helpersContract: AaveProtocolTestHelpers;
|
||||
_dai: MintableErc20;
|
||||
_aDai: AToken;
|
||||
};
|
||||
dai: MintableErc20;
|
||||
aDai: AToken;
|
||||
}
|
||||
|
||||
export function makeSuite(name: string, tests: (testEnv: TestEnv) => void) {
|
||||
describe(name, () => {
|
||||
|
@ -40,6 +48,11 @@ export function makeSuite(name: string, tests: (testEnv: TestEnv) => void) {
|
|||
users: [] as SignerWithAddress[],
|
||||
pool: {} as LendingPool,
|
||||
core: {} as LendingPoolCore,
|
||||
configurator: {} as LendingPoolConfigurator,
|
||||
addressesProvider: {} as LendingPoolAddressesProvider,
|
||||
helpersContract: {} as AaveProtocolTestHelpers,
|
||||
dai: {} as MintableErc20,
|
||||
aDai: {} as AToken,
|
||||
} as TestEnv;
|
||||
before(async () => {
|
||||
console.time("makeSuite");
|
||||
|
@ -59,6 +72,7 @@ export function makeSuite(name: string, tests: (testEnv: TestEnv) => void) {
|
|||
testEnv.deployer = deployer;
|
||||
testEnv.pool = await getLendingPool();
|
||||
testEnv.core = await getLendingPoolCore();
|
||||
testEnv.configurator = await getLendingPoolConfiguratorProxy();
|
||||
testEnv.addressesProvider = await getLendingPoolAddressesProvider();
|
||||
testEnv.helpersContract = await getAaveProtocolTestHelpers();
|
||||
const aDaiAddress = (await testEnv.helpersContract.getAllATokens()).find(
|
||||
|
@ -77,8 +91,8 @@ export function makeSuite(name: string, tests: (testEnv: TestEnv) => void) {
|
|||
process.exit(1);
|
||||
}
|
||||
|
||||
testEnv._aDai = await getAToken(aDaiAddress);
|
||||
testEnv._dai = await getMintableErc20(daiAddress);
|
||||
testEnv.aDai = await getAToken(aDaiAddress);
|
||||
testEnv.dai = await getMintableErc20(daiAddress);
|
||||
console.timeEnd("makeSuite");
|
||||
});
|
||||
tests(testEnv);
|
||||
|
|
Loading…
Reference in New Issue
Block a user