This directory contains practical examples demonstrating how to use evm-lib to interact with HyperEVM and HyperCore. Each example showcases different aspects of the library's functionality.
The library provides two ways to bridge tokens:
- By Token Address: bridgeToCore(address tokenAddress, uint256 evmAmount)
- By Token ID: bridgeToCore(uint64 token, uint256 evmAmount)
The address version uses the TokenRegistry to resolve the token ID, removing the need for developers to store the token ID for each linked evm token address.
Tokens are represented using differing amounts of precision depending on where they're used:
- EVM
- Spot
- Perps
The library provides conversion functions to handle these differences.
The TokenRegistry eliminates the need to manually track token IDs by providing an onchain mapping from EVM contract addresses to HyperCore token indices. This is populated trustlessly using the precompiles