From 0070fcd2d1176e6e20720bd91cb060473d12e3dd Mon Sep 17 00:00:00 2001 From: Sara Reynolds Date: Sun, 20 Oct 2024 17:53:21 -0400 Subject: [PATCH] comments --- src/base/DeltaResolver.sol | 11 ++++++----- src/base/NativeWrapper.sol | 3 ++- .../PositionManager.modifyLiquidities.t.sol | 3 --- 3 files changed, 8 insertions(+), 9 deletions(-) diff --git a/src/base/DeltaResolver.sol b/src/base/DeltaResolver.sol index 6856202d..c9bfa739 100644 --- a/src/base/DeltaResolver.sol +++ b/src/base/DeltaResolver.sol @@ -91,7 +91,7 @@ abstract contract DeltaResolver is ImmutableState { } /// @notice Calculates the sanitized amount before wrapping/unwrapping. - /// @param inputCurrency The currency, either native or wrapped native, that the contract holds + /// @param inputCurrency The currency, either native or wrapped native, that this contract holds /// @param amount The amount to wrap or unwrap. Can be CONTRACT_BALANCE or OPEN_DELTA or a specific amount /// @param outputCurrency The currency after the wrap/unwrap that the user may owe a balance in on the poolManager function _mapWrapUnwrapAmount(Currency inputCurrency, uint256 amount, Currency outputCurrency) @@ -99,15 +99,16 @@ abstract contract DeltaResolver is ImmutableState { view returns (uint256 _amount) { - // if wrapping, the balance in this contract should be in ETH - // if unwrapping, the balance in this contract should be in WETH + // if wrapping, the balance in this is in ETH + // if unwrapping, the balance in this contract is in WETH uint256 balance = inputCurrency.balanceOf(address(this)); if (amount == ActionConstants.CONTRACT_BALANCE) { + // return early to avoid unnecessary balance check return balance; } if (amount == ActionConstants.OPEN_DELTA) { - // if wrapping, the open currency on the contract is WETH. - // if unwrapping, the open currency on the contract is ETH. + // if wrapping, the open currency on the PoolManager is WETH. + // if unwrapping, the open currency on the PoolManager is ETH. _amount = _getFullDebt(outputCurrency); } else { _amount = amount; diff --git a/src/base/NativeWrapper.sol b/src/base/NativeWrapper.sol index 93252c6f..ef6a3f2a 100644 --- a/src/base/NativeWrapper.sol +++ b/src/base/NativeWrapper.sol @@ -8,9 +8,10 @@ import {ImmutableState} from "./ImmutableState.sol"; /// @title Native Wrapper /// @notice Used for wrapping and unwrapping native abstract contract NativeWrapper is ImmutableState { + /// @notice The address for WETH9 IWETH9 public immutable WETH9; - /// @notice Thrown when a non-expected address sends ETH to this contract + /// @notice Thrown when an unexpected address sends ETH to this contract error InvalidEthSender(); constructor(IWETH9 _weth9) { diff --git a/test/position-managers/PositionManager.modifyLiquidities.t.sol b/test/position-managers/PositionManager.modifyLiquidities.t.sol index 5a4d2174..d3f4adbd 100644 --- a/test/position-managers/PositionManager.modifyLiquidities.t.sol +++ b/test/position-managers/PositionManager.modifyLiquidities.t.sol @@ -31,8 +31,6 @@ import {PosmTestSetup} from "../shared/PosmTestSetup.sol"; import {ActionConstants} from "../../src/libraries/ActionConstants.sol"; import {Planner, Plan} from "../shared/Planner.sol"; -import "forge-std/console2.sol"; - contract PositionManagerModifyLiquiditiesTest is Test, PosmTestSetup, LiquidityFuzzers { using StateLibrary for IPoolManager; using PoolIdLibrary for PoolKey; @@ -414,7 +412,6 @@ contract PositionManagerModifyLiquiditiesTest is Test, PosmTestSetup, LiquidityF uint256 balanceEthBefore = address(this).balance; uint256 balance1Before = IERC20(Currency.unwrap(currency1)).balanceOf(address(this)); - console2.log(balance1Before); Plan memory planner = Planner.init(); planner.add( Actions.BURN_POSITION, abi.encode(tokenId, MIN_SLIPPAGE_DECREASE, MIN_SLIPPAGE_DECREASE, ZERO_BYTES)