2020-06-03 10:44:10 +00:00
|
|
|
import {expect} from "chai";
|
|
|
|
import {MockProvider} from "ethereum-waffle";
|
|
|
|
import {BuidlerRuntimeEnvironment} from "@nomiclabs/buidler/types";
|
2020-06-08 15:36:40 +00:00
|
|
|
import {getLendingPoolAddressesProvider} from "../helpers/contracts-helpers";
|
|
|
|
import {createRandomAddress, evmRevert} from "../helpers/misc-utils";
|
2020-06-03 10:44:10 +00:00
|
|
|
|
|
|
|
describe("LendingPoolAddressesProvider", () => {
|
|
|
|
const wallets = new MockProvider().getWallets();
|
|
|
|
|
|
|
|
before(async () => {
|
2020-06-08 15:36:40 +00:00
|
|
|
await evmRevert("0x1");
|
2020-06-03 10:44:10 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
it("Test the accessibility of the LendingPoolAddressesProvider", async () => {
|
|
|
|
const mockAddress = createRandomAddress();
|
|
|
|
const INVALID_OWNER_REVERT_MSG = "Ownable: caller is not the owner";
|
2020-06-08 15:36:40 +00:00
|
|
|
const addressesProvider = await getLendingPoolAddressesProvider();
|
2020-06-03 10:44:10 +00:00
|
|
|
await addressesProvider.transferOwnership(wallets[1].address);
|
|
|
|
|
|
|
|
for (const contractFunction of [
|
|
|
|
addressesProvider.setFeeProviderImpl,
|
|
|
|
addressesProvider.setLendingPoolImpl,
|
|
|
|
addressesProvider.setLendingPoolConfiguratorImpl,
|
|
|
|
addressesProvider.setLendingPoolCoreImpl,
|
|
|
|
addressesProvider.setLendingPoolDataProviderImpl,
|
|
|
|
addressesProvider.setLendingPoolLiquidationManager,
|
|
|
|
addressesProvider.setLendingPoolManager,
|
|
|
|
addressesProvider.setLendingPoolParametersProviderImpl,
|
|
|
|
addressesProvider.setPriceOracle,
|
|
|
|
addressesProvider.setLendingRateOracle,
|
|
|
|
]) {
|
|
|
|
await expect(contractFunction(mockAddress)).to.be.revertedWith(
|
|
|
|
INVALID_OWNER_REVERT_MSG
|
|
|
|
);
|
|
|
|
}
|
|
|
|
});
|
|
|
|
});
|