Skip to content

Conversation

@timbrinded
Copy link
Collaborator

@timbrinded timbrinded commented Sep 26, 2025

Adds cross-chain token operations between HyperEVM and HyperCore.

Key Changes

Core Functionality

  • Deposit tokens from HyperEVM to HyperCore with automatic bridging
  • Withdraw tokens from HyperCore back to HyperEVM with validation
  • Token metadata resolution for proper decimal handling across chains

Refactoring

  • Simplified client architecture reducing core/client.py by 30% (263 lines)
  • Reorganized utilities into modular structure (utils/init.py, utils/core.py, utils/evm.py)
  • Extracted token metadata handling into dedicated module with caching

Infrastructure

  • Environment configuration for deposit/withdraw addresses
  • Example script demonstrating roundtrip token flow
  • Improved connection management with cleaner separation of concerns

Technical Details

The implementation handles token decimal differences between chains automatically, validates payload signatures, and provides proper error handling for failed transactions. The refactoring improves maintainability by consolidating duplicate logic and establishing clear module boundaries.

Testing

Run example/09_evm_core_deposit_withdraw.py to verify the full deposit/withdraw cycle.

@timbrinded timbrinded marked this pull request as ready for review September 26, 2025 13:02
@timbrinded timbrinded merged commit f9a4018 into main Sep 26, 2025
9 checks passed
Copy link

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting

Comment on lines +520 to +521
amount_wei = to_uint64(amount, token_decimals)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[P1] Avoid uint64 conversion for ERC‑20 deposit/withdraw amounts

Both deposit_token_to_core and withdraw_token_to_evm pass token amounts through to_uint64(...), which enforces a 64‑bit cap (2**64-1). The Hyperliquid strategy methods accept uint256 values, so this conversion rejects perfectly valid transfers for common 18‑decimal tokens (e.g. depositing 100 ETH throws Value exceeds uint64 maximum before the transaction is constructed). This artificially limits token transfers and will fail for larger balances; the amounts should be encoded without truncating to 64‑bit.

Useful? React with 👍 / 👎.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants