Skip to content

Commit

Permalink
fmt
Browse files Browse the repository at this point in the history
  • Loading branch information
kinrezC committed Oct 23, 2024
1 parent 5e3521c commit 29aadb9
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 33 deletions.
9 changes: 3 additions & 6 deletions src/Doppler.sol
Original file line number Diff line number Diff line change
Expand Up @@ -823,12 +823,9 @@ contract Doppler is BaseHook {
uint160 sqrtPriceNext = TickMath.getSqrtPriceAtTick(currentTick);
uint160 sqrtPriceCurrent = TickMath.getSqrtPriceAtTick(tick);

SlugData memory lowerSlug = SlugData({
tickLower: tickLower,
tickUpper: currentTick,
liquidity: 0
});
(SlugData memory upperSlug, uint256 assetRemaining) = _computeUpperSlugData(key, 0, currentTick, numTokensToSell);
SlugData memory lowerSlug = SlugData({tickLower: tickLower, tickUpper: currentTick, liquidity: 0});
(SlugData memory upperSlug, uint256 assetRemaining) =
_computeUpperSlugData(key, 0, currentTick, numTokensToSell);
SlugData[] memory priceDiscoverySlugs =
_computePriceDiscoverySlugsData(key, upperSlug, tickUpper, assetRemaining);

Expand Down
1 change: 0 additions & 1 deletion test/integration/Rebalance.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -780,7 +780,6 @@ contract RebalanceTest is BaseTest {
upperSlug.liquidity
) * 9 / 10;


uint256 amount0ToSwap = LiquidityAmounts.getAmount0ForLiquidity(
TickMath.getSqrtPriceAtTick(upperSlug.tickLower),
TickMath.getSqrtPriceAtTick(upperSlug.tickUpper),
Expand Down
36 changes: 18 additions & 18 deletions test/invariant/DopplerInvariants.sol
Original file line number Diff line number Diff line change
Expand Up @@ -6,27 +6,27 @@ import {BaseTest} from "test/shared/BaseTest.sol";
import {DopplerHandler} from "test/invariant/DopplerHandler.sol";

contract DopplerInvariantsTest is BaseTest {
// DopplerHandler public handler;
// DopplerHandler public handler;

// function setUp() public override {
// super.setUp();
// handler = new DopplerHandler(key, hook, router, isToken0, usingEth);
// function setUp() public override {
// super.setUp();
// handler = new DopplerHandler(key, hook, router, isToken0, usingEth);

// bytes4[] memory selectors = new bytes4[](1);
// selectors[0] = handler.buyExactAmountIn.selector;
// bytes4[] memory selectors = new bytes4[](1);
// selectors[0] = handler.buyExactAmountIn.selector;

// targetSelector(FuzzSelector({addr: address(handler), selectors: selectors}));
// targetContract(address(handler));
// }
// targetSelector(FuzzSelector({addr: address(handler), selectors: selectors}));
// targetContract(address(handler));
// }

// function afterInvariant() public view {
// console.log("Handler address", address(handler));
// console.log("Calls: ", handler.totalCalls());
// console.log("buyExactAmountIn: ", handler.calls(handler.buyExactAmountIn.selector));
// }
// function afterInvariant() public view {
// console.log("Handler address", address(handler));
// console.log("Calls: ", handler.totalCalls());
// console.log("buyExactAmountIn: ", handler.calls(handler.buyExactAmountIn.selector));
// }

// /// forge-config: default.invariant.fail-on-revert = true
// function invariant_works() public {
// assertTrue(true);
// }
// /// forge-config: default.invariant.fail-on-revert = true
// function invariant_works() public {
// assertTrue(true);
// }
}
11 changes: 4 additions & 7 deletions test/shared/BaseTest.sol
Original file line number Diff line number Diff line change
Expand Up @@ -366,17 +366,15 @@ contract BaseTest is Test, Deployers {
}
uint256 approveAmount = uint256(-amount);
TestERC20(asset).approve(address(swapRouter), approveAmount);
vm.expectRevert(abi.encodeWithSelector(
Hooks.Wrap__FailedHookCall.selector, hook, abi.encodeWithSelector(selector)
)
vm.expectRevert(
abi.encodeWithSelector(Hooks.Wrap__FailedHookCall.selector, hook, abi.encodeWithSelector(selector))
);
swapRouter.swap(
key,
IPoolManager.SwapParams(isToken0, amount, isToken0 ? MIN_PRICE_LIMIT : MAX_PRICE_LIMIT),
PoolSwapTest.TestSettings(true, false),
""
);

}

function buyExpectRevert(int256 amount, bytes4 selector) public {
Expand All @@ -393,9 +391,8 @@ contract BaseTest is Test, Deployers {
TestERC20(numeraire).approve(address(swapRouter), uint256(mintAmount));
}

vm.expectRevert(abi.encodeWithSelector(
Hooks.Wrap__FailedHookCall.selector, hook, abi.encodeWithSelector(selector)
)
vm.expectRevert(
abi.encodeWithSelector(Hooks.Wrap__FailedHookCall.selector, hook, abi.encodeWithSelector(selector))
);
swapRouter.swap{value: usingEth ? mintAmount : 0}(
key,
Expand Down
3 changes: 2 additions & 1 deletion test/unit/Swap.sol
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,10 @@ contract SwapTest is BaseTest {
// NOTE: when testing conditions where we expect a revert using buy/sellExpectRevert,
// we need to pass in a negative amount to specify an exactIn swap.
// otherwise, the quoter will attempt to calculate an exactOut amount, which will fail.

function test_swap_RevertsBeforeStartTime() public {
vm.warp(hook.getStartingTime() - 1); // 1 second before the start time

buyExpectRevert(-1 ether, InvalidTime.selector);
}

Expand Down

0 comments on commit 29aadb9

Please sign in to comment.