2020-06-03 10:44:10 +00:00
|
|
|
import {expect} from "chai";
|
|
|
|
import {MockProvider} from "ethereum-waffle";
|
2020-06-08 15:36:40 +00:00
|
|
|
import {getLendingPoolAddressesProvider} from "../helpers/contracts-helpers";
|
|
|
|
import {createRandomAddress, evmRevert} from "../helpers/misc-utils";
|
2020-06-08 19:06:26 +00:00
|
|
|
import {TEST_SNAPSHOT_ID} from "../helpers/constants";
|
2020-06-03 10:44:10 +00:00
|
|
|
|
|
|
|
describe("LendingPoolAddressesProvider", () => {
|
|
|
|
const wallets = new MockProvider().getWallets();
|
|
|
|
|
|
|
|
before(async () => {
|
2020-06-08 19:06:26 +00:00
|
|
|
await evmRevert(TEST_SNAPSHOT_ID);
|
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
|
|
|
|
);
|
|
|
|
}
|
|
|
|
});
|
|
|
|
});
|