{"id":20650962,"url":"https://github.com/niklr/uniswap-v2-subgraph","last_synced_at":"2026-04-20T12:03:50.743Z","repository":{"id":84678155,"uuid":"418214299","full_name":"niklr/uniswap-v2-subgraph","owner":"niklr","description":null,"archived":false,"fork":false,"pushed_at":"2021-10-17T18:04:53.000Z","size":57,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-01-17T10:25:03.560Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/niklr.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-10-17T18:02:20.000Z","updated_at":"2021-10-18T17:47:33.000Z","dependencies_parsed_at":null,"dependency_job_id":"2fba684b-1abc-4537-bd3f-c1c96fb6f20a","html_url":"https://github.com/niklr/uniswap-v2-subgraph","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/niklr%2Funiswap-v2-subgraph","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/niklr%2Funiswap-v2-subgraph/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/niklr%2Funiswap-v2-subgraph/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/niklr%2Funiswap-v2-subgraph/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/niklr","download_url":"https://codeload.github.com/niklr/uniswap-v2-subgraph/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":242750783,"owners_count":20179256,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-16T17:24:42.726Z","updated_at":"2026-04-20T12:03:50.713Z","avatar_url":"https://github.com/niklr.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# optify-uniswap-v2-subgraph\n\n```\nnpm install -g @graphprotocol/graph-cli\ngraph init --product hosted-service --from-contract 0x5C69bEe701ef814a2B6a3EDD4B1652CB9cc5aA6f\ngraph auth --product hosted-service \u003cACCESS_TOKEN\u003e\n```\n\nhttps://docs.uniswap.org/protocol/V2/reference/API/entities\n\nhttps://docs.uniswap.org/protocol/V2/concepts/advanced-topics/fees\n\nThere is a 0.3% fee for swapping tokens. \n\n* timestamp\n* blocknumber\n* event type: 'mint', 'burn', 'swap'\n* reserve0_before\n* reserve0_after\n* reserve1_before\n* reserve1_after\n* swap0_in\n* swap0_out\n* swap1_in\n* swap1_out\n* swap_fee_token\n* swap_fee_pct (percentage)\n* deposit0\n* deposit1\n* withdraw0\n* withdraw1\n\n```\n{\n  events(first: 5, orderBy: blocknumber, where: { type: Burn}) {\n    id\n    pair {\n      token0 {\n        symbol\n      }\n      token1 {\n        symbol\n      }\n    }\n    timestamp\n    blocknumber\n    type\n    reserve0_before\n    reserve0_after\n    reserve1_before\n    reserve1_after\n    deposit0\n    deposit1\n    withdraw0\n    withdraw1\n  }\n}\n```\n\nhttps://thegraph.com/hosted-service/subgraph/uniswap/uniswap-v2\n\n```\n{\n  swaps(first: 5) {\n    id\n    amount0In\n    amount1In\n    amount0Out\n    amount1Out\n    pair {\n      token0Price\n      token1Price\n      token0 {\n        symbol\n      }\n      token1 {\n        symbol\n      }\n    }\n  }\n}\n```\n\n```\n{\n  \"data\": {\n    \"swaps\": [\n      {\n        \"amount0In\": \"117816\",\n        \"amount0Out\": \"0\",\n        \"amount1In\": \"0\",\n        \"amount1Out\": \"0.250201023684112805\",\n        \"id\": \"0x0000000605df365a8aac7506d995391b760f238366f1526f158912629d855051-0\",\n        \"pair\": {\n          \"token0\": {\n            \"symbol\": \"LGCY\"\n          },\n          \"token0Price\": \"413079.4849089631537531962388866835\",\n          \"token1\": {\n            \"symbol\": \"WETH\"\n          },\n          \"token1Price\": \"0.00000242084159715747148340782786737139\"\n        }\n      },\n      {\n        \"amount0In\": \"0.015\",\n        \"amount0Out\": \"0\",\n        \"amount1In\": \"0\",\n        \"amount1Out\": \"0.516678550006609427\",\n        \"id\": \"0x0000014be80cf0233ac4fefc02bd9dee376e197ca98ed4af6e6f9fe2cd5b428c-0\",\n        \"pair\": {\n          \"token0\": {\n            \"symbol\": \"WBTC\"\n          },\n          \"token0Price\": \"0.06477960185832108560795229350158764\",\n          \"token1\": {\n            \"symbol\": \"WETH\"\n          },\n          \"token1Price\": \"15.4369581058415805943228273516469\"\n        }\n      },\n      {\n        \"amount0In\": \"200000\",\n        \"amount0Out\": \"0\",\n        \"amount1In\": \"0\",\n        \"amount1Out\": \"7.05076765470194897\",\n        \"id\": \"0x0000022f3ec65cec795729c4e16d7f07581e02d1a6fc31ee39e59e36ad86c4b7-0\",\n        \"pair\": {\n          \"token0\": {\n            \"symbol\": \"GLQ\"\n          },\n          \"token0Price\": \"135183.5652183252163293812823080029\",\n          \"token1\": {\n            \"symbol\": \"WETH\"\n          },\n          \"token1Price\": \"0.000007397348918745945167601378167701192\"\n        }\n      },\n      {\n        \"amount0In\": \"0\",\n        \"amount0Out\": \"340\",\n        \"amount1In\": \"0.548916142051273397\",\n        \"amount1Out\": \"0\",\n        \"id\": \"0x000002c42681f10a0e971f5ff4f4f427d00777d2258eb750b8dad4c15971a029-0\",\n        \"pair\": {\n          \"token0\": {\n            \"symbol\": \"CTASK\"\n          },\n          \"token0Price\": \"5697.958519744493758909033911106692\",\n          \"token1\": {\n            \"symbol\": \"WETH\"\n          },\n          \"token1Price\": \"0.0001755014531142711296170035721088685\"\n        }\n      },\n      {\n        \"amount0In\": \"795.0004128\",\n        \"amount0Out\": \"0\",\n        \"amount1In\": \"0\",\n        \"amount1Out\": \"3.133334806402845094\",\n        \"id\": \"0x000003cd4d06ca0f2695fe4d3d69768bcbcdffc943e2efa2ce69a8a7d349cc6b-0\",\n        \"pair\": {\n          \"token0\": {\n            \"symbol\": \"DEGO\"\n          },\n          \"token0Price\": \"445.6726795141194458548309391079507\",\n          \"token1\": {\n            \"symbol\": \"WETH\"\n          },\n          \"token1Price\": \"0.002243799196060701761598800742457151\"\n        }\n      }\n    ]\n  }\n}\n```","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fniklr%2Funiswap-v2-subgraph","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fniklr%2Funiswap-v2-subgraph","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fniklr%2Funiswap-v2-subgraph/lists"}