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
setXChainRebalanceCallData
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
Parameter
Description
receiverAddressSP_
The address of the receiver for the rebalance.
routerPlusPayloadId_
The unique identifier of the router plus payload for the rebalance.
data_
The data struct containing necessary information for the rebalance.
completeCrossChainRebalance
completeCrossChainRebalance
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
Parameter
Description
receiverAddressSP
The address of the receiver for the rebalanced position.
routerPlusPayloadId
The unique identifier for the router plus payload.
amountReceivedInterimAsset
The amount of interim asset received during the rebalance.
newAmounts
An array representing the new amounts of the rebalanced positions.
newOutputAmounts
An array representing the new expected output amounts from the rebalance.
liqRequests
An array of liquidation requests associated with the rebalance.
Return
Returns
rebalanceSuccessful
, a boolean that indicates whether the rebalance was successful.
disputeRefund
disputeRefund
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
Parameter
Description
finalPayloadId_
The unique identifier of the refund being disputed.
proposeRefund
proposeRefund
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
Parameter
Description
finalPayloadId_
The unique identifier of the refund.
refundAmount_
The newly proposed refund amount.
finalizeRefund
finalizeRefund
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
Parameter
Description
finalPayloadId_
The unique identifier of the refund.
Last updated