Skip to content

Commit

Permalink
wip: ops timelock script
Browse files Browse the repository at this point in the history
  • Loading branch information
wadealexc committed Oct 3, 2024
1 parent 8461668 commit 7f46c77
Show file tree
Hide file tree
Showing 3 changed files with 181 additions and 10 deletions.
17 changes: 16 additions & 1 deletion script/Release_Template.s.sol
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,10 @@ abstract contract MultisigBuilder is ConfigParser, EncodeSafeTransactionMainnet
return encodeMultisendTxs(txs);
}

function test_Execute(string memory envPath) public {
execute(envPath);
}

/// @notice to be implemented by inheriting contract
function _execute(Addresses memory addrs, Environment memory env, Params memory params) internal virtual returns (Tx[] memory);
}
Expand Down Expand Up @@ -81,13 +85,24 @@ abstract contract NestedMultisigBuilder is ConfigParser {
abstract contract OpsTimelockBuilder is NestedMultisigBuilder {

/// @return a Transaction object for a Gnosis Safe to ingest
function queue(string memory envPath) public returns (Transaction memory) {
function queue(string memory envPath) public returns (bytes memory) {
// TODO

// get response from _queue()
// encode for Timelock
// return encoded call for Ops Multisig

(
Addresses memory addrs,
Environment memory env,
Params memory params
) = _readConfigFile(envPath);

TimelockTx[] memory ttx = _queue(addrs, env, params);

return encodeTimelockTxn(ttx);
}

function _queue(Addresses memory addrs, Environment memory env, Params memory params) internal virtual returns (Transaction memory);

function _makeTimelockTxns(Addresses memory addrs, Environment memory env, Params memory params) internal virtual returns (Transaction memory);
Expand Down
69 changes: 60 additions & 9 deletions script/releases/v0.1-eigenpod/UpgradeEigenPod.s.sol
Original file line number Diff line number Diff line change
Expand Up @@ -4,23 +4,60 @@ pragma solidity ^0.8.12;
import "script/Release_Template.s.sol";
import {IUpgradeableBeacon} from "script/utils/Interfaces.sol";

contract UpgradeCounter is MultisigBuilder {
library TxHelper {

function _execute(Addresses memory addrs, Environment memory env, Params memory params) internal override returns (Tx[] memory) {
Tx[] memory txs = new Tx[](2);
function append(
Tx[] storage txs,
address to,
uint value,
bytes memory data
) internal returns (Tx[] storage) {
txs.push(Tx({
to: to,
value: value,
data: data
}));

return txs;
}

txs[0] = Tx({
to: addrs.eigenPod.beacon,
function append(
Tx[] storage txs,
address to,
bytes memory data
) internal returns (Tx[] storage) {
txs.push(Tx({
to: to,
value: 0,
data: data
}));

return txs;
}
}

contract UpgradeCounter is MultisigBuilder {

using TxHelper for *;

Tx[] txs;

function _execute(Addresses memory addrs, Environment memory env, Params memory params) internal override returns (Tx[] memory) {
txs.append({
to: addrs.admin.timelock,
data: abi.encodeWithSelector(
IUpgradeableBeacon.upgradeTo.selector,
addrs.eigenPod.pendingImpl
ITimelock.executeTransaction.selector(
to,
value,
signature,
data,
eta
)
)
});

txs[1] = Tx({
txs.append({
to: addrs.proxyAdmin,
value: 0,
data: abi.encodeWithSelector(
ProxyAdmin.upgrade.selector,
addrs.eigenPodManager,
Expand All @@ -30,4 +67,18 @@ contract UpgradeCounter is MultisigBuilder {

return txs;
}

function _test_Execute(
Addresses memory addrs,
Environment memory env,
Params memory params
) internal override {
bytes memory data = encodeMultisendTxs(arr);

vm.startBroadcast(addrs.admin.opsMultisig);
addrs.admin.multiSend.delegatecall(data);
vm.stopBroadcast();


}
}
105 changes: 105 additions & 0 deletions script/releases/v0.1-eigenpod/UpgradeViaTimelock.s.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,105 @@
// SPDX-License-Identifier: BUSL-1.1
pragma solidity ^0.8.12;

import "script/Release_Template.s.sol";
import {IUpgradeableBeacon} from "script/utils/Interfaces.sol";

library TxHelper {

function append(
Tx[] storage txs,
address to,
uint value,
bytes memory data
) internal returns (Tx[] storage) {
txs.push(Tx({
to: to,
value: value,
data: data
}));

return txs;
}

function append(
Tx[] storage txs,
address to,
bytes memory data
) internal returns (Tx[] storage) {
txs.push(Tx({
to: to,
value: 0,
data: data
}));

return txs;
}
}

contract UpgradeCounter is OpsTimelockBuilder {

using TxHelper for *;

FinalExecutorCall[] finalCalls;

OpsCalls[] opsCalls;

function _makeTimelockTxns(Addresses memory addrs, Environment memory env, Params memory params) internal virtual returns (FinalExecutorCall[] memory) {
finalCalls.append({
to: addrs.eigenPod.beacon,
data: abi.encodeWithSelector(
IUpgradeableBeacon.upgradeTo.selector,
addrs.eigenPod.pendingImpl
)
});

finalCalls.append({
to: addrs.proxyAdmin,
data: abi.encodeWithSelector(
ProxyAdmin.upgrade.selector,
addrs.eigenPodManager,
addrs.eigenPod.pendingImpl
)
});

return finalCalls;
}

function _queue(Addresses memory addrs, Environment memory env, Params memory params) internal override returns (TimelockTx[] memory) {
opsCalls.append({
to: addrs.admin.timelock,
data: EncTimelock.queueTransaction(finalCalls)
});

return opsCalls;
}

function _execute(Addresses memory addrs, Environment memory env, Params memory params) internal override returns (Tx[] memory) {
opsCalls.append({
to: addrs.admin.timelock,
data: EncTimelock.executeTransaction()
encodeTimelockTxn(ttx)
});

opsCalls.append({
to: addrs.strategyFactory.proxy,
data: IStrategyFactory.whitelistThing(details)
});

return opsCalls;
}

function _test_Execute(
Addresses memory addrs,
Environment memory env,
Params memory params
) internal override {
bytes memory data = encodeMultisendTxs(arr);

vm.startBroadcast(addrs.admin.opsMultisig);
addrs.admin.multiSend.delegatecall(data);
vm.stopBroadcast();


}
}

0 comments on commit 7f46c77

Please sign in to comment.