Try   HackMD

SushiXSwap Scenario Doc

SushiXSwap - Cross Chain Swap

Sushi-X-Swap enables cross chain swaps on Sushiswap on the supported networks. It supports all combinations of wallet, bentobox, trident and legacy AMM. It supports Stargate bridge as of now.

Scenarios

We assume that the tokens and bentobox approvals are already done. If not, add that at the start of the action.

  1. Asset Transfer - Stargate Supported Assets - USDC, USDT, STG

    1. BentoBox - Stargate - BentoBox
      In this case, use ACTION_SRC_TRANSFER_FROM_BENTOBOX and unwrap the tokens to this contract address. After this add action STARGATE_TELEPORT. On the dst chain, use ACTION_DST_DEPOSIT_TO_BENTOBOX, which deposits it to the bentobox.
    2. Wallet - Stargate - Wallet
      In this case, use ACTION_SRC_DEPOSIT_TO_BENTOBOX and deposit to the address of msg.sender. After this add action ACTION_SRC_TRANSFER_FROM_BENTOBOX and unwrap the tokens to this contract address. After this add action STARGATE_TELEPORT. On dst chain, use ACTION_DST_WITHDRAW_TOKEN to withdraw it to user wallet.
    3. Wallet - Stargate - BentoBox
      In this case, use ACTION_SRC_DEPOSIT_TO_BENTOBOX and deposit to the address of msg.sender. After this add action ACTION_SRC_TRANSFER_FROM_BENTOBOX and unwrap the tokens to this contract address. After this add action STARGATE_TELEPORT. On the dst chain, use ACTION_DST_DEPOSIT_TO_BENTOBOX, which deposits it to the bentobox.
    4. BentoBox - Stargate - Wallet
      In this case, use ACTION_SRC_TRANSFER_FROM_BENTOBOX and unwrap the tokens to this contract address. After this add action STARGATE_TELEPORT. On dst chain, use ACTION_DST_WITHDRAW_TOKEN to withdraw it to user wallet.
  2. Asset Transfer / Swaps - ERC20s and Native Token

    1. BentoBox - Swap - Stargate - Swap - BentoBox
      In this case, use ACTION_SRC_TRANSFER_FROM_BENTOBOX and unwrap the tokens to the first pool of the swap, if it's legacy swap. If it's trident, transfer it to the first pool of the swap path. After this add action ACTION_LEGACY_SWAP or ACTION_TRIDENT_SWAP. If you have already deposited the tokens to the pool address, make sure to pass the correct amountIn. You can pass amountIn as 0 as well, however, in that case, it would automatically do the transfer, no need to deposit to the pool contract. In this case, make sure to withdraw tokens to this contract address. After this add action STARGATE_TELEPORT. On the dst chain, use ACTION_DST_DEPOSIT_TO_BENTOBOX for trident and deposit to the pool address of the swap path. In the case of legacy use ACTION_DST_WITHDRAW_TOKEN and transfer it to the first pool of the swap path or you can put amountIn as 0 for swap and it would automatically take the amounts from this contract, make sure to withdraw it.
    2. Wallet - Swap - Stargate - Swap - Wallet
    3. Wallet - Swap - Stargate - Swap - BentoBox
    4. BentoBox - Swap - Stargate - Swap - Wallet