Skip to content

Commit

Permalink
[No ticket] Silence warning by removing extraneous variable (and test) (
Browse files Browse the repository at this point in the history
  • Loading branch information
ams9198 authored Feb 14, 2023
1 parent 18f71fb commit 2137b01
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 32 deletions.
3 changes: 1 addition & 2 deletions contracts/controllers/WithdrawController.sol
Original file line number Diff line number Diff line change
Expand Up @@ -309,8 +309,7 @@ contract WithdrawController is IWithdrawController, BeaconImplementation {
returns (uint256 maxShares)
{
maxShares = PoolLib.calculateMaxCancellation(
_currentWithdrawState(owner),
_pool.settings().requestCancellationFeeBps
_currentWithdrawState(owner)
);
}

Expand Down
9 changes: 5 additions & 4 deletions contracts/libraries/PoolLib.sol
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down
12 changes: 6 additions & 6 deletions contracts/mocks/PoolLibTestWrapper.sol
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}
19 changes: 1 addition & 18 deletions test/libraries/PoolLib.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -886,7 +869,7 @@ describe("PoolLib", () => {
});

expect(
await poolLibWrapper.calculateMaxCancellation(withdrawState, fees)
await poolLibWrapper.calculateMaxCancellation(withdrawState)
).to.equal(72);
});
});
Expand Down
5 changes: 3 additions & 2 deletions test/scenarios/pool/withdraw-request.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 2137b01

Please sign in to comment.