Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add remaining semver #1041

Merged
merged 2 commits into from
Jan 22, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 7 additions & 5 deletions script/deploy/devnet/deploy_from_scratch.s.sol
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,8 @@ contract DeployFromScratch is Script, Test {
eigenPodImplementation = new EigenPod(
ethPOSDeposit,
eigenPodManager,
GOERLI_GENESIS_TIME
GOERLI_GENESIS_TIME,
SEMVER
);

eigenPodBeacon = new UpgradeableBeacon(address(eigenPodImplementation));
Expand All @@ -254,7 +255,8 @@ contract DeployFromScratch is Script, Test {
ethPOSDeposit,
eigenPodBeacon,
delegation,
eigenLayerPauserReg
eigenLayerPauserReg,
SEMVER
);
rewardsCoordinatorImplementation = new RewardsCoordinator(
IRewardsCoordinatorTypes.RewardsCoordinatorConstructorParams(
Expand All @@ -279,8 +281,8 @@ contract DeployFromScratch is Script, Test {
ALLOCATION_CONFIGURATION_DELAY,
SEMVER
);
permissionControllerImplementation = new PermissionController();
strategyFactoryImplementation = new StrategyFactory(strategyManager, eigenLayerPauserReg);
permissionControllerImplementation = new PermissionController(SEMVER);
strategyFactoryImplementation = new StrategyFactory(strategyManager, eigenLayerPauserReg, SEMVER);

// Third, upgrade the proxy contracts to use the correct implementation contracts and initialize them.
{
Expand Down Expand Up @@ -348,7 +350,7 @@ contract DeployFromScratch is Script, Test {

// Deploy strategyFactory & base
// Create base strategy implementation
baseStrategyImplementation = new StrategyBase(strategyManager, eigenLayerPauserReg);
baseStrategyImplementation = new StrategyBase(strategyManager, eigenLayerPauserReg, SEMVER);

// Create a proxy beacon for base strategy implementation
strategyBeacon = new UpgradeableBeacon(address(baseStrategyImplementation));
Expand Down
9 changes: 5 additions & 4 deletions script/deploy/local/Deploy_From_Scratch.s.sol
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,7 @@ contract DeployFromScratch is Script, Test {
} else {
ethPOSDeposit = IETHPOSDeposit(stdJson.readAddress(config_data, ".ethPOSDepositAddress"));
}
eigenPodImplementation = new EigenPod(ethPOSDeposit, eigenPodManager, GOERLI_GENESIS_TIME);
eigenPodImplementation = new EigenPod(ethPOSDeposit, eigenPodManager, GOERLI_GENESIS_TIME, SEMVER);

eigenPodBeacon = new UpgradeableBeacon(address(eigenPodImplementation));

Expand All @@ -265,7 +265,8 @@ contract DeployFromScratch is Script, Test {
ethPOSDeposit,
eigenPodBeacon,
delegation,
eigenLayerPauserReg
eigenLayerPauserReg,
SEMVER
);
rewardsCoordinatorImplementation = new RewardsCoordinator(
IRewardsCoordinatorTypes.RewardsCoordinatorConstructorParams(
Expand All @@ -290,7 +291,7 @@ contract DeployFromScratch is Script, Test {
ALLOCATION_CONFIGURATION_DELAY,
SEMVER
);
permissionControllerImplementation = new PermissionController();
permissionControllerImplementation = new PermissionController(SEMVER);

// Third, upgrade the proxy contracts to use the correct implementation contracts and initialize them.
{
Expand Down Expand Up @@ -362,7 +363,7 @@ contract DeployFromScratch is Script, Test {
);

// deploy StrategyBaseTVLLimits contract implementation
baseStrategyImplementation = new StrategyBaseTVLLimits(strategyManager, eigenLayerPauserReg);
baseStrategyImplementation = new StrategyBaseTVLLimits(strategyManager, eigenLayerPauserReg, SEMVER);
// create upgradeable proxies that each point to the implementation and initialize them
for (uint256 i = 0; i < strategyConfigs.length; ++i) {
if (strategyConfigs[i].tokenAddress == address(0)) {
Expand Down
10 changes: 6 additions & 4 deletions script/deploy/local/deploy_from_scratch.slashing.s.sol
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,8 @@ contract DeployFromScratch is Script, Test {
eigenPodImplementation = new EigenPod(
ethPOSDeposit,
eigenPodManager,
GOERLI_GENESIS_TIME
GOERLI_GENESIS_TIME,
SEMVER
);

eigenPodBeacon = new UpgradeableBeacon(address(eigenPodImplementation));
Expand All @@ -260,7 +261,8 @@ contract DeployFromScratch is Script, Test {
ethPOSDeposit,
eigenPodBeacon,
delegation,
eigenLayerPauserReg
eigenLayerPauserReg,
SEMVER
);
rewardsCoordinatorImplementation = new RewardsCoordinator(
IRewardsCoordinatorTypes.RewardsCoordinatorConstructorParams(
Expand All @@ -285,7 +287,7 @@ contract DeployFromScratch is Script, Test {
ALLOCATION_CONFIGURATION_DELAY,
SEMVER
);
permissionControllerImplementation = new PermissionController();
permissionControllerImplementation = new PermissionController(SEMVER);

// Third, upgrade the proxy contracts to use the correct implementation contracts and initialize them.
{
Expand Down Expand Up @@ -357,7 +359,7 @@ contract DeployFromScratch is Script, Test {
);

// deploy StrategyBaseTVLLimits contract implementation
baseStrategyImplementation = new StrategyBaseTVLLimits(strategyManager, eigenLayerPauserReg);
baseStrategyImplementation = new StrategyBaseTVLLimits(strategyManager, eigenLayerPauserReg, SEMVER);
// create upgradeable proxies that each point to the implementation and initialize them
for (uint256 i = 0; i < strategyConfigs.length; ++i) {
if (strategyConfigs[i].tokenAddress == address(0)) {
Expand Down
20 changes: 13 additions & 7 deletions script/releases/v1.0.0-slashing/1-deployContracts.s.sol
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ contract Deploy is EOADeployer {

deployImpl({
name: type(PermissionController).name,
deployedTo: address(new PermissionController())
deployedTo: address(new PermissionController(Env.version()))
});

deployProxy({
Expand Down Expand Up @@ -134,7 +134,8 @@ contract Deploy is EOADeployer {
_ethPOS: Env.ethPOS(),
_eigenPodBeacon: Env.beacon.eigenPod(),
_delegationManager: Env.proxy.delegationManager(),
_pauserRegistry: Env.impl.pauserRegistry()
_pauserRegistry: Env.impl.pauserRegistry(),
_version: Env.version()
}))
});

Expand All @@ -143,7 +144,8 @@ contract Deploy is EOADeployer {
deployedTo: address(new EigenPod({
_ethPOS: Env.ethPOS(),
_eigenPodManager: Env.proxy.eigenPodManager(),
_GENESIS_TIME: Env.EIGENPOD_GENESIS_TIME()
_GENESIS_TIME: Env.EIGENPOD_GENESIS_TIME(),
_version: Env.version()
}))
});

Expand All @@ -153,23 +155,26 @@ contract Deploy is EOADeployer {
name: type(StrategyBaseTVLLimits).name,
deployedTo: address(new StrategyBaseTVLLimits({
_strategyManager: Env.proxy.strategyManager(),
_pauserRegistry: Env.impl.pauserRegistry()
_pauserRegistry: Env.impl.pauserRegistry(),
_version: Env.version()
}))
});

deployImpl({
name: type(EigenStrategy).name,
deployedTo: address(new EigenStrategy({
_strategyManager: Env.proxy.strategyManager(),
_pauserRegistry: Env.impl.pauserRegistry()
_pauserRegistry: Env.impl.pauserRegistry(),
_version: Env.version()
}))
});

deployImpl({
name: type(StrategyFactory).name,
deployedTo: address(new StrategyFactory({
_strategyManager: Env.proxy.strategyManager(),
_pauserRegistry: Env.impl.pauserRegistry()
_pauserRegistry: Env.impl.pauserRegistry(),
_version: Env.version()
}))
});

Expand All @@ -178,7 +183,8 @@ contract Deploy is EOADeployer {
name: type(StrategyBase).name,
deployedTo: address(new StrategyBase({
_strategyManager: Env.proxy.strategyManager(),
_pauserRegistry: Env.impl.pauserRegistry()
_pauserRegistry: Env.impl.pauserRegistry(),
_version: Env.version()
}))
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ contract Deploy is EOADeployer {

deployImpl({
name: type(PermissionController).name,
deployedTo: address(new PermissionController())
deployedTo: address(new PermissionController(Env.version()))
});

deployProxy({
Expand Down Expand Up @@ -134,7 +134,8 @@ contract Deploy is EOADeployer {
_ethPOS: Env.ethPOS(),
_eigenPodBeacon: Env.beacon.eigenPod(),
_delegationManager: Env.proxy.delegationManager(),
_pauserRegistry: Env.impl.pauserRegistry()
_pauserRegistry: Env.impl.pauserRegistry(),
_version: Env.version()
}))
});

Expand All @@ -143,7 +144,8 @@ contract Deploy is EOADeployer {
deployedTo: address(new EigenPod({
_ethPOS: Env.ethPOS(),
_eigenPodManager: Env.proxy.eigenPodManager(),
_GENESIS_TIME: Env.EIGENPOD_GENESIS_TIME()
_GENESIS_TIME: Env.EIGENPOD_GENESIS_TIME(),
_version: Env.version()
}))
});

Expand All @@ -153,23 +155,26 @@ contract Deploy is EOADeployer {
name: type(StrategyBaseTVLLimits).name,
deployedTo: address(new StrategyBaseTVLLimits({
_strategyManager: Env.proxy.strategyManager(),
_pauserRegistry: Env.impl.pauserRegistry()
_pauserRegistry: Env.impl.pauserRegistry(),
_version: Env.version()
}))
});

deployImpl({
name: type(EigenStrategy).name,
deployedTo: address(new EigenStrategy({
_strategyManager: Env.proxy.strategyManager(),
_pauserRegistry: Env.impl.pauserRegistry()
_pauserRegistry: Env.impl.pauserRegistry(),
_version: Env.version()
}))
});

deployImpl({
name: type(StrategyFactory).name,
deployedTo: address(new StrategyFactory({
_strategyManager: Env.proxy.strategyManager(),
_pauserRegistry: Env.impl.pauserRegistry()
_pauserRegistry: Env.impl.pauserRegistry(),
_version: Env.version()
}))
});

Expand All @@ -178,7 +183,8 @@ contract Deploy is EOADeployer {
name: type(StrategyBase).name,
deployedTo: address(new StrategyBase({
_strategyManager: Env.proxy.strategyManager(),
_pauserRegistry: Env.impl.pauserRegistry()
_pauserRegistry: Env.impl.pauserRegistry(),
_version: Env.version()
}))
});

Expand Down
2 changes: 1 addition & 1 deletion script/utils/ExistingDeploymentParser.sol
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,7 @@ contract ExistingDeploymentParser is Script, Logger {
eigenLayerPauserReg = PauserRegistry(json.readAddress(".addresses.eigenLayerPauserReg"));

// FIXME: hotfix - remove later...
permissionControllerImplementation = new PermissionController();
permissionControllerImplementation = new PermissionController(SEMVER);
permissionController = PermissionController(
address(new TransparentUpgradeableProxy(address(permissionControllerImplementation), address(eigenLayerProxyAdmin), ""))
);
Expand Down
7 changes: 5 additions & 2 deletions src/contracts/permissions/PermissionController.sol
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,10 @@
pragma solidity ^0.8.27;

import "@openzeppelin-upgrades/contracts/proxy/utils/Initializable.sol";
import "../mixins/SemVerMixin.sol";
import "./PermissionControllerStorage.sol";

contract PermissionController is Initializable, PermissionControllerStorage {
contract PermissionController is Initializable, SemVerMixin, PermissionControllerStorage {
using EnumerableSet for *;

modifier onlyAdmin(
Expand All @@ -19,7 +20,9 @@ contract PermissionController is Initializable, PermissionControllerStorage {
* INITIALIZING FUNCTIONS
*
*/
constructor() {
constructor(
string memory _version
) SemVerMixin(_version) {
_disableInitializers();
}

Expand Down
17 changes: 15 additions & 2 deletions src/contracts/pods/EigenPod.sol
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
import "../libraries/BeaconChainProofs.sol";
import "../libraries/BytesLib.sol";

import "../mixins/SemVerMixin.sol";

import "../interfaces/IETHPOSDeposit.sol";
import "../interfaces/IEigenPodManager.sol";
import "../interfaces/IPausable.sol";
Expand All @@ -23,7 +25,13 @@ import "./EigenPodStorage.sol";
* @dev Note that all beacon chain balances are stored as gwei within the beacon chain datastructures. We choose
* to account balances in terms of gwei in the EigenPod contract and convert to wei when making calls to other contracts
*/
contract EigenPod is Initializable, ReentrancyGuardUpgradeable, EigenPodPausingConstants, EigenPodStorage {
contract EigenPod is
Initializable,
ReentrancyGuardUpgradeable,
EigenPodPausingConstants,
EigenPodStorage,
SemVerMixin
{
using BytesLib for bytes;
using SafeERC20 for IERC20;
using BeaconChainProofs for *;
Expand Down Expand Up @@ -94,7 +102,12 @@ contract EigenPod is Initializable, ReentrancyGuardUpgradeable, EigenPodPausingC
* CONSTRUCTOR / INIT
*
*/
constructor(IETHPOSDeposit _ethPOS, IEigenPodManager _eigenPodManager, uint64 _GENESIS_TIME) {
constructor(
IETHPOSDeposit _ethPOS,
IEigenPodManager _eigenPodManager,
uint64 _GENESIS_TIME,
string memory _version
) SemVerMixin(_version) {
ethPOS = _ethPOS;
eigenPodManager = _eigenPodManager;
GENESIS_TIME = _GENESIS_TIME;
Expand Down
13 changes: 10 additions & 3 deletions src/contracts/pods/EigenPodManager.sol
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import "@openzeppelin-upgrades/contracts/access/OwnableUpgradeable.sol";
import "@openzeppelin-upgrades/contracts/security/ReentrancyGuardUpgradeable.sol";

import "../libraries/SlashingLib.sol";
import "../mixins/SemVerMixin.sol";
import "../permissions/Pausable.sol";
import "./EigenPodPausingConstants.sol";
import "./EigenPodManagerStorage.sol";
Expand All @@ -27,7 +28,8 @@ contract EigenPodManager is
Pausable,
EigenPodPausingConstants,
EigenPodManagerStorage,
ReentrancyGuardUpgradeable
ReentrancyGuardUpgradeable,
SemVerMixin
{
using SlashingLib for *;
using Math for *;
Expand All @@ -48,8 +50,13 @@ contract EigenPodManager is
IETHPOSDeposit _ethPOS,
IBeacon _eigenPodBeacon,
IDelegationManager _delegationManager,
IPauserRegistry _pauserRegistry
) EigenPodManagerStorage(_ethPOS, _eigenPodBeacon, _delegationManager) Pausable(_pauserRegistry) {
IPauserRegistry _pauserRegistry,
string memory _version
)
EigenPodManagerStorage(_ethPOS, _eigenPodBeacon, _delegationManager)
Pausable(_pauserRegistry)
SemVerMixin(_version)
{
_disableInitializers();
}

Expand Down
5 changes: 3 additions & 2 deletions src/contracts/strategies/EigenStrategy.sol
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,9 @@ contract EigenStrategy is StrategyBase {
/// @notice Since this contract is designed to be initializable, the constructor simply sets `strategyManager`, the only immutable variable.
constructor(
IStrategyManager _strategyManager,
IPauserRegistry _pauserRegistry
) StrategyBase(_strategyManager, _pauserRegistry) {}
IPauserRegistry _pauserRegistry,
string memory _version
) StrategyBase(_strategyManager, _pauserRegistry, _version) {}

function initialize(IEigen _EIGEN, IERC20 _bEIGEN) public virtual initializer {
EIGEN = _EIGEN;
Expand Down
9 changes: 7 additions & 2 deletions src/contracts/strategies/StrategyBase.sol
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ pragma solidity ^0.8.27;

import "../interfaces/IStrategyManager.sol";
import "../permissions/Pausable.sol";
import "../mixins/SemVerMixin.sol";
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol";
import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
Expand All @@ -28,7 +29,7 @@ import "@openzeppelin-upgrades/contracts/proxy/utils/Initializable.sol";
* [this thread](https://github.com/OpenZeppelin/openzeppelin-contracts/issues/3706) on the OpenZeppelin repo.
* We specifically use a share offset of `SHARES_OFFSET` and a balance offset of `BALANCE_OFFSET`.
*/
contract StrategyBase is Initializable, Pausable, IStrategy {
contract StrategyBase is Initializable, Pausable, IStrategy, SemVerMixin {
using SafeERC20 for IERC20;

uint8 internal constant PAUSED_DEPOSITS = 0;
Expand Down Expand Up @@ -69,7 +70,11 @@ contract StrategyBase is Initializable, Pausable, IStrategy {
}

/// @notice Since this contract is designed to be initializable, the constructor simply sets `strategyManager`, the only immutable variable.
constructor(IStrategyManager _strategyManager, IPauserRegistry _pauserRegistry) Pausable(_pauserRegistry) {
constructor(
IStrategyManager _strategyManager,
IPauserRegistry _pauserRegistry,
string memory _version
) Pausable(_pauserRegistry) SemVerMixin(_version) {
strategyManager = _strategyManager;
_disableInitializers();
}
Expand Down
Loading
Loading