aave-protocol-v2/test/lending-pool-addresses-provider.spec.ts

38 lines
1.3 KiB
TypeScript
Raw Normal View History

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';
import {ethers} from 'ethers';
import {ZERO_ADDRESS} from '../helpers/constants';
const {utils} = ethers;
2020-07-13 08:54:08 +00:00
makeSuite('LendingPoolAddressesProvider', (testEnv: TestEnv) => {
it('Test the accessibility of the LendingPoolAddressesProvider', async () => {
const {addressesProvider, users} = testEnv;
const mockAddress = createRandomAddress();
const {INVALID_OWNER_REVERT_MSG} = ProtocolErrors;
await addressesProvider.transferOwnership(users[1].address);
for (const contractFunction of [
addressesProvider.setLendingPoolImpl,
addressesProvider.setLendingPoolConfiguratorImpl,
addressesProvider.setLendingPoolCollateralManager,
2020-09-16 12:09:42 +00:00
addressesProvider.setAaveAdmin,
addressesProvider.setPriceOracle,
addressesProvider.setLendingRateOracle,
]) {
2020-07-13 08:54:08 +00:00
await expect(contractFunction(mockAddress)).to.be.revertedWith(INVALID_OWNER_REVERT_MSG);
}
await expect(
addressesProvider.setAddress(
utils.keccak256(utils.toUtf8Bytes('RANDOM_ID')),
mockAddress,
ZERO_ADDRESS
)
).to.be.revertedWith(INVALID_OWNER_REVERT_MSG);
});
});