Skip to content

Commit

Permalink
Upgrade repo to eigenlayer v0.2.3 mainnet deployment
Browse files Browse the repository at this point in the history
  • Loading branch information
xhad committed Apr 10, 2024
1 parent 55bc6c8 commit 0597b87
Show file tree
Hide file tree
Showing 75 changed files with 724 additions and 5,139 deletions.
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,6 @@
[submodule "lib/openzeppelin-contracts"]
path = lib/openzeppelin-contracts
url = https://github.com/openzeppelin/openzeppelin-contracts
[submodule "lib/eigenlayer-contracts"]
path = lib/eigenlayer-contracts
url = https://github.com/layr-labs/eigenlayer-contracts
5 changes: 4 additions & 1 deletion foundry.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,10 @@ cache_path = 'cache'

fs_permissions = [{ access = "read-write", path = "./deployments"}, { access = "read", path = "./"}]

optimizer = true
optimizer = false
optimizer-runs = 200
evm_version = "cancun"
solc_version = "0.8.24"
offline = true

ignored_error_codes = [5159,2018,5574,3860]
1 change: 1 addition & 0 deletions lib/eigenlayer-contracts
Submodule eigenlayer-contracts added at 90a0f6
4 changes: 4 additions & 0 deletions remappings.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
@openzeppelin-upgrades/=lib/openzeppelin-contracts-upgradeable/
@openzeppelin/=lib/openzeppelin-contracts/


6 changes: 3 additions & 3 deletions script/Actors.sol
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ contract ActorAddresses {
address LSD_RESTAKING_MANAGER;
address STAKING_NODE_CREATOR;
address ORACLE_MANAGER;
address DEPOSIT_BOOTSTRAPER;
address DEPOSIT_BOOTSTRAPPER;
}

