Skip to content

Commit 9b0efde

Browse files
authored
Merge pull request #68 from buttonwood-protocol/rem-l1-fix-cancel-withdrawal-checks
fix(rem-l1): adding check in lender-queue to prevent double cancellation
2 parents 5219530 + 1ff7c07 commit 9b0efde

2 files changed

Lines changed: 9 additions & 0 deletions

File tree

src/LenderQueue.sol

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -191,6 +191,9 @@ abstract contract LenderQueue is Context, ERC165, AccessControl, ILenderQueue, R
191191
// Burn the excess shares that correspond to forfeited yield while the request was in the queue
192192
if (request.shares > 0 && request.amount > 0) {
193193
IConsol(consol).burnExcessShares(request.shares, request.amount);
194+
} else {
195+
// It's not possible to reach this point if the request has already been processed, so it must have been cancelled
196+
revert RequestAlreadyCancelled(index);
194197
}
195198

196199
// Transfer the request.amount of Consols back to the request owner's Account

src/interfaces/ILenderQueue/ILenderQueueErrors.sol

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,4 +55,10 @@ interface ILenderQueueErrors {
5555
* @param caller The caller of the function
5656
*/
5757
error CallerIsNotRequestAccount(address requestAccount, address caller);
58+
59+
/**
60+
* @notice The withdrawal request has already been cancelled.
61+
* @param index The index of the withdrawal request
62+
*/
63+
error RequestAlreadyCancelled(uint256 index);
5864
}

0 commit comments

Comments
 (0)