From 2137b01d13cd7648ff4b43020bd534d0b565d3b9 Mon Sep 17 00:00:00 2001 From: ams9198 <111915188+ams9198@users.noreply.github.com> Date: Tue, 14 Feb 2023 14:12:08 -0500 Subject: [PATCH] [No ticket] Silence warning by removing extraneous variable (and test) (#180) --- contracts/controllers/WithdrawController.sol | 3 +-- contracts/libraries/PoolLib.sol | 9 +++++---- contracts/mocks/PoolLibTestWrapper.sol | 12 ++++++------ test/libraries/PoolLib.test.ts | 19 +------------------ test/scenarios/pool/withdraw-request.test.ts | 5 +++-- 5 files changed, 16 insertions(+), 32 deletions(-) diff --git a/contracts/controllers/WithdrawController.sol b/contracts/controllers/WithdrawController.sol index 9384dfec..7420d0c8 100644 --- a/contracts/controllers/WithdrawController.sol +++ b/contracts/controllers/WithdrawController.sol @@ -309,8 +309,7 @@ contract WithdrawController is IWithdrawController, BeaconImplementation { returns (uint256 maxShares) { maxShares = PoolLib.calculateMaxCancellation( - _currentWithdrawState(owner), - _pool.settings().requestCancellationFeeBps + _currentWithdrawState(owner) ); } diff --git a/contracts/libraries/PoolLib.sol b/contracts/libraries/PoolLib.sol index d7b284dc..36b6769d 100644 --- a/contracts/libraries/PoolLib.sol +++ b/contracts/libraries/PoolLib.sol @@ -542,10 +542,11 @@ library PoolLib { * @dev Calculates the Maximum amount of shares that can be cancelled * from the current withdraw request. */ - function calculateMaxCancellation( - IPoolWithdrawState memory state, - uint256 requestCancellationFeeBps - ) public pure returns (uint256) { + function calculateMaxCancellation(IPoolWithdrawState memory state) + public + pure + returns (uint256) + { return state.requestedShares + state.eligibleShares; } diff --git a/contracts/mocks/PoolLibTestWrapper.sol b/contracts/mocks/PoolLibTestWrapper.sol index fe3eb5eb..c45eb453 100644 --- a/contracts/mocks/PoolLibTestWrapper.sol +++ b/contracts/mocks/PoolLibTestWrapper.sol @@ -272,11 +272,11 @@ contract PoolLibTestWrapper is ERC20("PoolLibTest", "PLT") { ); } - function calculateMaxCancellation( - IPoolWithdrawState memory state, - uint256 requestCancellationFeeBps - ) public pure returns (uint256) { - return - PoolLib.calculateMaxCancellation(state, requestCancellationFeeBps); + function calculateMaxCancellation(IPoolWithdrawState memory state) + public + pure + returns (uint256) + { + return PoolLib.calculateMaxCancellation(state); } } diff --git a/test/libraries/PoolLib.test.ts b/test/libraries/PoolLib.test.ts index 417bec7b..2d287875 100644 --- a/test/libraries/PoolLib.test.ts +++ b/test/libraries/PoolLib.test.ts @@ -861,23 +861,6 @@ describe("PoolLib", () => { it("returns the number of shares the owner can cancel from a request", async () => { const { poolLibWrapper } = await loadFixture(deployFixture); - const fees = 0; - const withdrawState = buildWithdrawState({ - requestedShares: 50, - eligibleShares: 22, - redeemableShares: 28, - latestRequestPeriod: 2 - }); - - expect( - await poolLibWrapper.calculateMaxCancellation(withdrawState, fees) - ).to.equal(72); - }); - - it("returns the number of shares irrespective of fees ", async () => { - const { poolLibWrapper } = await loadFixture(deployFixture); - - const fees = 1200; // 12% const withdrawState = buildWithdrawState({ requestedShares: 50, eligibleShares: 22, @@ -886,7 +869,7 @@ describe("PoolLib", () => { }); expect( - await poolLibWrapper.calculateMaxCancellation(withdrawState, fees) + await poolLibWrapper.calculateMaxCancellation(withdrawState) ).to.equal(72); }); }); diff --git a/test/scenarios/pool/withdraw-request.test.ts b/test/scenarios/pool/withdraw-request.test.ts index c0254594..3f4c06ba 100644 --- a/test/scenarios/pool/withdraw-request.test.ts +++ b/test/scenarios/pool/withdraw-request.test.ts @@ -194,8 +194,9 @@ describe("Withdraw Requests", () => { }); it("allows canceling a full request balance", async () => { - const { pool, aliceLender, bobLender, withdrawController } = - await loadFixture(loadPoolFixture); + const { pool, aliceLender, withdrawController } = await loadFixture( + loadPoolFixture + ); // Alice requests full redemption await pool