Across

Across is a bridge protocol, so the parser focuses on identifying BRIDGE_OUT and BRIDGE_IN actions from its on-chain events.


🧩 Files Involved in the Across Parser

src/lib/Across/
β”œβ”€β”€ abis/SpokePool.json   ← Only needed ABI fragments
β”œβ”€β”€ contracts.ts          ← Address + event signature map
β”œβ”€β”€ parser.ts             ← Logic to build actions from tx logs
└── index.ts              ← Parser class exposed to the framework

1.β€―contracts.ts β€” Contract Definitions & Event Signatures

This file defines which contracts Across uses on each chain, and how to identify the logs they emit.

export enum ACROSS_CONTRACTS {
  SPOKE_POOL = "SPOKE_POOL"
}

export const acrossContracts: IProtocolContractDefinitions = {
  [CHAIN_ID.ETHEREUM]: {
    [ACROSS_CONTRACTS.SPOKE_POOL]: {
      address: "0x...",  // SpokePool address on Ethereum
      listener: LISTEN_FOR_TRANSACTIONS.TO,
      abi: SpokePoolABI,
      events: {
        FilledRelay: "FilledRelay(address,address,address,uint256,uint256,uint256,bool,bytes32)",
        Deposited: "Deposited(address,address,address,uint256,uint256,uint256,bytes32)"
      }
    }
  },
  ...
};

Here we:

  • Define what contract to listen to (e.g. SpokePool)

  • Where to listen (to or from in tx)

  • Which events (logs) we care about


2.β€―parser.ts β€” Parsing the Logs into Actions

🧠 Note:

  • It loops through logs, uses a helper to parse each log via ABI

  • Builds high-level ITransactionAction objects

  • Each action gets: action, chainId, tokens, user, amount, timestamp


3.β€―index.ts β€” The Parser Class

This is the entry point used by the global parser map. It:

  1. Uses ProtocolHelper to check if the tx is related to Across

  2. If yes, passes it to parseAcrossTx

  3. Returns any ITransactionActions it detects


Recap: How Across Parser Works

Stage
What Happens

Contract Setup

Define SpokePool addresses and events in contracts.ts

Parsing Logic

Loop through logs and map to BRIDGE_IN / BRIDGE_OUT

Runtime Class

Implements IProtocolParserExport to plug into SDK

Output

Returns typed ITransactionAction[] used for OpenRep scoring

Last updated