Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ Make sure to update package.json settings to point to your own graph account.

## Queries

Below are a few ways to show how to query the uniswap-subgraph for data. The queries show most of the information that is queryable, but there are many other filtering options that can be used, just check out the [querying api](https://thegraph.com/docs/graphql-api). These queries can be used locally or in The Graph Explorer playground.
Below are a few ways to show how to query the uniswap-subgraph for data. The queries show most of the information that is queryable, but there are many other filtering options that can be used, just check out the [querying api](https://thegraph.com/docs/en/subgraphs/querying/graphql-api/). These queries can be used locally or in The Graph Explorer playground.

## Key Entity Overviews

Expand Down
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@
"watch-local": "graph deploy graphprotocol/Uniswap2 --watch --debug --node http://127.0.0.1:8020/ --ipfs http://localhost:5001"
},
"devDependencies": {
"@graphprotocol/graph-cli": "^0.64.1",
"@graphprotocol/graph-ts": "^0.32.0",
"@graphprotocol/graph-cli": "^0.96.0",
"@graphprotocol/graph-ts": "^0.35.1",
"@typescript-eslint/eslint-plugin": "^2.0.0",
"@typescript-eslint/parser": "^2.0.0",
"@uniswap/eslint-config": "^1.2.0",
Expand All @@ -27,4 +27,4 @@
"prettier": "^1.18.2",
"typescript": "^3.5.2"
}
}
}
41 changes: 20 additions & 21 deletions schema.graphql
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
type UniswapFactory @entity {
# factory address
id: ID!
id: Bytes!

# pair info
pairCount: Int!
Expand All @@ -22,7 +22,7 @@ type UniswapFactory @entity {

type Token @entity {
# token address
id: ID!
id: Bytes!

# mirrored from the smart contract
symbol: String!
Expand Down Expand Up @@ -56,7 +56,7 @@ type Token @entity {

type Pair @entity {
# pair address
id: ID!
id: Bytes!

# mirrored from the smart contract
token0: Token!
Expand Down Expand Up @@ -96,12 +96,12 @@ type Pair @entity {
}

type User @entity {
id: ID!
id: Bytes!
usdSwapped: BigDecimal!
}

type Transaction @entity {
id: ID! # txn hash
type Transaction @entity(immutable: true) {
id: Bytes! # txn hash
blockNumber: BigInt!
timestamp: BigInt!
# This is not the reverse of Mint.transaction; it is only used to
Expand All @@ -111,9 +111,9 @@ type Transaction @entity {
swaps: [Swap!]!
}

type Mint @entity {
# transaction hash + "-" + index in mints Transaction array
id: ID!
type Mint @entity(immutable: true) {
# transaction hash + index in mints Transaction array
id: Bytes!
transaction: Transaction!
timestamp: BigInt! # need this to pull recent txns for specific token or pair
pair: Pair!
Expand All @@ -135,9 +135,9 @@ type Mint @entity {
feeLiquidity: BigDecimal
}

type Burn @entity {
# transaction hash + "-" + index in mints Transaction array
id: ID!
type Burn @entity(immutable: true) {
# transaction hash + index in mints Transaction array
id: Bytes!
transaction: Transaction!
timestamp: BigInt! # need this to pull recent txns for specific token or pair
pair: Pair!
Expand All @@ -162,9 +162,8 @@ type Burn @entity {
feeLiquidity: BigDecimal
}

type Swap @entity {
# transaction hash + "-" + index in swaps Transaction array
id: ID!
type Swap @entity(immutable: true) {
id: Bytes!
transaction: Transaction!
timestamp: BigInt! # need this to pull recent txns for specific token or pair
pair: Pair!
Expand All @@ -185,13 +184,13 @@ type Swap @entity {

# stores for USD calculations
type Bundle @entity {
id: ID!
id: Bytes!
ethPrice: BigDecimal! # price of ETH usd
}

# Data accumulated and condensed into day stats for all of Uniswap
type UniswapDayData @entity {
id: ID! # timestamp rounded to current day by dividing by 86400
id: Bytes! # timestamp rounded to current day by dividing by 86400
date: Int!

dailyVolumeETH: BigDecimal!
Expand All @@ -207,7 +206,7 @@ type UniswapDayData @entity {
}

type PairHourData @entity {
id: ID!
id: Bytes!
hourStartUnix: Int! # unix timestamp for start of hour
pair: Pair!

Expand All @@ -225,12 +224,12 @@ type PairHourData @entity {
hourlyVolumeToken0: BigDecimal!
hourlyVolumeToken1: BigDecimal!
hourlyVolumeUSD: BigDecimal!
hourlyTxns: BigInt!
hourlyTxns: BigInt!
}

# Data accumulated and condensed into day stats for each exchange
type PairDayData @entity {
id: ID!
id: Bytes!
date: Int!
pairAddress: Bytes!
token0: Token!
Expand All @@ -254,7 +253,7 @@ type PairDayData @entity {
}

type TokenDayData @entity {
id: ID!
id: Bytes!
date: Int!
token: Token!

Expand Down
Loading