Skip to content

Commit 6601a19

Browse files
authored
Fix linting (#504)
* Fix linting * bump forge version
1 parent 7ebd04b commit 6601a19

28 files changed

+465
-352
lines changed

.github/workflows/lint.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ jobs:
2121
- name: Install Foundry
2222
uses: foundry-rs/foundry-toolchain@50d5a8956f2e319df19e6b57539d7e2acb9f8c1e # v1.5.0
2323
with:
24-
version: v1.3.6
24+
version: v1.4.3
2525

2626
- name: Check format
2727
run: forge fmt --check

src/PositionManager.sol

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -498,10 +498,7 @@ contract PositionManager is
498498
(liquidityDelta, feesAccrued) = poolManager.modifyLiquidity(
499499
poolKey,
500500
ModifyLiquidityParams({
501-
tickLower: info.tickLower(),
502-
tickUpper: info.tickUpper(),
503-
liquidityDelta: liquidityChange,
504-
salt: salt
501+
tickLower: info.tickLower(), tickUpper: info.tickUpper(), liquidityDelta: liquidityChange, salt: salt
505502
}),
506503
hookData
507504
);

src/V4Router.sol

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -120,9 +120,10 @@ abstract contract V4Router is IV4Router, BaseActionsRouter, DeltaResolver {
120120
amountOut =
121121
_getFullDebt(params.zeroForOne ? params.poolKey.currency1 : params.poolKey.currency0).toUint128();
122122
}
123-
uint128 amountIn = (
124-
uint256(-int256(_swap(params.poolKey, params.zeroForOne, int256(uint256(amountOut)), params.hookData)))
125-
).toUint128();
123+
uint128 amountIn = (uint256(
124+
-int256(_swap(params.poolKey, params.zeroForOne, int256(uint256(amountOut)), params.hookData))
125+
))
126+
.toUint128();
126127
if (amountIn > params.amountInMaximum) revert V4TooMuchRequested(params.amountInMaximum, amountIn);
127128
}
128129

@@ -144,7 +145,7 @@ abstract contract V4Router is IV4Router, BaseActionsRouter, DeltaResolver {
144145
(PoolKey memory poolKey, bool oneForZero) = pathKey.getPoolAndSwapDirection(currencyOut);
145146
// The output delta will always be negative, except for when interacting with certain hook pools
146147
amountIn = (uint256(-int256(_swap(poolKey, !oneForZero, int256(uint256(amountOut)), pathKey.hookData))))
147-
.toUint128();
148+
.toUint128();
148149

149150
amountOut = amountIn;
150151
currencyOut = pathKey.intermediateCurrency;

src/base/ERC721Permit_v4.sol

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,8 @@ abstract contract ERC721Permit_v4 is ERC721, IERC721Permit_v4, EIP712_v4, Unorde
9292
}
9393

9494
function _isApprovedOrOwner(address spender, uint256 tokenId) internal view returns (bool) {
95-
return spender == ownerOf(tokenId) || getApproved[tokenId] == spender
96-
|| isApprovedForAll[ownerOf(tokenId)][spender];
95+
return
96+
spender == ownerOf(tokenId) || getApproved[tokenId] == spender
97+
|| isApprovedForAll[ownerOf(tokenId)][spender];
9798
}
9899
}

src/base/Notifier.sol

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -60,12 +60,7 @@ abstract contract Notifier is INotifier {
6060
}
6161

