Description

Building a subgraph based on the The Graph Protocol to index bridged transactions on the Polygon blockchain of Synapse Protocol. It serves as a way to for any clients to fetch their bridged transactions without spending too much resources combing through blockchain data. This is interesting to work on due to the complexity of cross chain bridges but the lack of tools out there to index transactions flowing from one chain to another.

syn-polygon-subgraph showcase

How it's made

Motivation: - Cross chain bridges getting popular ○ Exploits happening ○ Tech is complex - User myself but havent dug into it. Am curious how data flow can be easily tracked and presented to users - Synapse protocol is open source and community is friendly - Analytics page is using a centralized solution ○ https://github.com/BlazeWasHere/SYN-Tracker-API/tree/main/syn/patches § Fetch data looks through every block for bridge events (eth_getLogs) and then parsed the info into a db which is then put into union with off chains info □ https://discord.com/channels/887411327696511027/887412328532951050/939052208786399303 ○ Team was using the graph but resyncs take a lot of time - Wanted to experiment using subgraphs to track cross chain activities Limitations - For multichains, need subgraph for each chain. Perhaps future subgraph supports cross chain indexing - Can deploy similar subgraph for each chain, have a backend service that aggregates data from multiple chains and serve it as an api ○ Still involve centralized solutions but a step towards relying on more decentralized solutions - Lack of callHandlers and block handlers in Polygon sidechain ○ https://discord.com/channels/438038660412342282/438070183794573313/939171354077446155 Future improvements: - Calculate price ○ Stableswap algorithm ○ Meta pools - Add more token support as more of them get whitelisted for bridging and swapping - Swap, liquidity events as well - Day data, hour data, week data OR Time travel queries - Matchstick for unit tests Have to log in code, deploy and debug through the interface