Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[No ticket] Silence warning by removing extraneous variable (and test) #180

Merged
merged 1 commit into from
Feb 14, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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