6262
/// @inheritdoc INotifier
63-
function unsubscribe(uint256 tokenId)
64-
external
65-
payable
66-
onlyIfPoolManagerLocked
67-
onlyIfApproved(msg.sender, tokenId)
68-
{
63+
function unsubscribe(uint256 tokenId) external payable onlyIfPoolManagerLocked onlyIfApproved(msg.sender, tokenId) {
6964
_unsubscribe(tokenId);
7065
}
7166

src/base/hooks/BaseTokenWrapperHook.sol

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,9 @@
22
pragma solidity ^0.8.0;
33

44
import {
5-
toBeforeSwapDelta, BeforeSwapDelta, BeforeSwapDeltaLibrary
5+
toBeforeSwapDelta,
6+
BeforeSwapDelta,
7+
BeforeSwapDeltaLibrary
68
} from "@uniswap/v4-core/src/types/BeforeSwapDelta.sol";
79
import {Currency, CurrencyLibrary} from "@uniswap/v4-core/src/types/Currency.sol";
810
import {PoolKey} from "@uniswap/v4-core/src/types/PoolKey.sol";
@@ -129,8 +131,9 @@ abstract contract BaseTokenWrapperHook is BaseHook, DeltaResolver {
129131

130132
if (wrapZeroForOne == params.zeroForOne) {
131133
// we are wrapping
132-
uint256 inputAmount =
133-
isExactInput ? uint256(-params.amountSpecified) : _getWrapInputRequired(uint256(params.amountSpecified));
134+
uint256 inputAmount = isExactInput
135+
? uint256(-params.amountSpecified)
136+
: _getWrapInputRequired(uint256(params.amountSpecified));
134137
(uint256 actualUnderlyingAmount, uint256 wrappedAmount) = _deposit(inputAmount);
135138
int128 amountUnspecified =
136139
isExactInput ? -wrappedAmount.toInt256().toInt128() : actualUnderlyingAmount.toInt256().toInt128();

src/interfaces/IV4Quoter.sol

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -42,9 +42,7 @@ interface IV4Quoter is IImmutableState, IMsgSender {
4242
/// exactAmount The desired input amount
4343
/// @return amountOut The output quote for the exactIn swap
4444
/// @return gasEstimate Estimated gas units used for the swap
45-
function quoteExactInput(QuoteExactParams memory params)
46-
external
47-
returns (uint256 amountOut, uint256 gasEstimate);
45+
function quoteExactInput(QuoteExactParams memory params) external returns (uint256 amountOut, uint256 gasEstimate);
4846

4947
/// @notice Returns the delta amounts for a given exact output swap of a single pool
5048
/// @param params The params for the quote, encoded as `QuoteExactSingleParams`
@@ -65,7 +63,5 @@ interface IV4Quoter is IImmutableState, IMsgSender {
6563
/// exactAmount The desired output amount
6664
/// @return amountIn The input quote for the exactOut swap
6765
/// @return gasEstimate Estimated gas units used for the swap
68-
function quoteExactOutput(QuoteExactParams memory params)
69-
external
70-
returns (uint256 amountIn, uint256 gasEstimate);
66+
function quoteExactOutput(QuoteExactParams memory params) external returns (uint256 amountIn, uint256 gasEstimate);
7167
}

src/libraries/CalldataDecoder.sol

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -320,11 +320,7 @@ library CalldataDecoder {
320320
}
321321

322322
/// @dev equivalent to: abi.decode(params, (Currency, uint256)) in calldata
323-
function decodeCurrencyAndUint256(bytes calldata params)
324-
internal
325-
pure
326-
returns (Currency currency, uint256 amount)
327-
{
323+
function decodeCurrencyAndUint256(bytes calldata params) internal pure returns (Currency currency, uint256 amount) {
328324
assembly ("memory-safe") {
329325
if lt(params.length, 0x40) {
330326
mstore(0, SLICE_ERROR_SELECTOR)

src/libraries/LiquidityAmounts.sol

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,9 @@ library LiquidityAmounts {
5959
uint256 amount0,
6060
uint256 amount1
6161
) internal pure returns (uint128 liquidity) {
62-
if (sqrtPriceAX96 > sqrtPriceBX96) (sqrtPriceAX96, sqrtPriceBX96) = (sqrtPriceBX96, sqrtPriceAX96);
62+
if (sqrtPriceAX96 > sqrtPriceBX96) {
63+
(sqrtPriceAX96, sqrtPriceBX96) = (sqrtPriceBX96, sqrtPriceAX96);
64+
}
6365

6466
if (sqrtPriceX96 <= sqrtPriceAX96) {
6567
liquidity = getLiquidityForAmount0(sqrtPriceAX96, sqrtPriceBX96, amount0);

src/libraries/PositionInfoLibrary.sol

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -95,11 +95,10 @@ library PositionInfoLibrary {
9595
{
9696
bytes25 _poolId = bytes25(PoolId.unwrap(_poolKey.toId()));
9797
assembly {
98-
info :=
99-
or(
100-
or(and(MASK_UPPER_200_BITS, _poolId), shl(TICK_UPPER_OFFSET, and(MASK_24_BITS, _tickUpper))),
101-
shl(TICK_LOWER_OFFSET, and(MASK_24_BITS, _tickLower))
102-
)
98+
info := or(
99+
or(and(MASK_UPPER_200_BITS, _poolId), shl(TICK_UPPER_OFFSET, and(MASK_24_BITS, _tickUpper))),
100+
shl(TICK_LOWER_OFFSET, and(MASK_24_BITS, _tickLower))
101+
)
103102
}
104103
}
105104
}

0 commit comments

Comments
 (0)