Commit fa2b24cd authored by 贾浩@五瓣科技's avatar 贾浩@五瓣科技

Initial commit

parents
Pipeline #880 failed with stages
node_modules
.vscode
.idea
.DS_Store
test.txt
build
src/types
This diff is collapsed.
# Uniswap V2 Subgraph
[Uniswap](https://uniswap.org/) is a decentralized protocol for automated token exchange on Ethereum.
This subgraph dynamically tracks any pair created by the uniswap factory. It tracks of the current state of Uniswap contracts, and contains derived stats for things like historical data and USD prices.
- aggregated data across pairs and tokens,
- data on individual pairs and tokens,
- data on transactions
- data on liquidity providers
- historical data on Uniswap, pairs or tokens, aggregated by day
## Running Locally
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.
## Key Entity Overviews
#### UniswapFactory
Contains data across all of Uniswap V2. This entity tracks important things like total liquidity (in ETH and USD, see below), all time volume, transaction count, number of pairs and more.
#### Token
Contains data on a specific token. This token specific data is aggregated across all pairs, and is updated whenever there is a transaction involving that token.
#### Pair
Contains data on a specific pair.
#### Transaction
Every transaction on Uniswap is stored. Each transaction contains an array of mints, burns, and swaps that occured within it.
#### Mint, Burn, Swap
These contain specifc information about a transaction. Things like which pair triggered the transaction, amounts, sender, recipient, and more. Each is linked to a parent Transaction entity.
## Example Queries
### Querying Aggregated Uniswap Data
This query fetches aggredated data from all uniswap pairs and tokens, to give a view into how much activity is happening within the whole protocol.
```graphql
{
uniswapFactories(first: 1) {
pairCount
totalVolumeUSD
totalLiquidityUSD
}
}
```
先全部安装graph-cli
npm install -g @graphprotocol/graph-cli@0.20.3
helper.ts
修改factory地址
prices.ts
修改WETH地址,USDT_WETH_PAIR用于获取主币的价格,USDC_WETH_PAIR和DAI_WETH_PAIR可以留空
修改WHITELIST默认追踪的白名单代币,也可以不填或不修改
测试网无价值,返回价值的都硬编码返回0 ZERO_BD
subgraph.yaml
修改factory地址和开始区块,如果开始区块距今不满足7天,explorer info前端会报错
部署
yarn
yarn codegen
graph remove movat/movaswap --node http://13.204.105.72:8020
graph create movat/movaswap --node http://13.204.105.72:8020
graph deploy movat/movaswap --ipfs http://13.204.105.72:5001 --node http://13.204.105.72:8020
[
{
"constant": true,
"inputs": [],
"name": "name",
"outputs": [
{
"name": "",
"type": "string"
}
],
"payable": false,
"stateMutability": "view",
"type": "function"
},
{
"constant": false,
"inputs": [
{
"name": "_spender",
"type": "address"
},
{
"name": "_value",
"type": "uint256"
}
],
"name": "approve",
"outputs": [
{
"name": "",
"type": "bool"
}
],
"payable": false,
"stateMutability": "nonpayable",
"type": "function"
},
{
"constant": true,
"inputs": [],
"name": "totalSupply",
"outputs": [
{
"name": "",
"type": "uint256"
}
],
"payable": false,
"stateMutability": "view",
"type": "function"
},
{
"constant": false,
"inputs": [
{
"name": "_from",
"type": "address"
},
{
"name": "_to",
"type": "address"
},
{
"name": "_value",
"type": "uint256"
}
],
"name": "transferFrom",
"outputs": [
{
"name": "",
"type": "bool"
}
],
"payable": false,
"stateMutability": "nonpayable",
"type": "function"
},
{
"constant": true,
"inputs": [],
"name": "decimals",
"outputs": [
{
"name": "",
"type": "uint8"
}
],
"payable": false,
"stateMutability": "view",
"type": "function"
},
{
"constant": true,
"inputs": [
{
"name": "_owner",
"type": "address"
}
],
"name": "balanceOf",
"outputs": [
{
"name": "balance",
"type": "uint256"
}
],
"payable": false,
"stateMutability": "view",
"type": "function"
},
{
"constant": true,
"inputs": [],
"name": "symbol",
"outputs": [
{
"name": "",
"type": "string"
}
],
"payable": false,
"stateMutability": "view",
"type": "function"
},
{
"constant": false,
"inputs": [
{
"name": "_to",
"type": "address"
},
{
"name": "_value",
"type": "uint256"
}
],
"name": "transfer",
"outputs": [
{
"name": "",
"type": "bool"
}
],
"payable": false,
"stateMutability": "nonpayable",
"type": "function"
},
{
"constant": true,
"inputs": [
{
"name": "_owner",
"type": "address"
},
{
"name": "_spender",
"type": "address"
}
],
"name": "allowance",
"outputs": [
{
"name": "",
"type": "uint256"
}
],
"payable": false,
"stateMutability": "view",
"type": "function"
},
{
"payable": true,
"stateMutability": "payable",
"type": "fallback"
},
{
"anonymous": false,
"inputs": [
{
"indexed": true,
"name": "owner",
"type": "address"
},
{
"indexed": true,
"name": "spender",
"type": "address"
},
{
"indexed": false,
"name": "value",
"type": "uint256"
}
],
"name": "Approval",
"type": "event"
},
{
"anonymous": false,
"inputs": [
{
"indexed": true,
"name": "from",
"type": "address"
},
{
"indexed": true,
"name": "to",
"type": "address"
},
{
"indexed": false,
"name": "value",
"type": "uint256"
}
],
"name": "Transfer",
"type": "event"
}
]
[
{
"constant": true,
"inputs": [],
"name": "name",
"outputs": [
{
"internalType": "bytes32",
"name": "",
"type": "bytes32"
}
],
"payable": false,
"stateMutability": "view",
"type": "function"
}
]
[
{
"constant": true,
"inputs": [],
"name": "symbol",
"outputs": [
{
"internalType": "bytes32",
"name": "",
"type": "bytes32"
}
],
"payable": false,
"stateMutability": "view",
"type": "function"
}
]
[
{
"inputs": [
{
"internalType": "address",
"name": "_feeToSetter",
"type": "address"
}
],
"payable": false,
"stateMutability": "nonpayable",
"type": "constructor"
},
{
"anonymous": false,
"inputs": [
{
"indexed": true,
"internalType": "address",
"name": "token0",
"type": "address"
},
{
"indexed": true,
"internalType": "address",
"name": "token1",
"type": "address"
},
{
"indexed": false,
"internalType": "address",
"name": "pair",
"type": "address"
},
{
"indexed": false,
"internalType": "uint256",
"name": "",
"type": "uint256"
}
],
"name": "PairCreated",
"type": "event"
},
{
"constant": true,
"inputs": [
{
"internalType": "uint256",
"name": "",
"type": "uint256"
}
],
"name": "allPairs",
"outputs": [
{
"internalType": "address",
"name": "",
"type": "address"
}
],
"payable": false,
"stateMutability": "view",
"type": "function"
},
{
"constant": true,
"inputs": [],
"name": "allPairsLength",
"outputs": [
{
"internalType": "uint256",
"name": "",
"type": "uint256"
}
],
"payable": false,
"stateMutability": "view",
"type": "function"
},
{
"constant": false,
"inputs": [
{
"internalType": "address",
"name": "tokenA",
"type": "address"
},
{
"internalType": "address",
"name": "tokenB",
"type": "address"
}
],
"name": "createPair",
"outputs": [
{
"internalType": "address",
"name": "pair",
"type": "address"
}
],
"payable": false,
"stateMutability": "nonpayable",
"type": "function"
},
{
"constant": true,
"inputs": [],
"name": "feeTo",
"outputs": [
{
"internalType": "address",
"name": "",
"type": "address"
}
],
"payable": false,
"stateMutability": "view",
"type": "function"
},
{
"constant": true,
"inputs": [],
"name": "feeToSetter",
"outputs": [
{
"internalType": "address",
"name": "",
"type": "address"
}
],
"payable": false,
"stateMutability": "view",
"type": "function"
},
{
"constant": true,
"inputs": [
{
"internalType": "address",
"name": "",
"type": "address"
},
{
"internalType": "address",
"name": "",
"type": "address"
}
],
"name": "getPair",
"outputs": [
{
"internalType": "address",
"name": "",
"type": "address"
}
],
"payable": false,
"stateMutability": "view",
"type": "function"
},
{
"constant": false,
"inputs": [
{
"internalType": "address",
"name": "_feeTo",
"type": "address"
}
],
"name": "setFeeTo",
"outputs": [],
"payable": false,
"stateMutability": "nonpayable",
"type": "function"
},
{
"constant": false,
"inputs": [
{
"internalType": "address",
"name": "_feeToSetter",
"type": "address"
}
],
"name": "setFeeToSetter",
"outputs": [],
"payable": false,
"stateMutability": "nonpayable",
"type": "function"
}
]
This diff is collapsed.
{
"name": "uniswap-v2-subgraph",
"version": "1.0.0",
"repository": "https://github.com/graphprotocol/uniswap-v2-subgraph",
"license": "GPL-3.0-or-later",
"scripts": {
"codegen": "graph codegen --output-dir src/types/",
"build": "graph build",
"create-local": "graph create davekaj/uniswap --node http://127.0.0.1:8020",
"deploy-local": "graph deploy davekaj/uniswap --debug --ipfs http://localhost:5001 --node http://127.0.0.1:8020",
"deploy": "graph deploy ianlapham/uniswap-v2-dev --ipfs https://api.thegraph.com/ipfs/ --node https://api.thegraph.com/deploy/ --debug",
"deploy-staging": "graph deploy $THE_GRAPH_GITHUB_USER/$THE_GRAPH_SUBGRAPH_NAME /Uniswap --ipfs https://api.staging.thegraph.com/ipfs/ --node https://api.staging.thegraph.com/deploy/",
"watch-local": "graph deploy graphprotocol/Uniswap2 --watch --debug --node http://127.0.0.1:8020/ --ipfs http://localhost:5001"
},
"devDependencies": {
"@graphprotocol/graph-cli": "^0.21.3",
"@graphprotocol/graph-ts": "^0.20.1",
"@typescript-eslint/eslint-plugin": "^2.0.0",
"@typescript-eslint/parser": "^2.0.0",
"eslint": "^6.2.2",
"eslint-config-prettier": "^6.1.0",
"prettier": "^1.18.2",
"typescript": "^3.5.2"
}
}
type UniswapFactory @entity {
# factory address
id: ID!
# pair info
pairCount: Int!
# total volume
totalVolumeUSD: BigDecimal!
totalVolumeETH: BigDecimal!
# untracked values - less confident USD scores
untrackedVolumeUSD: BigDecimal!
# total liquidity
totalLiquidityUSD: BigDecimal!
totalLiquidityETH: BigDecimal!
# transactions
txCount: BigInt!
}
type Token @entity {
# token address
id: ID!
# mirrored from the smart contract
symbol: String!
name: String!
decimals: BigInt!
# used for other stats like marketcap
totalSupply: BigInt!
# token specific volume
tradeVolume: BigDecimal!
tradeVolumeUSD: BigDecimal!
untrackedVolumeUSD: BigDecimal!
# transactions across all pairs
txCount: BigInt!
# liquidity across all pairs
totalLiquidity: BigDecimal!
# derived prices
derivedETH: BigDecimal
# derived fields
tokenDayData: [TokenDayData!]! @derivedFrom(field: "token")
pairDayDataBase: [PairDayData!]! @derivedFrom(field: "token0")
pairDayDataQuote: [PairDayData!]! @derivedFrom(field: "token1")
pairBase: [Pair!]! @derivedFrom(field: "token0")
pairQuote: [Pair!]! @derivedFrom(field: "token1")
}
type Pair @entity {
# pair address
id: ID!
# mirrored from the smart contract
token0: Token!
token1: Token!
reserve0: BigDecimal!
reserve1: BigDecimal!
totalSupply: BigDecimal!
# derived liquidity
reserveETH: BigDecimal!
reserveUSD: BigDecimal!
# used for separating per pair reserves and global
trackedReserveETH: BigDecimal!
# Price in terms of the asset pair
token0Price: BigDecimal!
token1Price: BigDecimal!
# lifetime volume stats
volumeToken0: BigDecimal!
volumeToken1: BigDecimal!
volumeUSD: BigDecimal!
untrackedVolumeUSD: BigDecimal!
txCount: BigInt!
# creation stats
createdAtTimestamp: BigInt!
createdAtBlockNumber: BigInt!
# Fields used to help derived relationship
liquidityProviderCount: BigInt! # used to detect new exchanges
# derived fields
pairHourData: [PairHourData!]! @derivedFrom(field: "pair")
liquidityPositions: [LiquidityPosition!]! @derivedFrom(field: "pair")
liquidityPositionSnapshots: [LiquidityPositionSnapshot!]! @derivedFrom(field: "pair")
mints: [Mint!]! @derivedFrom(field: "pair")
burns: [Burn!]! @derivedFrom(field: "pair")
swaps: [Swap!]! @derivedFrom(field: "pair")
}
type User @entity {
id: ID!
liquidityPositions: [LiquidityPosition!] @derivedFrom(field: "user")
usdSwapped: BigDecimal!
}
type LiquidityPosition @entity {
id: ID!
user: User!
pair: Pair!
liquidityTokenBalance: BigDecimal!
}
# saved over time for return calculations, gets created and never updated
type LiquidityPositionSnapshot @entity {
id: ID!
liquidityPosition: LiquidityPosition!
timestamp: Int! # saved for fast historical lookups
block: Int! # saved for fast historical lookups
user: User! # reference to user
pair: Pair! # reference to pair
token0PriceUSD: BigDecimal! # snapshot of token0 price
token1PriceUSD: BigDecimal! # snapshot of token1 price
reserve0: BigDecimal! # snapshot of pair token0 reserves
reserve1: BigDecimal! # snapshot of pair token1 reserves
reserveUSD: BigDecimal! # snapshot of pair reserves in USD
liquidityTokenTotalSupply: BigDecimal! # snapshot of pool token supply
liquidityTokenBalance: BigDecimal! # snapshot of users pool token balance
}
type Transaction @entity {
id: ID! # txn hash
blockNumber: BigInt!
timestamp: BigInt!
# This is not the reverse of Mint.transaction; it is only used to
# track incomplete mints (similar for burns and swaps)
mints: [Mint]!
burns: [Burn]!
swaps: [Swap]!
}
type Mint @entity {
# transaction hash + "-" + index in mints Transaction array
id: ID!
transaction: Transaction!
timestamp: BigInt! # need this to pull recent txns for specific token or pair
pair: Pair!
# populated from the primary Transfer event
to: Bytes!
liquidity: BigDecimal!
# populated from the Mint event
sender: Bytes
amount0: BigDecimal
amount1: BigDecimal
logIndex: BigInt
# derived amount based on available prices of tokens
amountUSD: BigDecimal
# optional fee fields, if a Transfer event is fired in _mintFee
feeTo: Bytes
feeLiquidity: BigDecimal
}
type Burn @entity {
# transaction hash + "-" + index in mints Transaction array
id: ID!
transaction: Transaction!
timestamp: BigInt! # need this to pull recent txns for specific token or pair
pair: Pair!
# populated from the primary Transfer event
liquidity: BigDecimal!
# populated from the Burn event
sender: Bytes
amount0: BigDecimal
amount1: BigDecimal
to: Bytes
logIndex: BigInt
# derived amount based on available prices of tokens
amountUSD: BigDecimal
# mark uncomplete in ETH case
needsComplete: Boolean!
# optional fee fields, if a Transfer event is fired in _mintFee
feeTo: Bytes
feeLiquidity: BigDecimal
}
type Swap @entity {
# transaction hash + "-" + index in swaps Transaction array
id: ID!
transaction: Transaction!
timestamp: BigInt! # need this to pull recent txns for specific token or pair
pair: Pair!
# populated from the Swap event
sender: Bytes!
from: Bytes! # the EOA that initiated the txn
amount0In: BigDecimal!
amount1In: BigDecimal!
amount0Out: BigDecimal!
amount1Out: BigDecimal!
to: Bytes!
logIndex: BigInt
# derived info
amountUSD: BigDecimal!
}
# stores for USD calculations
type Bundle @entity {
id: ID!
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
date: Int!
dailyVolumeETH: BigDecimal!
dailyVolumeUSD: BigDecimal!
dailyVolumeUntracked: BigDecimal!
totalVolumeETH: BigDecimal!
totalLiquidityETH: BigDecimal!
totalVolumeUSD: BigDecimal! # Accumulate at each trade, not just calculated off whatever totalVolume is. making it more accurate as it is a live conversion
totalLiquidityUSD: BigDecimal!
txCount: BigInt!
}
type PairHourData @entity {
id: ID!
hourStartUnix: Int! # unix timestamp for start of hour
pair: Pair!
# reserves
reserve0: BigDecimal!
reserve1: BigDecimal!
# total supply for LP historical returns
totalSupply: BigDecimal
# derived liquidity
reserveUSD: BigDecimal!
# volume stats
hourlyVolumeToken0: BigDecimal!
hourlyVolumeToken1: BigDecimal!
hourlyVolumeUSD: BigDecimal!
hourlyTxns: BigInt!
}
# Data accumulated and condensed into day stats for each exchange
type PairDayData @entity {
id: ID!
date: Int!
pairAddress: Bytes!
token0: Token!
token1: Token!
# reserves
reserve0: BigDecimal!
reserve1: BigDecimal!
# total supply for LP historical returns
totalSupply: BigDecimal
# derived liquidity
reserveUSD: BigDecimal!
# volume stats
dailyVolumeToken0: BigDecimal!
dailyVolumeToken1: BigDecimal!
dailyVolumeUSD: BigDecimal!
dailyTxns: BigInt!
}
type TokenDayData @entity {
id: ID!
date: Int!
token: Token!
# volume stats
dailyVolumeToken: BigDecimal!
dailyVolumeETH: BigDecimal!
dailyVolumeUSD: BigDecimal!
dailyTxns: BigInt!
# liquidity stats
totalLiquidityToken: BigDecimal!
totalLiquidityETH: BigDecimal!
totalLiquidityUSD: BigDecimal!
# price stats
priceUSD: BigDecimal!
}
This diff is collapsed.
/* eslint-disable prefer-const */
import { BigDecimal, BigInt, ethereum } from '@graphprotocol/graph-ts'
import { Bundle, Pair, PairDayData, Token, TokenDayData, UniswapDayData, UniswapFactory } from '../types/schema'
import { PairHourData } from './../types/schema'
import { FACTORY_ADDRESS, ONE_BI, ZERO_BD, ZERO_BI } from './helpers'
export function updateUniswapDayData(event: ethereum.Event): UniswapDayData {
let uniswap = UniswapFactory.load(FACTORY_ADDRESS)
let timestamp = event.block.timestamp.toI32()
let dayID = timestamp / 86400
let dayStartTimestamp = dayID * 86400
let uniswapDayData = UniswapDayData.load(dayID.toString())
if (uniswapDayData === null) {
uniswapDayData = new UniswapDayData(dayID.toString())
uniswapDayData.date = dayStartTimestamp
uniswapDayData.dailyVolumeUSD = ZERO_BD
uniswapDayData.dailyVolumeETH = ZERO_BD
uniswapDayData.totalVolumeUSD = ZERO_BD
uniswapDayData.totalVolumeETH = ZERO_BD
uniswapDayData.dailyVolumeUntracked = ZERO_BD
}
uniswapDayData.totalLiquidityUSD = uniswap.totalLiquidityUSD
uniswapDayData.totalLiquidityETH = uniswap.totalLiquidityETH
uniswapDayData.txCount = uniswap.txCount
uniswapDayData.save()
return uniswapDayData as UniswapDayData
}
export function updatePairDayData(event: ethereum.Event): PairDayData {
let timestamp = event.block.timestamp.toI32()
let dayID = timestamp / 86400
let dayStartTimestamp = dayID * 86400
let dayPairID = event.address
.toHexString()
.concat('-')
.concat(BigInt.fromI32(dayID).toString())
let pair = Pair.load(event.address.toHexString())
let pairDayData = PairDayData.load(dayPairID)
if (pairDayData === null) {
pairDayData = new PairDayData(dayPairID)
pairDayData.date = dayStartTimestamp
pairDayData.token0 = pair.token0
pairDayData.token1 = pair.token1
pairDayData.pairAddress = event.address
pairDayData.dailyVolumeToken0 = ZERO_BD
pairDayData.dailyVolumeToken1 = ZERO_BD
pairDayData.dailyVolumeUSD = ZERO_BD
pairDayData.dailyTxns = ZERO_BI
}
pairDayData.totalSupply = pair.totalSupply
pairDayData.reserve0 = pair.reserve0
pairDayData.reserve1 = pair.reserve1
pairDayData.reserveUSD = pair.reserveUSD
pairDayData.dailyTxns = pairDayData.dailyTxns.plus(ONE_BI)
pairDayData.save()
return pairDayData as PairDayData
}
export function updatePairHourData(event: ethereum.Event): PairHourData {
let timestamp = event.block.timestamp.toI32()
let hourIndex = timestamp / 3600 // get unique hour within unix history
let hourStartUnix = hourIndex * 3600 // want the rounded effect
let hourPairID = event.address
.toHexString()
.concat('-')
.concat(BigInt.fromI32(hourIndex).toString())
let pair = Pair.load(event.address.toHexString())
let pairHourData = PairHourData.load(hourPairID)
if (pairHourData === null) {
pairHourData = new PairHourData(hourPairID)
pairHourData.hourStartUnix = hourStartUnix
pairHourData.pair = event.address.toHexString()
pairHourData.hourlyVolumeToken0 = ZERO_BD
pairHourData.hourlyVolumeToken1 = ZERO_BD
pairHourData.hourlyVolumeUSD = ZERO_BD
pairHourData.hourlyTxns = ZERO_BI
}
pairHourData.totalSupply = pair.totalSupply
pairHourData.reserve0 = pair.reserve0
pairHourData.reserve1 = pair.reserve1
pairHourData.reserveUSD = pair.reserveUSD
pairHourData.hourlyTxns = pairHourData.hourlyTxns.plus(ONE_BI)
pairHourData.save()
return pairHourData as PairHourData
}
export function updateTokenDayData(token: Token, event: ethereum.Event): TokenDayData {
let bundle = Bundle.load('1')
let timestamp = event.block.timestamp.toI32()
let dayID = timestamp / 86400
let dayStartTimestamp = dayID * 86400
let tokenDayID = token.id
.toString()
.concat('-')
.concat(BigInt.fromI32(dayID).toString())
let tokenDayData = TokenDayData.load(tokenDayID)
if (tokenDayData === null) {
tokenDayData = new TokenDayData(tokenDayID)
tokenDayData.date = dayStartTimestamp
tokenDayData.token = token.id
tokenDayData.priceUSD = token.derivedETH.times(bundle.ethPrice)
tokenDayData.dailyVolumeToken = ZERO_BD
tokenDayData.dailyVolumeETH = ZERO_BD
tokenDayData.dailyVolumeUSD = ZERO_BD
tokenDayData.dailyTxns = ZERO_BI
tokenDayData.totalLiquidityUSD = ZERO_BD
}
tokenDayData.priceUSD = token.derivedETH.times(bundle.ethPrice)
tokenDayData.totalLiquidityToken = token.totalLiquidity
tokenDayData.totalLiquidityETH = token.totalLiquidity.times(token.derivedETH as BigDecimal)
tokenDayData.totalLiquidityUSD = tokenDayData.totalLiquidityETH.times(bundle.ethPrice)
tokenDayData.dailyTxns = tokenDayData.dailyTxns.plus(ONE_BI)
tokenDayData.save()
/**
* @todo test if this speeds up sync
*/
// updateStoredTokens(tokenDayData as TokenDayData, dayID)
// updateStoredPairs(tokenDayData as TokenDayData, dayPairID)
return tokenDayData as TokenDayData
}
/* eslint-disable prefer-const */
import { log } from '@graphprotocol/graph-ts'
import { PairCreated } from '../types/Factory/Factory'
import { Bundle, Pair, Token, UniswapFactory } from '../types/schema'
import { Pair as PairTemplate } from '../types/templates'
import {
FACTORY_ADDRESS,
fetchTokenDecimals,
fetchTokenName,
fetchTokenSymbol,
fetchTokenTotalSupply,
ZERO_BD,
ZERO_BI
} from './helpers'
export function handleNewPair(event: PairCreated): void {
// load factory (create if first exchange)
let factory = UniswapFactory.load(FACTORY_ADDRESS)
if (factory === null) {
factory = new UniswapFactory(FACTORY_ADDRESS)
factory.pairCount = 0
factory.totalVolumeETH = ZERO_BD
factory.totalLiquidityETH = ZERO_BD
factory.totalVolumeUSD = ZERO_BD
factory.untrackedVolumeUSD = ZERO_BD
factory.totalLiquidityUSD = ZERO_BD
factory.txCount = ZERO_BI
// create new bundle
let bundle = new Bundle('1')
bundle.ethPrice = ZERO_BD
bundle.save()
}
factory.pairCount = factory.pairCount + 1
factory.save()
// create the tokens
let token0 = Token.load(event.params.token0.toHexString())
let token1 = Token.load(event.params.token1.toHexString())
// fetch info if null
if (token0 === null) {
token0 = new Token(event.params.token0.toHexString())
token0.symbol = fetchTokenSymbol(event.params.token0)
token0.name = fetchTokenName(event.params.token0)
token0.totalSupply = fetchTokenTotalSupply(event.params.token0)
let decimals = fetchTokenDecimals(event.params.token0)
// bail if we couldn't figure out the decimals
if (decimals === null) {
log.debug('mybug the decimal on token 0 was null', [])
return
}
token0.decimals = decimals
token0.derivedETH = ZERO_BD
token0.tradeVolume = ZERO_BD
token0.tradeVolumeUSD = ZERO_BD
token0.untrackedVolumeUSD = ZERO_BD
token0.totalLiquidity = ZERO_BD
// token0.allPairs = []
token0.txCount = ZERO_BI
}
// fetch info if null
if (token1 === null) {
token1 = new Token(event.params.token1.toHexString())
token1.symbol = fetchTokenSymbol(event.params.token1)
token1.name = fetchTokenName(event.params.token1)
token1.totalSupply = fetchTokenTotalSupply(event.params.token1)
let decimals = fetchTokenDecimals(event.params.token1)
// bail if we couldn't figure out the decimals
if (decimals === null) {
return
}
token1.decimals = decimals
token1.derivedETH = ZERO_BD
token1.tradeVolume = ZERO_BD
token1.tradeVolumeUSD = ZERO_BD
token1.untrackedVolumeUSD = ZERO_BD
token1.totalLiquidity = ZERO_BD
// token1.allPairs = []
token1.txCount = ZERO_BI
}
let pair = new Pair(event.params.pair.toHexString()) as Pair
pair.token0 = token0.id
pair.token1 = token1.id
pair.liquidityProviderCount = ZERO_BI
pair.createdAtTimestamp = event.block.timestamp
pair.createdAtBlockNumber = event.block.number
pair.txCount = ZERO_BI
pair.reserve0 = ZERO_BD
pair.reserve1 = ZERO_BD
pair.trackedReserveETH = ZERO_BD
pair.reserveETH = ZERO_BD
pair.reserveUSD = ZERO_BD
pair.totalSupply = ZERO_BD
pair.volumeToken0 = ZERO_BD
pair.volumeToken1 = ZERO_BD
pair.volumeUSD = ZERO_BD
pair.untrackedVolumeUSD = ZERO_BD
pair.token0Price = ZERO_BD
pair.token1Price = ZERO_BD
// create the tracked contract based on the template
PairTemplate.create(event.params.pair)
// save updated values
token0.save()
token1.save()
pair.save()
factory.save()
}
/* eslint-disable prefer-const */
import { log, BigInt, BigDecimal, Address, ethereum } from '@graphprotocol/graph-ts'
import { ERC20 } from '../types/Factory/ERC20'
import { ERC20SymbolBytes } from '../types/Factory/ERC20SymbolBytes'
import { ERC20NameBytes } from '../types/Factory/ERC20NameBytes'
import { User, Bundle, Token, LiquidityPosition, LiquidityPositionSnapshot, Pair } from '../types/schema'
import { Factory as FactoryContract } from '../types/templates/Pair/Factory'
import { TokenDefinition } from './tokenDefinition'
export const ADDRESS_ZERO = '0x0000000000000000000000000000000000000000'
export const FACTORY_ADDRESS = '0xcFe29562342E165e561A95a8dc90d37e5bE2a2b7'
export let ZERO_BI = BigInt.fromI32(0)
export let ONE_BI = BigInt.fromI32(1)
export let ZERO_BD = BigDecimal.fromString('0')
export let ONE_BD = BigDecimal.fromString('1')
export let BI_18 = BigInt.fromI32(18)
export let factoryContract = FactoryContract.bind(Address.fromString(FACTORY_ADDRESS))
// rebass tokens, dont count in tracked volume
export let UNTRACKED_PAIRS: string[] = ['0x9ea3b5b4ec044b70375236a281986106457b20ef']
export function exponentToBigDecimal(decimals: BigInt): BigDecimal {
let bd = BigDecimal.fromString('1')
for (let i = ZERO_BI; i.lt(decimals as BigInt); i = i.plus(ONE_BI)) {
bd = bd.times(BigDecimal.fromString('10'))
}
return bd
}
export function bigDecimalExp18(): BigDecimal {
return BigDecimal.fromString('1000000000000000000')
}
export function convertEthToDecimal(eth: BigInt): BigDecimal {
return eth.toBigDecimal().div(exponentToBigDecimal(18))
}
export function convertTokenToDecimal(tokenAmount: BigInt, exchangeDecimals: BigInt): BigDecimal {
if (exchangeDecimals == ZERO_BI) {
return tokenAmount.toBigDecimal()
}
return tokenAmount.toBigDecimal().div(exponentToBigDecimal(exchangeDecimals))
}
export function equalToZero(value: BigDecimal): boolean {
const formattedVal = parseFloat(value.toString())
const zero = parseFloat(ZERO_BD.toString())
if (zero == formattedVal) {
return true
}
return false
}
export function isNullEthValue(value: string): boolean {
return value == '0x0000000000000000000000000000000000000000000000000000000000000001'
}
export function fetchTokenSymbol(tokenAddress: Address): string {
// static definitions overrides
let staticDefinition = TokenDefinition.fromAddress(tokenAddress)
if (staticDefinition != null) {
return (staticDefinition as TokenDefinition).symbol
}
let contract = ERC20.bind(tokenAddress)
let contractSymbolBytes = ERC20SymbolBytes.bind(tokenAddress)
// try types string and bytes32 for symbol
let symbolValue = 'unknown'
let symbolResult = contract.try_symbol()
if (symbolResult.reverted) {
let symbolResultBytes = contractSymbolBytes.try_symbol()
if (!symbolResultBytes.reverted) {
// for broken pairs that have no symbol function exposed
if (!isNullEthValue(symbolResultBytes.value.toHexString())) {
symbolValue = symbolResultBytes.value.toString()
}
}
} else {
symbolValue = symbolResult.value
}
return symbolValue
}
export function fetchTokenName(tokenAddress: Address): string {
// static definitions overrides
let staticDefinition = TokenDefinition.fromAddress(tokenAddress)
if (staticDefinition != null) {
return (staticDefinition as TokenDefinition).name
}
let contract = ERC20.bind(tokenAddress)
let contractNameBytes = ERC20NameBytes.bind(tokenAddress)
// try types string and bytes32 for name
let nameValue = 'unknown'
let nameResult = contract.try_name()
if (nameResult.reverted) {
let nameResultBytes = contractNameBytes.try_name()
if (!nameResultBytes.reverted) {
// for broken exchanges that have no name function exposed
if (!isNullEthValue(nameResultBytes.value.toHexString())) {
nameValue = nameResultBytes.value.toString()
}
}
} else {
nameValue = nameResult.value
}
return nameValue
}
// HOT FIX: we cant implement try catch for overflow catching so skip total supply parsing on these tokens that overflow
// TODO: find better way to handle overflow
let SKIP_TOTAL_SUPPLY: string[] = [
"0x0000000000bf2686748e1c0255036e7617e7e8a5"
]
export function fetchTokenTotalSupply(tokenAddress: Address): BigInt {
if (SKIP_TOTAL_SUPPLY.includes(tokenAddress.toHexString())) {
return BigInt.fromI32(0)
}
let contract = ERC20.bind(tokenAddress)
let totalSupplyValue = null
let totalSupplyResult = contract.try_totalSupply()
if (!totalSupplyResult.reverted) {
totalSupplyValue = totalSupplyResult as i32
}
return BigInt.fromI32(totalSupplyValue as i32)
}
export function fetchTokenDecimals(tokenAddress: Address): BigInt {
// static definitions overrides
let staticDefinition = TokenDefinition.fromAddress(tokenAddress)
if (staticDefinition != null) {
return (staticDefinition as TokenDefinition).decimals
}
let contract = ERC20.bind(tokenAddress)
// try types uint8 for decimals
let decimalValue = null
let decimalResult = contract.try_decimals()
if (!decimalResult.reverted) {
decimalValue = decimalResult.value
}
return BigInt.fromI32(decimalValue as i32)
}
export function createLiquidityPosition(exchange: Address, user: Address): LiquidityPosition {
let id = exchange
.toHexString()
.concat('-')
.concat(user.toHexString())
let liquidityTokenBalance = LiquidityPosition.load(id)
if (liquidityTokenBalance === null) {
let pair = Pair.load(exchange.toHexString())
pair.liquidityProviderCount = pair.liquidityProviderCount.plus(ONE_BI)
liquidityTokenBalance = new LiquidityPosition(id)
liquidityTokenBalance.liquidityTokenBalance = ZERO_BD
liquidityTokenBalance.pair = exchange.toHexString()
liquidityTokenBalance.user = user.toHexString()
liquidityTokenBalance.save()
pair.save()
}
if (liquidityTokenBalance === null) log.error('LiquidityTokenBalance is null', [id])
return liquidityTokenBalance as LiquidityPosition
}
export function createUser(address: Address): void {
let user = User.load(address.toHexString())
if (user === null) {
user = new User(address.toHexString())
user.usdSwapped = ZERO_BD
user.save()
}
}
export function createLiquiditySnapshot(position: LiquidityPosition, event: ethereum.Event): void {
let timestamp = event.block.timestamp.toI32()
let bundle = Bundle.load('1')
let pair = Pair.load(position.pair)
let token0 = Token.load(pair.token0)
let token1 = Token.load(pair.token1)
// create new snapshot
let snapshot = new LiquidityPositionSnapshot(position.id.concat(timestamp.toString()))
snapshot.liquidityPosition = position.id
snapshot.timestamp = timestamp
snapshot.block = event.block.number.toI32()
snapshot.user = position.user
snapshot.pair = position.pair
snapshot.token0PriceUSD = token0.derivedETH.times(bundle.ethPrice)
snapshot.token1PriceUSD = token1.derivedETH.times(bundle.ethPrice)
snapshot.reserve0 = pair.reserve0
snapshot.reserve1 = pair.reserve1
snapshot.reserveUSD = pair.reserveUSD
snapshot.liquidityTokenTotalSupply = pair.totalSupply
snapshot.liquidityTokenBalance = position.liquidityTokenBalance
snapshot.liquidityPosition = position.id
snapshot.save()
position.save()
}
/* eslint-disable prefer-const */
import { Pair, Token, Bundle } from '../types/schema'
import { BigDecimal, Address, BigInt } from '@graphprotocol/graph-ts/index'
import { ZERO_BD, factoryContract, ADDRESS_ZERO, ONE_BD, UNTRACKED_PAIRS } from './helpers'
const WETH_ADDRESS = '0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2'
const USDC_WETH_PAIR = '0xb4e16d0168e52d35cacd2c6185b44281ec28c9dc' // created 10008355
const DAI_WETH_PAIR = '0xa478c2975ab1ea89e8196811f51a7b7ade33eb11' // created block 10042267
const USDT_WETH_PAIR = '0x0d4a11d5eeaac28ec3f61d100daf4d40471f1852' // created block 10093341
export function getEthPriceInUSD(): BigDecimal {
return ZERO_BD
// fetch eth prices for each stablecoin
let daiPair = Pair.load(DAI_WETH_PAIR) // dai is token0
let usdcPair = Pair.load(USDC_WETH_PAIR) // usdc is token0
let usdtPair = Pair.load(USDT_WETH_PAIR) // usdt is token1
// all 3 have been created
if (daiPair !== null && usdcPair !== null && usdtPair !== null) {
let totalLiquidityETH = daiPair.reserve1.plus(usdcPair.reserve1).plus(usdtPair.reserve0)
let daiWeight = daiPair.reserve1.div(totalLiquidityETH)
let usdcWeight = usdcPair.reserve1.div(totalLiquidityETH)
let usdtWeight = usdtPair.reserve0.div(totalLiquidityETH)
return daiPair.token0Price
.times(daiWeight)
.plus(usdcPair.token0Price.times(usdcWeight))
.plus(usdtPair.token1Price.times(usdtWeight))
// dai and USDC have been created
} else if (daiPair !== null && usdcPair !== null) {
let totalLiquidityETH = daiPair.reserve1.plus(usdcPair.reserve1)
let daiWeight = daiPair.reserve1.div(totalLiquidityETH)
let usdcWeight = usdcPair.reserve1.div(totalLiquidityETH)
return daiPair.token0Price.times(daiWeight).plus(usdcPair.token0Price.times(usdcWeight))
// USDC is the only pair so far
} else if (usdcPair !== null) {
return usdcPair.token0Price
} else {
return ZERO_BD
}
}
// token where amounts should contribute to tracked volume and liquidity
let WHITELIST: string[] = [
'0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2', // WETH
'0x6b175474e89094c44da98b954eedeac495271d0f', // DAI
'0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48', // USDC
'0xdac17f958d2ee523a2206206994597c13d831ec7', // USDT
'0x0000000000085d4780b73119b644ae5ecd22b376', // TUSD
'0x5d3a536e4d6dbd6114cc1ead35777bab948e3643', // cDAI
'0x39aa39c021dfbae8fac545936693ac917d5e7563', // cUSDC
'0x86fadb80d8d2cff3c3680819e4da99c10232ba0f', // EBASE
'0x57ab1ec28d129707052df4df418d58a2d46d5f51', // sUSD
'0x9f8f72aa9304c8b593d555f12ef6589cc3a579a2', // MKR
'0xc00e94cb662c3520282e6f5717214004a7f26888', // COMP
'0x514910771af9ca656af840dff83e8264ecf986ca', //LINK
'0x960b236a07cf122663c4303350609a66a7b288c0', //ANT
'0xc011a73ee8576fb46f5e1c5751ca3b9fe0af2a6f', //SNX
'0x0bc529c00c6401aef6d220be8c6ea1667f6ad93e', //YFI
'0xdf5e0e81dff6faf3a7e52ba697820c5e32d806a8', // yCurv
'0x853d955acef822db058eb8505911ed77f175b99e', // FRAX
'0xa47c8bf37f92abed4a126bda807a7b7498661acd', // WUST
'0x1f9840a85d5af5bf1d1762f925bdaddc4201f984', // UNI
'0x2260fac5e5542a773aa44fbcfedf7c193bc2c599', // WBTC
'0x956f47f50a910163d8bf957cf5846d573e7f87ca' // FEI
]
// minimum liquidity required to count towards tracked volume for pairs with small # of Lps
let MINIMUM_USD_THRESHOLD_NEW_PAIRS = BigDecimal.fromString('400000')
// minimum liquidity for price to get tracked
let MINIMUM_LIQUIDITY_THRESHOLD_ETH = BigDecimal.fromString('2')
/**
* Search through graph to find derived Eth per token.
* @todo update to be derived ETH (add stablecoin estimates)
**/
export function findEthPerToken(token: Token): BigDecimal {
return ZERO_BD
if (token.id == WETH_ADDRESS) {
return ONE_BD
}
// loop through whitelist and check if paired with any
for (let i = 0; i < WHITELIST.length; ++i) {
let pairAddress = factoryContract.getPair(Address.fromString(token.id), Address.fromString(WHITELIST[i]))
if (pairAddress.toHexString() != ADDRESS_ZERO) {
let pair = Pair.load(pairAddress.toHexString())
if (pair.token0 == token.id && pair.reserveETH.gt(MINIMUM_LIQUIDITY_THRESHOLD_ETH)) {
let token1 = Token.load(pair.token1)
return pair.token1Price.times(token1.derivedETH as BigDecimal) // return token1 per our token * Eth per token 1
}
if (pair.token1 == token.id && pair.reserveETH.gt(MINIMUM_LIQUIDITY_THRESHOLD_ETH)) {
let token0 = Token.load(pair.token0)
return pair.token0Price.times(token0.derivedETH as BigDecimal) // return token0 per our token * ETH per token 0
}
}
}
return ZERO_BD // nothing was found return 0
}
/**
* Accepts tokens and amounts, return tracked amount based on token whitelist
* If one token on whitelist, return amount in that token converted to USD.
* If both are, return average of two amounts
* If neither is, return 0
*/
export function getTrackedVolumeUSD(
tokenAmount0: BigDecimal,
token0: Token,
tokenAmount1: BigDecimal,
token1: Token,
pair: Pair
): BigDecimal {
return ZERO_BD
let bundle = Bundle.load('1')
let price0 = token0.derivedETH.times(bundle.ethPrice)
let price1 = token1.derivedETH.times(bundle.ethPrice)
// dont count tracked volume on these pairs - usually rebass tokens
if (UNTRACKED_PAIRS.includes(pair.id)) {
return ZERO_BD
}
// if less than 5 LPs, require high minimum reserve amount amount or return 0
if (pair.liquidityProviderCount.lt(BigInt.fromI32(5))) {
let reserve0USD = pair.reserve0.times(price0)
let reserve1USD = pair.reserve1.times(price1)
if (WHITELIST.includes(token0.id) && WHITELIST.includes(token1.id)) {
if (reserve0USD.plus(reserve1USD).lt(MINIMUM_USD_THRESHOLD_NEW_PAIRS)) {
return ZERO_BD
}
}
if (WHITELIST.includes(token0.id) && !WHITELIST.includes(token1.id)) {
if (reserve0USD.times(BigDecimal.fromString('2')).lt(MINIMUM_USD_THRESHOLD_NEW_PAIRS)) {
return ZERO_BD
}
}
if (!WHITELIST.includes(token0.id) && WHITELIST.includes(token1.id)) {
if (reserve1USD.times(BigDecimal.fromString('2')).lt(MINIMUM_USD_THRESHOLD_NEW_PAIRS)) {
return ZERO_BD
}
}
}
// both are whitelist tokens, take average of both amounts
if (WHITELIST.includes(token0.id) && WHITELIST.includes(token1.id)) {
return tokenAmount0
.times(price0)
.plus(tokenAmount1.times(price1))
.div(BigDecimal.fromString('2'))
}
// take full value of the whitelisted token amount
if (WHITELIST.includes(token0.id) && !WHITELIST.includes(token1.id)) {
return tokenAmount0.times(price0)
}
// take full value of the whitelisted token amount
if (!WHITELIST.includes(token0.id) && WHITELIST.includes(token1.id)) {
return tokenAmount1.times(price1)
}
// neither token is on white list, tracked volume is 0
return ZERO_BD
}
/**
* Accepts tokens and amounts, return tracked amount based on token whitelist
* If one token on whitelist, return amount in that token converted to USD * 2.
* If both are, return sum of two amounts
* If neither is, return 0
*/
export function getTrackedLiquidityUSD(
tokenAmount0: BigDecimal,
token0: Token,
tokenAmount1: BigDecimal,
token1: Token
): BigDecimal {
return ZERO_BD
let bundle = Bundle.load('1')
let price0 = token0.derivedETH.times(bundle.ethPrice)
let price1 = token1.derivedETH.times(bundle.ethPrice)
// both are whitelist tokens, take average of both amounts
if (WHITELIST.includes(token0.id) && WHITELIST.includes(token1.id)) {
return tokenAmount0.times(price0).plus(tokenAmount1.times(price1))
}
// take double value of the whitelisted token amount
if (WHITELIST.includes(token0.id) && !WHITELIST.includes(token1.id)) {
return tokenAmount0.times(price0).times(BigDecimal.fromString('2'))
}
// take double value of the whitelisted token amount
if (!WHITELIST.includes(token0.id) && WHITELIST.includes(token1.id)) {
return tokenAmount1.times(price1).times(BigDecimal.fromString('2'))
}
// neither token is on white list, tracked volume is 0
return ZERO_BD
}
import {
Address,
BigInt,
} from "@graphprotocol/graph-ts"
// Initialize a Token Definition with the attributes
export class TokenDefinition {
address : Address
symbol: string
name: string
decimals: BigInt
// Initialize a Token Definition with its attributes
constructor(address: Address, symbol: string, name: string, decimals: BigInt) {
this.address = address
this.symbol = symbol
this.name = name
this.decimals = decimals
}
// Get all tokens with a static defintion
static getStaticDefinitions(): Array<TokenDefinition> {
let staticDefinitions = new Array<TokenDefinition>(6)
// Add DGD
let tokenDGD = new TokenDefinition(
Address.fromString('0xe0b7927c4af23765cb51314a0e0521a9645f0e2a'),
'DGD',
'DGD',
BigInt.fromI32(9)
)
staticDefinitions.push(tokenDGD)
// Add AAVE
let tokenAAVE = new TokenDefinition(
Address.fromString('0x7fc66500c84a76ad7e9c93437bfc5ac33e2ddae9'),
'AAVE',
'Aave Token',
BigInt.fromI32(18)
)
staticDefinitions.push(tokenAAVE)
// Add LIF
let tokenLIF = new TokenDefinition(
Address.fromString('0xeb9951021698b42e4399f9cbb6267aa35f82d59d'),
'LIF',
'Lif',
BigInt.fromI32(18)
)
staticDefinitions.push(tokenLIF)
// Add SVD
let tokenSVD = new TokenDefinition(
Address.fromString('0xbdeb4b83251fb146687fa19d1c660f99411eefe3'),
'SVD',
'savedroid',
BigInt.fromI32(18)
)
staticDefinitions.push(tokenSVD)
// Add TheDAO
let tokenTheDAO = new TokenDefinition(
Address.fromString('0xbb9bc244d798123fde783fcc1c72d3bb8c189413'),
'TheDAO',
'TheDAO',
BigInt.fromI32(16)
)
staticDefinitions.push(tokenTheDAO)
// Add HPB
let tokenHPB = new TokenDefinition(
Address.fromString('0x38c6a68304cdefb9bec48bbfaaba5c5b47818bb2'),
'HPB',
'HPBCoin',
BigInt.fromI32(18)
)
staticDefinitions.push(tokenHPB)
return staticDefinitions
}
// Helper for hardcoded tokens
static fromAddress(tokenAddress: Address) : TokenDefinition | null {
let staticDefinitions = this.getStaticDefinitions()
let tokenAddressHex = tokenAddress.toHexString()
// Search the definition using the address
for (let i = 0; i < staticDefinitions.length; i++) {
let staticDefinition = staticDefinitions[i]
if(staticDefinition.address.toHexString() == tokenAddressHex) {
return staticDefinition
}
}
// If not found, return null
return null
}
}
\ No newline at end of file
specVersion: 0.0.2
description: Uniswap is a decentralized protocol for automated token exchange on Ethereum.
repository: https://github.com/Uniswap/uniswap-v2-subgraph
schema:
file: ./schema.graphql
dataSources:
- kind: ethereum/contract
name: Factory
network: mainnet
source:
address: '0xcFe29562342E165e561A95a8dc90d37e5bE2a2b7'
abi: Factory
startBlock: 1
mapping:
kind: ethereum/events
apiVersion: 0.0.4
language: wasm/assemblyscript
file: ./src/mappings/factory.ts
entities:
- Pair
- Token
abis:
- name: Factory
file: ./abis/factory.json
- name: ERC20
file: ./abis/ERC20.json
- name: ERC20SymbolBytes
file: ./abis/ERC20SymbolBytes.json
- name: ERC20NameBytes
file: ./abis/ERC20NameBytes.json
eventHandlers:
- event: PairCreated(indexed address,indexed address,address,uint256)
handler: handleNewPair
templates:
- kind: ethereum/contract
name: Pair
network: mainnet
source:
abi: Pair
mapping:
kind: ethereum/events
apiVersion: 0.0.4
language: wasm/assemblyscript
file: ./src/mappings/core.ts
entities:
- Pair
- Token
abis:
- name: Pair
file: ./abis/pair.json
- name: Factory
file: ./abis/factory.json
eventHandlers:
- event: Mint(indexed address,uint256,uint256)
handler: handleMint
- event: Burn(indexed address,uint256,uint256,indexed address)
handler: handleBurn
- event: Swap(indexed address,uint256,uint256,uint256,uint256,indexed address)
handler: handleSwap
- event: Transfer(indexed address,indexed address,uint256)
handler: handleTransfer
- event: Sync(uint112,uint112)
handler: handleSync
{
"extends": "./node_modules/@graphprotocol/graph-ts/tsconfig.json",
"compilerOptions": {
"types": ["@graphprotocol/graph-ts"]
}
}
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment