Skip to content

Commit

Permalink
comments
Browse files Browse the repository at this point in the history
  • Loading branch information
snreynolds committed Oct 20, 2024
1 parent 94d8f07 commit 0070fcd
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 9 deletions.
11 changes: 6 additions & 5 deletions src/base/DeltaResolver.sol
Original file line number Diff line number Diff line change
Expand Up @@ -91,23 +91,24 @@ 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)
internal
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;
Expand Down
3 changes: 2 additions & 1 deletion src/base/NativeWrapper.sol
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit 0070fcd

Please sign in to comment.