mirror of
https://github.com/Instadapp/aave-protocol-v2.git
synced 2024-07-29 21:47:30 +00:00
- Fixed typo on configurator.spec test name.
- Unified error messages for tests on types.ts. - Finished migration of core-modifiers.spec.ts.
This commit is contained in:
parent
57cc16e665
commit
99cbb5f0a4
|
@ -42,6 +42,21 @@ export enum eContractid {
|
||||||
IERC20Detailed = "IERC20Detailed",
|
IERC20Detailed = "IERC20Detailed",
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export enum ProtocolErrors {
|
||||||
|
INVALID_CONFIGURATOR_CALLER_MSG = "The caller must be a lending pool configurator contract",
|
||||||
|
INVALID_POOL_CALLER_MSG = "The caller must be a lending pool contract",
|
||||||
|
INVALID_POOL_CALLER_MSG_1 = "The caller of this function must be a lending pool",
|
||||||
|
INVALID_POOL_MANAGER_CALLER_MSG = "The caller must be a lending pool manager",
|
||||||
|
INVALID_FROM_BALANCE_AFTER_TRANSFER = "Invalid from balance after transfer",
|
||||||
|
INVALID_TO_BALANCE_AFTER_TRANSFER = "Invalid from balance after transfer",
|
||||||
|
INVALID_OWNER_REVERT_MSG = "Ownable: caller is not the owner",
|
||||||
|
INVALID_REDIRECTED_BALANCE_BEFORE_TRANSFER = "Invalid redirected balance before transfer",
|
||||||
|
INVALID_REDIRECTED_BALANCE_AFTER_TRANSFER = "Invalid redirected balance after transfer",
|
||||||
|
INVALID_REDIRECTION_ADDRESS = "Invalid redirection address",
|
||||||
|
TRANSFERRED_AMOUNT_GT_ZERO = "Transferred amount needs to be greater than zero",
|
||||||
|
ZERO_COLLATERAL = "The collateral balance is 0",
|
||||||
|
}
|
||||||
|
|
||||||
export type tEthereumAddress = string;
|
export type tEthereumAddress = string;
|
||||||
export type tStringTokenBigUnits = string; // 1 ETH, or 10e6 USDC or 10e18 DAI
|
export type tStringTokenBigUnits = string; // 1 ETH, or 10e6 USDC or 10e18 DAI
|
||||||
export type tBigNumberTokenBigUnits = BigNumber;
|
export type tBigNumberTokenBigUnits = BigNumber;
|
||||||
|
|
|
@ -1,14 +1,14 @@
|
||||||
import {expect} from "chai";
|
import {expect} from "chai";
|
||||||
import {makeSuite, TestEnv} from "./helpers/make-suite";
|
import {makeSuite, TestEnv} from "./helpers/make-suite";
|
||||||
|
import {ProtocolErrors} from "../helpers/types";
|
||||||
|
|
||||||
makeSuite("AToken: Modifiers", (testEnv: TestEnv) => {
|
makeSuite("AToken: Modifiers", (testEnv: TestEnv) => {
|
||||||
const NOT_LENDING_POOL_MSG =
|
const {INVALID_POOL_CALLER_MSG_1} = ProtocolErrors;
|
||||||
"The caller of this function must be a lending pool";
|
|
||||||
|
|
||||||
it("Tries to invoke mintOnDeposit not being the LendingPool", async () => {
|
it("Tries to invoke mintOnDeposit not being the LendingPool", async () => {
|
||||||
const {deployer, aDai} = testEnv;
|
const {deployer, aDai} = testEnv;
|
||||||
await expect(aDai.mintOnDeposit(deployer.address, "1")).to.be.revertedWith(
|
await expect(aDai.mintOnDeposit(deployer.address, "1")).to.be.revertedWith(
|
||||||
NOT_LENDING_POOL_MSG
|
INVALID_POOL_CALLER_MSG_1
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -16,13 +16,13 @@ makeSuite("AToken: Modifiers", (testEnv: TestEnv) => {
|
||||||
const {deployer, aDai} = testEnv;
|
const {deployer, aDai} = testEnv;
|
||||||
await expect(
|
await expect(
|
||||||
aDai.burnOnLiquidation(deployer.address, "1")
|
aDai.burnOnLiquidation(deployer.address, "1")
|
||||||
).to.be.revertedWith(NOT_LENDING_POOL_MSG);
|
).to.be.revertedWith(INVALID_POOL_CALLER_MSG_1);
|
||||||
});
|
});
|
||||||
|
|
||||||
it("Tries to invoke transferOnLiquidation not being the LendingPool", async () => {
|
it("Tries to invoke transferOnLiquidation not being the LendingPool", async () => {
|
||||||
const {deployer, users, aDai} = testEnv;
|
const {deployer, users, aDai} = testEnv;
|
||||||
await expect(
|
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);
|
).to.be.revertedWith(INVALID_POOL_CALLER_MSG_1);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
|
@ -8,10 +8,20 @@ import {
|
||||||
import {convertToCurrencyDecimals} from "../helpers/contracts-helpers";
|
import {convertToCurrencyDecimals} from "../helpers/contracts-helpers";
|
||||||
import {expect} from "chai";
|
import {expect} from "chai";
|
||||||
import {ethers} from "ethers";
|
import {ethers} from "ethers";
|
||||||
import {RateMode} from "../helpers/types";
|
import {RateMode, ProtocolErrors} from "../helpers/types";
|
||||||
import {makeSuite, TestEnv} from "./helpers/make-suite";
|
import {makeSuite, TestEnv} from "./helpers/make-suite";
|
||||||
|
|
||||||
makeSuite("AToken: Transfer", (testEnv: TestEnv) => {
|
makeSuite("AToken: Transfer", (testEnv: TestEnv) => {
|
||||||
|
const {
|
||||||
|
INVALID_FROM_BALANCE_AFTER_TRANSFER,
|
||||||
|
INVALID_TO_BALANCE_AFTER_TRANSFER,
|
||||||
|
INVALID_REDIRECTED_BALANCE_BEFORE_TRANSFER,
|
||||||
|
INVALID_REDIRECTED_BALANCE_AFTER_TRANSFER,
|
||||||
|
INVALID_REDIRECTION_ADDRESS,
|
||||||
|
ZERO_COLLATERAL,
|
||||||
|
TRANSFERRED_AMOUNT_GT_ZERO,
|
||||||
|
} = ProtocolErrors;
|
||||||
|
|
||||||
it("User 0 deposits 1000 DAI, transfers to user 1", async () => {
|
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;
|
||||||
|
|
||||||
|
@ -42,11 +52,11 @@ makeSuite("AToken: Transfer", (testEnv: TestEnv) => {
|
||||||
|
|
||||||
expect(fromBalance.toString()).to.be.equal(
|
expect(fromBalance.toString()).to.be.equal(
|
||||||
"0",
|
"0",
|
||||||
"Invalid from balance after transfer"
|
INVALID_FROM_BALANCE_AFTER_TRANSFER
|
||||||
);
|
);
|
||||||
expect(toBalance.toString()).to.be.equal(
|
expect(toBalance.toString()).to.be.equal(
|
||||||
amountDAItoDeposit.toString(),
|
amountDAItoDeposit.toString(),
|
||||||
"Invalid to balance after transfer"
|
INVALID_TO_BALANCE_AFTER_TRANSFER
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -65,7 +75,7 @@ makeSuite("AToken: Transfer", (testEnv: TestEnv) => {
|
||||||
);
|
);
|
||||||
expect(user2RedirectedBalanceBefore.toString()).to.be.equal(
|
expect(user2RedirectedBalanceBefore.toString()).to.be.equal(
|
||||||
aDAIRedirected,
|
aDAIRedirected,
|
||||||
"Invalid redirected balance for user 2 before transfer"
|
INVALID_REDIRECTED_BALANCE_BEFORE_TRANSFER
|
||||||
);
|
);
|
||||||
|
|
||||||
await aDai
|
await aDai
|
||||||
|
@ -81,11 +91,11 @@ makeSuite("AToken: Transfer", (testEnv: TestEnv) => {
|
||||||
|
|
||||||
expect(user2RedirectedBalanceAfter.toString()).to.be.equal(
|
expect(user2RedirectedBalanceAfter.toString()).to.be.equal(
|
||||||
aDAItoTransfer,
|
aDAItoTransfer,
|
||||||
"Invalid redirected balance for user 2 after transfer"
|
INVALID_REDIRECTED_BALANCE_BEFORE_TRANSFER
|
||||||
);
|
);
|
||||||
expect(user1RedirectionAddress.toString()).to.be.equal(
|
expect(user1RedirectionAddress.toString()).to.be.equal(
|
||||||
users[2].address,
|
users[2].address,
|
||||||
"Invalid redirection address for user 1"
|
INVALID_REDIRECTION_ADDRESS
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -105,7 +115,7 @@ makeSuite("AToken: Transfer", (testEnv: TestEnv) => {
|
||||||
|
|
||||||
expect(user2RedirectedBalanceAfter.toString()).to.be.equal(
|
expect(user2RedirectedBalanceAfter.toString()).to.be.equal(
|
||||||
user1BalanceAfter.toString(),
|
user1BalanceAfter.toString(),
|
||||||
"Invalid redirected balance for user 2 after transfer"
|
INVALID_REDIRECTED_BALANCE_AFTER_TRANSFER
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -126,8 +136,8 @@ makeSuite("AToken: Transfer", (testEnv: TestEnv) => {
|
||||||
RateMode.Stable,
|
RateMode.Stable,
|
||||||
AAVE_REFERRAL
|
AAVE_REFERRAL
|
||||||
),
|
),
|
||||||
"The collateral balance is 0"
|
ZERO_COLLATERAL
|
||||||
).to.be.revertedWith("The collateral balance is 0");
|
).to.be.revertedWith(ZERO_COLLATERAL);
|
||||||
});
|
});
|
||||||
|
|
||||||
it("User 1 sets the DAI as collateral and borrows, tries to transfer everything back to user 0 (revert expected)", async () => {
|
it("User 1 sets the DAI as collateral and borrows, tries to transfer everything back to user 0 (revert expected)", async () => {
|
||||||
|
@ -157,8 +167,8 @@ makeSuite("AToken: Transfer", (testEnv: TestEnv) => {
|
||||||
const {users, pool, aDai, dai} = testEnv;
|
const {users, pool, aDai, dai} = testEnv;
|
||||||
await expect(
|
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"
|
TRANSFERRED_AMOUNT_GT_ZERO
|
||||||
).to.be.revertedWith("Transferred amount needs to be greater than zero");
|
).to.be.revertedWith(TRANSFERRED_AMOUNT_GT_ZERO);
|
||||||
});
|
});
|
||||||
|
|
||||||
it("User 1 repays the borrow, transfers aDAI back to user 0", async () => {
|
it("User 1 repays the borrow, transfers aDAI back to user 0", async () => {
|
||||||
|
@ -188,12 +198,12 @@ makeSuite("AToken: Transfer", (testEnv: TestEnv) => {
|
||||||
|
|
||||||
expect(user2RedirectedBalanceAfter.toString()).to.be.equal(
|
expect(user2RedirectedBalanceAfter.toString()).to.be.equal(
|
||||||
"0",
|
"0",
|
||||||
"Invalid redirected balance for user 2 after transfer"
|
INVALID_REDIRECTED_BALANCE_AFTER_TRANSFER
|
||||||
);
|
);
|
||||||
|
|
||||||
expect(user1RedirectionAddress.toString()).to.be.equal(
|
expect(user1RedirectionAddress.toString()).to.be.equal(
|
||||||
ZERO_ADDRESS,
|
ZERO_ADDRESS,
|
||||||
"Invalid redirected address for user 1"
|
INVALID_REDIRECTION_ADDRESS
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -238,11 +248,11 @@ makeSuite("AToken: Transfer", (testEnv: TestEnv) => {
|
||||||
|
|
||||||
expect(user2RedirectedBalanceAfter.toString()).to.be.equal(
|
expect(user2RedirectedBalanceAfter.toString()).to.be.equal(
|
||||||
expectedUser2Redirected,
|
expectedUser2Redirected,
|
||||||
"Invalid redirected balance for user 2 after transfer"
|
INVALID_REDIRECTED_BALANCE_AFTER_TRANSFER
|
||||||
);
|
);
|
||||||
expect(user3RedirectedBalanceAfter.toString()).to.be.equal(
|
expect(user3RedirectedBalanceAfter.toString()).to.be.equal(
|
||||||
expectedUser3Redirected,
|
expectedUser3Redirected,
|
||||||
"Invalid redirected balance for user 3 after transfer"
|
INVALID_REDIRECTED_BALANCE_AFTER_TRANSFER
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
|
@ -5,10 +5,13 @@ import {
|
||||||
APPROVAL_AMOUNT_LENDING_POOL_CORE,
|
APPROVAL_AMOUNT_LENDING_POOL_CORE,
|
||||||
} from "../helpers/constants";
|
} from "../helpers/constants";
|
||||||
import {convertToCurrencyDecimals} from "../helpers/contracts-helpers";
|
import {convertToCurrencyDecimals} from "../helpers/contracts-helpers";
|
||||||
|
import {ProtocolErrors} from "../helpers/types";
|
||||||
|
|
||||||
const {expect} = require("chai");
|
const {expect} = require("chai");
|
||||||
|
|
||||||
makeSuite("AToken: Transfer", (testEnv: TestEnv) => {
|
makeSuite("LendingPoolConfigurator", (testEnv: TestEnv) => {
|
||||||
|
const {INVALID_POOL_MANAGER_CALLER_MSG} = ProtocolErrors;
|
||||||
|
|
||||||
it("Deactivates the ETH reserve", async () => {
|
it("Deactivates the ETH reserve", async () => {
|
||||||
const {configurator, core} = testEnv;
|
const {configurator, core} = testEnv;
|
||||||
await configurator.deactivateReserve(MOCK_ETH_ADDRESS);
|
await configurator.deactivateReserve(MOCK_ETH_ADDRESS);
|
||||||
|
@ -28,16 +31,16 @@ makeSuite("AToken: Transfer", (testEnv: TestEnv) => {
|
||||||
const {configurator, users} = testEnv;
|
const {configurator, users} = testEnv;
|
||||||
await expect(
|
await expect(
|
||||||
configurator.connect(users[2].signer).deactivateReserve(MOCK_ETH_ADDRESS),
|
configurator.connect(users[2].signer).deactivateReserve(MOCK_ETH_ADDRESS),
|
||||||
"The caller must be a lending pool manager"
|
INVALID_POOL_MANAGER_CALLER_MSG
|
||||||
).to.be.revertedWith("The caller must be a lending pool manager");
|
).to.be.revertedWith(INVALID_POOL_MANAGER_CALLER_MSG);
|
||||||
});
|
});
|
||||||
|
|
||||||
it("Check the onlyLendingPoolManager on activateReserve ", async () => {
|
it("Check the onlyLendingPoolManager on activateReserve ", async () => {
|
||||||
const {configurator, users} = testEnv;
|
const {configurator, users} = testEnv;
|
||||||
await expect(
|
await expect(
|
||||||
configurator.connect(users[2].signer).activateReserve(MOCK_ETH_ADDRESS),
|
configurator.connect(users[2].signer).activateReserve(MOCK_ETH_ADDRESS),
|
||||||
"The caller must be a lending pool manager"
|
INVALID_POOL_MANAGER_CALLER_MSG
|
||||||
).to.be.revertedWith("The caller must be a lending pool manager");
|
).to.be.revertedWith(INVALID_POOL_MANAGER_CALLER_MSG);
|
||||||
});
|
});
|
||||||
|
|
||||||
it("Freezes the ETH reserve", async () => {
|
it("Freezes the ETH reserve", async () => {
|
||||||
|
@ -59,16 +62,16 @@ makeSuite("AToken: Transfer", (testEnv: TestEnv) => {
|
||||||
const {configurator, users} = testEnv;
|
const {configurator, users} = testEnv;
|
||||||
await expect(
|
await expect(
|
||||||
configurator.connect(users[2].signer).freezeReserve(MOCK_ETH_ADDRESS),
|
configurator.connect(users[2].signer).freezeReserve(MOCK_ETH_ADDRESS),
|
||||||
"The caller must be a lending pool manager"
|
INVALID_POOL_MANAGER_CALLER_MSG
|
||||||
).to.be.revertedWith("The caller must be a lending pool manager");
|
).to.be.revertedWith(INVALID_POOL_MANAGER_CALLER_MSG);
|
||||||
});
|
});
|
||||||
|
|
||||||
it("Check the onlyLendingPoolManager on unfreezeReserve ", async () => {
|
it("Check the onlyLendingPoolManager on unfreezeReserve ", async () => {
|
||||||
const {configurator, users} = testEnv;
|
const {configurator, users} = testEnv;
|
||||||
await expect(
|
await expect(
|
||||||
configurator.connect(users[2].signer).unfreezeReserve(MOCK_ETH_ADDRESS),
|
configurator.connect(users[2].signer).unfreezeReserve(MOCK_ETH_ADDRESS),
|
||||||
"The caller must be a lending pool manager"
|
INVALID_POOL_MANAGER_CALLER_MSG
|
||||||
).to.be.revertedWith("The caller must be a lending pool manager");
|
).to.be.revertedWith(INVALID_POOL_MANAGER_CALLER_MSG);
|
||||||
});
|
});
|
||||||
|
|
||||||
it("Deactivates the ETH reserve for borrowing", async () => {
|
it("Deactivates the ETH reserve for borrowing", async () => {
|
||||||
|
@ -95,8 +98,8 @@ makeSuite("AToken: Transfer", (testEnv: TestEnv) => {
|
||||||
configurator
|
configurator
|
||||||
.connect(users[2].signer)
|
.connect(users[2].signer)
|
||||||
.disableBorrowingOnReserve(MOCK_ETH_ADDRESS),
|
.disableBorrowingOnReserve(MOCK_ETH_ADDRESS),
|
||||||
"The caller must be a lending pool manager"
|
INVALID_POOL_MANAGER_CALLER_MSG
|
||||||
).to.be.revertedWith("The caller must be a lending pool manager");
|
).to.be.revertedWith(INVALID_POOL_MANAGER_CALLER_MSG);
|
||||||
});
|
});
|
||||||
|
|
||||||
it("Check the onlyLendingPoolManager on enableBorrowingOnReserve ", async () => {
|
it("Check the onlyLendingPoolManager on enableBorrowingOnReserve ", async () => {
|
||||||
|
@ -105,8 +108,8 @@ makeSuite("AToken: Transfer", (testEnv: TestEnv) => {
|
||||||
configurator
|
configurator
|
||||||
.connect(users[2].signer)
|
.connect(users[2].signer)
|
||||||
.enableBorrowingOnReserve(MOCK_ETH_ADDRESS, true),
|
.enableBorrowingOnReserve(MOCK_ETH_ADDRESS, true),
|
||||||
"The caller must be a lending pool manager"
|
INVALID_POOL_MANAGER_CALLER_MSG
|
||||||
).to.be.revertedWith("The caller must be a lending pool manager");
|
).to.be.revertedWith(INVALID_POOL_MANAGER_CALLER_MSG);
|
||||||
});
|
});
|
||||||
|
|
||||||
it("Deactivates the ETH reserve as collateral", async () => {
|
it("Deactivates the ETH reserve as collateral", async () => {
|
||||||
|
@ -139,8 +142,8 @@ makeSuite("AToken: Transfer", (testEnv: TestEnv) => {
|
||||||
configurator
|
configurator
|
||||||
.connect(users[2].signer)
|
.connect(users[2].signer)
|
||||||
.disableReserveAsCollateral(MOCK_ETH_ADDRESS),
|
.disableReserveAsCollateral(MOCK_ETH_ADDRESS),
|
||||||
"The caller must be a lending pool manager"
|
INVALID_POOL_MANAGER_CALLER_MSG
|
||||||
).to.be.revertedWith("The caller must be a lending pool manager");
|
).to.be.revertedWith(INVALID_POOL_MANAGER_CALLER_MSG);
|
||||||
});
|
});
|
||||||
|
|
||||||
it("Check the onlyLendingPoolManager on enableReserveAsCollateral ", async () => {
|
it("Check the onlyLendingPoolManager on enableReserveAsCollateral ", async () => {
|
||||||
|
@ -149,8 +152,8 @@ makeSuite("AToken: Transfer", (testEnv: TestEnv) => {
|
||||||
configurator
|
configurator
|
||||||
.connect(users[2].signer)
|
.connect(users[2].signer)
|
||||||
.enableReserveAsCollateral(MOCK_ETH_ADDRESS, "75", "80", "105"),
|
.enableReserveAsCollateral(MOCK_ETH_ADDRESS, "75", "80", "105"),
|
||||||
"The caller must be a lending pool manager"
|
INVALID_POOL_MANAGER_CALLER_MSG
|
||||||
).to.be.revertedWith("The caller must be a lending pool manager");
|
).to.be.revertedWith(INVALID_POOL_MANAGER_CALLER_MSG);
|
||||||
});
|
});
|
||||||
|
|
||||||
it("Disable stable borrow rate on the ETH reserve", async () => {
|
it("Disable stable borrow rate on the ETH reserve", async () => {
|
||||||
|
@ -177,8 +180,8 @@ makeSuite("AToken: Transfer", (testEnv: TestEnv) => {
|
||||||
configurator
|
configurator
|
||||||
.connect(users[2].signer)
|
.connect(users[2].signer)
|
||||||
.disableReserveStableBorrowRate(MOCK_ETH_ADDRESS),
|
.disableReserveStableBorrowRate(MOCK_ETH_ADDRESS),
|
||||||
"The caller must be a lending pool manager"
|
INVALID_POOL_MANAGER_CALLER_MSG
|
||||||
).to.be.revertedWith("The caller must be a lending pool manager");
|
).to.be.revertedWith(INVALID_POOL_MANAGER_CALLER_MSG);
|
||||||
});
|
});
|
||||||
|
|
||||||
it("Check the onlyLendingPoolManager on enableReserveStableBorrowRate", async () => {
|
it("Check the onlyLendingPoolManager on enableReserveStableBorrowRate", async () => {
|
||||||
|
@ -187,8 +190,8 @@ makeSuite("AToken: Transfer", (testEnv: TestEnv) => {
|
||||||
configurator
|
configurator
|
||||||
.connect(users[2].signer)
|
.connect(users[2].signer)
|
||||||
.enableReserveStableBorrowRate(MOCK_ETH_ADDRESS),
|
.enableReserveStableBorrowRate(MOCK_ETH_ADDRESS),
|
||||||
"The caller must be a lending pool manager"
|
INVALID_POOL_MANAGER_CALLER_MSG
|
||||||
).to.be.revertedWith("The caller must be a lending pool manager");
|
).to.be.revertedWith(INVALID_POOL_MANAGER_CALLER_MSG);
|
||||||
});
|
});
|
||||||
|
|
||||||
it("Changes LTV of the reserve", async () => {
|
it("Changes LTV of the reserve", async () => {
|
||||||
|
@ -204,8 +207,8 @@ makeSuite("AToken: Transfer", (testEnv: TestEnv) => {
|
||||||
configurator
|
configurator
|
||||||
.connect(users[2].signer)
|
.connect(users[2].signer)
|
||||||
.setReserveBaseLTVasCollateral(MOCK_ETH_ADDRESS, "75"),
|
.setReserveBaseLTVasCollateral(MOCK_ETH_ADDRESS, "75"),
|
||||||
"The caller must be a lending pool manager"
|
INVALID_POOL_MANAGER_CALLER_MSG
|
||||||
).to.be.revertedWith("The caller must be a lending pool manager");
|
).to.be.revertedWith(INVALID_POOL_MANAGER_CALLER_MSG);
|
||||||
});
|
});
|
||||||
|
|
||||||
it("Changes liquidation threshold of the reserve", async () => {
|
it("Changes liquidation threshold of the reserve", async () => {
|
||||||
|
@ -226,8 +229,8 @@ makeSuite("AToken: Transfer", (testEnv: TestEnv) => {
|
||||||
configurator
|
configurator
|
||||||
.connect(users[2].signer)
|
.connect(users[2].signer)
|
||||||
.setReserveLiquidationThreshold(MOCK_ETH_ADDRESS, "80"),
|
.setReserveLiquidationThreshold(MOCK_ETH_ADDRESS, "80"),
|
||||||
"The caller must be a lending pool manager"
|
INVALID_POOL_MANAGER_CALLER_MSG
|
||||||
).to.be.revertedWith("The caller must be a lending pool manager");
|
).to.be.revertedWith(INVALID_POOL_MANAGER_CALLER_MSG);
|
||||||
});
|
});
|
||||||
|
|
||||||
it("Changes liquidation bonus of the reserve", async () => {
|
it("Changes liquidation bonus of the reserve", async () => {
|
||||||
|
@ -248,8 +251,8 @@ makeSuite("AToken: Transfer", (testEnv: TestEnv) => {
|
||||||
configurator
|
configurator
|
||||||
.connect(users[2].signer)
|
.connect(users[2].signer)
|
||||||
.setReserveLiquidationBonus(MOCK_ETH_ADDRESS, "80"),
|
.setReserveLiquidationBonus(MOCK_ETH_ADDRESS, "80"),
|
||||||
"The caller must be a lending pool manager"
|
INVALID_POOL_MANAGER_CALLER_MSG
|
||||||
).to.be.revertedWith("The caller must be a lending pool manager");
|
).to.be.revertedWith(INVALID_POOL_MANAGER_CALLER_MSG);
|
||||||
});
|
});
|
||||||
|
|
||||||
it("Check the onlyLendingPoolManager on setReserveDecimals", async () => {
|
it("Check the onlyLendingPoolManager on setReserveDecimals", async () => {
|
||||||
|
@ -258,8 +261,8 @@ makeSuite("AToken: Transfer", (testEnv: TestEnv) => {
|
||||||
configurator
|
configurator
|
||||||
.connect(users[2].signer)
|
.connect(users[2].signer)
|
||||||
.setReserveDecimals(MOCK_ETH_ADDRESS, "80"),
|
.setReserveDecimals(MOCK_ETH_ADDRESS, "80"),
|
||||||
"The caller must be a lending pool manager"
|
INVALID_POOL_MANAGER_CALLER_MSG
|
||||||
).to.be.revertedWith("The caller must be a lending pool manager");
|
).to.be.revertedWith(INVALID_POOL_MANAGER_CALLER_MSG);
|
||||||
});
|
});
|
||||||
|
|
||||||
it("Removes the last added reserve", async () => {
|
it("Removes the last added reserve", async () => {
|
||||||
|
@ -284,8 +287,8 @@ makeSuite("AToken: Transfer", (testEnv: TestEnv) => {
|
||||||
configurator
|
configurator
|
||||||
.connect(users[2].signer)
|
.connect(users[2].signer)
|
||||||
.setReserveLiquidationBonus(MOCK_ETH_ADDRESS, "80"),
|
.setReserveLiquidationBonus(MOCK_ETH_ADDRESS, "80"),
|
||||||
"The caller must be a lending pool manager"
|
INVALID_POOL_MANAGER_CALLER_MSG
|
||||||
).to.be.revertedWith("The caller must be a lending pool manager");
|
).to.be.revertedWith(INVALID_POOL_MANAGER_CALLER_MSG);
|
||||||
});
|
});
|
||||||
|
|
||||||
it("Reverts when trying to disable the DAI reserve with liquidity on it", async () => {
|
it("Reverts when trying to disable the DAI reserve with liquidity on it", async () => {
|
||||||
|
|
|
@ -1,284 +1,258 @@
|
||||||
// import {ITestEnvWithoutInstances, iAssetsWithoutETH, RateMode} from '../utils/types';
|
import {expect} from "chai";
|
||||||
// import {
|
import {TestEnv, makeSuite} from "./helpers/make-suite";
|
||||||
// LendingPoolCoreInstance,
|
import {RateMode, ProtocolErrors} from "../helpers/types";
|
||||||
// MintableERC20Instance,
|
import {MOCK_ETH_ADDRESS} from "../helpers/constants";
|
||||||
// } from '../utils/typechain-types/truffle-contracts';
|
|
||||||
// import {testEnvProviderWithoutInstances} from '../utils/truffle/dlp-tests-env';
|
|
||||||
// import { ETHEREUM_ADDRESS} from '../utils/constants';
|
|
||||||
|
|
||||||
// const expectRevert = require('@openzeppelin/test-helpers').expectRevert;
|
makeSuite("LendingPoolCore: Modifiers", (testEnv: TestEnv) => {
|
||||||
|
const {
|
||||||
|
INVALID_CONFIGURATOR_CALLER_MSG,
|
||||||
|
INVALID_POOL_CALLER_MSG,
|
||||||
|
} = ProtocolErrors;
|
||||||
|
|
||||||
// contract('LendingPoolCore: Modifiers', async ([deployer, ...users]) => {
|
it("Tries invoke updateStateOnDeposit ", async () => {
|
||||||
// let _testEnvProvider: ITestEnvWithoutInstances;
|
const {dai, deployer, core} = testEnv;
|
||||||
// let _lendingPoolCoreInstance: LendingPoolCoreInstance;
|
await expect(
|
||||||
// let _tokenInstances: iAssetsWithoutETH<MintableERC20Instance>;
|
core.updateStateOnDeposit(dai.address, deployer.address, "0", false),
|
||||||
|
INVALID_POOL_CALLER_MSG
|
||||||
|
).to.be.revertedWith(INVALID_POOL_CALLER_MSG);
|
||||||
|
});
|
||||||
|
|
||||||
// before('Initializing tests', async () => {
|
it("Tries invoke updateStateOnRedeem", async () => {
|
||||||
// _testEnvProvider = await testEnvProviderWithoutInstances(artifacts, [deployer, ...users]);
|
const {dai, deployer, core} = testEnv;
|
||||||
|
await expect(
|
||||||
|
core.updateStateOnRedeem(dai.address, deployer.address, "0", false),
|
||||||
|
INVALID_POOL_CALLER_MSG
|
||||||
|
).to.be.revertedWith(INVALID_POOL_CALLER_MSG);
|
||||||
|
});
|
||||||
|
|
||||||
// const {getAllAssetsInstances, getLendingPoolCoreInstance} = _testEnvProvider;
|
it("Tries invoke updateStateOnBorrow", async () => {
|
||||||
// const instances = await Promise.all([getLendingPoolCoreInstance(), getAllAssetsInstances()]);
|
const {dai, deployer, core} = testEnv;
|
||||||
// _lendingPoolCoreInstance = instances[0];
|
await expect(
|
||||||
// _tokenInstances = instances[1];
|
core.updateStateOnBorrow(
|
||||||
// });
|
dai.address,
|
||||||
|
deployer.address,
|
||||||
|
"0",
|
||||||
|
"0",
|
||||||
|
RateMode.Stable
|
||||||
|
),
|
||||||
|
INVALID_POOL_CALLER_MSG
|
||||||
|
).to.be.revertedWith(INVALID_POOL_CALLER_MSG);
|
||||||
|
});
|
||||||
|
|
||||||
// it('Tries invoke updateStateOnDeposit ', async () => {
|
it("Tries invoke updateStateOnRepay", async () => {
|
||||||
// const {DAI: daiInstance} = _tokenInstances;
|
const {dai, deployer, core} = testEnv;
|
||||||
|
await expect(
|
||||||
|
core.updateStateOnRepay(
|
||||||
|
dai.address,
|
||||||
|
deployer.address,
|
||||||
|
"0",
|
||||||
|
"0",
|
||||||
|
"0",
|
||||||
|
false
|
||||||
|
),
|
||||||
|
INVALID_POOL_CALLER_MSG
|
||||||
|
).to.be.revertedWith(INVALID_POOL_CALLER_MSG);
|
||||||
|
});
|
||||||
|
|
||||||
// await expectRevert(
|
it("Tries invoke updateStateOnSwapRate", async () => {
|
||||||
// _lendingPoolCoreInstance.updateStateOnDeposit(daiInstance.address, deployer, '0', false),
|
const {dai, deployer, core} = testEnv;
|
||||||
// 'The caller must be a lending pool contract'
|
await expect(
|
||||||
// );
|
core.updateStateOnSwapRate(
|
||||||
// });
|
dai.address,
|
||||||
|
deployer.address,
|
||||||
|
"0",
|
||||||
|
"0",
|
||||||
|
"0",
|
||||||
|
RateMode.Stable
|
||||||
|
),
|
||||||
|
INVALID_POOL_CALLER_MSG
|
||||||
|
).to.be.revertedWith(INVALID_POOL_CALLER_MSG);
|
||||||
|
});
|
||||||
|
|
||||||
// it('Tries invoke updateStateOnRedeem', async () => {
|
it("Tries invoke updateStateOnRebalance", async () => {
|
||||||
// const {DAI: daiInstance} = _tokenInstances;
|
const {dai, deployer, core} = testEnv;
|
||||||
|
await expect(
|
||||||
|
core.updateStateOnRebalance(dai.address, deployer.address, "0"),
|
||||||
|
INVALID_POOL_CALLER_MSG
|
||||||
|
).to.be.revertedWith(INVALID_POOL_CALLER_MSG);
|
||||||
|
});
|
||||||
|
|
||||||
// await expectRevert(
|
it("Tries invoke updateStateOnLiquidation", async () => {
|
||||||
// _lendingPoolCoreInstance.updateStateOnRedeem(daiInstance.address, deployer, '0', false),
|
const {dai, deployer, core} = testEnv;
|
||||||
// 'The caller must be a lending pool contract'
|
await expect(
|
||||||
// );
|
core.updateStateOnLiquidation(
|
||||||
// });
|
MOCK_ETH_ADDRESS,
|
||||||
|
dai.address,
|
||||||
|
deployer.address,
|
||||||
|
"0",
|
||||||
|
"0",
|
||||||
|
"0",
|
||||||
|
"0",
|
||||||
|
"0",
|
||||||
|
false
|
||||||
|
),
|
||||||
|
INVALID_POOL_CALLER_MSG
|
||||||
|
).to.be.revertedWith(INVALID_POOL_CALLER_MSG);
|
||||||
|
});
|
||||||
|
|
||||||
// it('Tries invoke updateStateOnBorrow', async () => {
|
it("Tries invoke setUserUseReserveAsCollateral", async () => {
|
||||||
// const {DAI: daiInstance} = _tokenInstances;
|
const {deployer, core} = testEnv;
|
||||||
|
await expect(
|
||||||
|
core.setUserUseReserveAsCollateral(
|
||||||
|
MOCK_ETH_ADDRESS,
|
||||||
|
deployer.address,
|
||||||
|
false
|
||||||
|
),
|
||||||
|
INVALID_POOL_CALLER_MSG
|
||||||
|
).to.be.revertedWith(INVALID_POOL_CALLER_MSG);
|
||||||
|
});
|
||||||
|
|
||||||
// await expectRevert(
|
it("Tries invoke transferToUser", async () => {
|
||||||
// _lendingPoolCoreInstance.updateStateOnBorrow(
|
const {deployer, core} = testEnv;
|
||||||
// daiInstance.address,
|
await expect(
|
||||||
// deployer,
|
core.transferToUser(MOCK_ETH_ADDRESS, deployer.address, "0"),
|
||||||
// '0',
|
INVALID_POOL_CALLER_MSG
|
||||||
// '0',
|
).to.be.revertedWith(INVALID_POOL_CALLER_MSG);
|
||||||
// RateMode.Stable
|
});
|
||||||
// ),
|
|
||||||
// 'The caller must be a lending pool contract'
|
|
||||||
// );
|
|
||||||
// });
|
|
||||||
|
|
||||||
// it('Tries invoke updateStateOnRepay', async () => {
|
it("Tries invoke transferToReserve", async () => {
|
||||||
// const {DAI: daiInstance} = _tokenInstances;
|
const {deployer, core} = testEnv;
|
||||||
|
await expect(
|
||||||
|
core.transferToReserve(MOCK_ETH_ADDRESS, deployer.address, "0"),
|
||||||
|
INVALID_POOL_CALLER_MSG
|
||||||
|
).to.be.revertedWith(INVALID_POOL_CALLER_MSG);
|
||||||
|
});
|
||||||
|
|
||||||
// await expectRevert(
|
it("Tries invoke transferToFeeCollectionAddress", async () => {
|
||||||
// _lendingPoolCoreInstance.updateStateOnRepay(
|
const {deployer, core} = testEnv;
|
||||||
// daiInstance.address,
|
await expect(
|
||||||
// deployer,
|
core.transferToFeeCollectionAddress(
|
||||||
// '0',
|
MOCK_ETH_ADDRESS,
|
||||||
// '0',
|
deployer.address,
|
||||||
// '0',
|
"0",
|
||||||
// false
|
deployer.address
|
||||||
// ),
|
),
|
||||||
// 'The caller must be a lending pool contract'
|
INVALID_POOL_CALLER_MSG
|
||||||
// );
|
).to.be.revertedWith(INVALID_POOL_CALLER_MSG);
|
||||||
// });
|
});
|
||||||
|
|
||||||
// it('Tries invoke updateStateOnSwapRate', async () => {
|
it("Tries invoke liquidateFee", async () => {
|
||||||
// const {DAI: daiInstance} = _tokenInstances;
|
const {deployer, core} = testEnv;
|
||||||
|
await expect(
|
||||||
|
core.liquidateFee(MOCK_ETH_ADDRESS, "0", deployer.address),
|
||||||
|
INVALID_POOL_CALLER_MSG
|
||||||
|
).to.be.revertedWith(INVALID_POOL_CALLER_MSG);
|
||||||
|
});
|
||||||
|
|
||||||
// await expectRevert(
|
it("Tries invoke initReserve", async () => {
|
||||||
// _lendingPoolCoreInstance.updateStateOnSwapRate(
|
const {deployer, core, dai} = testEnv;
|
||||||
// daiInstance.address,
|
await expect(
|
||||||
// deployer,
|
core.initReserve(dai.address, dai.address, "18", deployer.address),
|
||||||
// '0',
|
INVALID_CONFIGURATOR_CALLER_MSG
|
||||||
// '0',
|
).to.be.revertedWith(INVALID_CONFIGURATOR_CALLER_MSG);
|
||||||
// '0',
|
});
|
||||||
// RateMode.Stable
|
|
||||||
// ),
|
|
||||||
// 'The caller must be a lending pool contract'
|
|
||||||
// );
|
|
||||||
// });
|
|
||||||
|
|
||||||
// it('Tries invoke updateStateOnRebalance', async () => {
|
it("Tries invoke refreshConfiguration", async () => {
|
||||||
// const {DAI: daiInstance} = _tokenInstances;
|
const {core} = testEnv;
|
||||||
|
await expect(
|
||||||
|
core.refreshConfiguration(),
|
||||||
|
INVALID_CONFIGURATOR_CALLER_MSG
|
||||||
|
).to.be.revertedWith(INVALID_CONFIGURATOR_CALLER_MSG);
|
||||||
|
});
|
||||||
|
|
||||||
// await expectRevert(
|
it("Tries invoke enableBorrowingOnReserve, disableBorrowingOnReserve", async () => {
|
||||||
// _lendingPoolCoreInstance.updateStateOnRebalance(daiInstance.address, deployer, '0'),
|
const {core, dai} = testEnv;
|
||||||
// 'The caller must be a lending pool contract'
|
await expect(
|
||||||
// );
|
core.enableBorrowingOnReserve(dai.address, false),
|
||||||
// });
|
INVALID_CONFIGURATOR_CALLER_MSG
|
||||||
|
).to.be.revertedWith(INVALID_CONFIGURATOR_CALLER_MSG);
|
||||||
|
await expect(
|
||||||
|
core.refreshConfiguration(),
|
||||||
|
INVALID_CONFIGURATOR_CALLER_MSG
|
||||||
|
).to.be.revertedWith(INVALID_CONFIGURATOR_CALLER_MSG);
|
||||||
|
});
|
||||||
|
|
||||||
// it('Tries invoke updateStateOnLiquidation', async () => {
|
it("Tries invoke freezeReserve, unfreezeReserve", async () => {
|
||||||
// const {DAI: daiInstance} = _tokenInstances;
|
const {core, dai} = testEnv;
|
||||||
|
await expect(
|
||||||
|
core.freezeReserve(dai.address),
|
||||||
|
INVALID_CONFIGURATOR_CALLER_MSG
|
||||||
|
).to.be.revertedWith(INVALID_CONFIGURATOR_CALLER_MSG);
|
||||||
|
await expect(
|
||||||
|
core.unfreezeReserve(dai.address),
|
||||||
|
INVALID_CONFIGURATOR_CALLER_MSG
|
||||||
|
).to.be.revertedWith(INVALID_CONFIGURATOR_CALLER_MSG);
|
||||||
|
});
|
||||||
|
|
||||||
// await expectRevert(
|
it("Tries invoke enableReserveAsCollateral, disableReserveAsCollateral", async () => {
|
||||||
// _lendingPoolCoreInstance.updateStateOnLiquidation(
|
const {core, dai} = testEnv;
|
||||||
// ETHEREUM_ADDRESS,
|
await expect(
|
||||||
// daiInstance.address,
|
core.enableReserveAsCollateral(dai.address, 0, 0, 0),
|
||||||
// deployer,
|
INVALID_CONFIGURATOR_CALLER_MSG
|
||||||
// '0',
|
).to.be.revertedWith(INVALID_CONFIGURATOR_CALLER_MSG);
|
||||||
// '0',
|
await expect(
|
||||||
// '0',
|
core.disableReserveAsCollateral(dai.address),
|
||||||
// '0',
|
INVALID_CONFIGURATOR_CALLER_MSG
|
||||||
// '0',
|
).to.be.revertedWith(INVALID_CONFIGURATOR_CALLER_MSG);
|
||||||
// false
|
});
|
||||||
// ),
|
|
||||||
// 'The caller must be a lending pool contract'
|
|
||||||
// );
|
|
||||||
// });
|
|
||||||
|
|
||||||
// it('Tries invoke setUserUseReserveAsCollateral', async () => {
|
it("Tries invoke enableReserveStableBorrowRate, disableReserveStableBorrowRate", async () => {
|
||||||
// await expectRevert(
|
const {core, dai} = testEnv;
|
||||||
// _lendingPoolCoreInstance.setUserUseReserveAsCollateral(ETHEREUM_ADDRESS, deployer, false),
|
await expect(
|
||||||
// 'The caller must be a lending pool contract'
|
core.enableReserveStableBorrowRate(dai.address),
|
||||||
// );
|
INVALID_CONFIGURATOR_CALLER_MSG
|
||||||
// });
|
).to.be.revertedWith(INVALID_CONFIGURATOR_CALLER_MSG);
|
||||||
|
await expect(
|
||||||
|
core.disableReserveStableBorrowRate(dai.address),
|
||||||
|
INVALID_CONFIGURATOR_CALLER_MSG
|
||||||
|
).to.be.revertedWith(INVALID_CONFIGURATOR_CALLER_MSG);
|
||||||
|
});
|
||||||
|
|
||||||
// it('Tries invoke transferToUser', async () => {
|
it("Tries invoke setReserveDecimals", async () => {
|
||||||
// await expectRevert(
|
const {core, dai} = testEnv;
|
||||||
// _lendingPoolCoreInstance.transferToUser(ETHEREUM_ADDRESS, deployer, '0'),
|
await expect(
|
||||||
// 'The caller must be a lending pool contract'
|
core.setReserveDecimals(dai.address, "0"),
|
||||||
// );
|
INVALID_CONFIGURATOR_CALLER_MSG
|
||||||
// });
|
).to.be.revertedWith(INVALID_CONFIGURATOR_CALLER_MSG);
|
||||||
|
});
|
||||||
|
|
||||||
// it('Tries invoke transferToReserve', async () => {
|
it("Tries invoke removeLastAddedReserve", async () => {
|
||||||
// await expectRevert(
|
const {core, dai} = testEnv;
|
||||||
// _lendingPoolCoreInstance.transferToReserve(ETHEREUM_ADDRESS, deployer, '0'),
|
await expect(
|
||||||
// 'The caller must be a lending pool contract'
|
core.removeLastAddedReserve(dai.address),
|
||||||
// );
|
INVALID_CONFIGURATOR_CALLER_MSG
|
||||||
// });
|
).to.be.revertedWith(INVALID_CONFIGURATOR_CALLER_MSG);
|
||||||
|
});
|
||||||
|
|
||||||
// it('Tries invoke transferToFeeCollectionAddress', async () => {
|
it("Tries invoke setReserveBaseLTVasCollateral", async () => {
|
||||||
// await expectRevert(
|
const {core, dai} = testEnv;
|
||||||
// _lendingPoolCoreInstance.transferToFeeCollectionAddress(
|
await expect(
|
||||||
// ETHEREUM_ADDRESS,
|
core.setReserveBaseLTVasCollateral(dai.address, "0"),
|
||||||
// deployer,
|
INVALID_CONFIGURATOR_CALLER_MSG
|
||||||
// '0',
|
).to.be.revertedWith(INVALID_CONFIGURATOR_CALLER_MSG);
|
||||||
// deployer
|
});
|
||||||
// ),
|
|
||||||
// 'The caller must be a lending pool contract'
|
|
||||||
// );
|
|
||||||
// });
|
|
||||||
|
|
||||||
// it('Tries invoke liquidateFee', async () => {
|
it("Tries invoke setReserveLiquidationBonus", async () => {
|
||||||
// await expectRevert(
|
const {core, dai} = testEnv;
|
||||||
// _lendingPoolCoreInstance.liquidateFee(ETHEREUM_ADDRESS, '0', deployer),
|
await expect(
|
||||||
// 'The caller must be a lending pool contract'
|
core.setReserveLiquidationBonus(dai.address, "0"),
|
||||||
// );
|
INVALID_CONFIGURATOR_CALLER_MSG
|
||||||
// });
|
).to.be.revertedWith(INVALID_CONFIGURATOR_CALLER_MSG);
|
||||||
|
});
|
||||||
|
|
||||||
// it('Tries invoke initReserve', async () => {
|
it("Tries invoke setReserveLiquidationThreshold", async () => {
|
||||||
// const {DAI: daiInstance} = _tokenInstances;
|
const {core, dai} = testEnv;
|
||||||
|
await expect(
|
||||||
|
core.setReserveLiquidationThreshold(dai.address, "0"),
|
||||||
|
INVALID_CONFIGURATOR_CALLER_MSG
|
||||||
|
).to.be.revertedWith(INVALID_CONFIGURATOR_CALLER_MSG);
|
||||||
|
});
|
||||||
|
|
||||||
// await expectRevert(
|
it("Tries invoke setReserveInterestRateStrategyAddress", async () => {
|
||||||
// _lendingPoolCoreInstance.initReserve(
|
const {core, deployer, dai} = testEnv;
|
||||||
// daiInstance.address,
|
await expect(
|
||||||
// daiInstance.address,
|
core.setReserveInterestRateStrategyAddress(dai.address, deployer.address),
|
||||||
// '18',
|
INVALID_CONFIGURATOR_CALLER_MSG
|
||||||
// deployer
|
).to.be.revertedWith(INVALID_CONFIGURATOR_CALLER_MSG);
|
||||||
// ),
|
});
|
||||||
// 'The caller must be a lending pool configurator contract'
|
});
|
||||||
// );
|
|
||||||
// });
|
|
||||||
|
|
||||||
// it('Tries invoke refreshConfiguration', async () => {
|
|
||||||
// await expectRevert(
|
|
||||||
// _lendingPoolCoreInstance.refreshConfiguration(),
|
|
||||||
// 'The caller must be a lending pool configurator contract'
|
|
||||||
// );
|
|
||||||
// });
|
|
||||||
|
|
||||||
// it('Tries invoke enableBorrowingOnReserve, disableBorrowingOnReserve', async () => {
|
|
||||||
// const {DAI: daiInstance} = _tokenInstances;
|
|
||||||
|
|
||||||
// await expectRevert(
|
|
||||||
// _lendingPoolCoreInstance.enableBorrowingOnReserve(daiInstance.address, false),
|
|
||||||
// 'The caller must be a lending pool configurator contract'
|
|
||||||
// );
|
|
||||||
// await expectRevert(
|
|
||||||
// _lendingPoolCoreInstance.refreshConfiguration(),
|
|
||||||
// 'The caller must be a lending pool configurator contract'
|
|
||||||
// );
|
|
||||||
// });
|
|
||||||
|
|
||||||
// it('Tries invoke freezeReserve, unfreezeReserve', async () => {
|
|
||||||
// const {DAI: daiInstance} = _tokenInstances;
|
|
||||||
|
|
||||||
// await expectRevert(
|
|
||||||
// _lendingPoolCoreInstance.freezeReserve(daiInstance.address),
|
|
||||||
// 'The caller must be a lending pool configurator contract'
|
|
||||||
// );
|
|
||||||
// await expectRevert(
|
|
||||||
// _lendingPoolCoreInstance.unfreezeReserve(daiInstance.address),
|
|
||||||
// 'The caller must be a lending pool configurator contract'
|
|
||||||
// );
|
|
||||||
// });
|
|
||||||
|
|
||||||
// it('Tries invoke enableReserveAsCollateral, disableReserveAsCollateral', async () => {
|
|
||||||
// const {DAI: daiInstance} = _tokenInstances;
|
|
||||||
|
|
||||||
// await expectRevert(
|
|
||||||
// _lendingPoolCoreInstance.enableReserveAsCollateral(daiInstance.address, 0, 0, 0),
|
|
||||||
// 'The caller must be a lending pool configurator contract'
|
|
||||||
// );
|
|
||||||
// await expectRevert(
|
|
||||||
// _lendingPoolCoreInstance.disableReserveAsCollateral(daiInstance.address),
|
|
||||||
// 'The caller must be a lending pool configurator contract'
|
|
||||||
// );
|
|
||||||
// });
|
|
||||||
|
|
||||||
// it('Tries invoke enableReserveStableBorrowRate, disableReserveStableBorrowRate', async () => {
|
|
||||||
// const {DAI: daiInstance} = _tokenInstances;
|
|
||||||
|
|
||||||
// await expectRevert(
|
|
||||||
// _lendingPoolCoreInstance.enableReserveStableBorrowRate(daiInstance.address),
|
|
||||||
// 'The caller must be a lending pool configurator contract'
|
|
||||||
// );
|
|
||||||
// await expectRevert(
|
|
||||||
// _lendingPoolCoreInstance.disableReserveStableBorrowRate(daiInstance.address),
|
|
||||||
// 'The caller must be a lending pool configurator contract'
|
|
||||||
// );
|
|
||||||
// });
|
|
||||||
|
|
||||||
// it('Tries invoke setReserveDecimals', async () => {
|
|
||||||
// const {DAI: daiInstance} = _tokenInstances;
|
|
||||||
|
|
||||||
// await expectRevert(
|
|
||||||
// _lendingPoolCoreInstance.setReserveDecimals(daiInstance.address, '0'),
|
|
||||||
// 'The caller must be a lending pool configurator contract'
|
|
||||||
// );
|
|
||||||
// });
|
|
||||||
|
|
||||||
// it('Tries invoke removeLastAddedReserve', async () => {
|
|
||||||
// const {DAI: daiInstance} = _tokenInstances;
|
|
||||||
|
|
||||||
// await expectRevert(
|
|
||||||
// _lendingPoolCoreInstance.removeLastAddedReserve(daiInstance.address),
|
|
||||||
// 'The caller must be a lending pool configurator contract'
|
|
||||||
// );
|
|
||||||
// });
|
|
||||||
|
|
||||||
// it('Tries invoke setReserveBaseLTVasCollateral', async () => {
|
|
||||||
// const {DAI: daiInstance} = _tokenInstances;
|
|
||||||
|
|
||||||
// await expectRevert(
|
|
||||||
// _lendingPoolCoreInstance.setReserveBaseLTVasCollateral(daiInstance.address, '0'),
|
|
||||||
// 'The caller must be a lending pool configurator contract'
|
|
||||||
// );
|
|
||||||
// });
|
|
||||||
|
|
||||||
// it('Tries invoke setReserveLiquidationBonus', async () => {
|
|
||||||
// const {DAI: daiInstance} = _tokenInstances;
|
|
||||||
|
|
||||||
// await expectRevert(
|
|
||||||
// _lendingPoolCoreInstance.setReserveLiquidationBonus(daiInstance.address, '0'),
|
|
||||||
// 'The caller must be a lending pool configurator contract'
|
|
||||||
// );
|
|
||||||
// });
|
|
||||||
|
|
||||||
// it('Tries invoke setReserveLiquidationThreshold', async () => {
|
|
||||||
// const {DAI: daiInstance} = _tokenInstances;
|
|
||||||
|
|
||||||
// await expectRevert(
|
|
||||||
// _lendingPoolCoreInstance.setReserveLiquidationThreshold(daiInstance.address, '0'),
|
|
||||||
// 'The caller must be a lending pool configurator contract'
|
|
||||||
// );
|
|
||||||
// });
|
|
||||||
|
|
||||||
// it('Tries invoke setReserveInterestRateStrategyAddress', async () => {
|
|
||||||
// const {DAI: daiInstance} = _tokenInstances;
|
|
||||||
|
|
||||||
// await expectRevert(
|
|
||||||
// _lendingPoolCoreInstance.setReserveInterestRateStrategyAddress(daiInstance.address, deployer),
|
|
||||||
// 'The caller must be a lending pool configurator contract'
|
|
||||||
// );
|
|
||||||
// });
|
|
||||||
// });
|
|
||||||
|
|
|
@ -1,12 +1,13 @@
|
||||||
import {expect} from "chai";
|
import {expect} from "chai";
|
||||||
import {createRandomAddress} from "../helpers/misc-utils";
|
import {createRandomAddress} from "../helpers/misc-utils";
|
||||||
import {makeSuite, TestEnv} from "./helpers/make-suite";
|
import {makeSuite, TestEnv} from "./helpers/make-suite";
|
||||||
|
import {ProtocolErrors} from "../helpers/types";
|
||||||
|
|
||||||
makeSuite("LendingPoolAddressesProvider", (testEnv: TestEnv) => {
|
makeSuite("LendingPoolAddressesProvider", (testEnv: TestEnv) => {
|
||||||
it("Test the accessibility of the LendingPoolAddressesProvider", async () => {
|
it("Test the accessibility of the LendingPoolAddressesProvider", async () => {
|
||||||
const {addressesProvider, users} = testEnv;
|
const {addressesProvider, users} = testEnv;
|
||||||
const mockAddress = createRandomAddress();
|
const mockAddress = createRandomAddress();
|
||||||
const INVALID_OWNER_REVERT_MSG = "Ownable: caller is not the owner";
|
const {INVALID_OWNER_REVERT_MSG} = ProtocolErrors;
|
||||||
|
|
||||||
await addressesProvider.transferOwnership(users[1].address);
|
await addressesProvider.transferOwnership(users[1].address);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user