mapping(uint256 => Actors) public actors;
Expand All @@ -23,7 +23,7 @@ contract ActorAddresses {
actors[17000] = Actors({
// EOA Deployment Addresses
DEFAULT_SIGNER: 0x72fdBD51085bDa5eEEd3b55D1a46E2e92f0837a5,
DEPOSIT_BOOTSTRAPER: 0x72fdBD51085bDa5eEEd3b55D1a46E2e92f0837a5,
DEPOSIT_BOOTSTRAPPER: 0x72fdBD51085bDa5eEEd3b55D1a46E2e92f0837a5,
// protocol fee receiver
FEE_RECEIVER: 0xa9295EA69DaF30A8CB81610c23966240BdDA2876,
// admin multisig roles
Expand Down Expand Up @@ -51,7 +51,7 @@ contract ActorAddresses {
LSD_RESTAKING_MANAGER: 0xa0Ee7A142d267C1f36714E4a8F75612F20a79720,
STAKING_NODE_CREATOR: 0xBcd4042DE499D14e55001CcbB24a551F3b954096,
ORACLE_MANAGER: 0x71bE63f3384f5fb98995898A86B02Fb2426c5788,
DEPOSIT_BOOTSTRAPER: 0xFABB0ac9d68B0B445fB7357272Ff202C5651694a
DEPOSIT_BOOTSTRAPPER: 0xFABB0ac9d68B0B445fB7357272Ff202C5651694a
});
}

Expand Down
4 changes: 2 additions & 2 deletions script/BaseScript.s.sol
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ abstract contract BaseScript is Script, Utils {
vm.serializeAddress(json, "LSD_RESTAKING_MANAGER", address((getActors()).LSD_RESTAKING_MANAGER));
vm.serializeAddress(json, "STAKING_NODE_CREATOR", address((getActors()).STAKING_NODE_CREATOR));
vm.serializeAddress(json, "ORACLE_MANAGER", address((getActors()).ORACLE_MANAGER));
vm.serializeAddress(json, "DEPOSIT_BOOTSTRAPER", address((getActors()).DEPOSIT_BOOTSTRAPER));
vm.serializeAddress(json, "DEPOSIT_BOOTSTRAPPER", address((getActors()).DEPOSIT_BOOTSTRAPPER));

string memory finalJson = vm.serializeAddress(json, "DEFAULT_SIGNER", address((getActors()).DEFAULT_SIGNER));
vm.writeJson(finalJson, getDeploymentFile());
Expand Down Expand Up @@ -94,7 +94,7 @@ abstract contract BaseScript is Script, Utils {
vm.serializeAddress(json, "LSD_RESTAKING_MANAGER", address((getActors()).LSD_RESTAKING_MANAGER));
vm.serializeAddress(json, "STAKING_NODE_CREATOR", address((getActors()).STAKING_NODE_CREATOR));
vm.serializeAddress(json, "ORACLE_MANAGER", address((getActors()).ORACLE_MANAGER));
vm.serializeAddress(json, "DEPOSIT_BOOTSTRAPER", address((getActors()).DEPOSIT_BOOTSTRAPER));
vm.serializeAddress(json, "DEPOSIT_BOOTSTRAPPER", address((getActors()).DEPOSIT_BOOTSTRAPPER));
vm.serializeAddress(json, "ynlsd", address(deployment.ynlsd));
vm.serializeAddress(json, "lsdStakingNodeImplementation", address(deployment.lsdStakingNodeImplementation));
vm.serializeAddress(json, "yieldNestOracle", address(deployment.yieldNestOracle));
Expand Down
9 changes: 6 additions & 3 deletions script/ContractAddresses.sol
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ contract ContractAddresses {
address DELEGATION_MANAGER_ADDRESS;
address DELEGATION_PAUSER_ADDRESS;
address STRATEGY_MANAGER_ADDRESS;
address STRATEGY_MANAGER_PAUSER_ADDRESS;
address DELAYED_WITHDRAWAL_ROUTER_ADDRESS;
}

Expand Down Expand Up @@ -45,6 +46,7 @@ contract ContractAddresses {
DELEGATION_MANAGER_ADDRESS: 0x39053D51B77DC0d36036Fc1fCc8Cb819df8Ef37A,
DELEGATION_PAUSER_ADDRESS: 0x369e6F597e22EaB55fFb173C6d9cD234BD699111,
STRATEGY_MANAGER_ADDRESS: 0x858646372CC42E1A627fcE94aa7A7033e7CF075A,
STRATEGY_MANAGER_PAUSER_ADDRESS: 0x28Ade60640fdBDb2609D8d8734D1b5cBeFc0C348,
DELAYED_WITHDRAWAL_ROUTER_ADDRESS: 0x7Fe7E9CC0F274d2435AD5d56D5fa73E47F6A23D8
}),
lsd: LSDAddresses({
Expand All @@ -69,16 +71,17 @@ contract ContractAddresses {
eigenlayer: EigenlayerAddresses({
EIGENPOD_MANAGER_ADDRESS: 0x30770d7E3e71112d7A6b7259542D1f680a70e315, // Placeholder address, replaced with address(1) for holesky
DELEGATION_MANAGER_ADDRESS: 0xA44151489861Fe9e3055d95adC98FbD462B948e7, // Placeholder address, replaced with address(1) for holesky
DELEGATION_PAUSER_ADDRESS: placeholderAddress, // Placeholder address, replaced with address(1) for holesky
DELEGATION_PAUSER_ADDRESS: 0x28Ade60640fdBDb2609D8d8734D1b5cBeFc0C348, // Placeholder address, replaced with address(1) for holesky
STRATEGY_MANAGER_ADDRESS: 0xdfB5f6CE42aAA7830E94ECFCcAd411beF4d4D5b6, // Placeholder address, replaced with address(1) for holesky
STRATEGY_MANAGER_PAUSER_ADDRESS: 0x28Ade60640fdBDb2609D8d8734D1b5cBeFc0C348,
DELAYED_WITHDRAWAL_ROUTER_ADDRESS: 0x642c646053eaf2254f088e9019ACD73d9AE0FA32 // 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_FEED_ADDRESS: 0xC028a945D4Ac8593F84F8dE3784F83143a165F1A, // Self-created aggregator TODO: Update
STETH_FEED_ADDRESS: 0xC028a945D4Ac8593F84F8dE3784F83143a165F1A, // Self-created aggregator TODO: Update
RETH_STRATEGY_ADDRESS: 0x3A8fBdf9e77DFc25d09741f51d3E181b25d0c4E0, // Placeholder address, replaced with address(1) for holesky
STETH_STRATEGY_ADDRESS: 0x7D704507b76571a51d9caE8AdDAbBFd0ba0e63d3 // Placeholder address, replaced with address(1) for holesky
})
Expand Down
8 changes: 4 additions & 4 deletions script/DeployYieldNest.s.sol
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@ pragma solidity ^0.8.24;


import {TransparentUpgradeableProxy} from "lib/openzeppelin-contracts/contracts/proxy/transparent/TransparentUpgradeableProxy.sol";
import {IEigenPodManager} from "src/external/eigenlayer/v0.1.0/interfaces/IEigenPodManager.sol";
import {IDelegationManager} from "src/external/eigenlayer/v0.1.0/interfaces/IDelegationManager.sol";
import {IDelayedWithdrawalRouter} from "src/external/eigenlayer/v0.1.0/interfaces/IDelayedWithdrawalRouter.sol";
import {IStrategyManager} from "src/external/eigenlayer/v0.1.0/interfaces/IStrategyManager.sol";
import {IEigenPodManager} from "lib/eigenlayer-contracts/src/contracts/interfaces/IEigenPodManager.sol";
import {IDelegationManager} from "lib/eigenlayer-contracts/src/contracts/interfaces/IDelegationManager.sol";
import {IDelayedWithdrawalRouter} from "lib/eigenlayer-contracts/src/contracts/interfaces/IDelayedWithdrawalRouter.sol";
import {IStrategyManager} from "lib/eigenlayer-contracts/src/contracts/interfaces/IStrategyManager.sol";
import {IDepositContract} from "src/external/ethereum/IDepositContract.sol";
import {IRewardsDistributor} from "src/interfaces/IRewardsDistributor.sol";
import {IynETH} from "src/interfaces/IynETH.sol";
Expand Down
12 changes: 6 additions & 6 deletions script/DeployYnLSD.s.sol
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@ pragma solidity ^0.8.24;

import {TransparentUpgradeableProxy} from "lib/openzeppelin-contracts/contracts/proxy/transparent/TransparentUpgradeableProxy.sol";
import {IERC20} from "lib/openzeppelin-contracts/contracts/token/ERC20/IERC20.sol";
import {IEigenPodManager} from "src/external/eigenlayer/v0.1.0/interfaces/IEigenPodManager.sol";
import {IDelegationManager} from "src/external/eigenlayer/v0.1.0/interfaces/IDelegationManager.sol";
import {IDelayedWithdrawalRouter} from "src/external/eigenlayer/v0.1.0/interfaces/IDelayedWithdrawalRouter.sol";
import {IStrategyManager} from "src/external/eigenlayer/v0.1.0/interfaces/IStrategyManager.sol";
import {IStrategy} from "src/external/eigenlayer/v0.1.0/interfaces/IStrategy.sol";
import {IEigenPodManager} from "lib/eigenlayer-contracts/src/contracts/interfaces/IEigenPodManager.sol";
import {IDelegationManager} from "lib/eigenlayer-contracts/src/contracts/interfaces/IDelegationManager.sol";
import {IDelayedWithdrawalRouter} from "lib/eigenlayer-contracts/src/contracts/interfaces/IDelayedWithdrawalRouter.sol";
import {IStrategyManager} from "lib/eigenlayer-contracts/src/contracts/interfaces/IStrategyManager.sol";
import {IStrategy} from "lib/eigenlayer-contracts/src/contracts/interfaces/IStrategy.sol";
import {IDepositContract} from "src/external/ethereum/IDepositContract.sol";
import {IWETH} from "src/external/tokens/IWETH.sol";

Expand Down Expand Up @@ -94,7 +94,7 @@ contract DeployYnLSD is BaseScript {
lsdRestakingManager: actors.LSD_RESTAKING_MANAGER, // Assuming no restaking manager is set initially
lsdStakingNodeCreatorRole: actors.STAKING_NODE_CREATOR, // Assuming no staking node creator role is set initially
pauseWhitelist: lsdPauseWhitelist,
depositBootstrapper: actors.DEPOSIT_BOOTSTRAPER
depositBootstrapper: actors.DEPOSIT_BOOTSTRAPPER
});
ynlsd.initialize(ynlsdInit);
}
Expand Down
36 changes: 18 additions & 18 deletions src/LSDStakingNode.sol
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,18 @@ import {Initializable} from "lib/openzeppelin-contracts-upgradeable/contracts/pr
import {IBeacon} from "lib/openzeppelin-contracts/contracts/proxy/beacon/IBeacon.sol";
import {ReentrancyGuardUpgradeable} from "lib/openzeppelin-contracts-upgradeable/contracts/utils/ReentrancyGuardUpgradeable.sol";
import {IERC20} from "lib/openzeppelin-contracts/contracts/token/ERC20/IERC20.sol";
import {ILSDStakingNode} from "src/interfaces/ILSDStakingNode.sol";
import {SafeERC20} from "lib/openzeppelin-contracts/contracts/token/ERC20/utils/SafeERC20.sol";

import {ISignatureUtils} from "lib/eigenlayer-contracts/src/contracts/interfaces/ISignatureUtils.sol";
import {IStrategyManager} from "lib/eigenlayer-contracts/src/contracts/interfaces/IStrategyManager.sol";
import {IDelegationManager} from "lib/eigenlayer-contracts/src/contracts/interfaces/IDelegationManager.sol";
import {IStrategy} from "lib/eigenlayer-contracts/src/contracts/interfaces/IStrategy.sol";
import {IynLSD} from "src/interfaces/IynLSD.sol";
import {IStrategyManager} from "src/external/eigenlayer/v0.1.0/interfaces/IStrategyManager.sol";
import {IDelegationManager} from "src/external/eigenlayer/v0.1.0/interfaces/IDelegationManager.sol";
import {IStrategy} from "src/external/eigenlayer/v0.1.0/interfaces/IStrategy.sol";
import {ILSDStakingNode} from "src/interfaces/ILSDStakingNode.sol";

interface ILSDStakingNodeEvents {
event DepositToEigenlayer(IERC20 indexed asset, IStrategy indexed strategy, uint256 amount, uint256 eigenShares);
event Delegated(address indexed operator, bytes32 approverSalt);
event Undelegated(address indexed operator);
event Undelegated(bytes32[] withdrawalRoots);
}

/**
Expand Down Expand Up @@ -106,27 +106,27 @@ contract LSDStakingNode is ILSDStakingNode, Initializable, ReentrancyGuardUpgrad
* @notice Delegates the staking operation to a specified operator.
* @param operator The address of the operator to whom the staking operation is being delegated.
*/
function delegate(address operator) public virtual onlyLSDRestakingManager {
function delegate(
address operator,
ISignatureUtils.SignatureWithExpiry memory signature,
bytes32 approverSalt
) public virtual onlyLSDRestakingManager {

IDelegationManager delegationManager = ynLSD.delegationManager();
delegationManager.delegateTo(operator);
delegationManager.delegateTo(operator, signature, approverSalt);

emit Delegated(operator, 0);
}

/**
* @notice Undelegates the staking operation from the current operator.
* @dev Retrieves the current operator by calling `delegatedTo` on the DelegationManager for event logging.
* @notice Undelegates the staking operation.
*/
function undelegate() public virtual onlyLSDRestakingManager {

IDelegationManager delegationManager = ynLSD.delegationManager();
address operator = delegationManager.delegatedTo(address(this));

IStrategyManager strategyManager = ynLSD.strategyManager();
strategyManager.undelegate();
function undelegate() public override onlyLSDRestakingManager {

IDelegationManager delegationManager = IDelegationManager(address(ynLSD.delegationManager()));
bytes32[] memory withdrawalRoots = delegationManager.undelegate(address(this));

emit Undelegated(operator);
emit Undelegated(withdrawalRoots);
}

/**
Expand Down
Loading

0 comments on commit 0597b87

Please sign in to comment.