WormholeARImplementation

Introduction

This contract is used to allow Superform to send messages via Wormhole.

Core Concepts

WormholeARImplementation builds upon AMBImplementation to formalize certain methods specific to Wormhole sent via Automatic Relayers.

Receiving Payloads

The implemented interface can be found in Wormhole Receivers here.

receiveWormholeMessages

This function handles the reception of messages broadcast via Wormhole.

function receiveWormholeMessages(
        bytes memory payload,
        bytes[] memory,
        bytes32 sourceAddress,
        uint16 sourceChain,
        bytes32 deliveryHash
) public payable override

Retrying Payloads

As mentioned in the AMB Implementations section, messages can be retried by calling retryPayload with a bytes hash of relevant data. In the case of Wormhole, the data is the following:

{
    VaaKey memory deliveryVaaKey,
    uint16 targetChain,
    uint256 newReceiverValue,
    uint256 newGasLimit,
    address newDeliveryProviderAddress
}

Configuration Setters

There are multiple bridge related configurations to be made on the contract. These configuration functions can only be set by the PROTOCOL_ADMIN

setWormholeRelayer

This function sets the automatic relayer address for the appropriate chain.

function setWormholeRelayer(
    address relayer_
) external onlyProtocolAdmin

setChainId

This function allows the ProtocolAdmin to map a Wormhole chain id to Superform's chain id, the EVM id.

function setChainId(
    uint64 superChainId_,
    uint16 ambChainId_) external onlyProtocolAdmin

setReceiver

This function allows the ProtocolAdmin to set receiver implementations on a new chain id.

function setReceiver(
    uint16 chainId_,
    address authorizedImpl_) external onlyProtocolAdmin

Last updated