Skip to content

Commit

Permalink
Merge pull request #40 from yieldnest/feature/holesky-deploy
Browse files Browse the repository at this point in the history
Feature/holesky deploy
  • Loading branch information
danoctavian authored Mar 14, 2024
2 parents 5d25c47 + 7714412 commit 0b18251
Show file tree
Hide file tree
Showing 3 changed files with 56 additions and 37 deletions.
8 changes: 8 additions & 0 deletions deployments/example.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"executionLayerReceiver": "0x0000000000000000000000000000000000000002",
"object": "dummy",
"rewardsDistributor": "0x0000000000000000000000000000000000000003",
"stakingNodeImplementation": "0x0000000000000000000000000000000000000004",
"stakingNodesManager": "0x0000000000000000000000000000000000000001",
"ynETH": "0x0000000000000000000000000000000000000000"
}
59 changes: 22 additions & 37 deletions scripts/forge/DeployYieldNest.s.sol
Original file line number Diff line number Diff line change
Expand Up @@ -58,20 +58,7 @@ contract DeployYieldNest is BaseScript {
uint256 deployerPrivateKey = vm.envUint("PRIVATE_KEY");

// ynETH.sol ROLES
ActorAddresses.Actors memory actors = ActorAddresses.Actors({
DEFAULT_SIGNER: address(0), // Placeholder, not used in this context
PROXY_ADMIN_OWNER: vm.envAddress("PROXY_OWNER"),
TRANSFER_ENABLED_EOA: address(0), // Placeholder, not used in this context
ADMIN: vm.envAddress("YNETH_ADMIN_ADDRESS"),
STAKING_ADMIN: vm.envAddress("STAKING_ADMIN_ADDRESS"),
STAKING_NODES_ADMIN: vm.envAddress("STAKING_NODES_ADMIN_ADDRESS"),
VALIDATOR_MANAGER: vm.envAddress("VALIDATOR_MANAGER_ADDRESS"),
FEE_RECEIVER: address(0), // Placeholder, not used in this context
PAUSE_ADMIN: vm.envAddress("PAUSER_ADDRESS"),
LSD_RESTAKING_MANAGER: vm.envAddress("LSD_RESTAKING_MANAGER_ADDRESS"),
STAKING_NODE_CREATOR: vm.envAddress("LSD_RESTAKING_MANAGER_ADDRESS"),
ORACLE_MANAGER: address(0) // Placeholder, not used in this context
});
ActorAddresses.Actors memory actors = getActors();

address _broadcaster = vm.addr(deployerPrivateKey);

Expand All @@ -90,13 +77,12 @@ contract DeployYieldNest is BaseScript {

ContractAddresses contractAddresses = new ContractAddresses();
ContractAddresses.ChainAddresses memory chainAddresses = contractAddresses.getChainAddresses(block.chainid);
eigenPodManager = IEigenPodManager(chainAddresses.EIGENLAYER_EIGENPOD_MANAGER_ADDRESS);
delegationManager = IDelegationManager(chainAddresses.EIGENLAYER_DELEGATION_MANAGER_ADDRESS);
delayedWithdrawalRouter = IDelayedWithdrawalRouter(chainAddresses.EIGENLAYER_DELAYED_WITHDRAWAL_ROUTER_ADDRESS); // Assuming DEPOSIT_2_ADDRESS is used for DelayedWithdrawalRouter
strategyManager = IStrategyManager(chainAddresses.EIGENLAYER_STRATEGY_MANAGER_ADDRESS);
depositContract = IDepositContract(chainAddresses.DEPOSIT_2_ADDRESS);
weth = IWETH(chainAddresses.WETH_ADDRESS);

eigenPodManager = IEigenPodManager(chainAddresses.eigenlayer.EIGENPOD_MANAGER_ADDRESS);
delegationManager = IDelegationManager(chainAddresses.eigenlayer.DELEGATION_MANAGER_ADDRESS);
delayedWithdrawalRouter = IDelayedWithdrawalRouter(chainAddresses.eigenlayer.DELAYED_WITHDRAWAL_ROUTER_ADDRESS);
strategyManager = IStrategyManager(chainAddresses.eigenlayer.STRATEGY_MANAGER_ADDRESS);
depositContract = IDepositContract(chainAddresses.ethereum.DEPOSIT_2_ADDRESS);
weth = IWETH(chainAddresses.ethereum.WETH_ADDRESS);
// Deploy implementations
yneth = new ynETH();
stakingNodesManager = new StakingNodesManager();
Expand All @@ -107,31 +93,31 @@ contract DeployYieldNest is BaseScript {
ynlsd = new ynLSD();

RewardsDistributor rewardsDistributorImplementation = new RewardsDistributor();
rewardsDistributorProxy = new TransparentUpgradeableProxy(address(rewardsDistributorImplementation), proxyOwnerAddress, "");
rewardsDistributorProxy = new TransparentUpgradeableProxy(address(rewardsDistributorImplementation), actors.PROXY_ADMIN_OWNER, "");
rewardsDistributor = RewardsDistributor(payable(rewardsDistributorProxy));

YieldNestOracle yieldNestOracleImplementation = new YieldNestOracle();
yieldNestOracleProxy = new TransparentUpgradeableProxy(address(yieldNestOracleImplementation), proxyOwnerAddress, "");
yieldNestOracleProxy = new TransparentUpgradeableProxy(address(yieldNestOracleImplementation), actors.PROXY_ADMIN_OWNER, "");
yieldNestOracle = YieldNestOracle(address(yieldNestOracleProxy));

ynLSD ynLSDImplementation = new ynLSD();
ynLSDProxy = new TransparentUpgradeableProxy(address(ynLSDImplementation), proxyOwnerAddress, "");
ynLSDProxy = new TransparentUpgradeableProxy(address(ynLSDImplementation), actors.PROXY_ADMIN_OWNER, "");
ynlsd = ynLSD(address(ynLSDProxy));

// Deploy proxies
ynethProxy = new TransparentUpgradeableProxy(address(yneth), proxyOwnerAddress, "");
stakingNodesManagerProxy = new TransparentUpgradeableProxy(address(stakingNodesManager), proxyOwnerAddress, "");
ynethProxy = new TransparentUpgradeableProxy(address(yneth), actors.PROXY_ADMIN_OWNER, "");
stakingNodesManagerProxy = new TransparentUpgradeableProxy(address(stakingNodesManager), actors.PROXY_ADMIN_OWNER, "");

yneth = ynETH(payable(ynethProxy));
stakingNodesManager = StakingNodesManager(payable(stakingNodesManagerProxy));

// Initialize ynETH with example parameters
address[] memory pauseWhitelist = new address[](1);
pauseWhitelist[0] = pauserAddress;
pauseWhitelist[0] = actors.PAUSE_ADMIN;

ynETH.Init memory ynethInit = ynETH.Init({
admin: ynethAdminAddress,
pauser: pauserAddress,
admin: actors.ADMIN,
pauser: actors.PAUSE_ADMIN,
stakingNodesManager: IStakingNodesManager(address(stakingNodesManager)),
rewardsDistributor: IRewardsDistributor(address(rewardsDistributor)),
exchangeAdjustmentRate: startingExchangeAdjustmentRate,
Expand All @@ -142,10 +128,11 @@ contract DeployYieldNest is BaseScript {

// Initialize StakingNodesManager with example parameters
StakingNodesManager.Init memory stakingNodesManagerInit = StakingNodesManager.Init({
admin: stakingNodesManagerAdminAddress,
stakingAdmin: stakingAdminAddress,
stakingNodesAdmin: stakingNodesAdminAddress,
validatorManager: validatorManagerAddress,
admin: actors.ADMIN,
stakingAdmin: actors.STAKING_ADMIN,
stakingNodesAdmin: actors.STAKING_NODES_ADMIN,
validatorManager: actors.VALIDATOR_MANAGER,
stakingNodeCreatorRole: actors.STAKING_NODE_CREATOR,
maxNodeCount: 10,
depositContract: depositContract,
ynETH: IynETH(address(yneth)),
Expand All @@ -160,7 +147,7 @@ contract DeployYieldNest is BaseScript {
stakingNodesManager.registerStakingNodeImplementationContract(address(stakingNodeImplementation));

RewardsDistributor.Init memory rewardsDistributorInit = RewardsDistributor.Init({
admin: rewardsDistributorAdminAddress,
admin: actors.ADMIN,
executionLayerReceiver: executionLayerReceiver,
consensusLayerReceiver: consensusLayerReceiver, // Adding consensusLayerReceiver to the initialization
feesReceiver: feeReceiver, // Assuming the contract itself will receive the fees
Expand All @@ -170,7 +157,7 @@ contract DeployYieldNest is BaseScript {

// Initialize RewardsReceiver with example parameters
RewardsReceiver.Init memory rewardsReceiverInit = RewardsReceiver.Init({
admin: rewardsDistributorAdminAddress,
admin: actors.ADMIN,
withdrawer: address(rewardsDistributor)
});
executionLayerReceiver.initialize(rewardsReceiverInit);
Expand All @@ -191,5 +178,3 @@ contract DeployYieldNest is BaseScript {
}
}



26 changes: 26 additions & 0 deletions test/foundry/ContractAddresses.sol
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,32 @@ contract ContractAddresses {
STETH_STRATEGY_ADDRESS: 0xB613E78E2068d7489bb66419fB1cfa11275d14da
})
});

// In absence of Eigenlayer a placeholder address is used for all Eigenlayer addresses
address placeholderAddress = address(1);

addresses[17000] = ChainAddresses({
ethereum: EthereumAddresses({
WETH_ADDRESS: placeholderAddress, // Placeholder address, replaced with address(1) for holesky
DEPOSIT_2_ADDRESS: 0x4242424242424242424242424242424242424242
}),
eigenlayer: EigenlayerAddresses({
EIGENPOD_MANAGER_ADDRESS: placeholderAddress, // Placeholder address, replaced with address(1) for holesky
DELEGATION_MANAGER_ADDRESS: placeholderAddress, // Placeholder address, replaced with address(1) for holesky
DELEGATION_PAUSER_ADDRESS: placeholderAddress, // Placeholder address, replaced with address(1) for holesky
STRATEGY_MANAGER_ADDRESS: placeholderAddress, // Placeholder address, replaced with address(1) for holesky
DELAYED_WITHDRAWAL_ROUTER_ADDRESS: placeholderAddress // Placeholder address, replaced with address(1) for holesky
}),
lsd: LSDAddresses({
SFRXETH_ADDRESS: placeholderAddress, // Placeholder address, replaced with address(1) for holesky
RETH_ADDRESS: 0x7322c24752f79c05FFD1E2a6FCB97020C1C264F1, // source: https://docs.rocketpool.net/guides/staking/via-rp
STETH_ADDRESS: 0x3F1c547b21f65e10480dE3ad8E19fAAC46C95034, // source: https://docs.lido.fi/deployed-contracts/holesky/
RETH_FEED_ADDRESS: 0xe1e444A5Df450E7640323a21073bF01E0af054fA, // Self-created aggregator
STETH_FEED_ADDRESS: 0xe1e444A5Df450E7640323a21073bF01E0af054fA, // Self-created aggregator
RETH_STRATEGY_ADDRESS: placeholderAddress, // Placeholder address, replaced with address(1) for holesky
STETH_STRATEGY_ADDRESS: placeholderAddress // Placeholder address, replaced with address(1) for holesky
})
});
}

function getChainAddresses(uint256 chainId) external view returns (ChainAddresses memory) {
Expand Down

0 comments on commit 0b18251

Please sign in to comment.