Skip to content

Commit

Permalink
fix: build
Browse files Browse the repository at this point in the history
  • Loading branch information
matthewlilley committed Mar 18, 2021
1 parent 1b50efd commit 989e27c
Show file tree
Hide file tree
Showing 29 changed files with 1,318 additions and 476 deletions.
11 changes: 6 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
{
"name": "@sushiswap/subgraphs",
"private": "true",
"private": true,
"workspaces": [
"packages/*",
"subgraphs/*"
],
"nohoist": [
"**subgraphs/@graphprotocol/graph-ts/**"
],
"scripts": {
"build": "yarn workspaces foreach run build",
"codegen": "yarn workspaces foreach run codegen"
},
"devDependencies": {
"@graphprotocol/graph-cli": "^0.19.0",
"@graphprotocol/graph-ts": "^0.19.0",
Expand All @@ -19,4 +20,4 @@
"prettier": "^2.0.0",
"typescript": "^4.0.0"
}
}
}
10 changes: 6 additions & 4 deletions packages/abis/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,11 @@
"description": "Abis",
"license": "MIT",
"private": true,
"files": ["./*.json"],
"files": [
"./*.json"
],
"scripts": {
"codegen": ".",
"build": "."
"codegen": ".",
"build": "."
}
}
}
File renamed without changes.
22 changes: 11 additions & 11 deletions packages/constants/package.json
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
{
"name": "constants",
"version": "1.0.0",
"description": "Constants",
"license": "MIT",
"private": true,
"main": "constants.ts",
"scripts": {
"codegen": ".",
"build": "."
}
}
"name": "const",
"version": "1.0.0",
"description": "Constants",
"license": "MIT",
"private": true,
"main": "index.ts",
"scripts": {
"codegen": ".",
"build": "."
}
}
2 changes: 1 addition & 1 deletion packages/pricing/price.ts → packages/pricing/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import {
UNISWAP_WETH_USDT_PAIR_ADDRESS,
USDT_ADDRESS,
WETH_ADDRESS,
} from 'constants/'
} from 'const'
import { Address, BigDecimal, BigInt, ethereum, log } from '@graphprotocol/graph-ts'

import { Factory as FactoryContract } from 'exchange/generated/Factory/Factory'
Expand Down
30 changes: 15 additions & 15 deletions packages/pricing/package.json
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
{
"name": "pricing",
"version": "1.0.0",
"description": "Common logic and utilities to use throughout the project",
"license": "MIT",
"private": true,
"main": "price.ts",
"dependencies": {
"constants": "^1.0.0",
"exchange": "^1.0.0"
},
"scripts": {
"codegen": ".",
"build": "."
}
}
"name": "pricing",
"version": "1.0.0",
"description": "Common logic and utilities to use throughout the project",
"license": "MIT",
"private": true,
"main": "index.ts",
"dependencies": {
"const": "^1.0.0",
"exchange": "^1.0.0"
},
"scripts": {
"codegen": ".",
"build": "."
}
}
3 changes: 1 addition & 2 deletions subgraphs/bar/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,4 @@
"remove-local": "graph remove --node http://localhost:8020/ /sushiswap/sushiswap",
"deploy-local": "graph deploy --node http://localhost:8020/ --ipfs http://localhost:5001 /sushiswap/sushiswap"
}
}

}
4 changes: 2 additions & 2 deletions subgraphs/bar/src/bar.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import {
SUSHI_BAR_ADDRESS,
SUSHI_TOKEN_ADDRESS,
SUSHI_USDT_PAIR_ADDRESS,
} from '../../../packages/constants/constants'
} from 'const'
import { Address, BigDecimal, BigInt, dataSource, ethereum, log } from '@graphprotocol/graph-ts'
import { Bar, History, User } from '../generated/schema'
import { Bar as BarContract, Transfer as TransferEvent } from '../generated/SushiBar/Bar'
Expand Down Expand Up @@ -234,7 +234,7 @@ export function transfer(event: TransferEvent): void {
user.xSushiAgeDestroyed = user.xSushiAgeDestroyed.plus(xSushiAgeDestroyed)

// remove xSushiAge
user.xSushiAge = user.xSushiAge.minus(xSushiAgeDestroyed);
user.xSushiAge = user.xSushiAge.minus(xSushiAgeDestroyed)
// Update xSushi last
user.xSushi = user.xSushi.minus(value)

Expand Down
3 changes: 1 addition & 2 deletions subgraphs/dexcandles/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,4 @@
"remove-local": "graph remove --node http://localhost:8020/ /sushiswap/sushiswap",
"deploy-local": "graph deploy --node http://localhost:8020/ --ipfs http://localhost:5001 /sushiswap/sushiswap"
}
}

}
17 changes: 17 additions & 0 deletions subgraphs/exchange/packages/abis/ERC20NameBytes.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
[
{
"constant": true,
"inputs": [],
"name": "name",
"outputs": [
{
"internalType": "bytes32",
"name": "",
"type": "bytes32"
}
],
"payable": false,
"stateMutability": "view",
"type": "function"
}
]
17 changes: 17 additions & 0 deletions subgraphs/exchange/packages/abis/ERC20SymbolBytes.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
[
{
"constant": true,
"inputs": [],
"name": "symbol",
"outputs": [
{
"internalType": "bytes32",
"name": "",
"type": "bytes32"
}
],
"payable": false,
"stateMutability": "view",
"type": "function"
}
]
2 changes: 1 addition & 1 deletion subgraphs/exchange/src/exchange/enitites/bundle.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { BIG_DECIMAL_ZERO } from 'constants/'
import { BIG_DECIMAL_ZERO } from 'const'
import { BigDecimal } from '@graphprotocol/graph-ts'
import { Bundle } from '../../../generated/schema'

