Skip to content

Commit

Permalink
Simplify
Browse files Browse the repository at this point in the history
  • Loading branch information
duncancmt committed Jan 30, 2025
1 parent 23d5583 commit 90c5702
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions src/SettlerIntent.sol
Original file line number Diff line number Diff line change
Expand Up @@ -144,10 +144,8 @@ abstract contract SettlerIntent is Permit2PaymentIntent, SettlerMetaTxn {
// This is a very fancy way of writing:
// expectedPrevSlotValue = addNotRemove ? _SENTINEL_SOLVER : solver
// newPrevSlotValue = addNotRemove ? solver : solverSlotValue
// newSolverSlotValue = addNotRemove ? _SENTINEL_SOLVER : address(0)
let expectedPrevSlotValue := xor(solver, mul(xor(_SENTINEL_SOLVER, solver), addNotRemove))
let newPrevSlotValue := xor(solverSlotValue, mul(xor(solverSlotValue, solver), addNotRemove))
let newSolverSlotValue := addNotRemove

// Check that the value for `prev` matches the value for `solver`. If we are adding a
// new solver, then `prev` must be the last element of the list (it points at
Expand All @@ -159,7 +157,7 @@ abstract contract SettlerIntent is Permit2PaymentIntent, SettlerMetaTxn {
// `$[solver]` or it points `$[prev]` at `solver` and points `$[solver]` at
// `_SENTINEL_SOLVER`
sstore(prevSlot, newPrevSlotValue)
sstore(solverSlot, newSolverSlotValue)
sstore(solverSlot, addNotRemove)

// If any of the checks failed, revert. This check is deferred because it makes the
// contract substantially smaller.
Expand Down

0 comments on commit 90c5702

Please sign in to comment.