From 914146a3904541192f2cb0906c0990cc6f90b1e3 Mon Sep 17 00:00:00 2001 From: Anna Carroll Date: Mon, 5 Aug 2024 12:34:05 +0200 Subject: [PATCH] one contract per file, files match contract names (#75) * one contract per file, files match contract names * snapshot --- .gas-snapshot | 4 ++-- script/Zenith.s.sol | 5 +++-- src/{Transact.sol => Transactor.sol} | 0 src/orders/HostOrders.sol | 9 +++++++++ src/orders/{Orders.sol => RollupOrders.sol} | 4 ---- test/Orders.t.sol | 2 +- test/Permit2Orders.t.sol | 2 +- test/Permit2Passage.t.sol | 2 +- test/{Transact.t.sol => Transactor.t.sol} | 2 +- 9 files changed, 18 insertions(+), 12 deletions(-) rename src/{Transact.sol => Transactor.sol} (100%) create mode 100644 src/orders/HostOrders.sol rename src/orders/{Orders.sol => RollupOrders.sol} (76%) rename test/{Transact.t.sol => Transactor.t.sol} (98%) diff --git a/.gas-snapshot b/.gas-snapshot index f5c9275..c0a4b27 100644 --- a/.gas-snapshot +++ b/.gas-snapshot @@ -1,8 +1,8 @@ GnosisSafeTest:test_gnosis_receive() (gas: 15927) OrderOriginPermit2Test:test_fillPermit2() (gas: 223464) -OrderOriginPermit2Test:test_fillPermit2_multi() (gas: 1010764) +OrderOriginPermit2Test:test_fillPermit2_multi() (gas: 1007964) OrderOriginPermit2Test:test_initiatePermit2() (gas: 233946) -OrderOriginPermit2Test:test_initiatePermit2_multi() (gas: 984506) +OrderOriginPermit2Test:test_initiatePermit2_multi() (gas: 981706) OrdersTest:test_fill_ERC20() (gas: 71459) OrdersTest:test_fill_ETH() (gas: 69090) OrdersTest:test_fill_both() (gas: 167814) diff --git a/script/Zenith.s.sol b/script/Zenith.s.sol index e0c927a..6d76e6c 100644 --- a/script/Zenith.s.sol +++ b/script/Zenith.s.sol @@ -3,8 +3,9 @@ pragma solidity 0.8.26; // deploy contracts import {Zenith} from "../src/Zenith.sol"; -import {Transactor} from "../src/Transact.sol"; -import {HostOrders, RollupOrders} from "../src/orders/Orders.sol"; +import {Transactor} from "../src/Transactor.sol"; +import {HostOrders} from "../src/orders/HostOrders.sol"; +import {RollupOrders} from "../src/orders/RollupOrders.sol"; import {Passage} from "../src/passage/Passage.sol"; import {RollupPassage} from "../src/passage/RollupPassage.sol"; // utils diff --git a/src/Transact.sol b/src/Transactor.sol similarity index 100% rename from src/Transact.sol rename to src/Transactor.sol diff --git a/src/orders/HostOrders.sol b/src/orders/HostOrders.sol new file mode 100644 index 0000000..fed0e7a --- /dev/null +++ b/src/orders/HostOrders.sol @@ -0,0 +1,9 @@ +// SPDX-License-Identifier: MIT OR Apache-2.0 +pragma solidity 0.8.26; + +import {OrderDestination} from "./OrderDestination.sol"; +import {UsesPermit2} from "../UsesPermit2.sol"; + +contract HostOrders is OrderDestination { + constructor(address _permit2) UsesPermit2(_permit2) {} +} diff --git a/src/orders/Orders.sol b/src/orders/RollupOrders.sol similarity index 76% rename from src/orders/Orders.sol rename to src/orders/RollupOrders.sol index 0176f48..4c89d0b 100644 --- a/src/orders/Orders.sol +++ b/src/orders/RollupOrders.sol @@ -5,10 +5,6 @@ import {OrderDestination} from "./OrderDestination.sol"; import {OrderOrigin} from "./OrderOrigin.sol"; import {UsesPermit2} from "../UsesPermit2.sol"; -contract HostOrders is OrderDestination { - constructor(address _permit2) UsesPermit2(_permit2) {} -} - contract RollupOrders is OrderOrigin, OrderDestination { constructor(address _permit2) UsesPermit2(_permit2) {} } diff --git a/test/Orders.t.sol b/test/Orders.t.sol index ec478b4..6133e9d 100644 --- a/test/Orders.t.sol +++ b/test/Orders.t.sol @@ -3,7 +3,7 @@ pragma solidity 0.8.26; // test contracts import {IOrders} from "../src/orders/IOrders.sol"; -import {RollupOrders} from "../src/orders/Orders.sol"; +import {RollupOrders} from "../src/orders/RollupOrders.sol"; import {OrderOrigin} from "../src/orders/OrderOrigin.sol"; // utils import {TestERC20} from "./Helpers.t.sol"; diff --git a/test/Permit2Orders.t.sol b/test/Permit2Orders.t.sol index bac0fbe..2110044 100644 --- a/test/Permit2Orders.t.sol +++ b/test/Permit2Orders.t.sol @@ -2,7 +2,7 @@ pragma solidity 0.8.26; // test contracts -import {RollupOrders} from "../src/orders/Orders.sol"; +import {RollupOrders} from "../src/orders/RollupOrders.sol"; import {IOrders} from "../src/orders/IOrders.sol"; import {UsesPermit2} from "../src/UsesPermit2.sol"; // utils diff --git a/test/Permit2Passage.t.sol b/test/Permit2Passage.t.sol index 15f42c1..6b744d3 100644 --- a/test/Permit2Passage.t.sol +++ b/test/Permit2Passage.t.sol @@ -130,7 +130,7 @@ contract RollupPassagePermit2Test is SharedPermit2Test { _setUpPermit2(token, amount); _setupSinglePermit(token, amount); - // deploy Passage + // deploy RollupPassage target = new RollupPassage(address(permit2Contract)); vm.label(address(target), "passage"); diff --git a/test/Transact.t.sol b/test/Transactor.t.sol similarity index 98% rename from test/Transact.t.sol rename to test/Transactor.t.sol index cb35111..a445b3f 100644 --- a/test/Transact.t.sol +++ b/test/Transactor.t.sol @@ -2,7 +2,7 @@ pragma solidity 0.8.26; // test contracts -import {Transactor} from "../src/Transact.sol"; +import {Transactor} from "../src/Transactor.sol"; import {Passage} from "../src/passage/Passage.sol"; // utils import {Test, console2} from "forge-std/Test.sol";