Expand Down
2 changes: 1 addition & 1 deletion subgraphs/exchange/src/exchange/enitites/factory.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Address, ethereum } from '@graphprotocol/graph-ts'
import { BIG_DECIMAL_ZERO, BIG_INT_ZERO, FACTORY_ADDRESS } from 'constants/'
import { BIG_DECIMAL_ZERO, BIG_INT_ZERO, FACTORY_ADDRESS } from 'const'
import { DayData, Factory } from '../../../generated/schema'

export function getFactory(id: Address = FACTORY_ADDRESS): Factory {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Address, BigDecimal, BigInt, ethereum } from '@graphprotocol/graph-ts'
import { BIG_DECIMAL_ZERO, BIG_INT_ZERO } from 'constants/'
import { BIG_DECIMAL_ZERO, BIG_INT_ZERO } from 'const'
import { LiquidityPosition, Pair } from '../../../generated/schema'

import { Pair as PairContract } from '../../../generated/templates/Pair/Pair'
Expand Down
2 changes: 1 addition & 1 deletion subgraphs/exchange/src/exchange/enitites/pair-day-data.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { BigDecimal, BigInt, ethereum } from '@graphprotocol/graph-ts'
import { Pair, PairDayData } from '../../../generated/schema'

import { BIG_DECIMAL_ZERO } from 'constants/'
import { BIG_DECIMAL_ZERO } from 'const'

