refactor: forge fmt (after foundry update)
Took 5 minutes Took 8 seconds
This commit is contained in:
@@ -93,9 +93,7 @@ contract TychoRouter is
|
||||
address indexed token, uint256 amount, address indexed receiver
|
||||
);
|
||||
|
||||
constructor(address _permit2, address weth)
|
||||
RestrictTransferFrom(_permit2)
|
||||
{
|
||||
constructor(address _permit2, address weth) RestrictTransferFrom(_permit2) {
|
||||
if (_permit2 == address(0) || weth == address(0)) {
|
||||
revert TychoRouter__AddressZero();
|
||||
}
|
||||
|
||||
@@ -43,7 +43,12 @@ contract BalancerV3Executor is IExecutor, RestrictTransferFrom, ICallback {
|
||||
calculatedAmount = abi.decode(abi.decode(result, (bytes)), (uint256));
|
||||
}
|
||||
|
||||
function verifyCallback(bytes calldata /*data*/ ) public view {
|
||||
function verifyCallback(
|
||||
bytes calldata /*data*/
|
||||
)
|
||||
public
|
||||
view
|
||||
{
|
||||
if (msg.sender != address(VAULT)) {
|
||||
revert BalancerV3Executor__SenderIsNotVault(msg.sender);
|
||||
}
|
||||
|
||||
@@ -29,7 +29,9 @@ contract BebopExecutor is IExecutor, RestrictTransferFrom {
|
||||
constructor(address _bebopSettlement, address _permit2)
|
||||
RestrictTransferFrom(_permit2)
|
||||
{
|
||||
if (_bebopSettlement == address(0)) revert BebopExecutor__ZeroAddress();
|
||||
if (_bebopSettlement == address(0)) {
|
||||
revert BebopExecutor__ZeroAddress();
|
||||
}
|
||||
bebopSettlement = _bebopSettlement;
|
||||
}
|
||||
|
||||
|
||||
@@ -55,7 +55,9 @@ contract CurveExecutor is IExecutor, RestrictTransferFrom {
|
||||
payable
|
||||
returns (uint256)
|
||||
{
|
||||
if (data.length != 85) revert CurveExecutor__InvalidDataLength();
|
||||
if (data.length != 85) {
|
||||
revert CurveExecutor__InvalidDataLength();
|
||||
}
|
||||
|
||||
(
|
||||
address tokenIn,
|
||||
@@ -91,13 +93,15 @@ contract CurveExecutor is IExecutor, RestrictTransferFrom {
|
||||
// crypto or llamma
|
||||
if (tokenIn == nativeToken || tokenOut == nativeToken) {
|
||||
// slither-disable-next-line arbitrary-send-eth
|
||||
CryptoPoolETH(pool).exchange{value: ethAmount}(
|
||||
uint256(int256(i)), uint256(int256(j)), amountIn, 0, true
|
||||
);
|
||||
CryptoPoolETH(pool)
|
||||
.exchange{
|
||||
value: ethAmount
|
||||
}(uint256(int256(i)), uint256(int256(j)), amountIn, 0, true);
|
||||
} else {
|
||||
CryptoPool(pool).exchange(
|
||||
uint256(int256(i)), uint256(int256(j)), amountIn, 0
|
||||
);
|
||||
CryptoPool(pool)
|
||||
.exchange(
|
||||
uint256(int256(i)), uint256(int256(j)), amountIn, 0
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -149,11 +153,7 @@ contract CurveExecutor is IExecutor, RestrictTransferFrom {
|
||||
require(msg.sender.code.length != 0);
|
||||
}
|
||||
|
||||
function _balanceOf(address token)
|
||||
internal
|
||||
view
|
||||
returns (uint256 balance)
|
||||
{
|
||||
function _balanceOf(address token) internal view returns (uint256 balance) {
|
||||
balance = token == nativeToken
|
||||
? address(this).balance
|
||||
: IERC20(token).balanceOf(address(this));
|
||||
|
||||
@@ -102,15 +102,18 @@ contract EkuboExecutor is
|
||||
}
|
||||
}
|
||||
|
||||
function payCallback(uint256, address /*token*/ ) external coreOnly {
|
||||
function payCallback(
|
||||
uint256,
|
||||
address /*token*/
|
||||
)
|
||||
external
|
||||
coreOnly
|
||||
{
|
||||
// Without selector and locker id
|
||||
_payCallback(msg.data[36:]);
|
||||
}
|
||||
|
||||
function _lock(bytes memory data)
|
||||
internal
|
||||
returns (uint128 swappedAmount)
|
||||
{
|
||||
function _lock(bytes memory data) internal returns (uint128 swappedAmount) {
|
||||
address target = address(core);
|
||||
|
||||
// slither-disable-next-line assembly
|
||||
|
||||
@@ -67,9 +67,8 @@ contract HashflowExecutor is IExecutor, RestrictTransferFrom {
|
||||
|
||||
if (approvalNeeded && quote.baseToken != NATIVE_TOKEN) {
|
||||
// slither-disable-next-line unused-return
|
||||
IERC20(quote.baseToken).forceApprove(
|
||||
hashflowRouter, type(uint256).max
|
||||
);
|
||||
IERC20(quote.baseToken)
|
||||
.forceApprove(hashflowRouter, type(uint256).max);
|
||||
}
|
||||
|
||||
uint256 ethValue = 0;
|
||||
|
||||
@@ -42,13 +42,13 @@ contract MaverickV2Executor is IExecutor, RestrictTransferFrom {
|
||||
|
||||
bool isTokenAIn = pool.tokenA() == tokenIn;
|
||||
int32 tickLimit = isTokenAIn ? type(int32).max : type(int32).min;
|
||||
IMaverickV2Pool.SwapParams memory swapParams = IMaverickV2Pool
|
||||
.SwapParams({
|
||||
amount: givenAmount,
|
||||
tokenAIn: isTokenAIn,
|
||||
exactOutput: false,
|
||||
tickLimit: tickLimit
|
||||
});
|
||||
IMaverickV2Pool.SwapParams memory swapParams =
|
||||
IMaverickV2Pool.SwapParams({
|
||||
amount: givenAmount,
|
||||
tokenAIn: isTokenAIn,
|
||||
exactOutput: false,
|
||||
tickLimit: tickLimit
|
||||
});
|
||||
|
||||
_transfer(target, transferType, address(tokenIn), givenAmount);
|
||||
|
||||
|
||||
@@ -121,7 +121,9 @@ contract UniswapV3Executor is IExecutor, ICallback, RestrictTransferFrom {
|
||||
int256, /* amount0Delta */
|
||||
int256, /* amount1Delta */
|
||||
bytes calldata /* data */
|
||||
) external {
|
||||
)
|
||||
external
|
||||
{
|
||||
handleCallback(msg.data);
|
||||
}
|
||||
|
||||
|
||||
@@ -11,19 +11,23 @@ import {
|
||||
import {IPoolManager} from "@uniswap/v4-core/src/interfaces/IPoolManager.sol";
|
||||
import {SwapParams} from "@uniswap/v4-core/src/types/PoolOperation.sol";
|
||||
import {
|
||||
Currency, CurrencyLibrary
|
||||
Currency,
|
||||
CurrencyLibrary
|
||||
} from "@uniswap/v4-core/src/types/Currency.sol";
|
||||
import {PoolKey} from "@uniswap/v4-core/src/types/PoolKey.sol";
|
||||
import {BalanceDelta} from "@uniswap/v4-core/src/types/BalanceDelta.sol";
|
||||
import {TickMath} from "@uniswap/v4-core/src/libraries/TickMath.sol";
|
||||
import {IHooks} from "@uniswap/v4-core/src/interfaces/IHooks.sol";
|
||||
import {PathKey} from "@uniswap/v4-periphery/src/libraries/PathKey.sol";
|
||||
import {IUnlockCallback} from
|
||||
"@uniswap/v4-core/src/interfaces/callback/IUnlockCallback.sol";
|
||||
import {SafeCast as V4SafeCast} from
|
||||
"@uniswap/v4-core/src/libraries/SafeCast.sol";
|
||||
import {TransientStateLibrary} from
|
||||
"@uniswap/v4-core/src/libraries/TransientStateLibrary.sol";
|
||||
import {
|
||||
IUnlockCallback
|
||||
} from "@uniswap/v4-core/src/interfaces/callback/IUnlockCallback.sol";
|
||||
import {
|
||||
SafeCast as V4SafeCast
|
||||
} from "@uniswap/v4-core/src/libraries/SafeCast.sol";
|
||||
import {
|
||||
TransientStateLibrary
|
||||
} from "@uniswap/v4-core/src/libraries/TransientStateLibrary.sol";
|
||||
import "../RestrictTransferFrom.sol";
|
||||
import "@openzeppelin/contracts/utils/Address.sol";
|
||||
import "../../lib/bytes/LibPrefixLengthEncodedByteArray.sol";
|
||||
@@ -115,7 +119,9 @@ contract UniswapV4Executor is
|
||||
PathKey[] memory path = new PathKey[](pools.length);
|
||||
for (uint256 i = 0; i < pools.length; i++) {
|
||||
path[i] = PathKey({
|
||||
intermediateCurrency: Currency.wrap(pools[i].intermediaryToken),
|
||||
intermediateCurrency: Currency.wrap(
|
||||
pools[i].intermediaryToken
|
||||
),
|
||||
fee: pools[i].fee,
|
||||
tickSpacing: pools[i].tickSpacing,
|
||||
hooks: IHooks(pools[i].hook),
|
||||
@@ -305,8 +311,8 @@ contract UniswapV4Executor is
|
||||
Currency currencyIn = zeroForOne ? poolKey.currency0 : poolKey.currency1;
|
||||
_settle(currencyIn, amountIn, transferType);
|
||||
uint128 amountOut = _swap(
|
||||
poolKey, zeroForOne, -int256(uint256(amountIn)), hookData
|
||||
).toUint128();
|
||||
poolKey, zeroForOne, -int256(uint256(amountIn)), hookData
|
||||
).toUint128();
|
||||
|
||||
Currency currencyOut =
|
||||
zeroForOne ? poolKey.currency1 : poolKey.currency0;
|
||||
@@ -343,11 +349,11 @@ contract UniswapV4Executor is
|
||||
pathKey.getPoolAndSwapDirection(swapCurrencyIn);
|
||||
// The output delta will always be positive, except for when interacting with certain hook pools
|
||||
amountOut = _swap(
|
||||
poolKey,
|
||||
zeroForOne,
|
||||
-int256(uint256(swapAmountIn)),
|
||||
pathKey.hookData
|
||||
).toUint128();
|
||||
poolKey,
|
||||
zeroForOne,
|
||||
-int256(uint256(swapAmountIn)),
|
||||
pathKey.hookData
|
||||
).toUint128();
|
||||
|
||||
swapAmountIn = amountOut;
|
||||
swapCurrencyIn = pathKey.intermediateCurrency;
|
||||
|
||||
@@ -37,7 +37,9 @@ contract UniswapXFiller is AccessControl, IReactorCallback {
|
||||
address _reactor,
|
||||
address _native_address
|
||||
) {
|
||||
if (_tychoRouter == address(0)) revert UniswapXFiller__AddressZero();
|
||||
if (_tychoRouter == address(0)) {
|
||||
revert UniswapXFiller__AddressZero();
|
||||
}
|
||||
if (_reactor == address(0)) revert UniswapXFiller__AddressZero();
|
||||
|
||||
_grantRole(DEFAULT_ADMIN_ROLE, msg.sender);
|
||||
@@ -73,9 +75,8 @@ contract UniswapXFiller is AccessControl, IReactorCallback {
|
||||
// The TychoRouter will take the input tokens from the filler
|
||||
if (tokenInApprovalNeeded) {
|
||||
// Native ETH input is not supported by UniswapX
|
||||
IERC20(order.input.token).forceApprove(
|
||||
tychoRouter, type(uint256).max
|
||||
);
|
||||
IERC20(order.input.token)
|
||||
.forceApprove(tychoRouter, type(uint256).max);
|
||||
}
|
||||
|
||||
// slither-disable-next-line low-level-calls
|
||||
@@ -125,7 +126,9 @@ contract UniswapXFiller is AccessControl, IReactorCallback {
|
||||
external
|
||||
onlyRole(DEFAULT_ADMIN_ROLE)
|
||||
{
|
||||
if (receiver == address(0)) revert UniswapXFiller__AddressZero();
|
||||
if (receiver == address(0)) {
|
||||
revert UniswapXFiller__AddressZero();
|
||||
}
|
||||
|
||||
for (uint256 i = 0; i < tokens.length; i++) {
|
||||
// slither-disable-next-line calls-loop
|
||||
@@ -144,7 +147,9 @@ contract UniswapXFiller is AccessControl, IReactorCallback {
|
||||
external
|
||||
onlyRole(DEFAULT_ADMIN_ROLE)
|
||||
{
|
||||
if (receiver == address(0)) revert UniswapXFiller__AddressZero();
|
||||
if (receiver == address(0)) {
|
||||
revert UniswapXFiller__AddressZero();
|
||||
}
|
||||
|
||||
uint256 amount = address(this).balance;
|
||||
if (amount > 0) {
|
||||
|
||||
Reference in New Issue
Block a user