Skip to content

Commit

Permalink
cache msg sender
Browse files Browse the repository at this point in the history
  • Loading branch information
zhongeric committed Dec 14, 2023
1 parent df5f006 commit 3cf69de
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 5 deletions.
2 changes: 1 addition & 1 deletion .forge-snapshots/poolManager bytecode size.snap
Original file line number Diff line number Diff line change
@@ -1 +1 @@
26357
26366
2 changes: 1 addition & 1 deletion .forge-snapshots/swap burn 6909 for input.snap
Original file line number Diff line number Diff line change
@@ -1 +1 @@
129161
129176
7 changes: 4 additions & 3 deletions src/PoolManager.sol
Original file line number Diff line number Diff line change
Expand Up @@ -349,10 +349,11 @@ contract PoolManager is IPoolManager, Fees, NoDelegateCall, Claims {
function burn(Currency currency, address from, uint256 amount) external override noDelegateCall onlyByLocker {
_accountDelta(currency, -(amount.toInt128()));
uint256 id = currency.toId();
if (from != msg.sender && !isOperator[from][msg.sender]) {
uint256 senderAllowance = allowance[from][msg.sender][id];
address sender = msg.sender;
if (from != sender && !isOperator[from][sender]) {
uint256 senderAllowance = allowance[from][sender][id];
if (senderAllowance != type(uint256).max) {
allowance[from][msg.sender][id] = senderAllowance - amount;
allowance[from][sender][id] = senderAllowance - amount;
}
}
_burn(from, id, amount);
Expand Down

0 comments on commit 3cf69de

Please sign in to comment.