Giter Club home page Giter Club logo

sushiswap-subgraph's Introduction

sushiswap-subgraph's People

Contributors

0xgenghisgoose avatar clearwood avatar hhk-eth avatar jiro-ono avatar jona avatar lufycz avatar matthewlilley avatar omakasebar avatar rokso avatar the-real-astro avatar xavier59 avatar zippoxer avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

sushiswap-subgraph's Issues

Doesnt this always return zero?

export function findEthPerToken(token: Token): BigDecimal {

Ive added a logger here and it always seems to return zero. Like, always always.

This function seems to only be called in 2 places.

https://github.com/sushiswap/sushiswap-subgraph/blob/master/src/exchange/mappings/pair.ts#L338

and

https://github.com/sushiswap/sushiswap-subgraph/blob/master/src/exchange/mappings/pair.ts#L339

So unless im missing something, if derivedETH is never set anywhere else, itll do this expensive loop only to get a value and multiple it by another token with a derivedETH of 0, and there for always be zero.

Missing Pools from Query

This problem seems to have started a few days ago, the deployed subgraph seems to be missing pools on the MATIC network. For example, trying to query for the USDC-WETH pool (one of the most active) produces no results:

On sushi analytics: https://app.sushi.com/analytics/pools/0x34965ba0ac2451a34a0471f04cca3f990b8dea27?chainId=137
On polygonscan: https://polygonscan.com/token/0x34965ba0ac2451a34a0471f04cca3f990b8dea27
On sushiswap subgraph: https://thegraph.com/hosted-service/subgraph/sushiswap/matic-exchange
query:
{
pair(id:"0x34965ba0ac2451a34a0471f04cca3f990b8dea27")
{
id
}
}

result:
{
"data": {
"pair": null
}
}

I did notice if I switch to the "pending version" of the subgraph the I get a result to the query - was this a recently fixed issue?

Sushiswap Matic: Certain swap transactions not showing up anymore

Hi there,

I have a reference swap transaction on sushiswap matic exchange that can be found here: https://polygonscan.com/tx/0x27ca6dce7210626ab2c1fe8496b0619e1ae4c43ca70ae3d28675e863721e8a2f

Query url:
https://api.thegraph.com/subgraphs/name/sushiswap/matic-exchange

When I try to query that transaction using the below query I no longer see the swap in the results. This transaction was showing up for me in the past. I'm not sure what has changed recently.

{
  swaps(where : { transaction: "0x27ca6dce7210626ab2c1fe8496b0619e1ae4c43ca70ae3d28675e863721e8a2f" }){
    to
    sender
    timestamp
    amountUSD
    amount0In
    amount1In
    amount0Out
    amount1Out
  }
}

Unexpected Result:

{
  "data": {
    "swaps": []
  }
}

Let me know if this is not the right place for posting this issue.

Cheers

Consts issue

Hey guys im trying to try the build for your project and its throwing an error, not really sure what i should do, im running exchange,maker and masterchef subgraphs everything else is the same as the current branch. thanks in advance

Compile data source: Factory => build/Factory/Factory.wasm
✖ Failed to compile subgraph: Failed to compile data source mapping: Import file '~lib/const.ts' not found.
Error: Failed to compile data source mapping: Import file '~lib/const.ts' not found.
at Compiler._compileDataSourceMapping (/home/ares/blockchain/sushiswap-subgraph/node_modules/@graphprotocol/graph-cli/src/compiler.js:314:13)
at /home/ares/blockchain/sushiswap-subgraph/node_modules/@graphprotocol/graph-cli/src/compiler.js:207:20
at updateInDeepMap (/home/ares/blockchain/sushiswap-subgraph/node_modules/immutable/dist/immutable.js:1971:22)
at updateInDeepMap (/home/ares/blockchain/sushiswap-subgraph/node_modules/immutable/dist/immutable.js:1980:23)
at updateInDeepMap (/home/ares/blockchain/sushiswap-subgraph/node_modules/immutable/dist/immutable.js:1980:23)
at Map.updateIn (/home/ares/blockchain/sushiswap-subgraph/node_modules/immutable/dist/immutable.js:1278:26)
at /home/ares/blockchain/sushiswap-subgraph/node_modules/@graphprotocol/graph-cli/src/compiler.js:206:24
at /home/ares/blockchain/sushiswap-subgraph/node_modules/immutable/dist/immutable.js:3016:46
at List.__iterate (/home/ares/blockchain/sushiswap-subgraph/node_modules/immutable/dist/immutable.js:2206:13)
at IndexedIterable.mappedSequence.__iterateUncached (/home/ares/blockchain/sushiswap-subgraph/node_modules/immutable/dist/immutable.js:3015:23)

Sushiswap Exchange Goerli deployment

I'm trying to deploy a Goerli version of the SushiSwap Exchange Subgraph - https://github.com/sushiswap/sushiswap-subgraph/tree/master/subgraphs/exchange

When I build I get some warnings but no errors (sample below)

WARNING AS206: Compiling constant with non-constant initializer as mutable.
   const token1DayData = updateTokenDayData(token1 as Token, event)
         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 in src/mappings/pair.ts(658,8)

When I try to deploy I get the message

The current version of graph-cli can't be used with mappings on apiVersion less than '0.0.5'

After updating the apiVersion to 0.0.5 and deploying the following error appears

To use this version of the graph-cli you must upgrade the graph-ts dependency to a version greater than or equal to 0.22.0
Also, you'll probably need to take a look at our AssemblyScript migration guide because of language breaking changes: https://gist.github.com/otaviopace/8406cb39644d2e7678570d1e7f50dac4

(side note, that warning with a link to the migration guide is a 404 and should probably link to https://thegraph.com/docs/en/developer/assemblyscript-migration-guide/)

When I update the graph-ts to 0.22.0 the yarn build command fails with

✖ Failed to compile subgraph: Failed to compile data source mapping: Compile error
Error: Failed to compile data source mapping: Compile error
    at Compiler._compileDataSourceMapping (/Users/justinavery/Documents/GitHub/sushiswap-subgraph/node_modules/@graphprotocol/graph-cli/src/compiler.js:314:13)
    at /Users/justinavery/Documents/GitHub/sushiswap-subgraph/node_modules/@graphprotocol/graph-cli/src/compiler.js:207:20
    at updateInDeepMap (/Users/justinavery/Documents/GitHub/sushiswap-subgraph/node_modules/immutable/dist/immutable.js:1971:22)
    at updateInDeepMap (/Users/justinavery/Documents/GitHub/sushiswap-subgraph/node_modules/immutable/dist/immutable.js:1980:23)
    at updateInDeepMap (/Users/justinavery/Documents/GitHub/sushiswap-subgraph/node_modules/immutable/dist/immutable.js:1980:23)
    at Map.updateIn (/Users/justinavery/Documents/GitHub/sushiswap-subgraph/node_modules/immutable/dist/immutable.js:1278:26)
    at /Users/justinavery/Documents/GitHub/sushiswap-subgraph/node_modules/@graphprotocol/graph-cli/src/compiler.js:206:24
    at /Users/justinavery/Documents/GitHub/sushiswap-subgraph/node_modules/immutable/dist/immutable.js:3016:46
    at List.__iterate (/Users/justinavery/Documents/GitHub/sushiswap-subgraph/node_modules/immutable/dist/immutable.js:2206:13)
    at mappedSequence.__iterateUncached (/Users/justinavery/Documents/GitHub/sushiswap-subgraph/node_modules/immutable/dist/immutable.js:3015:23)
error Command failed with exit code 1.

Am I right in assuming that someone need to go back through the mappings /entities and fix the breaking changes moving from 0.19.0 - 0.22.0?

Example query to grab token price on a certain date?

Hi! I was wondering if someone could write an example query to grab a specific token's price on a certain day? I'm struggling to figure it out by looking through the schema and I'm not yet super familiar with GraphQL. Thank you!

I recognize that token price fluctuates a lot throughout the day, so maybe an average price, or a price at a specific time stamp?

Bug with Token Pricing

  • An issue was raised for the exchange subgraph, where someone noticed that the pricing or derivedETH property on the Token entity is about half as much as it should be.

  • The token is Badger and the bug can be seen with this query:

{
  token (id: "0x3472a5a71965499acd81997a54bba8d852c6e53d") {
    id
    name
    symbol
    derivedETH
  }
}

The result of the query at the time of writing this issue is here:

{
  "data": {
    "token": {
      "derivedETH": "0.007107683004521135948939587780566205",
      "id": "0x3472a5a71965499acd81997a54bba8d852c6e53d",
      "name": "Badger",
      "symbol": "BADGER"
    }
  }
}

Add Token & Pair entities to MasterChef Subgraph

  • Token & Pair entities will make it easier for displaying and searching for specific pools.

  • Token entities will consist of: id(address), symbol, and decimals.

  • Pair entities will consist of: id(address), token0 (token entity), token1 (token entity)

  • Probably will just need to add contracts calls when creating a new Pair to index the symbol, name, and address.

Unify Uniswap and Sushiswap exchange data.

Unifying Uniswap and Sushiswap exchange data.

Why

  • There are gaps and various inconsistencies in the exchange data due to migration, specifically for users which were locked in at migration.

How

  • Sync a copy of the exchange subgraph using the Uniswap data source, we call this the base subgraph.
    • The entire history is potentially important in the case that someone holding pair tokens for a long period deposited to Masterchef before migration.
    • We can greatly reduce the time for this graph to sync, by ignoring all pairs other than those which were migrated.
  • Once the base is synced we will graft the exchange subgraph, using the SushiSwap data source, on top of the base subgraph at block number of first migration.

TBC ...

Blockers

Grafting is currently disabled on the graph hosted service.

Avalanche subgraph

Avalanche has native Graph integration via network: avalanche. Would be good to get an analytics page going for the Avalanche deployment

Why was the pricing data forked into another subgraph?

I was assigned this graph project as a curator for thegraph. As a curator I would like to know why the pricing data was forked into another subgraph? What's the purpose of a subgraph that only supports MasterChef and MasterChefPool data?

I was hoping to use this subgraph and perhaps the uniswap subgraph to identify pairs with enough liquidity for arbitrage opportunities with minimal slippage.

Apologies if this is not the correct place to ask this question.

CELO blocks

CELO blocks subgraph was accidentally synced for mainnet, needs redeploying for CELO

Sushiswap Exchange Subgraph Build Error

Description

As described in the title, pulling the master branch and building it without any change causes compile error.

Reproduce Steps:

// git clone and cd

yarn install
yarn run codegen:exchange
yarn run build:exchange

Screenshot

image

BSC exchange

BSC exchange subgraph failed deployment, has pending version but appears like it will never catch up. It would be nice to redeploy with performance improvements added by @jona

Adding Staging Environments For Every Subgraph

We need staging environments for every subgraph.

Not sure if there is an actual staging environment for each subgraph. Found this pattern in package.json
of the uniswap-fork. If there isn't a staging environment, then just having staging subgraphs would be helpful and scripts to deploy them to their respective locations.

`"deploy-staging": "graph deploy $THE_GRAPH_GITHUB_USER/$THE_GRAPH_SUBGRAPH_NAME --ipfs https://api.staging.thegraph.com/ipfs/ --node https://api.staging.thegraph.com/deploy/",

Move remaining lockup logic from MasterChef into Lockup subgraph.

The Lockup subgraph is essentially a slimmed-down clone of MasterChef, which tracks SUSHI up until the point of Lockup and then freezes the state. This works well for calculating the unclaimed SUSHI at point of lockup, which is needed for some UI computation, but we have some logic inside MasterChef remaining which is tracking harvested SUSHI since lockup.

Ideally, this should all be removed from MasterChef and added to the Lockup subgraph, as right now we're forced to query both which is causing problems because when you withdraw all liquidity tokens from MasterChef, the relationship is removed.

Setup and deploy instraction didn't seem to work for me

I am new to yarn and subgraphs, please help me out here.

  • If I follow readme I am getting command not found error.
  • I did try cding into directory and running codegen command and getting below output.
➜  subgraphs/bar git:(master) yarn run codegen
yarn run v1.22.11
$ graph codegen subgraph.yaml
  Skip migration: Bump mapping apiVersion from 0.0.1 to 0.0.2 (graph-ts dependency not installed yet)
  Skip migration: Bump mapping apiVersion from 0.0.2 to 0.0.3 (graph-ts dependency not installed yet)
  Skip migration: Bump mapping apiVersion from 0.0.3 to 0.0.4 (graph-ts dependency not installed yet)
✖ Failed to apply migrations: ENOENT: no such file or directory, open 'subgraph.yaml'
error Command failed with exit code 1.

graphql file wasm.ts not found.

In many cases when I tried to deploy the compiled I stumbled with this error

graph deploy --ipfs http://localhost:5001 --node http://localhost:8020 sushiswap/master-chef build/subgraph.yaml

✔ Version Label (e.g. v0.0.1) · 
  Skip migration: Bump mapping apiVersion from 0.0.1 to 0.0.2 (graph-ts dependency not installed yet)
  Skip migration: Bump mapping apiVersion from 0.0.2 to 0.0.3 (graph-ts dependency not installed yet)
  Skip migration: Bump mapping apiVersion from 0.0.3 to 0.0.4 (graph-ts dependency not installed yet)
  Skip migration: Bump mapping specVersion from 0.0.1 to 0.0.2
✔ Apply migrations
✔ Load subgraph from build/subgraph.yaml
  Compile data source: MasterChef => build/MasterChef/MasterChef.wasm
✖ Failed to compile subgraph: Failed to compile data source mapping: Entry file 'MasterChef/MasterChef.wasm.ts' not found.
Error: Failed to compile data source mapping: Entry file 'MasterChef/MasterChef.wasm.ts' not found.
    at Compiler._compileDataSourceMapping (/home/cardano/.nvm/versions/node/v16.3.0/lib/node_modules/@graphprotocol/graph-cli/src/compiler.js:314:13)
    at /home/cardano/.nvm/versions/node/v16.3.0/lib/node_modules/@graphprotocol/graph-cli/src/compiler.js:207:20
    at updateInDeepMap (/home/cardano/.nvm/versions/node/v16.3.0/lib/node_modules/@graphprotocol/graph-cli/node_modules/immutable/dist/immutable.js:1971:22)
    at updateInDeepMap (/home/cardano/.nvm/versions/node/v16.3.0/lib/node_modules/@graphprotocol/graph-cli/node_modules/immutable/dist/immutable.js:1980:23)
    at updateInDeepMap (/home/cardano/.nvm/versions/node/v16.3.0/lib/node_modules/@graphprotocol/graph-cli/node_modules/immutable/dist/immutable.js:1980:23)
    at Map.updateIn (/home/cardano/.nvm/versions/node/v16.3.0/lib/node_modules/@graphprotocol/graph-cli/node_modules/immutable/dist/immutable.js:1278:26)
    at /home/cardano/.nvm/versions/node/v16.3.0/lib/node_modules/@graphprotocol/graph-cli/src/compiler.js:206:24
    at /home/cardano/.nvm/versions/node/v16.3.0/lib/node_modules/@graphprotocol/graph-cli/node_modules/immutable/dist/immutable.js:3016:46
    at List.__iterate (/home/cardano/.nvm/versions/node/v16.3.0/lib/node_modules/@graphprotocol/graph-cli/node_modules/immutable/dist/immutable.js:2206:13)
    at IndexedIterable.mappedSequence.__iterateUncached (/home/cardano/.nvm/versions/node/v16.3.0/lib/node_modules/@graphprotocol/graph-cli/node_modules/immutable/dist/immutable.js:3015:23)
/home/cardano/.nvm/versions/node/v16.3.0/lib/node_modules/@graphprotocol/graph-cli/node_modules/binaryen/index.js:7
if(n){p=__dirname+"/";var ea,fa;a.read=function(c,e){var b=q(c);b||(ea||(ea=require("fs")),fa||(fa=require("path")),c=fa.normalize(c),b=ea.readFileSync(c));return e?b:b.toString()};a.readBinary=function(c){c=a.read(c,!0);c.buffer||(c=new Uint8Array(c));assert(c.buffer);return c};1<process.argv.length&&(a.thisProgram=process.argv[1].replace(/\\/g,"/"));a.arguments=process.argv.slice(2);process.on("uncaughtException",function(c){if(!(c instanceof ha))throw c;});process.on("unhandledRejection",u);a.quit=
                                                                                                                                                                                                                                                                                                                                                                                                                                                                     ^

Error: ENOENT: no such file or directory, open 'MasterChef/MasterChef.wasm'
    at Object.openSync (node:fs:582:3)
    at Object.readFileSync (node:fs:450:35)
    at Compiler._validateMappingContent (/home/cardano/.nvm/versions/node/v16.3.0/lib/node_modules/@graphprotocol/graph-cli/src/compiler.js:402:21)
    at Compiler._compileDataSourceMapping (/home/cardano/.nvm/versions/node/v16.3.0/lib/node_modules/@graphprotocol/graph-cli/src/compiler.js:244:12)
    at /home/cardano/.nvm/versions/node/v16.3.0/lib/node_modules/@graphprotocol/graph-cli/src/compiler.js:207:20
    at updateInDeepMap (/home/cardano/.nvm/versions/node/v16.3.0/lib/node_modules/@graphprotocol/graph-cli/node_modules/immutable/dist/immutable.js:1971:22)
    at updateInDeepMap (/home/cardano/.nvm/versions/node/v16.3.0/lib/node_modules/@graphprotocol/graph-cli/node_modules/immutable/dist/immutable.js:1980:23)
    at updateInDeepMap (/home/cardano/.nvm/versions/node/v16.3.0/lib/node_modules/@graphprotocol/graph-cli/node_modules/immutable/dist/immutable.js:1980:23)
    at Map.updateIn (/home/cardano/.nvm/versions/node/v16.3.0/lib/node_modules/@graphprotocol/graph-cli/node_modules/immutable/dist/immutable.js:1278:26)
    at /home/cardano/.nvm/versions/node/v16.3.0/lib/node_modules/@graphprotocol/graph-cli/src/compiler.js:206:24 {
  errno: -2,
  syscall: 'open',
  code: 'ENOENT',
  path: 'MasterChef/MasterChef.wasm'
}

Can you understand what means? It only happens after the build when I try to deploy the subgraph.yaml

Improvements for Sushibar Subgraph

Currently, we use call handlers to listen for enter/exit calls on the SushiBar contract. This logic could be moved into an event handler for the ERC20 Transfer event to improve performance and lower overall cost. Another nice side benefit of this is that it would also allow us to detect when xSushi is transferred from one account to another and update the users accordingly.

FTM issue

all the data is frozen on FTM network.

Add tx creator for swaps in exchange subgraph

Request

Uniswap updated their subgraph for V2 adding an extra field from https://github.com/Uniswap/uniswap-v2-subgraph/blob/master/schema.graphql#L201 that contains the EOA that initiated the txn. Add this field to the sushiswap subgraph

Reason

When obtaining trades for an account in order to create a report we've found that there are transactions send to the account but created by a different address. In that cases this transaction shouldn't be considered but without that field is not possible to do this.

graph-cli not compatible with apiVersion

Hi, I face this issue when I try to build the exchange subgraph.

$ yarn run codegen
  yarn run v1.22.10
  graph codegen subgraph.yaml
  The current version of graph-cli can't be used with mappings on apiVersion less than '0.0.5'

Import file '~lib/const.ts' not found

Load subgraph from subgraph.yaml
Compile data source: Factory => build\Factory\Factory.wasm
× Failed to compile subgraph: Failed to compile data source mapping: Import file '~lib/const.ts' not found.
Error: Failed to compile data source mapping: Import file '~lib/const.ts' not found.
at Compiler._compileDataSourceMapping (Z:\08-Swap-Projects\20220824-black-swap\works\black-subgraph\node_modules@graphprotocol\graph-cli\src\compiler.js:314:13)
at Z:\08-Swap-Projects\20220824-black-swap\works\black-subgraph\node_modules@graphprotocol\graph-cli\src\compiler.js:207:20
at updateInDeepMap (Z:\08-Swap-Projects\20220824-black-swap\works\black-subgraph\node_modules\immutable\dist\immutable.js:1971:22)
at updateInDeepMap (Z:\08-Swap-Projects\20220824-black-swap\works\black-subgraph\node_modules\immutable\dist\immutable.js:1980:23)
at updateInDeepMap (Z:\08-Swap-Projects\20220824-black-swap\works\black-subgraph\node_modules\immutable\dist\immutable.js:1980:23)
at Map.updateIn (Z:\08-Swap-Projects\20220824-black-swap\works\black-subgraph\node_modules\immutable\dist\immutable.js:1278:26)
at Z:\08-Swap-Projects\20220824-black-swap\works\black-subgraph\node_modules@graphprotocol\graph-cli\src\compiler.js:206:24
at Z:\08-Swap-Projects\20220824-black-swap\works\black-subgraph\node_modules\immutable\dist\immutable.js:3016:46
at List.__iterate (Z:\08-Swap-Projects\20220824-black-swap\works\black-subgraph\node_modules\immutable\dist\immutable.js:2206:13)
at IndexedIterable.mappedSequence.__iterateUncached (Z:\08-Swap-Projects\20220824-black-swap\works\black-subgraph\node_modules\immutable\dist\immutable.js:3015:23)

I got this error when trying to deploy exchange subgraph.

Please let me know how I can solve this issue

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.