Skip to content

Commit

Permalink
chore: gas opti [G-04]
Browse files Browse the repository at this point in the history
  • Loading branch information
xenoliss committed Apr 2, 2024
1 parent 893fd40 commit 679589b
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/MagicSpend.sol
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,10 @@ contract MagicSpend is Ownable, IPaymaster {

// NOTE: Do not include the gas part in withdrawable funds because it is considered already consumed at this point.
// `postOp()` will refund the amout of gas that was not consumed.
_withdrawableETH[userOp.sender] += withdrawAmount - maxCost;
uint256 nonGasAmount = withdrawAmount - maxCost;
if (nonGasAmount > 0) {
_withdrawableETH[userOp.sender] += nonGasAmount;
}
context = abi.encode(maxCost, userOp.sender);
}

Expand Down

0 comments on commit 679589b

Please sign in to comment.