Skip to content

Latest commit

 

History

History
148 lines (104 loc) · 3.18 KB

PolygonDAORoot.md

File metadata and controls

148 lines (104 loc) · 3.18 KB

PolygonDAORoot

Root chain side of a Polygon data bridge meant to execute commands on the child chain

This can be used to forward commands given by the DAO to be executed on the child chain

Contents

Globals

Note this contains internal vars as well due to a bug in the docgen procedure

Var Type
latestData bytes

Functions

constructor

PolygonDAORoot constructor

calls FxBaseRootTunnel(_checkpointManager, _fxRoot)

Declaration

  function constructor(
    address _checkpointManager,
    address _fxRoot
  ) public FxBaseRootTunnel

Modifiers:

Modifier
FxBaseRootTunnel

Args:

Arg Type Description
_checkpointManager address Address of RootChainProxy from https://github.com/maticnetwork/static/tree/master/network
_fxRoot address Address of FxStateRootTunnel from https://docs.matic.network/docs/develop/l1-l2-communication/state-transfer/

_processMessageFromChild

Used to receive message from child chain

Not currently used

Declaration

  function _processMessageFromChild(
    bytes _data
  ) internal

Modifiers:

No modifiers

Args:

Arg Type Description
_data bytes Data received from child chain

sendMessageToChild

Sends a payload to be executed on the child chain

Payload needs to be encoded like abi.encode(_target, _value, _data)

Declaration

  function sendMessageToChild(
    bytes _message
  ) public onlyOwner

Modifiers:

Modifier
onlyOwner

Args:

Arg Type Description
_message bytes payload to execute on the child chain

callOnChild

Encodes and sends a payload to be executed on the child chain

This is what you will use most of the time. Emits CallOnChild

Declaration

  function callOnChild(
    address _target,
    uint256 _value,
    bytes _data
  ) public onlyOwner

Modifiers:

Modifier
onlyOwner

Args:

Arg Type Description
_target address Address on child chain against which to execute the tx
_value uint256 Value to transfer
_data bytes Calldata for the child tx

Events

CallOnChild

Logs a call being forwarded to the child chain

Emitted when callOnChild is called

Params:

Param Type Indexed Description
caller address Address that called callOnChild
target address Target of call on the child chain
value uint256 Value to transfer on execution
sig bytes4 Signature of function that will be called