2020-07-13 08:54:08 +00:00
|
|
|
import {expect} from 'chai';
|
|
|
|
import {createRandomAddress} from '../helpers/misc-utils';
|
|
|
|
import {makeSuite, TestEnv} from './helpers/make-suite';
|
|
|
|
import {ProtocolErrors} from '../helpers/types';
|
2020-09-29 14:31:21 +00:00
|
|
|
import {ethers} from 'ethers';
|
|
|
|
import {ZERO_ADDRESS} from '../helpers/constants';
|
|
|
|
|
|
|
|
const {utils} = ethers;
|
2020-06-03 10:44:10 +00:00
|
|
|
|
2020-07-13 08:54:08 +00:00
|
|
|
makeSuite('LendingPoolAddressesProvider', (testEnv: TestEnv) => {
|
|
|
|
it('Test the accessibility of the LendingPoolAddressesProvider', async () => {
|
2020-06-10 15:01:32 +00:00
|
|
|
const {addressesProvider, users} = testEnv;
|
2020-06-03 10:44:10 +00:00
|
|
|
const mockAddress = createRandomAddress();
|
2020-06-12 08:39:42 +00:00
|
|
|
const {INVALID_OWNER_REVERT_MSG} = ProtocolErrors;
|
2020-06-10 15:01:32 +00:00
|
|
|
|
|
|
|
await addressesProvider.transferOwnership(users[1].address);
|
2020-06-03 10:44:10 +00:00
|
|
|
|
|
|
|
for (const contractFunction of [
|
|
|
|
addressesProvider.setLendingPoolImpl,
|
|
|
|
addressesProvider.setLendingPoolConfiguratorImpl,
|
2020-09-16 10:41:12 +00:00
|
|
|
addressesProvider.setLendingPoolCollateralManager,
|
2020-09-16 12:09:42 +00:00
|
|
|
addressesProvider.setAaveAdmin,
|
2020-06-03 10:44:10 +00:00
|
|
|
addressesProvider.setPriceOracle,
|
|
|
|
addressesProvider.setLendingRateOracle,
|
|
|
|
]) {
|
2020-07-13 08:54:08 +00:00
|
|
|
await expect(contractFunction(mockAddress)).to.be.revertedWith(INVALID_OWNER_REVERT_MSG);
|
2020-06-03 10:44:10 +00:00
|
|
|
}
|
2020-09-29 14:31:21 +00:00
|
|
|
|
|
|
|
await expect(
|
|
|
|
addressesProvider.setAddress(
|
|
|
|
utils.keccak256(utils.toUtf8Bytes('RANDOM_ID')),
|
|
|
|
mockAddress,
|
|
|
|
ZERO_ADDRESS
|
|
|
|
)
|
|
|
|
).to.be.revertedWith(INVALID_OWNER_REVERT_MSG);
|
2020-06-03 10:44:10 +00:00
|
|
|
});
|
|
|
|
});
|