This has been moved to: Sushi 2.0 Subgraphs
sushiswap / sushiswap-subgraph Goto Github PK
View Code? Open in Web Editor NEWSushiswap Subgraph
Home Page: https://thegraph.com/explorer/subgraph/sushiswap/sushiswap
License: MIT License
Sushiswap Subgraph
Home Page: https://thegraph.com/explorer/subgraph/sushiswap/sushiswap
License: MIT License
This has been moved to: Sushi 2.0 Subgraphs
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.
We need to track user count on the bar to normalise some data.
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?
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
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)
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?
https://thegraph.com/hosted-service/subgraph/sushiswap/matic-exchange
In the last 3 days, the pairs#reserveUSD property has become zero. Are there any pricing service that is broken?
{
pairs(first: 5) {
id,
reserveUSD
}
}
1inch exchange has created a candles subgraph for Uniswap, we should use this and retrofit it for SushiSwap.
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?
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"
}
}
}
Maker is still configured to use an old address, the latest version of maker is 0xE11fc0B43ab98Eb91e9836129d1ee7c3Bc95df50
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.
reserve0, reserve1 are the same values over multiple swap data which is wrong
Unifying Uniswap and Sushiswap exchange data.
TBC ...
Grafting is currently disabled on the graph hosted service.
Hi, it would be great to see data regarding 24h fees inside the daily data on pairs, as is available on the official Sushi stats page: https://analytics.sushi.com/
Uni v3 subgraph also usefully provides this: https://thegraph.com/hosted-service/subgraph/uniswap/uniswap-v3
Thanks :)
Avalanche has native Graph integration via network: avalanche
. Would be good to get an analytics page going for the Avalanche deployment
SushiMaker subgraph is down here: https://thegraph.com/explorer/subgraph/sushiswap/sushi-maker
It was built off an older SushiMaker contract, so probably better off just updating it rather than deploying a fix for this one.
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 subgraph was accidentally synced for mainnet, needs redeploying for CELO
It was attempted to track xSUSHI age globally on the Bar entity and on a User level as well. Sadly there is a bug in the logic somewhere which would be great to fix.
You can see clearly the issue with xSUSHI age on the bar in this example query
https://thegraph.com/explorer/subgraph/matthewlilley/bar?query=Bug
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
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/",
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.
Spotted by this comment on discord: https://discord.com/channels/748031363935895552/748032044289753118/836877253543460875
Basically looks mints is always setting the to address as the SushiMaker address, and all burns are setting the to address as the SLP token.
*Think about it some of those might be right though, so this might need a little more digging into to see what's going on.
I am new to yarn and subgraphs, please help me out here.
cd
ing 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.
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
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.
all the data is frozen on FTM network.
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
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.
pnpm run prepare
to prepare all subgraphs
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'
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
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.