Kitchen Layer Docs
  • 📌Welcome
  • Getting Started
    • Quickstart
    • Partners
    • Chain info
  • Bridge
  • 📔Cook Book
    • Native Functions
    • Yield Bearing Wallet
    • AI Block Explorer
    • dApps Interoperability
    • Kitchen Account
  • 🍳Native dApps
    • Kitchen swap
    • Kitchen fun
    • Kitchen explorer
    • Kitchen hub
  • 💻Developer Docs
    • Foundry Kitchen
    • Use your first Precompiles
Powered by GitBook
On this page
  • Overview
  • Prerequisites
  • Steps to Bridge HYPE to Kitchen Layer (L2)
  • Troubleshooting
  • Additional Notes

Bridge

PreviousChain infoNextNative Functions

Last updated 4 days ago

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.

Overview

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.

Prerequisites

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.

Steps to Bridge HYPE to Kitchen Layer (L2)

1. Identify the Optimism Portal Contract

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.

2. Prepare the Transaction Parameters

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.

3. Interact with the Optimism Portal Contract

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:

// SPDX-License-Identifier: MIT
pragma solidity 0.8.15;

// Bridge script for Bridging ETH to L2
// OptimismPortal address : 0xA0Cc14aa7c10cDdc6521579A282ab010C0167D96
// function depositTransaction(address _to, uint256 _value, uint64 _gasLimit, bool _isCreation, bytes memory _data)

import { Script } from "forge-std/Script.sol";
import { OptimismPortal } from "../src/L1/OptimismPortal.sol";

contract BridgeScript is Script {
    address payable internal optimismPortal = payable(0xA0Cc14aa7c10cDdc6521579A282ab010C0167D96);
    // Your L2 EOA address where you want to receive the funds
    address payable constant L2_RECEIVER_EOA = payable(0x4290D1C146ccD774F1C2E21a2679480712e54e71);

    uint256 constant AMOUNT_TO_DEPOSIT = 0.5 ether;
    uint64 constant L2_GAS_LIMIT = 1000000; // Or more, if 1M is not sufficient

    function run() public {
        // Ensure vm.broadcast is called with the private key of the L1 sender
        // who has the 0.01 ETH to deposit.
        // For example, if 0x8e46Cc63f1DaE605D8B5fb74CC75458E217441c5 is also the L1 sender:

        vm.startBroadcast(); // Or vm.startBroadcast(yourPrivateKey);

        OptimismPortal(optimismPortal).depositTransaction{ value: AMOUNT_TO_DEPOSIT }(
            L2_RECEIVER_EOA, // _to: The FINAL recipient on L2
            AMOUNT_TO_DEPOSIT, // _value: The amount to make available on L2
            L2_GAS_LIMIT, // _gasLimit: Gas for the L2 transaction execution
            false, // _isCreation: This is not a contract deployment
            bytes("") // _data: No additional call data needed for an ETH transfer
        );
        vm.stopBroadcast();
    }
}

Steps to Run:

  1. Save the script as BridgeHypeScript.s.sol in your Foundry project’s script directory.

  2. 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

  3. Load environment variables:

    source .env

  4. Compile the script:

    forge build

  5. 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.

4. Monitor the Transaction

  1. Note the L1 transaction hash after submission on HyperEVM testnet.

  2. Use a HyperEVM testnet block explorer to track the L1 transaction status.

  3. Bridging to Kitchen Layer will involve a finalization delay, typically a few minutes.

5. Verify Funds on L2

  1. After finalization, check the L2 receiver address balance using Kitchen Layer’s block explorer (if available).

  2. Confirm that the bridged HYPE (e.g., 0.5 HYPE) is available at the specified L2 address.

Troubleshooting

  • 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.

Additional Notes

  • Adjusting the Amount: Bridge any amount of HYPE by specifying the desired _value in wei. Ensure your L1 wallet has sufficient HYPE.

https://bridge.kitchen-layer.com/
Foundry’s official documentation