Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion foundry.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"lib/aave-address-book": {
"branch": {
"name": "main",
"rev": "79e2a33c0d655ded55c31ec4509bd541dedb5ff5"
"rev": "a31803177d717939ba8eceba54fee069235bd9c5"
}
},
"lib/forge-std": {
Expand Down
2 changes: 1 addition & 1 deletion lib/aave-address-book
22 changes: 22 additions & 0 deletions src/GovV3Helpers.sol
Original file line number Diff line number Diff line change
Expand Up @@ -261,6 +261,25 @@ library GovV3Helpers {
return bytecodeHash;
}

/**
* @notice method to deploy the payload contracts and register them on payloads controller for a given network
* @param chainId the chain id for the network where payload will be deployed and registered
* @param payloadBytecode list of payload creation bytecode which will be deployed and registered
*/
function deployRegisterPayload(Vm vm, uint256 chainId, bytes[] memory payloadBytecode) internal {
ChainHelpers.selectChain(vm, chainId);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is it fine / correct to "stay in the chain", after the script ends?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think after script ends we can select the previous chain which was selected.

The thing is on proposals the chain will be selected initially from:

  • Anvil -> ChainX

Then I think it is not so trivial to go from ChainX -> Anvil via createSelectFork() on forge

vm.startBroadcast();

IPayloadsControllerCore.ExecutionAction[] memory actions = new IPayloadsControllerCore.ExecutionAction[](payloadBytecode.length);
for (uint256 i = 0; i < payloadBytecode.length; i++) {
address payload = deployDeterministic(payloadBytecode[i]);
actions[i] = buildAction(payload);
}

createPayload(actions);
vm.stopBroadcast();
}

/**
* @dev builds a action to be registered on a payloadsController
* - assumes accesscontrol level 1
Expand Down Expand Up @@ -382,6 +401,9 @@ library GovV3Helpers {
if (payloadCreated && payload.createdAt > block.timestamp - 7 days) {
revert PayloadAlreadyCreated();
} else {
for (uint256 i = 0; i < actions.length; i++) {
require(actions[i].target.code.length > 0, 'Target Payload Not Deployed');
}
console2.log(
'safe: ',
IPermissionedPayloadsController(address(permissionedPayloadsController)).payloadsManager()
Expand Down
Loading