Skip to content

Commit 537e539

Browse files
authored
Merge pull request #94 from Uniswap/dev
Multiple small changes - need github to reflect current subgraph
2 parents 8798be5 + 11c85d1 commit 537e539

File tree

6 files changed

+20
-5
lines changed

6 files changed

+20
-5
lines changed

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
"build": "graph build",
99
"create-local": "graph create davekaj/uniswap --node http://127.0.0.1:8020",
1010
"deploy-local": "graph deploy davekaj/uniswap --debug --ipfs http://localhost:5001 --node http://127.0.0.1:8020",
11-
"deploy": "graph deploy ianlapham/uniswapv2 --ipfs https://api.thegraph.com/ipfs/ --node https://api.thegraph.com/deploy/ --debug",
11+
"deploy": "graph deploy ianlapham/uniswap-v2-rinkeby --ipfs https://api.thegraph.com/ipfs/ --node https://api.thegraph.com/deploy/ --debug",
1212
"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/",
1313
"watch-local": "graph deploy graphprotocol/Uniswap2 --watch --debug --node http://127.0.0.1:8020/ --ipfs http://localhost:5001"
1414
},

schema.graphql

+3-1
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,9 @@ type Pair @entity {
6868
# derived liquidity
6969
reserveETH: BigDecimal!
7070
reserveUSD: BigDecimal!
71-
trackedReserveETH: BigDecimal! # used for separating per pair reserves and global
71+
# used for separating per pair reserves and global
72+
trackedReserveETH: BigDecimal!
73+
7274
# Price in terms of the asset pair
7375
token0Price: BigDecimal!
7476
token1Price: BigDecimal!

src/mappings/factory.ts

+1
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ export function handleNewPair(event: PairCreated): void {
4545
token0.name = fetchTokenName(event.params.token0)
4646
token0.totalSupply = fetchTokenTotalSupply(event.params.token0)
4747
let decimals = fetchTokenDecimals(event.params.token0)
48+
4849
// bail if we couldn't figure out the decimals
4950
if (decimals === null) {
5051
log.debug('mybug the decimal on token 0 was null', [])

src/mappings/helpers.ts

+3
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,9 @@ export let BI_18 = BigInt.fromI32(18)
1818

1919
export let factoryContract = FactoryContract.bind(Address.fromString(FACTORY_ADDRESS))
2020

21+
// rebass tokens, dont count in tracked volume
22+
export let UNTRACKED_PAIRS: string[] = ['0x9ea3b5b4ec044b70375236a281986106457b20ef']
23+
2124
export function exponentToBigDecimal(decimals: BigInt): BigDecimal {
2225
let bd = BigDecimal.fromString('1')
2326
for (let i = ZERO_BI; i.lt(decimals as BigInt); i = i.plus(ONE_BI)) {

src/mappings/pricing.ts

+11-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/* eslint-disable prefer-const */
22
import { Pair, Token, Bundle } from '../types/schema'
33
import { BigDecimal, Address, BigInt } from '@graphprotocol/graph-ts/index'
4-
import { ZERO_BD, factoryContract, ADDRESS_ZERO, ONE_BD } from './helpers'
4+
import { ZERO_BD, factoryContract, ADDRESS_ZERO, ONE_BD, UNTRACKED_PAIRS } from './helpers'
55

66
const WETH_ADDRESS = '0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2'
77
const USDC_WETH_PAIR = '0xb4e16d0168e52d35cacd2c6185b44281ec28c9dc' // created 10008355
@@ -55,7 +55,11 @@ let WHITELIST: string[] = [
5555
'0x960b236a07cf122663c4303350609a66a7b288c0', //ANT
5656
'0xc011a73ee8576fb46f5e1c5751ca3b9fe0af2a6f', //SNX
5757
'0x0bc529c00c6401aef6d220be8c6ea1667f6ad93e', //YFI
58-
'0xdf5e0e81dff6faf3a7e52ba697820c5e32d806a8' // yCurv
58+
'0xdf5e0e81dff6faf3a7e52ba697820c5e32d806a8', // yCurv
59+
'0x853d955acef822db058eb8505911ed77f175b99e', // FRAX
60+
'0xa47c8bf37f92abed4a126bda807a7b7498661acd', // WUST
61+
'0x1f9840a85d5af5bf1d1762f925bdaddc4201f984', // UNI
62+
'0x2260fac5e5542a773aa44fbcfedf7c193bc2c599' // WBTC
5963
]
6064

6165
// minimum liquidity required to count towards tracked volume for pairs with small # of Lps
@@ -107,6 +111,11 @@ export function getTrackedVolumeUSD(
107111
let price0 = token0.derivedETH.times(bundle.ethPrice)
108112
let price1 = token1.derivedETH.times(bundle.ethPrice)
109113

114+
// dont count tracked volume on these pairs - usually rebass tokens
115+
if (UNTRACKED_PAIRS.includes(pair.id)) {
116+
return ZERO_BD
117+
}
118+
110119
// if less than 5 LPs, require high minimum reserve amount amount or return 0
111120
if (pair.liquidityProviderCount.lt(BigInt.fromI32(5))) {
112121
let reserve0USD = pair.reserve0.times(price0)

subgraph.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ dataSources:
3434
templates:
3535
- kind: ethereum/contract
3636
name: Pair
37-
network: mainnet
37+
network: rinkeby
3838
source:
3939
abi: Pair
4040
mapping:

0 commit comments

Comments
 (0)