unlock
unlock copied to clipboard
Missing data on querying subgraph
Describe the bug
When you try to grab the totalSupply and maxNumberOfKeys, you will get 0 and null respectively.
This is on Rinkeby and the Unlock Rinkeby Subgraph here — https://thegraph.com/hosted-service/subgraph/unlock-protocol/unlock-rinkeby?selected=playground
To Reproduce Steps to reproduce the behavior:
- Go to unlock subgraph on thegraph explorer
- Run below query
{
locks(where : {address: "0xDea369C7Dd7CaC10267516C3CAc47a41B610D41E"}){
id,
name,
price,
expirationDuration,
totalSupply,
maxNumberOfKeys,
keys(where:{owner:"0xbe14c2f410ec78b64cbd54f72081533cb392a3d1"}){
id,
keyId
},
owner,
version
}
}
- Check for totalSupply and maxNumberOfKeys. Those will be 0 and null.
Expected behavior Proper values for totalSupply and maxNumberOfKeys
I'm not sure if this happens on other subgraph as well. We should confirm it.
Adding a few more details:
- The issue does appear to be on mainnet as well.
-
totalSupply
looks like it always equals0
. This query returns empty:
{
locks(where :{totalSupply_gt : 0}){
id,
name,
totalSupply,
maxNumberOfKeys,
version
}
}
-
maxNumberOfKeys : null
for lock contracts version 7 and greater. This query also returns empty:
{
locks(where :{maxNumberOfKeys_not : null, version_gt : 6}){
id,
name,
totalSupply,
maxNumberOfKeys,
version
}
}
I can't say this with any degree of certainty as I have no idea how the subgraph is deployed, but the maxNumberOfKeys
issue may be a simple fix. Looking at lockProcessing.ts, the processv7
function appears to be missing this line from processPreV7
:
lock.maxNumberOfKeys = chainPublicLock.maxNumberOfKeys()
so maxNumberOfKeys
is never set. If that's the case, would make sense why it's returning null
We now have a MUCH better subgraph infrastructure/backbone https://unlock-protocol.com/blog/subgraph-v2 which means it will now be MUCH easier to add missing fields...
Awesome, thanks @julien51 ! I noticed this the other day and it's in our queue to use the updated version. I'll let you know if we run into issues. Sincerely appreciate it.
Closing as I believe we now have the missing fields!