Skip to content

Commit

Permalink
chore: deploy and upgrade longtail on preprod (#721)
Browse files Browse the repository at this point in the history
  • Loading branch information
wadealexc authored Sep 6, 2024
1 parent 5936fd7 commit c36027b
Show file tree
Hide file tree
Showing 4 changed files with 120 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{
"lastUpdated": "v0.4.2-preprod-longtail",
"addresses": {
"avsDirectory": "0x141d6995556135D4997b2ff72EB443Be300353bC",
"avsDirectoryImplementation": "0x357978adC03375BD6a3605DE055fABb84695d79A",
Expand All @@ -24,6 +25,10 @@
"strategyAddresses": [],
"strategyManager": "0xF9fbF2e35D8803273E214c99BF15174139f4E67a",
"strategyManagerImplementation": "0x1a26B23a004C512350d7Dd89056655A80b850199",
"strategyFactory": "0xad4A89E3cA9b3dc25AABe0aa7d72E61D2Ec66052",
"strategyFactoryImplementation": "0x7a9478c0AcB819d7c235FbE2a6E13ee1D2fCD862",
"strategyFactoryBeacon": "0xf2c2AcA859C685895E60ca7A14274365b64c0c2a",
"strategyFactoryBeaconImplementation": "0xd648792F932FbabcCC80Cd376812074434412685",
"token": {
"EIGEN": "0xD58f6844f79eB1fbd9f7091d05f7cb30d3363926",
"EIGENImpl": "0x95a7431400F362F3647a69535C5666cA0133CAA0",
Expand Down
1 change: 1 addition & 0 deletions script/configs/holesky/eigenlayer_preprod.config.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{
"lastUpdated": "v0.4.2-preprod-longtail",
"chainInfo": {
"chainId": 17000
},
Expand Down
113 changes: 113 additions & 0 deletions script/deploy/holesky/longtail-preprod-upgrade.s.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,113 @@
// SPDX-License-Identifier: BUSL-1.1
pragma solidity ^0.8.12;

import "../../utils/ExistingDeploymentParser.sol";

/**
* anvil --fork-url $RPC_HOLESKY
* forge script script/deploy/holesky/longtail-preprod-upgrade.s.sol:Longtail_Upgrade_Preprod --rpc-url http://127.0.0.1:8545 --private-key $PRIVATE_KEY --broadcast -vvvv
* forge script script/deploy/holesky/longtail-preprod-upgrade.s.sol:Longtail_Upgrade_Preprod --rpc-url $RPC_HOLESKY --private-key $PRIVATE_KEY --verify --broadcast -vvvv
*/
contract Longtail_Upgrade_Preprod is ExistingDeploymentParser {

address testAddress = 0xDA29BB71669f46F2a779b4b62f03644A84eE3479;
address initOwner = 0xDA29BB71669f46F2a779b4b62f03644A84eE3479;

function run() external virtual {
_parseInitialDeploymentParams(
"script/configs/holesky/eigenlayer_preprod.config.json"
);
_parseDeployedContracts(
"script/configs/holesky/eigenlayer_addresses_preprod.config.json"
);

emit log_named_address("Deployer Address", msg.sender);

// START RECORDING TRANSACTIONS FOR DEPLOYMENT
vm.startBroadcast();

_deployLongtail();
_upgradeLongtail();

// STOP RECORDING TRANSACTIONS FOR DEPLOYMENT
vm.stopBroadcast();

_sanityChecks();

logAndOutputContractAddresses("script/output/holesky/longtail-preprod.output.json");
}

function _deployLongtail() internal {
// Deploy implementations
strategyFactoryImplementation = new StrategyFactory(strategyManager);
strategyFactoryBeaconImplementation = new StrategyBase(strategyManager);

// Deploy and initialize proxies
strategyBeacon = new UpgradeableBeacon(address(strategyFactoryBeaconImplementation));
strategyFactory = StrategyFactory(address(new TransparentUpgradeableProxy(
address(strategyFactoryImplementation),
address(eigenLayerProxyAdmin),
abi.encodeWithSelector(
StrategyFactory.initialize.selector,
initOwner,
eigenLayerPauserReg,
0,
strategyBeacon
)
)));
}

function _tokensToBlacklist() internal pure returns (IERC20[] memory) {
// pulled from preprod strategy manager events, filtering by topic:
// 0x0c35b17d91c96eb2751cd456e1252f42a386e524ef9ff26ecc9950859fdc04fe
// (https://holesky.etherscan.io/address/0xF9fbF2e35D8803273E214c99BF15174139f4E67a#events)
IERC20[] memory t = new IERC20[](12);
t[0] = IERC20(0x1aea86558d3FF59176Fe7D5BE48B59B09c96bbf7); // WETHQ2
t[1] = IERC20(0xa63f56985F9C7F3bc9fFc5685535649e0C1a55f3); // sfrxETH
t[2] = IERC20(0x8783C9C904e1bdC87d9168AE703c8481E8a477Fd); // ankrETH
t[3] = IERC20(0xe3C063B1BEe9de02eb28352b55D49D85514C67FF); // mETH
t[4] = IERC20(0xF603c5A3F774F05d4D848A9bB139809790890864); // osETH
t[5] = IERC20(0x1d8b30cC38Dba8aBce1ac29Ea27d9cFd05379A09); // lsETH
t[6] = IERC20(0x17845EA6a9BfD2caF1b9E558948BB4999dF2656e); // frxETH
t[7] = IERC20(0x8720095Fa5739Ab051799211B146a2EEE4Dd8B37); // cbETH
t[8] = IERC20(0xB4F5fc289a778B80392b86fa70A7111E5bE0F859); // ETHx
t[9] = IERC20(0x7322c24752f79c05FFD1E2a6FCB97020C1C264F1); // rETH
t[10] = IERC20(0x3F1c547b21f65e10480dE3ad8E19fAAC46C95034); // stETH
t[11] = IERC20(0x94373a4919B3240D86eA41593D5eBa789FEF3848); // WETH

return t;
}

function _upgradeLongtail() internal {
IERC20[] memory tokensToBlacklist = _tokensToBlacklist();

strategyFactory.blacklistTokens(tokensToBlacklist);
strategyManager.setStrategyWhitelister(address(strategyFactory));
}

function _sanityChecks() internal {
// Sanity checks

require(eigenLayerProxyAdmin.getProxyAdmin(TransparentUpgradeableProxy(payable(address(strategyFactory)))) == address(eigenLayerProxyAdmin), "proxy admin not set correctly");
require(eigenLayerProxyAdmin.getProxyImplementation(TransparentUpgradeableProxy(payable(address(strategyFactory)))) == address(strategyFactoryImplementation), "proxy impl not set correctly");

require(strategyFactory.owner() == initOwner, "owner not set correctly");
require(strategyFactory.pauserRegistry() == eigenLayerPauserReg, "pauser not set correctly");
require(strategyFactory.strategyBeacon() == strategyBeacon, "beacon not set correctly");
require(strategyFactory.strategyManager() == strategyManager, "strategy manager not set correctly");

require(strategyManager.strategyWhitelister() == address(strategyFactory), "whitelist role not set correctly");

IERC20[] memory tokensToBlacklist = _tokensToBlacklist();
for (uint i = 0; i < tokensToBlacklist.length; i++) {
require(strategyFactory.isBlacklisted(tokensToBlacklist[i]), "token not blacklisted");
}

// Deploy a strategy and check that it's whitelisted
IERC20 dummy = IERC20(0x89Aa2dE0beC1b85c1A73111aee7E9A3EE3CBb593);
IStrategy newStrategy = strategyFactory.deployNewStrategy(dummy);

require(newStrategy.underlyingToken() == dummy, "underlying not set correctly");
require(strategyManager.strategyIsWhitelistedForDeposit(newStrategy), "did not whitelist in strategymanager");
}
}
1 change: 1 addition & 0 deletions script/utils/ExistingDeploymentParser.sol
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ contract ExistingDeploymentParser is Script, Test {
StrategyFactory public strategyFactory;
StrategyFactory public strategyFactoryImplementation;
UpgradeableBeacon public strategyBeacon;
StrategyBase public strategyFactoryBeaconImplementation;

// Token
ProxyAdmin public tokenProxyAdmin;
Expand Down

0 comments on commit c36027b

Please sign in to comment.