WormholeSRImplementation

Introduction

WormholeSRImplementation is a BroadcastAmbImplementation used in BroadcastRegistry and is the data layer by which messages on one chain can be broadcast to multiple chains.

You can read more about Wormhole's Specialized Relayer (SR) here: https://docs.wormhole.com/wormhole/explore-wormhole/relayer#specialized-relayers

Core Concepts

setWormholeCore

This function allows the ProtocolAdmin role to configure the Wormhole core contract for the respective chain found here: https://docs.wormhole.com/wormhole/blockchain-environments/contracts

function setWormholeCore(
    address wormhole_
) external onlyProtocolAdmin

broadcastPayload

This function implements the function in BroadcastAmbImplementation and publishes a message to Wormhole.

function broadcastPayload(
    address srcSender_,
    bytes memory message_,
    bytes memory extraData_
) external payable virtual
namedescription

srcSender_

address of the sending contract

message_

bytes message to broadcast

extraData_

bytes extraData to override

receiveMessage

This function allows roles that are Wormhole VAA Relayers to receive messages in Wormhole. Despite being public, the function will revert if the caller of this function is not a Relayer.

function receiveMessage(
    bytes memory encodedMessage
) public
namedescription

encodedMessage

bytes message to read into contract

setChainId

This function allows the ProtocolAdmin to add new chain ids based on the mapping in Wormhole.

function setChainId(
    uint64 superChainId_, 
    uint16 ambChainId_)
external onlyProtocolAdmin
namedescription

superChainId_

internal chain id used by the Superform protocol. block.chainid casted to uint64

ambChainId_

uint16 chain id allocated to each chain by Wormhole

setFinality

This function allows the ProtocolAdmin to set the required finality level on the source chain for message broadcasting.

function setFinality(
    uint8 finality_
) external onlyProtocolAdmin

Last updated