SourceGovernor
SourceGovernor
#
#
Functionsconstructor(contract FinderInterface _finder, uint8 _currentChainId) (public)
Constructor.
#
Parameters:- _finder: Address of Finder that this contract uses to locate Bridge.
- _currentChainId: Chain ID for this network. This is configurable by the deployer, rather than
automatically detected via
block.chainid
because the type ofcurrentChainId
should match anydestinationChainId
's submitted as input torelayGovernance()
.relayGovernance()
callsBridge.deposit()
which expects a uint8 chainID passed as the first param, butblock.chainid
returns a uint256 value. Due to the possibility that a uint256 --> uint28 conversion leads to data loss and the complexity of mapping safely from uint256 --> uint8 on-chain, we opt to allow the user to specify a unique uint8 ID for this chain. It follows that the_currentChainId
may not match withblock.chainid
.
relayGovernance(uint8 destinationChainId, address to, bytes data) (external)
This is the first method that should be called in order to relay a governance request to another network
marked by destinationChainId
. Note: this can only be called by the owner (presumably the L1 governor).
The transaction submitted to to
on the sidechain with the calldata data
is assumed to have 0 value
in order to avoid the added complexity of sending cross-chain transactions with positive value.
#
Parameters:- destinationChainId: Chain ID of SinkGovernor that this governance request should ultimately be sent to.
- to: Contract on network with chain ID
destinationChainId
to send governance transaction to.
- data: Calldata to include in governance transaction.
verifyRequest(address to, bytes data) (external)
This method will ultimately be called after relayGovernance
calls Bridge.deposit()
, which will call
GenericHandler.deposit()
and ultimately this method.
This method should basically check that the Bridge.deposit()
was triggered by a valid relay event.
#
Parameters:- to: Contract on network with chain ID
destinationChainId
to send governance transaction to.
- data: Calldata to include in governance transaction.
getResourceId() โ bytes32 (public)
Gets the resource id to send to the bridge.
More details about Resource ID's here: https://chainbridge.chainsafe.io/spec/#resource-id
_getBridge() โ contract IBridge (internal)
_formatMetadata(address to, bytes data) โ bytes (internal)
_computeRequestHash(address to, bytes data) โ bytes32 (internal)
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.
_msgSender() โ address (internal)
_msgData() โ bytes (internal)
#
EventsRelayedGovernanceRequest(uint8 destinationChainId, address to, bytes data)
OwnershipTransferred(address previousOwner, address newOwner)
#
ModifiersonlyOwner()
Throws if called by any account other than the owner.