-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path00_LvrShield.s.sol
38 lines (31 loc) · 1.66 KB
/
00_LvrShield.s.sol
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.24;
import "forge-std/Script.sol";
import {Hooks} from "v4-core/src/libraries/Hooks.sol";
import {PoolManager} from "v4-core/src/PoolManager.sol";
import {IPoolManager} from "v4-core/src/interfaces/IPoolManager.sol";
import {PoolModifyLiquidityTest} from "v4-core/src/test/PoolModifyLiquidityTest.sol";
import {PoolSwapTest} from "v4-core/src/test/PoolSwapTest.sol";
import {PoolDonateTest} from "v4-core/src/test/PoolDonateTest.sol";
import {BidRegistry} from "../src/BidRegistry.sol";
import {LvrShield} from "../src/LvrShield.sol";
import {HookMiner} from "../test/utils/HookMiner.sol";
contract LvrShieldScript is Script {
address constant CREATE2_DEPLOYER = address(0x4e59b44847b379578588920cA78FbF26c0B4956C);
address constant ARBITRUM_SEPOLIA_POOLMANAGER = address(0xE5dF461803a59292c6c03978c17857479c40bc46);
function setUp() public {}
function run() public {
// hook contracts must have specific flags encoded in the address
uint160 flags = uint160(
Hooks.BEFORE_SWAP_FLAG | Hooks.AFTER_SWAP_FLAG
);
// Mine a salt that will produce a hook address with the correct flags
(address hookAddress, bytes32 salt) =
HookMiner.find(CREATE2_DEPLOYER, flags, type(LvrShield).creationCode, abi.encode(address(ARBITRUM_SEPOLIA_POOLMANAGER)));
// Deploy the hook using CREATE2
vm.broadcast();
LvrShield lvrShield = new LvrShield{salt: salt}(IPoolManager(address(ARBITRUM_SEPOLIA_POOLMANAGER)));
// lvrShield.setBidRegistry()
require(address(lvrShield) == hookAddress, "LvrShieldScript: hook address mismatch");
}
}