From 703c4a81533bc4e4a367101f70d5aeb8516f31b9 Mon Sep 17 00:00:00 2001 From: Brice Stacey Date: Wed, 7 Dec 2022 15:54:15 -0500 Subject: [PATCH 1/2] Fix PoolController test --- contracts/controllers/PoolController.sol | 9 +++++++++ test/controllers/PoolController.test.ts | 9 ++++----- 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/contracts/controllers/PoolController.sol b/contracts/controllers/PoolController.sol index 8145eb48..3f1b8e30 100644 --- a/contracts/controllers/PoolController.sol +++ b/contracts/controllers/PoolController.sol @@ -25,6 +25,15 @@ contract PoolController is IPoolController, IBeaconImplementation { FirstLossVault private _firstLossVault; IERC20 private _liquidityAsset; + /** + * @dev Emitted when first loss is supplied to the pool. + */ + event FirstLossDeposited( + address indexed caller, + address indexed spender, + uint256 amount + ); + /** * @dev Modifier that checks that the caller is the pool's admin. */ diff --git a/test/controllers/PoolController.test.ts b/test/controllers/PoolController.test.ts index 830f93a9..4efe769d 100644 --- a/test/controllers/PoolController.test.ts +++ b/test/controllers/PoolController.test.ts @@ -313,14 +313,13 @@ describe("PoolController", () => { }); it("if the pool is closed, the withdraw window won't increase if it's already less than 1 day", async () => { - const { operator, poolAdmin } = await loadFixture(loadPoolFixture); + const { poolAdmin } = await loadFixture(loadPoolFixture); const overriddenPoolSettings = { withdrawRequestPeriodDuration: 86399 }; const { poolController: newPoolController } = await deployPool({ - operator, poolAdmin: poolAdmin, settings: overriddenPoolSettings }); @@ -506,8 +505,8 @@ describe("PoolController", () => { .approve(poolController.address, firstLossAmount); // Contribute first loss - expect( - await poolController + await expect( + poolController .connect(poolAdmin) .depositFirstLoss(firstLossAmount, poolAdmin.address) ).to.emit(poolController, "FirstLossDeposited"); @@ -907,7 +906,7 @@ describe("PoolController", () => { expect((await pool.accountings()).totalDefaults).to.equal(0); expect((await pool.accountings()).totalFirstLossApplied).to.equal(0); - poolController.connect(poolAdmin).defaultLoan(loan.address); + await poolController.connect(poolAdmin).defaultLoan(loan.address); expect((await pool.accountings()).totalDefaults).to.equal( await loan.principal() ); From f5f2cc38cdb2de0eafddd2ea4fce3fedace0a3dd Mon Sep 17 00:00:00 2001 From: Brice Stacey Date: Wed, 7 Dec 2022 16:01:40 -0500 Subject: [PATCH 2/2] Move FirstLossDeposited event to interface --- contracts/controllers/PoolController.sol | 9 --------- contracts/controllers/interfaces/IPoolController.sol | 9 +++++++++ 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/contracts/controllers/PoolController.sol b/contracts/controllers/PoolController.sol index 3f1b8e30..8145eb48 100644 --- a/contracts/controllers/PoolController.sol +++ b/contracts/controllers/PoolController.sol @@ -25,15 +25,6 @@ contract PoolController is IPoolController, IBeaconImplementation { FirstLossVault private _firstLossVault; IERC20 private _liquidityAsset; - /** - * @dev Emitted when first loss is supplied to the pool. - */ - event FirstLossDeposited( - address indexed caller, - address indexed spender, - uint256 amount - ); - /** * @dev Modifier that checks that the caller is the pool's admin. */ diff --git a/contracts/controllers/interfaces/IPoolController.sol b/contracts/controllers/interfaces/IPoolController.sol index ff901d3f..ad25fcba 100644 --- a/contracts/controllers/interfaces/IPoolController.sol +++ b/contracts/controllers/interfaces/IPoolController.sol @@ -48,6 +48,15 @@ interface IPoolController { */ event LoanDefaulted(address indexed loan); + /** + * @dev Emitted when first loss is supplied to the pool. + */ + event FirstLossDeposited( + address indexed caller, + address indexed spender, + uint256 amount + ); + /** * @dev Emitted when first loss capital is used to cover loan defaults */