Skip to content
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
17 changes: 8 additions & 9 deletions packages/contracts-bedrock/src/L2/XForkL2ContractsManager.sol
Original file line number Diff line number Diff line change
Expand Up @@ -146,29 +146,28 @@ contract XForkL2ContractsManager is ISemver {
function upgrade() external {
if (address(this) == THIS_L2CM) revert XForkL2ContractsManager_OnlyDelegatecall();

XForkL2CMTypes.FullConfig memory fullConfig = _fullConfig();
XForkL2CMTypes.FullConfig memory fullConfig = _loadFullConfig();
_apply(fullConfig);
}

/// @notice Loads the full configuration for the L2 Predeploys.
/// @return fullConfig_ The full configuration.
function _fullConfig() internal view returns (XForkL2CMTypes.FullConfig memory fullConfig_) {
function _loadFullConfig() internal view returns (XForkL2CMTypes.FullConfig memory fullConfig_) {
bool isCustomGasToken = IL1Block(Predeploys.L1_BLOCK_ATTRIBUTES).isCustomGasToken();

// L2CrossDomainMessenger
fullConfig_.crossDomainMessenger = XForkL2CMTypes.CrossDomainMessengerConfig({
otherMessenger: address(ICrossDomainMessenger(Predeploys.L2_CROSS_DOMAIN_MESSENGER).otherMessenger())
otherMessenger: ICrossDomainMessenger(Predeploys.L2_CROSS_DOMAIN_MESSENGER).otherMessenger()
});

// L2StandardBridge
fullConfig_.standardBridge = XForkL2CMTypes.StandardBridgeConfig({
otherBridge: address(IStandardBridge(payable(Predeploys.L2_STANDARD_BRIDGE)).otherBridge())
otherBridge: IStandardBridge(payable(Predeploys.L2_STANDARD_BRIDGE)).otherBridge()
});

// L2ERC721Bridge
fullConfig_.erc721Bridge = XForkL2CMTypes.ERC721BridgeConfig({
otherBridge: address(IERC721Bridge(Predeploys.L2_ERC721_BRIDGE).otherBridge())
});
fullConfig_.erc721Bridge =
XForkL2CMTypes.ERC721BridgeConfig({ otherBridge: IERC721Bridge(Predeploys.L2_ERC721_BRIDGE).otherBridge() });

// OptimismMintableERC20Factory
fullConfig_.mintableERC20Factory = XForkL2CMTypes.MintableERC20FactoryConfig({
Expand Down Expand Up @@ -199,7 +198,7 @@ contract XForkL2ContractsManager is ISemver {

// FeeSplitter
fullConfig_.feeSplitter = XForkL2CMTypes.FeeSplitterConfig({
sharesCalculator: address(IFeeSplitter(payable(Predeploys.FEE_SPLITTER)).sharesCalculator())
sharesCalculator: IFeeSplitter(payable(Predeploys.FEE_SPLITTER)).sharesCalculator()
});
}

Expand Down Expand Up @@ -251,7 +250,7 @@ contract XForkL2ContractsManager is ISemver {
_upgradeToAndCall(
Predeploys.L2_ERC721_BRIDGE,
L2_ERC721_BRIDGE_IMPL,
abi.encodeCall(IL2ERC721Bridge.initialize, (payable(_config.erc721Bridge.otherBridge))),
abi.encodeCall(IL2ERC721Bridge.initialize, payable(address(_config.erc721Bridge.otherBridge))),
INITIALIZABLE_SLOT_OZ_V4,
0
);
Expand Down
12 changes: 8 additions & 4 deletions packages/contracts-bedrock/src/libraries/XForkL2CMTypes.sol
Original file line number Diff line number Diff line change
Expand Up @@ -2,23 +2,27 @@
pragma solidity ^0.8.0;

import { Types } from "src/libraries/Types.sol";
import { ICrossDomainMessenger } from "interfaces/universal/ICrossDomainMessenger.sol";
import { IStandardBridge } from "interfaces/universal/IStandardBridge.sol";
import { IERC721Bridge } from "interfaces/universal/IERC721Bridge.sol";
import { ISharesCalculator } from "interfaces/L2/ISharesCalculator.sol";

/// @title XForkL2CMTypes
/// @notice Type definitions for XForkL2ContractsManager upgrade operations.
library XForkL2CMTypes {
/// @notice Configuration for L2CrossDomainMessenger.
struct CrossDomainMessengerConfig {
address otherMessenger;
ICrossDomainMessenger otherMessenger;
}

/// @notice Configuration for L2StandardBridge.
struct StandardBridgeConfig {
address otherBridge;
IStandardBridge otherBridge;
}

/// @notice Configuration for L2ERC721Bridge.
struct ERC721BridgeConfig {
address otherBridge;
IERC721Bridge otherBridge;
}

/// @notice Configuration for OptimismMintableERC20Factory.
Expand All @@ -42,7 +46,7 @@ library XForkL2CMTypes {

/// @notice Configuration for FeeSplitter.
struct FeeSplitterConfig {
address sharesCalculator;
ISharesCalculator sharesCalculator;
}

/// @notice Full network-specific configuration gathered from existing predeploys.
Expand Down
Loading