Skip to content

Commit e4df7de

Browse files
committed
Temp new deploy script
1 parent 2eaf8c2 commit e4df7de

1 file changed

Lines changed: 25 additions & 7 deletions

File tree

script/DeployGPv2.s.sol

Lines changed: 25 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,16 @@ import { IVault } from "../contracts/interfaces/IVault.sol";
1010

1111
string constant junkSeedPhrase = "test test test test test test test test test test test junk";
1212

13+
interface Deployer {
14+
function deploy(bytes32 _salt, bytes memory _initCode, bytes calldata _initializer)
15+
external
16+
payable
17+
returns (address deployedAddress);
18+
}
19+
1320
abstract contract GPv2DeployScript is Script {
1421
address internal constant BALANCER_VAULT = 0xBA12222222228d8Ba445958a75a0704d566BF2C8;
22+
Deployer internal constant DEPLOYER = Deployer(0x0000000040293A1f6542ba004343F80669b5160a);
1523

1624
struct Deployment {
1725
address deployer;
@@ -28,17 +36,27 @@ abstract contract GPv2DeployScript is Script {
2836
function deploy(uint256 expectedChainId) internal returns (Deployment memory deployment) {
2937
require(block.chainid == expectedChainId, "DeployGPv2: wrong chain");
3038

31-
deployment.deployer = walletAddress;
39+
deployment.deployer = address(DEPLOYER);
3240
deployment.manager = walletAddress;
3341

3442
vm.startBroadcast(privateKey);
3543

36-
// TODO: DO NOT USE THIS YET. Init should happen at the same time.
37-
GPv2AllowListAuthentication authenticator = new GPv2AllowListAuthentication();
38-
authenticator.initializeManager(deployment.manager);
39-
40-
GPv2Settlement settlement =
41-
new GPv2Settlement(GPv2Authentication(address(authenticator)), IVault(BALANCER_VAULT));
44+
address authenticatorAddress = DEPLOYER.deploy(
45+
bytes32(0),
46+
type(GPv2AllowListAuthentication).creationCode,
47+
abi.encodeCall(GPv2AllowListAuthentication.initializeManager, (deployment.manager))
48+
);
49+
GPv2AllowListAuthentication authenticator = GPv2AllowListAuthentication(authenticatorAddress);
50+
51+
address settlementAddress = DEPLOYER.deploy(
52+
bytes32(0),
53+
abi.encodePacked(
54+
type(GPv2Settlement).creationCode,
55+
abi.encode(GPv2Authentication(address(authenticator)), IVault(BALANCER_VAULT))
56+
),
57+
""
58+
);
59+
GPv2Settlement settlement = GPv2Settlement(payable(settlementAddress));
4260

4361
vm.stopBroadcast();
4462

0 commit comments

Comments
 (0)