Cross-chain Withdrawal

Phase 0: Route Generation and Selection

  1. User selects vaults to withdraw from, a target token, and the amount to withdraw from each vault

  2. User requests routes from the Superform API

  3. User selects a route

  4. User approves the SuperPosition contract to burn selected SuperPositions (if needed)

Phase 1A: Burning SuperPositions and Sending Data

Atomic phase

  1. 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

  2. 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

  3. SuperformRouter sends the cross-chain payment to the PayMaster contract on the source chain

Phase 1B: Receiving Data

Transit phase (not-atomic)

  1. In no particular order

    1. Payload is received by CoreStateRegistry on destination

    2. Payload proof is received by CoreStateRegistry on destination

  2. updateWithdrawPayload is called by the updated keeper to provide the CoreStateRegistry with the txData if it wasn't provided in the payload based on the user intent

Phase 2A: Withdrawing Tokens and Sending Them to the User

Atomic phase

  1. Processor keeper calls processPayload to trigger the redemption of vault shares from the target vault for the underlying tokens

  2. Underlying tokens may be swapped at this point into the target token if the target token is not the underlying token

  3. 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

Phase 2B: Receiving tokens on the target chain

Transit phase

  1. 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

Last updated