Bridge
Last updated
Last updated
Kitchen Layer Official testnet bridge:
General guidance on how to bridge HYPE tokens from HyperEVM testnet to Kitchen Layer using the Optimism contract. This process is based on the mechanics of a sample Solidity script using Foundry but focuses on the general steps rather than requiring users to run a specific script.
Bridging HYPE to the Kitchen Layer involves depositing HYPE into the Optimism contract on HyperEVM testnet, which facilitates the transfer to a specified address on the Kitchen Layer network. The Optimism Portal contract handles the communication between L1 and L2, ensuring funds are available on L2 after a finalization period.
Before bridging, ensure you have:
HyperEvm testnet Wallet: A wallet (e.g., Rabby) containing sufficient HYPE tokens for the transfer and gas fees.
L2 Receiver Address: The address on the Kitchen Layer network where you want to receive the HYPE tokens. This could be your own wallet or another valid L2 address.
Optimism Portal Contract Address: 0xA0Cc14aa7c10cDdc6521579A282ab010C0167D96
Forge Installed: If using Foundry, install it by following the instructions at .
Network Configuration: A HyperEVM testnet RPC endpoint (e.g., https://rpc.hyperliquid-testnet.xyz/evm
) configured in your environment.
Sufficient Gas: Enough HYPE in your L1 wallet to cover L1 transaction gas fees on the HyperEVM testnet.
Locate the Optimism Portal contract address on HyperEVM testnet that facilitates transfers to the Kitchen Layer. This contract, deployed on HyperEVM testnet, will manage the L1-to-L2 bridging process.
To bridge HYPE, you will typically call the depositTransaction
function on the Optimism Portal contract. The function requires:
_to
: The L2 address on Kitchen Layer that will receive the HYPE tokens (e.g., your L2 EOA).
_value
: The amount of HYPE to bridge, specified in wei (e.g., 0.5 HYPE = 500000000000000000
wei, assuming HYPE uses 18 decimals).
_gasLimit
: The gas limit for the L2 transaction. A value of 1,000,000 is typically sufficient for simple token transfers, but complex operations may require more.
_isCreation
: Set to false
for HYPE transfers (set to true
only if deploying a contract on L2).
_data
: Additional data for the L2 transaction. For a simple HYPE transfer, use an empty bytes string (0x
or bytes("")
) unless Kitchen Layer requires specific data for token bridging.
Example:
_to
: 0xYourKitchenLayerAddress
_value
: 0.5 HYPE (500000000000000000
wei)
_gasLimit
: 1,000,000
_isCreation
: false
_data
: 0x
Note: Since HYPE is the native token on HyperEVM testnet, explicit approval for the Optimism Portal contract to spend HYPE tokens is generally not required for native token transfers.
You can interact with the Optimism Portal contract in several ways. Below is an example using a Foundry script, as well as other methods.
The following is an example of how to structure a Foundry script to bridge HYPE:
Steps to Run:
Save the script as BridgeHypeScript.s.sol
in your Foundry project’s script
directory.
Configure your .env
file with your L1 private key and HyperEVM testnet RPC URL:
Extrait de code
ETH_RPC_URL=https://rpc.hyperliquid-testnet.xyz/evm PRIVATE_KEY=your-private-key-here
Load environment variables:
source .env
Compile the script:
forge build
Run the script:
forge script script/BridgeHypeScript.s.sol --rpc-url $ETH_RPC_URL --private-key $PRIVATE_KEY --broadcast
Note the transaction hash and monitor it on a HyperEVM testnet block explorer.
Note the L1 transaction hash after submission on HyperEVM testnet.
Use a HyperEVM testnet block explorer to track the L1 transaction status.
Bridging to Kitchen Layer will involve a finalization delay, typically a few minutes.
After finalization, check the L2 receiver address balance using Kitchen Layer’s block explorer (if available).
Confirm that the bridged HYPE (e.g., 0.5 HYPE) is available at the specified L2 address.
Insufficient Funds: Ensure your L1 wallet on HyperEVM testnet has enough HYPE for the bridged amount and for L1 gas fees.
Incorrect Receiver Address: Verify the L2 receiver address is correct and accessible on Kitchen Layer. Sending to an incorrect address may result in loss of funds.
Gas Limit Issues: If the L2 transaction fails, increase the _gasLimit
(e.g., to 2,000,000) and retry.
Transaction Reverts: Check the L1 transaction receipt on the HyperEVM testnet explorer for revert reasons. Ensure the Optimism Portal address is correct for Kitchen Layer.
Delayed L2 Balance: Allow time for Kitchen Layer’s finalization period. If funds don’t appear, check the L2 explorer or contact Kitchen Layer support.
Adjusting the Amount: Bridge any amount of HYPE by specifying the desired _value
in wei. Ensure your L1 wallet has sufficient HYPE.