build_hypercore_deposit_phase2

Documentation for eth_defi.hyperliquid.core_writer.build_hypercore_deposit_phase2 function.

build_hypercore_deposit_phase2(lagoon_vault, hypercore_usdc_amount, vault_address)

Build phase 2 of a two-phase Hypercore deposit: spot to perp to vault.

Batches two CoreWriter actions into a single multicall:

  1. transferUsdClass — move USDC from spot to perp

  2. vaultTransfer — deposit USDC from perp into vault

When the EVM block finishes execution, HyperCore processes all queued CoreWriter actions from that block sequentially, so the transferUsdClass completes before the vaultTransfer runs.

Must only be called after phase 1 USDC has cleared the EVM escrow and is available in the user’s HyperCore spot account. Use wait_for_evm_escrow_clear() between phase 1 and phase 2.

Parameters
  • lagoon_vault (LagoonVault) – Lagoon vault instance with trading_strategy_module_address configured.

  • hypercore_usdc_amount (int) – USDC amount in HyperCore wei (uint64) for both CoreWriter actions.

  • vault_address (HexAddress | str) – Hypercore native vault address (not the Lagoon vault address).

Returns

Bound module.functions.multicall(data) ready to .transact().

Return type

ContractFunction