PayloadHelper

Introduction

PayloadHelper facilitates the decoding of various types of payload data Superform sends between chains. This helper is not called in Superform core contracts, and doesn't serve a purpose in the protocol, but it enriches data hosted in Subgraphs and verifies off-chain processing by Keepers. Third party integrators can use PayloadHelper to extract and understanding payload information.

Core Concepts

There are 3 kinds of payloads associated with Superform at the moment:

  1. CoreStateRegistryPayload: payloads that originated from the chain's CoreStateRegistry

  2. StateSyncerPayload: payloads associated with the transaction history on any SuperformRouter implementation

  3. TimeLockPayload: payloads that originated from the chain's TimelockStateRegistry. Timelock payloads which have either failed or have yet to be processed

CoreStateRegistryPayloads

decodeCoreStateRegistryPayload

This function decodes payloads that arrived to the source chain's CoreStateRegistry.

function decodeCoreStateRegistryPayload(
    uint256 dstPayloadId_
) external view returns (
    uint8 txType,
    uint8 callbackType,
    address srcSender,
    uint64 srcChainId,
    uint256[] memory amounts,
    uint256[] memory slippages,
    uint256[] memory superformIds,
    bytes memory hasDstSwaps,
    bytes memory extraFormData,
    address receiverAddress,
    uint256 srcPayloadId);

decodeCoreStateRegistryPayloadLiqData

function decodeCoreStateRegistryPayloadLiqData(
    uint256 dstPayloadId_
) external view returns (
    uint8[] memory bridgeIds,
    bytes[] memory txDatas,
    address[] memory tokens,
    address[] memory interimTokens,
    uint64[] memory liqDstChainIds,
    uint256[] memory amountsIn,
    uint256[] memory nativeAmounts);

StateSyncerPayloads

decodePayloadHistory

Decodes basic transaction information for transactions that left SuperformRouter.

function decodePayloadHistory(
    uint256 srcPayloadId_,
) external view returns (
    uint8 txType,
    uint8 callbackType,
    uint8 isMulti,
    address srcSender,
    uint64 srcChainId);

TimeLockPayloads

decodeTimeLockPayload

This function decodes payloads where the timelock was successfully sent from source to destination.

function decodeTimeLockPayload(
    uint256 timelockPayloadId_
) external view returns (
    address srcSender,
    uint64 srcChainId,
    uint256 srcPayloadId,
    uint256 superformId,
    uint256 amount);

decodeTimeLockFailedPayload

This function decodes payloads where the timelock failed and was messaged back to the source chain.

function decodeTimeLockFailedPayload(
    uint256 timelockPayloadId_
    ) external view returns (
        address srcSender,
        uint64 srcChainId,
        uint256 srcPayloadId,
        uint256 superformId,
        uint256 amount);

Last updated