Cross-chain Withdrawal
Last updated
Last updated
User selects vaults to withdraw from, a target token, and the amount to withdraw from each vault
User requests routes from the Superform API
User selects a route
User approves the SuperPosition contract to burn selected SuperPositions (if needed)
Atomic phase
User calls singleXChainSingleVaultWithdraw
. The function burns the user designated amount of SuperPositions. The function parameters are complex; therefore, using the Superform API to generate valid function parameters is encouraged
SuperformRouter generates a payload and proof that contains singleVaultSFData
and calls dispatchPayload
to send them via the AMBs specified in the route. This payload contains the desired bridge/swap route and end states (chain, vault, amounts, slippage). Sending liqRequest.txData
on withdrawals is optional; if provided, it will reduce reliance on Superform Keepers, but increase the likelihood of the transaction failing requiring SuperPositions to be re-minted
SuperformRouter sends the cross-chain payment to the PayMaster contract on the source chain
Transit phase (non-atomic)
In no particular order
Payload is received by CoreStateRegistry on destination
Payload proof is received by CoreStateRegistry on destination
updateWithdrawPayload
is called by the updater Keeper to provide the CoreStateRegistry with the txData
if it wasn't provided in the payload based on the user intent
Atomic phase
Processor Keeper calls processPayload
to trigger the redemption of vault shares from the target vault for the underlying tokens
Underlying tokens may be swapped at this point into the target token if the target token is not the underlying token
If the target token is on another chain, the tokens will be bridged to the target chain, otherwise the tokens will be sent to the user’s address on the vault chain
Transit phase
If the target chain was different than the vault chain, tokens will be received by the user directly from the bridge contract after bridging completes