Skip to content

Commit

Permalink
fix FullRange/TWAMM hook
Browse files Browse the repository at this point in the history
  • Loading branch information
snreynolds committed Dec 14, 2023
1 parent 18d68e8 commit fead64a
Show file tree
Hide file tree
Showing 6 changed files with 8 additions and 12 deletions.
2 changes: 1 addition & 1 deletion .forge-snapshots/FullRangeAddInitialLiquidity.snap
Original file line number Diff line number Diff line change
@@ -1 +1 @@
410731
410761
2 changes: 1 addition & 1 deletion .forge-snapshots/FullRangeAddLiquidity.snap
Original file line number Diff line number Diff line change
@@ -1 +1 @@
204653
204683
2 changes: 1 addition & 1 deletion .forge-snapshots/FullRangeRemoveLiquidity.snap
Original file line number Diff line number Diff line change
@@ -1 +1 @@
200027
200057
2 changes: 1 addition & 1 deletion .forge-snapshots/FullRangeRemoveLiquidityAndRebalance.snap
Original file line number Diff line number Diff line change
@@ -1 +1 @@
386065
386095
4 changes: 3 additions & 1 deletion contracts/hooks/examples/FullRange.sol
Original file line number Diff line number Diff line change
Expand Up @@ -299,12 +299,14 @@ contract FullRange is BaseHook, ILockCallback {
pool.hasAccruedFees = false;
}

function lockAcquired(address, /*sender*/ bytes calldata rawData)
function lockAcquired(address sender, bytes calldata rawData)
external
override(ILockCallback, BaseHook)
poolManagerOnly
returns (bytes memory)
{
// Now that manager can be called by EOAs with a lock target, it's necessary for lockAcquired to check the original sender if it wants to trust the data passed through.
if (sender != address(this)) revert SenderMustBeHook();
CallbackData memory data = abi.decode(rawData, (CallbackData));
BalanceDelta delta;

Expand Down
8 changes: 1 addition & 7 deletions contracts/hooks/examples/TWAMM.sol
Original file line number Diff line number Diff line change
Expand Up @@ -131,12 +131,6 @@ contract TWAMM is BaseHook, ITWAMM {
self.lastVirtualOrderTimestamp = block.timestamp;
}

struct CallbackData {
address sender;
PoolKey key;
IPoolManager.SwapParams params;
}

/// @inheritdoc ITWAMM
function executeTWAMMOrders(PoolKey memory key) public {
PoolId poolId = key.toId();
Expand Down Expand Up @@ -306,7 +300,7 @@ contract TWAMM is BaseHook, ITWAMM {
IERC20Minimal(Currency.unwrap(token)).safeTransfer(to, amountTransferred);
}

function lockAcquired(address sender, bytes calldata rawData)
function lockAcquired(address, /*sender*/ bytes calldata rawData)
external
override
poolManagerOnly
Expand Down

0 comments on commit fead64a

Please sign in to comment.