export function updatePairDayData(event: ethereum.Event): PairDayData {
const timestamp = event.block.timestamp.toI32()
Expand Down
2 changes: 1 addition & 1 deletion subgraphs/exchange/src/exchange/enitites/pair-hour-data.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { BigDecimal, BigInt, ethereum } from '@graphprotocol/graph-ts'
import { Pair, PairHourData } from '../../../generated/schema'

import { BIG_DECIMAL_ZERO } from 'constants/'
import { BIG_DECIMAL_ZERO } from 'const'

export function updatePairHourData(event: ethereum.Event): PairHourData {
const timestamp = event.block.timestamp.toI32()
Expand Down
2 changes: 1 addition & 1 deletion subgraphs/exchange/src/exchange/enitites/pair.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Address, ethereum } from '@graphprotocol/graph-ts'
import { BIG_DECIMAL_ZERO, BIG_INT_ZERO, FACTORY_ADDRESS } from 'constants/'
import { BIG_DECIMAL_ZERO, BIG_INT_ZERO, FACTORY_ADDRESS } from 'const'

import { Pair } from '../../../generated/schema'
import { Pair as PairContract } from '../../../generated/templates/Pair/Pair'
Expand Down
2 changes: 1 addition & 1 deletion subgraphs/exchange/src/exchange/enitites/token-day-data.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { BigDecimal, BigInt, ethereum } from '@graphprotocol/graph-ts'
import { Token, TokenDayData } from '../../../generated/schema'

import { BIG_DECIMAL_ZERO } from 'constants/'
import { BIG_DECIMAL_ZERO } from 'const'
import { getBundle } from '.'

export function getTokenDayData(token: Token, event: ethereum.Event): TokenDayData {
Expand Down
2 changes: 1 addition & 1 deletion subgraphs/exchange/src/exchange/enitites/token.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Address, BigInt, log } from '@graphprotocol/graph-ts'
import { BIG_DECIMAL_ZERO, BIG_INT_ZERO, NULL_CALL_RESULT_VALUE } from 'constants/'
import { BIG_DECIMAL_ZERO, BIG_INT_ZERO, NULL_CALL_RESULT_VALUE } from 'const'

import { ERC20 } from '../../../generated/Factory/ERC20'
import { ERC20NameBytes } from '../../../generated/Factory/ERC20NameBytes'
Expand Down
2 changes: 1 addition & 1 deletion subgraphs/exchange/src/exchange/mappings/factory.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { getFactory, getPair } from '../enitites'

import { BIG_INT_ONE } from 'constants/'
import { BIG_INT_ONE } from 'const'
import { PairCreated } from '../../../generated/Factory/Factory'
import { Pair as PairTemplate } from '../../../generated/templates'

Expand Down
18 changes: 3 additions & 15 deletions subgraphs/exchange/src/exchange/mappings/pair.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,4 @@
import {
ADDRESS_ZERO,
BIG_DECIMAL_ZERO,
MASTER_CHEF_ADDRESS,
MINIMUM_USD_THRESHOLD_NEW_PAIRS,
WHITELIST,
} from 'constants/'
import { ADDRESS_ZERO, BIG_DECIMAL_ZERO, MASTER_CHEF_ADDRESS, MINIMUM_USD_THRESHOLD_NEW_PAIRS, WHITELIST } from 'const'
import { Address, BigDecimal, BigInt, log, store } from '@graphprotocol/graph-ts'
import { Burn, Mint, Pair, Swap, Token, Transaction } from '../../../generated/schema'
import {
Expand Down Expand Up @@ -267,10 +261,7 @@ export function onTransfer(event: TransferEvent): void {
}

// BURN
if (
event.params.from != ADDRESS_ZERO &&
event.params.from.toHex() != pair.id
) {
if (event.params.from != ADDRESS_ZERO && event.params.from.toHex() != pair.id) {
const fromUserLiquidityPosition = createLiquidityPosition(event.params.from, event.address, event.block)

fromUserLiquidityPosition.liquidityTokenBalance = fromUserLiquidityPosition.liquidityTokenBalance.minus(value)
Expand All @@ -281,10 +272,7 @@ export function onTransfer(event: TransferEvent): void {
}

// MINT
if (
event.params.to != ADDRESS_ZERO &&
event.params.to.toHex() != pair.id
) {
if (event.params.to != ADDRESS_ZERO && event.params.to.toHex() != pair.id) {
const toUserLiquidityPosition = createLiquidityPosition(event.params.to, event.address, event.block)

toUserLiquidityPosition.liquidityTokenBalance = toUserLiquidityPosition.liquidityTokenBalance.plus(value)
Expand Down
2 changes: 1 addition & 1 deletion subgraphs/exchange/src/exchange/pricing.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import {
USDT_WETH_PAIR,
WETH_ADDRESS,
WHITELIST,
} from 'constants/'
} from 'const'
import { Address, BigDecimal, BigInt, ethereum, log } from '@graphprotocol/graph-ts'
import { Pair, Token } from '../../generated/schema'

Expand Down
24 changes: 12 additions & 12 deletions subgraphs/lockup/package.json
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
{
"name": "lockup",
"license": "MIT",
"version": "1.0.0",
"author": "SushiSwap",
"scripts": {
"codegen": "graph codegen lockup.yaml",
"build": "graph build lockup.yaml",
"deploy": "graph deploy --node https://api.thegraph.com/deploy/ --ipfs https://api.thegraph.com/ipfs/ sushiswap/lockup lockup.yaml",
"create-local": "graph create --node http://localhost:8020/ /sushiswap/sushiswap",
"remove-local": "graph remove --node http://localhost:8020/ /sushiswap/sushiswap",
"deploy-local": "graph deploy --node http://localhost:8020/ --ipfs http://localhost:5001 /sushiswap/sushiswap"
}
"name": "lockup",
"license": "MIT",
"version": "1.0.0",
"author": "SushiSwap",
"scripts": {
"codegen": "graph codegen lockup.yaml",
"build": "graph build lockup.yaml",
"deploy": "graph deploy --node https://api.thegraph.com/deploy/ --ipfs https://api.thegraph.com/ipfs/ sushiswap/lockup lockup.yaml",
"create-local": "graph create --node http://localhost:8020/ /sushiswap/sushiswap",
"remove-local": "graph remove --node http://localhost:8020/ /sushiswap/sushiswap",
"deploy-local": "graph deploy --node http://localhost:8020/ --ipfs http://localhost:5001 /sushiswap/sushiswap"
}
}
13 changes: 11 additions & 2 deletions subgraphs/lockup/src/lockup.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,14 @@
import { Address, BigInt, ethereum, log } from '@graphprotocol/graph-ts'
import { BIG_DECIMAL_1E12, BIG_DECIMAL_1E18, BIG_DECIMAL_ZERO, BIG_INT_ONE, BIG_INT_ZERO, LOCKUP_BLOCK_NUMBER, LOCKUP_POOL_NUMBER, MASTER_CHEF_ADDRESS } from 'constants/'
import {
BIG_DECIMAL_1E12,
BIG_DECIMAL_1E18,
BIG_DECIMAL_ZERO,
BIG_INT_ONE,
BIG_INT_ZERO,
LOCKUP_BLOCK_NUMBER,
LOCKUP_POOL_NUMBER,
MASTER_CHEF_ADDRESS,
} from 'const'
import {
Deposit,
MasterChef as MasterChefContract,
Expand All @@ -8,7 +17,7 @@ import {
Withdraw,
} from '../generated/MasterChef/MasterChef'
import { Lockup, Pool, User } from '../generated/schema'
import { getSushiPrice } from 'pricing/'
import { getSushiPrice } from 'pricing'
import { Pair as PairContract } from '../generated/MasterChef/Pair'

export function getUser(pid: BigInt, address: Address, block: ethereum.Block): User {
Expand Down
8 changes: 1 addition & 7 deletions subgraphs/maker/src/maker.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,5 @@
import { Address, ByteArray, log } from '@graphprotocol/graph-ts'
import {
BIG_DECIMAL_1E18,
BIG_DECIMAL_ZERO,
FACTORY_ADDRESS,
SUSHI_BAR_ADDRESS,
SUSHI_MAKER_ADDRESS,
} from 'constants/'
import { BIG_DECIMAL_1E18, BIG_DECIMAL_ZERO, FACTORY_ADDRESS, SUSHI_BAR_ADDRESS, SUSHI_MAKER_ADDRESS } from 'const'
import { Maker, Server, Serving } from '../generated/schema'

import { ERC20 as ERC20Contract } from '../generated/Maker/ERC20'
Expand Down
4 changes: 2 additions & 2 deletions subgraphs/masterchef/src/masterchef.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@ import {
BIG_INT_ZERO,
MASTER_CHEF_ADDRESS,
MASTER_CHEF_START_BLOCK,
} from 'constants/constants'
} from 'const'
import { History, MasterChef, Pool, PoolHistory, User } from '../generated/schema'
import { getSushiPrice, getUSDRate } from 'pricing/price'
import { getSushiPrice, getUSDRate } from 'pricing'

import { ERC20 as ERC20Contract } from '../generated/MasterChef/ERC20'
import { Pair as PairContract } from '../generated/MasterChef/Pair'
Expand Down
Loading

0 comments on commit 989e27c

Please sign in to comment.