Skip to content

Commit

Permalink
feat: support chain id
Browse files Browse the repository at this point in the history
  • Loading branch information
renlulu committed Apr 2, 2024
1 parent cce652b commit 3e27503
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 2 deletions.
5 changes: 4 additions & 1 deletion contracts/script/MachServiceManagerDeployer.s.sol
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ contract MachServiceManagerDeployer is Script {
address churner;
address ejector;
address confirmer;
uint256 chainId;
// from eigenlayer contracts
address avsDirectory;
address delegationManager;
Expand Down Expand Up @@ -103,6 +104,7 @@ contract MachServiceManagerDeployer is Script {
addressConfig.churner = msg.sender;
addressConfig.ejector = msg.sender;
addressConfig.confirmer = msg.sender;
addressConfig.chainId = 1;
addressConfig.avsDirectory = address(eigenLayerContracts.avsDirectory);
addressConfig.delegationManager = address(eigenLayerContracts.delegationManager);

Expand Down Expand Up @@ -206,7 +208,8 @@ contract MachServiceManagerDeployer is Script {
machServiceContract.machServiceManagerImplementation = new MachServiceManager(
IAVSDirectory(addressConfig.avsDirectory),
machServiceContract.registryCoordinator,
machServiceContract.stakeRegistry
machServiceContract.stakeRegistry,
addressConfig.chainId
);
// Third, upgrade the proxy contracts to use the correct implementation contracts and initialize them.
machAVSProxyAdmin.upgradeAndCall(
Expand Down
4 changes: 3 additions & 1 deletion contracts/src/core/MachServiceManager.sol
Original file line number Diff line number Diff line change
Expand Up @@ -61,10 +61,12 @@ contract MachServiceManager is
constructor(
IAVSDirectory __avsDirectory,
IRegistryCoordinator __registryCoordinator,
IStakeRegistry __stakeRegistry
IStakeRegistry __stakeRegistry,
uint256 __chainId
)
BLSSignatureChecker(__registryCoordinator)
ServiceManagerBase(__avsDirectory, __registryCoordinator, __stakeRegistry)
MachServiceManagerStorage(__chainId)
{
_disableInitializers();
}
Expand Down
7 changes: 7 additions & 0 deletions contracts/src/core/MachServiceManagerStorage.sol
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@ abstract contract MachServiceManagerStorage {
// CONSTANTS
uint256 public constant THRESHOLD_DENOMINATOR = 100;

/// @notice Rollup chain id, it is different from block.chainid
uint256 public immutable chainId;

EnumerableSet.Bytes32Set internal _messageHashes;

/// @notice Ethereum addresses of currently register operators
Expand All @@ -34,4 +37,8 @@ abstract contract MachServiceManagerStorage {
// storage gap for upgradeability
// slither-disable-next-line shadowing-state
uint256[46] private __GAP;

constructor(uint256 _chainId) {
chainId = _chainId;
}
}

0 comments on commit 3e27503

Please sign in to comment.