Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
wadealexc committed Oct 1, 2024
1 parent fd8c2e1 commit 402caea
Show file tree
Hide file tree
Showing 4 changed files with 146 additions and 22 deletions.
36 changes: 28 additions & 8 deletions script/Release.s.sol
Original file line number Diff line number Diff line change
Expand Up @@ -33,14 +33,28 @@ contract Release is Releasoor {
.append(this.executeUpgrade);
}

function deploy(Addresses memory addrs) internal override {
struct Deployment {
string name;
address deployedTo;
}

function deploy(
Addresses memory addrs,
Environment memory env,
Params memory params
) internal override returns (Deployment[] memory deployments) {


vm.startBroadcast();

EigenPod newEigenPodImpl = new EigenPod(
IETHPOSDeposit(params.ethPOS),
IEigenPodManager(addrs.eigenPodManager.proxy),
params.EIGENPOD_GENESIS_TIME
);
deployments[0] = Deployment({
name: type(EigenPod).name,
address: address(new EigenPod(
IETHPOSDeposit(params.ethPOS),
IEigenPodManager(addrs.eigenPodManager.proxy),
params.EIGENPOD_GENESIS_TIME
))
});

EigenPodManager newEPMImpl = new EigenPodManager(
IETHPOSDeposit(params.ethPOS),
Expand All @@ -52,8 +66,14 @@ contract Release is Releasoor {

vm.stopBroadcast();

addrs.eigenPod.setPending(address(newEigenPodImpl));
addrs.eigenPodManager.setPending(address(newEPMImpl));
type(EigenPod).contractName;



_logDeploy(EIGENPOD, address(newEigenPodImpl));

// addrs.eigenPod.setPending(address(newEigenPodImpl));
// addrs.eigenPodManager.setPending(address(newEPMImpl));
}

function queueUpgrade(Addresses memory addrs) internal override {
Expand Down
42 changes: 30 additions & 12 deletions script/Release_Template.s.sol
Original file line number Diff line number Diff line change
Expand Up @@ -3,22 +3,40 @@ pragma solidity ^0.8.12;

import "./utils/Releasoor.s.sol";

contract Release_TEMPLATE is Releasoor {
abstract contract EOABuilder {
function deploy(string memory envPath) public returns (Deployment[]);
function _deploy(Addresses memory addrs, Env, Params) internal virtual returns (Deployment[]);
}

using TxBuilder for *;
using AddressUtils for *;

function deploy(Addresses memory addrs) internal override {
// If you're deploying contracts, do that here
abstract contract MultisigBuilder {
function execute(string memory envPath) public returns (Transaction memory) {
// TODO
}

function queueUpgrade(Addresses memory addrs) internal override returns (Tx[] memory executorTxns, uint eta) {
// If you're queueing an upgrade via the timelock, you can
// define and encode those transactions here
function _execute(Addresses memory addrs, Env, Params) internal virtual returns (Calls[] memory);
}

abstract contract OpsTimelockBuilder is MultisigBuilder {
function queue(string memory envPath) public returns (Calls[]);
function _queue(Addresses memory addrs, Env, Params) internal virtual returns (Calls[] memory);
function _makeTimelockTxns(Addresses memory addrs, Env, Params) internal virtual returns (Calls[]);
}

contract ExampleScript is MultisigBuilder {

struct Transaction {
address to;
uint value;
bytes data;
Operation op;
}

function executeUpgrade(Addresses memory addrs) internal override {
// Whether you are using the timelock or just making transactions
// from the ops multisig, you can define/encode those transactions here
function _execute(Addresses memory addrs, Environment memory env, Params memory params) internal virtual returns (Transaction memory) {


return Transaction({
to: addrs.admin.timelock,
data: calldata_to_timelock_queueing_action
});
}
}
75 changes: 75 additions & 0 deletions script/ScriptTest.t.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
// SPDX-License-Identifier: BUSL-1.1
pragma solidity ^0.8.12;

import "./Release_Template.s.sol";

// zeus new "pepe" opsmultisig

contract PEPE_Upgrade is OpsTimelockBuilder {

struct TimelockData {
address target;
uint value;
string signature;
bytes data;
uint eta;
}

function _makeTimelockData(
Addresses memory addrs,
Environment memory env,
Params memory params
) internal override returns (TimelockData memory) {
TimelockData data = _newTimelockData();
data.eta = env.isMainnet() ? 12351235 : 0;

data.appendCall({
to: addrs.eigenPod.beacon,
data: EncBeacon.upgradeTo(addrs.eigenPod.getPending())
});

data.appendCall({
to: addrs.proxyAdmin,
data: EncProxyAdmin.upgrade(addrs.eigenPodManager.proxy, addrs.eigenPodManager.getPending())
});

return data.encode();
}

function _queue(
Addresses memory addrs,
Environment memory env,
Params memory params
) internal override returns (Calls[] memory) {
TimelockData memory data = _makeTimelockData(addrs, env, params);

return opsMultisig.queue(txns);
}

function _execute(
Addresses memory addrs,
Environment memory env,
Params memory params
) internal override returns (Calls[]) {
TimelockTxn[] memory txns = _makeTimelockTxns(addrs, env, params);

Calls[] memory final = opsMultsig.execute(txns)
.append({
to: awfe
data: awef
});

return final;
}
}

contract PEPE_Deploy is EOABuilder {

function _deploy(
Addresses memory addrs,
Environment memory env,
Params memory params
) internal override returns (Deployment[]) {

}
}
15 changes: 13 additions & 2 deletions script/utils/Releasoor.s.sol
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@ import "./StringUtils.sol";
import "./AddressUtils.sol";
import "./TxBuilder.sol";

contract OpsMultisigBuilder is Releasoor {

}

contract Releasoor is ConfigParser {

using StringUtils for *;
Expand All @@ -33,6 +37,13 @@ contract Releasoor is ConfigParser {

string constant CONFIG_ZIPZOOP = "script/configs/zipzoop.json";

function deploy(string memory jsonFile) public returns (Deployment[] memory deployments) {

(Addresses, Env, Params) = _readConfig();

return _deploy(addrs, env, params);
}

/// $ run execute mainnet
/// -- requires that you have previously run deploy and queue
/// ... except that sometimes we don't need to run deploy OR queue. For example:
Expand All @@ -46,7 +57,7 @@ contract Releasoor is ConfigParser {
/// - This would mean we haven't called `queue` yet
/// - We reference a pendingImpl that doesn't exist in the config
/// - This would mean we haven't called `deploy` yet
function run(string memory action, string memory _env) public {
function run(string memory action, string memory _env) public returns (bytes memory) {
_log(action);
_log(_env);

Expand Down Expand Up @@ -80,7 +91,7 @@ contract Releasoor is ConfigParser {
bytes32 initialAddrs = keccak256(abi.encode(addrs));

if (action.eq(DEPLOY)) {
deploy(addrs);
(string[] memory names, ..) = deploy(addrs);
} else if (action.eq(QUEUE)) {
(Txs storage executorTxns, uint eta) = queueUpgrade(addrs);

Expand Down

0 comments on commit 402caea

Please sign in to comment.