diff --git a/src/PositionDescriptor.sol b/src/PositionDescriptor.sol index 5dbbe151..05fb0cc2 100644 --- a/src/PositionDescriptor.sol +++ b/src/PositionDescriptor.sol @@ -2,13 +2,13 @@ pragma solidity 0.8.26; import {IPoolManager} from "@uniswap/v4-core/src/interfaces/IPoolManager.sol"; -import {Currency, CurrencyLibrary} from "@uniswap/v4-core/src/types/Currency.sol"; +import {Currency} from "@uniswap/v4-core/src/types/Currency.sol"; import {StateLibrary} from "@uniswap/v4-core/src/libraries/StateLibrary.sol"; import {PoolKey} from "@uniswap/v4-core/src/types/PoolKey.sol"; -import {PoolId, PoolIdLibrary} from "@uniswap/v4-core/src/types/PoolId.sol"; +import {PoolId} from "@uniswap/v4-core/src/types/PoolId.sol"; import {IPositionManager} from "./interfaces/IPositionManager.sol"; import {IPositionDescriptor} from "./interfaces/IPositionDescriptor.sol"; -import {PositionInfo, PositionInfoLibrary} from "./libraries/PositionInfoLibrary.sol"; +import {PositionInfo} from "./libraries/PositionInfoLibrary.sol"; import {Descriptor} from "./libraries/Descriptor.sol"; import {CurrencyRatioSortOrder} from "./libraries/CurrencyRatioSortOrder.sol"; import {SafeCurrencyMetadata} from "./libraries/SafeCurrencyMetadata.sol"; @@ -17,9 +17,6 @@ import {SafeCurrencyMetadata} from "./libraries/SafeCurrencyMetadata.sol"; /// @notice Produces a string containing the data URI for a JSON metadata string contract PositionDescriptor is IPositionDescriptor { using StateLibrary for IPoolManager; - using PoolIdLibrary for PoolKey; - using CurrencyLibrary for Currency; - using PositionInfoLibrary for PositionInfo; // mainnet addresses address private constant DAI = 0x6B175474E89094C44Da98b954EedeAC495271d0F; diff --git a/src/PositionManager.sol b/src/PositionManager.sol index 291f86f2..583701ca 100644 --- a/src/PositionManager.sol +++ b/src/PositionManager.sol @@ -3,7 +3,6 @@ pragma solidity 0.8.26; import {IPoolManager} from "@uniswap/v4-core/src/interfaces/IPoolManager.sol"; import {PoolKey} from "@uniswap/v4-core/src/types/PoolKey.sol"; -import {PoolIdLibrary} from "@uniswap/v4-core/src/types/PoolId.sol"; import {Currency, CurrencyLibrary} from "@uniswap/v4-core/src/types/Currency.sol"; import {BalanceDelta} from "@uniswap/v4-core/src/types/BalanceDelta.sol"; import {SafeCast} from "@uniswap/v4-core/src/libraries/SafeCast.sol"; @@ -109,14 +108,12 @@ contract PositionManager is Permit2Forwarder, NativeWrapper { - using PoolIdLibrary for PoolKey; using StateLibrary for IPoolManager; using TransientStateLibrary for IPoolManager; using SafeCast for uint256; using SafeCast for int256; using CalldataDecoder for bytes; using SlippageCheck for BalanceDelta; - using PositionInfoLibrary for PositionInfo; /// @inheritdoc IPositionManager /// @dev The ID of the next token that will be minted. Skips 0 diff --git a/src/V4Router.sol b/src/V4Router.sol index e149da21..1def436e 100644 --- a/src/V4Router.sol +++ b/src/V4Router.sol @@ -8,7 +8,7 @@ import {Currency} from "@uniswap/v4-core/src/types/Currency.sol"; import {TickMath} from "@uniswap/v4-core/src/libraries/TickMath.sol"; import {SafeCast} from "@uniswap/v4-core/src/libraries/SafeCast.sol"; -import {PathKey, PathKeyLibrary} from "./libraries/PathKey.sol"; +import {PathKey} from "./libraries/PathKey.sol"; import {CalldataDecoder} from "./libraries/CalldataDecoder.sol"; import {IV4Router} from "./interfaces/IV4Router.sol"; import {BaseActionsRouter} from "./base/BaseActionsRouter.sol"; @@ -23,7 +23,6 @@ import {BipsLibrary} from "./libraries/BipsLibrary.sol"; /// An inheriting contract should call _executeActions at the point that they wish actions to be executed abstract contract V4Router is IV4Router, BaseActionsRouter, DeltaResolver { using SafeCast for *; - using PathKeyLibrary for PathKey; using CalldataDecoder for bytes; using BipsLibrary for uint256; diff --git a/src/base/BaseV4Quoter.sol b/src/base/BaseV4Quoter.sol index 55e57742..3eb36b91 100644 --- a/src/base/BaseV4Quoter.sol +++ b/src/base/BaseV4Quoter.sol @@ -6,12 +6,11 @@ import {BalanceDelta} from "@uniswap/v4-core/src/types/BalanceDelta.sol"; import {PoolKey} from "@uniswap/v4-core/src/types/PoolKey.sol"; import {QuoterRevert} from "../libraries/QuoterRevert.sol"; import {SafeCallback} from "../base/SafeCallback.sol"; -import {PoolId, PoolIdLibrary} from "@uniswap/v4-core/src/types/PoolId.sol"; +import {PoolId} from "@uniswap/v4-core/src/types/PoolId.sol"; import {TickMath} from "@uniswap/v4-core/src/libraries/TickMath.sol"; abstract contract BaseV4Quoter is SafeCallback { using QuoterRevert for *; - using PoolIdLibrary for PoolId; error NotEnoughLiquidity(PoolId poolId); error NotSelf(); diff --git a/src/lens/V4Quoter.sol b/src/lens/V4Quoter.sol index 9adc0bf3..773a1bd0 100644 --- a/src/lens/V4Quoter.sol +++ b/src/lens/V4Quoter.sol @@ -7,7 +7,7 @@ import {Currency} from "@uniswap/v4-core/src/types/Currency.sol"; import {PoolKey} from "@uniswap/v4-core/src/types/PoolKey.sol"; import {StateLibrary} from "@uniswap/v4-core/src/libraries/StateLibrary.sol"; import {IV4Quoter} from "../interfaces/IV4Quoter.sol"; -import {PathKey, PathKeyLibrary} from "../libraries/PathKey.sol"; +import {PathKey} from "../libraries/PathKey.sol"; import {QuoterRevert} from "../libraries/QuoterRevert.sol"; import {BaseV4Quoter} from "../base/BaseV4Quoter.sol"; @@ -17,7 +17,6 @@ import {BaseV4Quoter} from "../base/BaseV4Quoter.sol"; /// @dev These functions are not marked view because they rely on calling non-view functions and reverting /// to compute the result. They are also not gas efficient and should not be called on-chain. contract V4Quoter is IV4Quoter, BaseV4Quoter { - using PathKeyLibrary for PathKey; using QuoterRevert for *; constructor(IPoolManager _poolManager) BaseV4Quoter(_poolManager) {} diff --git a/src/libraries/PathKey.sol b/src/libraries/PathKey.sol index daa2fdd0..b6902db3 100644 --- a/src/libraries/PathKey.sol +++ b/src/libraries/PathKey.sol @@ -13,6 +13,8 @@ struct PathKey { bytes hookData; } +using PathKeyLibrary for PathKey global; + /// @title PathKey Library /// @notice Functions for working with PathKeys library PathKeyLibrary { diff --git a/src/libraries/PositionInfoLibrary.sol b/src/libraries/PositionInfoLibrary.sol index 2baba26a..85650585 100644 --- a/src/libraries/PositionInfoLibrary.sol +++ b/src/libraries/PositionInfoLibrary.sol @@ -2,7 +2,7 @@ pragma solidity ^0.8.24; import {PoolKey} from "@uniswap/v4-core/src/types/PoolKey.sol"; -import {PoolId, PoolIdLibrary} from "@uniswap/v4-core/src/types/PoolId.sol"; +import {PoolId} from "@uniswap/v4-core/src/types/PoolId.sol"; /** * @dev PositionInfo is a packed version of solidity structure. @@ -30,9 +30,9 @@ import {PoolId, PoolIdLibrary} from "@uniswap/v4-core/src/types/PoolId.sol"; */ type PositionInfo is uint256; -library PositionInfoLibrary { - using PoolIdLibrary for PoolKey; +using PositionInfoLibrary for PositionInfo global; +library PositionInfoLibrary { PositionInfo internal constant EMPTY_POSITION_INFO = PositionInfo.wrap(0); uint256 internal constant MASK_UPPER_200_BITS = 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF00000000000000; diff --git a/test/BaseActionsRouter.t.sol b/test/BaseActionsRouter.t.sol index 33a39add..a411dbc1 100644 --- a/test/BaseActionsRouter.t.sol +++ b/test/BaseActionsRouter.t.sol @@ -10,8 +10,6 @@ import {Test} from "forge-std/Test.sol"; import {Deployers} from "@uniswap/v4-core/test/utils/Deployers.sol"; contract BaseActionsRouterTest is Test, Deployers { - using Planner for Plan; - MockBaseActionsRouter router; function setUp() public { diff --git a/test/DeltaResolver.t.sol b/test/DeltaResolver.t.sol index e1f1ce6a..8dc620c5 100644 --- a/test/DeltaResolver.t.sol +++ b/test/DeltaResolver.t.sol @@ -10,8 +10,6 @@ import {ERC20} from "solmate/src/tokens/ERC20.sol"; import {MockDeltaResolver} from "./mocks/MockDeltaResolver.sol"; contract DeltaResolverTest is Test, Deployers { - using CurrencyLibrary for Currency; - MockDeltaResolver resolver; function setUp() public { diff --git a/test/PositionDescriptor.t.sol b/test/PositionDescriptor.t.sol index 824cc79d..b215306b 100644 --- a/test/PositionDescriptor.t.sol +++ b/test/PositionDescriptor.t.sol @@ -18,7 +18,6 @@ import {Descriptor} from "../src/libraries/Descriptor.sol"; contract PositionDescriptorTest is Test, PosmTestSetup { using Base64 for string; - using CurrencyLibrary for Currency; address public WETH9 = 0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2; address public DAI = 0x6B175474E89094C44Da98b954EedeAC495271d0F; diff --git a/test/StateViewTest.t.sol b/test/StateViewTest.t.sol index 41f5e79f..7a844b3d 100644 --- a/test/StateViewTest.t.sol +++ b/test/StateViewTest.t.sol @@ -10,8 +10,8 @@ import {TickMath} from "@uniswap/v4-core/src/libraries/TickMath.sol"; import {IPoolManager} from "@uniswap/v4-core/src/interfaces/IPoolManager.sol"; import {PoolKey} from "@uniswap/v4-core/src/types/PoolKey.sol"; import {BalanceDelta} from "@uniswap/v4-core/src/types/BalanceDelta.sol"; -import {PoolId, PoolIdLibrary} from "@uniswap/v4-core/src/types/PoolId.sol"; -import {CurrencyLibrary, Currency} from "@uniswap/v4-core/src/types/Currency.sol"; +import {PoolId} from "@uniswap/v4-core/src/types/PoolId.sol"; +import {Currency} from "@uniswap/v4-core/src/types/Currency.sol"; import {Pool} from "@uniswap/v4-core/src/libraries/Pool.sol"; import {TickBitmap} from "@uniswap/v4-core/src/libraries/TickBitmap.sol"; import {FixedPoint128} from "@uniswap/v4-core/src/libraries/FixedPoint128.sol"; @@ -23,7 +23,6 @@ import {Deploy, IStateView} from "./shared/Deploy.sol"; /// This test was taken from StateLibrary.t.sol in v4-core and adapted to use the StateView contract instead. contract StateViewTest is Test, Deployers, Fuzzers { using FixedPointMathLib for uint256; - using PoolIdLibrary for PoolKey; PoolId poolId; diff --git a/test/V4Quoter.t.sol b/test/V4Quoter.t.sol index 1c0fd5d1..c32c0ba5 100644 --- a/test/V4Quoter.t.sol +++ b/test/V4Quoter.t.sol @@ -13,7 +13,7 @@ import {SafeCast} from "@uniswap/v4-core/src/libraries/SafeCast.sol"; import {Deployers} from "@uniswap/v4-core/test/utils/Deployers.sol"; import {IHooks} from "@uniswap/v4-core/src/interfaces/IHooks.sol"; import {PoolModifyLiquidityTest} from "@uniswap/v4-core/src/test/PoolModifyLiquidityTest.sol"; -import {PoolId, PoolIdLibrary} from "@uniswap/v4-core/src/types/PoolId.sol"; +import {PoolId} from "@uniswap/v4-core/src/types/PoolId.sol"; import {PoolKey} from "@uniswap/v4-core/src/types/PoolKey.sol"; import {IPoolManager} from "@uniswap/v4-core/src/interfaces/IPoolManager.sol"; import {Currency} from "@uniswap/v4-core/src/types/Currency.sol"; @@ -25,7 +25,6 @@ import {MockERC20} from "solmate/src/test/utils/mocks/MockERC20.sol"; contract QuoterTest is Test, Deployers { using SafeCast for *; - using PoolIdLibrary for PoolKey; using StateLibrary for IPoolManager; // Min tick for full range with tick spacing of 60 diff --git a/test/libraries/PositionInfoLibrary.t.sol b/test/libraries/PositionInfoLibrary.t.sol index 12af5015..877f8ba7 100644 --- a/test/libraries/PositionInfoLibrary.t.sol +++ b/test/libraries/PositionInfoLibrary.t.sol @@ -3,13 +3,9 @@ pragma solidity ^0.8.24; import "forge-std/Test.sol"; import {PoolKey} from "@uniswap/v4-core/src/types/PoolKey.sol"; -import {PoolIdLibrary} from "@uniswap/v4-core/src/types/PoolId.sol"; import {PositionInfo, PositionInfoLibrary, PoolId} from "../../src/libraries/PositionInfoLibrary.sol"; contract PositionInfoLibraryTest is Test { - using PositionInfoLibrary for PositionInfo; - using PoolIdLibrary for PoolKey; - function setUp() public {} function test_fuzz_initialize(PoolKey memory poolKey, int24 tickLower, int24 tickUpper) public pure { diff --git a/test/mocks/MockDeltaResolver.sol b/test/mocks/MockDeltaResolver.sol index 6de67fbb..514379ce 100644 --- a/test/mocks/MockDeltaResolver.sol +++ b/test/mocks/MockDeltaResolver.sol @@ -1,7 +1,7 @@ // SPDX-License-Identifier: MIT pragma solidity ^0.8.24; -import {Currency, CurrencyLibrary} from "@uniswap/v4-core/src/types/Currency.sol"; +import {Currency} from "@uniswap/v4-core/src/types/Currency.sol"; import {IPoolManager} from "@uniswap/v4-core/src/interfaces/IPoolManager.sol"; import {IUnlockCallback} from "@uniswap/v4-core/src/interfaces/callback/IUnlockCallback.sol"; import {DeltaResolver} from "../../src/base/DeltaResolver.sol"; @@ -10,8 +10,6 @@ import {ERC20} from "solmate/src/tokens/ERC20.sol"; import {Test} from "forge-std/Test.sol"; contract MockDeltaResolver is Test, DeltaResolver, IUnlockCallback { - using CurrencyLibrary for Currency; - uint256 public payCallCount; constructor(IPoolManager _poolManager) ImmutableState(_poolManager) {} diff --git a/test/mocks/MockV4Router.sol b/test/mocks/MockV4Router.sol index fc935bb3..dcd2f243 100644 --- a/test/mocks/MockV4Router.sol +++ b/test/mocks/MockV4Router.sol @@ -2,7 +2,7 @@ pragma solidity ^0.8.19; import {IPoolManager} from "@uniswap/v4-core/src/interfaces/IPoolManager.sol"; -import {Currency, CurrencyLibrary} from "@uniswap/v4-core/src/types/Currency.sol"; +import {Currency} from "@uniswap/v4-core/src/types/Currency.sol"; import {V4Router} from "../../src/V4Router.sol"; import {ReentrancyLock} from "../../src/base/ReentrancyLock.sol"; import {SafeTransferLib} from "solmate/src/utils/SafeTransferLib.sol"; @@ -10,7 +10,6 @@ import {ERC20} from "solmate/src/tokens/ERC20.sol"; contract MockV4Router is V4Router, ReentrancyLock { using SafeTransferLib for *; - using CurrencyLibrary for Currency; constructor(IPoolManager _poolManager) V4Router(_poolManager) {} diff --git a/test/position-managers/Execute.t.sol b/test/position-managers/Execute.t.sol index f9eea6a2..935c4682 100644 --- a/test/position-managers/Execute.t.sol +++ b/test/position-managers/Execute.t.sol @@ -5,8 +5,8 @@ import "forge-std/Test.sol"; import {PoolManager} from "@uniswap/v4-core/src/PoolManager.sol"; import {IPoolManager} from "@uniswap/v4-core/src/interfaces/IPoolManager.sol"; import {IHooks} from "@uniswap/v4-core/src/interfaces/IHooks.sol"; -import {Currency, CurrencyLibrary} from "@uniswap/v4-core/src/types/Currency.sol"; -import {PoolId, PoolIdLibrary} from "@uniswap/v4-core/src/types/PoolId.sol"; +import {Currency} from "@uniswap/v4-core/src/types/Currency.sol"; +import {PoolId} from "@uniswap/v4-core/src/types/PoolId.sol"; import {PoolKey} from "@uniswap/v4-core/src/types/PoolKey.sol"; import {BalanceDelta} from "@uniswap/v4-core/src/types/BalanceDelta.sol"; import {FixedPointMathLib} from "solmate/src/utils/FixedPointMathLib.sol"; @@ -29,9 +29,6 @@ import {PosmTestSetup} from "../shared/PosmTestSetup.sol"; contract ExecuteTest is Test, PosmTestSetup, LiquidityFuzzers { using FixedPointMathLib for uint256; - using CurrencyLibrary for Currency; - using PoolIdLibrary for PoolKey; - using Planner for Plan; using StateLibrary for IPoolManager; PoolId poolId; diff --git a/test/position-managers/FeeCollection.t.sol b/test/position-managers/FeeCollection.t.sol index 16976301..39a7a2b8 100644 --- a/test/position-managers/FeeCollection.t.sol +++ b/test/position-managers/FeeCollection.t.sol @@ -5,7 +5,7 @@ import "forge-std/Test.sol"; import {PoolManager} from "@uniswap/v4-core/src/PoolManager.sol"; import {IPoolManager} from "@uniswap/v4-core/src/interfaces/IPoolManager.sol"; import {IHooks} from "@uniswap/v4-core/src/interfaces/IHooks.sol"; -import {Currency, CurrencyLibrary} from "@uniswap/v4-core/src/types/Currency.sol"; +import {Currency} from "@uniswap/v4-core/src/types/Currency.sol"; import {PoolId, PoolIdLibrary} from "@uniswap/v4-core/src/types/PoolId.sol"; import {PoolKey} from "@uniswap/v4-core/src/types/PoolKey.sol"; import {BalanceDelta} from "@uniswap/v4-core/src/types/BalanceDelta.sol"; @@ -22,7 +22,6 @@ import {IPositionManager} from "../../src/interfaces/IPositionManager.sol"; contract FeeCollectionTest is Test, PosmTestSetup, LiquidityFuzzers { using FixedPointMathLib for uint256; - using CurrencyLibrary for Currency; using FeeMath for IPositionManager; PoolId poolId; diff --git a/test/position-managers/IncreaseLiquidity.t.sol b/test/position-managers/IncreaseLiquidity.t.sol index bfda58e7..41279326 100644 --- a/test/position-managers/IncreaseLiquidity.t.sol +++ b/test/position-managers/IncreaseLiquidity.t.sol @@ -5,8 +5,8 @@ import "forge-std/Test.sol"; import {PoolManager} from "@uniswap/v4-core/src/PoolManager.sol"; import {IPoolManager} from "@uniswap/v4-core/src/interfaces/IPoolManager.sol"; import {IHooks} from "@uniswap/v4-core/src/interfaces/IHooks.sol"; -import {Currency, CurrencyLibrary} from "@uniswap/v4-core/src/types/Currency.sol"; -import {PoolId, PoolIdLibrary} from "@uniswap/v4-core/src/types/PoolId.sol"; +import {Currency} from "@uniswap/v4-core/src/types/Currency.sol"; +import {PoolId} from "@uniswap/v4-core/src/types/PoolId.sol"; import {PoolKey} from "@uniswap/v4-core/src/types/PoolKey.sol"; import {BalanceDelta} from "@uniswap/v4-core/src/types/BalanceDelta.sol"; import {LiquidityAmounts} from "@uniswap/v4-core/test/utils/LiquidityAmounts.sol"; @@ -31,9 +31,6 @@ import {ActionConstants} from "../../src/libraries/ActionConstants.sol"; contract IncreaseLiquidityTest is Test, PosmTestSetup, Fuzzers { using FixedPointMathLib for uint256; - using CurrencyLibrary for Currency; - using PoolIdLibrary for PoolKey; - using Planner for Plan; using FeeMath for IPositionManager; using StateLibrary for IPoolManager; diff --git a/test/position-managers/NativeToken.t.sol b/test/position-managers/NativeToken.t.sol index 2d7ef94e..e8663793 100644 --- a/test/position-managers/NativeToken.t.sol +++ b/test/position-managers/NativeToken.t.sol @@ -7,7 +7,7 @@ import {IPoolManager} from "@uniswap/v4-core/src/interfaces/IPoolManager.sol"; import {IHooks} from "@uniswap/v4-core/src/interfaces/IHooks.sol"; import {Deployers} from "@uniswap/v4-core/test/utils/Deployers.sol"; import {Currency, CurrencyLibrary} from "@uniswap/v4-core/src/types/Currency.sol"; -import {PoolId, PoolIdLibrary} from "@uniswap/v4-core/src/types/PoolId.sol"; +import {PoolId} from "@uniswap/v4-core/src/types/PoolId.sol"; import {PoolKey} from "@uniswap/v4-core/src/types/PoolKey.sol"; import {BalanceDelta, toBalanceDelta} from "@uniswap/v4-core/src/types/BalanceDelta.sol"; import {PoolSwapTest} from "@uniswap/v4-core/src/test/PoolSwapTest.sol"; @@ -35,9 +35,6 @@ import {PositionConfig} from "../shared/PositionConfig.sol"; contract PositionManagerTest is Test, PosmTestSetup, LiquidityFuzzers { using FixedPointMathLib for uint256; - using CurrencyLibrary for Currency; - using Planner for Plan; - using PoolIdLibrary for PoolKey; using StateLibrary for IPoolManager; using SafeCast for *; diff --git a/test/position-managers/Permit.t.sol b/test/position-managers/Permit.t.sol index e60c1d27..253cfbe3 100644 --- a/test/position-managers/Permit.t.sol +++ b/test/position-managers/Permit.t.sol @@ -5,8 +5,8 @@ import "forge-std/Test.sol"; import {PoolManager} from "@uniswap/v4-core/src/PoolManager.sol"; import {IPoolManager} from "@uniswap/v4-core/src/interfaces/IPoolManager.sol"; import {IHooks} from "@uniswap/v4-core/src/interfaces/IHooks.sol"; -import {Currency, CurrencyLibrary} from "@uniswap/v4-core/src/types/Currency.sol"; -import {PoolId, PoolIdLibrary} from "@uniswap/v4-core/src/types/PoolId.sol"; +import {Currency} from "@uniswap/v4-core/src/types/Currency.sol"; +import {PoolId} from "@uniswap/v4-core/src/types/PoolId.sol"; import {PoolKey} from "@uniswap/v4-core/src/types/PoolKey.sol"; import {FixedPointMathLib} from "solmate/src/utils/FixedPointMathLib.sol"; import {StateLibrary} from "@uniswap/v4-core/src/libraries/StateLibrary.sol"; @@ -24,8 +24,6 @@ import {PosmTestSetup} from "../shared/PosmTestSetup.sol"; contract PermitTest is Test, PosmTestSetup { using FixedPointMathLib for uint256; - using CurrencyLibrary for Currency; - using PoolIdLibrary for PoolKey; using StateLibrary for IPoolManager; PoolId poolId; diff --git a/test/position-managers/PositionManager.gas.t.sol b/test/position-managers/PositionManager.gas.t.sol index 3b0e8dd7..3b60cff0 100644 --- a/test/position-managers/PositionManager.gas.t.sol +++ b/test/position-managers/PositionManager.gas.t.sol @@ -6,7 +6,7 @@ import {PoolManager} from "@uniswap/v4-core/src/PoolManager.sol"; import {IPoolManager} from "@uniswap/v4-core/src/interfaces/IPoolManager.sol"; import {IHooks} from "@uniswap/v4-core/src/interfaces/IHooks.sol"; import {Currency, CurrencyLibrary} from "@uniswap/v4-core/src/types/Currency.sol"; -import {PoolId, PoolIdLibrary} from "@uniswap/v4-core/src/types/PoolId.sol"; +import {PoolId} from "@uniswap/v4-core/src/types/PoolId.sol"; import {PoolKey} from "@uniswap/v4-core/src/types/PoolKey.sol"; import {LiquidityAmounts} from "@uniswap/v4-core/test/utils/LiquidityAmounts.sol"; import {TickMath} from "@uniswap/v4-core/src/libraries/TickMath.sol"; @@ -26,9 +26,6 @@ import {MockSubscriber} from "../mocks/MockSubscriber.sol"; contract PosMGasTest is Test, PosmTestSetup { using FixedPointMathLib for uint256; - using CurrencyLibrary for Currency; - using PoolIdLibrary for PoolKey; - using Planner for Plan; PoolId poolId; address alice; diff --git a/test/position-managers/PositionManager.modifyLiquidities.t.sol b/test/position-managers/PositionManager.modifyLiquidities.t.sol index f2e5674e..58392a9f 100644 --- a/test/position-managers/PositionManager.modifyLiquidities.t.sol +++ b/test/position-managers/PositionManager.modifyLiquidities.t.sol @@ -11,7 +11,7 @@ import {IPoolManager} from "@uniswap/v4-core/src/interfaces/IPoolManager.sol"; import {IHooks} from "@uniswap/v4-core/src/interfaces/IHooks.sol"; import {Hooks} from "@uniswap/v4-core/src/libraries/Hooks.sol"; import {Currency, CurrencyLibrary} from "@uniswap/v4-core/src/types/Currency.sol"; -import {PoolId, PoolIdLibrary} from "@uniswap/v4-core/src/types/PoolId.sol"; +import {PoolId} from "@uniswap/v4-core/src/types/PoolId.sol"; import {PoolKey} from "@uniswap/v4-core/src/types/PoolKey.sol"; import {BalanceDelta} from "@uniswap/v4-core/src/types/BalanceDelta.sol"; import {StateLibrary} from "@uniswap/v4-core/src/libraries/StateLibrary.sol"; @@ -34,14 +34,11 @@ import {LiquidityFuzzers} from "../shared/fuzz/LiquidityFuzzers.sol"; import {Planner, Plan} from "../shared/Planner.sol"; import {PosmTestSetup} from "../shared/PosmTestSetup.sol"; import {ActionConstants} from "../../src/libraries/ActionConstants.sol"; -import {Planner, Plan} from "../shared/Planner.sol"; import {DeltaResolver} from "../../src/base/DeltaResolver.sol"; import {MockFOT} from "../mocks/MockFeeOnTransfer.sol"; contract PositionManagerModifyLiquiditiesTest is Test, PosmTestSetup, LiquidityFuzzers { using StateLibrary for IPoolManager; - using PoolIdLibrary for PoolKey; - using Planner for Plan; using BipsLibrary for uint256; PoolId poolId; diff --git a/test/position-managers/PositionManager.multicall.t.sol b/test/position-managers/PositionManager.multicall.t.sol index 70dd852c..8be08bbf 100644 --- a/test/position-managers/PositionManager.multicall.t.sol +++ b/test/position-managers/PositionManager.multicall.t.sol @@ -6,7 +6,7 @@ import {PoolManager} from "@uniswap/v4-core/src/PoolManager.sol"; import {IPoolManager} from "@uniswap/v4-core/src/interfaces/IPoolManager.sol"; import {IHooks} from "@uniswap/v4-core/src/interfaces/IHooks.sol"; import {Currency, CurrencyLibrary} from "@uniswap/v4-core/src/types/Currency.sol"; -import {PoolId, PoolIdLibrary} from "@uniswap/v4-core/src/types/PoolId.sol"; +import {PoolId} from "@uniswap/v4-core/src/types/PoolId.sol"; import {PoolKey} from "@uniswap/v4-core/src/types/PoolKey.sol"; import {BalanceDelta} from "@uniswap/v4-core/src/types/BalanceDelta.sol"; import {TickMath} from "@uniswap/v4-core/src/libraries/TickMath.sol"; @@ -32,11 +32,7 @@ import {IERC721Permit_v4} from "../../src/interfaces/IERC721Permit_v4.sol"; contract PositionManagerMulticallTest is Test, Permit2SignatureHelpers, PosmTestSetup, LiquidityFuzzers { using FixedPointMathLib for uint256; - using CurrencyLibrary for Currency; - using PoolIdLibrary for PoolKey; using StateLibrary for IPoolManager; - using Planner for Plan; - using PoolIdLibrary for PoolKey; using StateLibrary for IPoolManager; PoolId poolId; diff --git a/test/position-managers/PositionManager.notifier.t.sol b/test/position-managers/PositionManager.notifier.t.sol index b69d0a86..38d05b3e 100644 --- a/test/position-managers/PositionManager.notifier.t.sol +++ b/test/position-managers/PositionManager.notifier.t.sol @@ -8,7 +8,6 @@ import {Position} from "@uniswap/v4-core/src/libraries/Position.sol"; import {PoolKey} from "@uniswap/v4-core/src/types/PoolKey.sol"; import {IPoolManager} from "@uniswap/v4-core/src/interfaces/IPoolManager.sol"; import {StateLibrary} from "@uniswap/v4-core/src/libraries/StateLibrary.sol"; -import {PoolIdLibrary} from "@uniswap/v4-core/src/types/PoolId.sol"; import {BalanceDelta, toBalanceDelta} from "@uniswap/v4-core/src/types/BalanceDelta.sol"; import {Hooks} from "@uniswap/v4-core/src/libraries/Hooks.sol"; import {PosmTestSetup} from "../shared/PosmTestSetup.sol"; @@ -20,15 +19,12 @@ import {Plan, Planner} from "../shared/Planner.sol"; import {Actions} from "../../src/libraries/Actions.sol"; import {INotifier} from "../../src/interfaces/INotifier.sol"; import {MockReturnDataSubscriber, MockRevertSubscriber} from "../mocks/MockBadSubscribers.sol"; -import {PositionInfoLibrary, PositionInfo} from "../../src/libraries/PositionInfoLibrary.sol"; +import {PositionInfo} from "../../src/libraries/PositionInfoLibrary.sol"; import {MockReenterHook} from "../mocks/MockReenterHook.sol"; import {IERC721} from "forge-std/interfaces/IERC721.sol"; contract PositionManagerNotifierTest is Test, PosmTestSetup { - using PoolIdLibrary for PoolKey; using StateLibrary for IPoolManager; - using Planner for Plan; - using PositionInfoLibrary for PositionInfo; MockSubscriber sub; MockReturnDataSubscriber badSubscriber; diff --git a/test/position-managers/PositionManager.t.sol b/test/position-managers/PositionManager.t.sol index a0dc970d..92805433 100644 --- a/test/position-managers/PositionManager.t.sol +++ b/test/position-managers/PositionManager.t.sol @@ -5,8 +5,8 @@ import "forge-std/Test.sol"; import {PoolManager} from "@uniswap/v4-core/src/PoolManager.sol"; import {IPoolManager} from "@uniswap/v4-core/src/interfaces/IPoolManager.sol"; import {IHooks} from "@uniswap/v4-core/src/interfaces/IHooks.sol"; -import {Currency, CurrencyLibrary} from "@uniswap/v4-core/src/types/Currency.sol"; -import {PoolId, PoolIdLibrary} from "@uniswap/v4-core/src/types/PoolId.sol"; +import {Currency} from "@uniswap/v4-core/src/types/Currency.sol"; +import {PoolId} from "@uniswap/v4-core/src/types/PoolId.sol"; import {PoolKey} from "@uniswap/v4-core/src/types/PoolKey.sol"; import {BalanceDelta} from "@uniswap/v4-core/src/types/BalanceDelta.sol"; import {LiquidityAmounts} from "@uniswap/v4-core/test/utils/LiquidityAmounts.sol"; @@ -37,9 +37,6 @@ import {ReentrancyLock} from "../../src/base/ReentrancyLock.sol"; contract PositionManagerTest is Test, PosmTestSetup, LiquidityFuzzers { using FixedPointMathLib for uint256; - using CurrencyLibrary for Currency; - using Planner for Plan; - using PoolIdLibrary for PoolKey; using StateLibrary for IPoolManager; PoolId poolId; diff --git a/test/router/Payments.gas.t.sol b/test/router/Payments.gas.t.sol index 06d13918..f27e3617 100644 --- a/test/router/Payments.gas.t.sol +++ b/test/router/Payments.gas.t.sol @@ -1,18 +1,15 @@ // SPDX-License-Identifier: UNLICENSED pragma solidity ^0.8.19; -import {Currency, CurrencyLibrary} from "@uniswap/v4-core/src/types/Currency.sol"; +import {Currency} from "@uniswap/v4-core/src/types/Currency.sol"; import {IV4Router} from "../../src/interfaces/IV4Router.sol"; import {RoutingTestHelpers} from "../shared/RoutingTestHelpers.sol"; -import {Plan, Planner} from "../shared/Planner.sol"; +import {Planner} from "../shared/Planner.sol"; import {Actions} from "../../src/libraries/Actions.sol"; import {ActionConstants} from "../../src/libraries/ActionConstants.sol"; contract PaymentsTests is RoutingTestHelpers { - using CurrencyLibrary for Currency; - using Planner for Plan; - function setUp() public { setupRouterCurrenciesAndPoolsWithLiquidity(); plan = Planner.init(); diff --git a/test/router/Payments.t.sol b/test/router/Payments.t.sol index 832159cc..d572bd1d 100644 --- a/test/router/Payments.t.sol +++ b/test/router/Payments.t.sol @@ -1,19 +1,16 @@ // SPDX-License-Identifier: UNLICENSED pragma solidity ^0.8.19; -import {Currency, CurrencyLibrary} from "@uniswap/v4-core/src/types/Currency.sol"; +import {Currency} from "@uniswap/v4-core/src/types/Currency.sol"; import {IV4Router} from "../../src/interfaces/IV4Router.sol"; import {RoutingTestHelpers} from "../shared/RoutingTestHelpers.sol"; -import {Plan, Planner} from "../shared/Planner.sol"; +import {Planner} from "../shared/Planner.sol"; import {Actions} from "../../src/libraries/Actions.sol"; import {ActionConstants} from "../../src/libraries/ActionConstants.sol"; import {BipsLibrary} from "../../src/libraries/BipsLibrary.sol"; contract PaymentsTests is RoutingTestHelpers { - using CurrencyLibrary for Currency; - using Planner for Plan; - address bob = makeAddr("BOB"); function setUp() public { diff --git a/test/router/V4Router.gas.t.sol b/test/router/V4Router.gas.t.sol index a1ad2120..7c155a01 100644 --- a/test/router/V4Router.gas.t.sol +++ b/test/router/V4Router.gas.t.sol @@ -5,14 +5,11 @@ import {Currency, CurrencyLibrary} from "@uniswap/v4-core/src/types/Currency.sol import {IV4Router} from "../../src/interfaces/IV4Router.sol"; import {RoutingTestHelpers} from "../shared/RoutingTestHelpers.sol"; -import {Plan, Planner} from "../shared/Planner.sol"; +import {Planner} from "../shared/Planner.sol"; import {Actions} from "../../src/libraries/Actions.sol"; import {ActionConstants} from "../../src/libraries/ActionConstants.sol"; contract V4RouterTest is RoutingTestHelpers { - using CurrencyLibrary for Currency; - using Planner for Plan; - function setUp() public { setupRouterCurrenciesAndPoolsWithLiquidity(); plan = Planner.init(); diff --git a/test/router/V4Router.t.sol b/test/router/V4Router.t.sol index 0c74e004..c4799715 100644 --- a/test/router/V4Router.t.sol +++ b/test/router/V4Router.t.sol @@ -4,14 +4,11 @@ pragma solidity ^0.8.19; import {Currency, CurrencyLibrary} from "@uniswap/v4-core/src/types/Currency.sol"; import {IV4Router} from "../../src/interfaces/IV4Router.sol"; import {RoutingTestHelpers} from "../shared/RoutingTestHelpers.sol"; -import {Plan, Planner} from "../shared/Planner.sol"; +import {Planner} from "../shared/Planner.sol"; import {Actions} from "../../src/libraries/Actions.sol"; import {ActionConstants} from "../../src/libraries/ActionConstants.sol"; contract V4RouterTest is RoutingTestHelpers { - using CurrencyLibrary for Currency; - using Planner for Plan; - address alice = makeAddr("ALICE"); function setUp() public { diff --git a/test/shared/FeeMath.sol b/test/shared/FeeMath.sol index b1b547e2..6c3f6618 100644 --- a/test/shared/FeeMath.sol +++ b/test/shared/FeeMath.sol @@ -8,7 +8,7 @@ import {SafeCast} from "@uniswap/v4-core/src/libraries/SafeCast.sol"; import {IPoolManager} from "@uniswap/v4-core/src/interfaces/IPoolManager.sol"; import {StateLibrary} from "@uniswap/v4-core/src/libraries/StateLibrary.sol"; import {BalanceDelta, toBalanceDelta} from "@uniswap/v4-core/src/types/BalanceDelta.sol"; -import {PoolId, PoolIdLibrary} from "@uniswap/v4-core/src/types/PoolId.sol"; +import {PoolId} from "@uniswap/v4-core/src/types/PoolId.sol"; import {PoolKey} from "@uniswap/v4-core/src/types/PoolKey.sol"; import {IPositionManager} from "../../src/interfaces/IPositionManager.sol"; @@ -17,8 +17,6 @@ import {PositionConfig} from "../shared/PositionConfig.sol"; library FeeMath { using SafeCast for uint256; using StateLibrary for IPoolManager; - using PoolIdLibrary for PoolKey; - using PoolIdLibrary for PoolKey; /// @notice Calculates the fees accrued to a position. Used for testing purposes. function getFeesOwed(IPositionManager posm, IPoolManager manager, PositionConfig memory config, uint256 tokenId) diff --git a/test/shared/LiquidityOperations.sol b/test/shared/LiquidityOperations.sol index 9c65223c..37e4c0a7 100644 --- a/test/shared/LiquidityOperations.sol +++ b/test/shared/LiquidityOperations.sol @@ -16,7 +16,6 @@ import {Planner, Plan} from "../shared/Planner.sol"; import {HookSavesDelta} from "./HookSavesDelta.sol"; abstract contract LiquidityOperations is CommonBase { - using Planner for Plan; using SafeCast for *; IPositionManager lpm; diff --git a/test/shared/Planner.sol b/test/shared/Planner.sol index f457207f..d3c3b8be 100644 --- a/test/shared/Planner.sol +++ b/test/shared/Planner.sol @@ -12,9 +12,9 @@ struct Plan { bytes[] params; } -library Planner { - using Planner for Plan; +using Planner for Plan global; +library Planner { function init() internal pure returns (Plan memory plan) { return Plan({actions: bytes(""), params: new bytes[](0)}); } diff --git a/test/shared/RoutingTestHelpers.sol b/test/shared/RoutingTestHelpers.sol index b29972b9..8c62cbea 100644 --- a/test/shared/RoutingTestHelpers.sol +++ b/test/shared/RoutingTestHelpers.sol @@ -21,8 +21,6 @@ import {ActionConstants} from "../../src/libraries/ActionConstants.sol"; /// @notice A shared test contract that wraps the v4-core deployers contract and exposes basic helpers for swapping with the router. contract RoutingTestHelpers is Test, Deployers { - using Planner for Plan; - PoolModifyLiquidityTest positionManager; MockV4Router router; diff --git a/test/shared/fuzz/LiquidityFuzzers.sol b/test/shared/fuzz/LiquidityFuzzers.sol index 62f3f87b..da14514c 100644 --- a/test/shared/fuzz/LiquidityFuzzers.sol +++ b/test/shared/fuzz/LiquidityFuzzers.sol @@ -12,8 +12,6 @@ import {Actions} from "../../../src/libraries/Actions.sol"; import {Planner, Plan} from "../../shared/Planner.sol"; contract LiquidityFuzzers is Fuzzers { - using Planner for Plan; - uint128 constant _MAX_SLIPPAGE_INCREASE = type(uint128).max; function addFuzzyLiquidity(