Skip to content

Commit

Permalink
fix: remove hardcoded addresses and make them public
Browse files Browse the repository at this point in the history
  • Loading branch information
johnnyonline committed Dec 14, 2024
1 parent 797e1a4 commit 58a3652
Show file tree
Hide file tree
Showing 3 changed files with 118 additions and 97 deletions.
72 changes: 39 additions & 33 deletions script/ynEigen/DeployWithdrawalsProcessor.s.sol
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// SPDX-License-Identifier: BSD 3-Clause License
pragma solidity ^0.8.24;

import {TransparentUpgradeableProxy} from
import {TransparentUpgradeableProxy, ITransparentUpgradeableProxy} from
"lib/openzeppelin-contracts/contracts/proxy/transparent/TransparentUpgradeableProxy.sol";
import {IERC20} from "lib/openzeppelin-contracts/contracts/token/ERC20/IERC20.sol";

Expand Down Expand Up @@ -42,30 +42,30 @@ contract DeployWithdrawalsProcessor is YnEigenDeployer {
// deploy withdrawalsProcessor
WithdrawalsProcessor withdrawalsProcessor;
{
withdrawalsProcessor = new WithdrawalsProcessor(
chainAddresses.ynEigen.WITHDRAWAL_QUEUE_MANAGER_ADDRESS, // address(withdrawalQueueManager)
chainAddresses.ynEigen.TOKEN_STAKING_NODES_MANAGER_ADDRESS, // address(tokenStakingNodesManager)
chainAddresses.ynEigen.ASSET_REGISTRY_ADDRESS, // address(assetRegistry)
chainAddresses.ynEigen.EIGEN_STRATEGY_MANAGER_ADDRESS, // address(eigenStrategyManager)
chainAddresses.eigenlayer.DELEGATION_MANAGER_ADDRESS, // address(delegationManager)
chainAddresses.ynEigen.YNEIGEN_ADDRESS, // address(yneigen)
chainAddresses.ynEigen.REDEMPTION_ASSETS_VAULT_ADDRESS, // address(redemptionAssetsVault)
chainAddresses.ynEigen.WRAPPER, // address(wrapper)
chainAddresses.lsd.STETH_ADDRESS,
chainAddresses.lsd.WSTETH_ADDRESS,
chainAddresses.lsd.OETH_ADDRESS,
chainAddresses.lsd.WOETH_ADDRESS
);

withdrawalsProcessor = WithdrawalsProcessor(
address(
new TransparentUpgradeableProxy(
address(withdrawalsProcessor), chainAddresses.ynEigen.TIMELOCK_CONTROLLER_ADDRESS, ""
)
)
);

WithdrawalsProcessor(address(withdrawalsProcessor)).initialize(owner, keeper);
// withdrawalsProcessor = new WithdrawalsProcessor(
// chainAddresses.ynEigen.WITHDRAWAL_QUEUE_MANAGER_ADDRESS, // address(withdrawalQueueManager)
// chainAddresses.ynEigen.TOKEN_STAKING_NODES_MANAGER_ADDRESS, // address(tokenStakingNodesManager)
// chainAddresses.ynEigen.ASSET_REGISTRY_ADDRESS, // address(assetRegistry)
// chainAddresses.ynEigen.EIGEN_STRATEGY_MANAGER_ADDRESS, // address(eigenStrategyManager)
// chainAddresses.eigenlayer.DELEGATION_MANAGER_ADDRESS, // address(delegationManager)
// chainAddresses.ynEigen.YNEIGEN_ADDRESS, // address(yneigen)
// chainAddresses.ynEigen.REDEMPTION_ASSETS_VAULT_ADDRESS, // address(redemptionAssetsVault)
// chainAddresses.ynEigen.WRAPPER, // address(wrapper)
// chainAddresses.lsd.STETH_ADDRESS,
// chainAddresses.lsd.WSTETH_ADDRESS,
// chainAddresses.lsd.OETH_ADDRESS,
// chainAddresses.lsd.WOETH_ADDRESS
// );

// withdrawalsProcessor = WithdrawalsProcessor(
// address(
// new TransparentUpgradeableProxy(
// address(withdrawalsProcessor), chainAddresses.ynEigen.TIMELOCK_CONTROLLER_ADDRESS, ""
// )
// )
// );

// WithdrawalsProcessor(address(withdrawalsProcessor)).initialize(owner, keeper);
}

// grant roles to withdrawalsProcessor
Expand All @@ -81,22 +81,28 @@ contract DeployWithdrawalsProcessor is YnEigenDeployer {
// withdrawalQueueManager.REQUEST_FINALIZER_ROLE(), address(withdrawalsProcessor)
// );
// vm.stopPrank();
console.log("----------------------------------");
console.log("Grant roles to WithdrawalsProcessor:");
console.log("YNSecurityCouncil: ", actors.wallets.YNSecurityCouncil);
console.log("WithdrawalsProcessor: ", address(withdrawalsProcessor));
console.log("EigenStrategyManager: ", chainAddresses.ynEigen.EIGEN_STRATEGY_MANAGER_ADDRESS);
console.log("withdrawalQueueManager: ", chainAddresses.ynEigen.WITHDRAWAL_QUEUE_MANAGER_ADDRESS);
console.log("----------------------------------");
// console.log("----------------------------------");
// console.log("Grant roles to WithdrawalsProcessor:");
// console.log("YNSecurityCouncil: ", actors.wallets.YNSecurityCouncil);
// console.log("WithdrawalsProcessor: ", address(withdrawalsProcessor));
// console.log("EigenStrategyManager: ", chainAddresses.ynEigen.EIGEN_STRATEGY_MANAGER_ADDRESS);
// console.log("withdrawalQueueManager: ", chainAddresses.ynEigen.WITHDRAWAL_QUEUE_MANAGER_ADDRESS);
// console.log("----------------------------------");

// ----------------------------------
// Grant roles to WithdrawalsProcessor:
// YNSecurityCouncil: 0x743b91CDB1C694D4F51bCDA3a4A59DcC0d02b913
// WithdrawalsProcessor: 0xA1C5E681D143377F78eF727db73Deaa70EE4441f
// WithdrawalsProcessor: 0xA1C5E681D143377F78eF727db73Deaa70EE4441f (proxy) -- V1
// EigenStrategyManager: 0xA0a11A9b84bf87c0323bc183715a22eC7881B7FC
// withdrawalQueueManager: 0xaF8052DC454318D52A4478a91aCa14305590389f
// ----------------------------------

// ----------------------------------
// WithdrawalsProcessor: 0xdDb2282f56A7355DD904E7d1074980d69A6bAFd3 -- V2
// ----------------------------------
}

vm.stopBroadcast();
}

