-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathJBOptimismSuckerDeployer.sol
80 lines (66 loc) · 3.76 KB
/
JBOptimismSuckerDeployer.sol
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
// SPDX-License-Identifier: MIT
pragma solidity 0.8.23;
import "./JBSuckerDeployer.sol";
import "../interfaces/IJBArbitrumSuckerDeployer.sol";
import {JBOptimismSucker} from "../JBOptimismSucker.sol";
import {JBAddToBalanceMode} from "../enums/JBAddToBalanceMode.sol";
import {IJBOpSuckerDeployer} from "./../interfaces/IJBOpSuckerDeployer.sol";
import {IJBSuckerDeployer} from "./../interfaces/IJBSuckerDeployer.sol";
import {IOPMessenger} from "../interfaces/IOPMessenger.sol";
import {IOPStandardBridge} from "../interfaces/IOPStandardBridge.sol";
/// @notice An `IJBSuckerDeployerFeeless` implementation to deploy `JBOptimismSucker` contracts.
contract JBOptimismSuckerDeployer is JBSuckerDeployer, IJBOpSuckerDeployer {
//*********************************************************************//
// ---------------------- public stored properties ------------------- //
//*********************************************************************//
/// @notice The messenger used to send messages between the local and remote sucker.
IOPMessenger public override opMessenger;
/// @notice The bridge used to bridge tokens between the local and remote chain.
IOPStandardBridge public override opBridge;
//*********************************************************************//
// ---------------------------- constructor -------------------------- //
//*********************************************************************//
/// @param directory The directory of terminals and controllers for projects.
/// @param permissions The permissions contract for the deployer.
/// @param tokens The contract that manages token minting and burning.
/// @param configurator The address of the configurator.
constructor(
IJBDirectory directory,
IJBPermissions permissions,
IJBTokens tokens,
address configurator,
address trusted_forwarder
)
JBSuckerDeployer(directory, permissions, tokens, configurator, trusted_forwarder)
{}
//*********************************************************************//
// ------------------------ internal views --------------------------- //
//*********************************************************************//
/// @notice Check if the layer specific configuration is set or not. Used as a sanity check.
function _layerSpecificConfigurationIsSet() internal view override returns (bool) {
return address(opMessenger) != address(0) || address(opBridge) != address(0);
}
//*********************************************************************//
// --------------------- external transactions ----------------------- //
//*********************************************************************//
/// @notice handles some layer specific configuration that can't be done in the constructor otherwise deployment
/// addresses would change.
/// @notice messenger the OPMesssenger on this layer.
/// @notice bridge the OPStandardBridge on this layer.
function setChainSpecificConstants(IOPMessenger messenger, IOPStandardBridge bridge) external {
if (_layerSpecificConfigurationIsSet()) {
revert JBSuckerDeployer_AlreadyConfigured();
}
if (_msgSender() != LAYER_SPECIFIC_CONFIGURATOR) {
revert JBSuckerDeployer_Unauthorized(_msgSender(), LAYER_SPECIFIC_CONFIGURATOR);
}
// Configure these layer specific properties.
// This is done in a separate call to make the deployment code chain agnostic.
opMessenger = messenger;
opBridge = bridge;
// Make sure the layer specific configuration is properly configured.
if (!_layerSpecificConfigurationIsSet()) {
revert JBSuckerDeployer_InvalidLayerSpecificConfiguration();
}
}
}