From e501cca7d5a9ebf611bae4011621e318a045408a Mon Sep 17 00:00:00 2001 From: TokenTitan Date: Tue, 30 Jul 2024 20:29:23 +0530 Subject: [PATCH] fix: changed import style for consistency --- script/{test => examples}/CronCounter.s.sol | 7 +++---- script/{test => examples}/SelfCheckout.s.sol | 0 test/AssociatedDataStorage.t.sol | 2 +- test/CronCounter.t.sol | 4 ++-- test/FlashLiquidity.t.sol | 3 +-- test/FlashPillTest.t.sol | 4 ++-- test/NoopTurnerTest.t.sol | 4 ++-- test/PnP.t.sol | 6 +++--- test/Sandwich.t.sol | 4 ++-- test/SlippageProtection.t.sol | 2 +- test/examples/CronCounter.sol | 2 +- test/examples/{ => DeFi}/FlashLiquidity.sol | 7 +++++-- test/examples/{ => DeFi}/SwapPool.sol | 4 ++-- test/examples/FlashPill.sol | 4 ++-- test/examples/NoopTurner.sol | 6 +++--- test/examples/PnP.sol | 2 +- test/solve-lib/CronCounterLib.sol | 8 ++++---- test/solve-lib/{ => DeFi}/FlashLiquidityLib.sol | 2 +- test/solve-lib/{ => DeFi}/SlippageProtectionLib.sol | 2 +- test/solve-lib/PnPLib.sol | 8 ++++---- test/utils/MockPositionManager.sol | 2 +- test/utils/MockSwapRouter.sol | 4 ++-- 22 files changed, 44 insertions(+), 43 deletions(-) rename script/{test => examples}/CronCounter.s.sol (84%) rename script/{test => examples}/SelfCheckout.s.sol (100%) rename test/examples/{ => DeFi}/FlashLiquidity.sol (99%) rename test/examples/{ => DeFi}/SwapPool.sol (98%) rename test/solve-lib/{ => DeFi}/FlashLiquidityLib.sol (99%) rename test/solve-lib/{ => DeFi}/SlippageProtectionLib.sol (99%) diff --git a/script/test/CronCounter.s.sol b/script/examples/CronCounter.s.sol similarity index 84% rename from script/test/CronCounter.s.sol rename to script/examples/CronCounter.s.sol index f5e383d..180fd45 100644 --- a/script/test/CronCounter.s.sol +++ b/script/examples/CronCounter.s.sol @@ -5,7 +5,6 @@ pragma solidity 0.8.26; import {Script} from "forge-std/Script.sol"; import {BaseDeployer} from "../BaseDeployer.s.sol"; import {CronCounter} from "test/examples/CronCounter.sol"; -import {MyErc20} from "test/examples/MyErc20.sol"; /* solhint-disable no-console*/ import {console2} from "forge-std/console2.sol"; @@ -51,10 +50,10 @@ contract DeployCronCounter is Script, BaseDeployer { /// @dev Function to perform actual deployment. function chainDeploySmartedContract() private broadcast(_deployerPrivateKey) { - address cronTwoCounter = address(new CronCounter{salt: _salt}(_callBreaker)); + address cronCounter = address(new CronCounter{salt: _salt}(_callBreaker)); - require(_create2addr == cronTwoCounter, "Address mismatch CronCounter"); + require(_create2addr == cronCounter, "Address mismatch CronCounter"); - console2.log("CronCounter deployed at address:", cronTwoCounter, "\n"); + console2.log("CronCounter deployed at address:", cronCounter, "\n"); } } diff --git a/script/test/SelfCheckout.s.sol b/script/examples/SelfCheckout.s.sol similarity index 100% rename from script/test/SelfCheckout.s.sol rename to script/examples/SelfCheckout.s.sol diff --git a/test/AssociatedDataStorage.t.sol b/test/AssociatedDataStorage.t.sol index f2fd5ba..6fee954 100644 --- a/test/AssociatedDataStorage.t.sol +++ b/test/AssociatedDataStorage.t.sol @@ -2,7 +2,7 @@ pragma solidity ^0.8.0; import {Test} from "forge-std/Test.sol"; -import {AssociatedDataStorage, AssociatedDataLib} from "../src/CallBreakerTypes.sol"; +import {AssociatedDataStorage, AssociatedDataLib} from "src/CallBreakerTypes.sol"; contract AssociatedDataStorageTest is Test { AssociatedDataStorage assocData; diff --git a/test/CronCounter.t.sol b/test/CronCounter.t.sol index 783679c..15b5ffc 100644 --- a/test/CronCounter.t.sol +++ b/test/CronCounter.t.sol @@ -6,8 +6,8 @@ import "forge-std/Vm.sol"; import "./solve-lib/CronCounterLib.sol"; -import "../src/lamination/Laminator.sol"; -import "../src/timetravel/CallBreaker.sol"; +import "src/lamination/Laminator.sol"; +import "src/timetravel/CallBreaker.sol"; contract CronTest is Test, CronCounterLib { address deployer; diff --git a/test/FlashLiquidity.t.sol b/test/FlashLiquidity.t.sol index 376d38b..2e39ab0 100644 --- a/test/FlashLiquidity.t.sol +++ b/test/FlashLiquidity.t.sol @@ -3,8 +3,7 @@ pragma solidity 0.8.26; import "forge-std/Test.sol"; -import "../src/timetravel/CallBreaker.sol"; -import "../test/solve-lib/FlashLiquidityLib.sol"; +import "test/solve-lib/FlashLiquidityLib.sol"; contract FlashLiquidityTest is Test, FlashLiquidityLib { address deployer; diff --git a/test/FlashPillTest.t.sol b/test/FlashPillTest.t.sol index b2a9801..961c388 100644 --- a/test/FlashPillTest.t.sol +++ b/test/FlashPillTest.t.sol @@ -3,8 +3,8 @@ pragma solidity 0.8.26; import "forge-std/Test.sol"; -import "../src/timetravel/CallBreaker.sol"; -import "../test/examples/FlashPill.sol"; +import "src/timetravel/CallBreaker.sol"; +import "test/examples/FlashPill.sol"; contract FlashPillTest is Test { CallBreaker private callbreaker; diff --git a/test/NoopTurnerTest.t.sol b/test/NoopTurnerTest.t.sol index 2fa7c7e..4ca73c7 100644 --- a/test/NoopTurnerTest.t.sol +++ b/test/NoopTurnerTest.t.sol @@ -2,8 +2,8 @@ pragma solidity 0.8.26; import "forge-std/Test.sol"; -import "../src/timetravel/CallBreaker.sol"; -import "../test/examples/NoopTurner.sol"; +import "src/timetravel/CallBreaker.sol"; +import "test/examples/NoopTurner.sol"; contract NoopTurnerTest is Test { CallBreaker public callbreaker; diff --git a/test/PnP.t.sol b/test/PnP.t.sol index ef47df1..2769b74 100644 --- a/test/PnP.t.sol +++ b/test/PnP.t.sol @@ -3,9 +3,9 @@ pragma solidity 0.8.26; import "forge-std/Test.sol"; -import "../src/timetravel/CallBreaker.sol"; -import "../test/examples/PnP.sol"; -import "../test/solve-lib/PnPLib.sol"; +import "src/timetravel/CallBreaker.sol"; +import "test/examples/PnP.sol"; +import "test/solve-lib/PnPLib.sol"; contract PnPTest is Test, PnPLib { address deployer; diff --git a/test/Sandwich.t.sol b/test/Sandwich.t.sol index e523e01..9cb2478 100644 --- a/test/Sandwich.t.sol +++ b/test/Sandwich.t.sol @@ -6,8 +6,8 @@ import "forge-std/Vm.sol"; import "./solve-lib/CronCounterLib.sol"; -import "../src/lamination/Laminator.sol"; -import "../src/timetravel/CallBreaker.sol"; +import "src/lamination/Laminator.sol"; +import "src/timetravel/CallBreaker.sol"; contract CronTest is Test, CronCounterLib { address deployer; diff --git a/test/SlippageProtection.t.sol b/test/SlippageProtection.t.sol index 34a08ac..6d13fe9 100644 --- a/test/SlippageProtection.t.sol +++ b/test/SlippageProtection.t.sol @@ -4,7 +4,7 @@ pragma solidity 0.8.26; import "forge-std/Test.sol"; import "src/timetravel/CallBreaker.sol"; -import "test/solve-lib/SlippageProtectionLib.sol"; +import "test/solve-lib/DeFi/SlippageProtectionLib.sol"; contract SlippageProtectionTest is Test, SlippageProtectionLib { address deployer; diff --git a/test/examples/CronCounter.sol b/test/examples/CronCounter.sol index c7374b8..d0405ae 100644 --- a/test/examples/CronCounter.sol +++ b/test/examples/CronCounter.sol @@ -2,7 +2,7 @@ pragma solidity 0.8.26; -import "../../src/timetravel/SmarterContract.sol"; +import "src/timetravel/SmarterContract.sol"; contract CronCounter is SmarterContract { mapping(address => uint256) private _counters; diff --git a/test/examples/FlashLiquidity.sol b/test/examples/DeFi/FlashLiquidity.sol similarity index 99% rename from test/examples/FlashLiquidity.sol rename to test/examples/DeFi/FlashLiquidity.sol index c998fb2..e8b09fc 100644 --- a/test/examples/FlashLiquidity.sol +++ b/test/examples/DeFi/FlashLiquidity.sol @@ -1,12 +1,14 @@ // SPDX-License-Identifier: GPL-3.0 pragma solidity 0.8.26; +import "forge-std/console.sol"; + import "openzeppelin/token/ERC20/ERC20.sol"; +import "test/utils/interfaces/IWeth.sol"; +import "test/utils/interfaces/ISwapRouter.sol"; import "src/timetravel/CallBreaker.sol"; import "src/timetravel/SmarterContract.sol"; import "src/TimeTypes.sol"; -import "test/utils/interfaces/ISwapRouter.sol"; -import "test/utils/interfaces/IWeth.sol"; address constant DAI = 0x6B175474E89094C44Da98b954EedeAC495271d0F; address constant WETH9 = 0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2; @@ -67,6 +69,7 @@ contract FlashLiquidity is SmarterContract { // The call to `exactInputSingle` executes the swap. uint256 amountOut = router.exactInputSingle(params); + console.log("WETH", amountOut); // check whether or not CallObject memory callObj = CallObject({ diff --git a/test/examples/SwapPool.sol b/test/examples/DeFi/SwapPool.sol similarity index 98% rename from test/examples/SwapPool.sol rename to test/examples/DeFi/SwapPool.sol index aead196..34abfa8 100644 --- a/test/examples/SwapPool.sol +++ b/test/examples/DeFi/SwapPool.sol @@ -6,8 +6,8 @@ import "src/timetravel/SmarterContract.sol"; import "src/TimeTypes.sol"; import "test/utils/interfaces/ISwapRouter.sol"; -import {IWETH, IERC20} from "../utils/interfaces/IWeth.sol"; -import {IPositionManager} from "../utils/interfaces/IPositionManager.sol"; +import {IWETH, IERC20} from "test/utils/interfaces/IWeth.sol"; +import {IPositionManager} from "test/utils/interfaces/IPositionManager.sol"; // pool fee, 0.3%. uint24 constant poolFee = 3000; diff --git a/test/examples/FlashPill.sol b/test/examples/FlashPill.sol index 1665c13..5599284 100644 --- a/test/examples/FlashPill.sol +++ b/test/examples/FlashPill.sol @@ -2,8 +2,8 @@ pragma solidity 0.8.26; import "openzeppelin/token/ERC20/IERC20.sol"; -import "../../src/timetravel/CallBreaker.sol"; -import "../../src/timetravel/SmarterContract.sol"; +import "src/timetravel/CallBreaker.sol"; +import "src/timetravel/SmarterContract.sol"; contract FlashPill is IERC20, SmarterContract { mapping(address => uint256) private _balances; diff --git a/test/examples/NoopTurner.sol b/test/examples/NoopTurner.sol index 17f4d3e..c74643f 100644 --- a/test/examples/NoopTurner.sol +++ b/test/examples/NoopTurner.sol @@ -2,9 +2,9 @@ pragma solidity 0.8.26; -import "../../src/timetravel/CallBreaker.sol"; -import "../../src/timetravel/SmarterContract.sol"; -import "../../src/TimeTypes.sol"; +import "src/timetravel/CallBreaker.sol"; +import "src/timetravel/SmarterContract.sol"; +import "src/TimeTypes.sol"; contract NoopTurner is SmarterContract { address private _callbreakerAddress; diff --git a/test/examples/PnP.sol b/test/examples/PnP.sol index 9a1756f..9c926fc 100644 --- a/test/examples/PnP.sol +++ b/test/examples/PnP.sol @@ -2,7 +2,7 @@ pragma solidity 0.8.26; -import "../../src/timetravel/CallBreaker.sol"; +import "src/timetravel/CallBreaker.sol"; contract PnP { address private _callbreakerAddress; diff --git a/test/solve-lib/CronCounterLib.sol b/test/solve-lib/CronCounterLib.sol index ebf29a1..e7c0866 100644 --- a/test/solve-lib/CronCounterLib.sol +++ b/test/solve-lib/CronCounterLib.sol @@ -3,10 +3,10 @@ pragma solidity 0.8.26; import "forge-std/Vm.sol"; -import "../../src/lamination/Laminator.sol"; -import "../../src/timetravel/CallBreaker.sol"; -import "../../test/examples/CronCounter.sol"; -import "../../src/timetravel/SmarterContract.sol"; +import "src/lamination/Laminator.sol"; +import "src/timetravel/CallBreaker.sol"; +import "test/examples/CronCounter.sol"; +import "src/timetravel/SmarterContract.sol"; // for the next year, every day: // tip the pusher with a little eth diff --git a/test/solve-lib/FlashLiquidityLib.sol b/test/solve-lib/DeFi/FlashLiquidityLib.sol similarity index 99% rename from test/solve-lib/FlashLiquidityLib.sol rename to test/solve-lib/DeFi/FlashLiquidityLib.sol index 4578484..fc7eae1 100644 --- a/test/solve-lib/FlashLiquidityLib.sol +++ b/test/solve-lib/DeFi/FlashLiquidityLib.sol @@ -4,7 +4,7 @@ pragma solidity 0.8.26; import "src/lamination/Laminator.sol"; import "src/timetravel/CallBreaker.sol"; import "src/timetravel/SmarterContract.sol"; -import "test/examples/SwapPool.sol"; +import "test/examples/DeFi/SwapPool.sol"; import "test/utils/MockERC20Token.sol"; import "test/utils/MockSwapRouter.sol"; import "test/utils/MockPositionManager.sol"; diff --git a/test/solve-lib/SlippageProtectionLib.sol b/test/solve-lib/DeFi/SlippageProtectionLib.sol similarity index 99% rename from test/solve-lib/SlippageProtectionLib.sol rename to test/solve-lib/DeFi/SlippageProtectionLib.sol index 9ac5809..2c1b006 100644 --- a/test/solve-lib/SlippageProtectionLib.sol +++ b/test/solve-lib/DeFi/SlippageProtectionLib.sol @@ -3,7 +3,7 @@ pragma solidity 0.8.26; import "src/lamination/Laminator.sol"; import "src/timetravel/CallBreaker.sol"; -import "test/examples/SwapPool.sol"; +import "test/examples/DeFi/SwapPool.sol"; import "test/utils/MockERC20Token.sol"; import "test/utils/MockSwapRouter.sol"; import "test/utils/MockPositionManager.sol"; diff --git a/test/solve-lib/PnPLib.sol b/test/solve-lib/PnPLib.sol index 2cea968..1e5028a 100644 --- a/test/solve-lib/PnPLib.sol +++ b/test/solve-lib/PnPLib.sol @@ -3,10 +3,10 @@ pragma solidity 0.8.26; import "forge-std/Vm.sol"; -import "../../src/lamination/Laminator.sol"; -import "../../src/timetravel/CallBreaker.sol"; -import "../../test/examples/PnP.sol"; -import "../../src/timetravel/SmarterContract.sol"; +import "src/lamination/Laminator.sol"; +import "src/timetravel/CallBreaker.sol"; +import "src/timetravel/SmarterContract.sol"; +import "test/examples/PnP.sol"; contract PnPLib { address payable public pusherLaminated; diff --git a/test/utils/MockPositionManager.sol b/test/utils/MockPositionManager.sol index dbd7089..c226283 100644 --- a/test/utils/MockPositionManager.sol +++ b/test/utils/MockPositionManager.sol @@ -2,7 +2,7 @@ pragma solidity ^0.8.13; import {IPositionManager} from "./interfaces/IPositionManager.sol"; -import {ISwapRouter} from "../utils/interfaces/ISwapRouter.sol"; +import {ISwapRouter} from "./interfaces/ISwapRouter.sol"; /** * @notice Oversimplified mock version of a Position Manager diff --git a/test/utils/MockSwapRouter.sol b/test/utils/MockSwapRouter.sol index c8949f6..be7bcfc 100644 --- a/test/utils/MockSwapRouter.sol +++ b/test/utils/MockSwapRouter.sol @@ -1,8 +1,8 @@ // SPDX-License-Identifier: GPL-3.0 pragma solidity 0.8.26; -import {IWETH, IERC20} from "../utils/interfaces/IWeth.sol"; -import {ISwapRouter} from "../utils/interfaces/ISwapRouter.sol"; +import {IWETH, IERC20} from "./interfaces/IWeth.sol"; +import {ISwapRouter} from "./interfaces/ISwapRouter.sol"; /** * @notice Oversimplified mock version of a router