Optimism_ParentMessenger
Optimism_ParentMessenger
#
Sends cross chain messages from Ethereum L1 to Optimism L2 network.
This contract is ownable and should be owned by the DVM governor.
#
Functionsconstructor(address _crossDomainMessenger, uint256 _childChainId) (public)
Construct the Optimism_ParentMessenger contract.
#
Parameters:- _crossDomainMessenger: The address of the Optimism cross domain messenger contract.
- _childChainId: The chain id of the Optimism L2 network this messenger should connect to.
setDefaultGasLimit(uint32 newDefaultGasLimit) (public)
Changes the default gas limit that is sent along with transactions to Optimism.
The caller of this function must be the owner. This should be set to the DVM governor.
#
Parameters:- newDefaultGasLimit: the new L2 gas limit to be set.
setChildOracleSpoke(address newOracleSpoke) (public)
Changes the address of the oracle spoke on L2 via the child messenger.
The caller of this function must be the owner. This should be set to the DVM governor.
#
Parameters:- newOracleSpoke: the new oracle spoke address set on L2.
setChildParentMessenger(address newParentMessenger) (public)
Changes the address of the parent messenger on L2 via the child messenger.
The caller of this function must be the owner. This should be set to the DVM governor.
#
Parameters:- newParentMessenger: the new parent messenger contract to be set on L2.
setChildDefaultGasLimit(uint32 newDefaultGasLimit) (public)
Changes the Optimism_ChildMessenger default gas limit on L2 via the child messenger.
The caller of this function must be the owner. This should be set to the DVM governor.
#
Parameters:- newDefaultGasLimit: the new default gas limit set on L2.
sendMessageToChild(bytes data) (public)
Sends a message to the child messenger via the canonical message bridge.
The caller must be the either the OracleHub or the GovernorHub. This is to send either a price or initiate a governance action to the OracleSpoke or GovernorSpoke on the child network. The recipient of this message is the child messenger. The messenger must implement processMessageFromParent which then forwards the data to the target either the OracleSpoke or the governorSpoke depending on the caller.
#
Parameters:- data: data message sent to the child messenger. Should be an encoded function call or packed data.
processMessageFromCrossChainChild(bytes data) (public)
Process a received message from the child messenger via the canonical message bridge.
The caller must be the the child messenger, sent over the canonical message bridge. Note that only the OracleHub can receive messages from the child messenger. Therefore we can always forward these messages to this contract. The OracleHub must implement processMessageFromChild to handle this message.
#
Parameters:- data: data message sent from the child messenger. Should be an encoded function call or packed data.
_preEntranceCheck() (internal)
_preEntranceSet() (internal)
_postEntranceReset() (internal)
_startReentrantGuardDisabled() (internal)
_endReentrantGuardDisabled() (internal)
setChildMessenger(address newChildMessenger) (public)
Changes the stored address of the child messenger, deployed on L2.
The caller of this function must be the owner. This should be set to the DVM governor.
#
Parameters:- newChildMessenger: address of the new child messenger, deployed on L2.
setOracleHub(address newOracleHub) (public)
Changes the stored address of the Oracle hub, deployed on L1.
The caller of this function must be the owner. This should be set to the DVM governor.
#
Parameters:- newOracleHub: address of the new oracle hub, deployed on L1 Ethereum.
setGovernorHub(address newGovernorHub) (public)
Changes the stored address of the Governor hub, deployed on L1.
The caller of this function must be the owner. This should be set to the DVM governor.
#
Parameters:- newGovernorHub: address of the new governor hub, deployed on L1 Ethereum.
setOracleSpoke(address newOracleSpoke) (public)
Changes the stored address of the oracle spoke, deployed on L2.
The caller of this function must be the owner. This should be set to the DVM governor.
#
Parameters:- newOracleSpoke: address of the new oracle spoke, deployed on L2.
setGovernorSpoke(address newGovernorSpoke) (public)
Changes the stored address of the governor spoke, deployed on L2.
The caller of this function must be the owner. This should be set to the DVM governor.
#
Parameters:- newGovernorSpoke: address of the new governor spoke, deployed on L2.
getL1CallValue() โ uint256 (external)
Returns the amount of ETH required for a caller to pass as msg.value when calling sendMessageToChild
.
owner() โ address (public)
Returns the address of the current owner.
renounceOwnership() (public)
Leaves the contract without owner. It will not be possible to call
onlyOwner
functions anymore. Can only be called by the current owner.
NOTE: Renouncing ownership will leave the contract without an owner,
thereby removing any functionality that is only available to the owner.
transferOwnership(address newOwner) (public)
Transfers ownership of the contract to a new account (newOwner
).
Can only be called by the current owner.
_transferOwnership(address newOwner) (internal)
Transfers ownership of the contract to a new account (newOwner
).
Internal function without access restriction.
_msgSender() โ address (internal)
_msgData() โ bytes (internal)
getCrossDomainMessenger() โ contract ICrossDomainMessenger (internal)
Gets the messenger, usually from storage. This function is exposed in case a child contract needs to override.
sendCrossDomainMessage(address _crossDomainTarget, uint32 _gasLimit, bytes _message) (internal)
q Sends a message to an account on another domain
#
Parameters:- _crossDomainTarget: The intended recipient on the destination domain
- _message: The data to send to the target (usually calldata to a function with
onlyFromCrossDomainAccount()
)
- _gasLimit: The gasLimit for the receipt of the message on the target domain.
#
EventsSetDefaultGasLimit(uint32 newDefaultGasLimit)
MessageSentToChild(bytes data, address targetSpoke, uint32 gasLimit, address childMessenger)
MessageReceivedFromChild(bytes data, address childMessenger, address targetHub)
SetChildMessenger(address childMessenger)
SetOracleHub(address oracleHub)
SetGovernorHub(address governorHub)
SetOracleSpoke(address oracleSpoke)
SetGovernorSpoke(address governorSpoke)
OwnershipTransferred(address previousOwner, address newOwner)
#
ModifiersnonReentrant()
Prevents a contract from calling itself, directly or indirectly.
Calling a nonReentrant
function from another nonReentrant
function is not supported. It is possible to
prevent this from happening by making the nonReentrant
function external, and making it call a private
function that does the actual state modification.
nonReentrantView()
Designed to prevent a view-only method from being re-entered during a call to a nonReentrant()
state-changing method.
onlyHubContract()
onlyOwner()
Throws if called by any account other than the owner.
onlyFromCrossDomainAccount(address _sourceDomainAccount)
Enforces that the modified function is only callable by a specific cross-domain account.
Parameters:
- _sourceDomainAccount: The only account on the originating domain which is authenticated to call this function.