build_hypercore_withdraw_multicall

Documentation for eth_defi.hyperliquid.core_writer.build_hypercore_withdraw_multicall function.

build_hypercore_withdraw_multicall(lagoon_vault, hypercore_usdc_amount, vault_address)

Build a single multicall transaction for the full Hypercore withdrawal flow.

Batches the 3-step withdrawal into one EVM transaction:

  1. CoreWriter.sendRawAction(vaultTransfer) — withdraw from vault

  2. CoreWriter.sendRawAction(transferUsdClass) — move USDC from perp to spot

  3. CoreWriter.sendRawAction(spotSend) — bridge USDC back to EVM Safe

When the EVM block finishes execution, all queued CoreWriter actions are processed sequentially on HyperCore (~47k gas per action).

Derives all contract instances internally from the LagoonVault:

  • module from LagoonVault.trading_strategy_module

  • core_writer at the system address CORE_WRITER_ADDRESS

  • safe_address from LagoonVault.safe_address

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

  • hypercore_usdc_amount (int) – USDC amount in HyperCore wei (uint64) for all 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