Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rename currency settler util contract #799

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/test/CustomCurveHook.sol
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,14 @@ import {PoolKey} from "../types/PoolKey.sol";
import {BeforeSwapDelta, toBeforeSwapDelta} from "../types/BeforeSwapDelta.sol";
import {BalanceDelta} from "../types/BalanceDelta.sol";
import {Currency} from "../types/Currency.sol";
import {CurrencySettler} from "../../test/utils/CurrencySettler.sol";
import {CurrencySettlerTestUtil} from "../../test/utils/CurrencySettlerTestUtil.sol";
import {BaseTestHooks} from "./BaseTestHooks.sol";
import {IERC20Minimal} from "../interfaces/external/IERC20Minimal.sol";
import {Currency} from "../types/Currency.sol";

contract CustomCurveHook is BaseTestHooks {
using Hooks for IHooks;
using CurrencySettler for Currency;
using CurrencySettlerTestUtil for Currency;

error AddLiquidityDirectToHook();

Expand Down
4 changes: 2 additions & 2 deletions src/test/DeltaReturningHook.sol
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import {Hooks} from "../libraries/Hooks.sol";
import {SafeCast} from "../libraries/SafeCast.sol";
import {IHooks} from "../interfaces/IHooks.sol";
import {IPoolManager} from "../interfaces/IPoolManager.sol";
import {CurrencySettler} from "../../test/utils/CurrencySettler.sol";
import {CurrencySettlerTestUtil} from "../../test/utils/CurrencySettlerTestUtil.sol";
import {PoolKey} from "../types/PoolKey.sol";
import {BalanceDelta, toBalanceDelta} from "../types/BalanceDelta.sol";
import {Currency} from "../types/Currency.sol";
Expand All @@ -16,7 +16,7 @@ import {BeforeSwapDelta, toBeforeSwapDelta} from "../types/BeforeSwapDelta.sol";

contract DeltaReturningHook is BaseTestHooks {
using Hooks for IHooks;
using CurrencySettler for Currency;
using CurrencySettlerTestUtil for Currency;

IPoolManager immutable manager;

Expand Down
4 changes: 2 additions & 2 deletions src/test/PoolClaimsTest.sol
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@ import {IPoolManager} from "../interfaces/IPoolManager.sol";
import {PoolKey} from "../types/PoolKey.sol";
import {PoolTestBase} from "./PoolTestBase.sol";
import {SafeCast} from "../libraries/SafeCast.sol";
import {CurrencySettler} from "../../test/utils/CurrencySettler.sol";
import {CurrencySettlerTestUtil} from "../../test/utils/CurrencySettlerTestUtil.sol";

contract PoolClaimsTest is PoolTestBase {
using CurrencySettler for Currency;
using CurrencySettlerTestUtil for Currency;
using SafeCast for uint256;

constructor(IPoolManager _manager) PoolTestBase(_manager) {}
Expand Down
4 changes: 2 additions & 2 deletions src/test/PoolDonateTest.sol
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@ import {BalanceDelta, BalanceDeltaLibrary} from "../types/BalanceDelta.sol";
import {PoolTestBase} from "./PoolTestBase.sol";
import {IHooks} from "../interfaces/IHooks.sol";
import {Hooks} from "../libraries/Hooks.sol";
import {CurrencySettler} from "../../test/utils/CurrencySettler.sol";
import {CurrencySettlerTestUtil} from "../../test/utils/CurrencySettlerTestUtil.sol";

contract PoolDonateTest is PoolTestBase {
using CurrencySettler for Currency;
using CurrencySettlerTestUtil for Currency;
using Hooks for IHooks;

constructor(IPoolManager _manager) PoolTestBase(_manager) {}
Expand Down
4 changes: 2 additions & 2 deletions src/test/PoolModifyLiquidityTest.sol
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@ import {PoolTestBase} from "./PoolTestBase.sol";
import {IHooks} from "../interfaces/IHooks.sol";
import {Hooks} from "../libraries/Hooks.sol";
import {LPFeeLibrary} from "../libraries/LPFeeLibrary.sol";
import {CurrencySettler} from "../../test/utils/CurrencySettler.sol";
import {CurrencySettlerTestUtil} from "../../test/utils/CurrencySettlerTestUtil.sol";
import {StateLibrary} from "../libraries/StateLibrary.sol";

contract PoolModifyLiquidityTest is PoolTestBase {
using CurrencySettler for Currency;
using CurrencySettlerTestUtil for Currency;
using Hooks for IHooks;
using LPFeeLibrary for uint24;
using PoolIdLibrary for PoolKey;
Expand Down
4 changes: 2 additions & 2 deletions src/test/PoolModifyLiquidityTestNoChecks.sol
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@ import {PoolTestBase} from "./PoolTestBase.sol";
import {IHooks} from "../interfaces/IHooks.sol";
import {Hooks} from "../libraries/Hooks.sol";
import {LPFeeLibrary} from "../libraries/LPFeeLibrary.sol";
import {CurrencySettler} from "../../test/utils/CurrencySettler.sol";
import {CurrencySettlerTestUtil} from "../../test/utils/CurrencySettlerTestUtil.sol";
import {Constants} from "../../test/utils/Constants.sol";

contract PoolModifyLiquidityTestNoChecks is PoolTestBase {
using CurrencySettler for Currency;
using CurrencySettlerTestUtil for Currency;
using Hooks for IHooks;
using LPFeeLibrary for uint24;
using PoolIdLibrary for PoolKey;
Expand Down
4 changes: 2 additions & 2 deletions src/test/PoolNestedActionsTest.sol
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import {Test} from "forge-std/Test.sol";
import {BalanceDelta} from "../types/BalanceDelta.sol";
import {Currency} from "../types/Currency.sol";
import {PoolId, PoolIdLibrary} from "../types/PoolId.sol";
import {CurrencySettler} from "../../test/utils/CurrencySettler.sol";
import {CurrencySettlerTestUtil} from "../../test/utils/CurrencySettlerTestUtil.sol";
import {StateLibrary} from "../libraries/StateLibrary.sol";
import {TransientStateLibrary} from "../libraries/TransientStateLibrary.sol";

Expand Down Expand Up @@ -66,7 +66,7 @@ contract PoolNestedActionsTest is Test, IUnlockCallback {
contract NestedActionExecutor is Test, PoolTestBase {
using StateLibrary for IPoolManager;
using TransientStateLibrary for IPoolManager;
using CurrencySettler for Currency;
using CurrencySettlerTestUtil for Currency;
using PoolIdLibrary for PoolKey;

PoolKey internal key;
Expand Down
4 changes: 2 additions & 2 deletions src/test/PoolSwapTest.sol
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@ import {PoolKey} from "../types/PoolKey.sol";
import {IHooks} from "../interfaces/IHooks.sol";
import {Hooks} from "../libraries/Hooks.sol";
import {PoolTestBase} from "./PoolTestBase.sol";
import {CurrencySettler} from "../../test/utils/CurrencySettler.sol";
import {CurrencySettlerTestUtil} from "../../test/utils/CurrencySettlerTestUtil.sol";

contract PoolSwapTest is PoolTestBase {
using CurrencySettler for Currency;
using CurrencySettlerTestUtil for Currency;
using Hooks for IHooks;

constructor(IPoolManager _manager) PoolTestBase(_manager) {}
Expand Down
4 changes: 2 additions & 2 deletions src/test/PoolTakeTest.sol
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@ import {IPoolManager} from "../interfaces/IPoolManager.sol";
import {PoolKey} from "../types/PoolKey.sol";
import {PoolTestBase} from "./PoolTestBase.sol";
import {SafeCast} from "../libraries/SafeCast.sol";
import {CurrencySettler} from "../../test/utils/CurrencySettler.sol";
import {CurrencySettlerTestUtil} from "../../test/utils/CurrencySettlerTestUtil.sol";

contract PoolTakeTest is PoolTestBase {
using CurrencySettler for Currency;
using CurrencySettlerTestUtil for Currency;
using SafeCast for uint256;

constructor(IPoolManager _manager) PoolTestBase(_manager) {}
Expand Down
4 changes: 2 additions & 2 deletions src/test/SkipCallsTestHook.sol
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,13 @@ import {Currency} from "../types/Currency.sol";
import {PoolTestBase} from "./PoolTestBase.sol";
import {Constants} from "../../test/utils/Constants.sol";
import {Test} from "forge-std/Test.sol";
import {CurrencySettler} from "../../test/utils/CurrencySettler.sol";
import {CurrencySettlerTestUtil} from "../../test/utils/CurrencySettlerTestUtil.sol";
import {StateLibrary} from "../libraries/StateLibrary.sol";
import {TransientStateLibrary} from "../libraries/TransientStateLibrary.sol";
import {BeforeSwapDelta, BeforeSwapDeltaLibrary} from "../types/BeforeSwapDelta.sol";

contract SkipCallsTestHook is BaseTestHooks, Test {
using CurrencySettler for Currency;
using CurrencySettlerTestUtil for Currency;
using PoolIdLibrary for PoolKey;
using Hooks for IHooks;
using StateLibrary for IPoolManager;
Expand Down
4 changes: 2 additions & 2 deletions src/test/SwapRouterNoChecks.sol
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@ import {PoolKey} from "../types/PoolKey.sol";
import {IHooks} from "../interfaces/IHooks.sol";
import {Hooks} from "../libraries/Hooks.sol";
import {PoolTestBase} from "./PoolTestBase.sol";
import {CurrencySettler} from "../../test/utils/CurrencySettler.sol";
import {CurrencySettlerTestUtil} from "../../test/utils/CurrencySettlerTestUtil.sol";

contract SwapRouterNoChecks is PoolTestBase {
using CurrencySettler for Currency;
using CurrencySettlerTestUtil for Currency;
using Hooks for IHooks;

constructor(IPoolManager _manager) PoolTestBase(_manager) {}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,9 @@ import {IPoolManager} from "../../src/interfaces/IPoolManager.sol";
/// To settle a positive delta (a credit to the user), a user may take or mint.
/// To settle a negative delta (a debt on the user), a user make transfer or burn to pay off a debt.
/// @dev Note that sync() is called before any erc-20 transfer in `settle`.
library CurrencySettler {
/// @dev THIS CONTRACT IS NOT SECURE, IT IS FOR TESTING PURPOSES, DO NOT USE IT IN PROD
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I feel like this warning is a bit overkill? It just doesn't use safe transfer from and we don't do this in a lot of our test contracts which should never be used in prod

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think just renaming it and putting it in the test/utils file is sufficient

/// For an equivalent library, see v4-periphery/contracts/libraries/CurrencySettlerTestUtil.sol
library CurrencySettlerTestUtil {
/// @notice Settle (pay) a currency to the PoolManager
/// @param currency Currency to settle
/// @param manager IPoolManager to settle to
Expand Down
Loading