refactor: forge fmt (after foundry update)
Took 5 minutes Took 8 seconds
This commit is contained in:
@@ -108,7 +108,8 @@ contract Constants is Test, BaseConstants {
|
||||
address LDO_POOL = 0x9409280DC1e6D33AB7A8C6EC03e5763FB61772B5;
|
||||
address CRV_POOL = 0x8301AE4fc9c624d1D396cbDAa1ed877821D7C511;
|
||||
address AAVE_POOL = 0xDeBF20617708857ebe4F679508E7b7863a8A8EeE;
|
||||
address FRAXPYUSD_POOL = address(0xA5588F7cdf560811710A2D82D3C9c99769DB1Dcb);
|
||||
address FRAXPYUSD_POOL =
|
||||
address(0xA5588F7cdf560811710A2D82D3C9c99769DB1Dcb);
|
||||
address TRICRYPTO2_POOL = 0xD51a44d3FaE010294C616388b506AcdA1bfAAE46;
|
||||
address SUSD_POOL = 0xA5407eAE9Ba41422680e2e00537571bcC53efBfD;
|
||||
address FRAX_USDC_POOL = 0xDcEF968d416a41Cdac0ED8702fAC8128A64241A2;
|
||||
|
||||
@@ -176,17 +176,17 @@ contract GasTest is Commands, Test, Constants {
|
||||
returns (IAllowanceTransfer.PermitSingle memory, bytes memory)
|
||||
{
|
||||
IERC20(tokenIn).approve(PERMIT2_ADDRESS, amount_in);
|
||||
IAllowanceTransfer.PermitSingle memory permitSingle = IAllowanceTransfer
|
||||
.PermitSingle({
|
||||
details: IAllowanceTransfer.PermitDetails({
|
||||
token: tokenIn,
|
||||
amount: uint160(amount_in),
|
||||
expiration: uint48(block.timestamp + 1 days),
|
||||
nonce: 0
|
||||
}),
|
||||
spender: UNIVERSAL_ROUTER,
|
||||
sigDeadline: block.timestamp + 1 days
|
||||
});
|
||||
IAllowanceTransfer.PermitSingle memory permitSingle =
|
||||
IAllowanceTransfer.PermitSingle({
|
||||
details: IAllowanceTransfer.PermitDetails({
|
||||
token: tokenIn,
|
||||
amount: uint160(amount_in),
|
||||
expiration: uint48(block.timestamp + 1 days),
|
||||
nonce: 0
|
||||
}),
|
||||
spender: UNIVERSAL_ROUTER,
|
||||
sigDeadline: block.timestamp + 1 days
|
||||
});
|
||||
|
||||
bytes memory signature = signPermit2(permitSingle, ALICE_PK);
|
||||
return (permitSingle, signature);
|
||||
@@ -223,8 +223,9 @@ contract GasTest is Commands, Test, Constants {
|
||||
)
|
||||
);
|
||||
|
||||
bytes32 digest =
|
||||
keccak256(abi.encodePacked("\x19\x01", domainSeparator, permitHash));
|
||||
bytes32 digest = keccak256(
|
||||
abi.encodePacked("\x19\x01", domainSeparator, permitHash)
|
||||
);
|
||||
(uint8 v, bytes32 r, bytes32 s) = vm.sign(privateKey, digest);
|
||||
|
||||
return abi.encodePacked(r, s, v);
|
||||
|
||||
@@ -2,8 +2,9 @@
|
||||
pragma solidity ^0.8.26;
|
||||
|
||||
import {Test} from "forge-std/Test.sol";
|
||||
import {LibPrefixLengthEncodedByteArray} from
|
||||
"../lib/bytes/LibPrefixLengthEncodedByteArray.sol";
|
||||
import {
|
||||
LibPrefixLengthEncodedByteArray
|
||||
} from "../lib/bytes/LibPrefixLengthEncodedByteArray.sol";
|
||||
|
||||
contract LibPrefixLengthEncodedByteArrayTest is Test {
|
||||
using LibPrefixLengthEncodedByteArray for bytes;
|
||||
|
||||
@@ -25,17 +25,17 @@ contract Permit2TestHelper is Constants {
|
||||
uint256 amount_in
|
||||
) internal returns (IAllowanceTransfer.PermitSingle memory, bytes memory) {
|
||||
IERC20(tokenIn).approve(PERMIT2_ADDRESS, amount_in);
|
||||
IAllowanceTransfer.PermitSingle memory permitSingle = IAllowanceTransfer
|
||||
.PermitSingle({
|
||||
details: IAllowanceTransfer.PermitDetails({
|
||||
token: tokenIn,
|
||||
amount: uint160(amount_in),
|
||||
expiration: uint48(block.timestamp + 1 days),
|
||||
nonce: 0
|
||||
}),
|
||||
spender: spender,
|
||||
sigDeadline: block.timestamp + 1 days
|
||||
});
|
||||
IAllowanceTransfer.PermitSingle memory permitSingle =
|
||||
IAllowanceTransfer.PermitSingle({
|
||||
details: IAllowanceTransfer.PermitDetails({
|
||||
token: tokenIn,
|
||||
amount: uint160(amount_in),
|
||||
expiration: uint48(block.timestamp + 1 days),
|
||||
nonce: 0
|
||||
}),
|
||||
spender: spender,
|
||||
sigDeadline: block.timestamp + 1 days
|
||||
});
|
||||
|
||||
bytes memory signature = signPermit2(permitSingle, ALICE_PK);
|
||||
return (permitSingle, signature);
|
||||
@@ -78,8 +78,9 @@ contract Permit2TestHelper is Constants {
|
||||
)
|
||||
);
|
||||
|
||||
bytes32 digest =
|
||||
keccak256(abi.encodePacked("\x19\x01", domainSeparator, permitHash));
|
||||
bytes32 digest = keccak256(
|
||||
abi.encodePacked("\x19\x01", domainSeparator, permitHash)
|
||||
);
|
||||
(uint8 v, bytes32 r, bytes32 s) = vm.sign(privateKey, digest);
|
||||
|
||||
return abi.encodePacked(r, s, v);
|
||||
|
||||
@@ -183,16 +183,13 @@ contract TychoRouterSequentialSwapTest is TychoRouterTestSetup {
|
||||
vm.startPrank(ALICE);
|
||||
|
||||
IAllowanceTransfer.PermitSingle memory emptyPermitSingle =
|
||||
IAllowanceTransfer.PermitSingle({
|
||||
details: IAllowanceTransfer.PermitDetails({
|
||||
token: address(0),
|
||||
amount: 0,
|
||||
expiration: 0,
|
||||
nonce: 0
|
||||
}),
|
||||
spender: address(0),
|
||||
sigDeadline: 0
|
||||
});
|
||||
IAllowanceTransfer.PermitSingle({
|
||||
details: IAllowanceTransfer.PermitDetails({
|
||||
token: address(0), amount: 0, expiration: 0, nonce: 0
|
||||
}),
|
||||
spender: address(0),
|
||||
sigDeadline: 0
|
||||
});
|
||||
|
||||
bytes[] memory swaps = new bytes[](2);
|
||||
// WETH -> DAI
|
||||
@@ -219,7 +216,9 @@ contract TychoRouterSequentialSwapTest is TychoRouterTestSetup {
|
||||
)
|
||||
);
|
||||
|
||||
uint256 amountOut = tychoRouter.sequentialSwapPermit2{value: amountIn}(
|
||||
uint256 amountOut = tychoRouter.sequentialSwapPermit2{
|
||||
value: amountIn
|
||||
}(
|
||||
amountIn,
|
||||
address(0),
|
||||
USDC_ADDR,
|
||||
@@ -502,8 +501,9 @@ contract TychoRouterSequentialSwapTest is TychoRouterTestSetup {
|
||||
// Approve permit2
|
||||
vm.startPrank(ALICE);
|
||||
IERC20(USDC_ADDR).approve(PERMIT2_ADDRESS, type(uint256).max);
|
||||
bytes memory callData =
|
||||
loadCallDataFromFile("test_sequential_swap_strategy_encoder_unwrap");
|
||||
bytes memory callData = loadCallDataFromFile(
|
||||
"test_sequential_swap_strategy_encoder_unwrap"
|
||||
);
|
||||
(bool success,) = tychoRouterAddr.call(callData);
|
||||
|
||||
vm.stopPrank();
|
||||
|
||||
@@ -203,16 +203,13 @@ contract TychoRouterSingleSwapTest is TychoRouterTestSetup {
|
||||
vm.startPrank(ALICE);
|
||||
|
||||
IAllowanceTransfer.PermitSingle memory emptyPermitSingle =
|
||||
IAllowanceTransfer.PermitSingle({
|
||||
details: IAllowanceTransfer.PermitDetails({
|
||||
token: address(0),
|
||||
amount: 0,
|
||||
expiration: 0,
|
||||
nonce: 0
|
||||
}),
|
||||
spender: address(0),
|
||||
sigDeadline: 0
|
||||
});
|
||||
IAllowanceTransfer.PermitSingle({
|
||||
details: IAllowanceTransfer.PermitDetails({
|
||||
token: address(0), amount: 0, expiration: 0, nonce: 0
|
||||
}),
|
||||
spender: address(0),
|
||||
sigDeadline: 0
|
||||
});
|
||||
|
||||
bytes memory protocolData = encodeUniswapV2Swap(
|
||||
WETH_ADDR,
|
||||
@@ -225,7 +222,9 @@ contract TychoRouterSingleSwapTest is TychoRouterTestSetup {
|
||||
bytes memory swap =
|
||||
encodeSingleSwap(address(usv2Executor), protocolData);
|
||||
|
||||
uint256 amountOut = tychoRouter.singleSwapPermit2{value: amountIn}(
|
||||
uint256 amountOut = tychoRouter.singleSwapPermit2{
|
||||
value: amountIn
|
||||
}(
|
||||
amountIn,
|
||||
address(0),
|
||||
DAI_ADDR,
|
||||
@@ -338,8 +337,9 @@ contract TychoRouterSingleSwapTest is TychoRouterTestSetup {
|
||||
|
||||
vm.startPrank(ALICE);
|
||||
IERC20(WETH_ADDR).approve(tychoRouterAddr, type(uint256).max);
|
||||
bytes memory callData =
|
||||
loadCallDataFromFile("test_single_swap_strategy_encoder_no_permit2");
|
||||
bytes memory callData = loadCallDataFromFile(
|
||||
"test_single_swap_strategy_encoder_no_permit2"
|
||||
);
|
||||
(bool success,) = tychoRouterAddr.call(callData);
|
||||
|
||||
vm.stopPrank();
|
||||
|
||||
@@ -250,16 +250,13 @@ contract TychoRouterSplitSwapTest is TychoRouterTestSetup {
|
||||
vm.startPrank(ALICE);
|
||||
|
||||
IAllowanceTransfer.PermitSingle memory emptyPermitSingle =
|
||||
IAllowanceTransfer.PermitSingle({
|
||||
details: IAllowanceTransfer.PermitDetails({
|
||||
token: address(0),
|
||||
amount: 0,
|
||||
expiration: 0,
|
||||
nonce: 0
|
||||
}),
|
||||
spender: address(0),
|
||||
sigDeadline: 0
|
||||
});
|
||||
IAllowanceTransfer.PermitSingle({
|
||||
details: IAllowanceTransfer.PermitDetails({
|
||||
token: address(0), amount: 0, expiration: 0, nonce: 0
|
||||
}),
|
||||
spender: address(0),
|
||||
sigDeadline: 0
|
||||
});
|
||||
bytes memory protocolData = encodeUniswapV2Swap(
|
||||
WETH_ADDR,
|
||||
WETH_DAI_POOL,
|
||||
@@ -274,7 +271,9 @@ contract TychoRouterSplitSwapTest is TychoRouterTestSetup {
|
||||
bytes[] memory swaps = new bytes[](1);
|
||||
swaps[0] = swap;
|
||||
|
||||
uint256 amountOut = tychoRouter.splitSwapPermit2{value: amountIn}(
|
||||
uint256 amountOut = tychoRouter.splitSwapPermit2{
|
||||
value: amountIn
|
||||
}(
|
||||
amountIn,
|
||||
address(0),
|
||||
DAI_ADDR,
|
||||
|
||||
@@ -2,8 +2,9 @@
|
||||
pragma solidity ^0.8.26;
|
||||
|
||||
import "../TychoRouterTestSetup.sol";
|
||||
import {BalancerV3Executor__InvalidDataLength} from
|
||||
"../../src/executors/BalancerV3Executor.sol";
|
||||
import {
|
||||
BalancerV3Executor__InvalidDataLength
|
||||
} from "../../src/executors/BalancerV3Executor.sol";
|
||||
|
||||
contract BalancerV3ExecutorExposed is BalancerV3Executor {
|
||||
constructor(address _permit2) BalancerV3Executor(_permit2) {}
|
||||
@@ -31,7 +32,8 @@ contract BalancerV3ExecutorTest is Constants, TestUtils {
|
||||
address WETH_osETH_pool =
|
||||
address(0x57c23c58B1D8C3292c15BEcF07c62C5c52457A42);
|
||||
address osETH_ADDR = address(0xf1C9acDc66974dFB6dEcB12aA385b9cD01190E38);
|
||||
address waEthWETH_ADDR = address(0x0bfc9d54Fc184518A81162F8fB99c2eACa081202);
|
||||
address waEthWETH_ADDR =
|
||||
address(0x0bfc9d54Fc184518A81162F8fB99c2eACa081202);
|
||||
|
||||
function setUp() public {
|
||||
uint256 forkBlock = 22625131;
|
||||
|
||||
@@ -7,8 +7,9 @@ import "@src/executors/BebopExecutor.sol";
|
||||
import {Constants} from "../Constants.sol";
|
||||
import {ERC20} from "@openzeppelin/contracts/token/ERC20/ERC20.sol";
|
||||
import {Permit2TestHelper} from "../Permit2TestHelper.sol";
|
||||
import {SafeERC20} from
|
||||
"@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
|
||||
import {
|
||||
SafeERC20
|
||||
} from "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
|
||||
|
||||
contract BebopExecutorExposed is BebopExecutor {
|
||||
constructor(address _bebopSettlement, address _permit2)
|
||||
@@ -114,7 +115,7 @@ contract BebopExecutorTest is Constants, Permit2TestHelper, TestUtils {
|
||||
address tokenIn = WETH_ADDR;
|
||||
address tokenOut = WBTC_ADDR;
|
||||
RestrictTransferFrom.TransferType transferType =
|
||||
RestrictTransferFrom.TransferType.None;
|
||||
RestrictTransferFrom.TransferType.None;
|
||||
uint8 partialFillOffset = 12;
|
||||
uint256 amountIn = 1000000000000000000;
|
||||
bool approvalNeeded = true;
|
||||
@@ -165,7 +166,7 @@ contract BebopExecutorTest is Constants, Permit2TestHelper, TestUtils {
|
||||
address tokenIn = address(0);
|
||||
address tokenOut = WBTC_ADDR;
|
||||
RestrictTransferFrom.TransferType transferType =
|
||||
RestrictTransferFrom.TransferType.None;
|
||||
RestrictTransferFrom.TransferType.None;
|
||||
uint8 partialFillOffset = 12;
|
||||
uint256 amountIn = 1000000000000000000;
|
||||
bool approvalNeeded = false;
|
||||
@@ -212,7 +213,7 @@ contract BebopExecutorTest is Constants, Permit2TestHelper, TestUtils {
|
||||
address tokenIn = WETH_ADDR;
|
||||
address tokenOut = WBTC_ADDR;
|
||||
RestrictTransferFrom.TransferType transferType =
|
||||
RestrictTransferFrom.TransferType.None;
|
||||
RestrictTransferFrom.TransferType.None;
|
||||
uint8 partialFillOffset = 12;
|
||||
// filling only half of the quote
|
||||
uint256 amountIn = 1000000000000000000 / 2;
|
||||
@@ -264,7 +265,7 @@ contract BebopExecutorTest is Constants, Permit2TestHelper, TestUtils {
|
||||
address tokenIn = USDC_ADDR;
|
||||
address tokenOut = ONDO_ADDR;
|
||||
RestrictTransferFrom.TransferType transferType =
|
||||
RestrictTransferFrom.TransferType.None;
|
||||
RestrictTransferFrom.TransferType.None;
|
||||
uint8 partialFillOffset = 2;
|
||||
// filling only half of the quote
|
||||
uint256 amountIn = 20000000000;
|
||||
@@ -318,7 +319,7 @@ contract BebopExecutorTest is Constants, Permit2TestHelper, TestUtils {
|
||||
address tokenIn = USDC_ADDR;
|
||||
address tokenOut = ONDO_ADDR;
|
||||
RestrictTransferFrom.TransferType transferType =
|
||||
RestrictTransferFrom.TransferType.None;
|
||||
RestrictTransferFrom.TransferType.None;
|
||||
uint8 partialFillOffset = 2;
|
||||
// filling only half of the quote
|
||||
uint256 amountIn = 20000000000 / 2;
|
||||
|
||||
@@ -31,11 +31,9 @@ contract HashflowUtils is Test {
|
||||
);
|
||||
}
|
||||
|
||||
function encodeRfqtQuoteWithDefaults(IHashflowRouter.RFQTQuote memory quote)
|
||||
internal
|
||||
pure
|
||||
returns (bytes memory)
|
||||
{
|
||||
function encodeRfqtQuoteWithDefaults(
|
||||
IHashflowRouter.RFQTQuote memory quote
|
||||
) internal pure returns (bytes memory) {
|
||||
return
|
||||
encodeRfqtQuote(quote, true, RestrictTransferFrom.TransferType.None);
|
||||
}
|
||||
@@ -183,7 +181,9 @@ contract HashflowExecutorECR20Test is Constants, TestUtils, HashflowUtils {
|
||||
{
|
||||
return IHashflowRouter.RFQTQuote({
|
||||
pool: address(0x5d8853028fbF6a2da43c7A828cc5f691E9456B44),
|
||||
externalAccount: address(0x9bA0CF1588E1DFA905eC948F7FE5104dD40EDa31),
|
||||
externalAccount: address(
|
||||
0x9bA0CF1588E1DFA905eC948F7FE5104dD40EDa31
|
||||
),
|
||||
trader: address(ALICE),
|
||||
effectiveTrader: address(ALICE),
|
||||
baseToken: WETH_ADDR,
|
||||
@@ -243,7 +243,9 @@ contract HashflowExecutorNativeTest is Constants, HashflowUtils {
|
||||
{
|
||||
return IHashflowRouter.RFQTQuote({
|
||||
pool: address(0x713DC4Df480235dBe2fB766E7120Cbd4041Dcb58),
|
||||
externalAccount: address(0x111BB8c3542F2B92fb41B8d913c01D3788431111),
|
||||
externalAccount: address(
|
||||
0x111BB8c3542F2B92fb41B8d913c01D3788431111
|
||||
),
|
||||
trader: address(ALICE),
|
||||
effectiveTrader: address(ALICE),
|
||||
baseToken: address(0x0000000000000000000000000000000000000000),
|
||||
|
||||
@@ -92,9 +92,7 @@ contract UniswapXFillerTest is Test, TychoRouterTestSetup {
|
||||
additionalValidationData: ""
|
||||
}),
|
||||
input: InputToken({
|
||||
token: address(WETH_ADDR),
|
||||
amount: amountIn,
|
||||
maxAmount: amountIn
|
||||
token: address(WETH_ADDR), amount: amountIn, maxAmount: amountIn
|
||||
}),
|
||||
outputs: outputs,
|
||||
sig: "",
|
||||
@@ -132,9 +130,10 @@ contract UniswapXFillerTest is Test, TychoRouterTestSetup {
|
||||
|
||||
vm.startPrank(address(0xD213e6F6dCB2DBaC03FA28b893F6dA1BD822e852));
|
||||
// Approve Permit2
|
||||
IERC20(DAI_ADDR).approve(
|
||||
address(0x000000000022D473030F116dDEE9F6B43aC78BA3), amountIn
|
||||
);
|
||||
IERC20(DAI_ADDR)
|
||||
.approve(
|
||||
address(0x000000000022D473030F116dDEE9F6B43aC78BA3), amountIn
|
||||
);
|
||||
vm.stopPrank();
|
||||
|
||||
// Tx 0x005d7b150017ba1b59d2f99395ccae7bda9b739938ade4e509817e32760aaf9d
|
||||
|
||||
Reference in New Issue
Block a user