Skip to content

Commit ed12279

Browse files
committed
feat: remove duplicate isNative check
1 parent 69eebcd commit ed12279

3 files changed

Lines changed: 13 additions & 13 deletions

File tree

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
{
2-
"BinPositionManagerHelper size": "8610",
3-
"test_addLiquidities_existingPool": "1043905",
4-
"test_addLiquidities_existingPool_bobReceiver": "1043905",
5-
"test_addLiquidities_existingPool_nativeToken": "962157",
6-
"test_addLiquidities_newPool": "1167962",
7-
"test_addLiquidities_newPool_WithPermit": "1227012"
2+
"BinPositionManagerHelper size": "8601",
3+
"test_addLiquidities_existingPool": "1043871",
4+
"test_addLiquidities_existingPool_bobReceiver": "1043871",
5+
"test_addLiquidities_existingPool_nativeToken": "962140",
6+
"test_addLiquidities_newPool": "1167928",
7+
"test_addLiquidities_newPool_WithPermit": "1226978"
88
}

src/pool-bin/BinPositionManagerHelper.sol

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -128,12 +128,11 @@ contract BinPositionManagerHelper is Multicall, Permit2Forwarder, ReentrancyLock
128128
try binPoolManager.initialize(key, activeId) {} catch {}
129129
}
130130

131-
/// @dev Approve the bin position manager to spend the currency
131+
/// @notice Approve the bin position manager to spend the currency
132+
/// @dev assume currency is not native
132133
function _approveBinPm(Currency _currency, uint160 _amount) internal {
133-
if (!_currency.isNative()) {
134-
IERC20(Currency.unwrap(_currency)).approve(address(permit2), _amount);
135-
permit2.approve(Currency.unwrap(_currency), address(binPositionManager), _amount, uint48(block.timestamp));
136-
}
134+
IERC20(Currency.unwrap(_currency)).approve(address(permit2), _amount);
135+
permit2.approve(Currency.unwrap(_currency), address(binPositionManager), _amount, uint48(block.timestamp));
137136
}
138137

139138
function _getAddLiquidityParam(bytes calldata payload)

test/pool-bin/BinPositionManagerHelper.t.sol

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,6 @@ contract BinPositionManagerHelperTest is
6161

6262
bytes32 poolParam;
6363
address alice = makeAddr("alice");
64-
address bob = makeAddr("bob");
6564
uint24 activeId = 2 ** 23; // where token0 and token1 price is the same
6665

6766
function setUp() public {
@@ -164,8 +163,10 @@ contract BinPositionManagerHelperTest is
164163
assertEq(token1.balanceOf(alice), 1 ether); // initial 4 ether, then minus 3 ether added
165164
}
166165

167-
/// @dev mint to bob instead
166+
/// @dev mint to bob instead
168167
function test_addLiquidities_existingPool_bobReceiver() public {
168+
address bob = makeAddr("bob");
169+
169170
// before
170171
token0.mint(alice, 4 ether);
171172
token1.mint(alice, 4 ether);

0 commit comments

Comments
 (0)