build_hypercore_deposit_phase1

Documentation for eth_defi.hyperliquid.core_writer.build_hypercore_deposit_phase1 function.

build_hypercore_deposit_phase1(lagoon_vault, evm_usdc_amount)

Build phase 1 of a two-phase Hypercore deposit: bridge USDC to HyperCore spot.

This multicall performs:

  1. approve(CoreDepositWallet, amount) – approve USDC transfer

  2. CoreDepositWallet.deposit(amount, SPOT_DEX) – bridge USDC to HyperCore spot

After this transaction lands, the USDC enters EVM escrow. Use wait_for_evm_escrow_clear() to wait for the funds to arrive in the spot account, then call build_hypercore_deposit_phase2() for the remaining steps.

Example:

from eth_defi.hyperliquid.core_writer import (
    build_hypercore_deposit_phase1,
    build_hypercore_deposit_phase2,
)
from eth_defi.hyperliquid.evm_escrow import wait_for_evm_escrow_clear

# Phase 1: bridge USDC to HyperCore
fn1 = build_hypercore_deposit_phase1(lagoon_vault, evm_usdc_amount=1_000_000)
tx_hash = fn1.transact({"from": asset_manager})

# Wait for escrow to clear
wait_for_evm_escrow_clear(session, user=safe_address)

# Phase 2: move to perp and deposit into vault
fn2 = build_hypercore_deposit_phase2(
    lagoon_vault,
    hypercore_usdc_amount=1_000_000,
    vault_address="0x...",
)
tx_hash = fn2.transact({"from": asset_manager})
Parameters
  • lagoon_vault (LagoonVault) – Lagoon vault instance with trading_strategy_module_address configured.

  • evm_usdc_amount (int) – USDC amount in EVM wei (uint256) for approve and CDW deposit.

Returns

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

Return type

ContractFunction