From 17176efada1bd91f6add8b6ee7ca3f70f0b03dda Mon Sep 17 00:00:00 2001 From: Cody Born Date: Fri, 20 Sep 2024 16:18:32 -0400 Subject: [PATCH] V3 deployment script (#275) --- script/DeployDutchV3.s.sol | 31 +++++++++++++++++++++++++++++++ src/lib/V3DutchOrderLib.sol | 2 +- 2 files changed, 32 insertions(+), 1 deletion(-) create mode 100644 script/DeployDutchV3.s.sol diff --git a/script/DeployDutchV3.s.sol b/script/DeployDutchV3.s.sol new file mode 100644 index 00000000..d960cd42 --- /dev/null +++ b/script/DeployDutchV3.s.sol @@ -0,0 +1,31 @@ +// SPDX-License-Identifier: GPL-2.0-or-later +pragma solidity ^0.8.13; + +import "forge-std/console2.sol"; +import "forge-std/Script.sol"; +import {IPermit2} from "permit2/src/interfaces/IPermit2.sol"; +import {V3DutchOrderReactor} from "../src/reactors/V3DutchOrderReactor.sol"; + +struct V3DutchOrderDeployment { + IPermit2 permit2; + V3DutchOrderReactor reactor; +} + +contract DeployDutchV3 is Script { + address constant PERMIT2 = 0x000000000022D473030F116dDEE9F6B43aC78BA3; + + function setUp() public {} + + function run() public returns (V3DutchOrderDeployment memory deployment) { + address owner = vm.envAddress("FOUNDRY_REACTOR_OWNER"); + console2.log("Owner", owner); + vm.startBroadcast(); + + V3DutchOrderReactor reactor = new V3DutchOrderReactor{salt: 0x00}(IPermit2(PERMIT2), owner); + console2.log("Reactor", address(reactor)); + + vm.stopBroadcast(); + + return V3DutchOrderDeployment(IPermit2(PERMIT2), reactor); + } +} diff --git a/src/lib/V3DutchOrderLib.sol b/src/lib/V3DutchOrderLib.sol index b9f7ac48..71174146 100644 --- a/src/lib/V3DutchOrderLib.sol +++ b/src/lib/V3DutchOrderLib.sol @@ -205,7 +205,7 @@ library V3DutchOrderLib { /// @notice get the digest of the cosigner data /// @param order the priorityOrder /// @param orderHash the hash of the order - function cosignerDigest(V3DutchOrder memory order, bytes32 orderHash) internal view returns (bytes32) { + function cosignerDigest(V3DutchOrder memory order, bytes32 orderHash) internal pure returns (bytes32) { return keccak256(abi.encodePacked(orderHash, abi.encode(order.cosignerData))); } }