function _isOngoingWithdrawals() private returns (bool) {
Expand Down
10 changes: 5 additions & 5 deletions src/ynEIGEN/WithdrawalsProcessor.sol
Original file line number Diff line number Diff line change
Expand Up @@ -46,13 +46,13 @@ contract WithdrawalsProcessor is IWithdrawalsProcessor, Initializable, AccessCon
IDelegationManager public immutable delegationManager;

// assets
IERC20 private immutable STETH = IERC20(0xae7ab96520DE3A18E5e111B5EaAb095312D7fE84);
IwstETH private immutable WSTETH = IwstETH(0x7f39C581F595B53c5cb19bD0b3f8dA6c935E2Ca0);
IERC20 private immutable OETH = IERC20(0x856c4Efb76C1D1AE02e20CEB03A2A6a08b0b8dC3);
IERC4626 private immutable WOETH = IERC4626(0xDcEe70654261AF21C44c093C300eD3Bb97b78192);
IERC20 public immutable STETH;
IwstETH public immutable WSTETH;
IERC20 public immutable OETH;
IERC4626 public immutable WOETH;

// used to prevent rounding errors
uint256 private constant MIN_DELTA = 1000;
uint256 public constant MIN_DELTA = 1000;

// roles
bytes32 public constant KEEPER_ROLE = keccak256("KEEPER_ROLE");
Expand Down
133 changes: 74 additions & 59 deletions test/scenarios/ynEIGEN/UpgradeTestTemp.t.sol
Original file line number Diff line number Diff line change
@@ -1,59 +1,74 @@
// // SPDX-License-Identifier: BSD 3-Clause License
// pragma solidity ^0.8.24;

// import {TimelockController} from "@openzeppelin/contracts/governance/TimelockController.sol";

// import "forge-std/Test.sol";

// contract SmallTest is Test {

// address _proxy = 0x58c721D3f6FcdE97ef07df793D359DbCc1fDB36d;
// address _newImplementation = 0xD82d61C2905595f554233De5cDb947979802267C;
// address _ynSecurityCouncil = 0x743b91CDB1C694D4F51bCDA3a4A59DcC0d02b913;
// TimelockController timelockController = TimelockController(payable(0x317f96879FA387aFF6dfFAAc4A09bD2f6e367801));

// function setUp() public {}

// function testSmall() public {
// bytes memory _data = abi.encodeWithSignature(
// "upgradeAndCall(address,address,bytes)",
// _proxy, // proxy
// _newImplementation, // implementation
// ""
// );
// console.logBytes(_data);
// console.log("15 minutes: ", 15 minutes);
// console.logBytes32(bytes32(0));
// vm.startPrank(_ynSecurityCouncil);
// timelockController.schedule(
// // getTransparentUpgradeableProxyAdminAddress(_proxyAddress), // target
// 0x3BE30C73AF6b1c5d6d13E20B41D89a81FC074211,
// 0, // value
// _data,
// bytes32(0), // predecessor
// bytes32(0), // salt
// timelockController.getMinDelay() // delay
// );
// vm.stopPrank();

// uint256 minDelay;
// if (block.chainid == 1) { // Mainnet
// minDelay = 3 days;
// } else if (block.chainid == 17000) { // Holesky
// minDelay = 15 minutes;
// } else {
// revert("Unsupported chain ID");
// }
// skip(minDelay);

// vm.startPrank(_ynSecurityCouncil);
// timelockController.execute(
// 0x3BE30C73AF6b1c5d6d13E20B41D89a81FC074211, // target
// 0, // value
// _data,
// bytes32(0), // predecessor
// bytes32(0) // salt
// );
// vm.stopPrank();
// }
// }
// SPDX-License-Identifier: BSD 3-Clause License
pragma solidity ^0.8.24;

import {TimelockController} from "@openzeppelin/contracts/governance/TimelockController.sol";

import "forge-std/Test.sol";
import "script/Utils.sol";

contract SmallTest is Test, Utils {

// address _proxy = 0x58c721D3f6FcdE97ef07df793D359DbCc1fDB36d;
// address _newImplementation = 0xD82d61C2905595f554233De5cDb947979802267C;

// holesky
address _proxy = 0xA1C5E681D143377F78eF727db73Deaa70EE4441f; // withdrawlsProcessorProxy
address _newImplementation = 0xdDb2282f56A7355DD904E7d1074980d69A6bAFd3; // withdrawalsProcessorV2
address _ynSecurityCouncil = 0x743b91CDB1C694D4F51bCDA3a4A59DcC0d02b913;
address keeper = 0xbc345A8aEd2ff40308Cf923216dF39B5bE1146b2; // YNnWithdrawalsYnEigen
address proxyAdmin = 0xB1D96f8fb245194B6Ef025F1a0697964b719186C;
TimelockController timelockController = TimelockController(payable(0x62173555C27C67644C5634e114e42A63A59CD7A5));

function setUp() public {
vm.selectFork(vm.createFork(vm.envString("HOLESKY_RPC_URL")));
}

function testSmall() public {
bytes memory _data = abi.encodeWithSignature(
"upgradeAndCall(address,address,bytes)",
_proxy, // proxy
_newImplementation, // implementation
""
);
console.logBytes(_data);
console.log("15 minutes: ", 15 minutes);
console.logBytes32(bytes32(0));
console.log("timelockController: ", address(timelockController));
console.log("proxyAdmin: ", proxyAdmin);
console.log("ynSecurityCouncil: ", _ynSecurityCouncil);

vm.startPrank(_ynSecurityCouncil);
timelockController.schedule(
// getTransparentUpgradeableProxyAdminAddress(_proxyAddress), // target
proxyAdmin, // proxyadmin
0, // value
_data,
bytes32(0), // predecessor
bytes32(0), // salt
timelockController.getMinDelay() // delay
);
vm.stopPrank();

uint256 minDelay;
if (block.chainid == 1) { // Mainnet
minDelay = 3 days;
} else if (block.chainid == 17000) { // Holesky
minDelay = 15 minutes;
} else {
revert("Unsupported chain ID");
}
skip(minDelay);

vm.startPrank(_ynSecurityCouncil);
timelockController.execute(
proxyAdmin, // target
0, // value
_data,
bytes32(0), // predecessor
bytes32(0) // salt
);
vm.stopPrank();
}
}
//target-- 0xB1D96f8fb245194B6Ef025F1a0697964b719186C
//data-- 0x9623609d000000000000000000000000a1c5e681d143377f78ef727db73deaa70ee4441f000000000000000000000000ddb2282f56a7355dd904e7d1074980d69a6bafd300000000000000000000000000000000000000000000000000000000000000600000000000000000000000000000000000000000000000000000000000000000

0 comments on commit 58a3652

Please sign in to comment.