SuperformRouterPlusAsync

Overview

The SuperformRouterPlusAsync contract is an extension of the SuperformRouterPlus and handles the completion of cross-chain rebalancing. It takes over the funds received from the rebalance step of the startCrossChainRebalance functions (initiated in SuperformRouterPlus) and completes the rebalancing process in the destination chain.

Additionally, it provides fund recovery mechanisms in cases where the interim tokens received from the cross-chain process are incorrect. The contract ensures the accuracy of rebalanced amounts and facilitates refund mechanisms to handle discrepancies in cross-chain transactions.

Key Features

  • Completes the rebalancing process for positions that have been moved cross-chain.

  • Recovers funds in case of errors or slippage during the cross-chain process.

  • Provides refund mechanisms and dispute resolution for incorrect or malicious transactions.


Functions

setXChainRebalanceCallData

function setXChainRebalanceCallData(
    address receiverAddressSP_, 
    uint256 routerPlusPayloadId_, 
    XChainRebalanceData memory data_
) 
    external;

Description

This function sets the calldata for the cross-chain rebalance step. It is callable only by the designated router plus contract, and it sets up the data necessary for completing the rebalance on the destination chain.

Parameters


completeCrossChainRebalance

function completeCrossChainRebalance(
    CompleteCrossChainRebalanceArgs memory args_
) 
    external 
    payable 
    returns (bool rebalanceSuccessful);

Description

This function completes the rebalance process for positions across different chains. It finalizes the transaction by ensuring that the proper amounts have been transferred, and slippage is within acceptable limits.

Parameters

Return

  • Returns rebalanceSuccessful, a boolean that indicates whether the rebalance was successful.


disputeRefund

function disputeRefund(
    uint256 finalPayloadId_
) 
    external;

Description

This function allows a user (receiver or disputer) to protect themselves in case of malicious processors during a refund process. It initiates a dispute over the refund and halts any further actions until the dispute is resolved.

Parameters


proposeRefund

function proposeRefund(
    uint256 finalPayloadId_, 
    uint256 refundAmount_
) 
    external;

Description

This function allows a rescuer to propose a new refund amount after a successful dispute. It is intended to correct the refund amount after an error or fraudulent activity has been identified.

Parameters


finalizeRefund

function finalizeRefund(
    uint256 finalPayloadId_
) 
    external;

Description

This function allows a user to claim their refund after the dispute phase has ended and no further disputes are expected. It finalizes the refund and transfers the correct amount to the user.

Parameters


Last updated