Skip to content

Commit

Permalink
withdraw whatever left if req.amount > balance
Browse files Browse the repository at this point in the history
  • Loading branch information
Filipp Makarov authored and Filipp Makarov committed Oct 21, 2024
1 parent 09f243d commit 87756f1
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions contracts/sponsorship/BiconomySponsorshipPaymaster.sol
Original file line number Diff line number Diff line change
Expand Up @@ -177,8 +177,7 @@ contract BiconomySponsorshipPaymaster is
if (block.timestamp < clearanceTimestamp)
revert RequestNotClearedYet(clearanceTimestamp);
uint256 currentBalance = paymasterIdBalances[paymasterId];
if (req.amount > currentBalance)
revert InsufficientFundsInGasTank();
req.amount = req.amount > currentBalance ? currentBalance : req.amount;
paymasterIdBalances[paymasterId] = currentBalance - req.amount;
delete requests[paymasterId];
entryPoint.withdrawTo(payable(req.to), req.amount);
Expand Down

0 comments on commit 87756f1

Please sign in to comment.