From c1710f2ae1d315241e3dd621d90eb21b8f719f62 Mon Sep 17 00:00:00 2001 From: Adrian Soghoian Date: Wed, 28 Sep 2022 14:03:18 -0400 Subject: [PATCH 1/4] Add method for withdrawing first loss. Add tests for lib and pool. Update depositing FL method to specify a supplier. --- contracts/FirstLossVault.sol | 4 +- contracts/Loan.sol | 2 +- contracts/Pool.sol | 24 +++- contracts/interfaces/IPool.sol | 11 +- contracts/{library => libraries}/LoanLib.sol | 0 contracts/{library => libraries}/PoolLib.sol | 45 +++++- contracts/mocks/PoolLibTestWrapper.sol | 32 ++++- test/Pool.test.ts | 51 +++++-- test/{ => libraries}/PoolLib.test.ts | 138 +++++++++++++++---- 9 files changed, 253 insertions(+), 54 deletions(-) rename contracts/{library => libraries}/LoanLib.sol (100%) rename contracts/{library => libraries}/PoolLib.sol (79%) rename test/{ => libraries}/PoolLib.test.ts (66%) diff --git a/contracts/FirstLossVault.sol b/contracts/FirstLossVault.sol index 69292e94..d96cb9a8 100644 --- a/contracts/FirstLossVault.sol +++ b/contracts/FirstLossVault.sol @@ -18,7 +18,7 @@ contract FirstLossVault { /** * @dev Modifier restricting access to pool */ - modifier isPool() { + modifier onlyPool() { require(msg.sender == _pool, "FirstLossVault: caller not pool"); _; } @@ -50,7 +50,7 @@ contract FirstLossVault { /** * @dev Allows withdrawal of funds held by vault. */ - function withdraw(uint256 amount, address receiver) external isPool { + function withdraw(uint256 amount, address receiver) external onlyPool { require(receiver != address(0), "FirstLossVault: 0 address"); _asset.safeTransfer(receiver, amount); } diff --git a/contracts/Loan.sol b/contracts/Loan.sol index 2e323a3b..de12bc44 100644 --- a/contracts/Loan.sol +++ b/contracts/Loan.sol @@ -2,7 +2,7 @@ pragma solidity ^0.8.16; import "./interfaces/ILoan.sol"; -import "./library/LoanLib.sol"; +import "./libraries/LoanLib.sol"; import "./CollateralVault.sol"; /** diff --git a/contracts/Pool.sol b/contracts/Pool.sol index bef2212e..8d99c1d8 100644 --- a/contracts/Pool.sol +++ b/contracts/Pool.sol @@ -6,7 +6,7 @@ import "./interfaces/IPool.sol"; import {ERC20} from "@openzeppelin/contracts/token/ERC20/ERC20.sol"; import {IERC20} from "@openzeppelin/contracts/token/ERC20/ERC20.sol"; import {SafeERC20} from "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol"; -import "./library/PoolLib.sol"; +import "./libraries/PoolLib.sol"; import "./FirstLossVault.sol"; /** @@ -135,14 +135,15 @@ contract Pool is IPool, ERC20 { /** * @dev Supplies first-loss to the pool. Can only be called by the Pool Manager. */ - function supplyFirstLoss(uint256 amount) + function depositFirstLoss(uint256 amount, address spender) external onlyManager atInitializedOrActiveState { IPoolLifeCycleState poolLifeCycleState = PoolLib - .executeFirstLossContribution( + .executeFirstLossDeposit( address(_liquidityAsset), + spender, amount, address(_firstLossVault), _poolLifeCycleState, @@ -152,6 +153,23 @@ contract Pool is IPool, ERC20 { _setPoolLifeCycleState(poolLifeCycleState); } + /** + * @dev inheritdoc IPool + */ + function withdrawFirstLoss(uint256 amount, address receiver) + external + onlyManager + atState(IPoolLifeCycleState.Closed) + returns (uint256) + { + return + PoolLib.executeFirstLossWithdraw( + amount, + receiver, + address(_firstLossVault) + ); + } + /** * @dev Updates the pool capacity. Can only be called by the Pool Manager. */ diff --git a/contracts/interfaces/IPool.sol b/contracts/interfaces/IPool.sol index 7c115793..a52f02d6 100644 --- a/contracts/interfaces/IPool.sol +++ b/contracts/interfaces/IPool.sol @@ -104,9 +104,16 @@ interface IPool is IERC4626 { function accountings() external view returns (IPoolAccountings memory); /** - * @dev Supplies first-loss to the pool. Can only be called by the Pool Manager. + * @dev Deposits first-loss to the pool. Can only be called by the Pool Manager. */ - function supplyFirstLoss(uint256 amount) external; + function depositFirstLoss(uint256 amount, address spender) external; + + /** + * @dev Withdraws first-loss to the pool. Can only be called by the Pool Manager. + */ + function withdrawFirstLoss(uint256 amount, address receiver) + external + returns (uint256); /** * @dev Updates the pool capacity. Can only be called by the Pool Manager. diff --git a/contracts/library/LoanLib.sol b/contracts/libraries/LoanLib.sol similarity index 100% rename from contracts/library/LoanLib.sol rename to contracts/libraries/LoanLib.sol diff --git a/contracts/library/PoolLib.sol b/contracts/libraries/PoolLib.sol similarity index 79% rename from contracts/library/PoolLib.sol rename to contracts/libraries/PoolLib.sol index ec2c5e6d..77cc01a4 100644 --- a/contracts/library/PoolLib.sol +++ b/contracts/libraries/PoolLib.sol @@ -5,6 +5,7 @@ import {IERC20} from "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import {SafeERC20} from "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol"; import {SafeMath} from "@openzeppelin/contracts/utils/math/SafeMath.sol"; import "../interfaces/IPool.sol"; +import "../FirstLossVault.sol"; /** * @title Collection of functions used by the Pool @@ -21,9 +22,22 @@ library PoolLib { event LifeCycleStateTransition(IPoolLifeCycleState state); /** - * @dev Emitted when first loss is supplied to the pool. + * @dev Emitted when first loss is deposited to the pool. */ - event FirstLossSupplied(address indexed supplier, uint256 amount); + event FirstLossDeposited( + address indexed caller, + address indexed spender, + uint256 amount + ); + + /** + * @dev Emitted when first loss is withdrawn from the pool. + */ + event FirstLossWithdrawn( + address indexed caller, + address indexed receiver, + uint256 amount + ); /** * @dev See IERC4626 for event definition. @@ -43,8 +57,9 @@ library PoolLib { * @param minFirstLossRequired The minimum amount of first loss the pool needs to become active * @return newState The updated Pool lifecycle state */ - function executeFirstLossContribution( + function executeFirstLossDeposit( address liquidityAsset, + address spender, uint256 amount, address firstLossVault, IPoolLifeCycleState currentState, @@ -53,7 +68,7 @@ library PoolLib { require(firstLossVault != address(0), "Pool: 0 address"); IERC20(liquidityAsset).safeTransferFrom( - msg.sender, + spender, firstLossVault, amount ); @@ -69,7 +84,27 @@ library PoolLib { newState = IPoolLifeCycleState.Active; emit LifeCycleStateTransition(newState); } - emit FirstLossSupplied(msg.sender, amount); + emit FirstLossDeposited(msg.sender, spender, amount); + } + + /** + * @dev Withdraws first loss capital. Can only be called by the Pool manager under certain conditions. + * @param amount Amount of first loss being withdrawn + * @param withdrawReceiver Where the liquidity should be withdrawn to + * @param firstLossVault Vault holding first loss + * @return newState The updated Pool lifecycle state + */ + function executeFirstLossWithdraw( + uint256 amount, + address withdrawReceiver, + address firstLossVault + ) external returns (uint256) { + require(firstLossVault != address(0), "Pool: 0 address"); + require(withdrawReceiver != address(0), "Pool: 0 address"); + + FirstLossVault(firstLossVault).withdraw(amount, withdrawReceiver); + emit FirstLossWithdrawn(msg.sender, withdrawReceiver, amount); + return amount; } /** diff --git a/contracts/mocks/PoolLibTestWrapper.sol b/contracts/mocks/PoolLibTestWrapper.sol index 4596a1d7..62015476 100644 --- a/contracts/mocks/PoolLibTestWrapper.sol +++ b/contracts/mocks/PoolLibTestWrapper.sol @@ -1,7 +1,7 @@ // SPDX-License-Identifier: UNLICENSED pragma solidity ^0.8.16; -import "../library/PoolLib.sol"; +import "../libraries/PoolLib.sol"; import {ERC20} from "@openzeppelin/contracts/token/ERC20/ERC20.sol"; /** @@ -10,7 +10,16 @@ import {ERC20} from "@openzeppelin/contracts/token/ERC20/ERC20.sol"; */ contract PoolLibTestWrapper is ERC20("PoolLibTest", "PLT") { event LifeCycleStateTransition(IPoolLifeCycleState state); - event FirstLossSupplied(address indexed supplier, uint256 amount); + event FirstLossDeposited( + address indexed caller, + address indexed supplier, + uint256 amount + ); + event FirstLossWithdrawn( + address indexed caller, + address indexed receiver, + uint256 amount + ); event Deposit( address indexed caller, address indexed owner, @@ -18,15 +27,17 @@ contract PoolLibTestWrapper is ERC20("PoolLibTest", "PLT") { uint256 shares ); - function executeFirstLossContribution( + function executeFirstLossDeposit( address liquidityAsset, + address spender, uint256 amount, address firstLossVault, IPoolLifeCycleState currentState, uint256 minFirstLossRequired ) external { - PoolLib.executeFirstLossContribution( + PoolLib.executeFirstLossDeposit( liquidityAsset, + spender, amount, firstLossVault, currentState, @@ -34,6 +45,19 @@ contract PoolLibTestWrapper is ERC20("PoolLibTest", "PLT") { ); } + function executeFirstLossWithdraw( + uint256 amount, + address withdrawReceiver, + address firstLossVault + ) external returns (uint256) { + return + PoolLib.executeFirstLossWithdraw( + amount, + withdrawReceiver, + firstLossVault + ); + } + function calculateAssetsToShares( uint256 assets, uint256 sharesTotalSupply, diff --git a/test/Pool.test.ts b/test/Pool.test.ts index e7fc359f..9769ce6e 100644 --- a/test/Pool.test.ts +++ b/test/Pool.test.ts @@ -54,8 +54,8 @@ describe("Pool", () => { }); }); - describe("supplyFirstLoss", async () => { - it("first loss can be supplied and transitions lifecycle state", async () => { + describe("depositFirstLoss()", async () => { + it("first loss can be deposited and transitions lifecycle state", async () => { const { pool, poolManager, liquidityAsset } = await loadFixture( loadPoolFixture ); @@ -70,7 +70,9 @@ describe("Pool", () => { // Contribute first loss expect( - await pool.connect(poolManager).supplyFirstLoss(firstLossAmount) + await pool + .connect(poolManager) + .depositFirstLoss(firstLossAmount, poolManager.address) ).to.emit(pool.address, "FirstLossSupplied"); // Check balance @@ -81,6 +83,16 @@ describe("Pool", () => { }); }); + describe("withdrawFirstLoss()", async () => { + it("reverts if pool is not closed", async () => { + const { pool, poolManager } = await loadFixture(loadPoolFixture); + + await expect( + pool.connect(poolManager).withdrawFirstLoss(10, poolManager.address) + ).to.be.revertedWith("Pool: FunctionInvalidAtThisLifeCycleState"); + }); + }); + describe("deposit()", async () => { it("deposit cannot be called if pool is initialized", async () => { const { pool, otherAccount } = await loadFixture(loadPoolFixture); @@ -104,7 +116,12 @@ describe("Pool", () => { .approve(pool.address, firstLossInitialMinimum); // Contribute first loss - await pool.connect(poolManager).supplyFirstLoss(firstLossInitialMinimum); + await pool + .connect(poolManager) + .depositFirstLoss( + POOL_SETTINGS.firstLossInitialMinimum, + poolManager.address + ); // Provide capital to lender const depositAmount = 1000; @@ -128,7 +145,7 @@ describe("Pool", () => { }); describe("Permissions", () => { - describe("updatePoolCapacity", () => { + describe("updatePoolCapacity()", () => { it("reverts if not called by Pool Manager", async () => { const { pool, otherAccount } = await loadFixture(loadPoolFixture); @@ -138,7 +155,7 @@ describe("Pool", () => { }); }); - describe("updatePoolEndDate", () => { + describe("updatePoolEndDate()", () => { it("reverts if not called by Pool Manager", async () => { const { pool, otherAccount } = await loadFixture(loadPoolFixture); @@ -148,7 +165,7 @@ describe("Pool", () => { }); }); - describe("requestWithdrawal", () => { + describe("requestWithdrawal()", () => { it("reverts if not called by lender", async () => { const { pool, otherAccount } = await loadFixture(loadPoolFixture); @@ -158,7 +175,7 @@ describe("Pool", () => { }); }); - describe("fundLoan", () => { + describe("fundLoan()", () => { it("reverts if not called by Pool Manager", async () => { const { pool, otherAccount } = await loadFixture(loadPoolFixture); @@ -168,7 +185,7 @@ describe("Pool", () => { }); }); - describe("markLoanAsInDefault", () => { + describe("markLoanAsInDefault()", () => { it("reverts if not called by Pool Manager", async () => { const { pool, otherAccount } = await loadFixture(loadPoolFixture); @@ -178,12 +195,24 @@ describe("Pool", () => { }); }); - describe("supplyFirstLoss", () => { + describe("depositFirstLoss()", () => { + it("reverts if not called by Pool Manager", async () => { + const { pool, otherAccount } = await loadFixture(loadPoolFixture); + + await expect( + pool.connect(otherAccount).depositFirstLoss(100, otherAccount.address) + ).to.be.revertedWith("Pool: caller is not manager"); + }); + }); + + describe("withdrawFirstLoss()", () => { it("reverts if not called by Pool Manager", async () => { const { pool, otherAccount } = await loadFixture(loadPoolFixture); await expect( - pool.connect(otherAccount).supplyFirstLoss(100) + pool + .connect(otherAccount) + .withdrawFirstLoss(100, otherAccount.address) ).to.be.revertedWith("Pool: caller is not manager"); }); }); diff --git a/test/PoolLib.test.ts b/test/libraries/PoolLib.test.ts similarity index 66% rename from test/PoolLib.test.ts rename to test/libraries/PoolLib.test.ts index 68c3e414..b74d8e31 100644 --- a/test/PoolLib.test.ts +++ b/test/libraries/PoolLib.test.ts @@ -6,7 +6,7 @@ describe("PoolLib", () => { const FIRST_LOSS_AMOUNT = 100; async function deployFixture() { - const [caller, firstLossVault] = await ethers.getSigners(); + const [caller, otherAccount] = await ethers.getSigners(); const PoolLib = await ethers.getContractFactory("PoolLib"); const poolLib = await PoolLib.deploy(); @@ -27,6 +27,13 @@ describe("PoolLib", () => { const liquidityAsset = await LiquidityAsset.deploy("Test Coin", "TC"); await liquidityAsset.deployed(); + const FirstLossVault = await ethers.getContractFactory("FirstLossVault"); + const firstLossVault = await FirstLossVault.deploy( + poolLibWrapper.address, + liquidityAsset.address + ); + await liquidityAsset.deployed(); + await liquidityAsset.mint(caller.address, FIRST_LOSS_AMOUNT); await liquidityAsset .connect(caller) @@ -36,29 +43,33 @@ describe("PoolLib", () => { poolLibWrapper, caller, firstLossVault, - liquidityAsset + liquidityAsset, + otherAccount }; } - describe("executeFirstLossContribution()", async () => { + describe("executeFirstLossDeposit()", async () => { it("guards against transfers to null address", async () => { - const { poolLibWrapper, liquidityAsset } = await loadFixture( + const { poolLibWrapper, liquidityAsset, caller } = await loadFixture( deployFixture ); await expect( - poolLibWrapper.executeFirstLossContribution( - liquidityAsset.address, - FIRST_LOSS_AMOUNT, - ethers.constants.AddressZero, - 0, - 0 - ) + poolLibWrapper + .connect(caller) + .executeFirstLossDeposit( + liquidityAsset.address, + caller.address, + FIRST_LOSS_AMOUNT, + ethers.constants.AddressZero, + 0, + 0 + ) ).to.be.revertedWith("Pool: 0 address"); }); it("transfers liquidity to vault", async () => { - const { poolLibWrapper, liquidityAsset, firstLossVault } = + const { poolLibWrapper, liquidityAsset, firstLossVault, caller } = await loadFixture(deployFixture); // Confirm vault is empty @@ -67,14 +78,57 @@ describe("PoolLib", () => { ); expect( - await poolLibWrapper.executeFirstLossContribution( - liquidityAsset.address, - FIRST_LOSS_AMOUNT, - firstLossVault.address, - 0, - 0 - ) - ).to.emit(poolLibWrapper, "FirstLossSupplied"); + await poolLibWrapper + .connect(caller) + .executeFirstLossDeposit( + liquidityAsset.address, + caller.address, + FIRST_LOSS_AMOUNT, + firstLossVault.address, + 0, + 0 + ) + ).to.emit(poolLibWrapper, "FirstLossDeposited"); + + // Check balance of vault + expect(await liquidityAsset.balanceOf(firstLossVault.address)).to.equal( + FIRST_LOSS_AMOUNT + ); + }); + + it("transfers liquidity to vault from a supplier", async () => { + const { + poolLibWrapper, + liquidityAsset, + firstLossVault, + caller, + otherAccount + } = await loadFixture(deployFixture); + + // Transfer caller balance to another account + const callerBalance = await liquidityAsset.balanceOf(caller.address); + await liquidityAsset + .connect(caller) + .transfer(otherAccount.address, callerBalance); + expect(await liquidityAsset.balanceOf(caller.address)).to.equal(0); + + // Make approval from otherAccount + await liquidityAsset + .connect(otherAccount) + .approve(poolLibWrapper.address, callerBalance); + + expect( + await poolLibWrapper + .connect(caller) + .executeFirstLossDeposit( + liquidityAsset.address, + otherAccount.address, + FIRST_LOSS_AMOUNT, + firstLossVault.address, + 0, + 0 + ) + ).to.emit(poolLibWrapper, "FirstLossDeposited"); // Check balance of vault expect(await liquidityAsset.balanceOf(firstLossVault.address)).to.equal( @@ -83,12 +137,13 @@ describe("PoolLib", () => { }); it("graduates PoolLifeCycleState if threshold is met, and initial state is Initialized", async () => { - const { poolLibWrapper, liquidityAsset, firstLossVault } = + const { poolLibWrapper, liquidityAsset, firstLossVault, caller } = await loadFixture(deployFixture); expect( - await poolLibWrapper.executeFirstLossContribution( + await poolLibWrapper.connect(caller).executeFirstLossDeposit( liquidityAsset.address, + caller.address, FIRST_LOSS_AMOUNT, firstLossVault.address, 0, @@ -98,12 +153,13 @@ describe("PoolLib", () => { }); it("does not graduate PoolLifeCycleState if threshold is not met, and initial state is Initialized", async () => { - const { poolLibWrapper, liquidityAsset, firstLossVault } = + const { poolLibWrapper, liquidityAsset, firstLossVault, caller } = await loadFixture(deployFixture); expect( - await poolLibWrapper.executeFirstLossContribution( + await poolLibWrapper.executeFirstLossDeposit( liquidityAsset.address, + caller.address, FIRST_LOSS_AMOUNT, firstLossVault.address, 0, @@ -113,12 +169,13 @@ describe("PoolLib", () => { }); it("does not graduate PoolLifeCycleState if not in Initialized", async () => { - const { poolLibWrapper, liquidityAsset, firstLossVault } = + const { poolLibWrapper, liquidityAsset, firstLossVault, caller } = await loadFixture(deployFixture); expect( - await poolLibWrapper.executeFirstLossContribution( + await poolLibWrapper.executeFirstLossDeposit( liquidityAsset.address, + caller.address, FIRST_LOSS_AMOUNT, firstLossVault.address, 1, // Already active @@ -128,6 +185,35 @@ describe("PoolLib", () => { }); }); + describe("executeFirstLossWithdraw()", async () => { + it("transfers funds to receiver address", async () => { + const { poolLibWrapper, liquidityAsset, firstLossVault, otherAccount } = + await loadFixture(deployFixture); + + // Load up vault + const withdrawAmount = 1000; + await liquidityAsset.mint(firstLossVault.address, withdrawAmount); + + // Check balance prior + const receiverBalancePrior = await liquidityAsset.balanceOf( + otherAccount.address + ); + + expect( + await poolLibWrapper.executeFirstLossWithdraw( + withdrawAmount, + otherAccount.address, + firstLossVault.address + ) + ).to.emit(poolLibWrapper, "FirstLossWithdrawal"); + + // Check balance after + expect(await liquidityAsset.balanceOf(otherAccount.address)).to.equal( + receiverBalancePrior.add(withdrawAmount) + ); + }); + }); + describe("calculateNav()", async () => { it("deducts withdrawals from total assets", async () => { const { poolLibWrapper } = await loadFixture(deployFixture); From a3c7fc6884d45b1a6ee190c269efd3101f31cac2 Mon Sep 17 00:00:00 2001 From: Adrian Soghoian Date: Wed, 28 Sep 2022 19:07:07 -0400 Subject: [PATCH 2/4] Update comment. --- contracts/interfaces/IPool.sol | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/contracts/interfaces/IPool.sol b/contracts/interfaces/IPool.sol index a52f02d6..0ec5960f 100644 --- a/contracts/interfaces/IPool.sol +++ b/contracts/interfaces/IPool.sol @@ -109,7 +109,7 @@ interface IPool is IERC4626 { function depositFirstLoss(uint256 amount, address spender) external; /** - * @dev Withdraws first-loss to the pool. Can only be called by the Pool Manager. + * @dev Withdraws first-loss from the pool. Can only be called by the Pool Manager. */ function withdrawFirstLoss(uint256 amount, address receiver) external From 0ef19c49bb1680192f6e4371ad3240eea9d67ac7 Mon Sep 17 00:00:00 2001 From: Adrian Soghoian Date: Wed, 28 Sep 2022 19:10:19 -0400 Subject: [PATCH 3/4] Fix bad reference in test --- test/libraries/PoolLib.test.ts | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/test/libraries/PoolLib.test.ts b/test/libraries/PoolLib.test.ts index b74d8e31..0ffd3fca 100644 --- a/test/libraries/PoolLib.test.ts +++ b/test/libraries/PoolLib.test.ts @@ -27,17 +27,17 @@ describe("PoolLib", () => { const liquidityAsset = await LiquidityAsset.deploy("Test Coin", "TC"); await liquidityAsset.deployed(); + await liquidityAsset.mint(caller.address, FIRST_LOSS_AMOUNT); + await liquidityAsset + .connect(caller) + .approve(poolLibWrapper.address, FIRST_LOSS_AMOUNT); + const FirstLossVault = await ethers.getContractFactory("FirstLossVault"); const firstLossVault = await FirstLossVault.deploy( poolLibWrapper.address, liquidityAsset.address ); - await liquidityAsset.deployed(); - - await liquidityAsset.mint(caller.address, FIRST_LOSS_AMOUNT); - await liquidityAsset - .connect(caller) - .approve(poolLibWrapper.address, FIRST_LOSS_AMOUNT); + await firstLossVault.deployed(); return { poolLibWrapper, From aa3e7df81f503fb08c39f59d836842654dacd48c Mon Sep 17 00:00:00 2001 From: Adrian Soghoian Date: Thu, 29 Sep 2022 10:02:18 -0400 Subject: [PATCH 4/4] Post rebase fixes --- test/Pool.test.ts | 4 ++-- test/support/pool.ts | 4 +++- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/test/Pool.test.ts b/test/Pool.test.ts index 9769ce6e..4804bf70 100644 --- a/test/Pool.test.ts +++ b/test/Pool.test.ts @@ -73,7 +73,7 @@ describe("Pool", () => { await pool .connect(poolManager) .depositFirstLoss(firstLossAmount, poolManager.address) - ).to.emit(pool.address, "FirstLossSupplied"); + ).to.emit(pool.address, "FirstLossDeposited"); // Check balance expect(await pool.firstLoss()).to.equal(firstLossAmount); @@ -119,7 +119,7 @@ describe("Pool", () => { await pool .connect(poolManager) .depositFirstLoss( - POOL_SETTINGS.firstLossInitialMinimum, + DEFAULT_POOL_SETTINGS.firstLossInitialMinimum, poolManager.address ); diff --git a/test/support/pool.ts b/test/support/pool.ts index 97495f5d..acfd60b3 100644 --- a/test/support/pool.ts +++ b/test/support/pool.ts @@ -60,7 +60,9 @@ export async function deployActivePool( .connect(poolManager) .approve(pool.address, firstLossInitialMinimum); - await pool.connect(poolManager).supplyFirstLoss(firstLossInitialMinimum); + await pool + .connect(poolManager) + .depositFirstLoss(firstLossInitialMinimum, poolManager.address); return { pool, liquidityAsset }; }