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 framework1.β―contracts.ts β Contract Definitions & Event Signatures
contracts.ts β Contract Definitions & Event SignaturesThis 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 (
toorfromin tx)Which events (logs) we care about
2.β―parser.ts β Parsing the Logs into Actions
parser.ts β Parsing the Logs into Actionsπ§ Note:
It loops through logs, uses a helper to parse each log via ABI
Builds high-level
ITransactionActionobjectsEach action gets:
action,chainId,tokens,user,amount,timestamp
3.β―index.ts β The Parser Class
index.ts β The Parser ClassThis is the entry point used by the global parser map. It:
Uses
ProtocolHelperto check if the tx is related to AcrossIf yes, passes it to
parseAcrossTxReturns any
ITransactionActions it detects
Recap: How Across Parser Works
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