Function prepareDepositWithLiquiditySwaps

  • Parameters

    • userDeposits: bigint[][]

      The deposits of the user. If gas is wrapped, continue to set here.

    • chains: {
          chainId: number;
          channelId: string;
      }[]

      The chains that the user is depositing to. Is a list of objects with channelId. Is specific to AMBs. ChainId is the id in gasMap.

    • vaults: VaultInformation[]

      The vaults that the user is depositing to. Between volatile and amplified there is a lot of unused variables. So while all arguments aren't used by both, they are used by either.

    • vaultAddresses: string[]

      The addresses of the vaults that the user is depositing to.

    • assetsAddresses: string[][]

      The addresses of the assets within the vaults. Needs to be complete.

    • userAddresses: string[]

      The addresses of the users on the other chains.

    • messageVerifyGasCosts: bigint[]

      The cost to verify a message by the underlying messaging protocol on the various chains. Can be found by calling the CCI on estimateAdditionalCost.

    • priceOfDeliveryGas: bigint[][]

      What is the incentive for gas on the destination chain? Is indexed by from, to (in source chain wei).

    • priceOfAckGas: bigint[]

      What is the ack incentive for gas on the source chain? Is indexed by from chain. (in source chain wei).

    • refundGasTo: string

      Where should unspent gas go? (which is released on acks).

    • slippage: bigint = ...

      What is the slippage for the deposit? (in WAD percentage). Default 1%.

    • wrapGasValues: bigint[] = []

      If gas is to be wrapped, provided here. If only wrapping on chain 2, then set [undefined, Xn].

    Returns {
        gasUsage: {
            estimatedGasUsedOnLocalAck: bigint;
            estimatedGasUsedOnRemote: bigint;
            estimatedRoutingPayment: bigint;
        };
        routerArgs: RouterArguments;
        transferDetails: {
            amount: bigint;
            token: string;
        }[];
    }[]

    Returns a sequence of objects, each encapsulating the router arguments configured for a specific chain, alongside the corresponding estimates of gas consumption. The sequence follows with the chain order specified in the input.

    Notice

    Prepares the router arguments for a deposit along with liquidity swaps to balance the deposit over the whole pool. After calling this method, you should call transferWithPermitForDepositWithLiquiditySwaps on the returned router arguments object to add the transfer instructions to the router.

    Dev

    All lists should be equal length.