Skip to content

Commit be453bf

Browse files
feat: update tooling to support multi-chain deploy (#547)
* feat: add deployRegisterPayload * chore: bump address book * fix: ensure target contract deployed for ppc * chore: fix build '
1 parent 5e58acb commit be453bf

File tree

3 files changed

+24
-2
lines changed

3 files changed

+24
-2
lines changed

foundry.lock

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"lib/aave-address-book": {
33
"branch": {
44
"name": "main",
5-
"rev": "79e2a33c0d655ded55c31ec4509bd541dedb5ff5"
5+
"rev": "a31803177d717939ba8eceba54fee069235bd9c5"
66
}
77
},
88
"lib/forge-std": {

lib/aave-address-book

src/GovV3Helpers.sol

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -261,6 +261,25 @@ library GovV3Helpers {
261261
return bytecodeHash;
262262
}
263263

264+
/**
265+
* @notice method to deploy the payload contracts and register them on payloads controller for a given network
266+
* @param chainId the chain id for the network where payload will be deployed and registered
267+
* @param payloadBytecode list of payload creation bytecode which will be deployed and registered
268+
*/
269+
function deployRegisterPayload(Vm vm, uint256 chainId, bytes[] memory payloadBytecode) internal {
270+
ChainHelpers.selectChain(vm, chainId);
271+
vm.startBroadcast();
272+
273+
IPayloadsControllerCore.ExecutionAction[] memory actions = new IPayloadsControllerCore.ExecutionAction[](payloadBytecode.length);
274+
for (uint256 i = 0; i < payloadBytecode.length; i++) {
275+
address payload = deployDeterministic(payloadBytecode[i]);
276+
actions[i] = buildAction(payload);
277+
}
278+
279+
createPayload(actions);
280+
vm.stopBroadcast();
281+
}
282+
264283
/**
265284
* @dev builds a action to be registered on a payloadsController
266285
* - assumes accesscontrol level 1
@@ -382,6 +401,9 @@ library GovV3Helpers {
382401
if (payloadCreated && payload.createdAt > block.timestamp - 7 days) {
383402
revert PayloadAlreadyCreated();
384403
} else {
404+
for (uint256 i = 0; i < actions.length; i++) {
405+
require(actions[i].target.code.length > 0, 'Target Payload Not Deployed');
406+
}
385407
console2.log(
386408
'safe: ',
387409
IPermissionedPayloadsController(address(permissionedPayloadsController)).payloadsManager()

0 commit comments

Comments
 (0)