From baa1334dc916c5e1754a3f8db26ae2463893ad92 Mon Sep 17 00:00:00 2001 From: saucepoint Date: Fri, 10 May 2024 00:25:39 -0400 Subject: [PATCH] fix todo, use CurrencySettleTake --- contracts/hooks/examples/TWAMM.sol | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/contracts/hooks/examples/TWAMM.sol b/contracts/hooks/examples/TWAMM.sol index 87bb6bc9..a1fecdd6 100644 --- a/contracts/hooks/examples/TWAMM.sol +++ b/contracts/hooks/examples/TWAMM.sol @@ -314,22 +314,14 @@ contract TWAMM is BaseHook, ITWAMM { if (swapParams.zeroForOne) { if (delta.amount0() < 0) { - // TODO: use settle syntax when it supports transfers - // key.currency0.settle(poolManager, uint256(uint128(-delta.amount0())), false); - poolManager.sync(key.currency0); - key.currency0.transfer(address(poolManager), uint256(uint128(-delta.amount0()))); - poolManager.settle(key.currency0); + key.currency0.settle(poolManager, address(this), uint256(uint128(-delta.amount0())), false); } if (delta.amount1() > 0) { key.currency1.take(poolManager, address(this), uint256(uint128(delta.amount1())), false); } } else { if (delta.amount1() < 0) { - // TODO: use settle syntax when it supports transfers - // key.currency1.settle(poolManager, uint256(uint128(-delta.amount1())), false); - poolManager.sync(key.currency1); - key.currency1.transfer(address(poolManager), uint256(uint128(-delta.amount1()))); - poolManager.settle(key.currency1); + key.currency1.settle(poolManager, address(this), uint256(uint128(-delta.amount1())), false); } if (delta.amount0() > 0) { key.currency0.take(poolManager, address(this), uint256(uint128(delta.amount0())), false);