> ## Documentation Index
> Fetch the complete documentation index at: https://docs.goldsky.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Track Elysium bridge flows

> Stream every HYPE and token transfer between HyperEVM and Elysium into Postgres with a Turbo pipeline: the canonical bridge and native HYPE, in and out.

Every token transfer over Elysium's canonical bridge, and every HYPE transfer between HyperEVM and Elysium, leaves a record on Elysium. This guide builds a Turbo pipeline that writes each transfer to one Postgres table with its direction, route, token, sender, recipient and amount. Use it to measure how much value moves onto Elysium, which tokens move, and which wallets bridge.

## What you'll need

1. A Goldsky account and the CLI installed

> [accordion] Install Goldsky's CLI and log in
>
> 1. Install the Goldsky CLI:
>
>    **For macOS/Linux:**
>
>    ```shell theme={"dark"} theme={"dark"}
>    curl https://goldsky.com | sh
>    ```
>
>    **For Windows:**
>
>    ```shell theme={"dark"} theme={"dark"}
>    npm install -g @goldskycom/cli
>    ```
>
>    > [!NOTE]
>    >
>    > Windows users need to have Node.js and npm installed first. Download from [nodejs.org](https://nodejs.org) if not already installed.
> 2. Log into your Project by running:
>    ```shell theme={"dark"} theme={"dark"}
>    goldsky login
>    ```
>    This opens your browser to sign in (Google, GitHub, SSO, or email). Once you authenticate, the CLI is logged in automatically — there's no API key to copy or paste.
>    \[!NOTE] On a headless or remote machine (or in CI), create an API key on your [Project Settings](https://app.goldsky.com/dashboard/settings) page and pass it directly with `goldsky login --token <API_KEY>`. Use `goldsky login --no-browser` to print the login URL instead of opening a browser.
> 3. Now that you are logged in, run `goldsky` to get started:
>    ```shell theme={"dark"} theme={"dark"}
>    goldsky
>    ```

2. A Postgres database and a [Goldsky secret](https://docs.goldsky.com/platform/secrets.md#example-postgresql) for it. The examples call the secret `MY_POSTGRES`.
3. Basic familiarity with [Turbo pipelines](https://docs.goldsky.com/turbo-pipelines/introduction.md) and [decoding contract events](https://docs.goldsky.com/turbo-pipelines/guides/decoding-contract-events.md).

## Routes between HyperEVM and Elysium

Elysium is an Arbitrum Orbit chain that settles to HyperEVM. This guide covers two routes, and each one leaves a different record on Elysium:

| Route | What moves | Into Elysium | Out of Elysium |
| - | - | - | - |
| `canonical` | ERC-20 tokens issued on HyperEVM, such as USDC and WHYPE. Elysium mints a 1:1 representation. | `DepositFinalized` event on the standard gateway, or on the WHYPE gateway for WHYPE | `WithdrawalInitiated` event on the same gateway |
| `native` | HYPE, the gas token | A deposit transaction (type `0x64`) that credits the recipient | `L2ToL1Tx` event from the `ArbSys` precompile with a non-zero value |

Kinetiq's [token bridging docs](https://elysium.kinetiq.xyz/docs/token-bridging-on-elysium) describe each bridge from the user's side.

## Contract addresses

| Contract | Address on Elysium |
| - | - |
| Standard gateway | `0x5dc84e4cb0f9082246e92a5585c5395592b1af1f` |
| WHYPE gateway | `0xb916e67307ad52955d37b6c123cf1a79c10855b6` |
| `ArbSys` precompile | `0x0000000000000000000000000000000000000064` |

Two common tokens on the canonical route:

| Token | On Elysium | On HyperEVM (`hyperevm_token` in the output) |
| - | - | - |
| USDC | `0xb47c4c8f73f009cc0c0d3f92b388d13e293f0b65` | `0xb88339cb7199b77e23db6e890353e22632ba630f` |
| WHYPE | `0xba876237b0f021a6c6d852d6c26e107997cc5e81` | `0x5555555555555555555555555555555555555555` |

Kinetiq publishes the full list on its [contract addresses page](https://elysium.kinetiq.xyz/docs/contract-addresses), and warns that look-alike WHYPE and USDC tokens exist. Check a token's address before you count its flows.

## Pipeline YAML

The pipeline reads two curated Elysium datasets: `elysium_mainnet.raw_logs` for the gateway and `ArbSys` events, and `elysium_mainnet.receipt_transactions` for HYPE deposits. `start_at: earliest` loads every bridge transfer since the chain started, then keeps streaming new ones.

```yaml elysium-bridge-flows.yaml expandable theme={"dark"}
name: elysium-bridge-flows
resource_size: s

sources:
  elysium_logs:
    type: dataset
    dataset_name: elysium_mainnet.raw_logs
    version: 1.0.0
    start_at: earliest
  elysium_transactions:
    type: dataset
    dataset_name: elysium_mainnet.receipt_transactions
    version: 1.0.0
    start_at: earliest

transforms:
  # Token deposits and withdrawals on the canonical bridge gateways
  gateway_decoded:
    type: sql
    primary_key: id
    sql: |
      SELECT
        id,
        block_number,
        block_timestamp,
        transaction_hash,
        _gs_log_decode(
          '[{"anonymous":false,"inputs":[{"indexed":true,"name":"l1Token","type":"address"},{"indexed":true,"name":"_from","type":"address"},{"indexed":true,"name":"_to","type":"address"},{"indexed":false,"name":"_amount","type":"uint256"}],"name":"DepositFinalized","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"name":"l1Token","type":"address"},{"indexed":true,"name":"_from","type":"address"},{"indexed":true,"name":"_to","type":"address"},{"indexed":true,"name":"_l2ToL1Id","type":"uint256"},{"indexed":false,"name":"_exitNum","type":"uint256"},{"indexed":false,"name":"_amount","type":"uint256"}],"name":"WithdrawalInitiated","type":"event"}]',
          topics,
          data
        ) AS decoded
      FROM elysium_logs
      WHERE address IN (
          '0x5dc84e4cb0f9082246e92a5585c5395592b1af1f', -- standard gateway
          '0xb916e67307ad52955d37b6c123cf1a79c10855b6'  -- WHYPE gateway
        )
        AND SPLIT_INDEX(topics, ',', 0) IN (
          '0xc7f2e9c55c40a50fbc217dfc70cd39a222940dfa62145aa0ca49eb9535d4fcb2', -- DepositFinalized
          '0x3073a74ecb728d10be779fe19a74a1428e20468f5b4d167bf9c73d9067847d73'  -- WithdrawalInitiated
        )

  token_flows:
    type: sql
    primary_key: id
    sql: |
      SELECT
        id,
        block_number,
        block_timestamp,
        transaction_hash,
        CASE decoded.event_signature WHEN 'DepositFinalized' THEN 'in' ELSE 'out' END AS direction,
        'canonical' AS route,
        lower(decoded.event_params[1]) AS hyperevm_token,
        lower(decoded.event_params[2]) AS from_address,
        lower(decoded.event_params[3]) AS to_address,
        CAST(
          CASE decoded.event_signature
            WHEN 'DepositFinalized' THEN decoded.event_params[4]
            ELSE decoded.event_params[6]
          END AS DECIMAL(78, 0)
        ) AS amount
      FROM gateway_decoded
      WHERE decoded IS NOT NULL

  # HYPE withdrawals: ArbSys emits L2ToL1Tx for every message to HyperEVM.
  # Token withdrawals send a message with no value, so callvalue > 0 keeps only HYPE.
  arbsys_decoded:
    type: sql
    primary_key: id
    sql: |
      SELECT
        id,
        block_number,
        block_timestamp,
        transaction_hash,
        _gs_log_decode(
          '[{"anonymous":false,"inputs":[{"indexed":false,"name":"caller","type":"address"},{"indexed":true,"name":"destination","type":"address"},{"indexed":true,"name":"hash","type":"uint256"},{"indexed":true,"name":"position","type":"uint256"},{"indexed":false,"name":"arbBlockNum","type":"uint256"},{"indexed":false,"name":"ethBlockNum","type":"uint256"},{"indexed":false,"name":"timestamp","type":"uint256"},{"indexed":false,"name":"callvalue","type":"uint256"},{"indexed":false,"name":"data","type":"bytes"}],"name":"L2ToL1Tx","type":"event"}]',
          topics,
          data
        ) AS decoded
      FROM elysium_logs
      WHERE address = '0x0000000000000000000000000000000000000064'
        AND SPLIT_INDEX(topics, ',', 0) = '0x3e7aafa77dbf186b7fd488006beff893744caa3c4f6f299e8a709fa2087374fc'

  hype_out:
    type: sql
    primary_key: id
    sql: |
      SELECT
        id,
        block_number,
        block_timestamp,
        transaction_hash,
        'out' AS direction,
        'native' AS route,
        'HYPE' AS hyperevm_token,
        lower(decoded.event_params[1]) AS from_address,
        lower(decoded.event_params[2]) AS to_address,
        CAST(decoded.event_params[8] AS DECIMAL(78, 0)) AS amount
      FROM arbsys_decoded
      WHERE decoded IS NOT NULL
        AND CAST(decoded.event_params[8] AS DECIMAL(78, 0)) > 0

  # HYPE deposits arrive as ArbOS deposit transactions (type 0x64 = 100).
  # from_address is the sender's HyperEVM address with the Arbitrum alias offset added.
  hype_in:
    type: sql
    primary_key: id
    sql: |
      SELECT
        id,
        block_number,
        block_timestamp,
        hash AS transaction_hash,
        'in' AS direction,
        'native' AS route,
        'HYPE' AS hyperevm_token,
        from_address,
        to_address,
        CAST(value AS DECIMAL(78, 0)) AS amount
      FROM elysium_transactions
      WHERE transaction_type = 100

  bridge_flows:
    type: sql
    primary_key: id
    sql: |
      SELECT * FROM token_flows
      UNION ALL
      SELECT * FROM hype_out
      UNION ALL
      SELECT * FROM hype_in

sinks:
  flows_table:
    type: postgres
    from: bridge_flows
    schema: public
    table: elysium_bridge_flows
    secret_name: MY_POSTGRES
    primary_key: id
```

Deploy it:

```bash theme={"dark"}
goldsky turbo apply elysium-bridge-flows.yaml
```

## How the transforms work

### Token gateways

Both gateways use the standard Arbitrum token bridge events, so one ABI decodes them. `topics` is a comma-separated string, so `SPLIT_INDEX(topics, ',', 0)` extracts the event signature. [`_gs_log_decode`](https://docs.goldsky.com/turbo-pipelines/reference/sql-functions#evm_log_decode) returns parameters by position, and the two events put the amount in different positions: fourth in `DepositFinalized`, sixth in `WithdrawalInitiated`. The `CASE` in `token_flows` picks the right one.

The first parameter of both events is the token's address on HyperEVM, not on Elysium. Use the token table above to map the two.

### HYPE out

A HYPE withdrawal calls the `ArbSys` precompile at `0x…0064`, which emits `L2ToL1Tx`. Token withdrawals emit `L2ToL1Tx` too, but with a `callvalue` of 0, so the filter `callvalue > 0` keeps only HYPE. `caller` is the sender on Elysium and `destination` is the recipient on HyperEVM.

### HYPE in

A HYPE deposit doesn't emit an event. Elysium records it as a deposit transaction of type `0x64` (100) that sends the value to the recipient. Its `from_address` is the sender's HyperEVM address plus the Arbitrum [alias offset](https://docs.arbitrum.io/how-arbitrum-works/l1-to-l2-messaging#address-aliasing) `0x1111000000000000000000000000000000001111`. Subtract the offset in your database if you need the original sender.

## Query the flows

Net flow per route and token per day, in Postgres:

```sql theme={"dark"}
SELECT
  date_trunc('day', to_timestamp(block_timestamp)) AS day,
  route,
  hyperevm_token,
  SUM(CASE direction WHEN 'in' THEN amount ELSE -amount END) AS net_amount
FROM public.elysium_bridge_flows
GROUP BY 1, 2, 3
ORDER BY 1 DESC, 4 DESC;
```

Amounts are in each token's smallest unit. HYPE and WHYPE have 18 decimals and USDC has 6. Other tokens need their own `decimals()` value. To inspect a single row, open its `transaction_hash` in the [Elysium explorer](https://elysium.kinetiq.xyz/explorer).

## Notes

* **Withdrawals are recorded when they start.** An `out` row means the withdrawal began on Elysium. The funds reach HyperEVM later, when the withdrawal is executed there. This pipeline reads only Elysium, so it does not record that second step.

## Getting help

Can't find what you're looking for? Reach out to us at [support@goldsky.com](mailto:support@goldsky.com) for help.


## Related topics

- [Index Elysium bridge activity without code](https://docs.goldsky.com/chain-guides/elysium/no-code-subgraph.md)
- [Read Elysium over Edge RPC](https://docs.goldsky.com/chain-guides/elysium/edge-rpc.md)
- [Stream Elysium wallet activity](https://docs.goldsky.com/chain-guides/elysium/wallet-activity.md)
- [Elysium](https://docs.goldsky.com/chains/elysium.md)
- [Flow](https://docs.goldsky.com/chains/flow.md)
