Remove whenNotPaused modifier for configurator functions. Added more test cases.

This commit is contained in:
David Racero 2020-09-14 14:36:12 +02:00
parent ad2581b0a0
commit b8a7237458
2 changed files with 47 additions and 2 deletions

View File

@ -711,7 +711,7 @@ contract LendingPool is VersionedInitializable, Pausable, ILendingPool {
address stableDebtAddress,
address variableDebtAddress,
address interestRateStrategyAddress
) external override onlyLendingPoolConfigurator whenNotPaused {
) external override onlyLendingPoolConfigurator {
_reserves[asset].init(
aTokenAddress,
stableDebtAddress,
@ -731,7 +731,6 @@ contract LendingPool is VersionedInitializable, Pausable, ILendingPool {
external
override
onlyLendingPoolConfigurator
whenNotPaused
{
_reserves[asset].interestRateStrategyAddress = rateStrategyAddress;
}

View File

@ -17,6 +17,7 @@ makeSuite('AToken: Transfer', (testEnv: TestEnv) => {
// ZERO_COLLATERAL,
COLLATERAL_BALANCE_IS_0,
TRANSFER_NOT_ALLOWED,
IS_PAUSED,
} = ProtocolErrors;
it('User 0 deposits 1000 DAI, transfers to user 1', async () => {
@ -134,4 +135,49 @@ makeSuite('AToken: Transfer', (testEnv: TestEnv) => {
INVALID_TO_BALANCE_AFTER_TRANSFER
);
});
it('User 0 deposits 1000 DAI but reverts due pool is paused', async () => {
const {users, pool, dai, aDai, configurator} = testEnv;
const amountDAItoDeposit = await convertToCurrencyDecimals(dai.address, '1000');
await dai.connect(users[0].signer).mint(amountDAItoDeposit);
// user 0 deposits 1000 DAI
await dai.connect(users[0].signer).approve(pool.address, APPROVAL_AMOUNT_LENDING_POOL);
// Configurator pauses the pool
await configurator.pausePool();
await expect(
pool.connect(users[0].signer).deposit(dai.address, amountDAItoDeposit, users[0].address, '0')
).to.revertedWith(IS_PAUSED);
// Configurator unpauses the pool
await configurator.unpausePool();
});
it('User 0 burns 1000 aDAI but reverts due pool is paused', async () => {
const {users, pool, dai, aDai, configurator} = testEnv;
const amountDAItoDeposit = await convertToCurrencyDecimals(dai.address, '1000');
await dai.connect(users[0].signer).mint(amountDAItoDeposit);
// user 0 deposits 1000 DAI
await dai.connect(users[0].signer).approve(pool.address, APPROVAL_AMOUNT_LENDING_POOL);
await pool
.connect(users[0].signer)
.deposit(dai.address, amountDAItoDeposit, users[0].address, '0');
// Configurator pauses the pool
await configurator.pausePool();
// user tries to burn
await expect(
pool.connect(users[0].signer).withdraw(dai.address, amountDAItoDeposit)
).to.revertedWith(IS_PAUSED);
// Configurator unpauses the pool
await configurator.unpausePool();
});
});