mirror of
https://github.com/Instadapp/aave-protocol-v2.git
synced 2024-07-29 21:47:30 +00:00
Fixed P_IS_PAUSED
This commit is contained in:
parent
05d426645d
commit
07429b0a57
|
@ -64,7 +64,7 @@ contract LendingPool is VersionedInitializable, ILendingPool, LendingPoolStorage
|
||||||
* - The contract must not be paused.
|
* - The contract must not be paused.
|
||||||
*/
|
*/
|
||||||
function _whenNotPaused() internal view {
|
function _whenNotPaused() internal view {
|
||||||
require(!_paused, Errors.P_IS_PAUSED);
|
require(!_paused, Errors.LP_IS_PAUSED);
|
||||||
}
|
}
|
||||||
|
|
||||||
function getRevision() internal override pure returns (uint256) {
|
function getRevision() internal override pure returns (uint256) {
|
||||||
|
|
|
@ -80,7 +80,7 @@ library Errors {
|
||||||
string public constant LP_INVALID_EQUAL_ASSETS_TO_SWAP = '61';
|
string public constant LP_INVALID_EQUAL_ASSETS_TO_SWAP = '61';
|
||||||
string public constant LP_REENTRANCY_NOT_ALLOWED = '62';
|
string public constant LP_REENTRANCY_NOT_ALLOWED = '62';
|
||||||
string public constant LP_CALLER_MUST_BE_AN_ATOKEN = '63';
|
string public constant LP_CALLER_MUST_BE_AN_ATOKEN = '63';
|
||||||
string public constant P_IS_PAUSED = '64'; // 'Pool is paused'
|
string public constant LP_IS_PAUSED = '64'; // 'Pool is paused'
|
||||||
string public constant LP_NO_MORE_RESERVES_ALLOWED = '65';
|
string public constant LP_NO_MORE_RESERVES_ALLOWED = '65';
|
||||||
string public constant LP_INVALID_FLASH_LOAN_EXECUTOR_RETURN = '66';
|
string public constant LP_INVALID_FLASH_LOAN_EXECUTOR_RETURN = '66';
|
||||||
string public constant RC_INVALID_LTV = '67';
|
string public constant RC_INVALID_LTV = '67';
|
||||||
|
|
|
@ -135,7 +135,7 @@ export enum ProtocolErrors {
|
||||||
LP_INVALID_EQUAL_ASSETS_TO_SWAP = '61',
|
LP_INVALID_EQUAL_ASSETS_TO_SWAP = '61',
|
||||||
LP_REENTRANCY_NOT_ALLOWED = '62',
|
LP_REENTRANCY_NOT_ALLOWED = '62',
|
||||||
LP_CALLER_MUST_BE_AN_ATOKEN = '63',
|
LP_CALLER_MUST_BE_AN_ATOKEN = '63',
|
||||||
P_IS_PAUSED = '64', // 'Pool is paused'
|
LP_IS_PAUSED = '64', // 'Pool is paused'
|
||||||
LP_NO_MORE_RESERVES_ALLOWED = '65',
|
LP_NO_MORE_RESERVES_ALLOWED = '65',
|
||||||
LP_INVALID_FLASH_LOAN_EXECUTOR_RETURN = '66',
|
LP_INVALID_FLASH_LOAN_EXECUTOR_RETURN = '66',
|
||||||
RC_INVALID_LTV = '67',
|
RC_INVALID_LTV = '67',
|
||||||
|
|
|
@ -21,7 +21,7 @@ makeSuite('LendingPool liquidation - liquidator receiving aToken', (testEnv) =>
|
||||||
INVALID_HF,
|
INVALID_HF,
|
||||||
LPCM_SPECIFIED_CURRENCY_NOT_BORROWED_BY_USER,
|
LPCM_SPECIFIED_CURRENCY_NOT_BORROWED_BY_USER,
|
||||||
LPCM_COLLATERAL_CANNOT_BE_LIQUIDATED,
|
LPCM_COLLATERAL_CANNOT_BE_LIQUIDATED,
|
||||||
P_IS_PAUSED,
|
LP_IS_PAUSED,
|
||||||
} = ProtocolErrors;
|
} = ProtocolErrors;
|
||||||
|
|
||||||
it('LIQUIDATION - Deposits WETH, borrows DAI/Check liquidation fails because health factor is above 1', async () => {
|
it('LIQUIDATION - Deposits WETH, borrows DAI/Check liquidation fails because health factor is above 1', async () => {
|
||||||
|
|
|
@ -13,7 +13,7 @@ makeSuite('Pausable Pool', (testEnv: TestEnv) => {
|
||||||
let _mockFlashLoanReceiver = {} as MockFlashLoanReceiver;
|
let _mockFlashLoanReceiver = {} as MockFlashLoanReceiver;
|
||||||
|
|
||||||
const {
|
const {
|
||||||
P_IS_PAUSED,
|
LP_IS_PAUSED,
|
||||||
INVALID_FROM_BALANCE_AFTER_TRANSFER,
|
INVALID_FROM_BALANCE_AFTER_TRANSFER,
|
||||||
INVALID_TO_BALANCE_AFTER_TRANSFER,
|
INVALID_TO_BALANCE_AFTER_TRANSFER,
|
||||||
} = ProtocolErrors;
|
} = ProtocolErrors;
|
||||||
|
@ -44,7 +44,7 @@ makeSuite('Pausable Pool', (testEnv: TestEnv) => {
|
||||||
// User 0 tries the transfer to User 1
|
// User 0 tries the transfer to User 1
|
||||||
await expect(
|
await expect(
|
||||||
aDai.connect(users[0].signer).transfer(users[1].address, amountDAItoDeposit)
|
aDai.connect(users[0].signer).transfer(users[1].address, amountDAItoDeposit)
|
||||||
).to.revertedWith(P_IS_PAUSED);
|
).to.revertedWith(LP_IS_PAUSED);
|
||||||
|
|
||||||
const pausedFromBalance = await aDai.balanceOf(users[0].address);
|
const pausedFromBalance = await aDai.balanceOf(users[0].address);
|
||||||
const pausedToBalance = await aDai.balanceOf(users[1].address);
|
const pausedToBalance = await aDai.balanceOf(users[1].address);
|
||||||
|
@ -91,7 +91,7 @@ makeSuite('Pausable Pool', (testEnv: TestEnv) => {
|
||||||
await configurator.setPoolPause(true);
|
await configurator.setPoolPause(true);
|
||||||
await expect(
|
await expect(
|
||||||
pool.connect(users[0].signer).deposit(dai.address, amountDAItoDeposit, users[0].address, '0')
|
pool.connect(users[0].signer).deposit(dai.address, amountDAItoDeposit, users[0].address, '0')
|
||||||
).to.revertedWith(P_IS_PAUSED);
|
).to.revertedWith(LP_IS_PAUSED);
|
||||||
|
|
||||||
// Configurator unpauses the pool
|
// Configurator unpauses the pool
|
||||||
await configurator.setPoolPause(false);
|
await configurator.setPoolPause(false);
|
||||||
|
@ -116,7 +116,7 @@ makeSuite('Pausable Pool', (testEnv: TestEnv) => {
|
||||||
// user tries to burn
|
// user tries to burn
|
||||||
await expect(
|
await expect(
|
||||||
pool.connect(users[0].signer).withdraw(dai.address, amountDAItoDeposit, users[0].address)
|
pool.connect(users[0].signer).withdraw(dai.address, amountDAItoDeposit, users[0].address)
|
||||||
).to.revertedWith(P_IS_PAUSED);
|
).to.revertedWith(LP_IS_PAUSED);
|
||||||
|
|
||||||
// Configurator unpauses the pool
|
// Configurator unpauses the pool
|
||||||
await configurator.setPoolPause(false);
|
await configurator.setPoolPause(false);
|
||||||
|
@ -133,7 +133,7 @@ makeSuite('Pausable Pool', (testEnv: TestEnv) => {
|
||||||
// Try to execute liquidation
|
// Try to execute liquidation
|
||||||
await expect(
|
await expect(
|
||||||
pool.connect(user.signer).delegateBorrowAllowance([dai.address], toUser.address, ['1'], ['1'])
|
pool.connect(user.signer).delegateBorrowAllowance([dai.address], toUser.address, ['1'], ['1'])
|
||||||
).revertedWith(P_IS_PAUSED);
|
).revertedWith(LP_IS_PAUSED);
|
||||||
|
|
||||||
// Unpause the pool
|
// Unpause the pool
|
||||||
await configurator.setPoolPause(false);
|
await configurator.setPoolPause(false);
|
||||||
|
@ -149,7 +149,7 @@ makeSuite('Pausable Pool', (testEnv: TestEnv) => {
|
||||||
// Try to execute liquidation
|
// Try to execute liquidation
|
||||||
await expect(
|
await expect(
|
||||||
pool.connect(user.signer).borrow(dai.address, '1', '1', '0', user.address)
|
pool.connect(user.signer).borrow(dai.address, '1', '1', '0', user.address)
|
||||||
).revertedWith(P_IS_PAUSED);
|
).revertedWith(LP_IS_PAUSED);
|
||||||
|
|
||||||
// Unpause the pool
|
// Unpause the pool
|
||||||
await configurator.setPoolPause(false);
|
await configurator.setPoolPause(false);
|
||||||
|
@ -164,7 +164,7 @@ makeSuite('Pausable Pool', (testEnv: TestEnv) => {
|
||||||
|
|
||||||
// Try to execute liquidation
|
// Try to execute liquidation
|
||||||
await expect(pool.connect(user.signer).repay(dai.address, '1', '1', user.address)).revertedWith(
|
await expect(pool.connect(user.signer).repay(dai.address, '1', '1', user.address)).revertedWith(
|
||||||
P_IS_PAUSED
|
LP_IS_PAUSED
|
||||||
);
|
);
|
||||||
|
|
||||||
// Unpause the pool
|
// Unpause the pool
|
||||||
|
@ -195,7 +195,7 @@ makeSuite('Pausable Pool', (testEnv: TestEnv) => {
|
||||||
'0x10',
|
'0x10',
|
||||||
'0'
|
'0'
|
||||||
)
|
)
|
||||||
).revertedWith(P_IS_PAUSED);
|
).revertedWith(LP_IS_PAUSED);
|
||||||
|
|
||||||
// Unpause pool
|
// Unpause pool
|
||||||
await configurator.setPoolPause(false);
|
await configurator.setPoolPause(false);
|
||||||
|
@ -276,7 +276,7 @@ makeSuite('Pausable Pool', (testEnv: TestEnv) => {
|
||||||
// Do liquidation
|
// Do liquidation
|
||||||
expect(
|
expect(
|
||||||
pool.liquidationCall(weth.address, usdc.address, borrower.address, amountToLiquidate, true)
|
pool.liquidationCall(weth.address, usdc.address, borrower.address, amountToLiquidate, true)
|
||||||
).revertedWith(P_IS_PAUSED);
|
).revertedWith(LP_IS_PAUSED);
|
||||||
|
|
||||||
// Unpause pool
|
// Unpause pool
|
||||||
await configurator.setPoolPause(false);
|
await configurator.setPoolPause(false);
|
||||||
|
@ -305,7 +305,7 @@ makeSuite('Pausable Pool', (testEnv: TestEnv) => {
|
||||||
// Try to repay
|
// Try to repay
|
||||||
await expect(
|
await expect(
|
||||||
pool.connect(user.signer).swapBorrowRateMode(usdc.address, RateMode.Stable)
|
pool.connect(user.signer).swapBorrowRateMode(usdc.address, RateMode.Stable)
|
||||||
).revertedWith(P_IS_PAUSED);
|
).revertedWith(LP_IS_PAUSED);
|
||||||
|
|
||||||
// Unpause pool
|
// Unpause pool
|
||||||
await configurator.setPoolPause(false);
|
await configurator.setPoolPause(false);
|
||||||
|
@ -319,7 +319,7 @@ makeSuite('Pausable Pool', (testEnv: TestEnv) => {
|
||||||
|
|
||||||
await expect(
|
await expect(
|
||||||
pool.connect(user.signer).rebalanceStableBorrowRate(dai.address, user.address)
|
pool.connect(user.signer).rebalanceStableBorrowRate(dai.address, user.address)
|
||||||
).revertedWith(P_IS_PAUSED);
|
).revertedWith(LP_IS_PAUSED);
|
||||||
|
|
||||||
// Unpause pool
|
// Unpause pool
|
||||||
await configurator.setPoolPause(false);
|
await configurator.setPoolPause(false);
|
||||||
|
@ -339,7 +339,7 @@ makeSuite('Pausable Pool', (testEnv: TestEnv) => {
|
||||||
|
|
||||||
await expect(
|
await expect(
|
||||||
pool.connect(user.signer).setUserUseReserveAsCollateral(weth.address, false)
|
pool.connect(user.signer).setUserUseReserveAsCollateral(weth.address, false)
|
||||||
).revertedWith(P_IS_PAUSED);
|
).revertedWith(LP_IS_PAUSED);
|
||||||
|
|
||||||
// Unpause pool
|
// Unpause pool
|
||||||
await configurator.setPoolPause(false);
|
await configurator.setPoolPause(false);
|
||||||
|
|
Loading…
Reference in New Issue
Block a user