Skip to content

Commit

Permalink
Throw error when lending pool is zero address
Browse files Browse the repository at this point in the history
  • Loading branch information
MickdeGraaf committed Dec 7, 2020
1 parent 91e5837 commit bd652b2
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
1 change: 1 addition & 0 deletions contracts/callManagers/LendingManager/LendingLogicAave.sol
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ contract LendingLogicAave is ILendingLogic {
uint16 public referralCode;

constructor(address _lendingPool, uint16 _referralCode) {
require(_lendingPool != address(0), "LENDING_POOL_INVALID");
lendingPool = IAaveLendingPool(_lendingPool);
referralCode = _referralCode;
}
Expand Down
5 changes: 5 additions & 0 deletions test/lendingLogicAave.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,11 @@ describe("LendingLogicAave", function() {
await timeTraveler.revertSnapshot();
});

it("Deploying with lendingPool set to the zero address should fail", async() => {
const promise = deployContract(signers[0], LendingLogicAaveArtifact, [constants.AddressZero, 0]);
await expect(promise).to.be.revertedWith("LENDING_POOL_INVALID");
});

it("lend()", async() => {
const calls = await lendingLogic.lend(token.address, mintAmount);

Expand Down

0 comments on commit bd652b2

Please sign in to comment.