Skip to content

Commit

Permalink
update 'available' calculation in withdraw
Browse files Browse the repository at this point in the history
  • Loading branch information
kyriediculous committed Oct 28, 2024
1 parent e3e0136 commit 4969ed3
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/lpETH/LpETH.sol
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,10 @@ contract LpETH is
}
Data storage $ = _loadStorageSlot();

uint256 available = ud(amount).mul(UNIT_60x18.sub(ud($.unlocking).div(ud($.liabilities)))).unwrap();
uint256 available = $.liabilities - $.unlocking;
if (available > amount) available = amount;

ud(amount).mul(UNIT_60x18.sub(ud($.unlocking).div(ud($.liabilities)))).unwrap();

if (available < amount && available > 0) {
requestId = $.withdrawQueue.createRequest(uint128(amount - available), payable(msg.sender));
Expand Down

0 comments on commit 4969ed3

Please sign in to comment.